fix(model-resolver): respect UI model selection in agent initialization #1158
+103
−14
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.
Summary
ProviderModelNotFoundErrorcrash when user selects model in OpenCode UI but config has no model overrideChanges
src/shared/model-resolver.ts: AdduiSelectedModelparameter toExtendedModelResolutionInputtype andresolveModelWithFallback()function. UI selection now takes highest priority (Step 1) in model resolution chain.src/agents/utils.ts: AdduiSelectedModelparameter tocreateBuiltinAgents()and pass it to allresolveModelWithFallback()calls for Sisyphus, Atlas, and other agents.src/plugin-handlers/config-handler.ts: Passconfig.model(OpenCode's active model including UI selection) asuiSelectedModeltocreateBuiltinAgents()and Prometheus model resolution.src/shared/model-resolver.test.ts: Add test cases for UI model selection priority, including edge cases for empty/whitespace values.Screenshots
N/A - Backend logic change, no UI modifications.
Testing
bun run typecheck
bun test model-resolver
bun run buildManual testing:
opencode/some-model)oh-my-opencode.jsonconfigProviderModelNotFoundErrorRelated Issues
#959
Summary by cubic
Fixes agents ignoring the model chosen in the OpenCode UI by making UI selection the top priority. Prevents ProviderModelNotFoundError when config has no model.
Written for commit 01dd899. Summary will update on new commits.