-
Notifications
You must be signed in to change notification settings - Fork 38.9k
GitHub Copilot file_search glob with \**\ (backslash double-star) produces partial or no results where /**/ succeeds #293430
Description
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
- Use
file_searchwithquery: "alpha/**/Helper.java". - Use
file_searchwithquery: "alpha\**\Helper.java". - Use
file_searchwithquery: "alpha/**/readme.md". - Use
file_searchwithquery: "alpha\**\readme.md".
Expected
Steps 1–4 all find the respective files.
Actual
- Step 1 (
/**/): ✅ FindsHelper.java. - Step 2 (
\**\): ❌ No results, or partial results depending on root. - Step 3 (
/**/): ✅ Findsreadme.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 |
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
- GitHub Copilot
grep_searchincludePatternsilently fails with workspace root folder name prefix in multi-root workspaces (severe) #293428 —grep_searchincludePatternsilently fails with workspace root folder name prefix in multi-root workspaces (principal issue). - Malformed absolute paths in
read_fileandlist_dirtrigger "Allow reading external files?" prompt, then fail on GitHub Copilot #293204 — Malformed absolute paths trigger "Allow reading external files?" prompt, then fail. Affectsread_fileandlist_dir.