Repository navigation
fix: stop losing finished subagent results during access-policy outages, steer races and expiry - #200649
Conversation
…es, steer races and expiry A transient Gateway access-policy outage during requester settlement was recorded as a permanent delivery failure; it now retains the wake like other pre-admission retries. A completion whose steer already committed into the busy parent's run was recorded as intentional non-delivery when its owner changed afterward; it now counts as delivered. A suspended required completion that expired after seven days was discarded silently; it now records the existing visible failure notice in the requester 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 changes before merge. What this changesThis PR preserves finished child results through temporary policy outages, credits committed steering, and reports expired required completions. Example: A finished child's requester settlement encounters a temporary Gateway access-policy outage.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 3 items remain Keep open: this maintainer-authored PR addresses three concrete completion-delivery defects still present on current main, but the expiry change introduces a cleanup regression. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe subagent registry tracks finished child results, hands them to requester sessions through completion delivery, and persists delivery outcomes and failure notices. flowchart TD
A[Finished child result] --> B[Subagent registry]
B --> C[Requester settlement]
B --> D[Direct steering]
B --> E[Suspended delivery expiry]
C --> F[Requester conversation]
D --> F
E --> G[Failure notice writer]
G --> F
Technical reviewBest possible solution: Keep the three repairs in their existing owners while preventing failure reporting from turning an ordinary yielded cleanup into a failed sweep. Do we have a high-confidence way to reproduce the issue? Current-main source exposes all three reported paths, and the added owner regressions target them; this read-only review executed no target code. Is this the best way to solve the issue? The small changes reuse the right owners and preserve admission checks, but the expiry reporter must be placed so its asynchronous work cannot break the established yielded-cleanup contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 235e38488bf2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +8, Tests +462, Docs +6. Total +476 across 10 files. Added test files: 3. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
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 November 17, 2026, 10:13 AM ET / 15:13 UTC. |
Recording the notice mid-discard opened a yield point that let a concurrent owner change fail the discard. The notice now runs once the discard is committed and is best-effort. Drop the steer integration test that duplicated the direct-delivery contract table, and mark the policy test's registry mock isolation.
|
Maintainer override:
|
|
Landed in 3b61a7c.
|
…es, steer races and expiry (openclaw#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 (openclaw#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 (openclaw#152828, unchanged). Co-authored-by: Ayaan Zaidi <[email protected]>
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)
…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)
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: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:
deliveredbefore the delivery-owner check. Only an unconfirmed commit still depends on its owner.Explicit stop, cancellation, requester deletion and real revocation are unchanged.
Evidence
subagent-result-owed.{policy-outage,expiry-discard}.test.ts, plus the updatedsteering $outcome after $changedirect-delivery contract (accepted-steer rows fail on base). Each fails on the base commit and passes with the fix:failedbefore, owed and then delivered after;{delivered: true, path: "steered"}after;steering $outcome after $changecontract was updated: an accepted steer is now delivered after an owner change, and indeterminate steers keep the old outcome.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, andsubagent_runsrecordeddelivered/delivered.