feat(opencode): add runtime model override for task tool subagents - #35800
feat(opencode): add runtime model override for task tool subagents#35800pratikranaa wants to merge 1 commit into
Conversation
Add an optional model parameter to the task tool so a primary agent can choose a subagent model at runtime using "provider/model-id" format. Model selection order: explicit task model -> subagent configured model -> parent assistant message model. Explicit overrides are gated behind a new model_override permission that defaults to "ask", so users control which models agents can switch to without a prompt-injection escalation risk. Also adds test coverage for the existing per-agent model feature (frontmatter model field) which previously had no tests, and tests for the new runtime override including format validation, permission checking, and priority over the agent configured model. Closes anomalyco#17595, anomalyco#32730
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #29447: feat(opencode): add task model override Why it's related: This is the exact same feature mentioned in the PR description. PR #29447 has been waiting for review since May and implements the same task tool model override functionality. The current PR (35800) is an independent implementation of the same feature. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
really need this, i don't have to write a bunch of special agent def files if this get merged. |
|
@pratikranaa It's not clear to me skimming the code if the variant can also be overridden? I think definitely all of these should be possible:
For example, the parent model could be "xhigh" and call a "low" subagent or vice versa. If this is possible already, I think the docs/tool should be updated so it's more visible. |
Issue for this PR
Closes #17595, #32730
Type of change
What does this PR do?
Adds an optional
modelparameter to the task tool so a primary agent can pick a subagent model at runtime usingprovider/model-idformat.Model priority: explicit
modelparam → subagent configuredmodelfrontmatter → parent assistant message model.Explicit overrides are gated behind a new
model_overridepermission (defaults toask) to prevent prompt-injection escalation to expensive models.How did you verify your code works?
test/tool/task.test.ts(7 new) — all passbunx tsc --noEmitclean on changed filesScreenshots / recordings
N/A — backend logic change, no UI.
Checklist
Note: #29447 implements the same feature but has been waiting for review since May. This is an independent implementation.