Skip to content

fix: raise gbrain version-probe timeout to 10s on Windows - #2450

Closed
vaston-viji wants to merge 1 commit into
garrytan:mainfrom
vaston-viji:fix/win-gbrain-version-probe-timeout
Closed

fix: raise gbrain version-probe timeout to 10s on Windows#2450
vaston-viji wants to merge 1 commit into
garrytan:mainfrom
vaston-viji:fix/win-gbrain-version-probe-timeout

Conversation

@vaston-viji

Copy link
Copy Markdown
Contributor

Problem

On Windows the gbrain CLI is a .cmd shim that runs bun run cli.ts. A cold spawn takes over 2s (warm runs are ~700ms). resolveGbrainBin in lib/gbrain-local-status.ts probes gbrain --version with a 2s timeout, so the cold probe times out and localEngineStatus returns no-cli. The 60s status cache then serves that false negative to every skill preamble and sync run. Net effect: /sync-gbrain skips the memory stage with "gbrain CLI not on PATH; install via /setup-gbrain" on a machine where the CLI works.

Fix

Add VERSION_PROBE_TIMEOUT_MS: 10s when NEEDS_SHELL_ON_WINDOWS, 2s otherwise. Used by both resolveGbrainBin and readGbrainVersion. POSIX keeps the cheap 2s probe; only the Windows shim path gets headroom.

Verification

On Windows 11 (bun 1.3.14, gbrain 0.42.59.0):

  • Before: gstack-gbrain-detect reported gbrain_on_path: false, gbrain_local_status: "no-cli"; sync skipped the memory stage.
  • After: detect reports gbrain_on_path: true, gbrain_local_status: "ok"; memory stage runs (OK memory — persisted 23 pages).
  • bun test test/gbrain-local-status.test.ts shows the same 7 pass / 17 fail before and after the patch on this Windows machine — the 17 failures are pre-existing environment issues (the tests build fake POSIX shims on PATH), not caused by this change.

🤖 Generated with Claude Code

On Windows the gbrain CLI is a .cmd shim that runs `bun run cli.ts`.
A cold spawn takes over the 2s timeout in resolveGbrainBin (warm runs
are ~700ms), so the probe times out, localEngineStatus classifies the
engine as "no-cli", and the 60s status cache then serves that false
negative to every skill preamble and sync run. /sync-gbrain skips the
memory stage with "gbrain CLI not on PATH" even though the CLI works.

Give the shim 10s of headroom, gated on NEEDS_SHELL_ON_WINDOWS so
POSIX keeps the cheap 2s probe. Applies to both resolveGbrainBin and
readGbrainVersion.

Observed on Windows 11, bun 1.3.14, gbrain 0.42.59.0.

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

Thank you — this was absorbed on main (credited in the v1.6x CHANGELOG entries; roster in PR #2604). Closing.

@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