Revert "Per-Auth Method Feature Flag for Model Routing (#11333)" (#11597)

This commit is contained in:
Abhi
2025-10-21 14:36:02 -04:00
committed by GitHub
parent cb8f93bad7
commit 2c93542e5c
3 changed files with 13 additions and 57 deletions

View File

@@ -85,7 +85,6 @@ vi.mock('@google/gemini-cli-core', async () => {
const actualServer = await vi.importActual<typeof ServerConfig>(
'@google/gemini-cli-core',
);
return {
...actualServer,
IdeClient: {

View File

@@ -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);
});
});

View File

@@ -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 (