Skip to content

fix: resume unfinished tasks after Gateway restarts - #153243

Merged
steipete merged 1 commit into
mainfrom
codex/parent-restart-recovery
Sep 20, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/parent-restart-recovery

Conversation

@steipete

@steipete steipete commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: unfinished parent tasks stop after a Gateway restart when their latest turn was started by a subagent result.

User Impact

Interrupted parents continue with a restart notice and their existing transcript. Interrupted native children report back through normal completion; the parent can continue a retained child with sessions_send or assign replacement work. Children are no longer automatically relaunched. Existing cleanup, retention, permissions, and startup capacity limits remain in place.

Why This Change Was Made

Remove the assumption that an announcement-triggered turn only delivers a report, and remove the separate child relaunch, acceptance, retry, and resumption-notice machinery. The parent owns finishing the user's request. A saved child notification joins its recovered parent's exact result instead of starting duplicate work, and progress alone does not count as the owed final reply.

Live execution and admission are revalidated under the terminal completion lock. Delivering an already-saved result remains independent of permission to mutate or clean its child session. Existing shutdown markers and legacy child launch receipts are reconciled without a schema change or new updater behavior.

Evidence

  • Regressions failed before repair for skipped parent continuations, automatic child relaunch, duplicate parent execution, progress-only final receipts, and ownership changes during recovery.
  • Final runtime verification: 530 tests passed across real Gateway stop/start with controlled agent execution, child lifecycle/settlement, saved-result delivery, and isolated recovery classification. Additional parent recovery, cancellation, and delivery suites passed during development.
  • Post-rebase verification: the runtime was rebuilt and all 284 tests passed across settlement queries, real Gateway restart, database-worker parent recovery, child recovery, and requester-wake end-to-end flows. This includes the newer historical-grandchild settlement behavior on main.
  • Delivery evidence: 27 tests passed. Hidden model-session cleanup: 18 focused tests passed. The recovery-sweep benchmark preserved all invariants.
  • Test routing: 1,074 broad tooling cases passed; the remaining stale inventory reference was removed and the two focused owner/discovery regressions passed. Explicit isolated ownership now prevents the shortened recovery suite from being excluded from its own project.
  • Documentation, type, lint, storage, and import-cycle checks passed locally. Full local build passed before mechanical unused-export/caller cleanup. The reviewed patch rebases unchanged onto current main; hosted CI validates the integrated head.
  • Hosted CI is green at ba64ac34ac94e1f7046c3ce7736807d73b888c75: 164 passing checks, 50 skipped, no failures or pending checks. CI run.
  • Independent review completed with no actionable P0-P2 findings. No production Gateway was restarted or deployed for this proof.

Recover interrupted parent turns regardless of subagent-result provenance. Settle interrupted children through normal completion and let the parent inspect retained state before continuing or replacing them. Remove automatic child relaunch and retry machinery, preserve existing receipt reconciliation, and fence cleanup against newer owners.
@clawsweeper

clawsweeper Bot commented Sep 19, 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 September 19, 2026 23:22
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 19, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 19, 2026
@clawsweeper

clawsweeper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 19, 2026, 8:00 PM ET / September 20, 2026, 00:00 UTC (Revision 2).

ClawSweeper review

What this changes

Resumes unfinished parent conversations after Gateway restarts, settles interrupted children through normal completion, and reconciles recovered replies without automatically relaunching children.

Merge readiness

✅ Ready for maintainer review

The PR remains necessary: fetched main and v2026.9.5 retain the parent-recovery defect. No concrete introduced correctness or security blocker was found.

Priority: P2
Reviewed head: ba64ac34ac94e1f7046c3ce7736807d73b888c75

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent ownership simplification with relevant regression coverage and no actionable blocker found.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a maintainer-authored PR, so the ordinary external-contributor gate does not apply. Inspected restart coverage exercises real Gateway lifecycle and SQLite settlement with controlled agent execution; reported test totals were not independently rerun.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a maintainer-authored PR, so the ordinary external-contributor gate does not apply. Inspected restart coverage exercises real Gateway lifecycle and SQLite settlement with controlled agent execution; reported test totals were not independently rerun.
Evidence reviewed 9 items Current main still contains the defect: Fetched main still classifies announcement-origin turns as disposable completion reports, allowing unfinished parent work to be reconciled without continuation.
Latest supplied release retains the same shortcut: The v2026.9.5 source also contains completionSource-based reconciliation; the central repair is not already supplied by that release.
Recovery ownership and final effects: Child recovery captures session identity, checks live executions and admission, and passes current-owner predicates into terminal completion. Completion rechecks after acquiring its lock; cleanup persists suppression when ownership changes while saved-result delivery remains independent.
Findings None None.
Security None None.

How this fits together

Gateway restart recovery reads persisted conversations and delegated-task records to determine what work remains. It coordinates parent continuation, child settlement, final replies, and session cleanup.

flowchart TD
  A[Saved conversations and child runs] --> B[Gateway restart recovery]
  B --> C[Check current execution ownership]
  C --> D[Settle interrupted children]
  C --> E[Resume unfinished parent]
  D --> E
  E --> F[Reconcile final reply receipt]
  F --> G[Complete delivery and owned cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1335, Tests -2474, Docs -21, Other -10. Total -3840 across 59 files.

View PR surface stats
Area Files Added Removed Net
Source 30 402 1737 -1335
Tests 25 665 3139 -2474
Docs 2 35 56 -21
Config 0 0 0 0
Generated 0 0 0 0
Other 2 1 11 -10
Total 59 1103 4943 -3840

Review metrics

Metric Value Why it matters
Runtime versus verification footprint Runtime production −1,335 lines; tests/support/tooling −2,474 lines The cutover removes a separate child-relaunch owner and its obsolete tests while retaining parent, settlement, and cancellation coverage.

Technical review

Best possible solution:

Keep task continuation with the parent, using existing admission, durable completion receipts, and current-owner cleanup safeguards.

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

Yes, from source: interrupt a parent turn started by a child result before its work finishes; current main can discard it based on announcement provenance. No runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Yes. The patch removes the incorrect provenance shortcut and consolidates child interruption into existing settlement, while preserving admission and final-delivery checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2adc87245a5a.

Labels

Label justifications:

  • P2: Repairs task continuation after a Gateway restart with a bounded impact on interrupted parent and child workflows.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a maintainer-authored PR, so the ordinary external-contributor gate does not apply. Inspected restart coverage exercises real Gateway lifecycle and SQLite settlement with controlled agent execution; reported test totals were not independently rerun.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-19T23:30:14.214Z sha ba64ac3 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 18f1c11 into main Sep 20, 2026
291 checks passed
@steipete
steipete deleted the codex/parent-restart-recovery branch September 20, 2026 00:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 20, 2026
Recover interrupted parent turns regardless of subagent-result provenance. Settle interrupted children through normal completion and let the parent inspect retained state before continuing or replacing them. Remove automatic child relaunch and retry machinery, preserve existing receipt reconciliation, and fence cleanup against newer owners.
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 gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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.

1 participant