Repository navigation
test(agents): prove live compaction from the successful direct read - #180236
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR disables Code Mode in the live compaction fixture and checks seed contents only in successful direct read results. Example: A seed read is rejected with offset 0, then a successful read supplies TOOL-MEMORY-A1B2C3D4.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it is a focused maintainer-authored test repair that preserves the compaction assertions, with no actionable correctness or security findings. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe live test invokes the embedded agent runner, reads synthetic file contents into conversation history, forces automatic compaction, and reopens SQLite state to verify marker recall. flowchart LR
A[Synthetic file] --> B[Direct read tool]
B --> C[Agent tool history]
C --> D[Automatic compaction]
D --> E[SQLite checkpoint]
E --> F[Reopened session recall]
Technical reviewBest possible solution: Use the existing direct-tool override and successful-read filter while retaining all compaction and SQLite replay assertions. Do we have a high-confidence way to reproduce the issue? Source supports the mismatch between Code Mode output and the fixture's raw-read premise, and the author reports matching scripted reproduction; this read-only review executed no target code. Is this the best way to solve the issue? The patch is the smallest complete fixture repair using existing owners: pin direct tools and exclude failed reads without changing the production read contract or weakening downstream assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 461123273058. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +7. Total +7 across 1 file. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 21, 2026, 11:22 PM ET / October 22, 2026, 03:22 UTC. |
Adapt 28 audited units to the release-native ownership model. Preserve AgentsAPI/cron policy and actor-owned projection recovery. Source provenance and original contributor credit: #176852 342fea1 — yinx65588-boop <[email protected]> #180853 50f795a — Peter Steinberger <[email protected]> #184041 e356196 — Peter Steinberger <[email protected]> #184069 7739767 — Peter Steinberger <[email protected]> #182666 9ff9d88 — Stefan Stüben <[email protected]> #183884 112667f — Peter Steinberger <[email protected]> #184021 05010ed — Peter Steinberger <[email protected]> #183390 15a5706 — Masato Hoshino <[email protected]> #183282 24d7dd3 — pstarkgit <[email protected]> #164843 127f3c2 — PollyBot13 <[email protected]> #172959 30f88d3 — main object unavailable; stable source inspected #172959 eb2255b — johan-eilertsen <[email protected]> #120943 1a76be1 — Peter Steinberger <[email protected]> #178271 b3c8f8a — Wang Rui <[email protected]> #178271 7bd6895 — RJ <[email protected]> #177518 679980c — Masato Hoshino <[email protected]> #182454 a538efe — Peter Steinberger <[email protected]> #180042 bef193c — sunlit-deng <[email protected]> #179347 2405bf4 — Peter Steinberger <[email protected]> #179060 ccedbdc — Peter Steinberger <[email protected]> #118011 9596527 — Peter Steinberger <[email protected]> #182219 fade14f — Sukhdeep <[email protected]> #181871 b1b5f00 — Peter Steinberger <[email protected]> #178888 5125e3c — RoboClaw <[email protected]> #180075 c9c2d16 — Wang Rui <[email protected]> #181081 f223f77 — Jason O'Neal <[email protected]> #180236 d11c239 — Dallin Romney <[email protected]> #173921 af50fbd — Peter Steinberger <[email protected]> #174868 7034ca4 — Peter Steinberger <[email protected]> #172724 492c932 — Dallin Romney <[email protected]> Proof: targeted owner/sibling tests, supported fresh two-pass review clean. Known qualification gaps recorded in the release backport evidence. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes: the release-only live test
agent-session.openai-compaction.live.test.ts> "automatically compacts tool history and resumes from its SQLite checkpoint" failing its seed check when the model's firstreadcall passesoffset: 0, or when the model keeps the file marker out of its context.User Impact
There is no user-visible change. This removes a flaky failure from the release live lane (Native live agents) without weakening what the lane proves.
Why This Change Was Made
Root cause. The runner leaves
tools.codeModeat its default"auto"tier, and that tier engages Code Mode forgpt-5.6-luna. The offline replay below confirms it: the model-visible tools wereexecandwait. The seed transcript therefore holds Code Modeexecresults, not rawreadoutput. In those results the model decides what the script returns. The two recorded failures follow from that:read({ offset: 0 })and was rejected (offset: must be >= 1; received 0). The retry cell then read the file, saved the marker with the gueststore(), and returned only{"markerStored":true}. The session store stays outside model context, so no tool result carried the marker, andexpect(suppliedText).toContain(marker)failed. Line 325 onrelease/2026.10.6.This test owns compaction of tool history and SQLite replay, not Code Mode orchestration. Its premise is that the file contents reach the model through tool history and then survive compaction.
Fix.
codeModeOverride: false, as the other runner live tests already do. Thereadresult is then the file text in tool history.readresults (toolName === "read" && !isError), so a rejected first call such as offset 0 does not count and does not break the check.Every downstream assertion is unchanged: compaction checkpoint summary contains the marker, no tool results after compaction, the compact and replay replies equal the marker, and the replay stays under budget.
readwith offset 0: no product change.offsetis documented as a 1-based start line. The model already seesoffset?: number /* integer, >= 1 */in the Code Mode quick index and the schemaminimum: 1on the direct tool. The rejection names the field, the received value, and the expected input. In the recorded case the model self-corrected in one turn. Treating 0 as "from start" would add a second spelling for line 1, and it would hide 0-based callers whoseoffset: 5silently reads one line early. The owner contract is coherent as it stands.Evidence
OPENAI_API_KEYwas available locally. I wrote a scratch harness (not committed) that runs this file's actual test body. It setsOPENCLAW_LIVE_OPENAI_COMPACTION=1and usesconfigureAiTransportHost({ buildModelFetch })to serve scripted OpenAI Responses SSE, covering the seed, compaction summary, compact, and replay requests.store()cell returning{markerStored:true}): the test fails atexpect(suppliedText).toContain(marker)with the same error text as the release run.readcalled withoffset: 0, thenread, thenSTORED: the whole live test passes. Output:budget=10420 compactions=1 replayTokens=3037 sqliteReplay=passed toolMarker=preserved. The request log showsreadexposed directly (noexec).expected '' to contain 'TOOL-MEMORY-…', so the contract is not weakened.pnpm test src/agents/sessions/agent-session.openai-compaction.live.test.ts --maxWorkers=1takes 1.7s wall time and reports "No test files found": default suites exclude live files, so there is no CI cost outside the live lane. The offline replay ran the test body in about 9.3s.tsgo(test/tsconfig/tsconfig.core.test.agents-sessions.json), oxlint,run-format --check, andgit diff --checkare all clean. Autoreview (Codex, P2 threshold) came back scoped-clean.origin/release/2026.10.6(git merge-treeexit 0).