From 1b265f343f1891daa2587bba4dbbfadca8e40bf3 Mon Sep 17 00:00:00 2001 From: Sri Pasumarthi <111310667+sripasg@users.noreply.github.com> Date: Tue, 31 Mar 2026 17:25:59 -0700 Subject: [PATCH] fix(core): pin AuthType.GATEWAY to use Gemini 3.1 Pro/Flash Lite by default (#24375) --- packages/core/src/config/config.test.ts | 49 +++++++++++++++++++++++++ packages/core/src/config/config.ts | 18 +++++---- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/packages/core/src/config/config.test.ts b/packages/core/src/config/config.test.ts index 9c1a4b45b3..1e5a5d5267 100644 --- a/packages/core/src/config/config.test.ts +++ b/packages/core/src/config/config.test.ts @@ -591,6 +591,55 @@ describe('Server Config (config.ts)', () => { expect(await config.getResolvedClassifierThreshold()).toBe(90); }); }); + + describe('getGemini31LaunchedSync', () => { + it.each([AuthType.USE_GEMINI, AuthType.USE_VERTEX_AI, AuthType.GATEWAY])( + 'should return true for %s', + async (authType) => { + const config = new Config(baseParams); + vi.mocked(createContentGeneratorConfig).mockResolvedValue({ + authType, + }); + await config.refreshAuth(authType); + expect(config.getGemini31LaunchedSync()).toBe(true); + }, + ); + + it('should fallback to experiments for other auth types', async () => { + vi.mocked(getExperiments).mockResolvedValue({ + experimentIds: [], + flags: { + [ExperimentFlags.GEMINI_3_1_PRO_LAUNCHED]: { + flagId: ExperimentFlags.GEMINI_3_1_PRO_LAUNCHED, + boolValue: true, + }, + }, + }); + + const config = new Config(baseParams); + + vi.mocked(createContentGeneratorConfig).mockResolvedValue({ + authType: AuthType.LOGIN_WITH_GOOGLE, + }); + + await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE); + expect(config.getGemini31LaunchedSync()).toBe(true); + }); + }); + + describe('getGemini31FlashLiteLaunchedSync', () => { + it.each([AuthType.USE_GEMINI, AuthType.USE_VERTEX_AI, AuthType.GATEWAY])( + 'should return true for %s', + async (authType) => { + const config = new Config(baseParams); + vi.mocked(createContentGeneratorConfig).mockResolvedValue({ + authType, + }); + await config.refreshAuth(authType); + expect(config.getGemini31FlashLiteLaunchedSync()).toBe(true); + }, + ); + }); }); describe('refreshAuth', () => { diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index 7ac6628a65..b2d6e32d85 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -3083,6 +3083,14 @@ export class Config implements McpContext, AgentLoopContext { return useGemini3_1 && authType === AuthType.USE_GEMINI; } + private isGemini31LaunchedForAuthType(authType?: AuthType): boolean { + return ( + authType === AuthType.USE_GEMINI || + authType === AuthType.USE_VERTEX_AI || + authType === AuthType.GATEWAY + ); + } + /** * Returns whether Gemini 3.1 has been launched. * @@ -3092,10 +3100,7 @@ export class Config implements McpContext, AgentLoopContext { */ getGemini31LaunchedSync(): boolean { const authType = this.contentGeneratorConfig?.authType; - if ( - authType === AuthType.USE_GEMINI || - authType === AuthType.USE_VERTEX_AI - ) { + if (this.isGemini31LaunchedForAuthType(authType)) { return true; } return ( @@ -3113,10 +3118,7 @@ export class Config implements McpContext, AgentLoopContext { */ getGemini31FlashLiteLaunchedSync(): boolean { const authType = this.contentGeneratorConfig?.authType; - if ( - authType === AuthType.USE_GEMINI || - authType === AuthType.USE_VERTEX_AI - ) { + if (this.isGemini31LaunchedForAuthType(authType)) { return true; } return (