Skip to content

fix(subagents): failed requester wake no longer strands an expired completion for 7 days - #176145

Merged
steipete merged 5 commits into
openclaw:mainfrom
sukhdeepjohar:fix/subagent-expiry-settle-failure
Oct 18, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
sukhdeepjohar:fix/subagent-expiry-settle-failure

Conversation

@sukhdeepjohar

@sukhdeepjohar sukhdeepjohar commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #176117

What Problem This Solves

A finished child's result stays suspended with no retry owner when direct delivery expires and the final requester recovery wake fails. The row then waits for the seven-day discard instead of recording the failure.

User Impact

Exhausted recovery now records failed delivery immediately, keeps the child's result and payload, and preserves the existing blocked-delivery notice without duplicating it. This covers ordinary and private-parent completions. It does not restart exhausted retries or repair rows whose wakes were cleared before the fix; existing cleanup and retention still apply.

Why This Change Was Made

Expiry transfers settlement to the requester wake, but the completion kernel previously admitted an expiry-suspended row only for a successful outcome before clearing that wake unconditionally. Both outcomes now use the existing worker-owned transaction for delivery settlement, notice deduplication, and wake removal. Permanent suspensions remain excluded. No schema, persisted fields, configuration, or retry policy changes.

Original fix by @sukhdeepjohar; maintainer cleanup incorporates @xyi74976-del's private-parent, payload/notice retention, and failed-write rollback coverage from #176146, with coauthor credit. #176146's implementation and regression scope are covered here; its announcement documentation is represented by the operations documentation in this PR.

Deferred facts: the existing settlement path reselects canonical run/execution/delivery and requester-cohort identities under registry FIFO, checks the current Gateway lifetime, cancellation/commit episode and rearm generation, and revalidates writer admission at transaction and commit. The existing state-worker context binds the original database path/lifetime; captured outcome/error is the completed attempt's historical fact. This patch adds no new deferred work, captured config, limits, leases, or destinations.

Evidence

  • Source/history confirms the defect on main 110914e51c486fbfd885284b7b5e31c7d373f125: success-only expiry settlement followed by unconditional wake removal; the sweeper only age-discards the resulting unowned suspension. The earlier positive-receipt contract stays intact.
  • Exact-head CI run 39164267269 passed on f40411ccd5cf899cbd6b646c708da2a0025299c1 after merging current main: 38 successful jobs, including planned tests, production/test typechecks, lint, docs, and UI checks. The PR rollup has 58 passing checks and no failures or pending checks. No retries or inherited-failure exceptions were needed.
  • Regression: fails the expired delivery when its requester wake ends undelivered (target=%s) covers ordinary and private-parent results after SQLite reopen, retained result/payload, cleared wake, suppression, and unchanged notice identity. preserves the suspended delivery and wake when failed settlement write rejects the receipt extends the existing rollback table. Permanent-suspension and successful-receipt coverage remains.
  • Changed-file oxfmt 0.72.0 passed (56 ms for three files). Core oxlint 1.87.0 passed using the repository rules with only the nonmatching UI-only Solid plugin override omitted; the installed dependency tree lacks that plugin, and the wrapper cannot resolve this nested checkout's modules. git diff --check passed.
  • Codex autoreview (branch, P0–P2) with the complete mutation kernel, store, worker, and wake-owner context: scoped-clean, no actionable findings. The review executed no project code. Final main integration left every reviewed owner/context file unchanged.
  • Live Gateway proof, leases, local tests/typechecks, and production-revert negative controls were intentionally skipped per maintainer policy. Earlier contributor Gateway/upgrade observations concern ca6a7854d570; they were not rerun or claimed as exact-head proof.
  • Test cost: two additional table cases, no new test file, sleeps, polling, or real timers; local test wall time intentionally unmeasured. CI job 117784134854 ran all 13 expiry-receipt tests successfully: 7.12 s Vitest duration, about 8.67 s from shard begin to exit, and 190/196/215 ms for the ordinary/private/failed-write cases respectively.
  • Net diff versus main: production +4/-6 (-2), tests +48/-15 (+33), docs +5/-0 (+5). No extra production owner or helper was introduced.
  • ClawSweeper reviewed this exact head: no actionable P0–P2 findings, complete fix scope, and no before-merge blockers. It recognized the maintainer proof policy; PR CI is the proof. No human review findings remain.

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Oct 18, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Records failed delivery when an expired subagent completion’s final requester wake finishes undelivered.

Example: A child finishes successfully, delivery expires, and its requester wake ends with “requester turn failed.”

  • Before: The wake disappears while delivery remains suspended until seven-day discard.
  • After: Delivery records the failure immediately, retaining the child result, payload, and existing blocked notice.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-verified repair with meaningful persisted regressions; execution evidence follows the accepted CI-only policy.
Proof confidence 🦐 gold shrimp (3/6) The explicit maintainer request accepts exact-head PR CI for this adopted cleanup and excludes additional live, lease, local execution, and revert proof; CI remains pending, and earlier contributor observations are not claimed as current-head execution.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A completed child result can remain suspended without a delivery owner after its final requester wake fails.
Reason: The maintainer adopted this bounded repair, which records an honest terminal outcome without restarting exhausted retries or redesigning notifications.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current completion-settlement bug through the existing owner; no actionable P0–P2 defects were found.

Priority: P1
Reviewed head: f40411ccd5cf899cbd6b646c708da2a0025299c1

Before merge

None.

Findings

None.

Agent review details

How this fits together

The completion kernel consumes requester-wake outcomes and commits native subagent delivery state and deduplicated notification intents together in SQLite.

flowchart TD
  A[Completed child] --> B[Expired delivery]
  B --> C[Requester wake]
  C --> D[Completion mutation owner]
  D --> E[SQLite delivery state]
  D --> F[Deduplicated blocked notice]
Loading

Technical review

Best possible solution:

Settle both successful and failed expiry-wake outcomes atomically through the existing completion owner while preserving results and notice identity.

Do we have a high-confidence way to reproduce the issue?

Current main exposes the unsuccessful-settlement path, and the existing SQLite fixture directly exercises it; no target code was executed during this read-only review.

Is this the best way to solve the issue?

This is the smallest complete fix: extend the existing expiry exception to failure outcomes, retaining the transaction, ownership checks, permanent-suspension exclusion, and bounded retry policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 919888778d13.

Provenance checked

  • Expiry-suspended requester settlement changes intended behavior with a stated reason (fix(subagents): unblock launches after late completion delivery #151949: Accept confirmed positive receipts after expiry without treating permanent failures or cancellations as successful delivery; the later worker refactor preserved that contract.)
  • Expired-receipt negative regression changes intended behavior with a stated reason (d79446e: The earlier test retained suspension for an unsuccessful expiry receipt; this PR deliberately replaces that expectation with terminal failure while preserving permanent-failure and rejection coverage.)
  • Atomic settlement and notification receipts keeps the original intent (10e951e: Keep worker-owned settlement and committed notification intents recoverable without replaying completed writes or duplicating delivery.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit c614c9b adds src/agents/subagents/completion/subagent-completion-mutation.kernel.ts:158 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c614c9bb829b; files: src/agents/subagents/completion/subagent-completion-mutation.kernel.ts)
  • RoboClaw: Raw commit db6caae adds src/agents/subagents/completion/subagent-completion-mutation.kernel.ts:224 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: db6caaea9aeb; files: src/agents/subagents/completion/subagent-completion-mutation.kernel.ts)

PR surface

Source -2, Tests +33, Docs +5. Total +36 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 6 -2
Tests 1 48 15 +33
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 57 21 +36

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #176117
Summary: This PR repairs the canonical failed-expiry-settlement report and incorporates the sibling PR’s additional regression coverage.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P1: The source-confirmed bug strands completed child results after failed requester recovery in active agent workflows.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-18T08:19:48.563Z sha 47efe99 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-18T10:19:15.892Z sha ca6a785 :: needs maintainer review before merge. :: none

Reviewed October 18, 2026, 4:45 PM ET / 20:45 UTC (Revision 3).

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 18, 2026
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 18, 2026
@sukhdeepjohar
sukhdeepjohar marked this pull request as ready for review October 18, 2026 10:13
@sukhdeepjohar

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 18, 2026
steipete and others added 2 commits October 18, 2026 13:14
Cover private-parent recovery, retained completion payloads and notice identity, and rollback after a failed settlement write. Keep the existing kernel as the single failure owner.

Original fix by Sukhdeep Johar in openclaw#176145; additional regression coverage adapted from openclaw#176146.

Co-authored-by: Sukhdeep Johar <[email protected]>

Co-authored-by: xyi74976-del <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

Maintainer cleanup folds the private-parent, retained payload/notice identity, and failed-write rollback coverage from #176146 into this PR, with contributor credit. The body records the final scope and ownership checks.

Per maintainer proof policy, exact-head PR CI is the execution proof. Live Gateway, lease, local typecheck/test, and production-revert proof requests are intentionally skipped; please review P0–P2 code findings against the current head.

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@steipete
steipete merged commit 9312615 into openclaw:main Oct 18, 2026
149 of 151 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
…mpletion for 7 days (openclaw#176145)

* fix(subagents): settle expired completions when their requester wake fails

* docs(subagents): note failed settlement of expired completions

* fix(subagents): preserve failed expiry settlement contracts

Cover private-parent recovery, retained completion payloads and notice identity, and rollback after a failed settlement write. Keep the existing kernel as the single failure owner.

Original fix by Sukhdeep Johar in openclaw#176145; additional regression coverage adapted from openclaw#176146.

Co-authored-by: Sukhdeep Johar <[email protected]>

Co-authored-by: xyi74976-del <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: xyi74976-del <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Suspended (expiry) subagent completion is stranded after its requester settle wake ends undelivered: wake cleared, no re-arm, discarded at 7 days

2 participants