anomalyco / anomalyco/opencode
[OpenCode v1.16.42] task 工具派发 subagent 时不使用 agent.md 配置的 model,继承父 session model
@rekram1-node is already working on this.
Since Aug 24, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
核心问题:task 工具创建子 agent session 时不读取 agent.md frontmatter 的 model 字段,而是继承 primary agent 的 model。导致 per-agent model 配置完全失效。
复现步骤:
配置 supervisor.md model: provider/GLM-5.2,data-engineer.md model: provider/Qwen3.8-27B
opencode debug agent data-engineer 确认配置被正确解析(modelID=Qwen3.8-27B)
supervisor 通过 task 工具派发 data-engineer
检查 workspace dat 的 workspace:model-selection,子 session 实际用 GLM-5.2
根因:task 工具创建新 session 时不传递 agent 配置的 model,继承父 session model 选择。
期望行为:task 工具应使用子 agent 配置的 model,仅在未配置时回退到父 session model。
证据文件:opencode.workspace..dat 中的 workspace:model-selection 字段
环境影响:无法为不同专业 agent 分配不同模型(如推理模型给 supervisor、代码生成模型给 simulation-agent)
Plugins
No response
OpenCode version
OpenCode v1.16.42
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.