From 4eb46a8885e462f8ba574c10fb876825dcbe20b7 Mon Sep 17 00:00:00 2001 From: Shoubhit Dash Date: Fri, 25 Sep 2026 22:03:12 +0530 Subject: [PATCH] fix(core): revert always-thinking variants for Claude Opus 5.5 (#51359) --- packages/core/src/variant.ts | 13 ++----------- packages/core/test/variant.test.ts | 24 ------------------------ 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/packages/core/src/variant.ts b/packages/core/src/variant.ts index f0b3f1a1c1a..f5792727ae2 100644 --- a/packages/core/src/variant.ts +++ b/packages/core/src/variant.ts @@ -54,8 +54,7 @@ const modelID = (model: Model.Info) => model.modelID ?? model.id function claudeInfo(model: Model.Info) { const id = modelID(model) - // Versions are at most two digits so snapshot dates such as `-20260901` are not read as versions. - const familyFirst = /(?:claude-)?(opus|sonnet|haiku|fable|mythos)-(\d{1,2})(?:[.-](\d{1,2}))?(?!\d)/i.exec(id) + const familyFirst = /(?:claude-)?(opus|sonnet|haiku|fable|mythos)-(\d+)(?:[.-](\d+))?/i.exec(id) const versionFirst = /claude-(\d+)(?:[.-](\d+))?-(opus|sonnet|haiku|fable|mythos)/i.exec(id) const family = (familyFirst?.[1] ?? versionFirst?.[3])?.toLowerCase() const major = Number(familyFirst?.[2] ?? versionFirst?.[1]) @@ -65,12 +64,7 @@ function claudeInfo(model: Model.Info) { major, minor, manual: (major === 3 && minor === 7) || (major === 4 && minor < 6), - // Opus 5.5 and later reject disabled thinking. - always: - family === "fable" || - family === "mythos" || - id.toLowerCase().includes("mythos-preview") || - (family === "opus" && (major > 5 || (major === 5 && minor >= 5))), + always: family === "fable" || family === "mythos" || id.toLowerCase().includes("mythos-preview"), } } @@ -396,7 +390,6 @@ const bedrockConverse: Protocol = (model, support) => { return fields({ reasoningConfig: { type: "enabled", maxReasoningEffort: effort } }) }) case "toggle": - if (claude && claudeInfo(model).always) return [] return claude ? toggle(fields({ thinking: { type: "disabled" } }), fields({ thinking: ADAPTIVE_THINKING })) : toggle(fields({ reasoningConfig: { type: "disabled" } }), fields({ reasoningConfig: { type: "enabled" } })) @@ -456,7 +449,6 @@ const bedrockAISDK: Protocol = (model, support) => { : { reasoningConfig: { type: "enabled", maxReasoningEffort: effort } }, })) case "toggle": - if (claude && claudeInfo(model).always) return [] return claude ? toggle( { settings: { additionalModelRequestFields: { thinking: { type: "disabled" } } } }, @@ -515,7 +507,6 @@ const sapAICore: Protocol = (model, support) => { sap({ additionalModelRequestFields: { thinking: { type: "disabled" } } }), sap({ additionalModelRequestFields: { thinking: { type: "enabled" } } }), ) - if (id.includes("anthropic") && claudeInfo(model).always) return [] if (id.includes("anthropic")) return toggle( sap({ additionalModelRequestFields: { thinking: { type: "disabled" } } }), diff --git a/packages/core/test/variant.test.ts b/packages/core/test/variant.test.ts index 57ae608683f..1366db778d4 100644 --- a/packages/core/test/variant.test.ts +++ b/packages/core/test/variant.test.ts @@ -104,30 +104,6 @@ test("recognizes Claude version spellings and future models", () => { ]) }) -test("keeps thinking on for Claude Opus 5.5 and later", () => { - const supports: Variant.Support[] = [{ type: "toggle" }, { type: "effort", values: ["low", "high"] }] - const adaptive = ["low", "high"].map((effort) => ({ - id: effort, - settings: { effort, thinking: { type: "adaptive", display: "summarized" } }, - })) - for (const input of [ - model("@opencode/ai/providers/cloudflare-ai-gateway", "anthropic/claude-opus-5.5"), - model("@opencode/ai/providers/anthropic", "claude-opus-5-5"), - model("@opencode/ai/providers/anthropic", "claude-opus-6"), - ]) - expect(resolve(input, supports)).toEqual(adaptive) - - expect( - resolve(model("@opencode/ai/providers/amazon-bedrock", "us.anthropic.claude-opus-5-5-v1:0"), [{ type: "toggle" }]), - ).toEqual([]) - - for (const id of ["claude-opus-5", "claude-opus-5-20260901"]) - expect(resolve(model("@opencode/ai/providers/anthropic", id), supports)).toEqual([ - { id: "none", settings: { thinking: { type: "disabled" } } }, - ...adaptive, - ]) -}) - test("spells Cloudflare AI Gateway variants for their upstream routes", () => { const pkg = "@opencode/ai/providers/cloudflare-ai-gateway" expect(resolve(model(pkg, "openai/gpt-5.4"), [{ type: "effort", values: ["low", "xhigh"] }])).toEqual([