fix(model-fallback): transform gemini-3 models to -preview for google provider#1435
Open
filipemsilv4 wants to merge 3 commits intocode-yeongyu:devfrom
Open
Conversation
… provider Google provider only has gemini-3-flash-preview and gemini-3-pro-preview, not gemini-3-flash and gemini-3-pro. This was causing ProviderModelNotFoundError when subagents tried to use these models via the google provider. The fix adds the same transformation that was already applied for github-copilot provider to the google provider as well.
Contributor
|
All contributors have signed the CLA. Thank you! ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
…n pipeline The previous fix only addressed config generation (model-fallback.ts). This commit fixes the runtime model resolution when availableModels is empty but connected providers cache exists. Without this fix, the pipeline returns 'google/gemini-3-pro' directly without transformation, causing ProviderModelNotFoundError in opencode since Google provider only has 'gemini-3-pro-preview'.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/shared/model-resolution-pipeline.ts">
<violation number="1" location="src/shared/model-resolution-pipeline.ts:10">
P2: transformModelForProvider performs unconditional substring replacement, so models already containing the preview suffix (e.g., gemini-3-flash-preview) will be transformed to gemini-3-flash-preview-preview or mutate other variants. This non-idempotent transformation can generate invalid model IDs when inputs are already preview models.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
… suffix Use negative lookahead (?!-) to only transform base model names like 'gemini-3-pro' and 'gemini-3-flash', not models that already have suffixes like '-preview', '-high', '-low', '-medium'. This prevents 'gemini-3-flash-preview' from becoming 'gemini-3-flash-preview-preview'.
leoisadev1
pushed a commit
to leoisadev1/oh-my-opencode
that referenced
this pull request
Feb 3, 2026
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.
Summary
Fix ProviderModelNotFoundError when subagents try to use Gemini 3 models via the Google provider.
Problem
When a subagent attempts to use
google/gemini-3-flashorgoogle/gemini-3-pro, opencode throws:This happens because the Google provider only has
gemini-3-flash-previewandgemini-3-pro-previewregistered - not the base model names without the-previewsuffix.Solution
Add the same model name transformation for the
googleprovider that was already implemented for thegithub-copilotprovider:gemini-3-flash→gemini-3-flash-previewgemini-3-pro→gemini-3-pro-previewChanges
transformModelForProvider()functionTesting
Summary by cubic
Fixes ProviderModelNotFoundError by mapping Google Gemini 3 model names to their preview variants across config generation and runtime resolution. Subagents can now use Google Gemini 3 without errors.
Written for commit 72481a3. Summary will update on new commits.