Repository navigation
fix(agents): keep unfinished restored cohorts out of the requester FIFO - #184022
Conversation
Restore requester completion reservations only once their child and descendant work can run through the existing settle path. Share live member readiness and reuse descendant settlement policy so unfinished obligations stay in the registry without starving ordinary user input. Cover child and descendant waits through the real session store, registry and controller, preserve the obligation until completion, and verify queued user turns run in FIFO order. Keep retirement fixtures on settled child delivery. Refs #143334.
|
🦞👀 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 prevents unfinished restored subagent cohorts from reserving the requester’s mailbox before they can run. Example: After restart, child-a has finished but child-b or its grandchild is still running.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR repairs a current recovery/FIFO defect, and no actionable patch defect was found; its scope covers only part of the linked issue. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway recovery reads durable subagent obligations and rebuilds process-local session-controller reservations; live settlement later admits ready continuations through the same mailbox. flowchart TD
A[Durable subagent registry] --> B[Restart restoration]
B --> C[Shared readiness checks]
C -->|Unfinished| A
C -->|Ready| D[Requester mailbox]
E[User input] --> D
D --> F[Session controller]
F --> G[Requester turn]
Technical reviewBest possible solution: Use the existing settlement readiness owners before restored mailbox reservation, retaining unfinished obligations in the registry. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the reservation/readiness mismatch, and the PR reports matching red-on-base controller regressions; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is the smallest complete repair for restored-cohort starvation, but a Related reference is more accurate than closing #143334 because its distinct completion-loss and reset cases remain outside this repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 05010ed700c7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +32, Tests +116, Docs +3. Total +151 across 7 files. 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 25, 2026, 9:29 PM ET / October 26, 2026, 01:29 UTC. |
|
Merged via squash.
|
…FO (openclaw#184022) * fix(agents): keep unfinished restored cohorts out of requester FIFO Restore requester completion reservations only once their child and descendant work can run through the existing settle path. Share live member readiness and reuse descendant settlement policy so unfinished obligations stay in the registry without starving ordinary user input. Cover child and descendant waits through the real session store, registry and controller, preserve the obligation until completion, and verify queued user turns run in FIFO order. Keep retirement fixtures on settled child delivery. Refs openclaw#143334. * fix(agents): remove requester settlement type cycle
…FO (#184022) * fix(agents): keep unfinished restored cohorts out of requester FIFO Restore requester completion reservations only once their child and descendant work can run through the existing settle path. Share live member readiness and reuse descendant settlement policy so unfinished obligations stay in the registry without starving ordinary user input. Cover child and descendant waits through the real session store, registry and controller, preserve the obligation until completion, and verify queued user turns run in FIFO order. Keep retirement fixtures on settled child delivery. Refs #143334. * fix(agents): remove requester settlement type cycle (cherry picked from commit d738163) Adaptation-Base: cecd7059127eb19b4d2a2d2143e6bd4cb126b40b Adaptation-Scope: Gate restored cohorts on terminal child and descendant readiness with exact batch membership Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit f1b0cd7834096a9c4ff62449a249f3c86b9e533d)
What Problem This Solves
After a Gateway restart, a requester whose subagent cohort was still unfinished could get stuck: the next user message sat behind a restored controller reservation and never ran.
User Impact
Ordinary user input can run in FIFO order while restored child or descendant work remains unfinished. No configuration changes or migration are required.
Why This Change Was Made
Root cause
reserveRestoredSubagentControllerSources(src/agents/subagents/announce/subagent-announce-controller-source.ts) reserved foreground mailbox custody for restored settle-wake batches even when members, or their descendants, were still running. The live dispatch path already refuses those batches through the descendant-settlement policy. Restart recovery skipped that check, so an unprepared reservation held the requester FIFO.Fix
Restored sources now reuse the same readiness checks as live settlement:
isRequesterSettleMemberReadyplus the requester descendant reader andwaitForRequesterDescendants. Unfinished cohorts stay out of the requester FIFO until they actually settle. Explicitsessions_yieldpause notices keep their existing custody. The readiness predicate moves intosubagent-announce.requester-settle-state.tsso live and restored paths share one owner.Evidence
Tests 2 failed | 13 passed. With the fix they pass.tsgo:core, and agents/sessions test typecheck pass.The historical post-acceptance timeout from the report was already repaired by #138966. This PR fixes the remaining restored-cohort FIFO starvation.
Fixes #143334
CI follow-up
The first CI run found a type-only import cycle introduced by the shared readiness predicate. The delivery-state parameter now spells its existing
Omit<RequesterSettleWakeState, "retireAfterSettle">type directly instead of importing the alias from the announce layer. Runtime behavior is unchanged. The same Madge guard now reports zero cycles; targeted lint and formatting pass, and independent review found no actionable issue in the repair.