github / github/copilot-cli

--agent <name>  doesn't recognize custom agents loaded via  --add-dir

未关闭
#4,752 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Describe the bug

Custom agents loaded from a directory passed via  --add-dir  are correctly discovered for task-tool delegation (they appear in the model's list of available sub-agents, and can be invoked by mentioning them by name in a prompt), but the top-level  --agent   flag does not recognize them. Passing  --agent   for an agent that only exists under an  --add-dir -added directory's  .github/agents/  fails with "No such agent", even when that agent's frontmatter sets  user-invocable: true .

Affected version

GitHub Copilot CLI 1.0.83

Steps to reproduce the behavior
  1. Create a custom agent at  /.github/agents/my-agent.agent.md  with  user-invocable: true  in its frontmatter.
  2. Run:
    copilot --add-dir <some-dir> -p "List every custom agent name available to you via the task tool." --allow-all-tools
    my-agent appears in the list, confirming --add-dir loaded it correctly.
  3. Run:
    copilot --add-dir <some-dir> --agent my-agent -p "hello" --allow-all-tools
    → Fails with:
    No such agent: my-agent, available: <only agents registered through other mechanisms, e.g. plugins>
Expected behavior

 --agent   should be able to select any agent discovered via  --add-dir 's  .github/agents/  directory — the same set of agents already visible to/usable by the task tool in that same session — especially when the agent explicitly sets  user-invocable: true .

Additional context

• Workaround: instead of  --agent  , invoke the agent by mentioning its name directly in the prompt, e.g.  -p "use the my-agent agent to ..." . This reliably delegates to the correct agent via the task tool.
• OS: macOS
• Shell: bash

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先,使用 frontmatter 设置为 user-invocable: true 的 .github/agents/my-agent.agent.md 文件,通过 --add-dir 和 --agent 重现该行为。比较 task tool 发现该 agent 的方式与顶层 --agent 选项验证名称的方式。完成标准是:--agent my-agent 能够选择同一个自定义 agent,且不会出现“No such agent”错误。

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

评估

领域
cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
描述清楚
新手友好度
68/100

把新 issue 发到你的邮箱

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