Repository navigation
fix: preserve requester wakes after settlement publication failures - #160472
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 29, 2026, 2:57 AM ET / 06:57 UTC (Revision 8). ClawSweeper reviewWhat this changesMoves child-agent requester-wake writes into the SQLite worker and adds receipt-backed recovery when committed settlement cannot be published immediately. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main still performs requester-wake persistence on the Gateway thread, so the branch has distinct work to land. The previously raised terminal-receipt lifetime limit is documented and was explicitly accepted by a repository administrator for this change. I found no discrete blocking defect in the pinned diff. Priority: P1 Review scores
Verification
How this fits togetherThe subagent registry receives child completion events and decides when to resume the requesting agent. It persists wake state in SQLite, publishes the resulting registry facts, and schedules any resulting delivery intent. flowchart LR
A[Child completion] --> B[Requester wake owner]
B --> C[SQLite worker transaction]
C --> D[Committed receipt]
D --> E[Registry publication]
E --> F[Requester continuation]
C --> G[Queue intent]
G --> H[System event delivery]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +786, Tests +1201, Docs +17. Total +2004 across 39 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the registry's existing worker and queue owners for wake settlement, preserving single delivery and explicit refusal when the existing retention contract can no longer prove an outcome. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main synchronously persists requester-wake transitions and quiet completion on the Gateway path. The PR reports a measured host-SQL baseline; this read-only review did not execute it. Is this the best way to solve the issue? Yes. The branch uses the existing worker transaction, registry publication owner, and queue scheduler, with no new configuration or retention policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b3f7cf637382. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
Move requester transitions and quiet settlement through the existing SQLite worker transaction and registry publication owner. Retain committed receipts and reconcile current canonical rows and queue intents without repeating writes or transport. Keep unreadable native commit receipts classified as committed while preserving the same source-and-row restoration fence. Carry original source and wake authority through timers, retries, and acknowledgement. Refresh storage-mocked retirement fixtures and join the collector's actual terminal persistence before observing its detached completion. Preserve outcome and timing assertions. Validation: canonical receiving 365 cases, requester/lifecycle 39, public sessions.create/recovery/describe, 61 receipt/fence siblings, zero all-eight host SQLite APIs in the registered wake windows, full selected static checks and fresh independent review.
958e43f to
068615f
Compare
Compose requester settlement with canonical main 7972c35. Its asynchronous session-currentness check can finish MCP retirement after the registry fixture's last notification. Join the existing finite cleanup work before checking the unchanged cache predicate; retain the original timeout. The exact CI group reproduces the timeout while the cache is already empty. With the fixture correction, all 48 files pass (804 tests, 4 platform skips). Requester receiving also passes 370 worker/registry/lifecycle cases, 39 E2E cases and the public Gateway recovery capsule. Both observed wake windows retain zero calls across all eight host SQLite APIs.
Keep already-stale transition callbacks as no-ops while current unpublished work still fails and retains its existing receipt obligation. Restrict the whole-wave omitted-member check to outcome settlement; quiet wake mutations preserve the existing selected-member decision under exact row and source admission. Join actual initial transition acknowledgements before forcing restart in the recovery fixture. Its outstanding transport and original assertions stay unchanged. Extend the atomic outcome table to reject an omitted live sibling without changing either durable or published rows. Proof: the original six failures reproduce; the corrected recovery/worker pair passes 63 tests, the original CI selector group passes 295 with three platform skips, and eight registered receipt/replacement/quiet cases pass.
|
Maintainer disposition on the terminal-receipt lifetime question: this PR preserves the existing queue owner's retention contract. If publication remains unresolved until the completed intent has been pruned, settlement deliberately refuses and the wake may remain pending. That limitation is accepted for this bounded worker-transfer change and is documented; it is not a claim of successful recovery. Missing proof must not be converted into delivery success, a replacement intent, repeated transport, or a replayed committed write. Keeping completion facts beyond the existing retention window would be a separate durability/retention change with its own owner and upgrade proof. It is not an implicit prerequisite or an unapproved new policy in this PR. The real-worker tests cover matching pending and completed intents, and refusal for replaced or absent intents. Current head a41dc8a also composes the main refactor while preserving exact-entry custody and the canonical row reader. Receiving proof passed 77 owner cases, eight registered requester cases, owning types/lint/ratchets, and fresh full-scope independent review. CI 36533084528 is still pending and is not being represented as passing. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…penclaw#160472) * fix: preserve requester wakes after settlement publication failures Move requester transitions and quiet settlement through the existing SQLite worker transaction and registry publication owner. Retain committed receipts and reconcile current canonical rows and queue intents without repeating writes or transport. Keep unreadable native commit receipts classified as committed while preserving the same source-and-row restoration fence. Carry original source and wake authority through timers, retries, and acknowledgement. Refresh storage-mocked retirement fixtures and join the collector's actual terminal persistence before observing its detached completion. Preserve outcome and timing assertions. Validation: canonical receiving 365 cases, requester/lifecycle 39, public sessions.create/recovery/describe, 61 receipt/fence siblings, zero all-eight host SQLite APIs in the registered wake windows, full selected static checks and fresh independent review. * fix(agents): preserve stale and partial requester wake decisions Keep already-stale transition callbacks as no-ops while current unpublished work still fails and retains its existing receipt obligation. Restrict the whole-wave omitted-member check to outcome settlement; quiet wake mutations preserve the existing selected-member decision under exact row and source admission. Join actual initial transition acknowledgements before forcing restart in the recovery fixture. Its outstanding transport and original assertions stay unchanged. Extend the atomic outcome table to reject an omitted live sibling without changing either durable or published rows. Proof: the original six failures reproduce; the corrected recovery/worker pair passes 63 tests, the original CI selector group passes 295 with three platform skips, and eight registered receipt/replacement/quiet cases pass. * fix: resume requester wakes after persisted retries
Related: #159943, #160203, #160238, #160407
What Problem This Solves
Requester wake transitions still write SQLite on the Gateway thread. Moving those writes into the worker also requires preserving committed work when acknowledgement or host publication fails.
User Impact
Requester continuation and quiet child cleanup keep their existing behavior while their settlement writes run in the existing worker. Recovery does not repeat a committed write or send the requester result twice. Configuration, schema, and retention are unchanged.
Why This Change Was Made
The existing completion transaction owns transition, quiet completion, and reconciliation. Timers and retries retain their original database and wake owner. The existing pending wake episode keeps the native receipt until canonical facts are published and the remaining continuation settles.
Outcome settlement also retains committed system-event intents. The queue owner schedules matching pending intents and recognizes its compact terminal receipts. Missing or replaced intents are never recreated; if existing retention has removed a terminal receipt, the wake remains unsettled because completion cannot be established safely.
A native commit with unreadable receipt facts remains classified as committed and keeps the existing restoration fence. Neither retry nor source close can replay it; canonical restoration must first establish the current rows.
Quiet completion retains the existing ability to settle selected current members. Outcome-bearing settlement still requires the whole surviving frozen wave. Already-stale transition callbacks remain no-ops; current unpublished work still fails rather than allowing transport to continue.
A successfully retried transition now hands the remaining wake to the current retry caller, including a surviving sibling. The same pending episode owns the continuation until that caller claims it; committed replay budgets cannot leave a wake stranded behind an expired retry deadline.
Evidence
7972c353, before the final boundary correction, passed 370 worker, queue, registry/lifecycle, and source-replacement cases; 39 requester/lifecycle E2E cases; and an isolated public Gateway capsule using non-mainsessions.create, real scheduled completion recovery, and post-publicationsessions.describe.acf71ae1, the actual registered transition, outcome settlement, and quiet-completion callbacks ran while both observed wake windows recorded zero invocations across all eight host SQLite APIs. Dispatch and persisted-state assertions remain positive controls. The original whole-window baseline was 25; transition and quiet completion contributed 10 and 9 respectively. Initial requester-yield creation, other descendant readers, and native incognito preflight remain separate migration work.--maxWorkers=1: 51.52 seconds command wall time (41.31 seconds Vitest, about 6 seconds in the four cases) on Node 24.21.0 at068615f9. Vitest attributed 71% of its duration to transformation. The over-30-second file is retained for its real SQLite worker and registered queue scheduler boundary: pending/completed intent recovery must not duplicate dispatch, and replaced/absent intents must refuse recovery. Those ownership and persistence checks cannot be established by the storage-mocked policy fixtures.Selected static guards, core types, all 27 test type graphs, dead-export scans, formatting, lint, schema checks, and import/boundary guards passed on the reviewed continuation head
e87be536. The previous Linux composition passed normalpnpm buildwith Node 24.19.0 and pnpm 12.5.1; its UI report measured 372318 bytes against the 372347-byte limit, with an earlier eight-byte advisory retained in the investigation. Current receiving used Node 24.21.0 and pnpm 12.5.1; the focused E2E checks exercise source runtime and do not claim a fresh packaged-artifact build. Runtime delivery uses synthetic isolated dispatch, not a live channel. The first CI run (36519299928) exposed the cleanup fixture race above and an inherited Cron fixture lint error. The latter is fixed on main by743c2ceb72e7d1372845ea6f834bb82993fc9e0e; the next CI merge3aeb0b07includes its exact corrected blob and the lint job passed. Cancelled jobs are not counted as passing coverage.CI 36523188069 then exposed six branch-caused recovery cases. The final correction restores stale no-op and quiet selected-member behavior, and makes the forced-restart fixture await the write whose committed state it asserts. These failures and cancelled coverage remain recorded; they are not treated as pre-existing exceptions.
CI 36526345182 exposed three policy fixtures still observing the retired synchronous write seam and a replay fault no longer injected into the native writer. Migrating that fault to SQLite exposed a real missed continuation after successful retry. The pending-episode handoff above fixes that ownership gap, including a sibling executing the retry. These branch-caused failures are retained; cancelled jobs are not passing coverage.
Fresh independent P0–P2 review and the selected changed gate pass for the continuation correction: core types, all 27 test type graphs, all three dead-export scans, typed lint, schema and boundary guards. Main then introduced a source conflict through its existing owner refactor. The normal merge with fixed main
46147f5epreserves its exact-entry Map and shared row reader. That composition passes 77 worker/queue/lifetime/codec cases, eight registered requester cases, core and owning test types, the full branch line-cap check, changed-file lint, and a fresh full-scope P0–P2 review. Manifests and lockfile are unchanged. Final reviewed head:a41dc8a766866414ad49a6d55056c20abaa77d54. Exact-head CI 36533084528 passed. Native merge verified and landed this head as10e951e857488865ae3fcd85c83800b20c925431; native cleanup is complete. Earlier failed and cancelled runs remain recorded above.