Windows (Git Bash): every `./setup` re-spells the hook commands between `C:/...` and `/c/...` and calls them stale
What happened
On Windows 11 under Git Bash, every ./setup run prints these two lines, including a second run straight after the first with no change in between:
healed hook registrations: removed 0, repointed 4 (backup: settings.json.bak.<ts>; ...)
re-pointed Stop hook to bash /c/Users/<user>/.claude/skills/gstack/hosts/claude/hooks/timeline-stop-hook (previous registration held a stale path)
For these registrations the hook target never moved. Setup only rewrites the command between two spellings of the same hook path, so the "(previous registration held a stale path)" message is wrong. The heal step and the registration steps write the same hooks in different spellings, and every run undoes the run before it. The settings.json.bak.* files from one run show the heal writing every gstack hook as bash C:/Users/<user>/.claude/skills/gstack/..., then the later registration steps writing four of them back as bash /c/Users/<user>/.... The next run starts from /c/ and does the same again. Each run rewrites ~/.claude/settings.json several times and leaves several backups. On this machine that came to 10 backups from three runs in one morning.
Expected: a second ./setup heals nothing and re-points nothing.
This happened on every repeated default ./setup we ran on this machine. The conversion described below is specific to Git Bash/MSYS. We did not test other platforms.
Cause, from reading main at 4685fa9:
setupheals with"$SETTINGS_HOOK" prune-stale --repoint "$CANONICAL_GSTACK_ROOT"(setup:4385).bin/gstack-settings-hookpasses the root to Bun as an environment variable,GSTACK_REPOINT_ROOT="$REPOINT_ROOT" bun ...(bin/gstack-settings-hook:773), and buildsroot + "/" + row.relpathfrom it (line 827).- When MSYS starts a native Windows program, it converts environment values that look like POSIX paths. Bun therefore receives
C:/Users/..., and the heal writes that spelling. - The registration steps pass
--command "bash $CANONICAL_GSTACK_ROOT/...". Examples: the Stop hook at setup:4876-4878, with itsensure-eventcall at setup:4916. A value that starts withbashis not converted, so these keep/c/Users/....ensure-eventtreats the existing entry as the same gstack hook, sees a different command string, re-points it and logs the "stale path" line (setup:4926, and setup:4996 for the other hooks). - Both sides start from the same
CANONICAL_GSTACK_ROOT(setup:4327). The only difference is how the root reaches them: an environment variable for the heal, an argument for registration.
The two paths should agree on how they spell a command, or should treat equivalent path spellings as unchanged. gsWinPath (bin/gstack-settings-hook:171-174) already separates filesystem normalization from stored command spelling: "stored commands keep the form the firing shell expects". bin/gstack-path-spelling.sh:2-6 names this class of bug: "Comparing two spellings as strings is the bug class behind #3088, #3100 and #3101". Neither the heal nor ensure-event uses those helpers.
The conversion is easy to show on its own:
$ X=/c/Users/me/x bun -e 'console.log(process.env.X)'
C:/Users/me/x
$ MSYS2_ENV_CONV_EXCL=X X=/c/Users/me/x bun -e 'console.log(process.env.X)'
/c/Users/me/x
Both spellings run under Git Bash, so the hooks keep working. The harm is the settings churn, the build-up of backups, and log lines that describe an equivalent path as stale.
Possible fixes:
- Exclude
GSTACK_REPOINT_ROOTfrom MSYS environment conversion for this one Bun call, keeping any exclusions already set inMSYS2_ENV_CONV_EXCL. - Or, in both the heal and
ensure-event, compare the path inside each command in one spelling (thegstack_path_shell/ lib/path-spelling.ts helpers), and keep the wrapper, arguments and quoting as they are.
We searched the docs and code at 4685fa9 for an existing setting or guard. We found none: MSYS2_ENV_CONV_EXCL, MSYS_NO_PATHCONV and MSYS2_ARG_CONV_EXCL do not appear in setup or bin/gstack-settings-hook.
Steps to reproduce
- On Windows 11 with Git Bash, install gstack for Claude:
cd ~/.claude/skills/gstack && ./setup. - Run
./setupagain and save the output. It showshealed hook registrations: ... repointed 4andre-pointed Stop hook ... (previous registration held a stale path). - Run it a third time. The same two lines appear, and
ls ~/.claude/settings.json.bak.*shows several more files than after step 2.
Readiness report
gstack doctor 1.99.0.0
ok install root ~/.claude/skills/gstack: agy global current (1.99.0.0), codex global current (1.99.0.0), claude global current (1.99.0.0)
ok rescue refs none in ~/.claude/skills/gstack
ok state root ~/.gstack durable=yes (selected by default)
ok bun 1.4.4 at ~/AppData/Local/Microsoft/WinGet/Links/bun (floor 1.3.3, tested 1.4.2)
ok hooks 15 hook(s) parse
ok windows bash C:/Program Files/Git/bin/bash.exe (chosen by git --exec-path)
ok codex codex-cli 0.167.0; self-locate ok; model gpt-6.1-sol
ok codex probe cached MODEL_OK, 10d ago (not re-run; --live probes now)
ok artifacts sync status ok (mode full; queue 0)
ok browse bundle browse/dist built
ok binaries find-browse, design, pdf, gstack-global-discover launch (4 of 4)
not configured cso native helper not built; /cso reports not assessed
ok claude code 2.1.319 (Claude Code) at ~/.local/bin/claude
ok session journal largest of 60: 19.3 MiB
ok guard log 34 decisions (2 denied)
ok CLAUDE.md no gstack section lists skills
15 ok, 0 warn, 1 not configured, 0 fail
Environment
- Host and version: Claude Code 2.1.319; gstack 1.99.0.0, installed at 9ab5034.
setupandbin/gstack-settings-hookare byte-identical between 9ab5034 and main 4685fa9. - OS: Windows 11 Pro, Git for Windows 2.46.0 (Git Bash, MSYS2 runtime), Bun 1.4.4, no Developer Mode.
- Related: #3088, #3100, #3101 (the same path-spelling class). Companion issue, same machine: #4280.
Thanks for the careful write-up and the cause analysis. Windows gets minimal support in gstack (docs/support-tiers.md): we keep install, startup and the core workflows working, and we're not taking changes beyond that. The hooks still run here, and the repeated rewrite is noisy rather than broken, so I'm closing this as won't-fix. If it ever stops a hook from running or breaks setup, please reopen with the output and we'll take another look.