Skip to content

fix: preserve user-selected model when switching agents#175

Closed
Jianfei1030 wants to merge 8 commits into
XiaomiMiMo:mainfrom
Jianfei1030:fix/model-selection-lost-on-agent-switch
Closed

fix: preserve user-selected model when switching agents#175
Jianfei1030 wants to merge 8 commits into
XiaomiMiMo:mainfrom
Jianfei1030:fix/model-selection-lost-on-agent-switch

Conversation

@Jianfei1030

Copy link
Copy Markdown

Problem

When switching between agents (e.g., build → plan → build), the model selection resets to the agent's default, losing the user's manual /model\ choice.

Root Cause

In \packages/opencode/src/cli/cmd/tui/context/local.tsx, the \createEffect\ on agent change unconditionally overwrites the model whenever \�alue.model\ is set (line 432).

Fix

  • Add \hasUserSet(agentName)\ method to \modelStore\ that checks if the user manually selected a model for a given agent
  • Guard the effect with !model.hasUserSet(value.name)\ so user choices are preserved across agent switches

Changes

Only \packages/opencode/src/cli/cmd/tui/context/local.tsx\ is modified (+4/-1 lines).

qiaozongming and others added 8 commits June 11, 2026 01:23
docs: correct OpenCode repository URL in README files
…-qrcode

docs: update community group chat QR code
When switching between agents (e.g., build → plan → build), the model
selection was reset to the agent's default, losing the user's manual
/model choice.

The createEffect on agent change unconditionally overwrote the model
whenever value.model was set. Add hasUserSet() to check if the user
manually selected a model for the current agent, and guard the effect
so user choices are preserved across agent switches.
@qiaozongming

Copy link
Copy Markdown
Collaborator

#955

@qiaozongming

Copy link
Copy Markdown
Collaborator

#1106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants