feat(plan): support automatic model switching for Plan Mode (#20240)

This commit is contained in:
Jerop Kipruto
2026-02-24 19:15:14 -05:00
committed by GitHub
parent 1f9da6723f
commit bf278ef2b0
19 changed files with 422 additions and 31 deletions
+23
View File
@@ -2533,6 +2533,29 @@ describe('Config Quota & Preview Model Access', () => {
expect(config.isPlanEnabled()).toBe(false);
});
});
describe('getPlanModeRoutingEnabled', () => {
it('should default to true when not provided', async () => {
const config = new Config(baseParams);
expect(await config.getPlanModeRoutingEnabled()).toBe(true);
});
it('should return true when explicitly enabled in planSettings', async () => {
const config = new Config({
...baseParams,
planSettings: { modelRouting: true },
});
expect(await config.getPlanModeRoutingEnabled()).toBe(true);
});
it('should return false when explicitly disabled in planSettings', async () => {
const config = new Config({
...baseParams,
planSettings: { modelRouting: false },
});
expect(await config.getPlanModeRoutingEnabled()).toBe(false);
});
});
});
describe('Config JIT Initialization', () => {
+7
View File
@@ -153,6 +153,7 @@ export interface SummarizeToolOutputSettings {
export interface PlanSettings {
directory?: string;
modelRouting?: boolean;
}
export interface TelemetrySettings {
@@ -734,6 +735,7 @@ export class Config {
private readonly experimentalJitContext: boolean;
private readonly disableLLMCorrection: boolean;
private readonly planEnabled: boolean;
private readonly planModeRoutingEnabled: boolean;
private readonly modelSteering: boolean;
private contextManager?: ContextManager;
private terminalBackground: string | undefined = undefined;
@@ -823,6 +825,7 @@ export class Config {
this.agents = params.agents ?? {};
this.disableLLMCorrection = params.disableLLMCorrection ?? true;
this.planEnabled = params.plan ?? false;
this.planModeRoutingEnabled = params.planSettings?.modelRouting ?? true;
this.enableEventDrivenScheduler = params.enableEventDrivenScheduler ?? true;
this.skillsSupport = params.skillsSupport ?? true;
this.disabledSkills = params.disabledSkills ?? [];
@@ -2318,6 +2321,10 @@ export class Config {
return this.experiments?.flags[ExperimentFlags.USER_CACHING]?.boolValue;
}
async getPlanModeRoutingEnabled(): Promise<boolean> {
return this.planModeRoutingEnabled;
}
async getNumericalRoutingEnabled(): Promise<boolean> {
await this.ensureExperimentsLoaded();