Skip to content

grep_search tool returns no results on Windows due to backslash path separator in ripgrep output #13027

Description

@SpikedCola

Before submitting your bug report

Relevant environment info

- OS: Windows 7
- Continue version: v2.0.0
- IDE version: VSCodium 1.116.02821
- Model: Unsloth Studio Local

Description

The grep_search agent tool always returns "The search returned no results" on Windows, even when ripgrep finds matches. If I use Process Monitor to catch rg.exe being run, and run it manually, I get search results. If I search the same string in VSCode I also get search results.

The bug is in core/util/grepSearch.ts in formatGrepSearchResults. The parser checks for file header lines using:

if (line.startsWith("./") || line === "--") {

On Windows, ripgrep outputs paths with backslashes (.\templates\foo\bar.tpl) instead of forward slashes (./templates/foo/bar.tpl). The startsWith("./") check never matches, so numResults stays 0 and all results are silently discarded despite the content being present.

I added || line.startsWith(".\\") to this check, and now I get the search results I expect.

To reproduce

  1. Ask the agent to search for a string that exists in the codebase using the grep_search tool
  2. Observe "The search returned no results" even though the string is present

Log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions