Repository navigation
Description
Summary
On Windows running gstack under git-bash, bin/gstack-learnings-log always exits 1 without writing anything, AND without surfacing any error to the caller. The bin swallows stderr with 2>/dev/null, so neither the user nor the AI agent sees that the call failed.
Root cause: the bin computes SCRIPT_DIR via pwd, which returns a POSIX path (/c/Users/...) under git-bash. The bin then interpolates that into a bun import statement (import { hasInjection } from '$SCRIPT_DIR/../lib/jsonl-store.ts'). Bun on Windows can't resolve POSIX-style paths as ES module specifiers and throws Cannot find module, which gets swallowed.
Impact: every Windows user has /learn, /review, /ship, /investigate, etc. silently losing every AI-captured learning. The feature is structurally non-functional on Windows.
gstack-decision-log does not appear to share this code path, so cross-session decision memory still works.
Environment
| gstack | 1.57.7.0 (just upgraded from 1.56.0.0) |
| OS | Windows 11 Pro 26200 |
| Shell | MINGW64_NT bash (git-for-windows 2.54.0) |
| bun | 1.3.14 (Windows x64) |
| Claude Code | (host) |
Repro
From git-bash, with gstack installed at ~/.claude/skills/gstack:
~/.claude/skills/gstack/bin/gstack-learnings-log '{"skill":"learn","type":"pitfall","key":"test-key","insight":"hello world","confidence":5,"source":"observed"}'
echo "exit=$?"
wc -l ~/.gstack/projects/$(~/.claude/skills/gstack/bin/gstack-slug | sed 's/SLUG=//;s/ .*//')/learnings.jsonlExpected: exit=0, line count increases by 1.
Actual: exit=1, line count unchanged. No stderr output.
Root cause (verified)
Running the validation pipeline manually with stderr unsuppressed reveals:
error: Cannot find module '/c/Users/okyhm/.claude/skills/gstack/bin/../lib/jsonl-store.ts'
from 'C:\Users\okyhm\[eval]'
Bun v1.3.14 (Windows x64)
Bun is started with cwd C:\Users\okyhm (Windows form) but the import statement uses /c/Users/... (POSIX form). Bun's module resolver on Windows treats /c/... as an absolute filesystem path that doesn't exist — there's no C: drive letter prefix, just a leaf c under root.
The relevant lines in bin/gstack-learnings-log:
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" # returns /c/Users/... on git-bash
...
VALIDATED=$(printf '%s' "$INPUT" | bun -e "
import { hasInjection } from '$SCRIPT_DIR/../lib/jsonl-store.ts';
...
" 2>/dev/null) # ← stderr swallowed, error invisible
if [ $? -ne 0 ] || [ -z "$VALIDATED" ]; then
exit 1 # ← silent failure
fiSuggested fix
One-line conversion via cygpath (available in every git-for-windows install):
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
if command -v cygpath >/dev/null 2>&1; then
SCRIPT_DIR=$(cygpath -m "$SCRIPT_DIR") # /c/Users/... → C:/Users/...
ficygpath -m (mixed mode) produces Windows-style paths with forward slashes, which bun accepts as both filesystem paths and import specifiers. No-op on non-Windows (cygpath is absent).
I've verified this works locally:
$ ~/.claude/skills/gstack/bin/gstack-learnings-log '{"skill":"learn","type":"pitfall","key":"test","insight":"works","confidence":9,"source":"observed"}'
$ echo $?
0
# learning appended successfullySecondary concern: silent stderr
Independent of the path fix, the 2>/dev/null on the bun subshell is a footgun. Any future validation failure (invalid JSON, bad type, injection rejected, etc.) is invisible to the caller. The bin's own error messages are already prefixed (gstack-learnings-log: ...) so they're safe to surface. Consider dropping the redirect, or at least logging to a debug file.
This is the reason this bug went undetected — every Windows user since the bin was introduced has been silently losing learnings, and neither the user nor the AI got any signal that something was wrong.
Test coverage suggestion
A minimal regression test:
# On any platform — exits 0 on success, 1 on validation failure (visible reason)
output=$(./bin/gstack-learnings-log '{"skill":"test","type":"pitfall","key":"a","insight":"b","confidence":1,"source":"observed"}' 2>&1)
[ $? -eq 0 ] || { echo "BUG: bin failed: $output"; exit 1; }The current Linux CI passes because POSIX /home/runner/... paths resolve fine in bun — only the Windows-specific path-format mismatch triggers the failure. If the Windows-tests workflow runs the bin at all, it would have caught this.
Activity
ramgalv commentedon Jun 10, 2026
Confirming independently — still reproduces on v1.57.9.0 (bun 1.3.13, Windows 11 26200, git-bash). Same root cause: the
/c/Users/...MSYS path passed into thebun -eimport doesn't resolve.Two things toward a fix:
Tested: convert the lib path to Windows form before the import.
cygpathships with git-bash and resolves correctly:On my box
cygpath -wyieldsC:\Users\<user>\.claude\skills\gstack\lib\jsonl-store.ts, which Bun resolves. Afile://URL works too. The same treatment is needed anywhere a$SCRIPT_DIR-derived path is fed to abun -eimport.Stop swallowing the error: the
2>/dev/nullon the validationbun -eis what makes this silent. Surfacing that stderr (or checking the import once at startup) turns "learnings vanish" into a visible error.Scope on my install: of the
bin/scripts usingbun -e, onlygstack-learnings-loginterpolates a$SCRIPT_DIR/../lib/*.tsimport this way, so the user-facing impact is the learnings pipeline specifically.v1.58.4.0 fix: high-priority community bug wave + PTY plan-mode smoke…
chore: merge upstream gstack 1.58.5 (#1)
fix(learn): accept 'investigation' in normalizer, use house TS import…
time-attack commentedon Jul 15, 2026
@16francej Please close this issue as resolved. #2077 fixed the Git Bash path handling for the learnings logger and now surfaces Bun validation errors, so Windows failures are no longer silently discarded.
garrytan commentedon Aug 7, 2026
Verified already fixed on main.
bin/gstack-learnings-log:10-15converts the MSYS-style path withcygpath -mbefore thebun -eimport (MINGW/MSYS/CYGWIN detection), and validation errors now surface on stderr instead of a silent exit 1 (lines 22-26 + 81-86).Regression test:
test/bin-windows-bun-import-paths.test.ts("bin/ — Windows bun-import path guard (#1950)").Run
/gstack-upgradeif your install predates the fix. Closing.v1.78.0.0 fix: the two-red-lanes wave — AUQ collapse rooted, OSV gree…