Repository navigation
fix: guard widget recovery after Gateway crashes - #165468
Conversation
Exercise the real widget and exec tools with a local Responses provider across an owned Gateway crash. Assert successful terminal publication, durable and projected completion, widget revision, and one final reply. The missing database-admission handoff was already repaired by c1b9f4e (related to #165225). This regression fails before that repair on Node and Bun, and passes afterward without live provider credentials.
|
🦞👀 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 5:18 AM ET / 09:18 UTC. ClawSweeper reviewWhat this changesAdds an end-to-end test that crashes an isolated Gateway during widget authoring and verifies automatic recovery, durable completion, widget updates, and one final reply. Merge readiness✅ Ready for maintainer review Keep open: the production repair is already on main, but this PR adds useful process-level regression coverage that main lacks. No blocking patch defects were found. Priority: P2 Review scores
Verification
How this fits togetherGateway restart recovery resumes interrupted agent turns after their session databases become available. The regression exercises that recovery through real Gateway connections, tool execution, and persisted session state. flowchart TD
A[Widget authoring request] --> B[Gateway agent turn]
B --> C[Owned Gateway crash]
C --> D[Restart and database admission]
D --> E[Automatic turn recovery]
E --> F[Widget update and final reply]
E --> G[Durable session completion]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +511. Total +511 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the existing recovery owner and protect its durable crash-recovery contract with this isolated process-level regression. Do we have a high-confidence way to reproduce the issue? Not applicable to a remaining current-main defect: the producer repair is present. The author records a concrete pre-fix failure and after-fix success through an owned Gateway crash on both runtimes. Is this the best way to solve the issue? Yes: a process-level regression exercises startup admission, resumed tool execution, and durable terminal publication without adding another production owner or changing the live fixture. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c2e6410cd6cf. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
) A crash could leave widget authoring running forever when startup recovery finished before the agent database completed background admission. The producer repair is already on main in 9241c9e; add the missing deterministic process-level regression. Use a synthetic loopback provider and owned Gateway restart to prove resumed widget publication, successful terminal notification, durable/projected done, and one final reply without an inline client. Proof: pre-fix failure and post-fix success on Node 24 and pinned Bun; final P2 autoreview scoped-clean; exact-head CI green; ClawSweeper no findings. Production LOC unchanged. Related: openclaw#165225.
What Problem This Solves
Protects automatic widget-turn recovery after a Gateway crash when the session database becomes available after the initial recovery scan.
Related: #165225. The producer fix already landed in c1b9f4e while this reproduction was being developed. This PR adds the missing deterministic process-level regression; production LOC is unchanged.
User Impact
An interrupted dashboard-authoring turn resumes without reconnecting an inline-widget client, updates its pinned widget, and reaches a durable
donestate. No configuration, schema, or timeout changes.Why This Change Was Made
The observed
hasActiveRun: false/status: runningmismatch was a missed recovery handoff: startup correctly skipped a database awaiting inspection, but never revisited it after admission succeeded. The existing live fixture failed before checking the resumed provider turn, so it could not distinguish this from lost terminal persistence.The new local Responses provider drives the real widget and exec tools, then the test kills and replaces only its own isolated Gateway. After recovery it waits for terminal publication and verifies SQLite state, session-list state, widget revision, and exactly one final reply. The landed scheduler fix owns admission recovery; the test does not change status projection or the live fixture's expectations.
Evidence
The reproduction failed on unmodified main
56bdfc723e0don both Node 24.21.0 and the repository-pinned Bun 1.4.3 fork: two provider calls before the crash, none after restart, and the original session row stillrunningafter database admission completed.It passes against main
afc9b8afde74, which contains the producer fix, on both runtimes. Both report persisted/projecteddone,hasActiveRun: false, widget revision 2, and one final transcript marker. Provider traffic is loopback-only with synthetic credentials; state, ports, and logs belong to the fixture.Measured file cost: Node 35.2 seconds of test time / 67.2 seconds wrapper wall; Bun 66.7 seconds of test time / 127.0 seconds wrapper wall. Wrapper wall includes isolated worker compilation. The process-replacement and database-admission ordering require this E2E boundary; the landed fix separately covers scheduling with fast focused tests. This E2E file stays in the existing E2E lane, outside ordinary per-PR unit execution.
P2 autoreview is scoped-clean. Final root-test types, script/test lint, formatting, diff checks, and Madge (0 cycles) pass.
check-changedstops at existing unused exports in Google Meet, memory-wiki, workboard, and meeting-bot; the same exports fail on clean main3b8ccf88c6e1. Remaining planned type/lint checks were run directly and pass. Exact-head CI 37288698158 passed: 14 successful jobs, 30 configured skips, no retries. The ordinary PR matrix does not select this E2E file, so its CI test duration is not applicable. ClawSweeper completed the exact-head review with no findings. No live-provider replay was run.