[BUG] Grep/search tool runs ugrep with search path / instead of project dir — pegs CPU crawling entire filesystem (incl. /mnt/c on WSL2)

Open 💬 0 comments Opened Jul 15, 2026 by sippykup2

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Version: Claude Code 2.1.210
Platform: WSL2 (Linux 6.6.87.2-microsoft-standard-WSL2), Ubuntu, bash, 24-core

Summary: The bundled search tool invoked ugrep with the positional search path set to / (filesystem root) rather than the project directory / provided path. The process's own cwd was the project, but the search target was root.

Exact command observed:
ugrep -G --ignore-files --hidden -I \
--exclude-dir=.git --exclude-dir=.svn --exclude-dir=.hg \
--exclude-dir=.bzr --exclude-dir=.jj --exclude-dir=.sl \
-rniE '<REDACTED>' /

Impact:

  • ~1252% CPU (≈12.5 cores), load average pinned at 12.0 on a 24-core box.
  • Ran 8h35m before being noticed. On WSL2 it recursed into /mnt/c (Windows drive over the 9p mount — enormous and slow), which massively compounds cost. No --exclude-dir for /mnt, /proc, /sys, so nothing bounded it.

Secondary bug (cleanup): the search orphaned. Its parent Claude Code session had already exited, but the ugrep child kept running, reparented to /init (the WSL reaper) — so it survived session teardown and ran unwatched. Child search processes should be killed on session/tool exit.

What Should Happen?

Expected behavior:

  1. Search path must resolve to the provided path (default: cwd / project root) — an empty/undefined/mis-resolved path must never fall back to /.
  2. Search subprocesses should be terminated on session exit (process-group cleanup) so they can't orphan.
  3. Safety rail: exclude pseudo-filesystems and foreign mounts (/proc, /sys, /mnt, network mounts) and/or bound depth/time — a root-scoped full-filesystem crawl should be impossible from the tool, and is especially catastrophic on WSL2.

Error Messages/Logs

Steps to Reproduce

Repro: unclear what user action triggered the root-scoped path (the pattern was a project consent-scope search); the reproducer is "a Grep call whose path resolved to /." Worth adding a guard + a regression test that the tool refuses/normalizes a / search root.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.210

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

_No response_

View original on GitHub ↗