fix: pass through custom model names in Gemini provider#12137
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: pass through custom model names in Gemini provider#12137roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
…lling back to default
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.
Related GitHub Issue
Closes: #12136
Description
This PR attempts to address Issue #12136. Feedback and guidance are welcome.
Root cause: In
src/api/providers/gemini.ts, thegetModel()method checked if the user-provided model ID existed in the predefinedgeminiModelsmap. If not found, it silently fell back togeminiDefaultModelId(gemini-3.1-pro) instead of passing through the custom model name.Fix: Updated
getModel()to handle three cases (matching the pattern already applied tovertex.tsin commit 9724a28 for #12074):modelIdis ingeminiModels: use the curated ModelInfo (existing behavior).modelIdis provided but not in the map: pass it through as-is with sensible default ModelInfo (new -- fixes the bug).modelIdis provided: fall back togeminiDefaultModelId(existing behavior).Test Procedure
gemini.spec.tsthat previously asserted custom models fall back to the default. It now verifies custom model names are passed through as-is.gemini.spec.tspass. All 17 tests invertex.spec.tsandgemini-handler.spec.tscontinue to pass.cd src && npx vitest run api/providers/__tests__/gemini.spec.tsPre-Submission Checklist
Documentation Updates
Additional Notes
This is structurally identical to the fix already applied for Vertex AI in #12074 (commit 9724a28). The same silent-fallback pattern existed in the Gemini provider and is now resolved with the same approach.
Interactively review PR in Roo Code Cloud