@@ -87,6 +87,7 @@ import {
8787 isGemini2Model ,
8888 PREVIEW_GEMINI_FLASH_MODEL ,
8989 resolveModel ,
90+ setFlashModels ,
9091} from './models.js' ;
9192import { shouldAttemptBrowserLaunch } from '../utils/browser.js' ;
9293import type { MCPOAuthConfig } from '../mcp/oauth-provider.js' ;
@@ -2055,6 +2056,7 @@ export class Config implements McpContext, AgentLoopContext {
20552056 this . getUseCustomToolModelSync ( ) ,
20562057 this . getHasAccessToPreviewModel ( ) ,
20572058 this ,
2059+ this . hasGemini35FlashGAAccess ( ) ,
20582060 ) ;
20592061
20602062 const isPreview = isPreviewModel ( primaryModel , this ) ;
@@ -2094,6 +2096,7 @@ export class Config implements McpContext, AgentLoopContext {
20942096 this . getUseCustomToolModelSync ( ) ,
20952097 this . getHasAccessToPreviewModel ( ) ,
20962098 this ,
2099+ this . hasGemini35FlashGAAccess ( ) ,
20972100 ) ;
20982101 return this . modelQuotas . get ( primaryModel ) ?. remaining ;
20992102 }
@@ -2109,6 +2112,7 @@ export class Config implements McpContext, AgentLoopContext {
21092112 this . getUseCustomToolModelSync ( ) ,
21102113 this . getHasAccessToPreviewModel ( ) ,
21112114 this ,
2115+ this . hasGemini35FlashGAAccess ( ) ,
21122116 ) ;
21132117 return this . modelQuotas . get ( primaryModel ) ?. limit ;
21142118 }
@@ -2124,6 +2128,7 @@ export class Config implements McpContext, AgentLoopContext {
21242128 this . getUseCustomToolModelSync ( ) ,
21252129 this . getHasAccessToPreviewModel ( ) ,
21262130 this ,
2131+ this . hasGemini35FlashGAAccess ( ) ,
21272132 ) ;
21282133 return this . modelQuotas . get ( primaryModel ) ?. resetTime ;
21292134 }
@@ -3538,6 +3543,32 @@ export class Config implements McpContext, AgentLoopContext {
35383543 ) ;
35393544 }
35403545
3546+ /**
3547+ * Returns whether Gemini 3.5 Flash GA has been launched.
3548+ *
3549+ * Note: This method should only be called after startup, once experiments have been loaded.
3550+ */
3551+ hasGemini35FlashGAAccess ( ) : boolean {
3552+ const authType = this . contentGeneratorConfig ?. authType ;
3553+ const hasAccess = ( ( ) => {
3554+ if ( this . isGemini31LaunchedForAuthType ( authType ) ) {
3555+ return true ;
3556+ }
3557+ return (
3558+ this . experiments ?. flags [ ExperimentFlags . GEMINI_3_5_FLASH_GA_LAUNCHED ]
3559+ ?. boolValue ?? false
3560+ ) ;
3561+ } ) ( ) ;
3562+ // Used to set default flash models based on access
3563+ // TODO: Remove once the experiment for 3_5 flash rollut can be cleaned up.
3564+ if ( hasAccess ) {
3565+ setFlashModels ( 'gemini-3.5-flash' , 'gemini-3.5-flash' ) ;
3566+ } else {
3567+ setFlashModels ( 'gemini-3-flash-preview' , 'gemini-2.5-flash' ) ;
3568+ }
3569+ return hasAccess ;
3570+ }
3571+
35413572 /**
35423573 * Returns whether Gemini 3.1 has been launched.
35433574 *
0 commit comments