fix(core): prevent model router from overriding explicit model choice (#12399)

This commit is contained in:
Abhi
2025-10-31 17:02:22 -04:00
committed by GitHub
parent 8b93a5f27d
commit fd2cbacae9
3 changed files with 13 additions and 3 deletions

View File

@@ -634,6 +634,19 @@ describe('Server Config (config.ts)', () => {
expect(config.getUseModelRouter()).toBe(true);
expect(config.getModel()).toBe(chosenModel);
});
it('should NOT switch to auto model if cli provides specific model, even if router is enabled', async () => {
const config = new Config({
...baseParams,
useModelRouter: true,
model: 'gemini-flash-latest',
});
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
expect(config.getUseModelRouter()).toBe(true);
expect(config.getModel()).toBe('gemini-flash-latest');
});
});
describe('ContinueOnFailedApiCall Configuration', () => {

View File

@@ -562,8 +562,6 @@ export class Config {
if (this.model === DEFAULT_GEMINI_MODEL_AUTO) {
this.model = DEFAULT_GEMINI_MODEL;
}
} else if (this.useModelRouter && this.model === DEFAULT_GEMINI_MODEL) {
this.model = DEFAULT_GEMINI_MODEL_AUTO;
}
// Vertex and Genai have incompatible encryption and sending history with