Repository navigation
fix(claude): retain managed WSL selection across distro casing - #31992
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
A saved key that matches the launch distro exactly now resolves as before, so existing mixed-alias selections do not regress to System default. Co-Authored-By: Claude <noreply@anthropic.com>
ELI5
On Windows,
Ubuntuandubuntuare the same WSL distro:wsl -d ubuntuand\\wsl.localhost\ubuntu\...both work. Orca saved the chosen Claude account under the exact spelling from the Settings dropdown (Ubuntu), then looked it up using the spelling in the project path. A project added as\\wsl.localhost\ubuntu\...found nothing. Its Claude terminals quietly used the WSL system-default login, and switching accounts appeared to do nothing there.What changes for you: a Claude account you pick for a WSL distro now applies to every project in that distro, whatever casing its path uses. Nothing is migrated or renamed; saved settings keep their original spelling.
Fixes #23960 (reported by @Minsubs, whose suggested fix is case-insensitive distro comparison).
What changed
getClaudeWslSelectionKeynow folds case. The account lookup, the duplicate-account check, the WSL router's "does this distro have accounts" check, and selection pruning all compare distros case-insensitively.ubuntufor an account recorded asUbuntu) is allowed. Another distro (Debian,Ubuntu-24.04) is still refused.ubuntuis not refused as "another target". The marker file's bytes are never rewritten.Verification
awin, Windows + WSLUbuntu-24.04, PR head482ccaca):wsl.exe -d Ubuntu-24.04,-d ubuntu-24.04and-d UBUNTU-24.04all printWSL_DISTRO_NAME=Ubuntu-24.04, and\\wsl.localhost\ubuntu-24.04\etc\hostnameand\\wsl$\UBUNTU-24.04\etc\hostnameboth exist. Windows treats the name as case-insensitive.parseWslUncPathandruntime-selection.tswith the saved selection{ "Ubuntu-24.04": "acct-A" }. On main, the paths\\wsl.localhost\ubuntu-24.04\...,\\wsl$\UBUNTU-24.04\...and\\WSL.LOCALHOST\ubuntu-24.04\...returnedaccount=null, and prune cleared{ "ubuntu-24.04": "acct-A" }. On this PR, all four spellings returnacct-Aand prune keeps the entry.orca-qastaysnull. Conflicting{Ubuntu-24.04: A, ubuntu-24.04: B}resolves exact-first (A,B), andUBUNTU-24.04getsnull. Switching fromUBUNTU-24.04gives{"Ubuntu-24.04":"C","ubuntu-24.04":"C"}. On main it added a third key.claude-profile-wsl-entry.ts, bundled on Windows) ran inside the real WSL distro on Linux Node 24 against a scratch home. With the PR,ubuntu-24.04andUBUNTU-24.04exit 0, and theprofile.jsonmarker stays byte-identical ("distro":"Ubuntu-24.04").orca-qaand a marker owned by another account still exit 2 (belongs to another account or target). With main'sclaude-profile-paths.ts, the lower and upper spellings exit 2.pnpm teston Windows for the changed claude-accounts tests plussrc/main/rate-limits/: the PR and main show the same 12 Windows-only failures (in codex-fetcher, rate-limit service and opencode-go tests, plus one copy-link sign-in test). That set includes none of this PR's new tests, so nothing new fails.runtime-selection.ts,claude-profile-paths.tsandclaude-account-selection.tsback in, and 7 tests failed: lookup, alias update, pruning, the marker alias, account-service select/clear, router publish/launch, and the built standalone guest helper running as a subprocess. With the PR code they pass.pnpm test src/main/claude-accounts/ src/main/rate-limits/: 86 files and 1063 tests pass (3 skipped, as before). oxlint and oxfmt pass on the changed files.Risks / tradeoffs
Ubuntu: Aandubuntu: B, each spelling keeps its own account, exactly as today. A third spelling (UBUNTU) gets no managed account. One explicit switch reconciles all of them.Related
Visual proof: n/a, this is main-process account routing with no UI change.