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 摘要。