Skip to content

opencode run ignores recently used model from TUI #12667

@smitchaudhary

Description

@smitchaudhary

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions