Skip to content

fix(server): skip git status scans while the index is locked - #9845

Merged
t3dotgg merged 1 commit into
pingdotgg:mainfrom
Gigioxx:t3code/backoff-git-polling-locks
Sep 6, 2026
Merged

fix(server): skip git status scans while the index is locked#9845
t3dotgg merged 1 commit into
pingdotgg:mainfrom
Gigioxx:t3code/backoff-git-polling-locks

Conversation

@Gigioxx

@Gigioxx Gigioxx commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Background Git status scans can repeatedly run LFS clean filters while an index lock prevents caching the results. Git status can still exit successfully, so retry backoff based on command failures would miss this case.

Resolve the working tree's index through Git and check its lock before running status or numstat. Return a clear error while locked and resume on the next request after unlock. The shared status reader covers nested projects and linked worktrees across all clients.

Fixes #9776.

Verification:

  • Reproduced with real Git and an instrumented clean filter: three locked status polls invoked the filter three times, each exiting 0. The three new regressions fail on the original implementation.
  • With the fix, repeated locked polls invoke no filters, preserve the lock, and resume with correct status after unlock in root, nested, and linked-worktree repositories.
  • All 170 tests pass across GitVcsDriverCore.test.ts, GitVcsDriver.test.ts, and GitManager.test.ts. Server typecheck, targeted lint, formatting, and git diff --check pass.

This adds one Git path lookup per local scan. It prevents scans when the lock already exists; it does not cancel a scan if another process creates a lock afterward. No lock deletion, LFS cleanup, or checkpoint changes. The reproduction verifies repeated clean-filter execution, not the reported macOS LFS temp-file accumulation. No UI changes or browser run.

Model: GPT-6. Harness: Codex in T3 Code.


Note

Medium Risk
Touches the hot path for background repo status polling across all clients; behavior change is intentional but could surface transient errors during legitimate Git operations that hold the index lock.

Overview
Local status reads now bail out before git status when the repository index is locked, avoiding repeated LFS/clean-filter work while Git holds index.lock (status can still exit 0, so failure-based backoff did not help).

readStatusDetailsLocal resolves the index via git rev-parse --git-path index, checks for index.lock on disk, and returns a clear GitCommandError until the lock is gone; normal status (and downstream numstat) runs again after unlock. Each local scan adds one extra Git path lookup.

Tests cover root, nested cwd, and linked worktrees with a probe clean filter: three locked polls must not run the filter; unlock restores success. The stable-diagnostics test expects the new rev-parse --git-path index call before porcelain status.

Reviewed by Cursor Bugbot for commit a91c9a4. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Skip git status scans when index lock is present in GitVcsDriverCore

  • Adds an index-path preflight to GitVcsDriverCore.readStatusDetailsLocal using git rev-parse to check for an index lock file before running git status.
  • If the lock exists, the method fails early with a GitCommandError index-lock diagnostic instead of running the status command or clean filter. Normal status processing resumes once the lock is removed.
  • Risk: File-system errors during the lock check in readStatusDetailsLocal are now wrapped in GitCommandError rather than propagating raw.

Macroscope summarized a91c9a4.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 4, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at a91c9a4

Macroscope's review found this PR approvable — This is a focused Git status bug fix that adds a lock preflight, avoids repeated clean-filter work during index operations, and resumes the existing status path after unlock. The production logic is localized and covered by root, nested, and linked-worktree regression tests.

You can add or adjust custom eligibility rules. Learn more.

@t3dotgg
t3dotgg merged commit 86070cb into pingdotgg:main Sep 6, 2026
22 checks passed
BarretoDiego pushed a commit to BarretoDiego/t3code that referenced this pull request Sep 7, 2026
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 7, 2026
## What's Changed
* fix(clients): show feedback results in composer banners by @juliusmarminge in pingdotgg/t3code#10398
* fix(server): stop Windows terminal polling from spiking CPU by @UtkarshUsername in pingdotgg/t3code#9476
* fix(web): onboarding installs agents without needing Node or npm by @t3dotgg in pingdotgg/t3code#10402
* fix(server): allow settling threads with unanswered async questions by @t3dotgg in pingdotgg/t3code#10400
* feat(ci): ship stable releases from the latest nightly commit by @t3dotgg in pingdotgg/t3code#10410
* feat(marketing): add a nightly channel to the download page by @t3dotgg in pingdotgg/t3code#10408
* fix(web): keep settings inputs focused during IME composition by @Lucenx9 in pingdotgg/t3code#10262
* fix(server): preserve Codex reset credits during usage updates by @yashranaway in pingdotgg/t3code#10308
* docs: link the repository security reporting policy by @yashranaway in pingdotgg/t3code#10303
* fix(web): only show auto balance errors after failed checks by @maria-rcks in pingdotgg/t3code#10407
* fix(web): improve preview recording frame delivery by @maria-rcks in pingdotgg/t3code#10403
* fix(server): preserve inline provider secrets on redacted saves by @maxwellyoung in pingdotgg/t3code#10054
* fix(web, mobile): replace Apple desktop machine labels by @extoci in pingdotgg/t3code#10396
* fix(web): hide browser when the right panel starts closing by @Neel2107 in pingdotgg/t3code#10385
* fix(web): keep settings section headings description-free by @maria-rcks in pingdotgg/t3code#10415
* fix(usage): read and redeem hub reset credits through CLIProxyAPI by @juliusmarminge in pingdotgg/t3code#10395
* fix(web): deduplicate expanded tool labels and keep errors expandable by @Yash-Singh1 in pingdotgg/t3code#10420
* fix(server): skip git status scans while the index is locked by @Gigioxx in pingdotgg/t3code#9845
* fix(mcp): allow text-only preview snapshots by @juliusmarminge in pingdotgg/t3code#10232
* fix(claude): name the expired login or usage limit instead of a generic API error by @vitalyiegorov in pingdotgg/t3code#10321
* feat(mobile): queue a message while its attachment is still uploading by @juliusmarminge in pingdotgg/t3code#10404
* feat(mobile): show when an existing thread has a message waiting in the outbox by @juliusmarminge in pingdotgg/t3code#10405
* fix(codex): accept misalignment policy errors on thread resume by @realbakari in pingdotgg/t3code#10373
* fix(server): skip disabled settlement lookups by @t3dotgg in pingdotgg/t3code#10424
* fix(server): run OpenCode CLI commands sequentially by @t3dotgg in pingdotgg/t3code#10427
* feat(web): name the drop action while dragging sidebar threads by @SunkenInTime in pingdotgg/t3code#10378
* perf(web): keep the sidebar responsive during bulk thread updates by @t3dotgg in pingdotgg/t3code#10413
* fix(web): onboarding wizard now supports light mode by @t3dotgg in pingdotgg/t3code#10432
* feat(threads): dismiss async questions without replying by @t3dotgg in pingdotgg/t3code#10431
* fix(web): stop collapsing the composer when it loses focus by @t3dotgg in pingdotgg/t3code#10437
* fix(server): keep interrupted threads resumable after restarts by @maria-rcks in pingdotgg/t3code#10421

## New Contributors
* @Neel2107 made their first contribution in pingdotgg/t3code#10385
* @realbakari made their first contribution in pingdotgg/t3code#10373

**Full Changelog**: pingdotgg/t3code@v0.0.39-nightly.20260906.1316...v0.0.39-nightly.20260907.1325

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.39-nightly.20260907.1325
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Background git polling + stale index.lock fills .git/lfs/tmp (~150 GB/day) in LFS repos

2 participants