From 1b1e96222178a21a67fcc3a1d589ed04e0fa3b0b Mon Sep 17 00:00:00 2001 From: backryun Date: Tue, 28 Jul 2026 10:38:08 +0900 Subject: [PATCH] fix(types): preserve reasoning policy record shapes (#8811) --- src/lib/reasoningRouting/policy.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/reasoningRouting/policy.ts b/src/lib/reasoningRouting/policy.ts index 502b4f4e843..54647a9badb 100644 --- a/src/lib/reasoningRouting/policy.ts +++ b/src/lib/reasoningRouting/policy.ts @@ -127,7 +127,7 @@ function detectThinkingBudget( thinking: JsonRecord, thinkingConfig: JsonRecord ): boolean { - return [ + const budgetFields: Array<[JsonRecord, string]> = [ [thinking, "budget_tokens"], [thinking, "budgetTokens"], [reasoning, "budget_tokens"], @@ -137,7 +137,8 @@ function detectThinkingBudget( [body, "thinkingBudget"], [thinkingConfig, "thinkingBudget"], [thinkingConfig, "thinking_budget"], - ].some(([record, key]) => hasNumericField(record, key)); + ]; + return budgetFields.some(([record, key]) => hasNumericField(record, key)); } function hasReasoningSignal( @@ -503,7 +504,7 @@ export function attachReasoningRuleDirective( decision: ReasoningRuleDecision ): JsonRecord { const source = asRecord(bodyInput); - const body = { + const body: JsonRecord = { ...source, model: decision.rule.scope === "connection" ? source.model : decision.targetModel, };