microsoft / microsoft/vscode

Copilot agent regex search returns zero results for files outside workspace root

Open
#325,381 0 comments 0 reactions 1 assignee Claimed by @roblourens View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

### Type

Bug

### Description

I noticed 5.6-sol doing a little bit of thrashing when instructed to work on
files in a sibling directory to the workspace root.

The underlying issue appears to be the regex search tool used by the chat
agent. An identical regex search returns two results for a file inside the
workspace but zero results for a byte-equivalent file in a sibling directory.
This can lead the agent to retry or change approaches even though the target
file exists and the user has directed it to that path.

Reproduction repository:
https://github.com/TheNotary/vscode-regex-outside-root-repro

### Steps to reproduce

1. Clone the reproduction repository.
2. Run `.\setup.ps1` to create the byte-equivalent sibling fixture.
3. Open only the reproduction repository as the VS Code workspace.
4. Ensure the sibling fixture is closed and its directory is not part of the
workspace.
5. In chat agent mode, instruct the agent to use its regex search tool for
`issue-\d{4}` in `fixtures\inside.txt`.
6. Repeat the same regex search against the absolute path to the sibling
`outside.txt`.

### Expected

The regex tool returns two matches for both files.

### Actual

The regex tool returns two matches for the in-workspace file and zero matches
for the closed sibling file. Opening the sibling file in an editor buffer masks
the bug and makes the same tool return two matches.

### Environment

- VS Code: 1.128.0
- OS: Windows
- Agent model: 5.6-sol

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.