Skip to content

fix(sync): raise maxBuffer to 100 MiB to prevent silent ENOBUFS crash#982

Merged
garrytan merged 1 commit into
garrytan:masterfrom
garrytan-agents:fix/sync-maxbuffer
May 14, 2026
Merged

fix(sync): raise maxBuffer to 100 MiB to prevent silent ENOBUFS crash#982
garrytan merged 1 commit into
garrytan:masterfrom
garrytan-agents:fix/sync-maxbuffer

Conversation

@garrytan-agents

Copy link
Copy Markdown
Contributor

What

git() helper in sync.ts uses execFileSync with Node's default 1 MiB maxBuffer. On repos with 60–100K files, git diff --name-status -M output exceeds this limit, killing the sync process silently — no error, no stack trace, just a dead PID.

Root Cause

Observed on a 99K-file brain repo (62K tracked by git). Sync consistently died during the rename-detection phase at ~15% through buildSyncManifest(). The ENOBUFS error from execFileSync is not caught or logged — the process just vanishes.

Fix

Raise maxBuffer to 100 * 1024 * 1024 (100 MiB). A 100K-file diff with long paths tops out around 10–20 MiB in practice, so 100 MiB is generous but bounded.

Testing

  • Survived 5+ full syncs on a 99K-file corpus (62K in git ls-files) without dying
  • Previously failed at 15% on every attempt without the patch
  • No behavioral change for repos under 1 MiB diff output (the vast majority)

Node's default maxBuffer for execFileSync is 1 MiB. On repos with
60-100K files, `git diff --name-status -M` output easily exceeds this,
causing the sync process to die silently with no error in the log.

Observed at /data/brain (99K files, 62K in git ls-files): sync
consistently died during the rename-detection phase at ~15% through
`buildSyncManifest()`. No stack trace, no error event — just a dead
process. The fix survived 5+ full syncs on the same corpus.

100 MiB is generous but bounded. A 100K-file diff with long paths
tops out around 10-20 MiB in practice.
@garrytan garrytan merged commit cb8d6d8 into garrytan:master May 14, 2026
7 checks passed
brandonlipman added a commit to brandonlipman/gbrain that referenced this pull request May 29, 2026
* upstream/master:
  v0.35.1.0: embedder shootout prereqs (pricing + gateway export + --resume-from) (garrytan#1055)
  v0.35.0.0 feat: ZeroEntropy zembed-1 + zerank-2 reranker (garrytan#1008)
  v0.34.4.0 fix(embed): cursor-paginated --stale hardening wave (D2/D3/D4/D6/D7/D8 + regression test) (garrytan#991)
  v0.34.3.0 fix: supervisor treats code=0 watchdog exits as crashes (garrytan#1003)
  v0.34.2.0 fix(import): path-based checkpoint resume — kills parallel-drop + failed-file-skip + sort-flip bugs (garrytan#988)
  v0.34.1.0 fix(mcp): MCP fix wave — source-isolation P0 + PKCE DCR + federated_read + 3 more (garrytan#996)
  v0.34.0.0 feat: Cathedral III — recursive code intelligence + Leiden clusters + eval gate (garrytan#994)
  v0.33.3.0 feat(v0.33.3): code intelligence MCP foundation (v0.34 W0a-c + W3) (garrytan#934)
  v0.33.2.1 docs: fork-PR workflow for garrytan-agents (garrytan#992)
  fix(sync): raise maxBuffer to 100 MiB to prevent silent ENOBUFS crash (garrytan#982)
  v0.33.2.0 feat(search-lite): token budget + semantic query cache + intent weighting (garrytan#897)
  v0.33.1.1 fix: Voyage output_dimension + flexible-dim guard + OOM-cap rethrow (garrytan#962)
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