You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Account switch writes oauthAccount to ~/.claude/.claude.json, so new Claude terminals show the previous account #22667
After switching the managed Claude account, new claude terminals still report the previous account (claude auth status, /status), even though Orca switched the credentials correctly. Orca writes oauthAccount to ~/.claude/.claude.json whenever that file exists. Claude Code only reads that file when CLAUDE_CONFIG_DIR is set. Without it, Claude Code reads ~/.claude.json, which Orca leaves untouched.
Environment
Orca 1.4.203, macOS (native host runtime, managed Claude accounts)
Claude Code 2.1.281
CLAUDE_CONFIG_DIR not set in Orca terminals
Root cause
ClaudeRuntimePathResolver.resolveConfigPath (src/main/claude-accounts/runtime-paths.ts, since #1050):
Claude Code chooses its config file by whether CLAUDE_CONFIG_DIR is set, not by which file exists. Any tool that has ever run Claude with CLAUDE_CONFIG_DIR=~/.claude leaves a ~/.claude/.claude.json behind. One example is the claude-mem plugin's observer, as reported in thedotmack/claude-mem#4149. From then on, every account switch updates the Keychain and .credentials.json, but writes the account metadata to a file the CLI never reads.
Reproduction
Create ~/.claude/.claude.json, for example by running CLAUDE_CONFIG_DIR=~/.claude claude auth status once.
In Orca, switch the managed Claude account from A to B.
In a new Orca terminal, run claude auth status.
Expected: account B.
Actual: account A. ~/.claude/.claude.json contains B, ~/.claude.json still contains A, and the Keychain holds B's token.
This probe on the same machine confirms which file the CLI reads:
~/.claude.json
~/.claude/.claude.json
CLAUDE_CONFIG_DIR
claude auth status
B
A
unset
B
B
A
~/.claude
A
Secondary effect
The system-default snapshot (claude-runtime-auth/system-default-auth.json) captures configOauthAccount through the same resolver. After a fix, a snapshot taken under the old logic can still hold the identity from ~/.claude/.claude.json. Deselecting the managed account would then write that stale identity into ~/.claude.json.
Thanks for the detailed report. This area was rebuilt in #26801 (per-account CLAUDE_CONFIG_DIR and scoped Keychain items, replacing the old credential swap/OAuth refresh code), which removes the code path behind this. Could you check on the latest build? If it still happens, reply or reopen with the details.
Thanks for the report! This is fixed on main by #26801 (8b2a5e4): accounts now launch with their own CLAUDE_CONFIG_DIR, so Orca no longer writes oauthAccount into the shared ~/.claude/.claude.json on a switch. ClaudeRuntimePathResolver.resolveConfigPath is only used by its own test now. Closing — please reopen if you still see it on the latest build.
Activity
AmethystLiang commentedon Sep 24, 2026
thanks for reporting. looking into it
nwparker commentedon Oct 24, 2026
Thanks for the detailed report. This area was rebuilt in #26801 (per-account CLAUDE_CONFIG_DIR and scoped Keychain items, replacing the old credential swap/OAuth refresh code), which removes the code path behind this. Could you check on the latest build? If it still happens, reply or reopen with the details.
nwparker commentedon Oct 27, 2026
Thanks for the report! This is fixed on main by #26801 (8b2a5e4): accounts now launch with their own CLAUDE_CONFIG_DIR, so Orca no longer writes oauthAccount into the shared ~/.claude/.claude.json on a switch. ClaudeRuntimePathResolver.resolveConfigPath is only used by its own test now. Closing — please reopen if you still see it on the latest build.