github / github/copilot-cli

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

未關閉
#1,423 1 則留言 6 個 reaction 已指派 0 人 在 GitHub 檢視
area:configuration area:context-memory area:sessions
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### 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_

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。