Repository navigation
fix: settle yielded child notices after a sibling resumes - #200581
Merged
Merged
Conversation
A resumed sibling remaps requesterSettleWake.batchRunIds without replacing another yielded child\u0027s pause notice. Settle that same child-only notice against the current row while preserving its final-result cohort and existing identity and cancellation checks.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
Contributor
Codex Review Summary: ✅ CompletedThis 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)
November 17, 2026 12:40
Contributor
Author
|
Merged via squash auto-merge.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 18, 2026
) A sibling resume legitimately remaps requesterSettleWake.batchRunIds while another yielded child's one-shot pause notice is being delivered. Full-cohort equality incorrectly rejects that child's settlement, and the retained rejection then fails against the same snapshot on every sweep. Let the existing completion store settle the same child's pause notice against the current row despite changed sibling membership. Preserve runtime/requester identity, generation, notice content, delivery policy and cancellation checks, along with the observed delivery outcome and the cohort's future final-result obligation. Two real lifecycle/SQLite regression cases fail with the repeated warning pair on the base and pass with the fix, including no duplicate dispatch and delivery of a later independent requester batch. All 61 focused tests, targeted typechecks, lint, format and Codex autoreview passed. No Doctor repair or schema change is included. Related: openclaw#195275, openclaw#194732, openclaw#170562.
RomneyDa
added a commit
that referenced
this pull request
Nov 19, 2026
A sibling resume legitimately remaps requesterSettleWake.batchRunIds while another yielded child's one-shot pause notice is being delivered. Full-cohort equality incorrectly rejects that child's settlement, and the retained rejection then fails against the same snapshot on every sweep. Let the existing completion store settle the same child's pause notice against the current row despite changed sibling membership. Preserve runtime/requester identity, generation, notice content, delivery policy and cancellation checks, along with the observed delivery outcome and the cohort's future final-result obligation. Two real lifecycle/SQLite regression cases fail with the repeated warning pair on the base and pass with the fix, including no duplicate dispatch and delivery of a later independent requester batch. All 61 focused tests, targeted typechecks, lint, format and Codex autoreview passed. No Doctor repair or schema change is included. Related: #195275, #194732, #170562. (cherry picked from commit eea1d5a) Companion audit: #200649 selected next; pause-notice settlement retains generation and exact notice matching. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit c0824317fd65c47fb05a44d630712553219acd44)
RomneyDa
added a commit
that referenced
this pull request
Nov 19, 2026
…es, steer races and expiry (#200649) ## What Problem This Solves A finished subagent's result could be lost even though the child did its work. Three paths dropped it on current `main`: - **Access-policy outage:** a temporary "Gateway access policy is unavailable; retry the operation." during requester settlement was recorded as a permanent delivery failure. The parent never received the result, even after the policy recovered. - **Steer race:** when a busy parent accepted the child's result by steering, and the delivery owner changed afterward, the run was recorded as intentional non-delivery. The parent had the result, but the record said it didn't. The run could later "expire" and send a misleading failure. - **Expiry:** a suspended required completion was discarded after seven days with no notice in the requester conversation. Only an operator log line recorded it. On one Gateway, the access-policy class alone accounted for 25 failed child results in a week. ## User Impact A temporary access-policy outage now only delays a child's result; it is delivered after the policy returns. A result steered into a busy parent is recorded as delivered. A required result that finally expires records the existing visible failure notice ("The child result couldn't be delivered to this conversation…") instead of disappearing silently. ## Why This Change Was Made Each fix is at the existing owner: - **Settle wake:** a policy-unavailable error now joins the existing "no delivery was admitted, retry" class, alongside database-busy and overloaded errors, instead of the permanent-failure path. - **Direct delivery:** an accepted, committed steer returns `delivered` before the delivery-owner check. Only an unconfirmed commit still depends on its owner. - **Seven-day discard:** this path now calls the same failure-notice writer that other permanent failures already use (#198807). Explicit stop, cancellation, requester deletion and real revocation are unchanged. ## Evidence - **Regressions** drive the real lifecycle, announce, completion and SQLite owners: `subagent-result-owed.{policy-outage,expiry-discard}.test.ts`, plus the updated `steering $outcome after $change` direct-delivery contract (accepted-steer rows fail on base). Each fails on the base commit and passes with the fix: - policy outage: recorded `failed` before, owed and then delivered after; - steer race: receipt not delivered before, `{delivered: true, path: "steered"}` after; - expiry: no notice before, exactly one visible notice after. - **Existing suites:** announce, settle, lifecycle, completion authority, store-replaced, steer-restart and yielded-run settlement all pass, 500+ tests. The `steering $outcome after $change` contract was updated: an accepted steer is now delivered after an owner change, and indeterminate steers keep the old outcome. - **End to end (source tier, `ocx src`):** an isolated Gateway with a stub model. A busy parent received its finished child's result through a steer into the same run, and `subagent_runs` recorded `delivered/delivered`. - **Not in this PR:** splitting settle batches that mix operator invocations (a separate fix with its own proof), and the session-store-switch suspension policy (#152828, unchanged). Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 3b61a7c) Companion audit: #200581 included; existing authority outage classifier and completion failure owner are present. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit eadbf05817ce8aa5dc0c0e8daf8594486dc7e581)
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
A yielded child's pause notice can become stuck after a sibling resumes: delivery settlement rejects the changed batch membership, then the attempt to persist that rejection fails against the same snapshot. The wake remains armed and repeats the warning pair indefinitely.
The motivating incident began on November 16 at 18:12 PST on release
a117ca50: roughly four warning lines per minute, 2,934 lines by 04:05 the next morning, and persistence across a Gateway restart. One requester had yielded batches of 35 and eight children; 25 of 56 recorded runs still had pending delivery. A representative child was terminal without an outcome, paused bysessions_yield, with a dispatching pause notice at attempt one and rearm generation one.User Impact
A still-valid pause notice can finish its delivery bookkeeping exactly once when a sibling resumes. Its child's eventual final result remains owed, and another batch for the same requester can settle. No configuration, schema, timer, cache, or Doctor repair is added.
Why This Change Was Made
The reproduced first cause is
src/agents/subagents/registry/subagent-registry-run-recovery.ts:466: adoption replaces a yielded sibling's run ID inrequesterSettleWake.batchRunIds, including on other batch members (publication at line 558). An in-flight, child-only pause notice retains the old array. The full-array comparison insubagent-completion-admission.store.ts:575on the base incorrectly treats that legitimate remap as loss of the paused child's settlement ownership. Lifecycle fallback then retries the same retained settlement atsubagent-registry-lifecycle-wake.ts:633, so rejection itself cannot commit.The existing completion store remains the sole settlement owner. Only settlement of the same yielded pause notice ignores full-cohort membership changes. Child/requester identity, runtime ownership, rearm generation, exact notice content, delivery generation, cancellation, and final-delivery policy checks remain. The mutation consumes the one-shot notice against the current row and preserves the updated cohort for final results; it preserves the actual observed delivery outcome instead of replacing success with a rejection.
Periodic re-entry is
subagent-registry-sweeper.ts:300→resumeRequesterSettleWake→scheduleRequesterSettleWake; retained settlements are also resumed at sweep completion. The periodic timer is 60 seconds (runTick, line 200), with additional lifecycle triggers. The reported four lines/minute does not establish a dedicated 30-second retry timer.Related: #195275 addresses requester-run turnover and #194732 addresses independently resumed children/obsolete invocation authority. Their inspected heads (
2d21efe629cd28f05ca36a2ccdd46aa8cfc2ac92anda0abf6c69f9dbc9c2d3f22fab2c27ebb61be30d5) retain a byte-identicalcurrentRequesterEntriesguard and the membership remapping, so neither repairs this rejection loop. This change does not touch #195275's changed files. #170562 remains the Doctor recovery work. The older #161883 and #148076 were closed as duplicates, not as proof that every changed-source rejection was fixed; #137344 and the later changed-owner fix in #186443 established the existing terminal bookkeeping path.The test establishes this exact field mismatch and failure class. The structural incident records alone cannot identify which guard failed in that historical process. Already-dispatching notices with this same child owner, generation and notice can settle on their next evaluation; this is not a claim that all historical stranded rows self-heal after deployment.
Evidence
Two regression cases exercise actual sibling replacement, lifecycle evaluation/sweeps, and SQLite commits, with delivered and refused notice outcomes. On base
3447bee3a310a3c69d1252dde8545f7db629c5a8, both fail after three repeated pairs ofrequester settle wake failed/failed to persist requester settle wake rejection, withSubagent requester wake owner changed before settlement. With the fix, both pass, consume the notice durably, dispatch it once, retain final-result obligations and permit a later independent batch to become delivered.pnpm test src/agents/subagents/registry/subagent-registry-lifecycle-wake.source-change.test.ts --maxWorkers=1— base: 2 failed; fix: 2 passed. Final standalone green run: 52.67 s wall, 1.61 s test bodies; cold worker compilation took 36.93 s. CI: 2 passed, 8.70 s shard wall / 1.412 s test bodies (checks-node-changed-2).agents-sessionstest typecheck passed.eea1d5a7ff8923449fd44900811365ac0aa1a6d4; no CI rerun or failure exception was needed.