System prompt labels shell commands as tools, causing invalid tool calls and autopilot cost

未关闭 适合新手
#3,043 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
shell
领域
cli

调研方向

在仓库中搜索确切的 Available tools: git, curl, gh 文本,并跟踪 init 系统提示的入口点。确认生成的提示能够区分 shell 命令和可调用工具,然后检查现有的提示或 CLI 测试的覆盖情况。

由索引模型根据 Issue 内容生成。

描述

area:configuration area:non-interactive
Describe the bug

In Copilot CLI non-interactive/autopilot sessions, the init system prompt labels shell commands as "Available tools":

<environment_context>
...
* Available tools: git, curl, gh
</environment_context>

In the observed session, curl was available as a shell command, but not as a callable Copilot tool/function. The model treated it as a callable tool and emitted:

tool= curl args= {'url': 'https://app.notion.com/p/...'}

The runtime then returned:

Tool 'curl' does not exist.

This looks like prompt-surface ambiguity rather than only a model mistake: the system prompt uses the word "tools" for shell commands while callable tools are also exposed to the model as tools.

Related schema confusion observed in the same testing work

The same ambiguity showed up around other tool workflows:

  1. Shell/session tools were called without the required prior shell state:
Multiple validation errors:
- "shellId": Required
- "delay": Required
  1. Sub-agent/task invocation was attempted with an incomplete schema:
{name: "task", arguments: {agent_type: "translation-validator", description: "Validate changelog files", prompt: "...", mode: "background"}}

Runtime response:

"name": Required

The model then switched to background agent + read_agent, which worked but added extra turns and runtime cost.

Why this matters

Autopilot mode absorbs these validation errors and keeps going, but each invalid tool call costs extra model requests, tokens, and wall time. This is especially visible with smaller/local models that are more sensitive to tool-surface ambiguity.

In our prompt optimization test, making the prompt explicitly avoid the ambiguous paths removed the validation errors across 10/10 successful runs:

  • Require direct file write, not shell input/bash write
  • Require translation-validator with name=translation-validator
  • Require synchronous validator, not background/read_agent
  • Require validator to read only output files, not Notion/web/curl
  • Use events.jsonl session.task_complete as completion signal, not stdout
Affected version

Observed in Copilot CLI session metadata:

copilotVersion: 1.0.39
model: Qwen3.6-35B-A3B-bf16
mode: --autopilot, non-interactive
Expected behavior

The init system prompt should clearly distinguish callable tools from shell commands. For example:

* Available shell commands: git, curl, gh

instead of:

* Available tools: git, curl, gh

It would also help if the tool guidance made preconditions and required fields harder to miss, especially for:

  • shell/session output tools that require shellId
  • task / sub-agent tools that require name
  • background agent flows that require read_agent
Suggested fixes
  • Rename Available tools: git, curl, gh to Available shell commands: git, curl, gh in the system prompt.
  • Explicitly state that shell commands must be run through the bash/shell tool and are not callable tool names.
  • Add stronger schema guidance for task / sub-agent invocation, including required name and when not to use background/read_agent.
  • Add stronger precondition wording for shell output/input tools that require an existing shellId.
Additional context

This is related in impact to task completion/output reliability issues, but it is a distinct problem: tool-surface ambiguity in the init prompt causes invalid tool calls and unnecessary autopilot cost.

主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/copilot-cli 的其他 Issue

查看 github/copilot-cli 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。