Repository navigation
fix: stop Gateway shutdown waiting on abandoned setup prompts - #139783
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: needs maintainer review before merge. Reviewed September 6, 2026, 2:49 AM ET / 06:49 UTC. ClawSweeper reviewWhat this changesThe PR closes interactive setup prompts during Gateway shutdown while preserving in-progress writes, cleanup ownership, and reconnects during normal operation. Merge readiness✅ Ready for maintainer review The fix remains necessary on the supplied current main and v2026.9.2. No actionable introduced defect was found, and the supplied behavior evidence supports the repair. The maintainer-authored PR remains open for normal landing. Priority: P2 Review scores
Verification
How this fits togetherGateway setup turns client requests into interactive prompts and settings operations. Its lifecycle owner must stop accepting answers during shutdown while retaining responsibility for unfinished operations and lock cleanup. flowchart TD
A[Setup client] --> B[Setup admission]
B --> C[Interactive wizard]
D[Gateway stop or restart] --> E[Close prompt input]
E --> C
C --> F[Finish writes and cleanup]
F --> G[Release work and setup lock]
G --> H[Gateway shutdown completes]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +46, Tests +467, Docs +5. Total +518 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep prompt lifetime under the existing Gateway owner, allowing committed operations and lock cleanup to settle before releasing their resources. Do we have a high-confidence way to reproduce the issue? Yes, from source: leave an admitted setup prompt unanswered, disconnect, then stop or restart the Gateway; current main retains the runner without closing its pending input. This reviewer did not execute that scenario. Is this the best way to solve the issue? Yes. The patch repairs the existing admission and prompt owners without adding a competing shutdown path, changing drain budgets, or releasing cleanup ownership early. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2a488546aabe. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Bind admitted wizards to the existing Gateway lifetime and committed process drain signal. Keep runner and setup-lock settlement owned until cleanup finishes, while preserving normal socket reconnect behavior. Separate lifecycle closure from user cancellation and retain real write failures. No config, schema, protocol or drain-budget changes. Validated with 131 owner and real-socket tests, changed-file gates, and independent review through P2.
7680e00 to
eed4ac8
Compare
|
Merged via squash.
|
…39783) Bind admitted wizards to the existing Gateway lifetime and committed process drain signal. Keep runner and setup-lock settlement owned until cleanup finishes, while preserving normal socket reconnect behavior. Separate lifecycle closure from user cancellation and retain real write failures. No config, schema, protocol or drain-budget changes. Validated with 131 owner and real-socket tests, changed-file gates, and independent review through P2.
…39783) Bind admitted wizards to the existing Gateway lifetime and committed process drain signal. Keep runner and setup-lock settlement owned until cleanup finishes, while preserving normal socket reconnect behavior. Separate lifecycle closure from user cancellation and retain real write failures. No config, schema, protocol or drain-budget changes. Validated with 131 owner and real-socket tests, changed-file gates, and independent review through P2. (cherry picked from commit 9739f45)
What Problem This Solves
Fixes an issue where stopping or restarting a Gateway could wait for the full drain budget after an operator left an interactive setup prompt unanswered. Shutdown had already stopped accepting answers, while the wizard still retained its work and setup-lock ownership.
Why This Change Was Made
Wizard admission now binds to the existing Gateway generation and committed drain signal before setup-lock acquisition can yield. Shutdown closes the prompt input lifetime, and the Gateway tracks the existing settlement promise until the runner and target-lock cleanup finish. Ordinary socket disconnects remain reconnectable.
Lifecycle closure is distinct from user cancellation. Writes past their cancellation lock finish normally; pending and future prompts stop waiting for a client that cannot answer. Classic setup can already have saved settings without taking that cancellation lock, so shutdown records its own error rather than claiming a user cancellation. Genuine later write failures retain their diagnostic.
User Impact
An abandoned setup prompt no longer strands Gateway stop or restart. After the Gateway starts again, operators can reopen setup and inspect their saved settings. Configuration, persistence formats, protocol versions and drain budgets are unchanged.
Production grows by 46 lines across the two existing owners; tests grow by 467 lines, including reuse of the existing Gateway fixture, and docs by 5. The new input lifetime and exact cleanup binding require that production growth; there is no new run-loop layer or duplicate shutdown path.
Evidence
openclaw/ci-gate. The latest ClawSweeper review has no findings or before-merge actions.Native live proof
Crabbox run 34014138751, provider
blacksmith-testbox, leasetbx_01m1tk40syn8mwrdr3k0v0am0p. A real Tauri app opened the Ollama setup wizard and left the Local only choice unanswered. Native tray Stop completed in 1.241 seconds, with the real Gateway process gone and its health port closed; tray Start restored it in 4.128 seconds. The CLI receipt wasgateway stop --json --force, non-TTY stdin/stdout, exit 0,ok:true,result:stopped.This combined candidate used base
883d4d65bad1791755c203a8dfd854e14b4f6e33with the reviewed changes from this PR and #139664; the two setup runtime owner files are byte-identical to this PR head. Native GUI proof is Linux; no macOS/Windows service-manager claim is made. Screenshots contain only synthetic task data.Pending real provider prompt:
After native Stop: