From 1b327bbe3819c24eeb1052617c1160aaae2ec6d3 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Thu, 11 Dec 2025 23:48:35 +0000 Subject: [PATCH] feat: add "Enable Reasoning" checkbox for Bedrock custom ARNs - Add awsCustomArnEnableReasoning field to ProviderSettings type - Add UI checkbox in Bedrock settings when custom ARN is used - Update bedrock.ts logic to check awsCustomArnEnableReasoning for custom ARNs - Only enable reasoning for custom ARNs when explicitly enabled by user - Fixes issue where custom ARNs like Nova Lite received unsupported reasoning flag Addresses #10040 --- packages/types/src/provider-settings.ts | 1 + src/api/providers/bedrock.ts | 15 +++++++++++++-- .../src/components/settings/providers/Bedrock.tsx | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/packages/types/src/provider-settings.ts b/packages/types/src/provider-settings.ts index a8f1dbde722..676cf262c55 100644 --- a/packages/types/src/provider-settings.ts +++ b/packages/types/src/provider-settings.ts @@ -226,6 +226,7 @@ const bedrockSchema = apiModelIdProviderModelSchema.extend({ awsApiKey: z.string().optional(), awsUseApiKey: z.boolean().optional(), awsCustomArn: z.string().optional(), + awsCustomArnEnableReasoning: z.boolean().optional(), // Enable reasoning for custom ARNs awsModelContextWindow: z.number().optional(), awsBedrockEndpointEnabled: z.boolean().optional(), awsBedrockEndpoint: z.string().optional(), diff --git a/src/api/providers/bedrock.ts b/src/api/providers/bedrock.ts index 4a4adfc0f41..d7296c859ac 100644 --- a/src/api/providers/bedrock.ts +++ b/src/api/providers/bedrock.ts @@ -384,7 +384,13 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH modelConfig.reasoning && modelConfig.reasoningBudget - if ((isThinkingExplicitlyEnabled || isThinkingEnabledBySettings) && modelConfig.info.supportsReasoningBudget) { + // For custom ARNs, only enable reasoning if explicitly enabled via the awsCustomArnEnableReasoning setting + // For regular models, use the standard logic + const shouldEnableThinking = this.options.awsCustomArn + ? this.options.awsCustomArnEnableReasoning && modelConfig.info.supportsReasoningBudget + : (isThinkingExplicitlyEnabled || isThinkingEnabledBySettings) && modelConfig.info.supportsReasoningBudget + + if (shouldEnableThinking) { thinkingEnabled = true additionalModelRequestFields = { thinking: { @@ -717,11 +723,16 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH // For completePrompt, thinking is typically not used, but we should still check // if thinking was somehow enabled in the model config - const thinkingEnabled = + // For custom ARNs, only enable if explicitly set via awsCustomArnEnableReasoning + const thinkingEnabledBySettings = shouldUseReasoningBudget({ model: modelConfig.info, settings: this.options }) && modelConfig.reasoning && modelConfig.reasoningBudget + const thinkingEnabled = this.options.awsCustomArn + ? this.options.awsCustomArnEnableReasoning && modelConfig.reasoning && modelConfig.reasoningBudget + : thinkingEnabledBySettings + const inferenceConfig: BedrockInferenceConfig = { maxTokens: modelConfig.maxTokens || (modelConfig.info.maxTokens as number), temperature: modelConfig.temperature ?? (this.options.modelTemperature as number), diff --git a/webview-ui/src/components/settings/providers/Bedrock.tsx b/webview-ui/src/components/settings/providers/Bedrock.tsx index fac75170e96..fac11e5929b 100644 --- a/webview-ui/src/components/settings/providers/Bedrock.tsx +++ b/webview-ui/src/components/settings/providers/Bedrock.tsx @@ -226,6 +226,20 @@ export const Bedrock = ({ apiConfiguration, setApiConfigurationField, selectedMo )} + {apiConfiguration?.awsCustomArn && ( +
+ { + setApiConfigurationField("awsCustomArnEnableReasoning", checked) + }}> + Enable Reasoning + +
+ Enable extended thinking for this custom ARN. Only enable if the model supports reasoning. +
+
+ )} ) }