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
Bug: Model variant is not preserved after being cleared — resets to previous value on mode switch #214
When a model variant is explicitly cleared (set to none/default), it keeps coming back after switching modes or switching to another model and back.
Steps to Reproduce
Select a model (e.g. gpt-5.4).
Set variant to medium.
Explicitly clear the variant (set to none / no variant).
Switch to another mode (e.g. from build to plan) or switch model and back.
Expected Behavior
Variant stays cleared — since the user explicitly removed it, it should not be auto-reapplied.
Actual Behavior
Variant medium is automatically re-selected for gpt-5.4 after switching. The user has to manually clear it every time.
Environment
oh-my-opencode-slim: latest version
Notes
This makes working with models that have variants very frustrating as it requires constant manual corrections. Looks like the last-used variant is "remembered" and re-applied even after an explicit user clear.
Hey, I traced this through both codebases, to me it's an upstream OpenCode core bug, not something omo-slim can work around. I actually confirmed it still happens with omo-slim deactivated (plan/build build-in agents).
TL;DR: Two independent variant stores (UI vs API session) get out of sync. Clearing the variant in the UI only updates the UI side, so the API session keeps sending the old one. The next response overwrites your cleared variant right back — ghost variant.
Analysis 🐇
Two stores, one source of truth problem:
Store
Where
Controls
TUI local model store
~/.opencode/model.json
Dialog display
ACP session state
session.variant (in-memory)
Actual API calls
The flow:
Set variant to medium → both stores updated ✓
Clear it in the dialog → local store updated, ACP session still holds "medium"
Why omo-slim can't fix this: Variant handling there is config-time only (sets agent.config.variant at startup). Runtime hooks have no access to the ACP session manager. Suppressing it in message transforms would strip it from the API call too — wrong behavior.
Quick way to verify: Disable omo-slim entirely and reproduce — the bug persists, confirming it's upstream.
Fix in OpenCode core:
dialog-variant.tsx — on "Default" selection, propagate the clear to the ACP session (setVariant() at acp/session.ts:103 exists but is never called from the TUI clear path)
prompt/index.tsx:200 — stop blindly overwriting the local variant from the response
Note: High confidence on the desync mechanism, but worth noting the "mode switch" trigger could also partly be per-session variant persistence if that mode was previously used with the same model+variant. Needs proper reproduction to confirm the exact trigger path.
Triage Result: upstream OpenCode bug (not fixable in this plugin)
Thanks for the report (and to ReqX for the thorough trace). This is an OpenCode core bug, not something oh-my-opencode-slim can fix:
The root cause is a desync between two variant stores: the TUI's local model store (~/.opencode/model.json) and the ACP session state (session.variant). Clearing the variant in the UI updates only the local store; the ACP session keeps the old value, and the next response re-syncs the stale variant back into the UI — the "ghost variant."
oh-my-opencode-slim only sets a variant at config time (when building agent configs / applying presets). It has no runtime access to the ACP session manager, so it cannot propagate a UI clear to the session or suppress the re-sync without also stripping the variant from the actual API call (wrong behavior).
ReqX confirmed the bug reproduces with oh-my-opencode-slim deactivated, and you've already forwarded it to the OpenCode team.
Because the fix belongs in OpenCode core (propagate the clear to the ACP session on "Default" selection, and stop blindly overwriting the local variant from the response), we're closing this as outside our scope. We'll revisit if OpenCode ships a hook/API that lets a plugin participate in variant state.
If you'd like, you can link the upstream OpenCode issue here so others can track it.
Activity
ReqX commentedon Mar 31, 2026
Hey, I traced this through both codebases, to me it's an upstream OpenCode core bug, not something omo-slim can work around. I actually confirmed it still happens with omo-slim deactivated (plan/build build-in agents).
TL;DR: Two independent variant stores (UI vs API session) get out of sync. Clearing the variant in the UI only updates the UI side, so the API session keeps sending the old one. The next response overwrites your cleared variant right back — ghost variant.
Analysis 🐇
Two stores, one source of truth problem:
~/.opencode/model.jsonsession.variant(in-memory)The flow:
medium→ both stores updated ✓"medium"setSessionMode()doesn't touch variant"medium"goes to the APImsg.variant = "medium"→prompt/index.tsx:200syncs it back to the UI, undoing the clearSmoking gun:
Why omo-slim can't fix this: Variant handling there is config-time only (sets
agent.config.variantat startup). Runtime hooks have no access to the ACP session manager. Suppressing it in message transforms would strip it from the API call too — wrong behavior.Quick way to verify: Disable omo-slim entirely and reproduce — the bug persists, confirming it's upstream.
Fix in OpenCode core:
dialog-variant.tsx— on "Default" selection, propagate the clear to the ACP session (setVariant()atacp/session.ts:103exists but is never called from the TUI clear path)prompt/index.tsx:200— stop blindly overwriting the local variant from the responseNote: High confidence on the desync mechanism, but worth noting the "mode switch" trigger could also partly be per-session variant persistence if that mode was previously used with the same model+variant. Needs proper reproduction to confirm the exact trigger path.
alexzoo commentedon Mar 31, 2026
Thanks for the investigation, I've passed it on to the OpenCode team
mhenke commentedon Jul 9, 2026
Triage Result: upstream OpenCode bug (not fixable in this plugin)
Thanks for the report (and to ReqX for the thorough trace). This is an OpenCode core bug, not something oh-my-opencode-slim can fix:
~/.opencode/model.json) and the ACP session state (session.variant). Clearing the variant in the UI updates only the local store; the ACP session keeps the old value, and the next response re-syncs the stale variant back into the UI — the "ghost variant."Because the fix belongs in OpenCode core (propagate the clear to the ACP session on "Default" selection, and stop blindly overwriting the local variant from the response), we're closing this as outside our scope. We'll revisit if OpenCode ships a hook/API that lets a plugin participate in variant state.
If you'd like, you can link the upstream OpenCode issue here so others can track it.