Skip to content

GitHub Copilot file_search glob with \**\ (backslash double-star) produces partial or no results where /**/ succeeds #293430

@garretwilson

Description

@garretwilson

Summary

In GitHub Copilot's file_search tool, using backslashes around the ** glob segment (root\**\file.ext) produces fewer results or no results compared to the forward-slash equivalent (root/**/file.ext). Non-glob path segments handle both slash directions interchangeably, so the inconsistency is specific to the ** glob operator.

This is the second of three related bugs in Copilot's search tools affecting multi-root workspaces on Windows. The principal issue is tracked in #293428.

Environment

  • OS: Windows 11
  • VS Code: 1.109
  • Workspace: Multi-root (3 roots)

Reproduction

Setup

Create a multi-root workspace with one root:

C:\projects\alpha\       ← workspace root "alpha"
    readme.md
    src/
        util/
            Helper.java

Steps

  1. Use file_search with query: "alpha/**/Helper.java".
  2. Use file_search with query: "alpha\**\Helper.java".
  3. Use file_search with query: "alpha/**/readme.md".
  4. Use file_search with query: "alpha\**\readme.md".

Expected

Steps 1–4 all find the respective files.

Actual

  • Step 1 (/**/): ✅ Finds Helper.java.
  • Step 2 (\**\): ❌ No results, or partial results depending on root.
  • Step 3 (/**/): ✅ Finds readme.md.
  • Step 4 (\**\): ⚠️ May return fewer results. In testing, \**\ appears to require at least one path segment between the prefix and the filename, missing files where ** should match zero segments.

The Discrepancy

Pattern / separators \ separators
alpha/**/file.ext (root-prefixed glob) ✅ All results ❌ or ⚠️ Partial/no results
alpha/src/file.ext (root-prefixed explicit)
**/file.ext (recursive glob)
alpha/src/*.ext (single-star glob)

The issue is isolated to ** when surrounded by backslashes. Single-star globs (*), explicit paths, and non-glob backslash segments all work correctly with either separator. The ** glob with forward slashes also works correctly. Only the combination of ** with \ is affected.

Observed Variation Across Roots

In a multi-root workspace with three roots, the \**\ pattern was tested with each root name as prefix:

Pattern /**/ \**\
Root A (name appears as internal directory in its own tree) ✅ (partial — fewer results)
Root B (name does not appear as internal directory) ❌ No results
Root C (name does not appear as internal directory) ❌ No results

Root A's partial success with \**\ may be due to the same coincidental-directory-name matching described in #293428. The /**/ form works consistently for all roots.

Impact on LLMs

On Windows, LLMs sometimes produce backslash-separated paths. When combined with ** glob patterns, this causes file_search to silently return fewer or no results. Since non-glob backslash paths work fine, the failure appears intermittent from the LLM's perspective — backslash paths work in some calls but not others, depending solely on whether ** is present.

Root Cause Hypothesis

The glob engine used by file_search likely normalizes / and \ for literal path segments but does not normalize the separators adjacent to **. The ** operator may be recognized only when delimited by / (i.e., /**/), causing \**\ to be interpreted as a literal segment match or a malformed glob rather than a recursive wildcard.

Recommendation

The file_search glob engine should normalize \**\ to /**/ before evaluation, or treat ** as a recursive wildcard regardless of surrounding separator characters.

Related Issues

Metadata

Metadata

Assignees

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