microsoft / microsoft/vscode

Chat customization discovery fires batches of ~30 concurrent full-workspace rg enumerations with --no-ignore --follow, cancelled and re-fired in a loop (1.131.0)

Open
#328,122 5 comments 0 reactions 1 assignee Claimed by @aeschli View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

## Summary

On VS Code 1.131.0 (Windows), opening a large npm-workspaces monorepo and using Copilot Chat (agent/edit sessions) intermittently triggers "storms" of dozens of identical `rg.exe` processes that can make the machine unusable for minutes. Each process runs a **full workspace enumeration** with ignore files disabled and symlink-following enabled:

```
rg.exe --files --hidden --case-sensitive --no-require-git -g '**/*' -g '!**/.git' -g '!**/.svn' -g '!**/.hg' -g '!**/.DS_Store' -g '!**/Thumbs.db' --no-ignore --follow --no-config --no-ignore-global
- cwd: c:\repos\Clone3\Indra
```

This looks like the same pathology as #304676 (closed, milestone 1.116) and #311736, but it is still occurring on 1.131.0 — with additional detail below on the spawn-loop behavior that those issues did not capture.

## Evidence

**1. Spawn storm structure (ext host log, debug/trace level).** Batches of ~28–30 identical enumerations run concurrently. From the `Search finished` stats, each search's `cmdTime` was **95,000–97,000 ms** (they start together and thrash each other), and each was cancelled after collecting only ~5,100–6,100 results (`cmdResultCount` varies per scan despite identical commands → mid-flight cancellation). Immediately after a batch completes/cancels, a **new batch of identical spawns begins** (~200 ms later). Net effect: cancel-and-refire loop, sustained load. Representative log excerpt:

```
2026-07-29 14:46:16.959 [debug] ExtHostSearch Search finished. Stats: {"cmdTime":96014,"fileWalkTime":96014,"directoriesWalked":0,"filesWalked":0,"cmdResultCount":5351}
2026-07-29 14:46:17.004 [debug] ExtHostSearch Search finished. Stats: {"cmdTime":95681,"fileWalkTime":95681,"directoriesWalked":0,"filesWalked":0,"cmdResultCount":5571}
2026-07-29 14:46:17.038 [debug] ExtHostSearch Search finished. Stats: {"cmdTime":95383,"fileWalkTime":95383,"directoriesWalked":0,"filesWalked":0,"cmdResultCount":5671}
(... ~25 more identical "Search finished" lines with cmdTime 94.8s–97.4s, cmdResultCount 5082–6131 ...)
2026-07-29 14:46:18.414 [debug] ExtHostSearch ...\@vscode\ripgrep-universal\bin\win32-x64\rg.exe --files --hidden --case-sensitive --no-require-git -g '**/*' -g '!**/.git' -g '!**/.svn' -g '!**/.hg' -g '!**/.DS_Store' -g '!**/Thumbs.db' --no-ignore --follow --no-config --no-ignore-global
- cwd: c:\repos\Clone3\Indra
2026-07-29 14:46:18.433 [debug] ExtHostSearch (identical spawn)
2026-07-29 14:46:18.448 [debug] ExtHostSearch (identical spawn)
(... new batch continues at 15–200 ms intervals ...)
```

**2. Not an extension-API caller.** Trace logging was active during the storm (other `[trace]` lines interleave with the spawns), but there are **zero `extHostWorkspace#findFiles` trace lines** — so no extension called `findFiles`/`findFiles2`. The queries originate renderer-side and execute via `ExtHostSearch`. Consistent with this, no separate Copilot extensions are installed (see Environment) — chat is built-in on this build.

**3. Sole core caller.** The only call site of `ISearchService.fileSearch` in `src/vs/workbench/contrib` is `chat/common/promptSyntax/utils/promptFilesLocator.ts` — i.e., chat customization-file discovery (prompts / instructions / agents / skills / modes / AGENTS.md).

**4. Flag mismatch vs. current source.** Current `main` computes `disregardIgnoreFiles` from `explorer.excludeGitIgnore` (false here → no `--no-ignore` expected) and never sets `disregardGlobalIgnoreFiles` (→ no `--no-ignore-global` expected). The observed command line contains **both** flags, on stock settings (verified: `search.useIgnoreFiles` = true, `search.useGlobalIgnoreFiles` = false, `search.followSymlinks` = true, `search.exclude` at defaults incl. `**/node_modules` — yet the command has `--no-ignore` and lacks any node_modules exclusion glob; the excludes present match `files.exclude` defaults only). Something between the locator and `getRgArgs` is producing the pathological flags, or the release branch differs from main here.

**5. Why it is catastrophic on this workspace shape.** npm-workspaces monorepo: root `node_modules` contains **129,275 files** plus ~15 NTFS junctions pointing back into the repo's own package folders (`node_modules\@scope\pkg` → `packages\pkg`). With `--no-ignore`, all 129K files are enumerated per scan; with `--follow`, the junctions cause the source tree to be walked a second time. Multiply by ~30 concurrent processes per batch, re-fired in a loop.

**6. Trigger correlation.** Storms coincide with Copilot chat editing sessions — the log shows active `chat-editing-text-model` / `vscode-chat-session` activity immediately before the batch, and storms are frequently accompanied by the "Analyzing '' and its dependencies" notification from TypeScript and JavaScript Language Features. Frequency: intermittent, ~1–2×/hour during active chat use; no deterministic repro found, but the attached logs capture complete storms.

(Screenshots attached below: Task Manager showing ~50 identical rg.exe processes; full command line captured via `Get-CimInstance Win32_Process`.)

## Expected behavior

- Customization-file discovery should respect ignore files (per the #304676 fix) — a scan for a handful of well-known file patterns should not enumerate `node_modules`.
- Discovery scans should not follow symlinks/junctions (or should de-duplicate), given monorepo workspace-linking layouts (pnpm symlinks per #304676; npm-workspaces NTFS junctions here).
- Discovery should be batched/cached/debounced: one logical refresh should not spawn ~30 concurrent identical full enumerations, and cancelled scans should not immediately re-fire.
- Filename-pattern queries should push the pattern down to ripgrep rather than enumerating `**/*` and filtering in-process.

## Environment

- VS Code: 1.131.0 (system setup)
- Commit: e4c7e7b1d6d060162f4aa7f8225271b67ce1df75 (2026-07-28T10:51:25Z)
- OS: Windows_NT x64 10.0.26200
- Electron: 42.7.0, Node.js: 24.18.0, Chromium: 148.0.7778.280
- Ripgrep binary: `resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe`
- Copilot extensions: **none installed** — `code --list-extensions --show-versions | findstr /i copilot` returns only `ms-azuretools.vscode-azure-github-copilot@1.0.209`; no `GitHub.copilot` / `GitHub.copilot-chat` (chat is built-in on this build)

## Workspace

- npm workspaces monorepo, root `node_modules`: 129,275 files; ~15 junctions from `node_modules` back into `frontend/`, `backend/`, `packages/*`, `apps/*`, `tools/*`
- Single-root workspace, local NTFS volume
- Actively uses `.github/instructions`, skills, and related chat customization files, so disabling discovery is not a viable workaround

## Settings state (relevant; all verified in Settings UI)

- `search.useIgnoreFiles`: true (default)
- `search.useGlobalIgnoreFiles`: false (default)
- `search.followSymlinks`: true (default)
- `search.exclude`: defaults (includes `**/node_modules`)
- `explorer.excludeGitIgnore`: false (default)

## Related

- #304676 (closed, 1.116) — same flags, pnpm symlink variant; this report indicates the symptom persists on 1.131 with npm-workspaces junctions
- #311736 (closed) — same discovery component
- #283624 (duplicate of #304676)


Image

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.