Repository navigation
fix: keep CLI compaction on rotated context-engine sessions - #117250
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 2:01 AM ET / 06:01 UTC. ClawSweeper reviewWhat this changesThe branch moves context-engine compaction successor interpretation into one shared resolver so both CLI and queued compaction retain the correct rotated session transcript and reject binding changes. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Keep this PR open for explicit maintainer handling. The patch consolidates two successor interpreters at the session-owner boundary and adds focused rejection coverage; I found no discrete source-level correctness defect. The Priority: P2 Review scores
Verification
How this fits togetherContext-engine plugins compact agent transcripts and may return a successor identity. Both queued agent runs and the CLI post-turn path must validate that identity before maintenance and persisted resume state continue on the same agent, session key, and SQLite store. flowchart LR
A[CLI or queued compaction] --> B[Context-engine plugin result]
B --> C[Shared successor resolver]
C --> D[Agent session binding validation]
D --> E[Context-engine maintenance]
D --> F[Persisted resume state]
E --> G[Next agent turn]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource -41, Tests +203. Total +162 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one canonical successor resolver, then complete direct Codex-source verification and publish a redacted after-fix CLI/Testbox transcript showing a deprecated successor rotates maintenance and persisted resume state to the new transcript. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main has separate CLI and queued successor handling, while the new focused cases exercise the missing CLI compatibility path and invalid binding variants. No local test was run because this review is read-only. Is this the best way to solve the issue? Yes, conditionally: centralizing successor interpretation at the shared session-target boundary is the narrowest maintainable repair, provided direct Codex contract inspection and after-fix runtime proof confirm the stated compatibility claim. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1f40646f7e05. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where CLI-backed sessions could ignore a rotated transcript when a shipped third-party context engine reported its successor through the deprecated
sessionFileresult. The queued compaction path validated and adopted that successor, but the CLI post-turn path only handled typed targets and session IDs, so maintenance and persisted resume state could remain attached to the old transcript.Why This Change Was Made
Compaction successor interpretation now has one canonical internal owner shared by queued and CLI compaction. It preserves typed-target precedence, partial-target inheritance, legacy SQLite-marker and
agent:key compatibility, and the invariant that a successor cannot change the active agent, session key, or store path. Native harness routing, context-engine hooks/auth/timeouts, checkpointing, cancellation precedence, and store mutation remain in their existing dispatchers.User Impact
CLI sessions using context-engine plugins now continue on the correct compacted transcript, including plugins on the shipped deprecated successor contract. Invalid cross-agent, cross-key, cross-store, and conflicting-ID successors are rejected consistently in both compaction entrypoints.
Production delta: 193 additions / 234 deletions, net -41 lines. Tests are counted separately.
Evidence
tbx_01kyxxt18fvcapc39rzmjs047e: 169 focused tests passed (cli-compaction,compact.hooks, and compaction rotation).0fbb55a36ca4eb6344be6df44fb7cfcb94ab0c1f: fullpnpm check:changedpassed, including formatting, oxlint, core/core-test tsgo, SDK API, deprecated API, plugin boundaries, dead exports, database-first, schema, and import-cycle guards.gpt-5.6-solat xhigh, clean with no accepted/actionable findings.Inspectable after-fix runtime proof
A trusted Blacksmith Testbox ran the real exported CLI lifecycle against an ephemeral SQLite session store and a context-engine implementation returning each shipped deprecated successor shape. The only redaction below is the random temporary directory. Run 30687019376, lease
tbx_01kyxyqy2js4yynxcnzz0g4ct5, exit 0.This directly shows both deprecated result shapes reaching maintenance with the bound
agentId/sessionKey/storePath, and the next persisted resume resolving to the successor session ID.Direct upstream Codex contract proof
Personally inspected sibling
openai/codexat07490c75234ed3c63291a8eb7629f04f647038fa. Explicit app-server compaction remains native:Automatic compaction remains inline before sampling:
Therefore this PR does not alter
thread/compact/starttoOp::Compact, pre-sampling automatic compaction, or introduce a generic OAuth fallback.AI-assisted: yes. I reviewed the implementation, contracts, and validation results.