Skip to content

fix(onboard): terminal hatch connects after guided setup - #130082

Merged
steipete merged 2 commits into
mainfrom
codex/onboarding-guided-gateway-tui
Aug 26, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/onboarding-guided-gateway-tui

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Fixes an issue where users completing guided local setup with the terminal handoff could see the hatch TUI fail immediately because the newly started Gateway already owned the state directory.

Why This Change Was Made

Fresh guided setup now opens the hatch TUI through the Gateway it just installed and verified instead of starting a second embedded local runtime. Configured reruns, which deliberately do not start or verify a Gateway, retain the embedded local hatch. The first-run hatch message and non-delivery behavior stay unchanged.

User Impact

The terminal hatch can open normally after fresh guided setup instead of refusing startup with an active-Gateway state-lock error, without making configured reruns depend on an unverified Gateway.

Evidence

Exact head a04841cd9de6e871bdfddfff1bd85650c1519b4e rebased onto origin/main e6ed7e30cc5ff26be72f81edfe590a0288caa4b2:

  • Fresh setup is asserted to omit local and use the running Gateway; configured reruns are asserted to preserve local: true and skip setup apply.
  • Exact-head focused suite: onboard-guided.test.ts, 27 tests passed.
  • Exact-head pnpm check:changed: passed, including core/test typechecks, lint, boundaries, and import-cycle checks.
  • Fresh exact-head autoreview: clean, patch correct at 0.98 confidence.
  • TruffleHog 3.97.0 scan: clean.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS maintainer Maintainer-authored PR labels Aug 26, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 26, 2026, 7:51 AM ET / 11:51 UTC.

ClawSweeper review

What this changes

The PR removes the embedded-local hatch launch mode after guided onboarding so a newly created setup session connects to its running Gateway.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

The prior P1 finding remains on the same head: this fixes fresh setup but makes configured reruns use a Gateway client even though that branch deliberately does not start or verify the Gateway.

Priority: P2
Reviewed head: 669c65cfddd8921551d72a8edc7fd988fd566440

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The fresh setup repair is plausible, but the configured-rerun regression remains blocking.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply.
Evidence reviewed 5 items Configured rerun skips service setup: The already-configured branch is selected from existing Gateway configuration or completed detection and bypasses the sibling setup branch that checks the Gateway result.
Changed hatch always selects Gateway mode: The current PR-head hatch launch omits local mode, affecting both fresh setup and configured reruns.
TUI modes have distinct ownership contracts: Local mode acquires the embedded state lock and starts EmbeddedTuiBackend, while non-local mode connects GatewayChatClient.
Findings 1 actionable finding [P1] Preserve a hatch path for configured reruns without a Gateway
Security None None.

Live Verification

Command: pnpm openclaw onboard --help

Result: PASS (completed)

$ node scripts/run-node.mjs onboard --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 102.80 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.4s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4341ms (slowest: built plugin control-plane loads 3608ms)

OpenClaw 2026.8.1 (669c65c) — All your chats, one OpenClaw.

Usage: openclaw onboard [options] [command]

Guided setup for auth, models, Gateway, workspace, channels, and skills

Options:
  --accept-risk                            Acknowledge that agents are powerful and full system access is risky (required for --non-interactive) (default:
                                           false)
  --agent-name ‹name›                      Name for the first agent (default: main)
  --ai-gateway-api-key ‹key›               Vercel AI Gateway API key
  --alibaba-model-studio-api-key ‹key›     Alibaba Model Studio API
… output truncated …

Assertions:

  • PASS expect_output: --tui

How this fits together

Guided onboarding either applies setup, which starts and checks the machine Gateway, or recognizes an existing configuration and leaves its service untouched. Both branches can open the terminal hatch, whose mode selects an embedded runtime or a Gateway client.

flowchart LR
  A[Guided onboarding] --> B{Existing configuration?}
  B -->|No| C[Apply setup and verify Gateway]
  B -->|Yes| D[Keep service untouched]
  C --> E[Terminal hatch]
  D --> E
  E --> F{Hatch mode}
  F -->|Gateway client| G[Gateway chat]
  F -->|Embedded runtime| H[Local chat]
Loading

Before merge

  • Preserve a hatch path for configured reruns without a Gateway (P1) - The alreadyConfigured branch deliberately skips setup, so it neither starts nor verifies a Gateway before reaching this shared launch. Removing local turns a configured rerun with a stopped service from an embedded hatch into a disconnected client. This is the prior blocker: select mode from verified service ownership or handle the unavailable-Gateway outcome, then cover that branch.
  • Resolve merge risk (P1) - Configured reruns can lose their usable embedded hatch when their existing Gateway is stopped or otherwise unavailable.
  • Complete next step (P2) - The P1 blocker remains unresolved on this member-authored PR and needs an updated repair before merge.

Findings

  • [P1] Preserve a hatch path for configured reruns without a Gateway — src/commands/onboard-guided.ts:721-725
Agent review details

Security

None.

PR surface

Source 0, Tests +20. Total +20 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 20 0 +20
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 21 1 +20

Review metrics

Metric Value Why it matters
Production versus test delta production +1/-1, tests +20/-0 The net-neutral startup-mode edit changes service ownership while new coverage only exercises fresh setup.

Merge-risk options

Maintainer options:

  1. Preserve the rerun boundary (recommended)
    Use Gateway mode only after verified service ownership and cover fresh plus already-configured flows, including an unavailable service.
  2. Adopt Gateway-only reruns deliberately
    Keep this behavior only with explicit preflight and an in-product recovery path for a stopped Gateway.

Technical review

Best possible solution:

Carry verified Gateway ownership into the hatch decision, using the client only after service verification and preserving a tested recovery path otherwise.

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

Yes, from source: an existing Gateway configuration enters the alreadyConfigured branch, skips setup, and reaches the changed non-local hatch launch.

Is this the best way to solve the issue?

No: globally removing embedded mode is too broad because a configured rerun has not necessarily verified a live Gateway.

Full review comments:

  • [P1] Preserve a hatch path for configured reruns without a Gateway — src/commands/onboard-guided.ts:721-725
    The alreadyConfigured branch deliberately skips setup, so it neither starts nor verifies a Gateway before reaching this shared launch. Removing local turns a configured rerun with a stopped service from an embedded hatch into a disconnected client. This is the prior blocker: select mode from verified service ownership or handle the unavailable-Gateway outcome, then cover that branch.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The defect is limited to terminal hatch onboarding but can block an existing configured flow from reaching chat.
  • merge-risk: 🚨 compatibility: The shared launch default changes existing configured-rerun behavior.
  • merge-risk: 🚨 availability: The changed path can require a Gateway that the selected onboarding branch did not establish or verify.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The supplied repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply.

Evidence

What I checked:

  • Configured rerun skips service setup: The already-configured branch is selected from existing Gateway configuration or completed detection and bypasses the sibling setup branch that checks the Gateway result. (src/commands/onboard-guided.ts:531, 669c65cfddd8)
  • Changed hatch always selects Gateway mode: The current PR-head hatch launch omits local mode, affecting both fresh setup and configured reruns. (src/commands/onboard-guided.ts:721, 669c65cfddd8)
  • TUI modes have distinct ownership contracts: Local mode acquires the embedded state lock and starts EmbeddedTuiBackend, while non-local mode connects GatewayChatClient. (src/tui/tui.ts:765, e2e5d1bca685)
  • New test misses configured reruns: The added test uses the default fresh-setup fixture and only asserts that local is absent; no test enters the existing-Gateway or setupComplete branch. (src/commands/onboard-guided.test.ts:411, 669c65cfddd8)
  • Available history: The checked-out change is attributed to Amp; earlier file history is unavailable in this shallow checkout, so ownership is conservative. (src/commands/onboard-guided.ts:721, 669c65cfddd8)

Likely related people:

  • Amp: The checked-out head attributes the onboarding hatch change to Amp; earlier history is unavailable locally. (role: recent onboarding contributor; confidence: low; commits: 669c65cfddd8; files: src/commands/onboard-guided.ts, src/commands/onboard-guided.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Preserve a usable configured-rerun path without a verified Gateway.
  • Add regression coverage for the alreadyConfigured branch.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-26T11:08:17.815Z sha 669c65c :: found issues before merge. :: [P1] Preserve a hatch path for configured reruns without a Gateway

@steipete
steipete force-pushed the codex/onboarding-guided-gateway-tui branch from 669c65c to a04841c Compare August 26, 2026 15:43

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The prior configured-rerun blocker is addressed on exact head a04841cd9de6e871bdfddfff1bd85650c1519b4e: the hatch handoff now carries a closed { next: "hatch"; local: boolean } decision, uses the verified Gateway only after fresh setup, and preserves local: true for configured reruns. Focused coverage exercises both branches, and exact-head CI run 32986342931 passed all 82 jobs (61 successful, 21 skipped).

@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 4478959 into main Aug 26, 2026
128 of 141 checks passed
@steipete
steipete deleted the codex/onboarding-guided-gateway-tui branch August 26, 2026 17:14

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…0082)

* fix(onboard): connect guided hatch through Gateway

* fix(onboard): preserve local hatch reruns

---------

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

Labels

commands Command implementations maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants