AGENTS.md discovery still runs `rg --no-ignore --follow` over the whole tree (regression sibling of #304676)

Open
#323,094 1 comment 0 reactions 1 assignee View on GitHub

@aeschli is already working on this.

Since Jun 26, 2026.

Assessment

This issue has not been assessed yet.

Description

Environment

| Component | Value |
| VS Code | 1.126.0 |
| OS | macOS (Darwin arm64, Apple Silicon) |
| Workspace | pnpm monorepo, large node_modules with 200+ top-level symlinks + .pnpm store |
| Related (fixed) issue | #304676 (shipped 1.116.0) |

Summary

#304676 fixed the .github/agents/*.md scan (scoped it to the .github/agents/ folder, shipped in 1.116). But the AGENTS.md instruction-file discovery is a separate scan that still uses the same --no-ignore --follow flags and still walks the entire workspace, including all of node_modules. On a large pnpm monorepo this pins CPU (490-871%), respawns every few seconds, and heats the machine while VS Code is idle.

The command being run

.../@vscode/ripgrep-universal/bin/darwin-arm64/rg --files --hidden --case-sensitive --no-require-git -g /AGENTS.md -g !/.git -g !/.svn -g !/.hg -g !/.DS_Store -g !/Thumbs.db --no-ignore --follow --no-config --no-ignore-global
Note the glob is **/AGENTS.md, not /.github/agents/*.md - this is the instruction-file path, not the agent-definitions path that #304676 patched.
Parent process is Code Helper (Plugin) (the extension host).

Workspace

pnpm monorepo, large node_modules with 200+ top-level symlinks + a .pnpm store.
Same --follow + pnpm symlink-forest pathology described in #304676 (file system loop errors, repeated traversal).

Expected

Apply the same fix #304676 used: scope the AGENTS.md lookup, drop --follow, and/or
respect .gitignore so node_modules is skipped. Debounce instead of respawning.

Actual

**/AGENTS.md scan runs with --no-ignore --follow across the full tree, repeatedly.

Workaround
"chat.useAgentsMdFile": false,
"chat.useNestedAgentsMdFiles": false,
"search.followSymlinks": false
Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.