github / github/copilot-cli

Path-specific custom instructions bloat context window on initial copilot session.

Đang mở
#1,423 1 bình luận 6 reaction 0 người được giao Xem trên GitHub
area:configuration area:context-memory area:sessions
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

According to the [documentation ](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions#creating-path-specific-custom-instructions-2), creating path specific GitHub instruction files should only "apply to requests made in the context of files that match a specified path." However, every single path-specific instruction file is loaded into the system prompt, even those whose `applyTo` pattern does not match any file the user is currently working on.

This causes significant context window bloat when a repository has many instruction files scoped to different subdirectories.

### Affected version

0.0.408

### Steps to reproduce the behavior

1. Create a multi-project repository with several subdirectories (e.g., `ProjectA/`, `ProjectB/`,
`ProjectC/`, `SharedLib/`).

2. Start copilot, run /context and note the size.

3. Create the `.github/instructions/` directory.

4. Create multiple path-specific instruction files, each with a different `applyTo` pattern:
`.github/instructions/projecta.instructions.md`:

applyTo: "ProjectA/**

5. Between the creation of each successive instruction file, exit and restart Copilot and examine the context window. You will see that with each successive file, the context window grows. You can also confirm that it's just not reading the front matter by putting in an extremely large instructions file.

### Expected behavior

I would expect the initial context window not to include all of the path-specific instruction files.

### Additional context

_No response_

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

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

Đánh giá

Issue này chưa được đánh giá.

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.