Repository navigation
fix(agents): release requester wake reservations and preparation capacity after restarts - #182285
Merged
Merged
Conversation
Release restored requester-settle reservations after their durable wave settlement is acknowledged so later yielded cohorts can dispatch in FIFO order. Capture exact input identities before settlement clears frozen batch membership, preserve them across publication retries, and leave claimed turns with their owner. Add a two-restart registry/controller regression and document the ownership contract. The regression fails on the base and passes twice with the fix; focused requester-settle, restart recovery, mailbox, and spawn checks pass.
Restored child deliveries could exhaust the shared preparation budget while waiting behind earlier FIFO sources that needed the same budget to prepare. This left yielded parents with queued or never-enqueued completion wakes. Release preparation capacity when the Gateway accepts a delivery, including execution-start replays, while retaining its result under the existing lifecycle owner until settlement. Keep the concurrency bound, FIFO, and idempotency intact. Cover restored cohort and individual completions whose creation order differs from completion order. Both cases time out on the parent commit and pass twice with this change. Model acceptance in the test adapter before its mailbox wait.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
October 24, 2026 05:57
Contributor
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. |
steipete
enabled auto-merge (squash)
October 24, 2026 06:07
This was referenced Oct 24, 2026
scribe-dandelion-cult
added a commit
to karmaterminal/openclaw
that referenced
this pull request
Oct 25, 2026
Absorb openclaw/openclaw main at 9629838 (967 commits past 7ab6453) into P ea81534. 39 textual conflicts, resolved upstream-first; every ours/combined resolution keeps a continuation or carried-fleet symbol and is listed with its reason in the lane's table.tsv / RESOLUTION.md. Schema: upstream took agent schema 32-34 (PostgreSQL-only vector decoder, binary vector projection, index ordering; SQLite advances metadata only) and state 32. The continuation recipient-authority step moves from 32 to 35, above upstream's steps; on SQLite a P-era 32 database is upstream's 32 plus the authority table, which the idempotent step admits. Ports into upstream's new owners: - agent-runner-result-complete.ts deleted upstream (openclaw#181917, inlined into agent-runner-result.ts); the continuation delta moves onto the inlined block. - subagent registry activation returns AgentRecoveryProgress (openclaw#181428); the continuation activation latch follows progress.settled. - announce reply-instruction / params moved by the fork receive upstream's requesterOrigin (openclaw#182124) and onAccepted (openclaw#182285). - diagnostic trace context moved to the shared AsyncContext carrier (openclaw#181780); the fork's test reset clears only its own field. Generated files regenerated with their generators (postgres schema, config doc baseline). Refs karmaterminal/openclaw-bootstrap#1727 Co-Authored-By: Claude Opus 5.5 <[email protected]>
steipete
added a commit
that referenced
this pull request
Oct 25, 2026
#182285 changed the restored requester-settle budget to cover delivery preparation only until the Gateway accepts the input, documented in the subagent yield handoff and operations docs. The Gateway e2e still asserted the earlier contract that at most two restored wakes reach the model at once, so all three arrived together and it failed deterministically on main. Assert the documented contract instead: every restored wake proceeds once earlier wakes are accepted, a live turn is not delayed behind them, and all requesters settle after release. The two-slot preparation bound stays covered by the registry persistence and lifecycle tests.
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 25, 2026
…city after restarts (openclaw#182285) * fix(agents): release settled requester wake reservations Release restored requester-settle reservations after their durable wave settlement is acknowledged so later yielded cohorts can dispatch in FIFO order. Capture exact input identities before settlement clears frozen batch membership, preserve them across publication retries, and leave claimed turns with their owner. Add a two-restart registry/controller regression and document the ownership contract. The regression fails on the base and passes twice with the fix; focused requester-settle, restart recovery, mailbox, and spawn checks pass. * fix(agents): release recovery capacity on delivery admission Restored child deliveries could exhaust the shared preparation budget while waiting behind earlier FIFO sources that needed the same budget to prepare. This left yielded parents with queued or never-enqueued completion wakes. Release preparation capacity when the Gateway accepts a delivery, including execution-start replays, while retaining its result under the existing lifecycle owner until settlement. Keep the concurrency bound, FIFO, and idempotency intact. Cover restored cohort and individual completions whose creation order differs from completion order. Both cases time out on the parent commit and pass twice with this change. Model acceptance in the test adapter before its mailbox wait.
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 25, 2026
openclaw#182285 changed the restored requester-settle budget to cover delivery preparation only until the Gateway accepts the input, documented in the subagent yield handoff and operations docs. The Gateway e2e still asserted the earlier contract that at most two restored wakes reach the model at once, so all three arrived together and it failed deterministically on main. Assert the documented contract instead: every restored wake proceeds once earlier wakes are accepted, a live turn is not delayed behind them, and all requesters settle after release. The two-slot preparation bound stays covered by the registry persistence and lifecycle tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
After Gateway restarts, yielded fleet parents could stay asleep forever even though their children had finished or been interrupted. In live stress runs on main d355f2f (12 fleets per Gateway, Gateway killed
-9at +60 s and +240 s), 2/12 embedded and 5/12 Codex-runtime parents never merged anything; 40+ minutes later they were still idle. Durable state showed three shapes:queuedinsession_pending_inputsand never consumed, accepted 8 minutes after the last boot;User Impact
Yielded parents can resume after Gateway restarts when their child completions are ready. FIFO order and exactly-once delivery are unchanged, with no new timers or configuration.
Why This Change Was Made
Root cause
Two coupled defects in the subagent registry lifecycle:
session-controller.mailbox-dispatch.ts) then waited indefinitely on thatpreparinghead (subagent-announce.requester-settle-wake.ts).runBackgroundWorkheld the background preparation slot until a delivery fully finished (subagent-registry-lifecycle.ts). After a restart, accepted deliveries held every slot while waiting in the requester's FIFO behind earlier reservations, and those earlier reservations needed the same slots to prepare (cleanup insubagent-registry-lifecycle-cleanup.ts, wake preparation insubagent-registry-lifecycle-wake.ts). Neither side could progress. Embedded and Codex parents share this owner.Fix
FIFO order and exactly-once delivery are unchanged, with no new timers or configuration.
docs/concepts/subagent-yield-handoff.mdanddocs/tools/subagents/operations.mdare updated.Evidence
subagent-registry.requester-wake.e2e.test.ts(viasubagent-registry.requester-wake-settlement.test-support.ts): a yielded cohort dispatched once after a second restart retires an already-delivered wave, and a restored cohort and a restored individual each drained before later cohorts when registry order differs. All three time out (120 s, the deadlock) on base, both on d355f2f and on today's main 7c374d4, and pass twice with the fix. Also green: lifecycle (234, twice), completion replay (3, twice), main-session recovery (193), subagent recovery (85), spawn (32) and mailbox (29).