What happened?
The GrepTool has three search strategies that cascade on failure: git grep, system grep, and a JavaScript fallback. Two of these perform case-insensitive matching, but the system grep strategy does not:
| Strategy |
Flag |
Case-insensitive |
| git grep |
--ignore-case (line 418) |
Yes |
| system grep |
(none) |
No |
| JS fallback |
RegExp(pattern, 'i') (line 553) |
Yes |
This means search results depend on which strategy runs at runtime. On a non-git repo where system grep is available, a search for "TODO" won't match "todo" or "Todo" — but the same search in a git repo (git grep) or on Windows (JS fallback) will match all casings.
The system grep args at packages/core/src/tools/grep.ts line 467:
const grepArgs = ['-r', '-n', '-H', '-E', '-I']; // missing -i
The exclude_pattern regex on line 404 already uses the 'i' flag, which further confirms case-insensitive was the intended behavior.
What did you expect to happen?
All three strategies should produce consistent case-insensitive results. The system grep strategy should include -i in its argument list, matching the behavior of git grep (--ignore-case) and the JS fallback (RegExp(pattern, 'i')).
Client information
Identified via code review on main branch. Not a runtime reproduction, the inconsistency is visible in the source at packages/core/src/tools/grep.ts line 467 vs line 418 and line 553.
Login information
N/A — code-level bug, not auth-related.
Anything else we need to know?
The ripGrep.ts alternative implementation already uses --ignore-case at line 432, so this inconsistency is specific to the grep.ts system grep path. Submitting a PR shortly.
What happened?
The
GrepToolhas three search strategies that cascade on failure: git grep, system grep, and a JavaScript fallback. Two of these perform case-insensitive matching, but the system grep strategy does not:--ignore-case(line 418)RegExp(pattern, 'i')(line 553)This means search results depend on which strategy runs at runtime. On a non-git repo where system
grepis available, a search for"TODO"won't match"todo"or"Todo"— but the same search in a git repo (git grep) or on Windows (JS fallback) will match all casings.The system grep args at
packages/core/src/tools/grep.tsline 467:The
exclude_patternregex on line 404 already uses the'i'flag, which further confirms case-insensitive was the intended behavior.What did you expect to happen?
All three strategies should produce consistent case-insensitive results. The system grep strategy should include
-iin its argument list, matching the behavior of git grep (--ignore-case) and the JS fallback (RegExp(pattern, 'i')).Client information
Identified via code review on main branch. Not a runtime reproduction, the inconsistency is visible in the source at
packages/core/src/tools/grep.tsline 467 vs line 418 and line 553.Login information
N/A — code-level bug, not auth-related.
Anything else we need to know?
The
ripGrep.tsalternative implementation already uses--ignore-caseat line 432, so this inconsistency is specific to thegrep.tssystem grep path. Submitting a PR shortly.