anomalyco / anomalyco/opencode

Manually selected model reverts to the agent's configured model after every turn

Open
#39,319 1 comment 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Jul 28, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

A manually selected model reverts to the agent's configured model after every conversational turn, so it is impossible to stay on a non-default model.

My build agent is pinned to claude-opus-5 in opencode.json. If I pick a different model in the picker, the prompt runs on it, then the picker immediately shows the agent's model again. Next turn runs on the agent's model.

Happens in both the TUI and the desktop app, but for different reasons:

  • TUI: Prompt restores the model from the last user message on session hydration, overwriting the pick.
  • Desktop: the agent Select calls agents.select(...) even when the value is unchanged, and agent.set always rewrites the model as item.model ?? prev?.model. Since the agent has a configured model, that always wins.

Possibly related, but different triggers: #38770 (background subagent notifications), #34207 (answering a question). Mine needs no subagents, no questions, and no mid-stream switching.

Plugins

None

OpenCode version

Desktop app 1.18.7, CLI 1.18.4

Steps to reproduce
  1. In opencode.json, set the build agent's model, e.g. "agent": { "build": { "model": "provider/model-a" } }
  2. Start a session with build and confirm it shows model A
  3. Pick a different model B in the picker
  4. Send a prompt and wait for the reply
  5. The picker shows model A again; the next prompt runs on A
Operating System

macOS 26.5.2

Terminal

Ghostty (also reproduced in the desktop app)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.