🐛 Repo `.claude/agents/*/AGENT.md` `model:` field overrides session model for Copilot custom agents, breaking subagent spawns on BYOK providers
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Describe the bug
When a repository ships a Claude-Code agent definition in .claude/agents/<name>/AGENT.md with a model: field, the GitHub Copilot CLI honors that model: value as the default model for the Copilot custom agent of the same name — even when the agent is launched from .github/agents/<name>.md and even when the session runs on a different model.
On a BYOK provider (e.g. Ollama) where that model (sonnet, opus, …) is not served, spawning the agent as a task-tool subagent silently fails: the orchestrator reports Agent completed but produced no response. (or a Model '...' not found on provider ... (HTTP 404)), with no error surfaced to the caller.
Repro
- Session started with
COPILOT_MODEL=deepseek-v4-flash:cloud(Ollama BYOK) and--model deepseek-v4-flash:cloud. - Repo contains:
.github/agents/developer.md— a Copilot custom agent (nomodel:field)..claude/agents/developer/AGENT.md— a Claude-Code agent withmodel: sonnet.
- Orchestrator (
agent_type: test-orch, tooltask) spawnstask(agent_type: developer, mode: sync, ...).
Result: subagent fails / displays as Developer(sonnet), no response. Removing the model: sonnet line from .claude/agents/developer/AGENT.md, or moving the agent to user scope ~/.copilot/agents/, makes it inherit the session model and work.
Evidence (local bisect)
- With
.claude/agents/developer/AGENT.md(model: sonnet) present →Developer(sonnet), subagent fails. - Removing only the
model: sonnetline →Developer(deepseek-v4-flash:cloud), subagent works. - Removing the whole
.claude/agents/dir → same fix. - User-level
.copilot/agents/developer.md(no.claudecounterpart, nomodel:) → inherits session model, works. - Passing
model: deepseek-v4-flash:cloudexplicitly to thetasktool → overrides the.claudemodel, works.
The changelog confirms repo-level .claude/agents are intentionally discovered as custom agents, but honoring their Claude-specific model: hint for Copilot agents appears unintended and is the trigger.
Expected behaviour
Option A: .claude/agents/*/AGENT.md model: is treated as a Claude-Code-only hint and is ignored by the Copilot CLI (agents inherit the session model like .github/agents/*.md do).
Option B: a configuration flag/setting to ignore .claude models or force session-model inheritance for subagents.
Environment
- Copilot CLI 1.0.79, macOS.
- Provider: Ollama BYOK via
COPILOT_PROVIDER_BASE_URL,COPILOT_PROVIDER_WIRE_API=responses,COPILOT_MODEL.
Related
- #3266 (background task agents silently substitute requested model)
- #2758 (opt-out for the cost-multiplier guard that clamps subagent model to session model)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先跟踪 repo 级别的 .claude/agents/*/AGENT.md 是如何被发现的,以及其中的 model 字段如何映射到 Copilot custom agents;将其与 .github/agents/developer.md 和 ~/.copilot/agents/developer.md 进行比较。使用 Ollama BYOK 和 task(agent_type: developer) 重现,然后验证当 Claude model 不可用时,subagent 会继承会话 model 并返回响应。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- ollama, shell
- 领域
- ai, cli
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 50/100