Skip to content

Windows: gstack-gbrain-sync.ts stage 3 fails to spawn gstack-brain-sync (spawnSync needs shell: true) #1731

@CharlesBerg85

Description

@CharlesBerg85

Summary

On Windows (Git Bash + Bun runtime), stage 3 of the unified gstack-gbrain-sync.ts (the brain-sync stage for curated artifacts → git pipeline) fails with gstack-brain-sync exited undefined. Functional impact is limited (running gstack-brain-sync directly works fine), but the noise pollutes the sync summary on every gstack skill start and makes real errors harder to spot.

Environment

  • OS: Windows 11
  • Shell: Git Bash (MSYS2)
  • gstack version: 1.45.0.0
  • Bun version: (Bun-bundled with gstack install)
  • gbrain version: 0.18.2

Root cause

bin/gstack-gbrain-sync.ts:964-971 — the runBrainSyncPush function uses:

spawnSync(brainSyncPath, ["--once"], { stdio: [...], timeout: 60000 })

— without shell: true.

gstack-brain-sync is a bash-shebang script:

#!/usr/bin/env bash

Windows can't exec a shebang file directly without going through a shell. So spawnSync fails to spawn (returns result.status === undefined), and the wrapper interprets that as a stage failure.

Reproduction

On any Windows machine with gstack installed + gbrain configured:

# In Git Bash
gstack-gbrain-sync --incremental

Expected: stage 3 completes cleanly.
Actual: stage 3 reports gstack-brain-sync exited undefined, even though running gstack-brain-sync --once directly works (exits 0, empty queue).

Proposed fix

Add shell: true to both spawnSync calls in runBrainSyncPush, OR wrap with explicit bash invocation on Windows:

// Option A — simple:
spawnSync(brainSyncPath, ["--once"], { stdio: [...], timeout: 60000, shell: true })

// Option B — explicit cross-platform:
const isWindows = process.platform === "win32";
const cmd = isWindows ? "bash" : brainSyncPath;
const args = isWindows ? [brainSyncPath, "--once"] : ["--once"];
spawnSync(cmd, args, { stdio: [...], timeout: 60000 });

Workaround currently in use

gstack-gbrain-sync --no-brain-sync to skip stage 3 explicitly. Functional but noisy in the sync summary.

Discovered by

Surfaced by Harry Malinski (@hmalinski) during a Liquid Acre dev-machine cleanup session on 2026-05-26 after upgrading gstack 1.35.0.0 → 1.45.0.0. Logged in the LA project's observations log (docs/orchestration/_observations-log.md, session 2026-05-26 afternoon, obs #4).

Related context: a separate gstack-memory-ingest Windows incompat from gstack 1.35.x was already fixed in 1.45.0.0 — same session confirmed that stage works cleanly now. This runBrainSyncPush gap appears to be the last remaining Windows-spawn issue in the unified sync.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions