refactor(config): use getExperimentValue for existing experiment getters

This commit is contained in:
mkorwel
2026-02-19 16:42:10 -06:00
committed by Matt Korwel
parent d61eed2880
commit bc8acdc309
+15 -21
View File
@@ -3021,9 +3021,7 @@ export class Config implements McpContext, AgentLoopContext {
}
async getUserCaching(): Promise<boolean | undefined> {
await this.ensureExperimentsLoaded();
return this.experiments?.flags[ExperimentFlags.USER_CACHING]?.boolValue;
return this.getExperimentValue<boolean>(ExperimentFlags.USER_CACHING);
}
async getPlanModeRoutingEnabled(): Promise<boolean> {
@@ -3031,11 +3029,11 @@ export class Config implements McpContext, AgentLoopContext {
}
async getNumericalRoutingEnabled(): Promise<boolean> {
await this.ensureExperimentsLoaded();
const flag =
this.experiments?.flags[ExperimentFlags.ENABLE_NUMERICAL_ROUTING];
return flag?.boolValue ?? true;
return (
this.getExperimentValue<boolean>(
ExperimentFlags.ENABLE_NUMERICAL_ROUTING,
) ?? false
);
}
/**
@@ -3060,28 +3058,24 @@ export class Config implements McpContext, AgentLoopContext {
}
async getClassifierThreshold(): Promise<number | undefined> {
await this.ensureExperimentsLoaded();
const flag = this.experiments?.flags[ExperimentFlags.CLASSIFIER_THRESHOLD];
if (flag?.intValue !== undefined) {
return parseInt(flag.intValue, 10);
}
return flag?.floatValue;
return this.getExperimentValue<number>(
ExperimentFlags.CLASSIFIER_THRESHOLD,
);
}
async getBannerTextNoCapacityIssues(): Promise<string> {
await this.ensureExperimentsLoaded();
return (
this.experiments?.flags[ExperimentFlags.BANNER_TEXT_NO_CAPACITY_ISSUES]
?.stringValue ?? ''
this.getExperimentValue<string>(
ExperimentFlags.BANNER_TEXT_NO_CAPACITY_ISSUES,
) ?? ''
);
}
async getBannerTextCapacityIssues(): Promise<string> {
await this.ensureExperimentsLoaded();
return (
this.experiments?.flags[ExperimentFlags.BANNER_TEXT_CAPACITY_ISSUES]
?.stringValue ?? ''
this.getExperimentValue<string>(
ExperimentFlags.BANNER_TEXT_CAPACITY_ISSUES,
) ?? ''
);
}