Branch change totals time out at 30 s on every refresh when the base branch is far behind, and turn completion waits for it #37437
What happened#
After a turn ends, RunFinalizationService.finalize waits on VcsStatusBroadcaster.refreshLocalStatus. In a workspace whose branch has drifted far from the base branch, the change totals inside that refresh time out at 30 s on every call. So every turn in that workspace finishes about 30 s late, and the totals are never shown.
Environment#
- T3 Code (Beta) desktop, server bundle version 0.1.0, installed build as of 2026-11-15
- macOS 26.6.2, Apple M5, git 2.39.2
- Thread running in place in the repository root, with no remote. The checked-out branch has no
gh-merge-base, soresolveBaseBranchForNoUpstreamfalls back tomain. mainis a stale local line: not an ancestor of HEAD, 518 commits behind, 55,203 files different.
Diagnosis#
readBranchChangeTotals runs git diff --find-renames --minimal --numstat -z <merge-base> -- against the merge base with main, with untracked files added through prepareUntrackedReviewIndex. With 55,000 changed files, including large binaries, that diff can't finish within the 30 s git timeout.
The failure is caught (orElseSucceed), so it fails silently. Nothing remembers it, so the next refresh runs the same 30 s diff again. Worktree threads in the same repository set gh-merge-base to their parent branch and finish the same call in about 0.1 s.
Evidence#
Server trace spans, real provider turns:
GitVcsDriver.readBranchChangeTotalsin the repository root: n=61, 43 of them ended inGitCommandError: Git command timed out; p50 30.0 s, max 31.0 s.- The same diff run by hand without
--find-renames --minimalstill takes 30.6 s, so the size of the range is the cost, not the flags. - The same span in 9 worktree workspaces of the same repository: p50 0.1 s, max 1.5 s.
- Inside
RunFinalizationService.finalize(n=66):refreshLocalStatusp50 29.1 s, max 62.4 s.checkpointCapture.executep50 4.0 s.
Suggested fix#
- Don't make run completion wait on
refreshLocalStatus. Refresh status after the run is marked complete. This overlaps with #15124. - When
readBranchChangeTotalstimes out, cache that result per (cwd, HEAD, base) and stop retrying until one of them changes. Better still, skip the numstat entirely whengit diff --name-only(orrev-list --count) shows the range is above a size cap, and show "too many changes" the wayprepareUntrackedReviewIndexalready does for untracked files.
juliusmarminge closed this
Sign in to join this conversation.