Repository navigation
fix(context-engine): long sessions continue past 20k events - #122149
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 1:53 PM ET / 17:53 UTC. ClawSweeper reviewWhat this changesThis PR removes the provisional duplicate durable context-engine callback and makes accepted-turn commits and recovery deliver only the admitted-to-terminal transcript range. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep open for normal protected-PR handling: the prior type-check finding is fixed, and the branch consistently uses one bounded durable commit contract; exact-head CI is still running. Priority: P2 Review scores
Verification
How this fits togetherThe agent harness records an accepted transcript turn, bounds its messages, and queues a durable context-engine commit. The outbox retries that same commit after interruption, so live and recovery paths must provide identical payload semantics to the plugin. flowchart LR
A[Session transcript] --> B[Accepted turn]
B --> C[Bounded range reader]
C --> D[Durable commit outbox]
D --> E[Context-engine callback]
E --> F[Plugin context state]
D --> G[Restart recovery]
G --> E
Before merge
Agent review detailsSecurityNone. PR surfaceSource -77, Tests -111, Docs -19, Generated 0. Total -207 across 32 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the single atomic-idempotent contract after exact-head CI succeeds, keeping bounded transcript reads at the producer and the same projection in recovery rather than retaining an unreleased compatibility branch. Do we have a high-confidence way to reproduce the issue? Yes in source: the focused regression fixture creates an over-8 MiB historical prefix followed by a small accepted turn and verifies that only the new turn is committed; this read-only review did not execute it. Is this the best way to solve the issue? Yes. The PR repairs the range producer and its live and recovery consumers, while bootstrap/rebuild keep the existing cursor API; retaining the duplicate unshipped callback would preserve unnecessary policy branches. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d9766c3d5723. 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
HistoryReview history (1 earlier review cycle)
|
a58f1ed to
c67897c
Compare
|
Addressed the ClawSweeper review on exact head
Exact-head CI is running. The PR description now contains the durable evidence record. |
c67897c to
a9a7dca
Compare
a9a7dca to
d8d9f59
Compare
d8d9f59 to
f8b5840
Compare
…#122149) * oc-5b3: canonicalize durable commitTurn * oc-deb: remove stale commitTurn test fields
Related: #121647
What Problem This Solves
Fixes an issue where context-engine plugins implementing
commitTurn(...)receive the complete session prefix for every accepted turn. Once that prefix exceeds 20,000 events or 8 MiB, durable advancement is blocked even when the new turn is small.The interim repair added
commitTurnLocal(...)besidecommitTurn(...)and persisted which method recovery should call. The originalcommitTurn(...)contract was not included in a public release, so the duplicate API and recovery paths do not serve a released compatibility requirement.Why This Change Was Made
commitTurn(...)now receives only messages from the accepted turn's admission event through its terminal event. The existing 20,000-event and 8 MiB sentinel limits remain in place and apply to that bounded range. Transcript bootstrap and rebuild continue to use the bounded cursor API.The change removes
commitTurnLocal(...), persisted contract discrimination, and legacy recovery dispatch so live commits and recovered commits use the same payload and method.User Impact
Long sessions continue advancing context-engine state after their total history exceeds 20,000 events. A single accepted turn that exceeds the event or byte limit remains blocked as an explicit resource-safety outcome.
Plugin developers implement one durable commit method. This changes no contract included in a public release.
AI-assisted with Codex. I reviewed the implementation and understand the resulting commit, recovery, and bootstrap behavior.
Evidence
node scripts/run-vitest.mjs src/agents/harness/context-engine-turn-attempt.test.ts src/agents/harness/context-engine-turn-outbox.test.ts src/context-engine/host-compat.test.ts src/context-engine/context-engine.test.tspassed 81 tests.node scripts/run-vitest.mjs src/context-engine/host-param-projection.test.ts src/agents/harness/context-engine-turn-attempt.test.ts src/agents/harness/context-engine-turn-outbox.test.tspassed 19 tests on the rebased head.pnpm check:test-typespassed on the rebased head.pnpm plugin-sdk:api:checkpassed on the rebased head..agents/skills/autoreview/scripts/autoreview --mode localreported no actionable findings with 0.99 correctness confidence.Agent Transcript
Redacted Codex session transcript