Multi-root workspace: agent branch tracker and per-file git-root lookups spawn ~500 git processes/minute

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

In a multi-root workspace (a .code-workspace with 29 git repositories as folders), each active Agent
workbench makes its extension host spawn git at a sustained ~500 processes per minute while agents are
working. The Git output log for one 8-hour session (4-6 concurrent agents, 16 workbenches) recorded 32,715
git commands.

Only 573 of those were the stock VS Code git status refresh. The rest are Cursor-specific callers that fan
out across EVERY workspace root: GitProvider.getAllBranchNames (3,211 calls, 27,258 s of git process time;
bursts of 56 = 2 commands x 28 repos every 3-13 s per active workbench), findGitRoot (4,572 calls, 48,415 s;
one rev-parse --show-toplevel per file the agent touches, plus ~8,300 unlabeled rev-parse calls),
getGitRemoteUrl / getGitRepoPathForWorkspacePath / pushGitWorkspaceCaches (~3,200 calls, ~33,000 s). Under
this load git rev-parse --show-toplevel averaged 10.6 s per call vs ~10 ms on an idle machine, and
50-200 git processes were alive at any instant.

This is not a network problem, although it presents as one: extension hosts log 40-200 “became UNRESPONSIVE”
events per 5 minutes, Settings > Network reports “Streaming responses are being buffered by a proxy” /
“Bidirectional streaming is not supported by the http2 proxy”, and agents stall into “Continue Working” —
while an external Node process running the identical SSE and HTTP/2 health checks passes at the same moment.
On a managed corporate laptop (endpoint security agent inspecting process creation and image loads, as is
standard in enterprises) process start is expensive, so this spawn rate saturates the CPU.

Steps to Reproduce

  1. Create a .code-workspace with 20+ folders, each a separate git repository (any repos; sizes don’t
    matter much — the cost scales with the number of roots).
  2. Open it and start 3-4 agents in Agents View doing ordinary file-editing work.
  3. View > Output, select the “Git” channel for any of the workbenches.
  4. Observe bursts of > git branch --format=... (GitProvider.getAllBranchNames) and
    > git branch --all --format=... (GitProvider.getAllBranchNames) — two per root, all completing within
    the same second — recurring every few seconds while the agent is active.
  5. Observe > git rev-parse --show-toplevel [...ms] (findGitRoot) in bursts proportional to files touched.
  6. Count lines per minute across workbenches (> git lines with timestamps): ~500/min with 4-5 agents.
  7. Optional: on a machine with endpoint security installed, watch Task Manager — CPU pins, kernel time
    dominates, and Cursor’s own Settings > Network diagnostics start failing with proxy messages even
    though nothing on the network changed.

Expected Behavior

  • Branch lists change only when refs change. Invalidate the branch-name cache on HEAD/ref changes, not on
    every git status, and fetch for the repository the agent is working in (or the picker is open for),
    not all roots on every invalidation.
  • Memoize findGitRoot by directory, or resolve it from the known workspace-root → repository mapping,
    instead of spawning git once per file path.
  • Cache remote URL / repository path per root for the session; re-resolve only on workspace-folder or
    .git/config change.
  • Cap concurrent git spawns per extension host. 56 simultaneous git branch --all processes is strictly
    worse than 4 at a time.
  • Settings > Network should not attribute late-arriving stream chunks to a proxy when the local extension
    host is starved; a hint like “extension host unresponsive during test” would have saved days.

Operating System

Windows 10/11

Version Information

Version: 3.20.21
VSCode Version: 1.128.0
Commit: f09fca384ceca23f7bf21f9c23655b162641d740
Date: 2026-09-13T19:02:51.781Z
Electron: 42.10.0
Chromium: 148.0.7778.280
Node.js: 24.18.1
V8: 14.8.178.38-electron.0
OS: Windows_NT x64 10.0.26200

For AI issues: which model did you use?

N/A – not model-related (extension-host / git integration behavior, independent of model)

For AI issues: add Request ID with privacy disabled

N/A – not tied to a single request. Account is on an enterprise plan with Privacy Mode enabled (no training).

Additional Information

Environment: git 2.53.0.windows.1; git.autorefresh: false and files.watcherExclude set — no effect on
the callers below (they are not the stock refresh path). Reducing the workspace to 8 roots cuts the
per-root callers proportionally, but findGitRoot (per file) is unchanged.

Branch-tracker burst from one workbench’s Git output channel — branch and branch --all for every root,
all completing in the same second, each taking 2-4 s because ~56 run at once:

2026-09-11 13:56:34.837 [info] > git branch --all --format=%(refname:short) --sort=-committerdate [3769ms] (GitProvider.getAllBranchNames)
2026-09-11 13:56:34.838 [info] > git branch --format=%(refname:short) --sort=-committerdate [3713ms] (GitProvider.getAllBranchNames)
2026-09-11 13:56:34.839 [info] > git branch --format=%(refname:short) --sort=-committerdate [3826ms] (GitProvider.getAllBranchNames)
2026-09-11 13:56:34.839 [info] > git branch --all --format=%(refname:short) --sort=-committerdate [3622ms] (GitProvider.getAllBranchNames)
... (52 more identical lines within the same second)

Seconds between successive bursts in that workbench: 11 4 8 8 13 3 11 7 8 9 6 7 8 19 7 7 7 5 5 8 10 8 22 7 6 5 4

Per-file root lookups — 28 completing in the same second, 10-13 s each:

2026-09-11 13:58:50.168 [info] > git rev-parse --show-toplevel [11786ms] (findGitRoot)
2026-09-11 13:58:50.315 [info] > git rev-parse --show-toplevel [12910ms] (findGitRoot)
2026-09-11 13:58:50.336 [info] > git rev-parse --show-toplevel [11588ms] (findGitRoot)
2026-09-11 13:58:51.922 [info] > git rev-parse --show-toplevel [10465ms] (findGitRoot)
2026-09-11 13:58:51.922 [info] > git rev-parse --show-toplevel [10606ms] (findGitRoot)

Per-minute totals across all workbenches in one 5-minute window: 499, 573, 530, 461, 565 commands;
3,000-11,800 git-process-seconds per minute.

Where it comes from, from reading workbench.desktop.main.js in 3.20.21:

  • localAgentBranchOptionsTracker / localAgentBranchNames.js tracks every SCM repository in the workspace
    (_refreshTrackedRepoPaths), fetches getAllBranchNames twice per repo (includeRemotes false/true), and has
    a 300 s cache (Veo = 300*1e3) that is invalidated on every onDidRunGitStatus and onDidGitHeadChange. With
    agents writing files, git status runs continuously, so the cache is never warm; _refreshTrackedRepoPaths
    also re-fetches on every onDidUpdateRepository.
  • findGitRoot (gitignore provider / retrieval) issues a fresh rev-parse --show-toplevel per file path with
    no visible memoization, although the answer is constant for every file under a workspace root.
  • None of this is user-configurable; no cursor.* setting affects these callers.

Happy to share the full Git.*.log files with support privately (they contain on-disk paths).

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey @Kevin_Pohlmeier, thanks for the report and the numbers.

We were able to reproduce this with a 29-repository workspace: opening it, and each new agent, fans out git calls across every repository in the workspace, exactly as your logs show.

One thing we could not reproduce is the bursts repeating every few seconds while agents are already running. For us they only happened when a new agent or new chat was created. If you can send the Git output logs from one workbench (you can DM them to me), a rough note of what you were doing when the bursts started would help a lot: starting new agents, subagents, or switching back to older agents.

Thanks Colin. You’re right that I described the timing wrong. Here’s a cleaner capture from this afternoon (Cursor 3.20.x, Windows 11, Agents View, a 29-repo .code-workspace).

I have two Git output logs ready but the forum won’t let me start a message yet. Can you message me and I’ll attach them there?

The repeat isn’t every few seconds inside one workbench. A new workbench for the same workspace keeps getting created about every 5 minutes, and each new one runs the full fan-out again. The first Git log line for each new workbench on that workspace: 14:25:48, 14:30:45, 14:35:48, 14:40:48, 14:45:47, 14:50:48, … 16:01:19, 16:06:07, 16:09:33, 16:21:46, 16:28:28, 16:32:39, 16:36:54, 16:43:16, 16:48:17, 16:57:58, 17:00:57. Each workbench’s Git log only covers 2–3 minutes (wb428: 16:01:19–16:03:25; wb438: 16:36:54–16:39:52), so it looks like the workbench is torn down and rebuilt. This Cursor session is on window1_wb447 since it started yesterday at 12:55.

I wasn’t starting a new agent every 5 minutes. The agents were already running and doing ordinary file edits, no subagents, and I wasn’t switching agents on that schedule.

Effect from 16:00–17:00 across all workbenches: about 6,800 git commands and 65,000 git-process-seconds. findGitRoot was 2,121 calls averaging 10.5 s each, and GitProvider.getAllBranchNames was 332 calls averaging 32 s each. There were 215 “Extension host became UNRESPONSIVE” events in the same hour. For comparison, an 8-repo workspace open at the same time spiked once when it opened (197 commands in one minute) and then held around 20/min, and a single-folder workspace stayed near zero.

So I think the fan-out you reproduced is the whole mechanism. What keeps triggering it is the workbench being recreated every ~5 minutes. Is that expected in Agents View?