Summary
A configured agents.build.model (e.g. openai/gpt-5.6-sol) is not used for the primary session's model. With no top-level model and no explicit model on session create, the runner falls back to the catalog default — "newest released available model" — which on a fresh install is a free opencode/* model.
Observed (integration-v2 @ 4668dfc, shuvcode serve --service)
GET /api/agent reports {"id":"build","model":{"id":"gpt-5.6-sol","providerID":"openai"}}.
- A session created without
model and prompted normally ran on {"id":"nemotron-3.5-lightning-free","providerID":"opencode"} (which then looped on provider.invalid-output).
Code path
packages/core/src/session/context.ts:120 → models.resolve(selection.session)
packages/core/src/session/runner/model.ts:80-83 — if (!session.model) resolver.resolve(); selection.agent.info.model is never consulted.
packages/core/src/model-resolver.ts:356-366 → catalog.model.default()
packages/core/src/catalog.ts:196-205 — no configured default ⇒ model.available()[0], sorted by time.released desc (catalog.ts:180-184).
- Contrast: the command path does honor the agent model —
packages/core/src/session.ts:710: command.model ?? commandAgent?.model ?? input.model.
Session.create only stores input.model (session.ts:417-421); switchAgent doesn't touch the model (session.ts:805-811).
Expected
Resolution order session.model ?? agent.model ?? config.model ?? catalog default, consistent with the command path.
Workaround
Set top-level "model" in opencode.json, or pass model on POST /api/session.
Found while running the Discord plugin (shuvcode-bot) on a fresh VM.
Summary
A configured
agents.build.model(e.g.openai/gpt-5.6-sol) is not used for the primary session's model. With no top-levelmodeland no explicit model on session create, the runner falls back to the catalog default — "newest released available model" — which on a fresh install is a freeopencode/*model.Observed (integration-v2 @ 4668dfc,
shuvcode serve --service)GET /api/agentreports{"id":"build","model":{"id":"gpt-5.6-sol","providerID":"openai"}}.modeland prompted normally ran on{"id":"nemotron-3.5-lightning-free","providerID":"opencode"}(which then looped onprovider.invalid-output).Code path
packages/core/src/session/context.ts:120→models.resolve(selection.session)packages/core/src/session/runner/model.ts:80-83—if (!session.model) resolver.resolve();selection.agent.info.modelis never consulted.packages/core/src/model-resolver.ts:356-366→catalog.model.default()packages/core/src/catalog.ts:196-205— no configured default ⇒model.available()[0], sorted bytime.releaseddesc (catalog.ts:180-184).packages/core/src/session.ts:710:command.model ?? commandAgent?.model ?? input.model.Session.createonly storesinput.model(session.ts:417-421);switchAgentdoesn't touch the model (session.ts:805-811).Expected
Resolution order
session.model ?? agent.model ?? config.model ?? catalog default, consistent with the command path.Workaround
Set top-level
"model"in opencode.json, or passmodelonPOST /api/session.Found while running the Discord plugin (shuvcode-bot) on a fresh VM.