Skip to content

Commit 74c7571

Browse files
committed
fix(claude): hide the Ultracode toggle on Claude Code before 2.1.284
Before 2.1.284, Claude Code switches to xhigh whenever Ultracode is on, so the toggle would show Max · Ultracode while running at xhigh. Opus 5.5 is offered from 2.1.280, so this range is reachable.
1 parent df43b5c commit 74c7571

2 files changed

Lines changed: 32 additions & 7 deletions

File tree

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ describe("Claude model catalog", () => {
248248
profiles: {
249249
synthetic: { capabilities: { optionDescriptors: [effort, contextWindow] } },
250250
},
251+
models: [
252+
{
253+
...base.providers!.claudeAgent!.models[0]!,
254+
adapter: { claudeCode: { minVersion: "2.1.280" } },
255+
},
256+
],
251257
},
252258
},
253259
});
@@ -265,5 +271,12 @@ describe("Claude model catalog", () => {
265271
],
266272
});
267273
assert.strictEqual(resolveClaudeCatalogEffort(catalog, "synthetic", "ultracode"), "extreme");
274+
275+
const optionIdsFor = (version: string) =>
276+
resolveClaudeModelsForVersion(catalog, version)[0]?.capabilities?.optionDescriptors?.map(
277+
(descriptor) => descriptor.id,
278+
);
279+
assert.deepStrictEqual(optionIdsFor("2.1.283"), ["effort", "contextWindow"]);
280+
assert.deepStrictEqual(optionIdsFor("2.1.284"), ["effort", "ultracode", "contextWindow"]);
268281
});
269282
});

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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ 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.
31+
const ULTRACODE_ANY_EFFORT_MIN_VERSION = "2.1.284";
3032

31-
/**
32-
* Claude Code 2.1.284 made Ultracode a session toggle that works at any effort
33-
* level. Every installed release reads the remote manifest, and releases before
34-
* this one only understand Ultracode as an effort choice mapped to xhigh, so the
35-
* manifest keeps that shape and the choice is lifted into its own option here.
36-
*/
33+
// Older T3 releases read the same remote manifest and only understand Ultracode as an
34+
// effort choice, so the manifest keeps that shape and the choice is lifted out here.
3735
function withUltracodeToggle<T extends ModelCapabilities | null>(capabilities: T): T {
3836
const descriptors = capabilities?.optionDescriptors;
3937
if (!descriptors || descriptors.some((descriptor) => descriptor.id === ULTRACODE)) {
@@ -197,9 +195,23 @@ export function resolveClaudeModelsForVersion(
197195
catalog: ClaudeModelCatalog,
198196
version: string | null | undefined,
199197
): ReadonlyArray<ClaudeCatalogModel["model"]> {
198+
const ultracodeAtAnyEffort =
199+
!!version && compareSemverVersions(version, ULTRACODE_ANY_EFFORT_MIN_VERSION) >= 0;
200200
return catalog.models
201201
.filter((entry) => isVersionSupported(entry.compatibility, version))
202-
.map((entry) => entry.model);
202+
.map(({ model }) =>
203+
ultracodeAtAnyEffort || !model.capabilities?.optionDescriptors
204+
? model
205+
: {
206+
...model,
207+
capabilities: {
208+
...model.capabilities,
209+
optionDescriptors: model.capabilities.optionDescriptors.filter(
210+
(descriptor) => descriptor.id !== ULTRACODE,
211+
),
212+
},
213+
},
214+
);
203215
}
204216

205217
export function resolveClaudeUpdateRequiredModels(

0 commit comments

Comments
 (0)