Repository navigation
fix(config): resolve Claude Code's config dir by its own home rule - #4262
Merged
max-sixty merged 1 commit intoSep 26, 2026
Merged
Conversation
`show.rs::home_dir` read `HOME` before `USERPROFILE`, while Claude Code resolves its config directory with `os.homedir()` — `USERPROFILE` on Windows, where the POSIX-style `HOME` Git Bash sets is not a Windows path at all. `install-statusline` wrote settings.json beside the drive root and reported success; `wt config show` reported a configured statusline as missing. All three branches now use `worktrunk::path::home_dir()`, the rule the other agent integrations already use. Signed-off-by: hiro-nikaitou <[email protected]>
worktrunk-bot
approved these changes
Sep 25, 2026
1 task
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.
wt config plugins claude install-statuslineandwt config showresolved Claude Code's config directory with aHOME-first home rule, while Claude Code itself — and every other home lookup in worktrunk — uses the OS lookup. On Windows the two disagree wheneverHOMEholds the POSIX-style path Git Bash, MSYS2 and Cygwin set, and the disagreement is silent in both directions.Problem
src/commands/config/show.rs::home_dirreadHOME, thenUSERPROFILE, before falling back toworktrunk::path::home_dir. Claude Code is a Node program: its config directory isprocess.env.CLAUDE_CONFIG_DIR || os.homedir(), and Node'sos.homedir()on Windows readsUSERPROFILEand ignoresHOMEentirely. In a Git Bash sessionHOMEis/c/Users/<name>, which is not a Windows path at all — Windows resolves it against the current drive's root.So
install-statuslinereports✓ Statusline configuredafter writing to a directory Claude Code never opens, andwt config showreports a statusline that is configured as missing.wt config showreads back from the same path install just wrote to, so the two agree with each other and neither agrees with Claude Code.Evidence
Windows 11, two binaries built from the same tree with
cargo +stable-x86_64-pc-windows-gnu build— one atmain(f88b827c), one with this change — run in an identical environment:HOME=/c/…/posix,USERPROFILE=D:\…\real,CLAUDE_CONFIG_DIRunset.The mirror is
D:\c\projects\…\posix\.claude\settings.json— the POSIX path re-rooted on whichever drivewthappened to run from.Detection, with the statusline already where Claude Code reads it:
Claude Code's rule, read off the installed bundle (its config path is
join(process.env.CLAUDE_CONFIG_DIR || os.homedir(), ".claude…json")) and confirmed against Node on the same machine withHOMEset to something else:What changes
claude_config_dir()resolves all three of its branches throughworktrunk::path::home_dir(), and the module-localhome_dir()is deleted. On Unix nothing moves — thehomecrate isHOMEthere, with the passwd entry behind it, exactly asos.homedir()is. It is the rulepi.rsandomp.rsalready use for their agent directories, which is the point: the value being resolved is a third party's directory, so the rule that matters is the one that third party uses. Item 9 of the survey in #4106 flagged the two rules in this module as needing a call; this settles it.The tilde branch keeps the behaviour the previous change settled:
~/xand a bare~expand against home, and~\xstays a real path component. It now expands by the same rule rather than a second one.Verification
cargo test --test integration test_plugins_claude_install_statusline→ 9 passed (honors_claude_config_dir,expands_tilde_in_claude_config_dirboth cases,falls_back_to_dot_claude, and the five others)cargo fmt --check,cargo check --all-targetsNot covered by a test:
set_temp_home_envpinsHOMEandUSERPROFILEto the same temp path, so the suite cannot distinguish the two rules, and the manual evidence above is where the difference shows. The fixture would need to split them for a regression test.