Skip to content

fix(server): background git status fetches no longer fill the disk with failed repacks - #13812

Merged
t3dotgg merged 1 commit into
mainfrom
t3code/background-fetch-no-auto-gc
Sep 26, 2026
Merged

t3dotgg merged 1 commit into
mainfrom
t3code/background-fetch-no-auto-gc

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

One 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.

…th failed repacks

The status poller's `git fetch` also started `git gc --auto`. When that gc
fails (here, a repository with missing objects), Git retries it on every
fetch and leaves a full-size tmp_pack_* each time. Pass --no-auto-gc so the
background poll never starts repository maintenance.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Sep 26, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at d6bc76e

Macroscope'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.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Review in Change Stack →

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 295d7cb and d6bc76e.

📒 Files selected for processing (2)
  • apps/server/src/vcs/GitVcsDriverCore.test.ts
  • apps/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 that statusDetailsRemote leaves 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.ts
The status fetch command passes --no-auto-gc. The test verifies that the pack count remains two after statusDetailsRemote.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to d6bc7

Status 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
t3dotgg merged commit 95030dc into main Sep 26, 2026
24 checks passed
@t3dotgg
t3dotgg deleted the t3code/background-fetch-no-auto-gc branch September 26, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant