System prompt still instructs the model to use grep, glob, view and lsp after --available-tools has removed them
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Version
1.0.80 — self-reported by the CLI inside the system prompt it sends (<version_information>Version number: 1.0.80</version_information>), so the version and the defect come from the same captured request.
What happens
When --available-tools narrows the tool set (in my case to a single MCP server's tools), the tool declaration is correctly narrowed — the request carries exactly the allowed tools and nothing else. But the system prompt is not narrowed with it. Three sections continue to instruct the model to use tools that are no longer available:
<tool_preferences>— "Use the grep tool instead of commands likegrep/rgin bash · Use the glob tool instead of commands likefind/ls· Use the view tool instead of commands likecat/head/tail"<code_search_tools>— "Prefer calling in the following order: Code Intelligence Tools (if available) > lsp (if available) > glob > grep with glob pattern"<exploration_and_reading_files>— instructions on batchingviewcalls
The model follows them, the calls are rejected at the tool boundary (Tool 'view' does not exist. Available tools that can be called are …), and the turn is spent.
Note this is not uniform behaviour across sections: dropping the skill tool does remove the <available_skills> block from the prompt. So some sections are already tool-conditional and these three appear not to be, which is what makes this look like an oversight rather than a design decision.
Reproduction
copilot -p "read the file ./notes.txt and summarise it" \
--available-tools <one-mcp-server-tool> \
--allow-tool <that-server> \
--disable-builtin-mcps \
--no-custom-instructions
Inspect the outgoing request (any HTTPS proxy will show it). The tools array contains only the allowed tool; the system content still contains the three sections above.
Impact
The model wastes turns on tools it cannot call, and each one is billed. In one of my sessions the model tried twice in a row:
turn 3 view path=/tmp/copilot-tool-output-176a24.txt
→ Tool 'view' does not exist.
turn 5 bash cat /tmp/copilot-tool-output-1789a0.txt
→ Tool 'bash' does not exist.
Both were the prompt's advice followed literally. Beyond the cost, it makes a restricted-tool session behave measurably differently from what the flag implies, which matters if you are using the CLI as a controlled harness.
What I checked for a workaround
- Every flag in
copilot --helpon 1.0.80.--no-custom-instructionscloses the custom-instructions channel and nothing else;--available-toolsand--excluded-toolsboth affect availability, not the prompt. - Every variable in
copilot help environment. None gates prompt assembly. - Hook surface: none documented.
Suggested fix
Make these three sections conditional on the corresponding tools actually being available, the way <available_skills> already is.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行提供的 copilot 命令并加上 --available-tools,检查发出的请求,将缩减后的 tools 数组与 system prompt 进行比较。以现有的 <available_skills> 行为作为参考,跟踪 <tool_preferences>、<code_search_tools> 和 <exploration_and_reading_files> 的 prompt 组装过程;完成的标准是这些部分不再推荐不可用的 tools。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 67/100