Skip to content

fix(subagents): resume restart recovery after retained run cleanup - #175044

Merged
steipete merged 1 commit into
mainfrom
fix/subagent-retained-run-recovery-20261017
Oct 17, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/subagent-retained-run-recovery-20261017

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes interrupted subagent tasks remaining pending after a retained run finishes cleanup.

User Impact

Restart recovery schedules its existing one-second wake when the live run releases ownership, including when its session admission released earlier. Recovery still rereads current state and checks authority before settling the interrupted task or continuing its requester.

Why This Change Was Made

#174838 removed broad session-change cache invalidation while promising that “retained owners still expose currentness/release.” The retained-owner check includes registry runs, but its release promise covers only session admissions. Real command cleanup releases admission before awaited cleanup and final run-context removal, so recovery can retain a run without a subsequent wake.

The coordinator now observes only runtime/run-registry changes for retained owners and wakes when that ownership ends. Deferred retry deadlines remain intact. Reset removes the observer, and the existing test now also covers admission releasing before run-context cleanup. The operations documentation describes this distinction.

Evidence

  • Current main d5c7055a7006: the original retained-run case fails; 76 other cases pass. The two original ownership cases pass on c7242cb54d7c, parent of refactor(agents): simplify completed-run bookkeeping #174838. Relevant source is unchanged between that PR's landed commit and the reproduced main.
  • Fixed restart recovery: 78/78 pass, 50.58s Vitest / 61.05s wrapper; original failing case 7ms and staggered-release case 6ms.
  • Adjacent sweeper recovery: 49/49 pass, 59.95s Vitest / 76.55s wrapper, including deferred backoff and cleanup scheduling. Both files ran under Node with --maxWorkers=1.
  • Targeted typecheck, type-aware lint, source/docs formatting, one-page MDX validation, and independent P0–P2 review pass.

No timeout, assertion, retry budget, or authority check was weakened. PR CI supplies broad proof; no workflow was dispatched or rerun.

PR #174838 removed broad session-change invalidation, but retained run
contexts have no admission-release promise. Command cleanup can release
its admission before awaited cleanup clears the run context, leaving a
recovery attempt without its next wake.

Observe only runtime/agent-run changes for retained owners, and schedule
the existing one-second wake once their current ownership ends. Preserve
admission-release wakes, bounded deferred retries and effect authority.
Unsubscribe on reset and account for release during the recovery read.
Extend the existing ownership table with staggered admission/run release.

Main reproduces the retained-run failure; #174838's parent passes both
original cases. Fixed recovery and sweeper files pass 127 tests with
maxWorkers=1 (61.05s and 76.55s wrappers). Targeted types, lint, formatting,
docs MDX and isolated P2 review pass. No CI dispatch or rerun.
@clawsweeper

clawsweeper Bot commented Oct 17, 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.

@steipete
steipete marked this pull request as ready for review October 17, 2026 03:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T03:24:56.146096Z 3438c43 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: XS labels Oct 17, 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 17, 2026
@steipete
steipete merged commit 2f50ba6 into main Oct 17, 2026
190 of 193 checks passed
@steipete
steipete deleted the fix/subagent-retained-run-recovery-20261017 branch October 17, 2026 03:35
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…175044)

PR openclaw#174838 removed broad session-change invalidation, but retained run
contexts have no admission-release promise. Command cleanup can release
its admission before awaited cleanup clears the run context, leaving a
recovery attempt without its next wake.

Observe only runtime/agent-run changes for retained owners, and schedule
the existing one-second wake once their current ownership ends. Preserve
admission-release wakes, bounded deferred retries and effect authority.
Unsubscribe on reset and account for release during the recovery read.
Extend the existing ownership table with staggered admission/run release.

Main reproduces the retained-run failure; openclaw#174838's parent passes both
original cases. Fixed recovery and sweeper files pass 127 tests with
maxWorkers=1 (61.05s and 76.55s wrappers). Targeted types, lint, formatting,
docs MDX and isolated P2 review pass. No CI dispatch or rerun.
steipete added a commit that referenced this pull request Oct 17, 2026
PR #175033 intentionally makes missing-source requester and yielded
continuations settle once without inventing operator authority. These
restart-fence fixtures instead need an authorized original requester.

Reuse prepareSubagentRecoveryFixture before persisting their rows. Keep
existing parent identity in the yielded integration case and preserve all
wake, stale-batch, delivery, and deadline assertions. Production code and
missing-source settlement coverage remain unchanged.

Attribution: current main a1ef282 reproduces three matching failures;
pre-#175033 cc19e13 passes seven focused cases while already containing
#175044. The ownership-release fix is therefore retained.

Validation: both full affected files pass all 45 tests under Node with
maxWorkers=1 (272.02s Vitest; native SQLite restart/fence coverage).
Targeted types, type-aware lint, formatting, and isolated P2 review pass.
No CI dispatch or rerun.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…aw#175186)

PR openclaw#175033 intentionally makes missing-source requester and yielded
continuations settle once without inventing operator authority. These
restart-fence fixtures instead need an authorized original requester.

Reuse prepareSubagentRecoveryFixture before persisting their rows. Keep
existing parent identity in the yielded integration case and preserve all
wake, stale-batch, delivery, and deadline assertions. Production code and
missing-source settlement coverage remain unchanged.

Attribution: current main a40e1b1 reproduces three matching failures;
pre-openclaw#175033 c8f9ee3 passes seven focused cases while already containing
openclaw#175044. The ownership-release fix is therefore retained.

Validation: both full affected files pass all 45 tests under Node with
maxWorkers=1 (272.02s Vitest; native SQLite restart/fence coverage).
Targeted types, type-aware lint, formatting, and isolated P2 review pass.
No CI dispatch or rerun.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling 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. docs Improvements or additions to documentation size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant