@@ -86,6 +86,7 @@ import {
8686 isGemini2Model ,
8787 PREVIEW_GEMINI_FLASH_MODEL ,
8888 resolveModel ,
89+ setFlashModels ,
8990} from './models.js' ;
9091import { shouldAttemptBrowserLaunch } from '../utils/browser.js' ;
9192import type { MCPOAuthConfig } from '../mcp/oauth-provider.js' ;
@@ -2054,6 +2055,7 @@ export class Config implements McpContext, AgentLoopContext {
20542055 this . getUseCustomToolModelSync ( ) ,
20552056 this . getHasAccessToPreviewModel ( ) ,
20562057 this ,
2058+ this . hasGemini35FlashGAAccess ( ) ,
20572059 ) ;
20582060
20592061 const isPreview = isPreviewModel ( primaryModel , this ) ;
@@ -2093,6 +2095,7 @@ export class Config implements McpContext, AgentLoopContext {
20932095 this . getUseCustomToolModelSync ( ) ,
20942096 this . getHasAccessToPreviewModel ( ) ,
20952097 this ,
2098+ this . hasGemini35FlashGAAccess ( ) ,
20962099 ) ;
20972100 return this . modelQuotas . get ( primaryModel ) ?. remaining ;
20982101 }
@@ -2108,6 +2111,7 @@ export class Config implements McpContext, AgentLoopContext {
21082111 this . getUseCustomToolModelSync ( ) ,
21092112 this . getHasAccessToPreviewModel ( ) ,
21102113 this ,
2114+ this . hasGemini35FlashGAAccess ( ) ,
21112115 ) ;
21122116 return this . modelQuotas . get ( primaryModel ) ?. limit ;
21132117 }
@@ -2123,6 +2127,7 @@ export class Config implements McpContext, AgentLoopContext {
21232127 this . getUseCustomToolModelSync ( ) ,
21242128 this . getHasAccessToPreviewModel ( ) ,
21252129 this ,
2130+ this . hasGemini35FlashGAAccess ( ) ,
21262131 ) ;
21272132 return this . modelQuotas . get ( primaryModel ) ?. resetTime ;
21282133 }
@@ -3537,6 +3542,32 @@ export class Config implements McpContext, AgentLoopContext {
35373542 ) ;
35383543 }
35393544
3545+ /**
3546+ * Returns whether Gemini 3.5 Flash GA has been launched.
3547+ *
3548+ * Note: This method should only be called after startup, once experiments have been loaded.
3549+ */
3550+ hasGemini35FlashGAAccess ( ) : boolean {
3551+ const authType = this . contentGeneratorConfig ?. authType ;
3552+ const hasAccess = ( ( ) => {
3553+ if ( this . isGemini31LaunchedForAuthType ( authType ) ) {
3554+ return true ;
3555+ }
3556+ return (
3557+ this . experiments ?. flags [ ExperimentFlags . GEMINI_3_5_FLASH_GA_LAUNCHED ]
3558+ ?. boolValue ?? false
3559+ ) ;
3560+ } ) ( ) ;
3561+ // Used to set default flash models based on access
3562+ // TODO: Remove once the experiment for 3_5 flash rollut can be cleaned up.
3563+ if ( hasAccess ) {
3564+ setFlashModels ( 'gemini-3.5-flash' , 'gemini-3.5-flash' ) ;
3565+ } else {
3566+ setFlashModels ( 'gemini-3-flash-preview' , 'gemini-2.5-flash' ) ;
3567+ }
3568+ return hasAccess ;
3569+ }
3570+
35403571 /**
35413572 * Returns whether Gemini 3.1 has been launched.
35423573 *
0 commit comments