fix: preserve user-selected model when switching agents#175
Closed
Jianfei1030 wants to merge 8 commits into
Closed
fix: preserve user-selected model when switching agents#175Jianfei1030 wants to merge 8 commits into
Jianfei1030 wants to merge 8 commits into
Conversation
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.
97aefc0 to
ab53d06
Compare
Collaborator
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Changes
Only \packages/opencode/src/cli/cmd/tui/context/local.tsx\ is modified (+4/-1 lines).