🐛 Repo `.claude/agents/*/AGENT.md` `model:` field overrides session model for Copilot custom agents, breaking subagent spawns on BYOK providers
まだ誰も着手していません。
- 主要言語
- Shell
- スター
- 11.2k
- フォーク
- 1.9k
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、リポジトリレベルの .claude/agents/*/AGENT.md がどのように検出され、その model フィールドが Copilot custom agents にどのようにマッピングされるかを追跡します。.github/agents/developer.md および ~/.copilot/agents/developer.md と比較してください。Ollama BYOK と task(agent_type: developer) で再現し、その後、Claude モデルが利用できない場合でもサブエージェントがセッションモデルを継承し、応答を返すことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ollama, shell
- 領域
- ai, cli
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 50/100