Repository navigation
fix(agents): recover interrupted children without stale failures - #159492
Conversation
Preserve typed restart interruptions, identify unfinished children in parent recovery input, and prefer retained-session continuation after checking uncertain effects. Keep genuine execution failures and exact-owner recovery delivery exhaustion visible. Cover restart persistence, parent dispatch, projection ownership, and the rendered sidebar.
|
🦞👀 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 maintainer review before merge. Reviewed September 27, 2026, 12:58 PM ET / 16:58 UTC (Revision 8). ClawSweeper reviewWhat this changesThe branch preserves typed child-run restart interruptions, gives the recovering parent a scoped list of unfinished children, and shows interruptions with a neutral status in the Gateway and Control UI. Merge readiness✅ Ready for maintainer review Current main still shows restart interruptions as child failures and does not provide a lifecycle-scoped recovery roster. This PR addresses that remaining behavior, with positive provider-boundary and upgrade evidence. The discussion expressly accepts the additive status and historical-record semantics. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw stores parent sessions and child runs in SQLite. After a Gateway restart, recovery reads those records to resume the parent; the Gateway also projects child status to clients such as the Control UI. flowchart LR
A[Saved parent session] --> C[Gateway restart recovery]
B[Saved child runs] --> C
C --> D{Current parent ownership?}
D -->|Yes| E[Child recovery roster]
D -->|No| F[Diagnostic history only]
E --> G[Parent model turn]
B --> H[Gateway session status]
H --> I[Control UI indicator]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +255, Tests +901, Docs +29. Total +1185 across 48 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use one lifecycle-checked recovery roster to guide the parent while retaining diagnostic history and distinguishing ordinary interruptions from genuine execution or delivery failures. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source maps interrupted status to failed and omits the child roster from restart dispatch; the PR records the resulting recovery scenario at an HTTP provider boundary. This reviewer did not execute the code. Is this the best way to solve the issue? Yes. The patch uses the existing registry, recovery, Gateway projection, and UI owners, with parent lifecycle checks at the actionable roster and delivery boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e2aa96231351. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
Resolve physical session storage through its async owner before selecting retained child runs. Cover retired and unknown stores, upgrade reconciliation with typed restart ownership, and unchanged ambiguous history. Align the existing websocket and startup assertions with interrupted session status.
Require the captured requester session identity after selecting the latest child generations. Preserve unscoped run-history queries and prove reset-parent exclusion at dispatch. Strengthen upgrade coverage by reopening SQLite records with and without retained restart ownership.
Capture the requester lifecycle revision in every spawn path and use it for actionable restart rosters. Prove the real Gateway reset boundary at an HTTP model provider: reset keeps the session ID, current work is delivered, and pre-reset work is excluded while diagnostic history remains available.
Integrate current main while preserving its wake and progress-card refactors. Keep actionable child identities exclusively in the requester-lifecycle-checked recovery roster; retain ordinary completion history and atomic batch settlement.
|
Maintainer decision: I accept the additive The incomplete execution outcome remains recorded. Genuine execution failures, exhausted delivery failures, and ambiguous historical failures without typed restart evidence remain failures. Recovery does not blindly replay child commands. Existing completion history and atomic batch settlement remain intact; only the captured-parent-lifecycle roster supplies new child recovery instructions and addresses. The PR includes client/protocol/UI checks, persisted-row SQLite reopen proof, and real Gateway/provider coverage. The remaining hosted CI and published-updater checks must complete before landing. This acceptance covers the public status and historical-record semantics; it does not authorize a deployment or restart of a live Gateway. |
Reuse the real Gateway and Responses fixture for current, reset-revoked, and restored-history saved batches. Replace the corrupt Windows media-tool PNG with the canonical valid image fixture while preserving all assertions.
|
Merged via squash auto-merge.
|
…nclaw#159492) * fix(agents): recover interrupted children without stale failures Preserve typed restart interruptions, identify unfinished children in parent recovery input, and prefer retained-session continuation after checking uncertain effects. Keep genuine execution failures and exact-owner recovery delivery exhaustion visible. Cover restart persistence, parent dispatch, projection ownership, and the rendered sidebar. * fix(agents): bind restart child recovery to its requester store Resolve physical session storage through its async owner before selecting retained child runs. Cover retired and unknown stores, upgrade reconciliation with typed restart ownership, and unchanged ambiguous history. Align the existing websocket and startup assertions with interrupted session status. * fix(agents): fence restart recovery to the parent session incarnation Require the captured requester session identity after selecting the latest child generations. Preserve unscoped run-history queries and prove reset-parent exclusion at dispatch. Strengthen upgrade coverage by reopening SQLite records with and without retained restart ownership. * fix(agents): retain parent lifecycle ownership through child recovery Capture the requester lifecycle revision in every spawn path and use it for actionable restart rosters. Prove the real Gateway reset boundary at an HTTP model provider: reset keeps the session ID, current work is delivered, and pre-reset work is excluded while diagnostic history remains available. * fix(agents): scope settled recovery guidance to parent lifecycle * test: verify saved batch recovery at the HTTP provider boundary Reuse the real Gateway and Responses fixture for current, reset-revoked, and restored-history saved batches. Replace the corrupt Windows media-tool PNG with the canonical valid image fixture while preserving all assertions.
What Problem This Solves
Fixes persistent red child-task warnings after a Gateway restart and gives the resumed parent an explicit list of unfinished work to reconcile.
User Impact
The parent checks retained results and prefers continuing the same child when its work is still needed. Normal restart interruptions show a neutral pause indicator. Genuine execution failures and exhausted parent-wake delivery remain actionable; an old delivery failure cannot mark newer work as failed.
The recovery roster belongs to the current parent. Children from another store, replaced session, earlier reset, unknown ownership, or a superseded generation cannot become actionable recovery instructions. Existing recently completed execution metadata remains diagnostic history.
Why This Change Was Made
Restart settlement discarded its typed interruption reason and projected an incomplete execution as an ordinary session failure. Preserve that existing reason through the lifecycle owner and compact reads, carry interrupted status through the Gateway/UI contract, and share bounded reconciliation guidance between main-session recovery and child-batch wakeups.
Reset preserves a session ID and rotates its lifecycle revision. Native, ACP, and visible spawns now capture both together before awaited launch. The registry selects latest child generations before matching requester agent, canonical physical store, session ID, and lifecycle revision. This uses optional metadata in the existing run payload; no database/protocol version bump, migration, new scheduler, or command replay is required. Existing retry and authority owners remain in control.
Saved batch wakes apply the same exact ownership matcher to their actionable roster and capture the parent identity before awaiting findings. Final dispatch revalidates that immutable identity, including the existing followup path. Ordinary completion history, frozen cohort identity, atomic settlement, and public/private delivery contracts are preserved. The added child-session field and “parent recovery required” directive were removed from ordinary findings; only the lifecycle-checked roster supplies recovery addresses and instructions.
On upgrade, saved records with a retained typed restart-recovery owner are reconciled on startup. Ambiguous historical failures without that evidence remain failed; error text is not a safe discriminator. Only matching captured ownership enters the actionable roster. Saved history remains available for inspection.
Evidence
Published-updater compatibility passed: Package Acceptance run 36331276511 used trusted Tooling SHA
220a6d0c71aef054f25c4a95afae93040c157d6b, candidate runtime SHAf46615c2f2783ceaa8ba0c2397cef9305bff2720, and the canonical[email protected]/taskflow-restorationcell. The published updater installed the candidate tarball (package version 2026.9.6), verified its build identity, migrated the seeded task/flow records and child links, and passed SDK/page reads plus persistence checks across two candidate Gateway starts. The lane passed in 266 seconds. Evidence artifactdocker-e2e-published-upgrade-survivorcontains the phase receipts and exact source-commit assertions. This is the actual published 2026.9.4 driver, not a claimed 2026.9.6-driver run; interruption-specific historical cases are separately covered by the closed/reopened SQLite tests. Later PR edits add tests only; main integrations preserve the recovery patch and include the already-landed fixture repair.Maintainer acceptance of the additive status and typed historical-record behavior is recorded. Final CI run 36334750472 passed on reviewed head
84f5524596e5fbbeb4054a982048434a3372729f. Merged as3d62d4e2a5e112bb0a558fa4ff1dca723074be1e.Real Gateway → HTTP model-provider boundary: the extended startup-recovery test uses an isolated Gateway and local Responses provider, invokes public
sessions.reset, then records the actual recovery prompt received by the provider. With only session-ID matching, the old child incorrectly remains actionable after reset. With lifecycle matching, the trace is:{"proof":"restart-parent-provider-boundary","originalChildDelivered":true,"resetPreservedSessionId":true,"resetChangedLifecycle":true,"currentChildDelivered":true,"oldChildDeliveredAfterReset":false,"historicalMetadataRetained":true}The assertion inspects the actionable recovery prompt separately from the documented Recently Completed Subagents diagnostic history. The existing fixture also verifies queued browser-turn cancellation and exactly-once execution. No live operator Gateway was modified.
Saved-batch Gateway → actual HTTP model provider: the same real Gateway/provider fixture now persists/reloads an owned saved batch, observes its actionable roster at HTTP, re-arms it, confirms public reset revokes the live wake without another provider request, and explicitly restores older fixture history. The restored row reaches HTTP as ordinary findings with no actionable child roster or recovery directive:
{"proof":"saved-batch-provider-boundary","currentChildActionable":true,"liveWakeRevokedByReset":true,"olderFixtureHistoryRestored":true,"staleChildActionable":false,"ordinaryResultRetained":true,"diagnosticHistoryRetained":true}The two final batch requests reach the actual local HTTP Responses server; they do not use a mocked agent command. Existing Gateway/provider fixtures and atomic completion are reused, with no additional Gateway boot, timer, or polling loop. The extended command passed in 62.49 s wall (test body 20.558 s).
Saved-batch Gateway admission → final agent-command boundary: four cases persist/reload the original frozen cohort, then verify current, stale, mixed, and legacy rows. Stale and unknown rows retain their ordinary result text but cannot add actionable continuation instructions; current children in mixed cohorts remain present. All 84 focused tests passed across the Gateway replay and announce ownership/dispatch/results suites. The previous implementation fails the stale/legacy actionable-roster assertions. A further full-message regression fails on the redundant recovery directive and passes after ordinary findings become diagnostic-only.
The actual public
sessions.resetpath already revokes its existing saved wakes:killSubagentRunTreedefaultssuppressCompletedWakesto enabled. The new regression verifies no agent dispatch for that current-reset path, then explicitly restores an older saved row to test the added roster contract. This distinguishes current reset behavior from deliberately seeded retained history; it does not claim current reset leaves an unrevoked wake. No per-member settlement API or new delivery policy was added.Additional proof: main recovery suite 220 passed before the final boundary extension; final replacement/reset parent cases passed. Parent-settle results 3 passed; restart integration 14 passed; compact SQLite reads 28 passed; lifecycle guards 6 passed; Gateway projection 29 passed; registry-read siblings 21 passed; Sessions view 47 passed; spawn requester-incarnation coverage passed across all three producers and SQLite reload. Six historical upgrade/ownership cases passed after persisting released-format rows, closing both SQLite owners, clearing the registry, and reopening at startup. The row codec and normalizer are unchanged from released commit eb377ac; this is a persisted synthetic-state test, not an old-binary deployment.
The UI E2E shows interruption clearing red attention and a later real failure restoring it. Inspected synthetic screenshots are below. After integrating main’s wake/UI refactors, the Gateway replay, spawn-incarnation, and parent restart suites passed (38 tests); progress-card unit tests passed (53), the sidebar E2E passed, and core/UI types passed. All selected typecheck, lint, formatting, schema, and import gates completed; Swift/Kotlin protocol and i18n checks need no generated changes. Independent Codex review of the full candidate found no actionable P0 findings; the final batch correction also passed an independent P0/P1 review.
After integration, CI run 36331082383 stopped on the Windows registered media-tool test: its pre-existing 68-byte PNG had invalid IDAT CRC and zlib Adler32 checksums. Strict zlib and the actual shared Rastermill decoder both reproduced the exact “incorrect data check” failure. An independent canonical-fixture substitution verified the decoder fix locally. Main then landed the same root-cause repair in #159771; this branch retains that landed valid 67-byte PNG exactly and drops its duplicate edit. Strict CRC/zlib validation passes for the landed bytes. All registered image/PDF/image-generation assertions are unchanged. This is a test-input correction, with no product-code change. The Windows route passed in final CI.
CI run 36322522543 passed on the preceding corrected head. A later run, 36314996491, timed out in the unchanged Gmail hot-reload SecretRef fixture. Its original local shard selection passed (51 files/886 tests; two CI-only files excluded by local policy), and focused cases passed on Node 26 and 24.21. The Linux/Node 24.19 timeout remains unexplained; no timeout, assertion, or retry was weakened, and passing replays are not claimed as a fix. Final-head CI passed.
Measured test cost
Commands use
pnpm test <file> --maxWorkers=1; UI E2E uses its dedicated wrapper. Existing fixtures are reused. Cold compiler/worker preparation contributes materially to wall time.The long existing suites cover real recovery/storage/worker composition. The real Gateway test is needed because session reset preserves its ID; a session-ID-only mock missed that boundary. No new Gateway fixture, polling loop, worker pin, or timer increase was added. On passing CI run 36310109829 the relevant compact-large-19 job took 388 s and UI E2E jobs took 246–436 s.