Skip to content

fix: exec gstack-brain-sync through bash on Windows - #2451

Closed
vaston-viji wants to merge 1 commit into
garrytan:mainfrom
vaston-viji:fix/win-brain-sync-bash-spawn
Closed

fix: exec gstack-brain-sync through bash on Windows#2451
vaston-viji wants to merge 1 commit into
garrytan:mainfrom
vaston-viji:fix/win-brain-sync-bash-spawn

Conversation

@vaston-viji

Copy link
Copy Markdown
Contributor

Problem

The #1731 fix gated the orchestrator's brain-sync spawns behind shell: NEEDS_SHELL_ON_WINDOWS, but that routes through cmd.exe, which cannot execute an extensionless bash shebang script. Every /sync-gbrain run on Windows errors:

'C:\Users\...\gstack\bin\gstack-brain-sync' is not recognized as an internal or external command

and the stage reports ERR brain-sync — gstack-brain-sync exited 1.

Fix

In runBrainSyncPush (bin/gstack-gbrain-sync.ts), exec the script through bash explicitly on Windows: spawnSync("bash", [brainSyncPath, flag]). Git Bash ships with git, which gstack already requires, so bash is a safe dependency. POSIX keeps the direct shebang exec with no shell. Spawn errors (e.g. bash missing from PATH) now surface in the stage summary instead of a bare exit code.

The #1731 tripwire test pinned the old shape (spawnSync(brainSyncPath, ...) with the shell flag), so it is updated to pin the new invariant: brain-sync spawns must exec bash on Windows and must not rely on shell: true.

Verification

On Windows 11 (bun 1.3.14):

  • Before: ERR brain-sync — gstack-brain-sync exited 1 with the "not recognized" cmd error.
  • After: OK brain-sync — curated artifacts pushed (0.2s).
  • bun test test/gbrain-spawn-windows-shell.test.ts: 5 pass, 0 fail.

Related: #2450 fixes the separate Windows probe-timeout false-negative in the same sync pipeline.

🤖 Generated with Claude Code

The garrytan#1731 fix gated the brain-sync spawns behind
`shell: NEEDS_SHELL_ON_WINDOWS`, but that routes through cmd.exe,
which cannot execute an extensionless bash shebang script. Every
/sync-gbrain run on Windows errored with "'gstack-brain-sync' is not
recognized as an internal or external command" and the stage reported
"brain-sync exited 1".

Invoke the script through bash explicitly on Windows (Git Bash ships
with git, a hard gstack dependency); POSIX keeps the direct shebang
exec. Also surface spawn errors (e.g. bash missing from PATH) in the
stage summary instead of a bare exit code, and update the garrytan#1731
tripwire test to pin the new invariant: brain-sync spawns must exec
bash, not rely on shell:true.

Observed on Windows 11, bun 1.3.14.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Aug 4, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@garrytan

Copy link
Copy Markdown
Owner

Closing: this was absorbed or superseded on main by v1.67.0.0 or earlier (see the v1.67 tracker-wave receipts in PR #2604). Thank you!

@garrytan garrytan closed this Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants