fix: scope flash model names per auth type for Vertex AI and Gateway backends#27760
fix: scope flash model names per auth type for Vertex AI and Gateway backends#27760ibarsi wants to merge 4 commits into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a configuration issue where non-AI Studio backends were incorrectly defaulting to an unsupported model name when Gemini 3.5 Flash GA access was enabled. By standardizing the model resolution logic, the fix ensures consistent behavior across all authentication types and resolves deployment errors on Vertex AI. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
📊 PR Size: size/S
|
There was a problem hiding this comment.
Code Review
This pull request simplifies the configuration of default Gemini Flash models when access is granted, removing the conditional check on authType so that gemini-3-flash-preview and gemini-3.5-flash are always set. The corresponding unit tests are updated to reflect this change. Feedback highlights that the test suite mutates module-level global variables without resetting them, which can lead to test flakiness, and suggests adding an afterEach block to restore the default values.
The `hasGemini35FlashGAAccess()` method branched on auth type when setting flash model names: AI Studio got `gemini-3.5-flash` while Vertex AI and Gateway got `gemini-3-flash`. The latter does not exist on Vertex AI, causing ModelNotFoundError for any flash model request. Remove the auth-type conditional so all backends use `gemini-3.5-flash` when GA access is enabled. Fixes google-gemini#27759
Preserve gemini-3-flash alias for Gateway/LOGIN_WITH_GOOGLE backends that may not accept the gemini-3.5-flash model name directly.
Prevents false positives from leaked state when tests run sequentially with the same expected values.
7f5b8c8 to
af06bec
Compare
Use gemini-3.5-flash for both preview and default on Vertex AI, matching the intent of the upstream model mapping fix.
Summary
Fixes #27759
The
hasGemini35FlashGAAccess()method previously applied the same flash model names to all non-AI-Studio backends. This caused issues because different backends resolve model names differently:gemini-3.5-flashbut not the oldergemini-3-flashalias, which results in aModelNotFoundErrorLOGIN_WITH_GOOGLEmay not acceptgemini-3.5-flashdirectly and needs thegemini-3-flashaliasFix
Split the
elsebranch into explicit cases per auth type:USE_GEMINI(AI Studio)gemini-3-flash-previewgemini-3.5-flashUSE_VERTEX_AIgemini-3.5-flashgemini-3.5-flashgemini-3-flashgemini-3-flashAlso adds
afterEachcleanup in the test suite to reset flash model globals between tests, preventing cross-test contamination.Test plan
USE_VERTEX_AIauth type asserting both models aregemini-3.5-flashUSE_GEMINItest to useLOGIN_WITH_GOOGLEand assertgemini-3-flashfor both modelsafterEachto reset model globals between testshasGemini35FlashGAAccessconfig tests pass