Repository navigation
fix: recover child results when restart interrupts requester delivery - #199488
Conversation
|
🦞👀 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 Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesPreserves captured child results when restart interrupts their requester’s delivery turn and prevents a duplicate recovery turn. Example: Gateway restarts while processing CAPTURED_CUSTODY_RESULT for agent:main:dashboard:restart-hub.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: main still mishandles interrupted requester delivery, and this PR repairs the existing owners without an identified code defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherSubagent completion passes captured results through the requester’s controller mailbox; restart recovery reconstructs pending obligations and admits their continuation under current authority. flowchart LR
A[Completed child] --> B[Captured result and wake]
B --> C[Requester controller input]
C --> D[Restart interruption receipt]
D --> E[Fresh restart admission]
E --> C
C --> F[Requester reply and delivery receipt]
Technical reviewBest possible solution: Keep restart interruption retryable at the existing receipt producer and let the existing completion owner resume the same input once. Do we have a high-confidence way to reproduce the issue? Source exposes the terminal Stop receipt and wake-retirement paths, and the supplied regression reports failure on the exact base; no target code was executed during this review. Is this the best way to solve the issue? The patch corrects the recorded cause and reuses exact settle identity, current requester admission and existing replay deduplication without adding a parallel recovery owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d1cdb8b69707. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +29, Tests +88, Docs +6, Other +178. Total +301 across 9 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. 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 HistoryReview history (1 earlier review cycle)
Reviewed November 15, 2026, 1:58 AM ET / 06:58 UTC (Revision 2). |
|
Addressing all four open items against final code head
Inspectable real-Gateway proof is committed in the restart harness: the graceful and SIGKILL branches preserve pending captured results, assert one persisted input and one completed reply after reconstruction, and repeat the restart to assert deduplication again. The provider is synthetic; Gateway, SQLite, controller and process termination are real. Relevant sanitized local test output: The captured/stopped-child case was rerun separately after moving an assertion before its expected bookkeeping retirement; all four custody cases and all seven yielded restart cases passed. The new announcing case fails on exact parent @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…openclaw#199488) * fix: recover child results when restart interrupts requester delivery * test: align synthetic restart benchmark run identities
Related: #198905
What Problem This Solves
Fixes a captured child result being lost when a Gateway restart interrupts the requester’s settle/announce turn before it replies.
User Impact
A retained successful child result is handed back to its requester once after restart, without a duplicate recovery turn or a false “completion agent did not produce a visible reply” outcome. Intentional Stop still ends the obligation. No configuration, database schema, or retention policy changes.
Why This Change Was Made
The shutdown controller already distinguishes restart interruption from Stop, but two consumers discarded that distinction: the announce observer retired its wake, and the input observer sealed a non-retryable Stop receipt. Both now consume the existing typed restart reason. The restart owner recognizes that the surviving settle input owns continuation, so it does not also enqueue a generic recovery turn.
This adds 29 production lines across the existing owners. The growth is needed to recognize the previously missing interrupted-announce state; it adds no cache, state store, schema, or independent lifecycle manager. The lookup uses the existing requester index and exact settle identity. An earlier additional replay flag was removed in favor of correcting the input receipt at its producer.
Evidence
The new real-Gateway graceful-restart regression fails on base
3c6bb67f82aec52a12644933434a9d5ed7e6ed01: the successful child changes from pending to failed and loses its wake. With the fix, graceful shutdown and SIGKILL both preserve one input and produce one completed requester response; a second restart does not duplicate either. The provider is synthetic; the Gateway, SQLite, controller, and process restarts are real.The native input-owner tests prove that restart reopens the consumed input and retains deduplication, while existing intentional Stop tests remain green. The stopped-child case verifies the parent receives actionable recovery guidance and the child is not independently rerun. The six-minute retention characterization verifies failed session-run rows can expire while suspended rows remain.
Local proof: 11 real custody/yield restart cases, five ordinary restart cases, 16 native input-owner tests, 131 focused sibling tests, and six sweeper lifecycle tests passed.
pnpm check:changedpassed, followed by a passing changed-file check for the five-line yielded-test fixture correction. Final local Codex autoreview against base3c6bb67fwas scoped-clean through P2, with no accepted/actionable findings. The original parked-message fixture held the now-retained pause-notice model request indefinitely; it now acknowledges that notice while preserving every lifecycle and continuation assertion. Its unchanged version passed on the exact main parent, so this is not being labeled an inherited red.Synthetic btrfs measurement completed on an isolated 8-CPU / 16-GB VM with Node 24.22.1: 50.82 GiB agent SQLite DB, 10,800 session records, 289,998 transcript rows across 3,820 populated sessions, 4,300 retained runs, and 62,000 workspace files totaling 1.10 GiB. No Team data was used. Transcript generation was bounded after the physical DB exceeded the requested scale; the original logical-text estimate would have exhausted the volume. SQLite
quick_checkreturnedok, then the canonical fixture owner completed retained runs and workspace data.Five interleaved process pairs, 20 warmups and 20 measured passes per process; each pass classifies 10,800 sessions. Separate allocation sampling used two processes per arm, 1-KiB sampling, including collected allocations. Imports, metadata loading, and workspace I/O are outside owner timing.
The fixed owner correctly parks all 2,150 interrupted cohorts; the broken baseline parks none. The added 2.73 ms and approximately 4.14 MiB per all-interrupted pass buy the missing correctness work; this is not a speedup claim. Ordinary-run timing is unchanged within process variation. No scan, new I/O, or new cache was added. The read-only metadata pass left the fixture DB size and modification time unchanged. These numbers characterize the indexed owner, not full Gateway startup.
Final head is
82a92ced7bcd022c14f2fb69a374da360485872f; CI run 43686829245 targets that head. Prior runtime-identical head7f464028passed CI run 43682515506 with native watcher GREEN. The sole follow-up aligns the benchmark fixture'slifecycleRunIdandlastRunId; its smoke run covered all 2,150 cohorts, changed-file checks passed, and fresh Codex autoreview was scoped-clean through P2. Existing pending-input and legacy-main-session input-handoff compatibility suites additionally passed 16/16. Final-head CI and zero-open-item ClawSweeper review remain required before merge.Reported live evidence and related investigations
The repository maintainer explicitly requested publication of the following incident evidence and run IDs in this PR. Read-only evidence supplied from Team r333 (
5fbdf698), deployed 2026-11-15 04:20Z:73b346e7completed successfully and its result was captured at 04:16:15Z, pending delivery. Its requester-settle runannounce:dashboard:5a1fa3ac…:73b346e7…:yield-1, created 04:16:16Z, ended withGateway stoppedat 04:19:51Z and deliverynot_required. After restart the child was suspended withpermanent_failure/store replaced.f0d74c47,announce:subagent:04ee1ba0, andae2c7c6f—were delivered at 04:26:21Z. This distinguishes the missing path from fix: deliver retained child results after Gateway restart #198905’s retained-result recovery.c8a0d37f(running 26 minutes),c725603d, andfaffe7d7ended withGateway stopped. The restart contract intentionally stops child executions and recovers their top-level requester to inspect saved work and issue further instructions. It does not independently resume every child execution. The real restart test proves that visible parent recovery path.b05d48cd,b9e5ac55,0a4cb605, andfaffe7d7reportedly disappeared within roughly six minutes. The sweeper has an existing five-minute TTL for completed session-run bookkeeping without an archive deadline, while suspended rows have a separate seven-day retention guard. Confirmed killed rows can also retire when their requester obligation settles. These are bookkeeping rows, not a durable audit log. Thestore replacedreason denotes retired in-memory completion authority and does not by itself prove that a physical database was replaced. Exact historical deletion cannot be attributed from the supplied IDs alone; no retention change is included.No Team data was copied and no live deployment, restart, or configuration change was performed. This change prevents new restart interruptions from being recorded as intentional Stop; it does not reinterpret old ambiguous Stop receipts.