| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Hey! Your PR title feat(tool/task): add model parameter to override subagent model doesn't follow conventional commit format. Please update it to start with one of:
Where scope is the package name (e.g., app, desktop, opencode). See CONTRIBUTING.md for details. |
Sorry, something went wrong.
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related but older PRs that addressed similar features: Potentially Related (Historical):
These are merged/closed PRs from the repository's history, so the current PR (26535) is not a duplicate of open PRs. However, you may want to verify:
No open duplicate PRs found - The current PR is not duplicating any actively open pull requests. |
Sorry, something went wrong.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Sorry, something went wrong.
There was a problem hiding this comment.
Adds an optional model parameter to the task tool so callers can override which model a spawned subagent uses (taking priority over the agent’s configured model and the parent message/session model), and documents + tests the new behavior.
Changes:
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/opencode/src/tool/task.ts | Adds model param and uses it to resolve the subagent model via Provider.parseModel() before falling back to agent/parent model. |
| packages/opencode/src/tool/task.txt | Documents the new model parameter and intended usage. |
| packages/opencode/test/tool/task.test.ts | Adds a test verifying model overrides the model used for the child prompt + returned metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
…verride
Adds an optional model parameter to the task tool that overrides which
model a subagent uses. Format: provider/model (e.g. anthropic/claude-sonnet-4).
Model priority: params.model > agent config > parent session model.
The model_override permission is denied by default, requiring users to
opt in via config (e.g. model_override: { anthropic/*: allow }).
This prevents prompt injection from escalating to expensive models.
Closes anomalyco#17595
|
Thanks for putting this together — this is exactly the behavior I was looking for as an opencode user. I tested a small local version of the same idea and confirmed the Task tool model parameter works well for orchestrator-driven subagent routing. I took a look at why this seems stuck. GitHub currently reports the PR as conflicted/dirty against dev — the branch is far behind current dev, and the conflicts are mostly around the newer Task implementation/background-subagent code. A few concrete notes from porting this locally onto current dev:
I have a clean local port of this onto current dev with those tweaks if that would help. Validation I could run locally: git diff --check and lightweight Bun build checks for the touched files passed; full bun test/typecheck were blocked in my local checkout by missing @opentui/solid/preload and tsgo. |
Sorry, something went wrong.
|
I opened a refreshed forward-port at #29447 to help unblock maintainers since this branch is conflicted/far behind dev. I credited this PR and @funkybooboo in the new PR body and kept the same core design: optional Task model, model_override permission, early provider/model validation, and explicit model > subagent model > parent model precedence. I also included the permission-ordering/test coverage notes from my local port. Happy to close mine if this branch gets refreshed first — mostly trying to move the existing work over the line. |
Sorry, something went wrong.
|
@kobicovaldev thank you for keeping the work moving! I love what you have done and am happy to close this PR! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Issue for this PR
Closes #17595
Type of change
What does this PR do?
Adds an optional model parameter to the task tool, allowing callers to override which model a subagent uses at runtime. Accepts provider/model format (e.g. anthropic/claude-sonnet-4, openai/gpt-4o).
Model priority: params.model (task tool call) -> agent.model (agent config) -> parent session model (inherit)
Security: Model overrides are gated by model_override permission -- denied by default. Users must explicitly opt in via config. This prevents prompt injection from escalating to expensive models.
Example config:
{ "permission": { "model_override": { "anthropic/*": "allow", "openai/gpt-4o": "allow" } } }Relationship to prior PRs
This PR addresses the same issue (#17595) as several other open PRs, with different tradeoffs:
This PR takes the minimal, permission-gated approach from #18528 (which appears stalled since early May) with an Effect Schema implementation matching current codebase patterns.
Changes
packages/opencode/src/tool/task.ts -- Added model optional string param to Parameters schema. When provided:
packages/opencode/src/tool/task.txt -- Added "Model selection" section documenting the new parameter and permission requirement.
packages/opencode/src/agent/agent.ts -- Added model_override: "deny" to default permission set for all agents.
packages/opencode/src/config/permission.ts -- Added model_override to the config permission schema so users can configure it in opencode.json.
packages/opencode/test/tool/task.test.ts -- Added 1 test verifying model param correctly overrides the model passed to the child session and prompt payload.
How did you verify your code works?
Behavior change for users
Purely additive. The model parameter is optional and requires explicit permission. When omitted or denied, behavior is identical to before -- subagents inherit their model from agent config or the parent session.
Checklist