From bc8acdc309ffe01ff1e96e89e967d407a5ae03a7 Mon Sep 17 00:00:00 2001 From: mkorwel Date: Thu, 19 Feb 2026 16:42:10 -0600 Subject: [PATCH] refactor(config): use getExperimentValue for existing experiment getters --- packages/core/src/config/config.ts | 36 +++++++++++++----------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index d5be84a453..dadbda15d3 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -3021,9 +3021,7 @@ export class Config implements McpContext, AgentLoopContext { } async getUserCaching(): Promise { - await this.ensureExperimentsLoaded(); - - return this.experiments?.flags[ExperimentFlags.USER_CACHING]?.boolValue; + return this.getExperimentValue(ExperimentFlags.USER_CACHING); } async getPlanModeRoutingEnabled(): Promise { @@ -3031,11 +3029,11 @@ export class Config implements McpContext, AgentLoopContext { } async getNumericalRoutingEnabled(): Promise { - await this.ensureExperimentsLoaded(); - - const flag = - this.experiments?.flags[ExperimentFlags.ENABLE_NUMERICAL_ROUTING]; - return flag?.boolValue ?? true; + return ( + this.getExperimentValue( + ExperimentFlags.ENABLE_NUMERICAL_ROUTING, + ) ?? false + ); } /** @@ -3060,28 +3058,24 @@ export class Config implements McpContext, AgentLoopContext { } async getClassifierThreshold(): Promise { - 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( + ExperimentFlags.CLASSIFIER_THRESHOLD, + ); } async getBannerTextNoCapacityIssues(): Promise { - await this.ensureExperimentsLoaded(); return ( - this.experiments?.flags[ExperimentFlags.BANNER_TEXT_NO_CAPACITY_ISSUES] - ?.stringValue ?? '' + this.getExperimentValue( + ExperimentFlags.BANNER_TEXT_NO_CAPACITY_ISSUES, + ) ?? '' ); } async getBannerTextCapacityIssues(): Promise { - await this.ensureExperimentsLoaded(); return ( - this.experiments?.flags[ExperimentFlags.BANNER_TEXT_CAPACITY_ISSUES] - ?.stringValue ?? '' + this.getExperimentValue( + ExperimentFlags.BANNER_TEXT_CAPACITY_ISSUES, + ) ?? '' ); }