Skip to content

fix(core): add case-insensitive flag to system grep strategy#24956

Open
Anjaligarhwal wants to merge 1 commit intogoogle-gemini:mainfrom
Anjaligarhwal:fix/core/grep-case-sensitivity-inconsistency
Open

fix(core): add case-insensitive flag to system grep strategy#24956
Anjaligarhwal wants to merge 1 commit intogoogle-gemini:mainfrom
Anjaligarhwal:fix/core/grep-case-sensitivity-inconsistency

Conversation

@Anjaligarhwal
Copy link
Copy Markdown
Contributor

Fixes #24955

What

The GrepTool uses three cascading search strategies. The git grep strategy uses --ignore-case and the JS fallback uses RegExp(pattern, 'i'), but the system grep strategy was missing the -i flag — making it case-sensitive on non-git repos where system grep is available.

Fix

Add -i to the system grep args array at line 467, consistent with the other two strategies and with the ripGrep.ts implementation (which already uses --ignore-case).

Tests

  • All 32 grep.test.ts tests pass
  • Lint and prettier pass via pre-commit hooks
  • TypeScript has zero errors on this file

The grep tool has three search strategies that fall through on failure:
git grep (--ignore-case), system grep, and JS fallback (RegExp 'i' flag).

The system grep strategy was missing the -i flag, making it
case-sensitive while the other two strategies are case-insensitive.
This causes inconsistent search results depending on which strategy
executes — specifically on non-git repositories where system grep is
available but git grep is not.

Add -i to the system grep args for consistent behavior across all
three strategies.
@Anjaligarhwal Anjaligarhwal requested a review from a team as a code owner April 8, 2026 20:03
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an inconsistency in the GrepTool's search strategies by enabling case-insensitive matching for the system grep implementation. This ensures that search behavior remains predictable and uniform across different environments, regardless of whether a git repository is present.

Highlights

  • System Grep Strategy: Added the -i flag to the system grep command arguments to ensure case-insensitive searches.
  • Consistency: Aligned the system grep strategy behavior with the existing git grep and JS fallback strategies.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-cli gemini-cli bot added the area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality label Apr 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

🛑 Action Required: Evaluation Approval

Steering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged.

Maintainers:

  1. Go to the Workflow Run Summary.
  2. Click the yellow 'Review deployments' button.
  3. Select the 'eval-gate' environment and click 'Approve'.

Once approved, the evaluation results will be posted here automatically.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the grep command arguments in packages/core/src/tools/grep.ts to include the -i flag, enabling case-insensitive searching. I have no further feedback to provide as there are no review comments to address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System grep strategy is case-sensitive while git grep and JS fallback are not

1 participant