GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(opencode): add model parameter to task tool for subagent model override by funkybooboo · Pull Request #26535 · anomalyco/opencode Conversation
|
| PR | Approach | Status | Key difference |
|---|---|---|---|
| #18528 | model param + model_override permission |
Open, stalled | Nearly identical approach. Uses zod schema and iife() helper; this PR uses Effect Schema and inline parsing. Both have the same permission gate. |
| #11217 | @agent:provider/model syntax in prompt + TUI autocomplete + permission.model |
Open | UI-driven approach with @ mention syntax. Much larger scope -- includes TUI and web UI changes. |
| #11377 | model_tier param (quick/standard/advanced) + configurable tier-to-model mapping |
Open | Tier abstraction layer rather than direct model selection. Adds a tier config system. |
| #17570 | Config/UI-based agent-to-model assignment (assign-model command) |
Open | Static config-only approach. No runtime model selection. |
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.
packages/opencode/src/tool/task.ts -- Added model optional string param to Parameters schema. When provided:
provider/model format (rejects missing / or empty parts with a clear error message)model_override permission with the model and provider wildcard as patternsProviderID/ModelID branded types using lightweight imports from provider/schema.tsagent.model or parent session model when not providedpackages/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.
cd packages/opencode bun test test/tool/task.test.ts # 8 pass, 0 fail, 28 expect() calls bun test test/permission/ # 85 pass, 0 fail, 130 expect() calls bun typecheck # clean bun run build # succeeds
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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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.
There was an error while loading. Please reload this page.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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:
TaskTool parameters with optional model in provider/model format and apply it during subagent session/prompt creation.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.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…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
cae2d8d to
bf6215a
Compare
There was an error while loading. Please reload this page.
|
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 I took a look at why this seems stuck. GitHub currently reports the PR as conflicted/dirty against A few concrete notes from porting this locally onto current
I have a clean local port of this onto current |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I opened a refreshed forward-port at #29447 to help unblock maintainers since this branch is conflicted/far behind I credited this PR and @funkybooboo in the new PR body and kept the same core design: optional Task Happy to close mine if this branch gets refreshed first — mostly trying to move the existing work over the line. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@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.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[FEATURE]: Runtime model override for task tool subagents
There was an error while loading. Please reload this page.