Skip to content

fix: scope flash model names per auth type for Vertex AI and Gateway backends#27760

Open
ibarsi wants to merge 4 commits into
google-gemini:mainfrom
ibarsi:ibarsi/27759/fix-3.5-flash-vertex
Open

fix: scope flash model names per auth type for Vertex AI and Gateway backends#27760
ibarsi wants to merge 4 commits into
google-gemini:mainfrom
ibarsi:ibarsi/27759/fix-3.5-flash-vertex

Conversation

@ibarsi

@ibarsi ibarsi commented Jun 9, 2026

Copy link
Copy Markdown

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:

  • Vertex AI accepts gemini-3.5-flash but not the older gemini-3-flash alias, which results in a ModelNotFoundError
  • Gateway / LOGIN_WITH_GOOGLE may not accept gemini-3.5-flash directly and needs the gemini-3-flash alias

Fix

Split the else branch into explicit cases per auth type:

Auth type Preview model Default model
USE_GEMINI (AI Studio) gemini-3-flash-preview gemini-3.5-flash
USE_VERTEX_AI gemini-3.5-flash gemini-3.5-flash
Other (Gateway) gemini-3-flash gemini-3-flash

Also adds afterEach cleanup in the test suite to reset flash model globals between tests, preventing cross-test contamination.

Test plan

  • Added dedicated test for USE_VERTEX_AI auth type asserting both models are gemini-3.5-flash
  • Updated existing non-USE_GEMINI test to use LOGIN_WITH_GOOGLE and assert gemini-3-flash for both models
  • Added afterEach to reset model globals between tests
  • All hasGemini35FlashGAAccess config tests pass

@ibarsi ibarsi requested a review from a team as a code owner June 9, 2026 17:07
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Unified Model Configuration: Removed the auth-type conditional logic in hasGemini35FlashGAAccess to ensure all backends, including Vertex AI, consistently use the correct 'gemini-3.5-flash' model.
  • Bug Fix: Resolved a 'ModelNotFoundError' occurring on Vertex AI by preventing the system from defaulting to the non-existent 'gemini-3-flash' model.
  • Test Suite Update: Updated configuration tests to validate that 'USE_VERTEX_AI' correctly resolves to the expected Gemini 3.5 Flash model names.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the size/s A small PR label Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

📊 PR Size: size/S

  • Lines changed: 30
  • Additions: +22
  • Deletions: -8
  • Files changed: 2

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/core/src/config/config.test.ts Outdated
@gemini-cli gemini-cli Bot added priority/p1 Important and should be addressed in the near term. area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Jun 9, 2026
ibarsi added 3 commits June 10, 2026 09:23
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.
@ibarsi ibarsi force-pushed the ibarsi/27759/fix-3.5-flash-vertex branch from 7f5b8c8 to af06bec Compare June 10, 2026 13:24
Use gemini-3.5-flash for both preview and default on Vertex AI,
matching the intent of the upstream model mapping fix.
@ibarsi ibarsi changed the title fix: use gemini-3.5-flash for all auth types including Vertex AI fix: scope flash model names per auth type for Vertex AI and Gateway backends Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p1 Important and should be addressed in the near term. size/s A small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertex AI: flash model router maps to non-existent gemini-3-flash

1 participant