opencode run ignores recently used model from TUI #8815

Closed
opened 2026-02-16 18:10:55 -05:00 by yindo · 1 comment
Owner

Originally created by @smitchaudhary on GitHub (Feb 8, 2026).

Originally assigned to: @thdxr on GitHub.

Description

When using opencode run without --model (or any other way we specify the model), the CLI falls back to Provider.defaultModel() which picks a model based on sort priority. The TUI persists recently used models to model.json and checks them before falling back, but the CLI run path skips this. This means the CLI can select a different default model than what the user last used in the TUI.

Plugins

None

OpenCode version

1.1.53

Steps to reproduce

  1. Launch opencode (TUI) and switch to a model of your choice and then exit.
  2. Run opencode run 'Hello' without --model

And then if you see the session or see the model was used some other way, you will see that it did not respect our choice from the TUI

Screenshot and/or share link

No response

Operating System

macOS26.2

Terminal

Ghostty

Originally created by @smitchaudhary on GitHub (Feb 8, 2026). Originally assigned to: @thdxr on GitHub. ### Description When using `opencode run` without `--model` (or any other way we specify the model), the CLI falls back to `Provider.defaultModel()` which picks a model based on sort priority. The TUI persists recently used models to `model.json` and checks them before falling back, but the CLI run path skips this. This means the CLI can select a different default model than what the user last used in the TUI. ### Plugins None ### OpenCode version 1.1.53 ### Steps to reproduce 1. Launch opencode (TUI) and switch to a model of your choice and then exit. 2. Run opencode run 'Hello' without --model And then if you see the session or see the model was used some other way, you will see that it did not respect our choice from the TUI ### Screenshot and/or share link _No response_ ### Operating System macOS26.2 ### Terminal Ghostty
yindo added the bug label 2026-02-16 18:10:55 -05:00
yindo closed this issue 2026-02-16 18:10:55 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 8, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10407: Feature Request: Remember last used model/agent across sessions
  • #7948: TUI: User selected agent/model is overwritten by server defaults when creating a new session
  • #11334: Model selection: prefer session history over agent default (-m)
  • #4930: Feature Request: Retain current model and agent selection when switching sessions

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 8, 2026): This issue might be a duplicate of existing issues. Please check: - #10407: Feature Request: Remember last used model/agent across sessions - #7948: TUI: User selected agent/model is overwritten by server defaults when creating a new session - #11334: Model selection: prefer session history over agent default (-m) - #4930: Feature Request: Retain current model and agent selection when switching sessions Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8815