Skip to content

[Bug]: Managed WSL Claude account is ignored when the project path uses different distro casing (\\wsl.localhost\ubuntu vs Ubuntu) #23960

Closed

Description

@Minsubs

Operating system

Windows

Orca version

v1.4.216

Details

Summary

  • One line: On Windows + WSL, the active managed Claude account is silently ignored for any project whose path spells the distro with different casing than the account selection (for example \\wsl.localhost\ubuntu\... vs Ubuntu). Those terminals fall back to the WSL system-default Claude login.
  • Impact: Switching Claude accounts in Settings, in the usage popover, or via "Continue in new session" has no effect in those projects. New Claude sessions keep using the system-default account, and nothing in the UI says the switch was not applied.
  • Suggested fix: Compare WSL distro names case-insensitively (Windows treats them that way) when storing and looking up activeClaudeManagedAccountIdsByRuntime.wsl, or canonicalize the distro parsed from the path against the installed distro list.
  • Workaround: Re-add the project using the exact distro casing from wsl.exe -l, or launch Claude manually with CLAUDE_CONFIG_DIR pointing at the managed account directory.

Environment

  • Windows host, WSL2 distro named Ubuntu (this is what wsl.exe -l and the account-location dropdown show)
  • Account location: WSL → Ubuntu, with three managed WSL Claude accounts
  • Claude Code 2.1.28x installed inside WSL

What happens

Most of my projects were added with a lowercase distro segment, e.g. \\wsl.localhost\ubuntu\home\<user>\projects\.... A few were added as \\wsl.localhost\Ubuntu\.... Windows resolves both to the same location, so everything else in Orca works and the difference is invisible.

The managed-account selection is stored under the distro name from the dropdown:

"activeClaudeManagedAccountIdsByRuntime": { "host": null, "wsl": { "Ubuntu": "<managed-account-id>" } }

When a Claude terminal is launched in a lowercase-path project, the PTY gets no CLAUDE_CONFIG_DIR, so Claude uses ~/.claude (the system-default login). In an Ubuntu-path project, the same launch gets CLAUDE_CONFIG_DIR=/home/<user>/.local/share/orca/claude-accounts/<managed-account-id>/auth as expected.

Reproduction

  1. On Windows with a WSL distro named Ubuntu, add two projects: one via \\wsl.localhost\Ubuntu\home\<user>\repo-a, one via \\wsl.localhost\ubuntu\home\<user>\repo-b.
  2. Settings → AI Provider Accounts → WSL → Ubuntu → add a managed Claude account and make it active.
  3. Open a new Claude terminal in each project and run echo $CLAUDE_CONFIG_DIR (or /status inside Claude).

Expected: both terminals use the managed account.
Actual: only the Ubuntu project does. The ubuntu project gets no CLAUDE_CONFIG_DIR and runs under the system-default account.

Controlled A/B check

I ran this at the same moment, with the same active selection ({"Ubuntu": "<managed-account-id>"}). The command contains the claude token so Orca treats it as a Claude launch:

orca terminal create --worktree 'id:<repo-a-id>::\\wsl.localhost\Ubuntu\home\<user>\repo-a' \
  --command ": claude ; printenv CLAUDE_CONFIG_DIR > /tmp/ab-upper.txt; echo rc=\$? >> /tmp/ab-upper.txt; exit"
orca terminal create --worktree 'id:<repo-b-id>::\\wsl.localhost\ubuntu\home\<user>\repo-b' \
  --command ": claude ; printenv CLAUDE_CONFIG_DIR > /tmp/ab-lower.txt; echo rc=\$? >> /tmp/ab-lower.txt; exit"

Result:

ab-upper.txt: /home/<user>/.local/share/orca/claude-accounts/<managed-account-id>/auth
              rc=0
ab-lower.txt: rc=1        # CLAUDE_CONFIG_DIR not set

The same happens with "Continue in new session": the new tab in the lowercase project had all the ORCA_* launch variables (ORCA_AGENT_LAUNCH_TOKEN, ORCA_PANE_KEY, and so on) but no CLAUDE_CONFIG_DIR, and /status inside it showed the system-default account.

Where it seems to come from

This is based on reading the bundled main process of v1.4.216, so the names below are my readable reconstruction:

// Launch target for a PTY: the distro is parsed from the cwd UNC path as written
function resolveClaudeLaunchTarget(shellOverride, cwd, expectedWslDistro) {
  const wsl = parseWslUncPath(cwd) // "\\wsl.localhost\ubuntu\..." -> { distro: "ubuntu" }
  return isWslShell(shellOverride) || wsl
    ? { runtime: "wsl", wslDistro: wsl?.distro ?? expectedWslDistro ?? null }
    : { runtime: "host" }
}

function normalizeDistroKey(d) { return d?.trim() || null } // trim only, no case folding

function getActiveClaudeAccountId(settings, target) {
  const sel = settings.activeClaudeManagedAccountIdsByRuntime
  if (target.runtime === "host") return sel.host
  if (target.wslDistro) return sel.wsl[normalizeDistroKey(target.wslDistro) ?? "__default__"] ?? null
  // ...fallback to "__default__" / the single selected account only when no distro is known
}

sel.wsl["ubuntu"] is undefined, so the lookup returns null. getPreparation() then takes the WSL system-default branch (envPatch: {}), and no CLAUDE_CONFIG_DIR is injected.

Switching the account-location dropdown to "WSL default" does not help. Once a distro name is parsed from the path, the lookup never consults the __default__ key. In my case the stored selection also stayed {"Ubuntu": ...}.

Suggested fix

  • Normalize WSL distro keys case-insensitively on both write and read, e.g. d?.trim().toLowerCase(), and migrate existing keys.
  • Alternatively, canonicalize the distro parsed from a UNC path to the installed distro's real name (from wsl.exe -l) before any lookup.
  • Consider surfacing a hint when a Claude launch resolves to "system default" while a managed account is selected for that runtime. At the moment the failure is completely silent.

The Codex selection (activeCodexManagedAccountIdsByRuntime) is keyed the same way ({"Ubuntu": ...}), so it may be affected too. I have not verified that.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions