Skip to content

Model incorrectly changes on agent switch using -m, but correctly sticks using config #3863

@jdanbrown

Description

@jdanbrown

Description

Related issues from pre-1.0:

Now in 1.0, if I set my model in the config file then the model correctly doesn't change when I switch agents:

  1. In config opencode.jsonc, set "model": "anthropic/claude-sonnet-4-5"
    1. Run opencode → UI shows "Anthropic Claude Sonnet 4.5"
    2. Press tab to switch agents → UI still shows "Anthropic Claude Sonnet 4.5" — correct
  2. In config opencode.jsonc, set "model": "openai/gpt-5"
    1. Run opencode → UI shows "OpenAI GPT-5"
    2. Press tab to switch agents → UI still shows "OpenAI GPT-5" — correct

But if I instead set my model using -m/--model on the command line, then when I switch agents the model incorrectly changes to the last-used model:

  1. Disable config "model" setting above
  2. Run opencode (with no -m and no config "model")
    1. UI shows "OpenAI GPT-5" — correct, last-used model (from above)
    2. Press tab to switch agents → UI still shows "OpenAI GPT-5" — correct, last-used model (from above)
  3. Run opencode -m anthropic/claude-sonnet-4-5
    1. UI shows "Anthropic Claude Sonnet 4.5" — correct
    2. Press tab to switch agents → UI shows "OpenAI GPT-5" — bug, last-used model instead of -m model
  4. Run opencode (with no -m and no config "model")
    1. UI shows "Anthropic Claude Sonnet 4.5" — correct
    2. Press tab to switch agents → UI shows "Anthropic Claude Sonnet 4.5" — weird, now it works?
  5. Run opencode -m openai/gpt-5
    1. UI shows "OpenAI GPT-5" — correct
    2. Press tab to switch agents → UI shows "Anthropic Claude Sonnet 4.5" — bug, last-used model instead of -m model
  6. Run opencode (with no -m and no config "model")
    1. UI shows "OpenAI GPT-5" — correct
    2. Press tab to switch agents → UI shows "OpenAI GPT-5" — weird, now it works?

OpenCode version

1.0.18

Steps to reproduce

(above)

Screenshot and/or share link

No response

Operating System

macOS 15.5

Terminal

VS Code terminal

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions