Skip to content

Desktop v2: Model dropdown resets to first alphabetical model after sending a message #30860

@alferd0806

Description

@alferd0806

Description

In Desktop v2 (new SolidJS UI), after sending a message, the model dropdown in the prompt input resets to the first available model alphabetically (e.g., alibaba-cn/kimi-*).

However, the actual message is still processed with the originally selected model — this is purely a visual UI bug where the dropdown selection state is lost after submit.

Desktop v1 (legacy UI) and TUI do not have this issue. The TUI had a similar bug which was fixed in PR #25993.

Steps to Reproduce

  1. Open OpenCode Desktop v2 (new UI design)
  2. Select a non-alphabetically-first model from the dropdown (e.g., opencode/deepseek-v4-flash-free)
  3. Type a message and press Enter
  4. Observed: The model dropdown immediately switches to alibaba-cn/kimi-* (or whichever provider/model is alphabetically first in your connected providers list)
  5. The next message — if sent without manually re-selecting — uses the wrong model

Expected Behavior

The model dropdown should preserve the user's selection across message sends. After sending a message, the dropdown should still show the model that was selected before sending.

Environment

  • OpenCode Desktop version: 1.15.13 (also confirmed on 1.16.0)
  • Channel: latest
  • OS: macOS (Apple Silicon)
  • Plugins: oh-my-openagent, @tarquinen/opencode-dcp
  • UI variant: Desktop v2 (newLayoutDesigns = true)

Confirmed: Visual Only

The actual message processing uses the correct model. Evidence:

  • SQLite database shows 531+ messages all using opencode/deepseek-v4-flash-free
  • No model-switched events recorded in the DB
  • Response content confirms the intended model was used

Root Cause Analysis

The model dropdown reads from local.model.current() in packages/app/src/context/local.tsx. The resolution chain is:

scope()?.model → agent.current()?.model → fallback
                                               ↓
                       configuredModel() ?? recentModel() ?? defaultModel()
                                                                ↓
                                             first connected provider's first model

After message submit, SolidJS reactivity causes scope()?.model to briefly become undefined, causing the chain to fall through to defaultModel(), which returns the first model from the first connected provider (sorted by insertion order — typically alphabetical provider ID).

Related

Suggested Fix

Ensure that the model selection is preserved in local.tsx during the submit flow. The scope()?.model should remain stable after local.session.promote() is called and should not be invalidated by the reactivity chain that follows message submission.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions