-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(model-fallback): transform gemini-3 models to -preview for google provider #1435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
fix(model-fallback): transform gemini-3 models to -preview for google provider #1435
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.
|
All contributors have signed the CLA. Thank you! ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
…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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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'.
…odels to -preview for google provider # Conflicts: # src/cli/__snapshots__/model-fallback.test.ts.snap # src/cli/model-fallback.ts
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.