Manually selected model reverts to the agent's configured model after every turn · Issue #39319 · anomalyco/opencode · GitHub
Skip to content

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

Closed as not planned

Description

@tbartik

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)

Activity

  1. github-actions commented on Jul 28, 2026

    @github-actions
    Contributor

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

    Your report is well-detailed and the root-cause analysis (TUI hydration path + desktop agent.set always preferring the configured model) is specific enough that it may be a distinct manifestation. If maintainers confirm it is new, no action needed on your end.

  2. added a commit that references this issue on Jul 28, 2026
    f901b9c
  3. github-actions commented on Oct 9, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions