@devries-cameron20 / t3code-1 / commits / ae49f4d2a7
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): honor custom Claude thinking choices (#28024)

Co-authored-by: chise <188340668+chisewaguri@users.noreply.github.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>

chise committed Nov 14, 2026 at 18:30 UTC ae49f4d2a7963590e7d6b67dbf98f549cb46f376
3 files changed +34 -12
apps/server/src/claudeModelOptions.test.ts
+27 -8
@@ -105,14 +105,33 @@ describe("compileClaudeModelSelection", () => {
105 ).toMatchObject({ effort: "high", promptEffort: "ultrathink" });
106 });
107
108 - it("keeps explicit effort for models missing from the local catalog", () => {
108 + it("ignores thinking for catalog models without a thinking option", () => {
109 expect(
110 - compileClaudeModelSelection(
111 - selection("claude-pool-model-not-in-catalog", [{ id: "effort", value: "max" }]),
112 - ).effort,
113 - ).toBe("max");
114 - expect(
115 - compileClaudeModelSelection(selection("claude-pool-model-not-in-catalog", [])).effort,
116 - ).toBeUndefined();
110 + compileClaudeModelSelection(selection("claude-opus-5-5", [{ id: "thinking", value: false }]))
111 + .settings,
112 + ).not.toHaveProperty("alwaysThinkingEnabled");
113 });
114 +
115 + it.each(["gateway-route", "gateway-route[1m]"])(
116 + "keeps explicit effort and thinking for %s outside the local catalog",
117 + (model) => {
118 + for (const thinking of [true, false]) {
119 + expect(
120 + compileClaudeModelSelection(
121 + selection(model, [
122 + { id: "effort", value: "max" },
123 + { id: "thinking", value: thinking },
124 + ]),
125 + ),
126 + ).toMatchObject({
127 + apiModelId: model,
128 + effort: "max",
129 + settings: { alwaysThinkingEnabled: thinking },
130 + });
131 + }
132 + const unconfigured = compileClaudeModelSelection(selection(model, []));
133 + expect(unconfigured.effort).toBeUndefined();
134 + expect(unconfigured.settings).toEqual({});
135 + },
136 + );
137 });
apps/server/src/claudeModelOptions.ts
+6 -3
@@ -12,6 +12,7 @@ import {
12 normalizeClaudeCatalogEffort,
13 resolveClaudeCatalogApiModelId,
14 resolveClaudeCatalogEffort,
15 + resolveClaudeCatalogModel,
16 resolveClaudeModelSlug,
17 type ClaudeModelCatalog,
18 } from "./provider/ClaudeModelCatalog.ts";
@@ -45,9 +46,11 @@ export function compileClaudeModelSelection(
46 const fastMode = supportsBoolean("fastMode")
47 ? (getModelSelectionBooleanOptionValue(selection, "fastMode") ?? false)
48 : undefined;
48 - const thinking = supportsBoolean("thinking")
49 - ? getModelSelectionBooleanOptionValue(selection, "thinking")
50 - : undefined;
49 + const inCatalog = resolveClaudeCatalogModel(catalog, selection.model) !== undefined;
50 + const thinking =
51 + !inCatalog || supportsBoolean("thinking")
52 + ? getModelSelectionBooleanOptionValue(selection, "thinking")
53 + : undefined;
54 const ultracode = descriptors.find((descriptor) => descriptor.id === "ultracode")?.currentValue;
55 const settings = {
56 ...(typeof thinking === "boolean" ? { alwaysThinkingEnabled: thinking } : {}),
apps/server/src/provider/ClaudeModelCatalog.ts
+1 -1
@@ -223,7 +223,7 @@ export function claudeReportedModels(
223 return models;
224 }
225
226 -function resolveClaudeCatalogModel(
226 +export function resolveClaudeCatalogModel(
227 catalog: ClaudeModelCatalog,
228 slugOrAlias: string | null | undefined,
229 ): ClaudeCatalogModel | undefined {