Repository navigation
fix: deliver a saved child answer after a Gateway crash - #207706
Conversation
Recover a confirmed final from the original child run before treating an orphaned registry row as interrupted. Keep normal parent delivery, the recorded reply time, and the existing interruption notice when no final was saved. Co-authored-by: daniel-lxs <[email protected]>
Worked on by: - @daniel-lxs Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: 8765fc69-70a9-4cf5-ba52-608b5c68ac71
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: passed. What this changesRecover producer-confirmed child answers after a Gateway crash and preserve inspected visible transcripts during deferred cleanup. Example: Run completed saves “saved child answer” immediately before the Gateway crashes.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a current saved-answer loss path through the existing completion owner; no blocking correctness or security defects were found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe subagent registry restores child runs, reads their recorded transcripts, and sends terminal outcomes through the existing parent-delivery and cleanup owners. flowchart TD
A[Restored child run] --> B[Registry sweeper]
B --> C[Original run transcript]
C --> D[Terminal completion owner]
D --> E[Parent delivery]
D --> F[Deferred cleanup]
Technical reviewBest possible solution: Recover confirmed local finals through the existing terminal owner while retaining interruption fallback, cancellation precedence, and restart-specific transcript preservation. Do we have a high-confidence way to reproduce the issue? Current-main source establishes that a crash between saving the child's final and registry completion produces an interruption instead of recovering that answer; this read-only review ran no reproduction. Is this the best way to solve the issue? The patch repairs the existing recovery path with producer evidence and a bounded read retry, without introducing a second execution or delivery owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 97b31dd340ea. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +56, Tests +287, Docs +7. Total +350 across 13 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed November 28, 2026, 5:53 PM ET / 22:53 UTC (Revision 4). |
Retry the local evidence read once, not the whole sweep. If the read still fails, settle the original run through its existing interruption and delivery path instead of leaving the parent waiting. Co-authored-by: daniel-lxs <[email protected]>
Worked on by: - @daniel-lxs Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: e738913b-3c51-436c-b7f8-888355c38c4c
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Distinguish the unconfirmed crash fallback from live shutdown instead of inferring it from an untimed error. Keep child transcript retention with the child-session owner: hidden-effects cleanup must not open a visible session target for hard deletion during requester delivery. Co-authored-by: daniel-lxs <[email protected]>
Worked on by: - @daniel-lxs Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: 80bda22f-ca7e-42b4-aa53-250cbc95fd59
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep the verified replacement cleanup path and its removal primitive unchanged from main. Record the visible-transcript preservation decision only when a crash completion is committed, so deferred terminal cleanup can respect it after another restart. Exercise both session metadata and answer retention using SessionManager. Co-authored-by: daniel-lxs <[email protected]>
Worked on by: - @daniel-lxs Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: d2361948-5a64-4256-bf5a-440963ea98d1
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…or baseline * commit '2f2edbf36836a8ddc6758dfdcce872d4414a3a92': (520 commits) chore(doctor): hold expired doctor migrations as removal-pending (#207865) fix: show ended one-time automations in History (#201280) chore(release): update appcast for 2026.11.11 (#207504) fix: let updates back up deeply nested databases (#207756) fix(telegram): stop resending earlier messages to the model on every turn in DM topics (#207684) feat(workboard): choose which sessions appear on a board (#207781) fix: acknowledge updates when the Gateway first becomes ready (#207819) chore: stop the cron recovery test from failing CI on slow runners (#207837) fix: queue follow-ups when session creation reuses an active chat (#207800) feat(clawrouter): consume qualified native memory embeddings (#191874) fix: save the account for main-session prompts and converted reminders (#207776) test(infra): measure worker Buffer storage directly (#207663) feat(workboard): hide sessions and filter subagents per board (#207744) chore(i18n): refresh native locales (#207796) fix: name safe recovery when agent schema markers disagree (#207705) improve(ui): show only setup warnings on skill pages (#203750) fix(gateway): keep Linux legacy lock recovery explicit (#207340) fix: deliver a saved child answer after a Gateway crash (#207706) fix(ui): fold background command wakes into chat activity (#207305) fix: restore the Feishu proxy transport tests (#207782) ...
…aseline * commit '2f2edbf36836a8ddc6758dfdcce872d4414a3a92': (520 commits) chore(doctor): hold expired doctor migrations as removal-pending (#207865) fix: show ended one-time automations in History (#201280) chore(release): update appcast for 2026.11.11 (#207504) fix: let updates back up deeply nested databases (#207756) fix(telegram): stop resending earlier messages to the model on every turn in DM topics (#207684) feat(workboard): choose which sessions appear on a board (#207781) fix: acknowledge updates when the Gateway first becomes ready (#207819) chore: stop the cron recovery test from failing CI on slow runners (#207837) fix: queue follow-ups when session creation reuses an active chat (#207800) feat(clawrouter): consume qualified native memory embeddings (#191874) fix: save the account for main-session prompts and converted reminders (#207776) test(infra): measure worker Buffer storage directly (#207663) feat(workboard): hide sessions and filter subagents per board (#207744) chore(i18n): refresh native locales (#207796) fix: name safe recovery when agent schema markers disagree (#207705) improve(ui): show only setup warnings on skill pages (#203750) fix(gateway): keep Linux legacy lock recovery explicit (#207340) fix: deliver a saved child answer after a Gateway crash (#207706) fix(ui): fold background command wakes into chat activity (#207305) fix: restore the Feishu proxy transport tests (#207782) ...
…aseline * commit '2f2edbf36836a8ddc6758dfdcce872d4414a3a92': (520 commits) chore(doctor): hold expired doctor migrations as removal-pending (#207865) fix: show ended one-time automations in History (#201280) chore(release): update appcast for 2026.11.11 (#207504) fix: let updates back up deeply nested databases (#207756) fix(telegram): stop resending earlier messages to the model on every turn in DM topics (#207684) feat(workboard): choose which sessions appear on a board (#207781) fix: acknowledge updates when the Gateway first becomes ready (#207819) chore: stop the cron recovery test from failing CI on slow runners (#207837) fix: queue follow-ups when session creation reuses an active chat (#207800) feat(clawrouter): consume qualified native memory embeddings (#191874) fix: save the account for main-session prompts and converted reminders (#207776) test(infra): measure worker Buffer storage directly (#207663) feat(workboard): hide sessions and filter subagents per board (#207744) chore(i18n): refresh native locales (#207796) fix: name safe recovery when agent schema markers disagree (#207705) improve(ui): show only setup warnings on skill pages (#203750) fix(gateway): keep Linux legacy lock recovery explicit (#207340) fix: deliver a saved child answer after a Gateway crash (#207706) fix(ui): fold background command wakes into chat activity (#207305) fix: restore the Feishu proxy transport tests (#207782) ...
) Recover a worker-confirmed final answer from the original child transcript after a Gateway crash. Use the existing requester delivery path and send the interruption notice if the local transcript stays unreadable after one retry. Preserve a visible transcript during restart recovery while keeping ordinary steer and shutdown behavior. Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: 8765fc69-70a9-4cf5-ba52-608b5c68ac71 OpenClaw-Publication: e738913b-3c51-436c-b7f8-888355c38c4c OpenClaw-Publication: 80bda22f-ca7e-42b4-aa53-250cbc95fd59 OpenClaw-Publication: d2361948-5a64-4256-bf5a-440963ea98d1
Preserve the existing requester restart reason in announce classification so unconsumed completed results remain pending for startup custody. Existing consumption receipts prevent replay; permanent refusals, explicit cancellation, and ambiguous sends retain their policies. (cherry picked from commit b8b06c4) Follow-ups: fca5133 fix: preserve child completion inputs across Gateway restarts (#208367) [not selected for this narrow backport]; b7967b2 fix: deliver a saved child answer after a Gateway crash (#207706) [not selected for this narrow backport]; 17e2ec9 fix: tell the user when a finished subagent's report can't start in their chat (#207194) [not selected for this narrow backport]; 811f999 refactor(subagents): centralize completion delivery decisions (#206383) [not selected for this narrow backport]; 50a6774 fix: retain channel requester when child completion resumes parent [separately ordered lane row]; d2699a8 chore: carry and enforce participant limits on admitted runs (#204847) [not selected for this narrow backport]; 57dd84b fix(agents): settle every undelivered child completion into history; drop delivery dispositions (#204260) [separately ordered lane row]; cded11f fix(agents): deliver a child's end state as parent history, not a turn obligation (#204178) [not selected for this narrow backport]; 92e92d7 fix: preserve restarted child results and gateway test ownership (#203839) [not selected for this narrow backport]; 09d956b fix(subagents): wake a yielded requester for each ready child result (#203176) [not selected for this narrow backport]; 9f35510 fix: retain child results behind live requester turns (#203198) [separately ordered lane row]; c23cd7f fix: preserve private child results during restart (#203156) [separately ordered lane row] Release adaptation: Keep stable requester fixture setup and insert the two consumed/unconsumed restart cases without moving its existing lost-yield test. Co-authored-by: RomneyDa <[email protected]>
Related: #206422 (the crash-without-an-answer case).
What Problem This Solves
A waiting parent can lose an answer its child saved just before a Gateway crash. If the child's transcript stays unreadable, the parent can instead wait indefinitely.
User Impact
The parent receives the confirmed answer once, or an interruption notice if the Gateway still cannot read the answer after one local retry. The child is not rerun. Ordinary steering, explicit session deletion, graceful shutdown and timeout precedence keep their existing behavior. No configuration change or migration is required.
Why This Change Was Made
I kept the interruption behavior from #206437 and #207549 when there is no confirmed final. A saved answer needs the original run ID, the producer's terminal marker and a successful stop. Recovery records whether it found that final rather than guessing from a missing end time. This also leaves live shutdown free to honor an already accepted Stop.
Only crash recovery records that later cleanup must leave the inspected visible transcript alone. The decision survives another restart. This preserves the readable answer and avoids reopening a damaged child database to delete it while the healthy parent's wake is queued. An explicit
cleanup: "delete"still applies to the child session.I left the shared deletion operation and steer replacement code identical to main. #151936 retained post-replacement transcript cleanup; #167966 required a verified predecessor before retiring it. That history concerns a distinct, explicitly recorded target, not a policy to erase default visible spawns.
Evidence
I verified that published head
285bb91df68fhas tree527db66ff6d9, identical to the tested tree. In the three-way CrabBox AWS comparison, a read-only SQLite connection checked both the session row and the exact answer after the real replacement operation finished:1bf587626b5d9be8The explicit-target cases seeded a recorded target. Separately, a real public visible spawn and follow-up on each revision showed what the default does: it recorded no target, replaced the paused run, preserved the visible conversation and wrote the successor's final.
On the same fixed tree I killed the real Gateway after the child saved its final and before registry completion. The readable case delivered the answer once and retained the child final; the persistently unreadable case delivered one interruption. Both produced a direct parent acknowledgment with zero history-only fallbacks. A second restart added no delivery or model call. The Gateway and Codex app-server were real; model responses were scripted.
The regression failed on the previous head because the retired session still existed. On the exact published tree, 42 selected tests passed, as did formatting, lint and both core and touched-test typechecks. The new tests write answers through an awaited
SessionManager. Deferred cleanup runs against a terminal record reloaded from SQLite and checks the actual session and transcript. Relative to the merge base: production +116/-18 lines; tests +272/-27. The shared remover adds no new policy. Both AWS leases for the steer comparison were released.Earlier proof, not counted as final-head runs: the SIGTERM process comparison checked at handler return and caught a pending Stop that an exit-only check missed. Both live-shutdown owner controls passed again on this head. Earlier runs cover direct crash delivery, cleanup checks and the corrected preview counter, an intermediate shutdown run whose wrapper exited 1, nine crash comparisons, bounded reads, and a crash before any final. I did not run the full suite or use live model inference.
Worked on by: @daniel-lxs
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by
🦞 Made with OpenClaw