From 2c93542e5c3f30c9fd902b7e4978bdd12f168b78 Mon Sep 17 00:00:00 2001 From: Abhi <43648792+abhipatel12@users.noreply.github.com> Date: Tue, 21 Oct 2025 14:36:02 -0400 Subject: [PATCH] Revert "Per-Auth Method Feature Flag for Model Routing (#11333)" (#11597) --- packages/cli/src/config/config.test.ts | 1 - packages/core/src/config/config.test.ts | 47 ++++++------------------- packages/core/src/config/config.ts | 22 ++---------- 3 files changed, 13 insertions(+), 57 deletions(-) diff --git a/packages/cli/src/config/config.test.ts b/packages/cli/src/config/config.test.ts index 1a8dab99e9..6bc23ad7d6 100644 --- a/packages/cli/src/config/config.test.ts +++ b/packages/cli/src/config/config.test.ts @@ -85,7 +85,6 @@ vi.mock('@google/gemini-cli-core', async () => { const actualServer = await vi.importActual( '@google/gemini-cli-core', ); - return { ...actualServer, IdeClient: { diff --git a/packages/core/src/config/config.test.ts b/packages/core/src/config/config.test.ts index b5e99a5e37..0546f7cba6 100644 --- a/packages/core/src/config/config.test.ts +++ b/packages/core/src/config/config.test.ts @@ -574,52 +574,27 @@ describe('Server Config (config.ts)', () => { }); }); - describe('Model Router with Auth', () => { - it('should disable model router by default for oauth-personal', async () => { - const config = new Config({ - ...baseParams, - useModelRouter: true, - }); - await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE); + describe('UseModelRouter Configuration', () => { + it('should default useModelRouter to false when not provided', () => { + const config = new Config(baseParams); expect(config.getUseModelRouter()).toBe(false); }); - it('should enable model router by default for other auth types', async () => { - const config = new Config({ + it('should set useModelRouter to true when provided as true', () => { + const paramsWithModelRouter: ConfigParameters = { ...baseParams, useModelRouter: true, - }); - await config.refreshAuth(AuthType.USE_GEMINI); + }; + const config = new Config(paramsWithModelRouter); expect(config.getUseModelRouter()).toBe(true); }); - it('should disable model router for specified auth type', async () => { - const config = new Config({ - ...baseParams, - useModelRouter: true, - disableModelRouterForAuth: [AuthType.USE_GEMINI], - }); - await config.refreshAuth(AuthType.USE_GEMINI); - expect(config.getUseModelRouter()).toBe(false); - }); - - it('should enable model router for other auth type', async () => { - const config = new Config({ - ...baseParams, - useModelRouter: true, - disableModelRouterForAuth: [], - }); - await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE); - expect(config.getUseModelRouter()).toBe(true); - }); - - it('should keep model router disabled when useModelRouter is false', async () => { - const config = new Config({ + it('should set useModelRouter to false when explicitly provided as false', () => { + const paramsWithModelRouter: ConfigParameters = { ...baseParams, useModelRouter: false, - disableModelRouterForAuth: [AuthType.USE_GEMINI], - }); - await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE); + }; + const config = new Config(paramsWithModelRouter); expect(config.getUseModelRouter()).toBe(false); }); }); diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index 4955a0f95e..584e928cb0 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -47,7 +47,6 @@ import { DEFAULT_GEMINI_EMBEDDING_MODEL, DEFAULT_GEMINI_FLASH_MODEL, DEFAULT_GEMINI_MODEL, - DEFAULT_GEMINI_MODEL_AUTO, DEFAULT_THINKING_MODE, } from './models.js'; import { shouldAttemptBrowserLaunch } from '../utils/browser.js'; @@ -279,7 +278,6 @@ export interface ConfigParameters { policyEngineConfig?: PolicyEngineConfig; output?: OutputSettings; useModelRouter?: boolean; - disableModelRouterForAuth?: AuthType[]; enableMessageBusIntegration?: boolean; codebaseInvestigatorSettings?: CodebaseInvestigatorSettings; continueOnFailedApiCall?: boolean; @@ -376,9 +374,7 @@ export class Config { private readonly messageBus: MessageBus; private readonly policyEngine: PolicyEngine; private readonly outputSettings: OutputSettings; - private useModelRouter: boolean; - private readonly initialUseModelRouter: boolean; - private readonly disableModelRouterForAuth?: AuthType[]; + private readonly useModelRouter: boolean; private readonly enableMessageBusIntegration: boolean; private readonly codebaseInvestigatorSettings: CodebaseInvestigatorSettings; private readonly continueOnFailedApiCall: boolean; @@ -474,11 +470,7 @@ export class Config { this.enableToolOutputTruncation = params.enableToolOutputTruncation ?? true; this.useSmartEdit = params.useSmartEdit ?? true; this.useWriteTodos = params.useWriteTodos ?? false; - this.initialUseModelRouter = params.useModelRouter ?? false; - this.useModelRouter = this.initialUseModelRouter; - this.disableModelRouterForAuth = params.disableModelRouterForAuth ?? [ - AuthType.LOGIN_WITH_GOOGLE, - ]; + this.useModelRouter = params.useModelRouter ?? false; this.enableMessageBusIntegration = params.enableMessageBusIntegration ?? false; this.codebaseInvestigatorSettings = { @@ -549,16 +541,6 @@ export class Config { } async refreshAuth(authMethod: AuthType) { - this.useModelRouter = this.initialUseModelRouter; - if (this.disableModelRouterForAuth?.includes(authMethod)) { - this.useModelRouter = false; - if (this.model === DEFAULT_GEMINI_MODEL_AUTO) { - this.model = DEFAULT_GEMINI_MODEL; - } - } else { - this.model = DEFAULT_GEMINI_MODEL_AUTO; - } - // Vertex and Genai have incompatible encryption and sending history with // thoughtSignature from Genai to Vertex will fail, we need to strip them if (