fix(routing): fix resolveClassifierModel argument mismatch in ApprovalModeStrategy (#26658)

Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
Daniel Weis
2026-05-07 15:34:14 -04:00
committed by GitHub
parent 49456e4e15
commit ac31e80984
4 changed files with 38 additions and 1 deletions
@@ -43,6 +43,8 @@ describe('ApprovalModeStrategy', () => {
getApprovedPlanPath: vi.fn().mockReturnValue(undefined),
getPlanModeRoutingEnabled: vi.fn().mockResolvedValue(true),
getGemini31Launched: vi.fn().mockResolvedValue(false),
getGemini31FlashLiteLaunched: vi.fn().mockResolvedValue(false),
getHasAccessToPreviewModel: vi.fn().mockReturnValue(true),
getUseCustomToolModel: vi.fn().mockImplementation(async () => {
const launched = await mockConfig.getGemini31Launched();
const authType = mockConfig.getContentGeneratorConfig?.()?.authType;
@@ -48,9 +48,16 @@ export class ApprovalModeStrategy implements RoutingStrategy {
const approvalMode = config.getApprovalMode();
const approvedPlanPath = config.getApprovedPlanPath();
const [useGemini3_1, useCustomToolModel] = await Promise.all([
const [
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
] = await Promise.all([
config.getGemini31Launched(),
config.getGemini31FlashLiteLaunched(),
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel(),
]);
// 1. Planning Phase: If ApprovalMode === PLAN, explicitly route to the Pro model.
@@ -59,7 +66,10 @@ export class ApprovalModeStrategy implements RoutingStrategy {
model,
GEMINI_MODEL_ALIAS_PRO,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
);
return {
model: proModel,
@@ -75,7 +85,10 @@ export class ApprovalModeStrategy implements RoutingStrategy {
model,
GEMINI_MODEL_ALIAS_FLASH,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
);
return {
model: flashModel,
@@ -38,6 +38,10 @@ describe('GemmaClassifierStrategy', () => {
}),
getModel: () => DEFAULT_GEMINI_MODEL,
getPreviewFeatures: () => false,
getGemini31Launched: vi.fn().mockResolvedValue(false),
getGemini31FlashLiteLaunched: vi.fn().mockResolvedValue(false),
getUseCustomToolModel: vi.fn().mockResolvedValue(false),
getHasAccessToPreviewModel: vi.fn().mockReturnValue(true),
} as unknown as Config;
strategy = new GemmaClassifierStrategy();
@@ -209,9 +209,27 @@ ${formattedHistory}
const reasoning = routerResponse.reasoning;
const latencyMs = Date.now() - startTime;
const [
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
] = await Promise.all([
config.getGemini31Launched(),
config.getGemini31FlashLiteLaunched(),
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel?.() ?? true,
]);
const selectedModel = resolveClassifierModel(
context.requestedModel ?? config.getModel(),
routerResponse.model_choice,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
);
return {