Repository navigation
fix(sessions): skip archive workers when no archive exists - #149506
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. Reviewed September 15, 2026, 11:23 PM ET / September 16, 2026, 03:23 UTC (Revision 3). ClawSweeper reviewWhat this changesChecks registered transcript metadata before starting an archive reader and extends the session-resume regression to verify that missing archives trigger no worker reads. Merge readiness✅ Ready for maintainer review Keep open: the optimization remains absent from current main, and the resolved integration preserves the merged settlement-test improvements. No blocking correctness or security findings remain; the previous merge-conflict blocker is resolved. Priority: P2 Review scores
Verification
How this fits togetherSubagent completion reads the selected run’s answer from its transcript, falling back to retained archives. The archive reader feeds that answer into parent settlement and wake-up. flowchart TD
A[Child run completes] --> B[Read live transcript]
B -->|Answer missing| C[Check registered archive metadata]
C -->|Absent| D[Return existing retained-result fallback]
C -->|Present| E[Worker reads and validates archive]
E --> F[Parent settlement and wake-up]
D --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +18, Tests +3. Total +21 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep archive existence checks in the existing session-history owner while retaining worker-based decoding and integrity validation for registered archives. Do we have a high-confidence way to reproduce the issue? Yes for unnecessary worker dispatch: current-main source unconditionally enters the worker path when an exact-run lookup falls back to an absent archive. The intermittent settlement timeout was reported in the supplied validation, not independently reproduced here. Is this the best way to solve the issue? Yes. Reusing the existing metadata query avoids empty worker startup without adding a cache, changing persisted data, or replacing the positive-read path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 472a5e958dec. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
ff401c7 to
71524e8
Compare
Check committed archive identities before dispatching the archive reader, while retaining the captured archive session and positive-read integrity checks. Missing child transcripts no longer start cold workers that keep subagent cleanup and requester-wake roots alive unnecessarily. The exact-run answer reads added by 31172cf exposed this timing race. The existing sessions.send yield/resume regression reproduced the residual root assertion on one of five clean-main runs; it now also asserts that this empty-archive flow never dispatches an archive reader. Validation: yield/resume test 5/5; archive-read suite 3/3; node scripts/check-changed.mjs; independent review clean through P2.
71524e8 to
a33bcfa
Compare
|
Merged via squash.
|
…149506) Check committed archive identities before dispatching the archive reader, while retaining the captured archive session and positive-read integrity checks. Missing child transcripts no longer start cold workers that keep subagent cleanup and requester-wake roots alive unnecessarily. The exact-run answer reads added by bca4493 exposed this timing race. The existing sessions.send yield/resume regression reproduced the residual root assertion on one of five clean-main runs; it now also asserts that this empty-archive flow never dispatches an archive reader. Validation: yield/resume test 5/5; archive-read suite 3/3; node scripts/check-changed.mjs; independent review clean through P2.
Related: #149223
What Problem This Solves
Fixes intermittent yield/resume settlement failures when a child session has no registered transcript archive.
Fixes the main CI failure in run 35028916689:
resumes a yielded child through sessions.send and wakes its original parentfailed withAssertionError: residual registry roots: expected 1 to be +0at head891d3732136.User Impact
Session completion and parent wake-up avoid unnecessary archive-reader startup when no archive exists. Reads for sessions with registered archives retain their existing behavior. No configuration changes or migration are required.
Why This Change Was Made
Regression introduced by #149223 (
31172cf5446). Requester settlement began awaiting exact-run answers, whose result lookup can fall back to transcript-archive reads. With no registered archive, that fallback still started archive read Workers—six observed in this fixture—holding completion and wake roots past the test-support's one-secondvi.waitFordeadline on slower hosts.Check the registered archive metadata in the agent database before starting a Worker and return
undefinedwhen none exists. The existing yield/resume regression also asserts that this empty-archive flow performs zero archive-worker reads.The test-side settlement stabilization landed separately in #149558. This PR preserves that stabilization, removes the root cause by avoiding archive Worker startup when no archive exists, and asserts that no worker is started.
Evidence
src/gateway/server-methods/sessions.send-yield-resume.test.tsreproduced the residual-root failure in 1 of 5 runs on clean main and passes 5 of 5 runs with the fix.node scripts/check-changed.mjsexited 0.After resolving the test conflict with #149558, the yield/resume regression passed 5 of 5 fresh runs and
node scripts/check-changed.mjsexited 0 on heada33bcfaeb8b1162f9d41dac63967e19849e0236d. Fresh Codex autoreview of the resolved integration returned scoped-clean.Exact-head CI run 35051123429, attempt 1, completed successfully on
a33bcfaeb8b1162f9d41dac63967e19849e0236d; the native CI watcher returned GREEN.