Description
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.
Plugins
opencode-antigravity-auth@latest, @mohak34/opencode-notifier@latest
OpenCode version
1.2.4
Steps to reproduce
- 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
Relevant code paths:
packages/opencode/src/cli/cmd/tui/context/local.tsx (loads/saves model.json variant map)
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx (submits explicit variant)
packages/opencode/src/session/prompt.ts (uses input.variant first, config variant only as fallback)
Screenshot and/or share link
No share link; validated with runtime behavior + DB inspection (opencode.db) and source reading.
Operating System
WSL2 (Ubuntu 24.04)
Terminal
Windows Terminal
Description
Hey team, I found a variant precedence issue that is pretty confusing in day-to-day usage.
I set
agent.build.variantin~/.config/opencode/opencode.jsontomedium, but when I startopencodein TUI it still opens withhighforopenai/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):
--variantis passed, configagent.build.variantshould be respected.Actual behavior:
high) even when config saysmedium.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.
Plugins
opencode-antigravity-auth@latest, @mohak34/opencode-notifier@latest
OpenCode version
1.2.4
Steps to reproduce
agent.build.varianttomediumin~/.config/opencode/opencode.json~/.local/state/opencode/model.jsonhasvariant["openai/gpt-5.3-codex"] = "high"opencodeBuild ... highopencode.dbmessage data: variant is stored ashighAlso with session resume:
6. Run
opencode -s <existing-session-id>where last message variant washigh7. Observe resumed session keeps
higheven after config changed tomediumRelevant code paths:
packages/opencode/src/cli/cmd/tui/context/local.tsx(loads/saves model.json variant map)packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx(submits explicit variant)packages/opencode/src/session/prompt.ts(uses input.variant first, config variant only as fallback)Screenshot and/or share link
No share link; validated with runtime behavior + DB inspection (
opencode.db) and source reading.Operating System
WSL2 (Ubuntu 24.04)
Terminal
Windows Terminal