mirror of https://github.com/garrytan/gstack.git
lib/bin-context.ts spawns the `gstack-slug` bash script directly. Windows has
no shebang support, so spawnSync fails with ENOENT, stdout is null, and the
slug silently falls back to "unknown".
Every bun-based bin that resolves a slug this way then reads and writes
~/.gstack/projects/unknown/ instead of the real project. In practice that means
gstack-decision-log writes decisions somewhere gstack-decision-search on another
project can also see, and the Context Recovery block in every skill preamble
never surfaces them, because it checks for decisions.active.json under the
correct slug. The failure is silent: exit 0, empty results, nothing in any log.
Same root cause as the spawn half of #2356, and the same class the #1731 fix
addressed for gbrain. That fix used `shell: true`, which is right for gbrain
because gbrain ships a .cmd shim on Windows. gstack's own bins are extensionless
bash scripts, so cmd.exe answers "is not recognized as an internal or external
command" and only `spawnSync("bash", [script])` starts them:
spawnSync(bin) -> ENOENT
spawnSync(bin, {shell: true}) -> not recognized as an internal or external command
spawnSync("bash", [bin]) -> status 0
Adds spawnBashBin() and routes resolveSlug through it. The direct spawn is still
attempted first, so POSIX behaviour is byte-for-byte unchanged and the bash
fallback only runs on the path that is currently broken.
Verified on Windows 11, bun 1.3.13, Git Bash, global git install at
~/.claude/skills/gstack:
before: gstack-decision-search --json -> [] (2 decisions on disk)
after: gstack-decision-search --json -> 2 decisions, from both the repo root
and a subdirectory with a different git remote
Test suite unchanged: test/gbrain-spawn-windows-shell.test.ts,
gstack-decision.test.ts, gstack-decision-bins.test.ts,
bin-windows-bun-import-paths.test.ts and gstack-slug-sanitize.test.ts report
39 pass / 18 fail both before and after this commit on Windows at
|
||
|---|---|---|
| .. | ||
| diagram-render | ||
| bin-context.ts | ||
| conductor-env-shim.ts | ||
| gbrain-exec.ts | ||
| gbrain-guards.ts | ||
| gbrain-local-status.ts | ||
| gbrain-sources.ts | ||
| gstack-decision-semantic.ts | ||
| gstack-decision.ts | ||
| gstack-memory-helpers.ts | ||
| is-conductor.ts | ||
| jsonl-store.ts | ||
| redact-audit-log.ts | ||
| redact-engine.ts | ||
| redact-patterns.ts | ||
| staging-guard.ts | ||
| worktree.ts | ||