Repository navigation
Description
Description
After upgrading to VS Code 1.113.0, opening a workspace that contains git worktrees (under .claude/worktrees/) causes an unbounded number of rg (ripgrep) processes to spawn, consuming all CPU and freezing macOS. Rolling back to 1.112.0 resolves the issue completely.
Environment
- VS Code version: 1.113.0 (cfbea10)
- OS: macOS (Darwin 25.4.0, Apple Silicon arm64)
- Extensions: GitHub Copilot + standard built-in extensions
- Workspace: pnpm monorepo with git worktrees under
.claude/worktrees/(each worktree has its ownnode_modules,dist,lib)
Reproduction
- Have a monorepo with git worktrees under a subdirectory (e.g.,
.claude/worktrees/<branch-name>) - Open the root workspace in VS Code 1.113.0
- Observe via Activity Monitor or
ps aux | grep rgthat dozens ofrgprocesses spawn continuously - System becomes unresponsive (95%+ CPU utilization, near 0% idle)
Root cause investigation
1.113.0 shipped several changes that interact with worktree scanning:
Git extension changes
-
Git - update DotGit file watcher to ignore worktree index.lock files #303504 ("Git: update DotGit file watcher to ignore worktree index.lock files"): Changed the DotGit file watcher regex in
extensions/git/src/repository.tsfrom:!/\/\.git(\/index\.lock)?$|\/\.watchman-cookie-/to:
!/\/\.git(\/index\.lock|\/worktrees\/[^/]+\/index\.lock)?$|\/\.watchman-cookie-/This alters which worktree file events pass through the watcher filter, potentially allowing more events to trigger
git statusrefreshes and downstreamrginvocations. -
Git - optimize worktree ignored-path computation #303955 ("Git: optimize worktree ignored-path computation"): Changed the early-exit condition in
_getWorktreeIncludePaths()from checkinggitIgnoredFilestogitIgnoredPaths. While the output set should be identical, this function determines which directories are fed to ripgrep for worktree scanning.
Copilot Chat: new Search Subagent
- Search subagent -- resolve relative and absolute paths vscode-copilot-chat#4429 ("Search subagent: resolve relative and absolute paths"): Added a search subagent that calls
workspace.findFilesto hydrate code references. - System prompt updates to handle search subagent vscode-copilot-chat#4500 ("System prompt updates to handle search subagent"): Updated prompts to prefer the SearchSubagent tool. Notably, the PR adds guidance to "avoid repeated/parallel SearchSubagent calls," suggesting unbounded calls were already a known concern.
Combined effect
The Git extension's worktree watcher changes may allow more file events to trigger repository scans. Simultaneously, the new Copilot search subagent introduces additional workspace.findFiles calls. In a workspace with git worktrees (each containing node_modules, build output, etc.), this creates a feedback loop of unbounded rg process spawning, consistent with #303190.
Workaround
Rolling back to 1.112.0 resolves the issue. The following settings may mitigate on 1.113.0 (not fully verified):
{
"files.watcherExclude": {
"**/.claude/worktrees/**": true
},
"git.ignoredRepositories": [".claude/worktrees"],
"search.ripgrep.maxThreads": 4
}Related issues
- workspace.findFiles spawns unbounded parallel ripgrep processes with --no-ignore on bulk file changes #303190 (workspace.findFiles spawns unbounded parallel ripgrep processes)
- ripgrep file search uses too many threads #206030 (ripgrep thread count, resolved via
search.ripgrep.maxThreads) - VSCode seems to spawn a lot of ripgrep processes which completely locks up vscode and my computer #164665 (ripgrep processes lock up VS Code and computer)
- High CPU usage with vscode/resources/app/node_modules/@vscode/ripgrep/bin/rg #248666 (high CPU from ripgrep)
Activity
hatpick commentedon Apr 1, 2026
Any progress here? vscode is not usable in the last week, even downgrading to 1.112 is not helping as I originally thought.
vemvcs commentedon Apr 9, 2026
I found the following:
#303190 (comment)
osortega commentedon May 14, 2026
This is probably happenig from extensions triggering
findFilessee #303190 (comment), but vemvcs is right, the fix that went in before that flipped the default to be--no-ignoreseems like a bug in VS Code core.That said, it might be a bit risky to just go ahead and flip that to start respecting what the extension is requesting since it would cause a lot of unexpected behavior change.
To address this I created this PR with the intention of:
When search.experimental.useIgnoreFilesInFindFiles is ON:
Could you please help me verify this in insiders once this lands?
osortega commentedon May 14, 2026
Reopening until we confirm verification and decide on the correct default
vemvcs commentedon May 15, 2026
Thank you!
vemvcs commentedon Jul 15, 2026
Hi Osvaldo Ortega (@osortega) ! Thanks again for #316349 .
The
useIgnoreFilesInFindFilesflag, being experimental, cannot be used in extensions published in official channels.It's been a couple months now - perhaps by now the flag can be made official?
Thanks - V
nickolas52468 commentedon Aug 14, 2026
The infinity loop is causing high usage of RAM on Windows too.