You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--model is ignored when resuming a session with --session #53806
When a session is resumed with --session <id> --model <provider/model>, the --model flag is ignored: the TUI switches to the model of the session's last user message, and the next prompt is sent to that model.
--agent is already kept in this case (// Keep command line --agent if specified. in packages/tui/src/component/prompt/index.tsx), but the model from the last message is applied unconditionally right below it.
This matters for anything that relaunches OpenCode on an existing session with a different model (I hit it in an app that runs OpenCode in a terminal and restarts it with --session when the user changes the model).
OpenCode version
1.18.35 (also current dev)
Steps to reproduce
opencode run --model provider-a/model-a "hi" (creates a session whose messages use model-a)
Thanks for the detailed report and for finding the exact code path.
This is about OpenCode v1 (1.18.35). v1 now only gets fixes for critical bugs such as data loss, security problems or breakage with no workaround. Since the model can still be switched in the TUI after resuming, this one is unlikely to be fixed in v1.
Please consider moving to v2 (@opencode/cli, the opencode command). It's a separate implementation and handles startup flags differently: --agent and --model are applied when the app starts, before it opens the --session session. If you can reproduce the problem on v2 (2.x), or you think it is critical, please reply here with the v2 version and steps.
Thanks. Checked on v2 (@opencode/cli 2.0.24, Windows, --standalone, a local OpenAI-compatible stub with two providers):
opencode mini -s <id> --model fakeb/mb on a session last used with fakea/ma: footer shows model B and the next request goes to mb. So v2's mini interface handles it.
The default v2 interface doesn't accept --model / --agent at all (opencode --standalone -s <id> --model … prints the usage), so there's nothing to reproduce there.
Closing #53807 since v1 won't take it. One question for v2, if it's useful: are --model / --agent planned for the full interface too (as in mini)? Wrappers that relaunch OpenCode on an existing session with a different model need one of them.
The v2 interface code already applies --model and --agent before it opens the --session session. So once the main command accepts these flags, relaunching on an existing session with a different model should work like mini does. I can't promise when that will happen. Until then, opencode mini is the way to do this on v2. You could also add a 👍 or your use case on #53728.
The v1 behaviour reported here is still unlikely to be fixed, since v1 only gets critical fixes. This issue will be closed on that basis.
Closing this as not planned. It's a v1 (1.18.35) behaviour, v1 only gets critical fixes, and there's a workaround: you can switch the model after resuming.
On v2, your test showed that opencode mini -s <id> --model … already keeps the requested model. Support for --model / --agent on the full v2 interface is tracked in #53728, and there's an open PR adding --model there in #48163. Please follow those for your wrapper use case.
Thanks for the clear report and for checking it on v2. If you see this again on v2, please open a new issue.
Activity
opencode-agent commentedon Oct 7, 2026
Thanks for the detailed report and for finding the exact code path.
This is about OpenCode v1 (1.18.35). v1 now only gets fixes for critical bugs such as data loss, security problems or breakage with no workaround. Since the model can still be switched in the TUI after resuming, this one is unlikely to be fixed in v1.
Please consider moving to v2 (
@opencode/cli, theopencodecommand). It's a separate implementation and handles startup flags differently:--agentand--modelare applied when the app starts, before it opens the--sessionsession. If you can reproduce the problem on v2 (2.x), or you think it is critical, please reply here with the v2 version and steps.Related issues, most closely related first:
glmn commentedon Oct 7, 2026
Thanks. Checked on v2 (
@opencode/cli2.0.24, Windows,--standalone, a local OpenAI-compatible stub with two providers):opencode mini -s <id> --model fakeb/mbon a session last used withfakea/ma: footer shows model B and the next request goes tomb. So v2's mini interface handles it.--model/--agentat all (opencode --standalone -s <id> --model …prints the usage), so there's nothing to reproduce there.Closing #53807 since v1 won't take it. One question for v2, if it's useful: are
--model/--agentplanned for the full interface too (as inmini)? Wrappers that relaunch OpenCode on an existing session with a different model need one of them.opencode-agent commentedon Oct 7, 2026
Thanks for testing on v2. Good to know that
opencode mini -s <id> --model …works there.To answer your question: the full v2 interface doesn't support
--model/--agentyet, and that's already tracked:--agentand--modelon the full v2 interface. It's open and gives the same reason as yours (wrapper scripts that start OpenCode with a chosen agent or model).--model/-mto the mainopencodecommand and passes it through. It isn't merged yet and doesn't cover--agent.The v2 interface code already applies
--modeland--agentbefore it opens the--sessionsession. So once the main command accepts these flags, relaunching on an existing session with a different model should work likeminidoes. I can't promise when that will happen. Until then,opencode miniis the way to do this on v2. You could also add a 👍 or your use case on #53728.The v1 behaviour reported here is still unlikely to be fixed, since v1 only gets critical fixes. This issue will be closed on that basis.
opencode-agent commentedon Oct 8, 2026
Closing this as not planned. It's a v1 (1.18.35) behaviour, v1 only gets critical fixes, and there's a workaround: you can switch the model after resuming.
On v2, your test showed that
opencode mini -s <id> --model …already keeps the requested model. Support for--model/--agenton the full v2 interface is tracked in #53728, and there's an open PR adding--modelthere in #48163. Please follow those for your wrapper use case.Thanks for the clear report and for checking it on v2. If you see this again on v2, please open a new issue.