From ccd0677dc1fd4a31cc75013c417f53b6b0bdeff6 Mon Sep 17 00:00:00 2001 From: Amirsalar Sojoudi Date: Thu, 1 Oct 2026 10:06:58 +0700 Subject: [PATCH] fix(claude): resolve Sonnet 5.x to adaptive thinking so no forged thinking placeholders are sent --- open-sse/providers/capabilities.js | 1 + tests/unit/capabilities-sonnet-5-5.test.js | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/unit/capabilities-sonnet-5-5.test.js diff --git a/open-sse/providers/capabilities.js b/open-sse/providers/capabilities.js index 1e4240c8..39d116ee 100644 --- a/open-sse/providers/capabilities.js +++ b/open-sse/providers/capabilities.js @@ -286,6 +286,7 @@ PROVIDER_CAPABILITIES.cx = PROVIDER_CAPABILITIES.codex; export const PATTERN_CAPABILITIES = [ // ── Claude (4.6+ = adaptive thinking; older/haiku = budget) ────── { pattern: "*claude*opus-5*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 } }, + { pattern: "*claude*sonnet-5*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive", contextWindow: 1000000, maxOutput: 128000 } }, { pattern: "*claude*opus-4.6*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive" } }, { pattern: "*claude*opus-4.7*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive" } }, { pattern: "*claude*opus-4.8*", caps: { vision: true, reasoning: true, search: true, thinkingFormat: "claude-adaptive" } }, diff --git a/tests/unit/capabilities-sonnet-5-5.test.js b/tests/unit/capabilities-sonnet-5-5.test.js new file mode 100644 index 00000000..824bc309 --- /dev/null +++ b/tests/unit/capabilities-sonnet-5-5.test.js @@ -0,0 +1,21 @@ +import { describe, expect, it } from "vitest"; + +import { getCapabilitiesForModel } from "../../open-sse/providers/capabilities.js"; + +// claude-sonnet-5-5 has no exact entry and matched only the generic *claude*sonnet* +// pattern (claude-budget). That sent thinking.type "enabled" and made the translator +// forge signed thinking placeholders on every tool_use turn; Sonnet 5.5 answered +// large Codex conversations with stop_reason "refusal". It must resolve like the +// rest of the 5.x family: adaptive thinking, 1M context. +describe("Claude Sonnet 5.5 capabilities", () => { + for (const model of ["claude-sonnet-5-5", "claude-sonnet-5.5", "anthropic/claude-sonnet-5-5"]) { + it(`${model} resolves to adaptive thinking + 1M context`, () => { + expect(getCapabilitiesForModel("claude", model)).toMatchObject({ + thinkingFormat: "claude-adaptive", + contextWindow: 1000000, + maxOutput: 128000, + reasoning: true, + }); + }); + } +});