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] Native compaction treats non-completed JSON output as a successful rebase #6135
At e1e33a9, observeResponsesTerminalState returns completed for {"status":"incomplete","output":[]}. Failed, cancelled, queued and in_progress statuses also complete when an output array exists. Conversely, {"status":"completed","error":null,"output":[]} fails.
Impact
The relay uses this verdict to authorize native-compaction rebase. A false completion can clear context state on the next turn even when compaction did not complete; null error also suppresses a legitimate rebase.
Expected behavior
Explicit failure states should fail, pending or unknown statuses should remain unknown, and null error should allow successful output. Status-less compact endpoint objects should keep their existing behavior.
Verified patch
Nine regressions fail on unchanged source. The fix passes 27 targeted tests, including a local upstream/proxy checking actual pendingRebase state for five non-success statuses and successful null-error output. Typecheck and build pass. This extends #323's native-compaction gate; #2311 addresses preflight summaries.
查重: 不重复 — but before touching code I listed open [PR] rows: this thread already has a fix PR #6136 (opened by the reporter). Per the one-fix-PR-per-thread rule I did not open a second PR; I independently verified #6136 against the report instead.
Triage — verified live on current master:
Reproduced all six misjudged shapes through observeResponsesTerminalState: incomplete, failed, cancelled, queued, in_progress with an output array all return "completed"; {"status":"completed","error":null,"output":[]} returns "failed".
Root cause (src/stream-terminal.ts:104-108): the JSON path never reads status at all, and tests field presence (error !== undefined) rather than value — so OpenAI's standard success payload (error: null) fails while every non-success status completes.
Impact confirmed in code: src/server/relay.ts:2117 schedules the context rebase (markNativeCompactionBoundary) on any "completed" verdict — a false completion rebases onto a compaction that never happened and discards valid blocks (Fix Codex Responses session continuity #249 class); the null-error false-fail silently suppresses legitimate rebases.
Diff: a 3-line semantics change in observeJsonTerminalState only; the SSE branch is byte-identical; no config/wire/kernel/persistence changes. Status-less compact-endpoint objects stay supported (new test pins {object:"response.compaction", output:[…]} → completed).
Regression sweep over pre-existing behaviors: non-null error → failed (kept); no-error + output array → completed (kept); no output / unparseable / empty / oversized body → unknown (kept). Every new delta is either the intended fix or fail-closed.
Targeted suites on the PR head: 27/27 pass (unit + relay-level e2e asserting real pendingRebase state for all five non-success statuses and the null-error success case). Against unfixed source, exactly the 9 new semantic cases fail — the regressions have teeth.
Typecheck clean, build clean on the PR head. CI on 5caa9a1d: 27 success / 1 skipped / 0 failed. Base e1e33a97 is an ancestor of master with zero churn on the three touched files since.
Two small corrections I made directly (labeled commits / ops):
No test pinned that {"status":"completed","error":{…}} still fails (the error payload must outrank the completion claim). Added one unit row as additive commit e5235f1ef8 on the PR branch — tests only, no source change. CI re-runs on the new head.
The PR carried p2; per the severity policy, data-loss-class defects are p1 without downgrade — swapped to bug · p1 · codex · scope/kernel (issue side labeled the same).
⚠️ The last row is the one delta beyond the issue's letter ("status-less objects keep existing behavior"): the PR applies "explicit error: null = no error" uniformly rather than only on the completed path. No known provider emits error: null without a status field, so it is unobservable in current traffic — flagging it anyway so the owner can veto if they want the carve-out strict.
Sibling facet tracked separately: #6137/#6138 (truncated SSE terminal header) is a different mechanism (SSE branch, line splitting) and stays out of this fix — untouched here.
Verdict:#6136 is verified correct and complete for this issue — ready for your merge once CI goes green on e5235f1ef8. I can't merge PRs (system rules forbid it) — please merge yourself: #6136
Activity
test(ranxianglei#6135): pin that a completed claim carrying a real er…
ranxianglei commentedon Nov 10, 2026
(ai: opencode/qwen3.8-27b)
查重: 不重复 — but before touching code I listed open
[PR]rows: this thread already has a fix PR #6136 (opened by the reporter). Per the one-fix-PR-per-thread rule I did not open a second PR; I independently verified #6136 against the report instead.Triage — verified live on current master:
observeResponsesTerminalState:incomplete,failed,cancelled,queued,in_progresswith anoutputarray all return"completed";{"status":"completed","error":null,"output":[]}returns"failed".src/stream-terminal.ts:104-108): the JSON path never readsstatusat all, and tests field presence (error !== undefined) rather than value — so OpenAI's standard success payload (error: null) fails while every non-success status completes.src/server/relay.ts:2117schedules the context rebase (markNativeCompactionBoundary) on any"completed"verdict — a false completion rebases onto a compaction that never happened and discards valid blocks (Fix Codex Responses session continuity #249 class); the null-error false-fail silently suppresses legitimate rebases.Verification of PR #6136 (head
5caa9a1d):observeJsonTerminalStateonly; the SSE branch is byte-identical; no config/wire/kernel/persistence changes. Status-less compact-endpoint objects stay supported (new test pins{object:"response.compaction", output:[…]}→ completed).pendingRebasestate for all five non-success statuses and the null-error success case). Against unfixed source, exactly the 9 new semantic cases fail — the regressions have teeth.5caa9a1d: 27 success / 1 skipped / 0 failed. Basee1e33a97is an ancestor of master with zero churn on the three touched files since.Two small corrections I made directly (labeled commits / ops):
{"status":"completed","error":{…}}still fails (the error payload must outrank the completion claim). Added one unit row as additive commite5235f1ef8on the PR branch — tests only, no source change. CI re-runs on the new head.p2; per the severity policy, data-loss-class defects are p1 without downgrade — swapped tobug · p1 · codex · scope/kernel(issue side labeled the same).Behavior changes (old → new, all intentional):
status: failed / incomplete / cancelled(+ output)status: queued / in_progress / unrecognized / non-stringstatus: completed, error: null, output: […]error: null, output: […]error: null= no error" uniformly rather than only on the completed path. No known provider emitserror: nullwithout astatusfield, so it is unobservable in current traffic — flagging it anyway so the owner can veto if they want the carve-out strict.Sibling facet tracked separately: #6137/#6138 (truncated SSE terminal header) is a different mechanism (SSE branch, line splitting) and stays out of this fix — untouched here.
标签: bug · codex · scope/kernel · p1 —— 误判会让未完成的压缩触发上下文重基、丢弃有效块,属数据丢失类,按 2026-10-19 口径定 p1。
八问:
error !== undefined、output 数组在不在),从未读取 status;error: null被当成"有错误"。Verdict: #6136 is verified correct and complete for this issue — ready for your merge once CI goes green on
e5235f1ef8. I can't merge PRs (system rules forbid it) — please merge yourself: #6136ranxianglei commentedon Nov 12, 2026
Fixed in batch PR #6439 (merged).
test(ranxianglei#6135): pin that a completed claim carrying a real er…