#18528 · @Quadina · opened Mar 21, 2026 at 1:55 PM UTC · last updated Mar 21, 2026 at 1:56 PM UTC
feat(task): add model override for subagents
Score breakdown
Impact
Clarity
Urgency
Ease Of Review
Guidelines
Readiness
Size
Trust
Traction
Summary
This PR adds a model parameter to the task tool, allowing orchestrators to dynamically select which model a subagent uses at runtime. The feature is gated by a model_override permission for security, defaulting to deny. This enhances agent flexibility for use cases like adaptive review or variable-complexity reports.
Description
Issue for this PR
Closes #17595
Type of change
- [ ] Bug fix
- [x] New feature
- [ ] Refactor / code improvement
- [ ] Documentation
What does this PR do?
Adds a model parameter to the task tool so the orchestrator can pick which model a subagent runs on ("provider/model-id" format). Gated by a model_override permission — denied by default, users opt-in via config with support for wildcards like "anthropic/*": "allow".
Without permission the override is silently ignored and the subagent uses its default model.
How did you verify your code works?
bun test test/tool/task.test.ts — 14 tests pass (parseModel parsing + permission evaluation).
bun typecheck — clean.
Screenshots / recordings
N/A — no UI changes.
Checklist
- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR
Linked Issues
#17595 [FEATURE]: Runtime model override for task tool subagents
View issueComments
No comments.
Changed Files
packages/opencode/src/agent/agent.ts
+1−0packages/opencode/src/config/config.ts
+1−0packages/opencode/src/tool/task.ts
+38−3packages/opencode/src/tool/task.txt
+6−1packages/opencode/test/tool/task.test.ts
+175−1