fix(core): enable numerical routing by default and set threshold fallback to 90

This commit is contained in:
Sehoon Shon
2026-03-11 01:12:55 -04:00
parent f8ad3a200a
commit 30b6e987c6
6 changed files with 89 additions and 136 deletions
+37
View File
@@ -492,6 +492,43 @@ describe('Server Config (config.ts)', () => {
expect(await config.getUserCaching()).toBeUndefined();
});
});
describe('getNumericalRoutingEnabled', () => {
it('should return true by default if there are no experiments', async () => {
const config = new Config(baseParams);
expect(await config.getNumericalRoutingEnabled()).toBe(true);
});
it('should return true if the remote flag is set to true', async () => {
const config = new Config({
...baseParams,
experiments: {
flags: {
[ExperimentFlags.ENABLE_NUMERICAL_ROUTING]: {
boolValue: true,
},
},
experimentIds: [],
},
} as unknown as ConfigParameters);
expect(await config.getNumericalRoutingEnabled()).toBe(true);
});
it('should return false if the remote flag is explicitly set to false', async () => {
const config = new Config({
...baseParams,
experiments: {
flags: {
[ExperimentFlags.ENABLE_NUMERICAL_ROUTING]: {
boolValue: false,
},
},
experimentIds: [],
},
} as unknown as ConfigParameters);
expect(await config.getNumericalRoutingEnabled()).toBe(false);
});
});
});
describe('refreshAuth', () => {
+6 -2
View File
@@ -2508,8 +2508,12 @@ export class Config implements McpContext, AgentLoopContext {
async getNumericalRoutingEnabled(): Promise<boolean> {
await this.ensureExperimentsLoaded();
return !!this.experiments?.flags[ExperimentFlags.ENABLE_NUMERICAL_ROUTING]
?.boolValue;
const flag =
this.experiments?.flags[ExperimentFlags.ENABLE_NUMERICAL_ROUTING];
if (flag?.boolValue !== undefined) {
return flag.boolValue;
}
return true;
}
async getClassifierThreshold(): Promise<number | undefined> {