Skip to content

Commit bad68a0

Browse files
committed
fix(onboarding): finish token-free handoff cleanup
1 parent 94c1a65 commit bad68a0

5 files changed

Lines changed: 19 additions & 24 deletions

File tree

‎docs/cli/onboard.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ Skills: `--node-manager <npm|pnpm|bun>` (default `npm`), `--skip-skills`.
360360

361361
UI and hook setup: `--skip-ui` (skip Control UI/TUI prompts), `--skip-hooks` (skip webhook/hook setup), `--skip-channels`, `--skip-search`.
362362

363-
Output: `--suppress-gateway-token-output` suppresses token-bearing Gateway/UI output (token hints, auto-login URL with embedded token, and automatic Control UI launch) - useful in shared terminals and CI.
363+
Output: `--suppress-gateway-token-output` disables the automatic Control UI handoff in guided onboarding. Classic onboarding never prints reusable Gateway token values or tokenized URLs; it still prints safe recovery commands.
364364

365365
<Note>
366366
`--json` does not imply non-interactive mode in guided or classic onboarding.

‎src/cli/program/register.onboard.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export function registerOnboardCommand(program: Command): void {
244244
.option("--skip-search", "Skip search provider setup")
245245
.option("--skip-health", "Skip health check")
246246
.option("--skip-ui", "Skip Control UI/TUI prompts")
247-
.option("--suppress-gateway-token-output", "Suppress token-bearing Gateway/UI output")
247+
.option("--suppress-gateway-token-output", "Disable the guided Control UI handoff")
248248
.option("--skip-hooks", "Skip hook setup")
249249
.option("--node-manager <name>", "Node manager for skills: npm|pnpm|bun")
250250
.option("--import-from <provider>", "Migration provider to run during onboarding")

‎src/cli/program/register.setup.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export function registerSetupCommand(program: Command): void {
252252
.option("--skip-search", "Skip search provider setup")
253253
.option("--skip-health", "Skip health check")
254254
.option("--skip-ui", "Skip Control UI/TUI launch")
255-
.option("--suppress-gateway-token-output", "Suppress token-bearing Gateway/UI output")
255+
.option("--suppress-gateway-token-output", "Disable the guided Control UI handoff")
256256
.option("--skip-hooks", "Accepted for onboard compatibility; hooks setup is skipped")
257257
.option("--node-manager <name>", "Node manager for skills: npm|pnpm|bun")
258258
.option("--import-from <provider>", "Migration provider to run during onboarding")

‎src/commands/onboard-helpers.ts‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,24 +192,16 @@ export function applyWizardMetadata(
192192
}
193193

194194
/** Formats the no-GUI SSH tunnel hint for opening the Control UI remotely. */
195-
export function formatControlUiSshHint(params: {
196-
port: number;
197-
basePath?: string;
198-
token?: string;
199-
}): string {
195+
export function formatControlUiSshHint(params: { port: number; basePath?: string }): string {
200196
const basePath = normalizeControlUiBasePath(params.basePath);
201197
const uiPath = basePath ? `${basePath}/` : "/";
202198
const localUrl = `http://localhost:${params.port}${uiPath}`;
203-
const authedUrl = params.token
204-
? `${localUrl}#token=${encodeURIComponent(params.token)}`
205-
: undefined;
206199
const sshTarget = resolveSshTargetHint();
207200
return [
208201
"No GUI detected. Open from your computer:",
209202
`ssh -N -L ${params.port}:127.0.0.1:${params.port} ${sshTarget}`,
210203
"Then open:",
211204
localUrl,
212-
authedUrl,
213205
"BYOH note: lan, tailnet, and custom bind are currently IPv4-only.",
214206
"If your host is IPv6-only, use an IPv4 sidecar or proxy in front of the Gateway.",
215207
"Docs:",

‎src/wizard/setup.finalize.test.ts‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ const inspectWindowsGatewayFirewall = vi.hoisted(() =>
141141
vi.mock("../commands/onboard-helpers.js", () => ({
142142
probeGatewayReachable,
143143
resolveAdvertisedControlUiLinks,
144-
resolveControlUiLinks: vi.fn(() => ({
145-
httpUrl: "http://127.0.0.1:18789",
146-
wsUrl: "ws://127.0.0.1:18789",
147-
})),
148144
resolveLocalControlUiProbeLinks,
149145
waitForGatewayReachable,
150146
}));
@@ -1541,6 +1537,9 @@ describe("finalizeSetupWizard", () => {
15411537

15421538
it("never prints the reusable Gateway token during classic onboarding", async () => {
15431539
const prompter = createLaterPrompter();
1540+
const runtimeLog = vi.fn();
1541+
const runtimeError = vi.fn();
1542+
const runtime = { log: runtimeLog, error: runtimeError, exit: vi.fn() };
15441543
probeGatewayReachable.mockResolvedValue({ ok: true });
15451544

15461545
await finalizeSetupWizard({
@@ -1563,17 +1562,21 @@ describe("finalizeSetupWizard", () => {
15631562
tailscaleMode: "off",
15641563
},
15651564
prompter,
1566-
runtime: createRuntime(),
1565+
runtime,
15671566
});
15681567

1569-
const output = vi
1570-
.mocked(prompter.note)
1571-
.mock.calls.map((call) => call.join("\n"))
1568+
const terminalOutput = [prompter.note, prompter.outro]
1569+
.flatMap((writer) => vi.mocked(writer).mock.calls.flat())
1570+
.join("\n");
1571+
const runtimeOutput = [runtimeLog, runtimeError]
1572+
.flatMap((writer) => writer.mock.calls.flat())
15721573
.join("\n");
1573-
expect(output).toContain("http://127.0.0.1:18789");
1574-
expect(output).toContain("openclaw dashboard --no-open");
1575-
expect(output).not.toContain("session-token");
1576-
expect(output).not.toContain("#token=");
1574+
expect(terminalOutput).toContain("http://127.0.0.1:18789");
1575+
expect(terminalOutput).toContain("openclaw dashboard --no-open");
1576+
for (const output of [terminalOutput, runtimeOutput]) {
1577+
expect(output).not.toContain("session-token");
1578+
expect(output).not.toContain("#token=");
1579+
}
15771580
});
15781581

15791582
it("stops after a scheduled restart instead of reinstalling the service", async () => {

0 commit comments

Comments
 (0)