Repository navigation
Switch OpenCode V2 model with approved agent - #1569
Merged
backnotprop merged 1 commit intoSep 18, 2026
Merged
Conversation
OpenCode stores the session agent and model independently, so V2 plan approval could select Build while continuing with Plan's configured model. Carry validated agent model metadata into the approval handoff and apply the two durable session selections in OpenCode's order. Older hosts avoid a partial switch, while switch failures remain non-blocking for approval.
Owner
|
Merged, thanks. Verified against the V2 wire shape (AgentV2Info.model is the ModelRef, so the id/variant read is right) and the CLI bridge path is untouched. One optional follow-up if you feel like it: when the host lacks switchModel but the agent has a configured model, the PR skips the agent switch entirely, while a throwing switchModel keeps the agent and warns. Treating both the same (switch the agent, warn about the model) would remove that inconsistency and keep older hosts switching agents as they did before. Will go out in 0.27.17. |
Contributor
Author
1 task
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.

OpenCode stores the session agent and model independently. Approving a plan currently selects Build while leaving Plan's model active when the agents have different model configurations.
This preserves model metadata from V2 agent discovery and applies
switchAgentfollowed byswitchModel, matching OpenCode's own clients. Hosts that cannot apply both selections avoid a partial switch, and failures continue to leave plan approval intact.