Skip to content

fix(accounts): open the browser for a WSL account sign-in - #29566

Merged
nwparker merged 2 commits into
mainfrom
fix/wsl-account-sign-in-opens-browser
Oct 16, 2026
Merged

nwparker merged 2 commits into
mainfrom
fix/wsl-account-sign-in-opens-browser

Conversation

@nwparker

@nwparker nwparker commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​348 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​348
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​140 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​127

ELI5

When you add a Claude or Codex account that lives inside WSL, Orca now opens the sign-in page in your Windows browser, the same way a normal account add does. Before this, nothing opened and you had to click "Copy link" and paste the link yourself.

What Changed

Before: Settings → AI Provider Accounts → pick a WSL location → Add account (or Sign in again). Orca starts the provider's login program inside the Linux distro. That program tries to open a browser from inside Linux. Most distros have no way to do that (no xdg-open, wslview or $BROWSER), so nothing appears. The login sits and waits until the user finds Copy link.

After: For WSL logins only, Orca catches the sign-in link and opens it on Windows itself:

  • Claude: Orca reuses the small stand-in "browser" program that Copy link already uses. Claude hands the link to it, and Orca reads the link back. Previously Orca only installed this stand-in for Copy link. Now a plain WSL Add account or Sign in again installs it too. If it can't be written, the login runs exactly as it did before.
  • Codex: Codex already prints its link, and Orca already captures it for Copy link. Orca now also opens that captured link. Orca also tells Codex inside the distro not to open a browser of its own (BROWSER=true), so a distro that does have an opener doesn't get a second tab.
  • Validation: before anything is opened, the desktop's main process checks the link: https only, no user name or password in it, no explicit port, and it must be the provider's own sign-in host (claude.com / claude.ai with a callback to this computer, or auth.openai.com). Anything else is logged and dropped, and it is never opened.
  • Copy link still works as before, as a fallback.
  • Local logins (macOS, Linux, Windows without WSL) are unchanged. They still let the CLI open the browser itself.
  • The headless server (orcad) never opens anything. The opener is only switched on from the desktop app's IPC setup.

Why

The link was already reaching Orca (Copy link proves it), and the sign-in callback already reaches WSL once a browser loads the link. The only missing piece was opening it. Reusing the existing capture paths keeps one way of catching each provider's link and adds no new IPC or renderer surface.

Alternatives considered:

  • Installing wslu / xdg-open in the distro: needs root and changes the user's system.
  • A Windows-side BROWSER shim calling cmd.exe /c start: AGENTS.md flags that pattern as an EDR signal, and it would pass an unvalidated URL to a shell.
  • Opening from the renderer: it would add a renderer → shell round trip for a link that main already holds.

Linked Issue

Internal bug E19 (WSL bridge / WSL host). External PR #12023 attempted the Claude half on an older base; it has been stale since August and doesn't cover Codex.

Visual Proof

N/A. There is no on-screen change in Orca. The change is that a browser tab now opens on Windows, which needs a real Windows + WSL machine to show.

Testing

  • pnpm tc passes.

  • pnpm vitest run --config config/vitest.config.ts src/main/claude-accounts src/main/codex-accounts src/main/ipc/account-sign-in-link-opener.test.ts: 85 files and 676 tests pass.

  • New tests:

    • account-sign-in-link-opener.test.ts: valid Claude and Codex links open. Plain http, file:, javascript:, custom schemes, malformed text, an empty string, credentials in the link, explicit ports, lookalike hosts, the wrong provider's host, and a Claude link calling back to a non-local host are never passed to openExternal.
    • claude-login-session.test.ts: a WSL login opens the link once and cleans up the stand-in. A WSL Copy link copies and never opens. A local login gets no stand-in and nothing is opened. A WSL login with no opener (orcad) is unchanged. A bad link is not opened and the login is not killed. If the stand-in can't be written, the login runs unchanged.
    • codex-login-session-wsl-open.test.ts: a WSL login opens the printed link, keeps it for Copy link, and suppresses the distro opener. With no opener the login is unchanged. A non-https link is not opened. A local login is untouched.
    • wsl-codex-command.test.ts: BROWSER=true is added only when Orca opens the link.
  • Platforms: unit tests on macOS. Not tested on a real Windows + WSL machine.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

An adversarial reviewer agent reviewed the change. Its findings are addressed in follow-up commits.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: only main opens links, and only after the https and host allowlist check. Copy link's existing Claude check (isClaudeLocalSignInLink) is reused and tightened with no-userinfo and no-port rules.
  • SSH / remote: Add account is disabled in Settings for remote account scopes, and the orca account add CLI runs the login in the user's own terminal. Neither path is touched here.
  • Mobile / web: no change. The web preload already returns no pending link.
  • Backward compatibility: no IPC, RPC or settings changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f6db77ed-72ba-4036-8f47-8aa7e26db23c
📥 Commits

Reviewing files that changed from the base of the PR and between fd8b0df84b5721135f706b204640b7f4b0b37b3b and ccbfcd2.

📒 Files selected for processing: 15
  • src/main/claude-accounts/claude-account-service.test.ts
  • src/main/claude-accounts/claude-login-session.test.ts
  • src/main/claude-accounts/claude-login-session.ts
  • src/main/claude-accounts/claude-sign-in-browser.ts
  • src/main/claude-accounts/service.ts
  • src/main/codex-accounts/codex-login-auth-url.ts
  • src/main/codex-accounts/codex-login-session-wsl-open.test.ts
  • src/main/codex-accounts/codex-login-session.ts
  • src/main/codex-accounts/service.ts
  • src/main/codex-accounts/wsl-codex-command.test.ts
  • src/main/codex-accounts/wsl-codex-command.ts
  • src/main/ipc/account-sign-in-link-opener.test.ts
  • src/main/ipc/account-sign-in-link-opener.ts
  • src/main/ipc/claude-accounts.ts
  • src/main/ipc/codex-accounts.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: edd71c52-41c5-45f9-a14c-3d6afdc2e7af
📥 Commits

Reviewing files that changed from the base of the PR and between 172a5d2 and fd8b0df84b5721135f706b204640b7f4b0b37b3b.

📒 Files selected for processing: 15
  • src/main/claude-accounts/claude-account-service.test.ts
  • src/main/claude-accounts/claude-login-session.test.ts
  • src/main/claude-accounts/claude-login-session.ts
  • src/main/claude-accounts/claude-sign-in-browser.ts
  • src/main/claude-accounts/service.ts
  • src/main/codex-accounts/codex-login-auth-url.ts
  • src/main/codex-accounts/codex-login-session-wsl-open.test.ts
  • src/main/codex-accounts/codex-login-session.ts
  • src/main/codex-accounts/service.ts
  • src/main/codex-accounts/wsl-codex-command.test.ts
  • src/main/codex-accounts/wsl-codex-command.ts
  • src/main/ipc/account-sign-in-link-opener.test.ts
  • src/main/ipc/account-sign-in-link-opener.ts
  • src/main/ipc/claude-accounts.ts
  • src/main/ipc/codex-accounts.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

📝 Walkthrough

Claude and Codex WSL login sessions can send provider sign-in links to a configured host opener. A shared opener validates links before opening them externally. Claude link polling now accepts a configurable timeout, and Codex sets BROWSER=true when an opener is configured. Tests cover link validation, delivery, cancellation, fallback, and local login behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to fd8b0

No identified issue blocks merging the WSL sign-in browser change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 47.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title is concise, specific, and accurately describes the primary change: opening the browser for WSL account sign-in.
Description check Passed The description is complete and directly aligned with the change. It explains the user impact, implementation, rationale, security validation, alternatives, testing, platform limitations, and compatib…
Full details: Description check

Explanation

The description is complete and directly aligned with the change. It explains the user impact, implementation, rationale, security validation, alternatives, testing, platform limitations, and compatibility considerations. It does not include a direct issue URL and does not confirm all lint, typecheck, test, and build commands, but these are minor gaps because the main required information is present.

✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

A WSL Add account / Sign in again ran the provider CLI inside the distro,
where stock distros have no opener, so no browser opened. Claude's link is
now caught by the same BROWSER stand-in Copy link uses, Codex's by the link
it already prints, and the desktop opens it after validation.
…ll login window

Addresses review: watch the login's cancel signal before opening, give auto-open
the whole login window to receive Claude's link, log the refused host, and cover
cancel-before-delivery and service wiring in tests.
@nwparker
nwparker force-pushed the fix/wsl-account-sign-in-opens-browser branch from fd8b0df to ccbfcd2 Compare October 16, 2026 09:20
@nwparker
nwparker merged commit a77cf64 into main Oct 16, 2026
33 checks passed
nwparker added a commit that referenced this pull request Oct 16, 2026
… stand-in does (#29682)

The fake Claude wrote .orca-sign-in-browser.link directly, so the link
poller could read it between create and write, see an empty link, and end
the sign-in. Write a temp file and rename it into place, as the real
stand-in script does. Flake introduced with the tests in #29566.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant