Skip to content

fix(cli): link https in --print-handoff when the web UI is served over TLS - #2773

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2770-handoff-tls-scheme
Oct 21, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2770-handoff-tls-scheme

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #2770

Problem

With INSPECTOR_TLS_KEY_PATH and INSPECTOR_TLS_CERT_PATH both set (#2446), the web UI listener serves https only. buildHandoff() in clients/cli/src/cli.ts still built --print-handoff's deep link as http://…, so the link it printed could not load. Copilot found this while reviewing the v2.12.0 milestone merge (#2769).

Change

  • clients/cli/src/cli.ts: the deep link's scheme is https when both TLS paths are set and non-blank, the same rule as resolveTlsConfig() in clients/web/server/tls.ts, and http otherwise. A half pair stays http, because the web server refuses to start on one, so there is no https listener to link. The port-forward command is unchanged: it forwards ports, and the sandbox and app-origin listeners stay plain http under TLS by design.
  • clients/cli/README.md: the --print-handoff row says when the link is https.

Tests

Four new --print-handoff cases in stored-auth.test.ts: both paths set (https), key only, cert only, and a blank key path (http). All 69 tests in the file pass. Mutation check: putting back the hardcoded http:// fails exactly the both-set case (1 failed | 68 passed).

npm run local:gate: green (exit 0).

No UI change, so no screenshots.

🤖 Generated with Claude Code

…r TLS

buildHandoff() hardcoded http:// for the deep link, so with both
INSPECTOR_TLS_KEY_PATH and INSPECTOR_TLS_CERT_PATH set (#2446) the link
pointed at a listener that serves https only. It now follows the same
both-set, blank-is-unset rule as resolveTlsConfig(). A half pair stays
http, since the web server refuses to start on one.

Closes #2770

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: cliffhall <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change matches the intended TLS behavior, includes regression coverage, and has no identified blocking issues.

No open issues 🎉

What changed in this PR

Fixes the CLI’s OAuth handoff link for HTTPS web listeners, addressing #2770 without changing port forwarding.

Changes:

  • Selects HTTPS when both TLS paths are non-blank; otherwise retains HTTP.
  • Adds regression tests for complete, partial, and blank TLS configuration.
  • Documents HTTPS handoff behavior.
File Description
clients/​cli/​src/​cli.ts Selects the handoff link scheme from TLS configuration.
clients/​cli/​README.md Documents when handoff links use HTTPS.
clients/​cli/​__tests__/​stored-auth.test.ts Adds four TLS scheme regression cases.

Review effort: Balanced

@cliffhall
cliffhall merged commit 20287a6 into v2/main Oct 21, 2026
11 checks passed
@cliffhall
cliffhall deleted the v2/fix/2770-handoff-tls-scheme branch October 21, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

2 participants