Skip to content

fix(subagents): record failed recovery instead of stranding child results - #176146

Closed
xyi74976-del wants to merge 1 commit into
openclaw:mainfrom
xyi74976-del:fix/subagent-expired-settle-failure
Closed

xyi74976-del wants to merge 1 commit into
openclaw:mainfrom
xyi74976-del:fix/subagent-expired-settle-failure

Conversation

@xyi74976-del

Copy link
Copy Markdown
Contributor

Closes #176117

What Problem This Solves

Fixes completed child results remaining silently suspended when direct delivery expires and the requester recovery wake ultimately fails.

User Impact

Failed recovery now records its concrete delivery failure while retaining the child's result, instead of leaving an unowned suspended completion until age-based discard. Existing blocked-delivery warnings remain deduplicated. This does not restart exhausted retry budgets or guarantee delivery after a permanent failure.

Why This Change Was Made

Expiry transfers settlement to the requester wake. Previously, the settlement owner admitted an expiry-suspended row only for successful outcomes, then cleared the wake even after an unsuccessful outcome. Both outcomes now use the existing settlement path; failure recording, result retention, warning deduplication, and wake removal remain in one worker-owned transaction. Permanent suspensions retain their existing behavior. No schema, dependency, permission, or retention-policy change is introduced.

Evidence

  • Before the fix, both ordinary and private-parent recovery regressions failed on upstream 470ba964: reopening SQLite showed suspended and the old expiry error instead of the final failure.
  • 315 tests passed across completion-expiry receipts, persisted requester wakes, requester-settle delivery, and registry lifecycle (74.34 seconds wall time). The changed receipt suite has 13 passing tests (30.43 seconds wall time including worker preparation; about 4 seconds executing tests). Coverage includes restart persistence, retained result/payload, warning deduplication, ownership rejection and failed-settlement transaction rollback.
  • Core typecheck (pnpm tsgo:core), targeted repository lint, three-file formatting, and git diff --check passed. The implementation reuses the existing settlement owner and reduces production code; the additional test code protects the previously missing failure path.
  • Independent OpenClaw autoreview assessment with the complete settlement kernel and caller context: no actionable P0–P2 findings. This was a static independent review; the reviewer did not execute tests.

Local proof used Node 24.21.0 and isolated synthetic SQLite state. No live provider outage, real channel delivery, native Windows run, or full-suite run is claimed. PR CI results and CI seconds are pending.

AI assistance: Codex for investigation, implementation, tests, independent review and this description.

@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 docs Improvements or additions to documentation 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. 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 real behavior proof before merge.

What this changes

Records failed requester recovery for expiry-suspended child completions before clearing their wake.

Example: A child returns "canonical result", direct delivery expires, and requester recovery ends with "requester failed".

  • Before: The wake disappears while delivery remains suspended with the earlier expiry error.
  • After: Delivery becomes failed with the final error, retaining the result and existing blocked warning.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is narrow and source-correct, with useful persistence regressions, but required runtime and existing-state compatibility evidence is not supplied.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Completed child results can remain silently suspended after their final requester recovery attempt fails.
Reason: Explicit terminal failure satisfies the reported ownership invariant without restarting exhausted retries or introducing a new product surface.

Merge readiness

⛔ Blocked before merge - 2 items remain

This PR provides a focused repair for a current settlement bug; no introduced correctness or security defect was found.

Priority: P1
Reviewed head: 8725f2cb20fcb556f9333eac821d6916df9d52ad

Before merge

  • Add real behavior proof - The body and discussion provide SQLite regression and static-check results, but the added fixture mocks requester-wake delivery; no supplied runtime trace exercises expiry through failed requester recovery after the fix. Provide redacted logs or terminal output showing the final failure, retained result, cleared wake, and unchanged warning count. Existing-state upgrade proof is also absent; the reopen cases create state using the current fixture. Redact API keys, IPs, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply redacted runtime evidence of expired delivery followed by exhausted requester recovery and persisted terminal failure, including an existing-state upgrade from the latest stable release.
Agent review details

How this fits together

Subagent completion settlement consumes requester-wake outcomes and atomically updates native run records and deduplicated notification intents in SQLite.

flowchart TD
  A[Completed child result] --> B[Direct delivery expires]
  B --> C[Requester recovery wake]
  C --> D[Completion settlement worker]
  D --> E[Retained result and failure receipt]
  D --> F[Deduplicated blocked notice]
Loading

Technical review

Best possible solution:

Use the existing worker transaction to record terminal recovery failure, retain the child result, deduplicate warnings, and clear the exhausted wake.

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

Current-main settlement and its terminal-failure callers establish the reported path; the author reports failing-before/passing-after SQLite regressions, which this read-only review did not execute.

Is this the best way to solve the issue?

This is the smallest complete repair: broaden the existing expiry exception to both outcomes and retain the established failure, transaction, and notification owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 66485231b24d.

Provenance checked

  • Expiry outcome settlement changes intended behavior with a stated reason (fix(subagents): unblock launches after late completion delivery #151949: Accept confirmed late delivery while preserving permanent-failure exclusions; later worker refactoring carried the positive-receipt exception forward.)
  • Worker transaction and wake publication keeps the original intent (10e951e: Keep settlement writes off the Gateway thread and preserve committed work across acknowledgment or publication failures.)
  • Negative expiry-receipt regression changes intended behavior with a stated reason (d79446e: Ensure unsuccessful receipts do not become successful delivery; the replacement instead requires an explicit retained failure.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

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

Review metrics

Metric Value Why it matters
Production versus test changes Production +4/-6 lines; tests +48/-15 lines Production shrinks while regression coverage adds persisted failure, private-parent retention, and rollback cases.

Root-cause cluster

Relationship: same_root_cause
Canonical: #176117
Summary: Two open PRs implement the same failed-expiry settlement repair for the canonical report; neither supplied shipped-entry-point proof.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The linked report establishes active child-result handoff failures, and current main confirms that failed recovery loses its settlement owner.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide the changed recovery-path runtime evidence and stable-to-head existing-state validation described in the proof assessment.

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.

Reviewed October 18, 2026, 4:22 AM ET / 08:22 UTC.

steipete added a commit to sukhdeepjohar/openclaw that referenced this pull request Oct 18, 2026
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 added a commit that referenced this pull request Oct 18, 2026
…mpletion for 7 days (#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 #176145; additional regression coverage adapted from #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]>
@steipete

Copy link
Copy Markdown
Contributor

Thanks @xyi74976-del! Your approach and private-parent/rejected-write regression coverage were folded into #176145, which landed as 9312615 with your co-author credit. Closing this as covered by the landed fix.

@steipete steipete closed this Oct 18, 2026
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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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