Repository navigation
fix(subagents): leave interrupted delivery reservations to their recovery owner - #184100
Conversation
Prevent retained interrupted child deliveries from blocking ready parent continuations after repeated Gateway restarts. Reserve those inputs only when their recovery owner can prepare the announcement, preserving FIFO for runnable work. Add a SQLite-backed restore and controller regression, and document the reservation ownership contract.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR defers interrupted subagent delivery reservations until their recovery owner prepares the announcement. Example: After two Gateway restarts, an interrupted generation-1 child delivery precedes a ready generation-2 parent continuation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR makes a focused reservation-ownership correction, with no actionable introduced defect found. The failing CI assertion also occurs independently on another PR. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway startup restores durable subagent obligations into the requester session controller; its mailbox then admits ready continuations and user turns in FIFO order. flowchart TD
A[Durable subagent records] --> B[Gateway restore]
B --> C[Ready completion reservation]
B --> D[Interrupted recovery owner]
D --> E[Reconcile and prepare delivery]
E --> F[Requester mailbox]
C --> F
F --> G[Parent continuation or user turn]
Technical reviewBest possible solution: Keep mailbox reservation with the existing recovery owner until interrupted delivery is ready, while retaining its durable obligation. Do we have a high-confidence way to reproduce the issue? The base source and reported red/green controller regression establish the premature reservation path; the full two-restart stall was not independently reproduced, and fetched main additionally contains the overlapping recovery repair in #184069. Is this the best way to solve the issue? The guard is the smallest complete ownership correction: it reuses the existing announcement reservation path, preserves retained records, and adds no state, lease, configuration, or alternate delivery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 29423b655086. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +61, Docs +3. Total +66 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
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 25, 2026, 10:37 PM ET / October 26, 2026, 02:37 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…penclaw#184100) Prevent retained interrupted child deliveries from blocking ready parent continuations after repeated Gateway restarts. Reserve those inputs only when their recovery owner can prepare the announcement, preserving FIFO for runnable work. Add a SQLite-backed restore and controller regression, and document the reservation ownership contract.
…184100) Prevent retained interrupted child deliveries from blocking ready parent continuations after repeated Gateway restarts. Reserve those inputs only when their recovery owner can prepare the announcement, preserving FIFO for runnable work. Add a SQLite-backed restore and controller regression, and document the reservation ownership contract. (cherry picked from commit d576313) Adaptation-Base: cecd7059127eb19b4d2a2d2143e6bd4cb126b40b Adaptation-Scope: Defer interrupted-recovery owners rather than consume restored runnable slots Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 9818af9044e4659c7396fcdf218c515ab246e57b)
What Problem This Solves
In a live subagent stress run with two Gateway kill -9 restarts, two of twelve Codex-runtime parents stayed
status=queuedwithhasActiveRun=truefor over 35 minutes. Each had a fresh continuation input queued that never ran.User Impact
Ready parent continuations can run after repeated Gateway restarts without being blocked by retained interrupted child deliveries. No configuration changes or migration are required.
Why This Change Was Made
Root cause
Both parents had completed their recovery turns and yielded. Their queued inputs were fresh boot-2 continuations, so no dead-boot claim was involved. On restore,
reserveRestoredSubagentControllerSources(subagent-announce-controller-source.ts) reserved requester-mailbox slots for unprepared deliveries of older interrupted child generations, ahead of those ready continuations. Recovery refuses superseded child generations, so nobody ever prepared or released those reservations, and requester FIFO blocked the parent. Thelive_ownerskip in main-session recovery reflects current process-local controller activity, which was this stuck reservation, not a persisted lease.Fix
Interrupted terminal deliveries (
terminalOwner === "interrupted-recovery") are no longer reserved during restore. Their recovery owner reserves them right before the actual announcement, after it reconciles them. No new leases, fencing or state. Documented indocs/concepts/subagent-yield-handoff.md.Evidence
subagent-controller-inputs.test.tsproves one completion followed by the user turn, in FIFO order. It fails on base (expected [...] to have a length of 1 but got 2, 1 failed / 16) and passes with the fix, twice.Known remaining gap, not addressed here: retained notices from superseded historical child executions still are not cleaned up. They can no longer starve ready parent work.
Landing CI
CI run 40258699310 at
77675382fa6a7049910afb07fe891df435db67cdhas one failing test:public yielded settle replay with real Gateway admission > recovers public work once through a sibling and reconciles its private child finalinsrc/gateway/server.subagent-settle-replay.harness.test.ts. It recordserror/cancelledwhereok/completedis expected atserver.subagent-settle-replay-recovery.test-support.ts:459.The same 23-test file on the exact CI main baseline,
2f1a6b9c35437f169dfbb0d66dcbb44e972bdfb3, reproduces the identical assertion (22 passed, 1 failed). These test files are unchanged by this PR. A focused Linux/Bun rerun with this PR passed all 23 tests; that passing replay is not claimed as a repair. All other CI checks passed. Landing uses the authorized native pre-existing-failure exception and preserves the red CI evidence. The intermittent baseline replay defect remains a follow-up.