Repository navigation
Description
Description
On OpenCode 2.0.8, agents.<name>.model is loaded into the agent catalog but is not applied when a subagent is spawned.
GET /api/agent shows the configured model on general / explore. The child session still runs with the parent session model. The parent variant is also dropped (#xhigh → #default).
This matches the V2 agents docs ("a subagent uses its configured model, or inherits the parent session model when none is configured") but not the current runner, which resolves only session.model.
The parent subagent tool schema also says not to pass model unless the user names one, so the configured agent model is never applied on the default path.
Related: #21952 #36250 #36289 #37797. Those were mostly V1; this is a V2 2.0.8 regression/gap.
Plugins
None
OpenCode version
2.0.8 (OpenCode Desktop, latest)
Steps to reproduce
- Set the primary session to model A, with a non-default variant (example:
provider-a/model-a#xhigh). - Pin a different model B on the built-in subagents in
opencode.jsonc:
{
"agents": {
"general": {
"mode": "subagent",
"model": "provider-b/model-b#high"
},
"explore": {
"mode": "subagent",
"model": "provider-b/model-b#high"
}
}
}- Start a new session. Confirm the catalog:
GET /api/agent
general / explore resolve to provider-b/model-b with variant high.
- Ask the primary agent to spawn
generalorexplore. Do not name a model in the prompt (so thesubagenttool does not receivemodel). - Inspect the child session:
GET /api/session/{childID}
Expected Behavior
Child session uses the agent catalog model: provider-b/model-b#high.
Actual Behavior
Child session uses the parent model with variant reset:
- parent:
provider-a/model-a#xhigh - child
generalsessions:provider-a/model-a#default
Observed on three child sessions from one parent. Reproducible, not intermittent. Custom providers were used in the original run; the mismatch is catalog model B vs spawned session model A.
packages/core/src/session/runner/model.ts (SessionRunnerModel.resolve) selects from session.model only. agent.model is never consulted. packages/core/src/tool/builtins.ts still lists task as not ported.
Screenshot and/or share link
N/A. API evidence (IDs generalized):
GET /api/agent
→ general.model = { id: model-b, providerID: provider-b, variant: high }
GET /api/session/{child}
→ agent=general, model={ id: model-a, providerID: provider-a, variant: default }
Operating System
Windows 11 (10.0.26200.9457)
Terminal
OpenCode Desktop (@opencode-aidesktop)
Activity
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report. I tried to reproduce this on 2.0.8 and couldn't.
Setup: two models on one provider. The session used
model-a#xhigh, andopencode.jsonchadagents.general: { mode: "subagent", model: "<provider>/model-b#high" }. The parent turn called thesubagenttool with onlyagent,descriptionandprompt, with nomodelargument. The childgeneralsession sent its requests to model-b, and the parent kept using model-a. In 2.0.8 thesubagenttool chooses the child's model in this order: an explicitmodelargument from the tool call, then the agent's configured model, then the parent's model. SoSessionRunnerModel.resolveisn't where the child's model gets chosen.One detail in your report suggests a different cause. Your children came out as
provider-a/model-a#default. A child that inherited the parent model would have kept#xhigh. A model with no variant is what you get when the parent model passesmodel: "provider-a/model-a"explicitly in thesubagenttool call, despite the tool description telling it not to. That matches #51071 (subagent model overrides are accepted without user authorization).These would help:
subagenttool call input from the parent session for one of the affected children. Does it include amodelfield?agentsconfig is in the project'sopencode.jsoncor the global one, and whether a Markdown agent file also definesgeneral/explore(see core: legacy Markdown agent silently drops "model: provider/model#variant" — subagent inherits parent model #50849 for a case where a Markdown agent'smodel: ...#variantgets dropped).Related issues, most likely first:
model: provider/model#variant, so the subagent inherits the parent modelopencodejr commentedon Oct 31, 2026
Closing this for now, since we haven't heard back. On 2.0.8 I couldn't reproduce it: a
generalsubagent spawned without amodelargument ran on its configuredagents.general.model, not the parent's model. Your child sessions came out asprovider-a/model-a#default, which suggests the parent model passed an explicitmodelin thesubagenttool call. That would be #51071.If it still happens, please reopen or comment with the
subagenttool call input from an affected parent session (does it includemodel?) and your current OpenCode version, and we'll look again. Related: #51071, #50849.