From 7c0289d7bc00d4c0e0368f153859e22a6374581d Mon Sep 17 00:00:00 2001 From: Ravi Tharuma Date: Wed, 25 Mar 2026 15:41:12 +0100 Subject: [PATCH] fix(model-capabilities): honor root thinking flags --- src/shared/model-capabilities.test.ts | 16 ++++++++++++++++ src/shared/model-capabilities.ts | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/src/shared/model-capabilities.test.ts b/src/shared/model-capabilities.test.ts index 82b5ea649..a145aab45 100644 --- a/src/shared/model-capabilities.test.ts +++ b/src/shared/model-capabilities.test.ts @@ -115,6 +115,22 @@ describe("getModelCapabilities", () => { }) }) + test("respects root-level thinking flags when providers do not nest them under capabilities", () => { + const result = getModelCapabilities({ + providerID: "custom-proxy", + modelID: "gpt-5.4", + runtimeModel: { + supportsThinking: true, + }, + bundledSnapshot, + }) + + expect(result).toMatchObject({ + canonicalModelID: "gpt-5.4", + supportsThinking: true, + }) + }) + test("accepts runtime variant arrays without corrupting them into numeric keys", () => { const result = getModelCapabilities({ providerID: "openai", diff --git a/src/shared/model-capabilities.ts b/src/shared/model-capabilities.ts index cead7f00e..25835f5d5 100644 --- a/src/shared/model-capabilities.ts +++ b/src/shared/model-capabilities.ts @@ -276,6 +276,11 @@ function readRuntimeModelThinkingSupport(runtimeModel: Record | return capabilityValue } + const rootThinkingSupport = readRuntimeModelBoolean(runtimeModel, ["thinking", "supportsThinking"]) + if (rootThinkingSupport !== undefined) { + return rootThinkingSupport + } + const runtimeCapabilities = readRuntimeModelCapabilities(runtimeModel) if (!runtimeCapabilities) { return undefined