From 1542195217be56f29f73cb10a852499f6ef2e688 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Tue, 1 Sep 2026 14:57:55 -0500 Subject: [PATCH] fix(opencode): allow none reasoning effort in Bedrock SDK (#46671) --- .../opencode/test/provider/transform.test.ts | 38 +++++++++++++++++- .../@ai-sdk%2Famazon-bedrock@4.0.166.patch | 40 ++++++++++++++----- 2 files changed, 67 insertions(+), 11 deletions(-) diff --git a/packages/opencode/test/provider/transform.test.ts b/packages/opencode/test/provider/transform.test.ts index ed85f6920a..4d346d8871 100644 --- a/packages/opencode/test/provider/transform.test.ts +++ b/packages/opencode/test/provider/transform.test.ts @@ -6,7 +6,7 @@ import { ProviderV2 } from "@opencode-ai/core/provider" import { ModelV2 } from "@opencode-ai/core/model" import { ModelsDev } from "@opencode-ai/core/models-dev" import { generateText, jsonSchema, type ModelMessage } from "ai" -import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock" +import { createAmazonBedrock, type AmazonBedrockLanguageModelOptions } from "@ai-sdk/amazon-bedrock" import { createAnthropic } from "@ai-sdk/anthropic" import { createVertexAnthropic } from "@ai-sdk/google-vertex/anthropic" @@ -3717,6 +3717,42 @@ describe("ProviderTransform.reasoningVariants", () => { ) }) + test.each(["luna", "sol", "terra"])("serializes Bedrock GPT-5.6 %s none effort", async (name) => { + const item = target("@ai-sdk/amazon-bedrock", `global.openai.gpt-5.6-${name}`) + const variants = ProviderTransform.reasoningVariants( + model([{ type: "effort", values: ["none", "low", "medium", "high", "xhigh", "max"] }]), + item, + ) + for (const effort of ["low", "medium", "high", "xhigh", "max"]) { + expect(variants?.[effort]).toEqual({ reasoningConfig: { type: "enabled", maxReasoningEffort: effort } }) + } + expect(variants?.none).toEqual({ + reasoningConfig: { type: "enabled", maxReasoningEffort: "none" }, + } satisfies AmazonBedrockLanguageModelOptions) + const sent: unknown[] = [] + const provider = createAmazonBedrock({ + apiKey: "test-key", + region: "us-east-1", + fetch: Object.assign( + async (...args: Parameters) => { + sent.push(JSON.parse(String(args[1]?.body))) + return Response.json({ + output: { message: { role: "assistant", content: [{ text: "ok" }] } }, + stopReason: "end_turn", + usage: { inputTokens: 1, outputTokens: 1, totalTokens: 2 }, + }) + }, + { preconnect: () => undefined }, + ), + }) + await generateText({ + model: provider(item.api.id), + prompt: "hi", + providerOptions: ProviderTransform.providerOptions(item, variants?.none ?? {}), + }) + expect(sent).toEqual([expect.objectContaining({ additionalModelRequestFields: { reasoning: { effort: "none" } } })]) + }) + test("combines effort with extended thinking for Claude Opus 4.5", () => { expect( ProviderTransform.reasoningVariants( diff --git a/patches/@ai-sdk%2Famazon-bedrock@4.0.166.patch b/patches/@ai-sdk%2Famazon-bedrock@4.0.166.patch index 96fd15106e..388b306daa 100644 --- a/patches/@ai-sdk%2Famazon-bedrock@4.0.166.patch +++ b/patches/@ai-sdk%2Famazon-bedrock@4.0.166.patch @@ -1,8 +1,16 @@ diff --git a/dist/index.d.mts b/dist/index.d.mts -index d194ae227fd1223ba44c8c5157b1bb72b1bab273..2e046db0a365c27659ffcec08782c7c26845c1fa 100644 +index d194ae227fd1223ba44c8c5157b1bb72b1bab273..db7fdb1b6f4e617baa40539ccef718735d2e9e81 100644 --- a/dist/index.d.mts +++ b/dist/index.d.mts -@@ -61,6 +61,12 @@ declare const amazonBedrockLanguageModelOptions: z.ZodObject<{ +@@ -51,6 +51,7 @@ declare const amazonBedrockLanguageModelOptions: z.ZodObject<{ + type: z.ZodOptional, z.ZodLiteral<"disabled">, z.ZodLiteral<"adaptive">]>>; + budgetTokens: z.ZodOptional; + maxReasoningEffort: z.ZodOptional>; @@ -16,10 +24,18 @@ index d194ae227fd1223ba44c8c5157b1bb72b1bab273..2e046db0a365c27659ffcec08782c7c2 anthropicBeta: z.ZodOptional>; serviceTier: z.ZodOptional, z.ZodLiteral<"disabled">, z.ZodLiteral<"adaptive">]>>; + budgetTokens: z.ZodOptional; + maxReasoningEffort: z.ZodOptional>; @@ -33,14 +49,16 @@ index d194ae227fd1223ba44c8c5157b1bb72b1bab273..2e046db0a365c27659ffcec08782c7c2 anthropicBeta: z.ZodOptional>; serviceTier: z.ZodOptional