fix(statusline): respect CLAUDE_CONFIG_DIR for active account detection - #7
Open
haddowg wants to merge 1 commit into
Open
fix(statusline): respect CLAUDE_CONFIG_DIR for active account detection#7haddowg wants to merge 1 commit into
haddowg wants to merge 1 commit into
Conversation
The statusline resolved the current account by reading oauthAccount.emailAddress from ~/.claude/.claude.json (or ~/.claude.json) unconditionally. Inside an isolated profile (ccm switch --isolated), the active account lives in $CLAUDE_CONFIG_DIR/.claude.json, so the statusline showed whatever account was globally active rather than the profile in use. Prefer $CLAUDE_CONFIG_DIR/.claude.json when CLAUDE_CONFIG_DIR is set, falling back to the previous global paths otherwise. The CLAUDE_CODE_USER_EMAIL env-var fast path is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a Claude Code session runs inside an isolated profile (
ccm switch --isolated <account>), the statusline's account line showed the globally-active account instead of the profile actually in use.The root cause is in the statusline script generated by
cmd_statusline. It resolves the account by readingoauthAccount.emailAddressfrom a hardcoded global path:Isolated profiles keep their own
.claude.jsonunder$CLAUDE_CONFIG_DIR, so this read always returned whatever account was last globally active — not the one bound to the running session. TheCLAUDE_CODE_USER_EMAILfast path would mask this, but it isn't always present, and the fallback then silently reports the wrong account.The fix makes the generated statusline prefer
$CLAUDE_CONFIG_DIR/.claude.jsonwhenCLAUDE_CONFIG_DIRis set, falling back to the previous global paths otherwise. This mirrors how isolated profiles are meant to be resolved and leaves non-isolated sessions completely unchanged. TheCLAUDE_CODE_USER_EMAILenv-var fast path is untouched.A
CHANGELOG.mdentry is included under## [Unreleased].Test plan
Verified by extracting the generated statusline from the modified
ccm.shand running it against a synthetic environment with a global config (accountwork) and an isolated profile config (accountpersonal):CLAUDE_CONFIG_DIRpointing at the profile → account line showspersonalCLAUDE_CONFIG_DIR(global session) → account line still showswork(fallback unchanged, no regression)bash -npasses on bothccm.shand the generated statusline script