Repository navigation
Description
Steps to reproduce
- On Windows, add several projects. Mine are 4 Git repositories with an
originremote (300, 611, 2,837 and 33,819 tracked files) and 4 folders that are not repositories. - Turn Automatically pull on, with the default 30 s automatic fetch interval.
- Leave the server running for a while.
- Count the Git commands under each
autoPullProjectsspan in the server trace logs:
# python count.py <T3 data dir>/userdata/logs
import collections, glob, json, sys
spans = {}
for f in glob.glob(sys.argv[1] + "/server.trace.ndjson*"):
for line in open(f, encoding="utf-8", errors="replace"):
try: d = json.loads(line)
except ValueError: continue
spans[d["spanId"]] = d
passes = collections.Counter()
for d in spans.values():
if d["name"] != "runGitCommand": continue
p = d.get("parentSpanId")
while p in spans and spans[p]["name"] != "autoPullProjects":
p = spans[p].get("parentSpanId")
if p in spans: passes[p] += 1
n = sorted(passes.values())
print(len(n), "auto-pull passes, median git commands per pass:", n[len(n) // 2])Expected behavior
A project that is already up to date costs close to nothing per pass: a fetch and one cheap check of whether it is behind.
Actual behavior
Over 129 full minutes on 2026-11-29, on a machine in active use with agents running (the stretch in my logs during which the auto-pull loop was running; it stopped afterwards, consistent with its pause on a constrained host such as a locked screen, which I did not record):
| Measure | Value |
|---|---|
| Git commands the server ran, all causes | 16,685 (median 122/min, p90 198, max 273) |
| …from the auto-pull loop | 51.4% |
| …from status subscription polling | 22.8% |
| …from pull request lookups | 17.8% |
| …from checkpoints and other callers | 8.1% |
| Auto-pull passes | 185, median 40.3 s between starts (the 30 s wait plus a pass of about 10 s) |
| Git commands per pass (median) | 45, over 8 projects |
git status runs per pass / diff-index --numstat runs per pass |
4 / 4 |
git pull runs in total, over all passes and projects |
21 |
Where the work goes, from autoPullProjects in serverRuntimeStartup.ts:
- Full status before the cheap answer. It calls
statusDetails, which runsgit statusandgit diff-index -M --numstat(among others), and only afterwards returns onbehindCount <= 0. The numstat result is not used by auto-pull at all. - Folders that are not repositories are probed again every pass. Each of my 4 cost 3 Git commands per pass (12 of the 45).
Cost of status plus numstat alone, timed outside T3 with the same subcommands on the same 4 repositories (5 runs each, process CPU time): about 2.2 CPU-seconds per pass, of which 1.8 is the 33,819-file repository. Every command is also a new process on Windows (see #40140 for console hosts).
Proposed change
- In the auto-pull pass, after the fetch, check the cheap conditions first (current branch is the default branch, has an upstream, behind count > 0). Run the working tree check only for a project that is behind, and skip numstat.
- Remember that a project root is not a repository instead of probing it each pass, and re-check cheaply (for example, whether a
.gitentry has appeared).
Pull behaviour stays the same: the pass already returns without pulling when the project is not behind.
Trade-offs:
- The "Skipped automatic project pull" debug log would no longer report
working-tree-changesfor a project with nothing to pull. - It needs a lighter path than the shared
statusDetails, so the default-branch and upstream rules must not drift from it.
Not verified
- Measured on one machine and one install, not reproduced on a fresh isolated server.
- The CPU figure covers status and numstat only, measured with my own invocations rather than the server's environment.
- I have not shown that this churn makes the UI lag. The CPU cost here is modest (under 1% of 16 hardware threads); the point is that most of it is avoidable work that grows with the number and size of projects.
- The automatic fetches themselves are expected behaviour and are not part of this report.
Version and environment
- T3 Code Nightly
0.1.14-nightly.20261129.5425(be0e8a5f1658), desktop app.serverRuntimeStartup.tsis unchanged onmainatd8f480add0d8. - The repeating pass was added in fix(server): Automatically pull keeps unviewed project roots current #43077.
- Windows 11 build 26300, AMD Ryzen 9 6900HX (8 cores / 16 threads), Git for Windows 2.56.1.
Workaround
Turn Automatically pull off.
Activity