opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[BUG] Using --prompt causes the wrong model to be selected.

Open arkaydeus opened this issue 1 week ago • 3 comments

Description

When you just run opencode, it launches with the default model which the user has selected. This is good.

But when you then run opencode --prompt "What is this repo?", instead of exactly the same behavior but with the prompt, it launches with Gemini 3 Pro via Github as the provider.

Adding --prompt has nothing to do with the model. So forcing this model which will often fail, is an undesirable and unrelated outcome that appears to be a bug.

Plugins

No response

OpenCode version

1.1.20

Steps to reproduce

opencode --prompt "What is this repo?"

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

arkaydeus avatar Jan 14 '26 23:01 arkaydeus

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

  • #8452: Model selection in /command incorrectly changes the default model

Both issues appear to involve model selection being unintentionally changed when using different flags or commands (--prompt flag in this case, /command in #8452). The underlying cause may be related to how model defaults are handled when alternative invocation methods are used.

Feel free to ignore if this specific case differs from the linked issue.

github-actions[bot] avatar Jan 14 '26 23:01 github-actions[bot]

To add to this, if you have "model", in your opencode.json, this bug doesn't appear. But if you don't and your default is the last selected model (most people are in this position), then the bug persists.

arkaydeus avatar Jan 14 '26 23:01 arkaydeus

I believe there is a timing issue here where the prompt submits prior to the tui having last used model available

rekram1-node avatar Jan 14 '26 23:01 rekram1-node