fix(sync-gbrain): Windows compat — capability check + brain-sync skip#1641
Closed
jakehann11 wants to merge 1 commit into
Closed
fix(sync-gbrain): Windows compat — capability check + brain-sync skip#1641jakehann11 wants to merge 1 commit into
jakehann11 wants to merge 1 commit into
Conversation
Two Windows-only failures surfaced when running /sync-gbrain on Git Bash from a freshly-set-up local-stdio gbrain install: 1) Capability check used `echo "ping" | gbrain put "$SLUG"` which fails with `ENOENT /dev/stdin` on Windows. Switching to `gbrain put "$SLUG" --content "ping"` works on both Windows and Unix (and matches the v1.42.0.0 wave that rewrote all 10 user-facing put_page templates to the put + --content shape). 2) `runBrainSyncPush` in gstack-gbrain-sync.ts did not check artifacts_sync_mode before invoking gstack-brain-sync. When the user set the mode to "off" (the default + opt-out value), the orchestrator still tried to run the bash script, which Node/Bun spawnSync can't execute directly on Windows (ENOENT, returns status === undefined). Verdict showed "ERR brain-sync gstack-brain-sync exited undefined" despite a healthy install. New `readArtifactsSyncMode()` helper parses ~/.gstack/config.yaml directly via readFileSync — no process spawn, fully portable. When the key reads "off", the stage returns ran=false ok=true with summary "skipped (artifacts_sync_mode=off — user opt-out)". Verified on Windows Git Bash: - Capability check: CAPABILITY_OK=1 (was 0) - Sync verdict: "3 ok, 0 error, 0 skipped" (was "2 ok, 1 error") Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Two Windows-only failures surfaced running
/sync-gbrainon Git Bash from a freshly-set-up local-stdio gbrain install. Both trace to the same family of issues — Node/BunspawnSynccan't directly execute bash scripts on Windows (ENOENT). Same shape as #1571 (different code path).1. Capability check fails on Windows. The
## Step 4: Refresh ## GBrain Search Guidance blockcapability check uses:Windows Git Bash treats this as writing to
/dev/stdin, which gbrain rejects withENOENT: no such file or directory, open '/dev/stdin'.CAPABILITY_OKalways reports0on Windows even when the engine is healthy and search works — so the skill removes the## GBrain Search Guidanceblock fromCLAUDE.mdon every run, defeating the whole point of the workflow.Switching to
gbrain put "$SLUG" --content "ping"works on both Windows and Unix, and matches the v1.42.0.0 wave (#1571 era) that rewrote all 10 user-facingput_pageinstruction templates to theput + --contentcanonical shape.2.
runBrainSyncPushproduces spuriousERRrows whenartifacts_sync_mode=off. The orchestrator didn't check the user's opt-out before invokinggstack-brain-sync(also a bash script). On Windows the spawn fails withresult.status === undefined, producing this verdict row even with a healthy install + intentional opt-out:New
readArtifactsSyncMode()parses~/.gstack/config.yamldirectly viareadFileSync— no process spawn, fully portable across all platforms. When the key readsoff(the default), the stage returnsran=false ok=true summary="skipped (artifacts_sync_mode=off — user opt-out)".Verified on Windows Git Bash
Before:
After:
Capability check:
CAPABILITY_OK=1(was0).Test plan
bun test test/gstack-gbrain-sync.test.ts— same 31 pass / 6 fail before and after this PR. The 6 failures (sourceLocalPathdescribe block) are pre-existing Windows-specific test issues — the tests use bash-script shims that Windows NodespawnSynccan't execute viaENOENT. Same root cause family, separate fix needed./sync-gbrainonce on macOS/Linux to confirm both paths still behave (no regression expected; the YAML-parse helper is just areadFileSync + regexand the--contentflag has been the canonical shape since v0.18+).🤖 Generated with Claude Code