Skip to content

[Bug]: Gateway RPC wizard inherits CLI process and service lifecycle #110545

Closed

Description

@TheAngryPit

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Gateway-hosted wizard sessions inherit CLI process and service-lifecycle behavior: a wizard exit can terminate the shared Gateway process, and a client that already installed the Gateway service cannot tell onboarding not to install it again.

Steps to reproduce

  1. Install and start a Gateway service from an external client such as the Windows Companion.
  2. Start the native setup wizard through the Gateway wizard.start RPC without an installDaemon parameter.
  3. Continue through onboarding until the service-install/finalization path runs.
  4. Observe the RPC session lose its hosting Gateway when the CLI-oriented wizard calls runtime.exit(); the client cannot declare that it already owns daemon installation.

The Windows Companion setup E2E reproduces this with the official OpenClaw 2026.7.2-beta.2 package: all three setup/recovery shards lose the Gateway during the shared wizard fixture before their scenario-specific assertions run.

Expected behavior

  • Gateway RPC wizards run as embedded sessions and cannot terminate their hosting Gateway process.
  • Exit code zero completes the wizard session; nonzero exits are reported as session errors.
  • The RPC caller can explicitly set installDaemon: false when it already owns service installation.
  • The CLI wizard keeps its existing standalone lifecycle behavior.

Actual behavior

The Gateway passes the normal exiting runtime to CLI-oriented setup and channel wizard runners. The setup RPC schema also has no caller-controlled daemon-install flag, so omitted configuration follows onboarding defaults and may attempt service installation even when the client already completed that step.

OpenClaw version

Official package 2026.7.2-beta.2; source behavior confirmed on current main while preparing the fix.

Operating system

Windows 11 host with Companion-owned OpenClawGateway WSL distribution; the owner-boundary defect is in the Gateway RPC path and is not Windows-specific.

Install method

Windows Companion managed WSL Gateway setup using the official OpenClaw package.

Model

N/A; the failure occurs during setup before model selection.

Provider / routing chain

N/A; Windows Companion -> Gateway RPC -> native onboarding wizard.

Additional provider/model setup details

N/A.

Logs

The client loses the Gateway connection while the native wizard is running. The downstream setup-connect, revocation-recovery, and network-recovery E2E shards fail at the same shared wizard fixture.

Screenshots, recordings, and evidence

Impact and severity

  • Affected: remote setup clients embedding the native Gateway wizard, currently reproduced through the Windows Companion.
  • Severity: high for onboarding because the hosting Gateway disappears before setup completes.
  • Frequency: deterministic in the observed official beta.2 Companion E2E path.
  • Consequence: fresh setup and recovery flows cannot complete, and clients cannot cleanly retain service-lifecycle ownership.

Additional information

The two symptoms share one owner boundary: an RPC-hosted wizard must be an embedded session rather than a standalone CLI process. The intended fix is one bounded Gateway change that supplies a non-exiting runtime and projects an optional installDaemon request field. The Windows Companion will then send installDaemon: false because it installs the service earlier in its own setup pipeline.

Activity

  1. added
    P0
    impact:crash-loop
    impact:ux-release-blocker
    issue-rating: 🦞 diamond lobster
    clawsweeper:source-repro
    on Jul 18, 2026
  2. clawsweeper commented on Jul 18, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 18, 2026, 3:53 AM ET / 07:53 UTC.

    Summary
    Keep this issue open as the canonical report: current main still passes the process-exiting CLI runtime into both Gateway wizard flows, and the two linked open pull requests are complementary candidate fixes rather than merged resolution.

    Reproducibility: yes. in source: wizard.start supplies defaultRuntime to runners whose setup path calls runtime.exit(), which reaches process.exit; a focused live Gateway RPC run is still needed as regression proof after the fix.

    Root-cause cluster
    Relationship: canonical
    Canonical: #110545
    Summary: This issue is the canonical umbrella for one Gateway RPC owner-boundary defect with two complementary open candidate fixes.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    Two open linked pull requests already own the concrete repair slices, so a separate automated fix branch would duplicate active contributor work.

    Review details

    Best possible solution:

    Consolidate the two complementary fixes into one bounded Gateway change: run both RPC wizard flows with a non-exiting runtime, translate only ExitError(0) to normal completion, surface nonzero exits as session errors, and forward optional installDaemon unchanged.

    Do we have a high-confidence way to reproduce the issue?

    Yes in source: wizard.start supplies defaultRuntime to runners whose setup path calls runtime.exit(), which reaches process.exit; a focused live Gateway RPC run is still needed as regression proof after the fix.

    Is this the best way to solve the issue?

    Yes, if handled as one Gateway owner-boundary repair: reuse the existing non-exiting runtime and forward the already-defined onboarding option rather than adding Companion-specific behavior or changing CLI lifecycle semantics.

    AGENTS.md: unclear because the file could not be read completely.

    Remaining risk / open question:

    • Landing only the lifecycle change would still leave Companion-style callers unable to preserve explicit installDaemon: false; landing only the protocol projection would still allow an embedded wizard to terminate its Gateway host.
    • The Gateway RPC schema is a public protocol surface, so the optional field must preserve omission, true, and explicit false without changing standalone CLI onboarding behavior.

    Codex review notes: model internal, reasoning high; reviewed against 09963412d170.

    Label changes

    Label changes:

    • add P0: A first-run Windows Companion setup path deterministically loses its hosting Gateway before onboarding can complete.
    • add impact:crash-loop: The embedded wizard can invoke the normal runtime exit path and terminate the shared Gateway process.
    • add impact:ux-release-blocker: Affected companion users cannot complete fresh setup or recovery through the client’s expected wizard flow.
    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.

    Label justifications:

    • P0: A first-run Windows Companion setup path deterministically loses its hosting Gateway before onboarding can complete.
    • impact:crash-loop: The embedded wizard can invoke the normal runtime exit path and terminate the shared Gateway process.
    • impact:ux-release-blocker: Affected companion users cannot complete fresh setup or recovery through the client’s expected wizard flow.
    Evidence reviewed

    What I checked:

    • Current Gateway runtime boundary: wizard.start invokes both the setup and channel wizard runners with defaultRuntime; its exit implementation calls process.exit, so an embedded wizard can terminate its host process. (src/gateway/server-methods/wizard.ts:4, 09963412d170)
    • Existing embedded-runtime primitive: Current runtime code already provides createNonExitingRuntime(), which converts an exit into ExitError(code) instead of exiting the process; this is the appropriate Gateway session boundary primitive. (src/runtime.ts:2, 09963412d170)
    • Observable exit path: The setup wizard calls runtime.exit(1) for invalid configuration and runtime.exit(0) after a launched TUI, confirming that passing the normal CLI runtime into an RPC-hosted session is behaviorally unsafe. (src/wizard/setup.ts:3, 09963412d170)
    • Daemon option is already an onboarding contract: OnboardOptions already includes optional installDaemon, so forwarding it through the Gateway RPC projection is a missing propagation of an existing option rather than a new configuration surface. (src/commands/onboard-types.ts:6, 09963412d170)
    • Current RPC projection omits the required option: The setup branch currently passes only mode and workspace to the wizard runner, leaving no path for an RPC caller to preserve explicit installDaemon: false. (src/gateway/server-methods/wizard.ts:4, 09963412d170)
    • Paired implementation candidates: The issue links an open lifecycle-boundary candidate, fix(gateway): isolate wizard exits from shared process #110382, and an open daemon-option projection candidate, fix(gateway): let wizard clients control daemon installation #109412. Neither is merged, so neither is implementation provenance for closing this issue.

    Likely related people:

    • TheAngryPit: Authored the two linked candidate pull requests that separately trace the Gateway lifecycle boundary and missing installDaemon RPC projection. (role: related-fix author; confidence: medium; commits: 79fcd377c754, 90dc7533822f; files: src/gateway/server-methods/wizard.ts, src/runtime.ts, src/commands/onboard-types.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  3. obviyus commented on Jul 30, 2026

    @obviyus
    Collaborator

    Fixed on main.

    Both halves of this are addressed:

    • Exit isolation — 1dd28f1 (fix(gateway): hosted setup exits no longer stop the gateway #115671, "hosted setup exits no longer stop the gateway"). runHostedWizard now runs under createNonExitingRuntime() (src/gateway/server-methods/wizard.ts:50), so runtime.exit raises ExitError instead of calling process.exit and can no longer take the Gateway down with it.
    • Daemon lifecycle choice — installDaemon is now part of the wizard RPC surface and is projected through wizard.start (src/gateway/server-methods/wizard.ts:124), so an RPC caller can decline daemon installation rather than inheriting the CLI's service behavior.

    Closing as fixed. If you see a hosted wizard path that still terminates the Gateway process, reopen with the RPC method and the exit route — that would be a distinct escape from the non-exiting runtime rather than this issue.

  4. locked as resolved and limited conversation to collaborators on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0clawsweeper:source-reproimpact:crash-loopimpact:ux-release-blockerissue-rating: 🦞 diamond lobster

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions