Skip to content

fix: disable gc.auto after blobless clones to prevent race condition#6

Merged
critesjosh merged 1 commit intomainfrom
fix/gc-race-condition
Mar 2, 2026
Merged

fix: disable gc.auto after blobless clones to prevent race condition#6
critesjosh merged 1 commit intomainfrom
fix/gc-race-condition

Conversation

@critesjosh
Copy link
Collaborator

Summary

  • Adds git config gc.auto 0 immediately after each --filter=blob:none clone in cloneRepo()
  • Prevents concurrent git gc --auto processes from colliding during on-demand blob fetches triggered by sparsePathOverrides checkouts
  • Fixes "unable to write new index file" errors when syncing aztec-packages (which uses sparsePathOverrides to pull docs from the next branch)

Context

Blobless clones (--filter=blob:none) fetch blobs on demand. When sparsePathOverrides checks out files from a different branch (e.g., origin/next), each blob fetch triggers git gc --auto. Multiple concurrent gc processes race to write the same index file, causing failures.

Setting gc.auto=0 is safe here because these are read-only clones used only for code search — they never accumulate loose objects over time.

Test plan

  • All 109 existing tests pass with updated assertions for the new gc.auto config call
  • Delete ~/.aztec-mcp/repos/aztec-packages and re-sync to verify clone succeeds without gc errors

🤖 Generated with Claude Code

Blobless clones with sparsePathOverrides trigger on-demand blob fetches,
each of which runs `git gc --auto`. Concurrent gc processes collide with
"unable to write new index file" errors. Setting gc.auto=0 right after
clone prevents this. Safe for read-only clones used only for code search.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@critesjosh critesjosh merged commit 8db109f into main Mar 2, 2026
6 checks passed
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

🎉 This PR is included in version 1.9.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@critesjosh critesjosh deleted the fix/gc-race-condition branch March 2, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant