Skip to content

fix(gateway): prevent overlapping setup after wizard cancellation - #115856

Merged
steipete merged 8 commits into
mainfrom
steipete/wizard-exit-isolation
Jul 29, 2026
Merged

steipete merged 8 commits into
mainfrom
steipete/wizard-exit-isolation

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #110545

Supersedes #110382 with full credit to @TheAngryPit, whose original commits and lifecycle design are preserved here. The hosted-exit containment portion landed separately in #115671 with contributor credit; this takeover carries the remaining maintainer-approved cancellation and protocol work onto current main.

What Problem This Solves

Fixes an issue where cancelling a Gateway-hosted setup wizard could release its single-wizard ownership while the underlying runner was still active and able to mutate setup state. Remote onboarding clients also could not pass the existing daemon-install choice through wizard.start.

Why This Change Was Made

Track the runner's actual settlement separately from its public cancelled or completed status. Cancelled sessions continue to own the wizard slot until the runner can no longer mutate state, then purge automatically. Add the maintainer-approved optional installDaemon request field and forward true, false, or omission unchanged without adding config, compatibility shims, or a protocol-version bump.

The field remains camelCase in TypeScript and the generated Swift API. Existing clients remain valid because the field is optional.

User Impact

Cancelling remote onboarding no longer permits overlapping setup work. A replacement wizard is rejected until the cancelled runner settles, then a later start succeeds automatically. Trusted remote onboarding clients can explicitly choose whether that invocation installs the daemon, while omission preserves existing behavior.

Evidence

Exact submitted head: 346433c18d2e050f937f98d2950323cfa786865d.

  • node scripts/run-vitest.mjs src/gateway/server-methods/wizard.test.ts src/gateway/server-wizard-sessions.test.ts: 14/14 passed.
  • node scripts/run-vitest.mjs src/gateway/gateway-wizard-cancel.e2e.test.ts: 1/1 passed through an authenticated real Gateway WebSocket; cancellation blocked replacement until settlement, later replacement started, and Gateway health remained available.
  • node scripts/run-vitest.mjs src/gateway/gateway.test.ts -t 'keeps the authenticated Gateway alive after': 4/4 passed for setup/channel exits with codes 0 and 23; process.exit was untouched and the authenticated Gateway remained healthy.
  • node scripts/run-vitest.mjs packages/gateway-protocol/src/index.test.ts: 57/57 passed.
  • Protocol registry, protocol-since, generated Swift check mode, and git diff --check: passed.
  • Final full-branch Codex autoreview: no accepted/actionable findings (patch is correct, confidence 0.93). The accepted review findings were the generated Swift spelling and E2E cleanup scope; both were fixed at their owner boundaries and re-reviewed clean.

The failed Real behavior proof check on #110382 did not execute contributor code. Its log reports that a transient PR-body revision lacked authored What Problem This Solves and Evidence sections. Later checks on that same head passed after the body was restored. This takeover includes both required sections in its initial PR body.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts size: M maintainer Maintainer-authored PR labels Jul 29, 2026
@steipete
steipete marked this pull request as ready for review July 29, 2026 11:15
@steipete steipete self-assigned this Jul 29, 2026
@steipete
steipete merged commit 8915f9c into main Jul 29, 2026
122 checks passed
@steipete
steipete deleted the steipete/wizard-exit-isolation branch July 29, 2026 11:49
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
…enclaw#115856)

* fix(wizard): retain cancelled sessions until runner settles

* fix(wizard): purge cancelled sessions after settlement

* test(gateway): cover settled wizard replacement

* test(gateway): split wizard cancellation e2e

* test(gateway): fix wizard e2e env key types

* fix(gateway): forward daemon choice through wizard RPC

Co-authored-by: TheAngryPit <[email protected]>

* test(gateway): harden wizard cancellation cleanup

Co-authored-by: TheAngryPit <[email protected]>

* chore: drop changelog edit (release generation owns it)

---------

Co-authored-by: TheAngryPit <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui gateway Gateway runtime maintainer Maintainer-authored PR scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants