Skip to content

fix(core): ripgrep fails when pattern looks like ripgrep flag#18858

Merged
scidomino merged 2 commits intogoogle-gemini:mainfrom
syvb:sv/fix-fixed-string-fail
Feb 18, 2026
Merged

fix(core): ripgrep fails when pattern looks like ripgrep flag#18858
scidomino merged 2 commits intogoogle-gemini:mainfrom
syvb:sv/fix-fixed-string-fail

Conversation

@syvb
Copy link
Copy Markdown
Contributor

@syvb syvb commented Feb 12, 2026

Summary

Fixes a failing tool call when you ask Gemini to "Do a fixed-string search for --regexp" or similar

Details

The pattern argument was interpreted as a argument by ripgrep, not a pattern. This resulted in the tool call failing.

Related Issues

Closes #18856

How to Validate

Ask Gemini to "Do a fixed-string search for --regexp", and verify that it doesn't fail.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@syvb syvb requested a review from a team as a code owner February 12, 2026 00:15
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @syvb, 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 a critical bug in the ripgrep tool integration where certain search patterns, particularly those starting with --, were incorrectly parsed as command-line flags by ripgrep. The fix ensures robust argument handling, preventing tool failures and improving the reliability of search operations within the system.

Highlights

  • Bug Fix: Resolved an issue where ripgrep failed when a search pattern resembled a command-line flag, such as --regexp.
  • Argument Handling: Modified the ripgrep tool invocation to ensure search patterns are always explicitly passed as arguments to --regexp, preventing misinterpretation as flags.
  • Test Coverage: Enhanced existing tests to specifically verify that ripgrep arguments are correctly ordered and that patterns are not mistakenly associated with flags like --fixed-strings.
Changelog
  • packages/core/src/tools/ripGrep.test.ts
    • Updated test assertions to explicitly check the order and presence of ripgrep arguments, ensuring --fixed-strings is not immediately followed by the search pattern.
    • Added checks for --regexp and the pattern itself in the spawnArgs array.
  • packages/core/src/tools/ripGrep.ts
    • Refactored rgArgs construction to always push --regexp and the search pattern as a distinct pair.
    • Removed the conditional pushing of the pattern directly after --fixed-strings, ensuring proper argument separation.
Activity
  • Author syvb added/updated tests to cover the fix.
  • Author syvb validated the changes on MacOS using npm run.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

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 addresses a bug where the RipGrepTool would fail if a search pattern resembled a command-line flag. The fix, which involves consistently using the --regexp argument to pass the pattern to ripgrep, is correct and effectively prevents the pattern from being misinterpreted. This change also improves the consistency of argument handling within the tool. The test updates are appropriate and verify the fix. The changes are solid and I have no further comments.

@gemini-cli gemini-cli bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Feb 12, 2026
@scidomino scidomino enabled auto-merge February 18, 2026 20:31
@scidomino scidomino added this pull request to the merge queue Feb 18, 2026
Merged via the queue into google-gemini:main with commit 221ea36 Feb 18, 2026
27 checks passed
tripleyoung pushed a commit to tripleyoung/gemini-cli that referenced this pull request Feb 27, 2026
tripleyoung pushed a commit to tripleyoung/gemini-cli that referenced this pull request Feb 27, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fixed-string searches that look like ripgrep arguments fail

2 participants