You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] A truncated native-compaction SSE terminal header can authorize a rebase #6137
At e1e33a9, pass observeResponsesTerminalState an SSE stream containing only "event: response.completed" and one newline. It reports completed even though no data or blank-line dispatch boundary arrived. A complete data line without the final blank line also completes; malformed JSON is accepted beneath a completed header.
Impact and expected behavior
The relay uses this verdict to authorize native-compaction rebase. A truncated terminal event can leave the client retaining history while the proxy schedules that context state to be cleared. Only complete dispatchable terminal events should authorize rebase. Multiline data and supported line endings must work across chunks, and explicit failure data must override a conflicting success header.
Verified patch
Assemble full SSE frames using the existing line-ending helpers and parse joined data before classifying. Nine new cases fail against unchanged source. All 26 targeted tests, including local upstream/proxy integration, typecheck and build pass. This addresses event boundaries in #323, independently of summary extraction and whole-body JSON status.
Duplicate screening: not a duplicate — and PR #6138 already targets this thread. Searched open+closed issues/PRs for the same symptom/mechanism (truncated terminal frame authorizing rebase): no other matching item; #6137 stands alone. @Afloat16's PR #6138 ("fix: classify native compaction only from complete SSE events", base e1e33a9, head d48b0a9) is the verified patch this issue describes — same repro, same nine-case suite, same base sha. Per the one-fix-PR-per-thread rule I will NOT open a parallel PR; I am reviewing and independently verifying #6138 against this issue's acceptance criteria instead.
Triage — defect confirmed at source level:
src/stream-terminal.ts:17-36 (terminalFromSseLine): a bare event: response.completed line returns "completed" immediately — before any data line and before the blank-line dispatch boundary. All three reported repro shapes (header-only line; data line without final blank line; malformed JSON beneath a completed header) hit this early-return path.
Impact chain confirmed at src/server/relay.ts:2116-2119: terminal === "completed" → markNativeCompactionBoundary(session) → "rebase scheduled for next Responses turn". A false "completed" on a truncated stream rebases onto a compaction the client never received — the Fix Codex Responses session continuity #249 valid-blocks-discarded failure mode.
Next: running the nine framing cases against master (expect fail) and against #6138's head (expect pass), plus the existing terminal suites, typecheck/build, and CI status. Structured review (八问) to follow in this thread.
Labels: bug / scope/wiring / p1 — silent context-state loss class (false rebase discards valid blocks), narrow trigger window but data-loss severity per the 2026-10-19 p1 ruling.
Activity
ranxianglei commentedon Nov 10, 2026
(ai: vllm-qwen/qwen3.8-27b)
Duplicate screening: not a duplicate — and PR #6138 already targets this thread. Searched open+closed issues/PRs for the same symptom/mechanism (truncated terminal frame authorizing rebase): no other matching item; #6137 stands alone. @Afloat16's PR #6138 ("fix: classify native compaction only from complete SSE events", base e1e33a9, head d48b0a9) is the verified patch this issue describes — same repro, same nine-case suite, same base sha. Per the one-fix-PR-per-thread rule I will NOT open a parallel PR; I am reviewing and independently verifying #6138 against this issue's acceptance criteria instead.
Triage — defect confirmed at source level:
src/stream-terminal.ts:17-36(terminalFromSseLine): a bareevent: response.completedline returns"completed"immediately — before any data line and before the blank-line dispatch boundary. All three reported repro shapes (header-only line; data line without final blank line; malformed JSON beneath a completed header) hit this early-return path.src/server/relay.ts:2116-2119:terminal === "completed"→markNativeCompactionBoundary(session)→ "rebase scheduled for next Responses turn". A false "completed" on a truncated stream rebases onto a compaction the client never received — the Fix Codex Responses session continuity #249 valid-blocks-discarded failure mode.Next: running the nine framing cases against master (expect fail) and against #6138's head (expect pass), plus the existing terminal suites, typecheck/build, and CI status. Structured review (八问) to follow in this thread.
Labels: bug / scope/wiring / p1 — silent context-state loss class (false rebase discards valid blocks), narrow trigger window but data-loss severity per the 2026-10-19 p1 ruling.
ranxianglei commentedon Nov 12, 2026
Fixed in batch PR #6439 (merged).