#2985·gstack

/sync-gbrain code stage fails on managed gbrain (>= 0.51): gbrain sync needs --no-pull

Author: michael-sumnerCreated Sep 28, 2026Updated Sep 28, 2026

Summary

After gbrain's managed writer mode is activated (gbrain >= 0.51, gbrain sources writer activate), gbrain sync refuses to run without --no-pull. gstack-gbrain-sync.ts builds the code-stage command without that flag, so /sync-gbrain fails every time on managed brains:

ERR   code   gbrain sync --strategy code --source gstack-code-<repo>-<hash> exited 1

Running the same command directly shows the reason:

Managed sync requires --no-pull; Git pull/rebase needs an explicit drained maintenance window.

Adding --no-pull fixes it (Already up to date., and the stage goes back to OK).

Environment

  • gstack 1.91.2.0 (fresh clone + ./setup)
  • gbrain 0.59.0.0, Postgres engine, local-stdio MCP mode, macOS arm64
  • All sources claimed and writer status showing enabled: true

Where

bin/gstack-gbrain-sync.ts, in the code stage:

typescript
const walkArgs = ["sync", "--strategy", "code", "--source", sourceId];
if (args.mode === "full") walkArgs.push("--full", "--yes");

Suggested fix

The code stage indexes the user's working checkout, and gstack should never pull or rebase it anyway, so passing --no-pull unconditionally looks safe:

diff
-  const walkArgs = ["sync", "--strategy", "code", "--source", sourceId];
+  // --no-pull: managed writer mode (gbrain >= 0.51) refuses sync without it,
+  // and the user owns pulls of their own checkout.
+  const walkArgs = ["sync", "--strategy", "code", "--source", sourceId, "--no-pull"];

If older gbrain versions reject the flag, it could be gated on gbrain sources writer status --json → enabled: true. On 0.59 the flag is accepted in both modes.

I've applied this locally and the orchestrator returns 3 ok, 0 error again. The patch is lost on the next gstack upgrade, which is why I'm reporting it here.

Related but different: #2920 (a "managed canonical worktree" error with writer mode disabled).