fix(server): background git status fetches no longer fill the disk with failed repacks #13812
main fromrefs/pull/13812/head·merged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubOne of our machines lost 688 GB to tmp_pack_* files in .git/objects/pack. T3 Code's background status fetch was the main trigger.
Every git fetch also starts git gc --auto. The repo had 120 packs (the auto-gc limit is 50), so gc tried a full repack each time. The repack failed on missing objects, which left a ~245 MB partial pack behind. Git never records that failure when gc runs under git maintenance run --auto --detach, so the next fetch tried again. The status poller fetches about every 15s, so the leak never stopped.
The fix: the status poller now runs git fetch --no-auto-gc. A background poll should not start maintenance on the user's repo. Fetches, pulls, and commits that users start themselves still run git's normal auto-gc. --no-auto-gc is the older synonym of --no-auto-maintenance, so older Git accepts it too.
Tested with a new test: a repo where auto-gc is due. It fails without the flag (2 packs repacked into 1) and passes with it.
Related: #3525 and #4338 cover a different leak, where the 5s fetch timeout kills index-pack. This PR does not change that.
Created with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code
Summary by CodeRabbit#
- Bug Fixes
- Background status checks no longer trigger Git’s automatic cleanup of repository pack files.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
d6bc76eMacroscope's review found this PR approvable — This is a focused server bug fix that prevents background status fetches from triggering failed automatic repacks, while leaving user-initiated fetch behavior unchanged. A targeted integration test covers the new behavior, with no schema, security, deployment, or configuration-default changes.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Team
Run ID:
377c4853-6391-4dc6-8237-d09620b8da60📥 Commits
Reviewing files that changed from the base of the PR and between 295d7cba09bb4b4084482a74b5a42a0cac72a0b1 and d6bc76e804d7c95b8354d54fff2df85aaee7a9f8.
📒 Files selected for processing (2)
apps/server/src/vcs/GitVcsDriverCore.test.tsapps/server/src/vcs/GitVcsDriverCore.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
📝 Walkthrough
Walkthrough#
The status fetch command now passes
--no-auto-gc. A test checks thatstatusDetailsRemoteleaves two pack files in place when automatic garbage collection thresholds are configured.Changes#
Status fetch garbage collection
Layer / File(s) Summary Disable automatic garbage collection for status fetches
apps/server/src/vcs/GitVcsDriverCore.ts,apps/server/src/vcs/GitVcsDriverCore.test.tsThe status fetch command passes --no-auto-gc. The test verifies that the pack count remains two afterstatusDetailsRemote.Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
juliusmarmingeMerge Risk: ⚪ Minimal · up to
d6bc7Status polling will avoid triggering automatic repository maintenance, preventing repeated failed repacks from accumulating temporary pack files. No actionable merge risk remains.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation Title check ✅ Passed The title clearly identifies the server-side fix and its purpose: preventing failed repacks from consuming disk space during background Git status fetches. Description check ✅ Passed The description explains the problem, root cause, fix, expected behavior, test coverage, and out-of-scope issues. It does not reproduce the template headings or checklist, but it provides the required… Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2… Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. ✨ Finishing Touches
📝 Generate docstrings
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
Comment `@coderabbitai help` to get the list of available commands.t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes