You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build variant in config gets ignored by TUI due persisted per-model variant state #13718
Hey team, I found a variant precedence issue that is pretty confusing in day-to-day usage.
I set agent.build.variant in ~/.config/opencode/opencode.json to medium, but when I start opencode in TUI it still opens with high for openai/gpt-5.3-codex.
This happens because TUI restores variant from persisted state (~/.local/state/opencode/model.json) and submits that explicit variant, so config fallback never gets used.
I can reproduce this reliably and also confirmed by checking stored message data in opencode.db.
Expected behavior (for a new session):
If no CLI --variant is passed, config agent.build.variant should be respected.
Persisted UI variant should not silently override config unless there is an explicit “remember last variant” mode.
Actual behavior:
Persisted per-model variant wins (ex: high) even when config says medium.
opencode -s <session> also restores last message variant and keeps forcing that value.
This makes config changes feel broken because they don’t take effect in fresh TUI usage.
Set agent.build.variant to medium in ~/.config/opencode/opencode.json
Ensure ~/.local/state/opencode/model.json has variant["openai/gpt-5.3-codex"] = "high"
Start TUI with opencode
Observe header shows Build ... high
Send a prompt and inspect opencode.db message data: variant is stored as high
Also with session resume:
6. Run opencode -s <existing-session-id> where last message variant was high
7. Observe resumed session keeps high even after config changed to medium
While they affect different aspects (model vs variant), they likely share the same root cause regarding state precedence and could potentially be fixed together.
@rekram1-node
The issue is clear and shouldn't be closed without any feedback as this is a bug issue not a feature so it can't be closed as "not planned"
Reacted by Andrei Tarutin, Ramon Paolo Maram and Jose Andrés González Guevara
Activity
github-actions commentedon Feb 15, 2026
This issue might be a duplicate of or related to #13456: TUI model selection gets overwritten by agent default model.
Both issues involve state persisted in
~/.local/state/opencode/model.jsoninappropriately overriding configuration settings:While they affect different aspects (model vs variant), they likely share the same root cause regarding state precedence and could potentially be fixed together.
dhruvkej9 commentedon Feb 15, 2026
@rekram1-node Can you check this? It is on the latest version, I just tried many times and it is 100% reproducible
demian85 commentedon Feb 25, 2026
Variants are not respected in both TUI and desktop, even though they are configured in opencode.json:
When changing agents, the default variant is not used.
github-actions commentedon Apr 27, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
dhruvkej9 commentedon Apr 27, 2026
@rekram1-node
The issue is clear and shouldn't be closed without any feedback as this is a bug issue not a feature so it can't be closed as "not planned"
tarurar commentedon Apr 28, 2026
Completely agree. There is related one #16034