Repository navigation
[PR] fix(codex): rebase ACP state when codex replays an opaque native compaction checkpoint - #4937
ranxianglei wants to merge 11 commits into
Conversation
…ckpoint (#4929) Codex's newer local auto-compact lands as a native Responses compaction item with an opaque encrypted_content instead of the legacy textual summary. The kernel projection drops it into the preamble (no core id ever exists for it), so the host's text-prefix detector could never see it: covered fold ids vanished from the resent history, drift escalation latched the fold-epoch confirmation, and preflight paused forever — the old history never returns to the wire, so the latch could never clear. Detect the structural wire shape itself (type=compaction + non-empty string encrypted_content, bili-generated items excluded), hash the blob undecoded (sha256) as its persisted identity, and rebase through the existing native-compaction boundary path once per distinct checkpoint — only when fold coverage was actually lost by majority rule or the substrate is empty. First observation with fully intact coverage preserves current folds; repeated echoes and cold loads of a known identity are no-ops, retaining later folds. Marker-decisive per #2193: no absolute missing-id floor, since a provider-issued opaque wire item cannot be forged by user text (the 8-id floor exists only to disambiguate pasteable text). Host-only; legacy text path untouched.
…controls Main e2e: 4-id fold (below the 8-id legacy floor) + latched epoch-confirm + stale usage baseline; codex replays [opaque checkpoint, retained tail] -> boundary reconciled once in-request, identity persisted, refs re-seeded onto the compacted view above the pinned floor, latch cleared, baseline reset, checkpoint forwarded byte-exact, new folds created afterwards, echo does not re-rebase. Cold-load e2e: persisted identity survives a restart, echo retains later folds. Controls: non-codex UA, bili-generated item, malformed shapes, intact coverage.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7397-pr.4937.a822494This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4937.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复——#4599 核对 master 侧 unused-exports 门禁为绿(近期同款红均为各 PR 自伤,如 #4839/#4849),本红无既有修复条目,直接在本分支修。两次红(head b53d7b0 与 merge-guard 并入 master 后的 04a3e4d)签名逐字相同,排除基线漂移。 是什么问题:PR 新增的 什么原因导致的:函数在 PR 内只被同文件的 影响范围与严重程度:仅 CI 门禁层面,零运行时影响(纯去导出关键字,不改任何行为);严重度 = 不修则 PR 无法合入。 怎么修复的:去掉前导 是否有回归问题:无。全仓 grep 确认该符号仅出现两处(定义 + 文件内调用),无任何 import 引用(含测试),去掉 是否破坏缓存:不涉及(未触碰缓存、重试、增量游标、去重键)。 是否改了设计方向:不涉及。 是否引入了新的配置:不涉及。 收工判定:修复已推送,等 CI 全量在新 head 上跑完;若其余车道绿,本 PR 即可进入合并评审。 |
(ai: vllm-qwen/qwen3.8-27b) Merge-guard resync done: master moved twice while CI ran, so the branch was synced in two clean zero-overlap merges — first |
(ai: vllm-qwen/qwen3.8-27b) Synced origin/master (through e5e2108) into this branch — clean merge, no conflicts; pushed c2b9972. PR is now mergeable=true (was "behind"), merge state blocked only on the 23 queued CI checks; targeted regression suite tests/issue4929-codex-opaque-checkpoint.test.ts passes 7/7 locally on the merged head. |
🔶 需要决策 PR #4937 collides with an already-merged fix for the SAME issue (#4929) — this is a semantic collision, not a mechanical text conflict. I attempted to rebase the PR onto current master ( Background
The two implementations
Key semantic differences
Options
Recommendation + default: A — close PR #4937 as redundant. Rationale: master's fix is merged and shipped, first-come-first-served, and #4929's purpose is already served by master. If the owner values the PR's majority-rule / observability improvements, that is a separate small follow-up (Option C), not a reason to keep this conflicting PR. If no decision is made, the default is A: I make no code changes, no force-push, and do not close the PR — waiting for the owner's call. 结构化八问(中文)
判定:需要 owner 拍板选 A/B/C;默认 A(关闭 PR #4937 为冗余,master 的 |
[bot] 🏷 Status: merge conflict is still a semantic "which implementation wins" decision — blocked on the owner's A/B/C call (floor 36, still pending). This run I re-verified the live state and re-ran the dry-run merge to confirm nothing has changed since the run-1 decision request:
Separately (from the previous CI-failure run): the red check What I did NOT do (by design, pending the decision): no code changes, no force-push, no close. The Waiting for the owner's call on floor 36 (A/B/C):
结构化八问(中文)
收工判定:本轮无代码改动、无 push、无关闭。冲突与 CI 红都卡在 floor 36 的 A/B/C 决策上,等 owner 拍板;默认 A(关闭 PR #4937 为冗余,master 的 |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
1 similar comment
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
5 similar comments
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
[bot] 🏷 Status: unchanged — merge conflict is still the same semantic "which implementation wins" decision, blocked on the owner's A/B/C call (floor 36, still pending). This run I re-verified the live state (master has moved again since the last check):
What I did NOT do (by design, pending the decision): no code changes, no force-push, no close. The Waiting for the owner's call on floor 36 (A/B/C):
结构化八问(中文)
收工判定:本轮无代码改动、无 push、无关闭。冲突卡在 floor 36 的 A/B/C 决策上,等 owner 拍板;默认 A(关闭 PR #4937 为冗余,master 的 |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
1 similar comment
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
[bot] 🏷 Status: unchanged. Re-verified live this run — nothing has moved since floor 76:
No code changes, no push, no close. Waiting on floor 36 (A/B/C). Default = A (close PR #4937 as redundant — master's 结构化八问(中文)
收工判定:等 owner A/B/C 拍板,默认 A。 |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
[bot] 🏷 Status: unchanged. Re-verified live this run — nothing has moved since floor 83:
No code changes, no push, no close. Waiting on floor 36 (A/B/C). Default = A (close PR #4937 as redundant — master's 结构化八问(中文)
收工判定:等 owner A/B/C 拍板,默认 A。 |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
[bot] 🏷 Status: unchanged. Re-verified live this run — nothing has moved since floor 87:
No code changes, no push, no close. Waiting on floor 36 (A/B/C). Default = A (close PR #4937 as redundant — master's 结构化八问(中文)
收工判定:等 owner A/B/C 拍板,默认 A。 |
[ework] auto-fix stalled: test (windows-latest, 22, 5) — stopping for human review |
Closes #4929
Problem
Codex's newer local auto-compact lands as a native Responses
compactioninput item with an opaqueencrypted_contentinstead of the legacy textual summary message. The kernel projection drops it into the preamble — no core id ever exists for it — so the host's text-prefix detector (carriesCodexLocalCompactionSummary) can never see it. Covered fold ids vanish from the resent history → drift escalation latches fold-epoch confirmation → preflight pauses forever (the old history never returns to the wire, so the latch cannot clear on its own), and the stale usage baseline survives.Fix (host-only)
src/codex-compact.ts: detect the structural wire shape itself —type === "compaction"+ non-empty stringencrypted_content, with bili-generated items (fc_bili_*ids /bili:acp:blobs) excluded. Identity = sha256 of the raw blob, undecoded.src/server/prepare-responses.ts: when a NEW identity lands on the codex lane, persistmetadata.codexCheckpointFpand rebase through the existing native-compaction boundary path (mark + reconcile within the same request) — only when fold coverage was actually lost by majority rule (missing*2 >= expected) or the substrate is empty. First observation with fully intact coverage preserves current folds; repeated echoes and cold loads of a known identity are no-ops.The legacy text path is untouched (older codex builds keep working). No kernel change, no config-surface change, no version bump. Complements #4260/#4261 (snapshot retention) and #4486/#4487 (async summary-target validation); does not disable the high-pressure native fallback.
Behavior-change disclosure
codexCheckpointFp(sha256 hex string) — additive; every other code path ignores it, and pre-existing session files load fine (absent key = no checkpoint observed yet).Tests
tests/issue4929-codex-opaque-checkpoint.test.ts(7 tests): main e2e (4-id fold below the legacy 8-id floor + latched epoch-confirm + stale baseline → single in-request reconciliation, byte-exact checkpoint forwarding upstream, new folds created afterwards, echo does not re-rebase), cold-load e2e (persisted identity survives a restart, echo retains later folds), controls (non-codex UA / bili-generated item / malformed shapes / intact coverage).tests/codex-local-compaction.test.ts5/5,issue2592-rebase-floor+native-compact-terminal+issue2709-dsh-native-compaction-attribution14/14, typecheck clean. Full-suite verdict deferred to CI.Not claimed (per the issue): genuine provider checkpoint acceptance and production recovery — synthetic transport/persistence coverage only.