github / github/copilot-cli

`glob` tool false-negatives on any multi-segment pattern unless prefixed with `**/`

Đang mở
#4,271 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:tools
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

## Describe the bug

The built-in `glob` tool returns "No files matched the pattern." for **any
pattern containing a path separator**, unless the pattern is prefixed with
`**/`. Literal relative paths (`2026/07/26.md`) and wildcarded multi-segment
patterns (`2026/07/*.md`) both fail even though the files exist directly under
the given `paths` root. Single-segment patterns (`inbox.md`, `*.md`) and
`**/`-prefixed patterns work.

This is worse than an inconvenience: the agent trusts the empty result. In one
session the agent checked for a file with its exact relative path, got no
match, and confidently declared the file missing — then acted on that false
premise.

## Affected version

1.0.70-0 (running as the VS Code Agent Sessions CLI backend; macOS arm64)

## Steps to reproduce the behavior

Against a repo containing `2026/07/26.md` and `inbox.md` at the root:

1. `glob` with `pattern: "2026/07/26.md"`, `paths: [""]` →
`No files matched the pattern.` (file exists)
2. `glob` with `pattern: "2026/07/*.md"`, same paths →
`No files matched the pattern.` (31 files exist there)
3. `glob` with `pattern: "**/07/26.md"`, same paths →
`/2026/07/26.md` ✔
4. `glob` with `pattern: "inbox.md"`, same paths →
`/inbox.md` ✔

So the failure is specifically: multi-segment pattern **not** prefixed with
`**/`. It looks like the matcher compares patterns against basenames (or a
single path segment) unless a globstar forces full-path matching.

## Expected behavior

A relative pattern is resolved against the given `paths` roots, per standard
glob semantics: `2026/07/26.md` matches `/2026/07/26.md`. At minimum,
the tool description should say patterns must be `**/`-prefixed to traverse
directories — but fixing the matching is much better than documenting the
trap, since empty results are treated as evidence of absence.

## Additional context

- OS: macOS 26.5.2, arm64
- Observed both from VS Code Agent Sessions and reproduced deterministically
(4 calls above, same session, seconds apart)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách xác định công cụ glob tích hợp và phần triển khai so khớp đường dẫn của nó, sau đó tái hiện bốn mẫu trong issue trên một repository chứa các tệp được liệt kê. Theo dõi cách các mẫu tương đối được so sánh với các root của đường dẫn. Công việc được xem là hoàn tất khi các mẫu tương đối nhiều phân đoạn khớp với các tệp hiện có, trong khi các trường hợp một phân đoạn và **/ hiện tại vẫn tiếp tục hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
shell
Lĩnh vực
cli, tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.