Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

fix(catalog): read v3 reasoning.supported, not the field's presence

Jack Rudenko224734090e4c
diff --git a/packages/cli/src/providers/model-catalog-reasoning.test.ts b/packages/cli/src/providers/model-catalog-reasoning.test.ts
new file mode 100644
index 00000000..d04b876a
--- /dev/null
+++ b/packages/cli/src/providers/model-catalog-reasoning.test.ts
@@ -0,0 +1,63 @@
+// Pins the v3 reasoning-object regression: presence alone must not mark a model as thinking.
+import { describe, expect, test } from "bun:test";
+import { readFileSync } from "node:fs";
+import { resolve } from "node:path";
+import type { SlimModelEntry } from "./all-models-cache.js";
+import { slimEntryToCatalogModel } from "./model-catalog.js";
+
+interface CatalogFixture {
+ entries: SlimModelEntry[];
+}
+
+const fixture = JSON.parse(
+ readFileSync(
+ resolve(import.meta.dir, "../test-fixtures/catalog-v3/rows-g-20260919013346169.json"),
+ "utf-8"
+ )
+) as CatalogFixture;
+
+function fixtureRow(modelId: string): SlimModelEntry {
+ const entry = fixture.entries.find((candidate) => candidate.modelId === modelId);
+ expect(entry, `fixture row ${modelId} should exist`).toBeDefined();
+ return entry!;
+}
+
+describe("slimEntryToCatalogModel reasoning", () => {
+ test("maps supported reasoning to thinking true", () => {
+ const entry = fixtureRow("kimi-k3");
+ expect(entry.reasoning?.supported).toBe(true);
+
+ const model = slimEntryToCatalogModel(entry);
+
+ expect(model.capabilities?.thinking).toBe(true);
+ });
+
+ test("maps explicitly unsupported reasoning to thinking false", () => {
+ const entry = fixtureRow("gemini-omni-1.1-flash");
+ expect(entry.reasoning?.supported).toBe(false);
+
+ const model = slimEntryToCatalogModel(entry);
+
+ expect(model.capabilities?.thinking).toBe(false);
+ });
+
+ test("omits thinking when reasoning is absent", () => {
+ const entry = fixtureRow("gemini-flash-latest");
+ expect("reasoning" in entry).toBe(false);
+
+ const model = slimEntryToCatalogModel(entry);
+
+ expect("thinking" in (model.capabilities ?? {})).toBe(false);
+ });
+
+ test("omits thinking when reasoning status is unknown", () => {
+ const realEntry = fixtureRow("kimi-k3");
+ expect(realEntry.reasoning?.supported).toBe(true);
+ const entry: SlimModelEntry = { ...realEntry, reasoningStatus: "unknown" };
+ expect(entry.reasoningStatus).toBe("unknown");
+
+ const model = slimEntryToCatalogModel(entry);
+
+ expect("thinking" in (model.capabilities ?? {})).toBe(false);
+ });
+});
diff --git a/packages/cli/src/providers/model-catalog.ts b/packages/cli/src/providers/model-catalog.ts
index 73a02141..09af32f2 100644
--- a/packages/cli/src/providers/model-catalog.ts
+++ b/packages/cli/src/providers/model-catalog.ts
@@ -19,7 +19,7 @@ import {
getModelsByProvider,
searchModels as searchModelsFromFirebase,
} from "../model-loader.js";
-import { type SlimModelEntry, readAllModelsCache } from "./all-models-cache.js";
+import { type SlimModelEntry, readAllModelsCache, reasoningStatusOf } from "./all-models-cache.js";
import { FIREBASE_CACHE_TTL_MS } from "./cache-ttl.js";
// ─── Public types ────────────────────────────────────────────────────────────
@@ -251,7 +251,7 @@ function filterToServedByProvider(
return kept;
}
-function slimEntryToCatalogModel(entry: SlimModelEntry): CatalogModel {
+export function slimEntryToCatalogModel(entry: SlimModelEntry): CatalogModel {
return {
modelId: entry.modelId,
displayName: entry.modelId,
@@ -277,7 +277,12 @@ function slimEntryToCatalogModel(entry: SlimModelEntry): CatalogModel {
// tools" are different claims and only the second one disqualifies a model.
capabilities: {
...(entry.supportsVision === undefined ? {} : { vision: entry.supportsVision }),
- ...(entry.reasoning === undefined ? {} : { thinking: true }),
+ // v3 `reasoning` is an OBJECT, `{ supported: false }` included — reading its
+ // mere presence as "thinks" flagged 469 of 1137 non-reasoning entries as
+ // reasoning models. Same rule as the adapters: an UNKNOWN status says nothing.
+ ...(entry.reasoning === undefined || reasoningStatusOf(entry) === "unknown"
+ ? {}
+ : { thinking: entry.reasoning.supported }),
...(entry.supportsTools === undefined ? {} : { tools: entry.supportsTools }),
},
};