Skip to content

Commit d8c48b5

Browse files
committed
fix(claude): Claude Code before 2.1.284 keeps Ultracode as a reasoning choice
Hiding the toggle there took Ultracode away from those users. They get the manifest's original effort choice back, which the server already compiles to xhigh with Ultracode on.
1 parent 636f5d2 commit d8c48b5

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

‎apps/server/src/provider/ClaudeModelCatalog.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ describe("Claude model catalog", () => {
276276
resolveClaudeModelsForVersion(catalog, version)[0]?.capabilities?.optionDescriptors?.map(
277277
(descriptor) => descriptor.id,
278278
);
279-
assert.deepStrictEqual(optionIdsFor("2.1.283"), ["effort", "contextWindow"]);
279+
assert.deepStrictEqual(resolveClaudeModelsForVersion(catalog, "2.1.283")[0]?.capabilities, {
280+
optionDescriptors: [effort, contextWindow],
281+
});
280282
assert.deepStrictEqual(optionIdsFor("2.1.284"), ["effort", "ultracode", "contextWindow"]);
281283
});
282284
});

‎apps/server/src/provider/ClaudeModelCatalog.ts‎

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import { BUNDLED_MODEL_MANIFEST, resolveProviderCatalog } from "./ModelManifest.
2727
const CLAUDE = ProviderDriverKind.make("claudeAgent");
2828
const EMPTY_CAPABILITIES: ModelCapabilities = { optionDescriptors: [] };
2929
const ULTRACODE = "ultracode";
30-
// Before this, Claude Code switches to xhigh whenever Ultracode is on.
30+
// Before this, Claude Code switches to xhigh whenever Ultracode is on, so older versions
31+
// keep the manifest's Ultracode effort choice instead of the toggle.
3132
const ULTRACODE_ANY_EFFORT_MIN_VERSION = "2.1.284";
3233

3334
// Older T3 releases read the same remote manifest and only understand Ultracode as an
@@ -63,6 +64,7 @@ function withUltracodeToggle<T extends ModelCapabilities | null>(capabilities: T
6364

6465
export interface ClaudeCatalogModel {
6566
readonly model: ServerProviderModel;
67+
readonly manifestCapabilities?: ServerProviderModel["capabilities"];
6668
readonly runtime: ClaudeCodeProfile;
6769
readonly compatibility: ClaudeCodeCompatibility;
6870
}
@@ -82,8 +84,10 @@ function tryResolveClaudeModelCatalog(
8284
const adapter = decodeClaudeModelAdapter(entry.adapter ?? {});
8385
if (Option.isNone(profile) || Option.isNone(adapter)) return null;
8486
const model = ModelCatalog.catalogServerModel(resolved, entry);
87+
const capabilities = withUltracodeToggle(model.capabilities);
8588
models.push({
86-
model: { ...model, capabilities: withUltracodeToggle(model.capabilities) },
89+
model: { ...model, capabilities },
90+
...(capabilities === model.capabilities ? {} : { manifestCapabilities: model.capabilities }),
8791
runtime: profile.value.claudeCode ?? {},
8892
compatibility: adapter.value.claudeCode ?? {},
8993
});
@@ -199,18 +203,10 @@ export function resolveClaudeModelsForVersion(
199203
!!version && compareSemverVersions(version, ULTRACODE_ANY_EFFORT_MIN_VERSION) >= 0;
200204
return catalog.models
201205
.filter((entry) => isVersionSupported(entry.compatibility, version))
202-
.map(({ model }) =>
203-
ultracodeAtAnyEffort || !model.capabilities?.optionDescriptors
206+
.map(({ model, manifestCapabilities }) =>
207+
ultracodeAtAnyEffort || manifestCapabilities === undefined
204208
? model
205-
: {
206-
...model,
207-
capabilities: {
208-
...model.capabilities,
209-
optionDescriptors: model.capabilities.optionDescriptors.filter(
210-
(descriptor) => descriptor.id !== ULTRACODE,
211-
),
212-
},
213-
},
209+
: { ...model, capabilities: manifestCapabilities },
214210
);
215211
}
216212

0 commit comments

Comments
 (0)