Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

feat(codex): add ultra reasoning effort with per-model filtering

jonathanwxh-celle56f39eba870
diff --git a/packages/phone-protocol/src/effort-levels.ts b/packages/phone-protocol/src/effort-levels.ts
new file mode 100644
index 0000000000..c501c0effe
--- /dev/null
+++ b/packages/phone-protocol/src/effort-levels.ts
@@ -0,0 +1,16 @@
+import type { EffortLevel } from "./wire.ts";
+
+export interface EffortOfferingInstance {
+ models?: { options?: readonly { id: string; effortLevels?: readonly EffortLevel[] }[] };
+ capabilities?: { effortLevels?: readonly EffortLevel[] };
+ adapter?: { capabilities?: { effortLevels?: readonly EffortLevel[] } };
+}
+
+/** Effort levels offered for `model` on `instance`, preferring model-specific levels over instance defaults. */
+export function offeredEffortLevels(
+ instance: EffortOfferingInstance | null | undefined,
+ model: string | undefined,
+): readonly EffortLevel[] {
+ const option = model ? instance?.models?.options?.find((candidate) => candidate.id === model) : undefined;
+ return option?.effortLevels ?? instance?.capabilities?.effortLevels ?? instance?.adapter?.capabilities?.effortLevels ?? [];
+}
diff --git a/packages/phone-protocol/src/responses.ts b/packages/phone-protocol/src/responses.ts
index 4dfe437fae..28996801b2 100644
--- a/packages/phone-protocol/src/responses.ts
+++ b/packages/phone-protocol/src/responses.ts
@@ -135,6 +135,7 @@ export interface WireModelOption {
label: string;
custom?: boolean;
provider?: string;
+ effortLevels?: readonly string[];
}
/** One AI engine set up on the server, as GET /api/instances lists it: the fields a phone reads. Each entry carries more
diff --git a/packages/phone-protocol/src/wire.ts b/packages/phone-protocol/src/wire.ts
index 71239c48a7..29877fc5f0 100644
--- a/packages/phone-protocol/src/wire.ts
+++ b/packages/phone-protocol/src/wire.ts
@@ -45,7 +45,7 @@ export type { AuthPairResponse, AuthSessionResponse, BotCreateResponse, BotsResp
/** Reasoning-effort levels, ascending: a union of what any engine accepts;
* each driver declares the subset its CLI will take. */
-export const EFFORT_LEVELS = ["none", "low", "medium", "high", "xhigh", "max"] as const;
+export const EFFORT_LEVELS = ["none", "low", "medium", "high", "xhigh", "max", "ultra"] as const;
export type EffortLevel = (typeof EFFORT_LEVELS)[number];
export function isEffortLevel(value: unknown): value is EffortLevel {
diff --git a/scripts/mcp-server.ts b/scripts/mcp-server.ts
index b305b15477..230830634b 100644
--- a/scripts/mcp-server.ts
+++ b/scripts/mcp-server.ts
@@ -713,11 +713,11 @@ async function checkedModelSelection(
if (!instance) throw new ToolInputError(`model instance not found: ${instanceId}`);
if (instance.snapshot?.state !== "available") throw new ToolInputError(`model instance is unavailable: ${instanceId}`);
const models = isRecord(instance.models) ? instance.models : {};
- const offered = records(models.options).map((option) => option.id).filter((id) => typeof id === "string");
- if (models.default !== model && !offered.includes(model)) {
+ const match = records(models.options).find((option) => option.id === model);
+ if (models.default !== model && !match) {
throw new ToolInputError(`model '${model}' is not offered by instance '${instanceId}'`);
}
- const efforts = Array.isArray(instance.capabilities?.effortLevels) ? instance.capabilities.effortLevels : [];
+ const efforts = Array.isArray(match?.effortLevels) ? match.effortLevels : Array.isArray(instance.capabilities?.effortLevels) ? instance.capabilities.effortLevels : [];
if (effort && !efforts.includes(effort)) {
throw new ToolInputError(`effort '${effort}' is not offered by instance '${instanceId}'`);
}
diff --git a/server/contracts.ts b/server/contracts.ts
index 7f98a9b416..014c1eda03 100644
--- a/server/contracts.ts
+++ b/server/contracts.ts
@@ -528,6 +528,8 @@ export interface ModelCatalog {
contextWindow?: number;
/** Discovery hints; the native session revalidates these before each turn. */
variants?: ModelVariantOption[];
+ /** Effort levels this model accepts when narrower/wider than the engine default. */
+ effortLevels?: readonly EffortLevel[];
/** The organization of the signed-in account turned this model off: the engine would answer with another. */
orgBlocked?: true;
/** The installed CLI is too old for this model: the version it needs. */
diff --git a/server/default-model-selection.test.ts b/server/default-model-selection.test.ts
index 302bde6d28..a8b5216c23 100644
--- a/server/default-model-selection.test.ts
+++ b/server/default-model-selection.test.ts
@@ -72,6 +72,24 @@ describe("new bot default model selection", () => {
expect(preferred.effort).toBe("high");
});
+ it("drops a saved effort level unsupported by that specific model even when the engine advertises it", () => {
+ const preferred = { instanceId: "codex", model: "gpt-6-luna", effort: "ultra" as const };
+ const modelScopedCodex = {
+ ...codex,
+ models: {
+ default: "gpt-6.2-sol",
+ options: [
+ { id: "gpt-6.2-sol", label: "GPT-6.2-Sol", effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] as const },
+ { id: "gpt-6-luna", label: "GPT-6-Luna", effortLevels: ["low", "medium", "high", "xhigh", "max"] as const },
+ ],
+ },
+ capabilities: { effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] as const },
+ };
+ expect(selectDefaultModelSelection([modelScopedCodex], preferred)).toEqual({ instanceId: "codex", model: "gpt-6-luna" });
+ expect(selectDefaultModelSelection([modelScopedCodex], { instanceId: "codex", model: "gpt-6.2-sol", effort: "ultra" }))
+ .toEqual({ instanceId: "codex", model: "gpt-6.2-sol", effort: "ultra" });
+ });
+
it("accepts the provider default even when it is not repeated in its options", () => {
expect(selectDefaultModelSelection(
[{ ...codex, models: { default: "codex-default", options: [] } }],
diff --git a/server/default-model-selection.ts b/server/default-model-selection.ts
index 3341642786..e38c956b00 100644
--- a/server/default-model-selection.ts
+++ b/server/default-model-selection.ts
@@ -1,4 +1,5 @@
import { freeFallback, rankAis } from "../shared/ai-ranking.ts";
+import { offeredEffortLevels } from "../shared/wire.ts";
import type { EffortLevel, EngineAccess, InstanceConfigMap, ModelCatalog, ModelSelection, ProviderSnapshot } from "./contracts.ts";
export interface SelectableInstance {
@@ -72,8 +73,8 @@ export function selectDefaultModelSelection(
return { instanceId: "", model: "" };
}
const selection = { ...preferred };
- // A saved effort can outlive driver support: keep the model, let the provider use its default effort.
- if (selection.effort && !instance.capabilities?.effortLevels?.includes(selection.effort)) delete selection.effort;
+ // A saved effort can outlive driver or per-model support: keep the model, let the provider use its default effort.
+ if (selection.effort && !offeredEffortLevels(instance, selection.model).includes(selection.effort)) delete selection.effort;
return selection;
}
const available = instances.filter((instance) => instance.enabled !== false && instance.snapshot.state === "available" && context.refusal?.(instance) === undefined && defaultModel(instance));
diff --git a/server/drivers/codex-catalog.test.ts b/server/drivers/codex-catalog.test.ts
index ac74e47a5e..0dc2dd4788 100644
--- a/server/drivers/codex-catalog.test.ts
+++ b/server/drivers/codex-catalog.test.ts
@@ -158,6 +158,69 @@ describe("readCodexModelCatalog", () => {
});
});
+ it("reads per-model supportedReasoningEfforts so only supporting models advertise ultra", async () => {
+ chmodSync(FAKE_CLI, 0o755);
+ const catalog = await readCodexModelCatalog(
+ { HOME: join(tmpdir(), "omb-codex-app-server-efforts"), PATH: process.env.PATH, FAKE_CODEX_TIERS: "1", FAKE_CODEX_EFFORTS: "1" },
+ fetch,
+ FAKE_CLI,
+ );
+
+ expect(catalog).toEqual({
+ default: "gpt-fake-default",
+ options: [
+ {
+ id: "gpt-fake-default",
+ label: "GPT Fake Default",
+ effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"],
+ },
+ {
+ id: "gpt-fake-default+priority",
+ label: "GPT Fake Default · Fast",
+ effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"],
+ },
+ {
+ id: "gpt-page-two",
+ label: "GPT Page Two",
+ effortLevels: ["low", "medium", "high", "xhigh", "max"],
+ },
+ ],
+ });
+ });
+
+ it("preserves CLI-listed effortLevels when model_catalog_json also matches the configured model", async () => {
+ chmodSync(FAKE_CLI, 0o755);
+ const home = scratchHome({
+ "config.toml": `
+model_provider = "omlx"
+model = "gpt-fake-default"
+model_catalog_json = "omlx-catalog.json"
+
+[model_providers.omlx]
+name = "oMLX"
+`,
+ "omlx-catalog.json": JSON.stringify({ models: [{ slug: "gpt-fake-default" }] }),
+ });
+ const catalog = await readCodexModelCatalog(
+ { HOME: home, PATH: process.env.PATH, FAKE_CODEX_EFFORTS: "1" },
+ fetch,
+ FAKE_CLI,
+ );
+
+ expect(catalog.options).toContainEqual({
+ id: encodeCodexSelection("omlx", "gpt-fake-default"),
+ label: "gpt-fake-default (oMLX)",
+ custom: true,
+ effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"],
+ });
+ expect(catalog.options).toContainEqual({
+ id: encodeCodexSelection("omlx", "gpt-page-two"),
+ label: "gpt-page-two (oMLX)",
+ custom: true,
+ effortLevels: ["low", "medium", "high", "xhigh", "max"],
+ });
+ });
+
it("appends the configured local model and cached catalog slugs as custom", async () => {
const home = scratchHome({
"config.toml": `
diff --git a/server/drivers/codex-catalog.ts b/server/drivers/codex-catalog.ts
index dcbe0ec4b8..4c3e41325c 100644
--- a/server/drivers/codex-catalog.ts
+++ b/server/drivers/codex-catalog.ts
@@ -4,7 +4,8 @@ import { readdirSync, readFileSync } from "node:fs";
import { homedir } from "node:os";
import { basename, join } from "node:path";
-import type { ModelCatalog } from "../contracts.ts";
+import type { EffortLevel, ModelCatalog } from "../contracts.ts";
+import { EFFORT_LEVELS, isEffortLevel } from "../../shared/wire.ts";
import { qualifiedModelLabel } from "../contracts.ts";
import { killCliTree, spawnCli } from "../procs.ts";
import { codexHome } from "./codex-identity.ts";
@@ -78,10 +79,25 @@ interface CodexAppServerModel {
isDefault?: unknown;
serviceTiers?: unknown;
defaultServiceTier?: unknown;
+ supportedReasoningEfforts?: unknown;
}
const FAST_TIER = /fast/i;
+/** Parse per-model `supportedReasoningEfforts` (`string[]` or `{ reasoningEffort: string }[]`) in canonical ascending order. */
+function supportedEffortLevels(row: CodexAppServerModel): readonly EffortLevel[] | undefined {
+ if (!Array.isArray(row.supportedReasoningEfforts)) return undefined;
+ const present = new Set<EffortLevel>();
+ for (const item of row.supportedReasoningEfforts) {
+ const raw = typeof item === "string" ? item
+ : item && typeof item === "object"
+ ? (item as { reasoningEffort?: unknown; effort?: unknown }).reasoningEffort ?? (item as { effort?: unknown }).effort
+ : undefined;
+ if (isEffortLevel(raw)) present.add(raw);
+ }
+ return EFFORT_LEVELS.filter((level) => present.has(level));
+}
+
/** The model's Fast tier (codex-cli 0.167 lists `{id: "priority", name: "Fast"}`), unless it already runs on it. */
function fastTier(row: CodexAppServerModel): { id: string; name: string } | null {
if (!Array.isArray(row.serviceTiers)) return null;
@@ -182,9 +198,11 @@ export function readCodexAppServerModelCatalog(
if (row.hidden === true || typeof row.id !== "string" || !MODEL_ID.test(row.id) || seen.has(row.id)) continue;
seen.add(row.id);
const label = typeof row.displayName === "string" && row.displayName.trim() ? row.displayName : row.id;
- options.push({ id: row.id, label });
+ const effortLevels = supportedEffortLevels(row);
+ const meta = effortLevels !== undefined ? { effortLevels } : {};
+ options.push({ id: row.id, label, ...meta });
const fast = fastTier(row);
- if (fast && !TIERED_ID.test(row.id)) options.push({ id: `${row.id}+${fast.id}`, label: `${label} · ${fast.name}` });
+ if (fast && !TIERED_ID.test(row.id)) options.push({ id: `${row.id}+${fast.id}`, label: `${label} · ${fast.name}`, ...meta });
if (row.isDefault === true) defaultModel = row.id;
}
if (!options.length) {
@@ -421,9 +439,9 @@ async function catalogAround(
if (listingProvider) official = { default: encodeCodexSelection(listingProvider, official.default), options: [] };
const known = new Map(main.providers.map((provider) => [provider.id, provider]));
const named = collectCatalogNames(home);
- const extras: Array<{ provider: string; model: string }> = [];
+ const extras: Array<{ provider: string; model: string; effortLevels?: readonly EffortLevel[] }> = [];
- const remember = (provider: string | undefined, model: string | undefined) => {
+ const remember = (provider: string | undefined, model: string | undefined, effortLevels?: readonly EffortLevel[]) => {
if (!provider || !model) return;
if (!PROVIDER_ID.test(provider) || !MODEL_ID.test(model)) return;
// A local provider may serve an official slug: keep its row provider-qualified.
@@ -431,11 +449,11 @@ async function catalogAround(
provider === OFFICIAL_CODEX_PROVIDER &&
official.options.some((option) => option.id === model)
) return;
- extras.push({ provider, model });
+ extras.push({ provider, model, ...(effortLevels !== undefined ? { effortLevels } : {}) });
};
+ if (listingProvider) for (const option of listed) remember(listingProvider, option.id, option.effortLevels);
remember(main.modelProvider, main.model);
- if (listingProvider) for (const option of listed) remember(listingProvider, option.id);
for (const file of listDir(home)) {
if (!file.endsWith(".config.toml")) continue;
@@ -469,6 +487,7 @@ async function catalogAround(
id,
label: niceLabel(extra.model, extra.provider, known, named),
custom: true,
+ ...(extra.effortLevels !== undefined ? { effortLevels: extra.effortLevels } : {}),
});
}
diff --git a/server/drivers/codex.test.ts b/server/drivers/codex.test.ts
index 7a403726b2..fd9152b3b9 100644
--- a/server/drivers/codex.test.ts
+++ b/server/drivers/codex.test.ts
@@ -4570,7 +4570,7 @@ process.stdout.write(JSON.stringify({jsonrpc:'2.0',id:m.id,result})+'\\n');});`)
]);
});
- it("sends effort on turn/start, and omits the key when unset", async () => {
+ it("sends effort (including ultra) on turn/start, and omits the key when unset", async () => {
await create();
const dump = join(scratch, "effort.json");
process.env.FAKE_CODEX_DUMP = dump;
@@ -4581,6 +4581,13 @@ process.stdout.write(JSON.stringify({jsonrpc:'2.0',id:m.id,result})+'\\n');});`)
const seen = JSON.parse(readFileSync(dump, "utf8"));
const turnStart = seen.calls.find((c: any) => c.method === "turn/start");
expect(turnStart.params.effort).toBe("xhigh");
+
+ const ultraDump = join(scratch, "effort-ultra.json");
+ process.env.FAKE_CODEX_DUMP = ultraDump;
+ await instance.adapter.sendTurn({ threadId: "t-effort-ultra", text: "hi", effort: "ultra" });
+ await recorder.until((e) => e.type === "turn.completed" && e.threadId === "t-effort-ultra");
+ const ultraSeen = JSON.parse(readFileSync(ultraDump, "utf8"));
+ expect(ultraSeen.calls.find((c: any) => c.method === "turn/start").params.effort).toBe("ultra");
});
it("sends no effort key when the turn has none", async () => {
diff --git a/server/drivers/pi.test.ts b/server/drivers/pi.test.ts
index f396a74370..76ed984700 100644
--- a/server/drivers/pi.test.ts
+++ b/server/drivers/pi.test.ts
@@ -23,6 +23,7 @@ import {
PiDriver,
PiRpcChunks,
piLineReader,
+ piThinkingLevel,
preferPiInjectRows,
splitPiModel,
updatePiModelCatalog,
@@ -838,6 +839,7 @@ describe("PiDriver turns (fake CLI)", () => {
await create();
expect(instance.adapter.capabilities.images).toBe(true);
expect(instance.adapter.capabilities.effortLevels).toEqual(["none", "low", "medium", "high", "xhigh", "max"]);
+ expect(piThinkingLevel("ultra")).toBe("max");
});
it("pins reasoning effort via set_thinking_level after the model", async () => {
diff --git a/server/drivers/pi.ts b/server/drivers/pi.ts
index 6cef845b36..627d6c6487 100644
--- a/server/drivers/pi.ts
+++ b/server/drivers/pi.ts
@@ -35,8 +35,8 @@ import type {
SendTurnInput,
SteerOutcome,
} from "../contracts.ts";
-import { EFFORT_LEVELS } from "../../shared/wire.ts";
import { newEventId, newId } from "../contracts.ts";
+export const PI_EFFORT_LEVELS = ["none", "low", "medium", "high", "xhigh", "max"] as const;
import { ASK_USER_TOOL, MAX_QUESTION_TEXT, parseAskQuestions, parseChoices, questionAnswersByQuestion } from "../../shared/ask-question.ts";
import {
decodeInjectId,
@@ -72,8 +72,8 @@ const PI_SESSION_SLOW_MS = 20_000;
/** pi answered success:false: an explicit refusal from a live runtime, not a transport failure. */
class PiRpcRefusalError extends Error {}
-export function piThinkingLevel(effort: EffortLevel): (typeof EFFORT_LEVELS)[number] | "off" {
- return effort === "none" ? "off" : effort;
+export function piThinkingLevel(effort: EffortLevel): (typeof PI_EFFORT_LEVELS)[number] | "off" {
+ return effort === "none" ? "off" : effort === "ultra" ? "max" : effort;
}
interface PiModelEntry {
@@ -971,7 +971,7 @@ export const PiDriver: ProviderDriver<PiConfig> = {
images: true,
nativeImageInput: true,
// pi rejects an unsupported level and the turn keeps the engine default.
- effortLevels: EFFORT_LEVELS,
+ effortLevels: PI_EFFORT_LEVELS,
queueing: true, askTool: { kind: "native", name: "ask_user" },
},
sendTurn,
diff --git a/server/headless/team-file.test.ts b/server/headless/team-file.test.ts
index 3d0c11e5d5..5a22a4337f 100644
--- a/server/headless/team-file.test.ts
+++ b/server/headless/team-file.test.ts
@@ -105,8 +105,8 @@ rooms:
});
it("reads JSON too, and warns about a bot left on an automatic computer", () => {
- const team = loadTeamFile(file(JSON.stringify({ version: 1, bots: [{ name: "Solo" }] }), "team.json"));
- expect(team.bots).toEqual([{ name: "Solo", manages: [], skills: [] }]);
+ const team = loadTeamFile(file(JSON.stringify({ version: 1, bots: [{ name: "Solo", effort: "ultra" }] }), "team.json"));
+ expect(team.bots).toEqual([{ name: "Solo", effort: "ultra", manages: [], skills: [] }]);
expect(team.warnings).toEqual([expect.stringContaining('bot "Solo" has no computer set')]);
});
diff --git a/server/headless/team-file.ts b/server/headless/team-file.ts
index 049121f79b..9cbcc8171c 100644
--- a/server/headless/team-file.ts
+++ b/server/headless/team-file.ts
@@ -8,6 +8,7 @@ import { z } from "zod";
import { BOT_PROFILE_LIMITS, fitsOnOneLine } from "../../shared/bot-profile.ts";
import { parseSkillMd } from "../../shared/skill-md.ts";
import { parseToolScope, type ToolScope } from "../../shared/tool-scope.ts";
+import { EFFORT_LEVELS } from "../../shared/wire.ts";
import { usageError } from "./args.ts";
export const TEAM_BRIEF_MAX_BYTES = 24_000;
@@ -44,7 +45,7 @@ const botFields = {
description: z.string().max(BOT_PROFILE_LIMITS.description, `must be at most ${BOT_PROFILE_LIMITS.description} characters`).optional(),
soul: textOrFile.optional(),
model: z.string().regex(/^[\w.-]+\/\S.*$/, "must be INSTANCE/MODEL, such as claude/claude-sonnet-5-5").optional(),
- effort: z.enum(["none", "low", "medium", "high", "xhigh", "max"]).optional(),
+ effort: z.enum(EFFORT_LEVELS).optional(),
approval: z.enum(["ask", "edits", "auto", "full"], { error: "must be ask, edits, auto or full (custom is set in the desktop app)" }).optional(),
computer: z.enum(["auto", "off", "browser", "local", "vm", "cloud"]).optional(),
cwd: z.string().min(1).optional(),
diff --git a/server/index.ts b/server/index.ts
index e8a0b63a98..02b1da7887 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -106,7 +106,7 @@ import { createDataRoutes } from "./data/routes.ts";
import { DataSheetRegistry } from "./data/sheet.ts";
import { DataFailure } from "./data/types.ts";
import { TeamComputers, teamComputerOwner, type TeamComputerRecord } from "./team-computers.ts";
-import { isEffortLevel, type AuthPairResponse, type CardAnswerer, type LoopbackSessionResponse, type SignedInSessionResponse, type PairResponse, type ResolvedSender, type ServerFrame, type SignInRequestCardData, type WireBot, type WireGroup, type WireTask } from "../shared/wire.ts";
+import { isEffortLevel, offeredEffortLevels, type AuthPairResponse, type CardAnswerer, type LoopbackSessionResponse, type SignedInSessionResponse, type PairResponse, type ResolvedSender, type ServerFrame, type SignInRequestCardData, type WireBot, type WireGroup, type WireTask } from "../shared/wire.ts";
import { isPersistentQuestionCard, shouldSettleRequestCard } from "../shared/ask-question.ts";
import { parseToolScope } from "../shared/tool-scope.ts";
import type { TeamComputersPayload } from "../shared/team-computer.ts";
@@ -2487,7 +2487,7 @@ async function refreshUnsetModelSelections(instances?: readonly SelectableInstan
bootSelection = testedAi.settle(await defaultSelection(undefined, selectable.filter(instance => readyToRun(instance, selectionContext))), selectable, read);
if (hostedModels || !bootSelection.instanceId || !bootSelection.model) return;
const selection = withNewBotEffort(bootSelection, cfg.newBots?.effort,
- registry.get(bootSelection.instanceId)?.adapter.capabilities.effortLevels);
+ offeredEffortLevels(registry.get(bootSelection.instanceId), bootSelection.model));
for (const bot of store.bots) {
if (!bot.modelSelection.instanceId && !bot.modelSelection.model) store.applyModelDefault(bot.id, selection);
}
@@ -2597,7 +2597,7 @@ function checkedModelSelection(
};
}
}
- const allowed: readonly string[] = target?.adapter.capabilities.effortLevels ?? [];
+ const allowed: readonly string[] = offeredEffortLevels(target, selection.model);
if (target && selection.effort !== undefined && !allowed.includes(selection.effort)) {
return { ok: false, status: 400, error: `effort "${selection.effort}" is not offered by this bot's engine` };
}
@@ -2724,13 +2724,13 @@ function checkedMemberIds(value: unknown): { ok: true; memberIds: string[] } | {
}
let bootSelection = { instanceId: "", model: "" }; // Settled by one tiny test message through each AI it could be (server/tested-ai.ts).
const testedAi = createTestedAi({ engine: (instanceId) => registry.get(instanceId), store: () => store, threadBusy, context: selectionContext, changed: () => refreshUnsetModelSelections().then(() => broadcast({ kind: "config", ...configStatus() })),
- saved: () => [cfg.defaultModelSelection, cfg.newBotDefaults?.profile.modelSelection], hosted: () => Boolean(hostedModels), identity: (instanceId) => configIdentity(providerConfigs()[instanceId]), file: join(DATA_DIR, "providers", "ai-checks.json"), forBot: (selection) => withNewBotEffort(selection, cfg.newBots?.effort, registry.get(selection.instanceId)?.adapter.capabilities.effortLevels) });
+ saved: () => [cfg.defaultModelSelection, cfg.newBotDefaults?.profile.modelSelection], hosted: () => Boolean(hostedModels), identity: (instanceId) => configIdentity(providerConfigs()[instanceId]), file: join(DATA_DIR, "providers", "ai-checks.json"), forBot: (selection) => withNewBotEffort(selection, cfg.newBots?.effort, offeredEffortLevels(registry.get(selection.instanceId), selection.model)) });
/** The start-up read of every engine: routines and room handoffs wait for it; a turn waits only for its own engine's probe. */
let enginesRead: Promise<void> | null = null;
const presetStore = createPresetStore();
const store = new Store(
() => bootSelection,
- (selection) => withNewBotEffort(selection, cfg.newBots?.effort, registry.get(selection.instanceId)?.adapter.capabilities.effortLevels),
+ (selection) => withNewBotEffort(selection, cfg.newBots?.effort, offeredEffortLevels(registry.get(selection.instanceId), selection.model)),
(instanceId) => registry.cliTarget(instanceId)?.driverKind,
personLanguages.forPlace,
() => sharedMembership() ? undefined : cfg.profile?.name,
@@ -7563,7 +7563,7 @@ async function beginTurn(
const route = routeDirectTurn(bot, task, store.activePath(threadId), resolvedImages, instance, automated, quickFallback.refused(instance.instanceId));
const { model, effort, variant } = route;
assertModelVariantSupported({ variant, effort }, instance.adapter.capabilities);
- if (effort && !instance.adapter.capabilities.effortLevels?.includes(effort)) {
+ if (effort && !offeredEffortLevels(instance, model).includes(effort)) {
throw Object.assign(
new Error(`effort "${effort}" is not offered by this bot's engine — choose another level in settings`),
{ status: 409 },
diff --git a/server/routes/internal-models.test.ts b/server/routes/internal-models.test.ts
index 5e5643b95b..95da1ba4d9 100644
--- a/server/routes/internal-models.test.ts
+++ b/server/routes/internal-models.test.ts
@@ -40,6 +40,29 @@ describe("modelMenu", () => {
}] });
});
+ it("scopes engine efforts in the menu to listed models' per-model effortLevels", () => {
+ const noUltra = engine("codex", [], {
+ models: { default: "gpt-5.3", options: [{ id: "gpt-5.3", label: "GPT-5.3", effortLevels: ["low", "medium", "high", "xhigh", "max"] }] },
+ adapter: { capabilities: { effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] } },
+ });
+ expect(modelMenu({ engines: [noUltra], current, pinned: [], refusal: opens }).engines[0]).toMatchObject({
+ efforts: ["low", "medium", "high", "xhigh", "max"],
+ });
+ const withUltra = engine("codex", [], {
+ models: {
+ default: "gpt-5.4",
+ options: [
+ { id: "gpt-5.4", label: "GPT-5.4", effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] },
+ { id: "gpt-5.3", label: "GPT-5.3", effortLevels: ["low", "medium", "high", "xhigh", "max"] },
+ ],
+ },
+ adapter: { capabilities: { effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] } },
+ });
+ expect(modelMenu({ engines: [withUltra], current, pinned: [], refusal: opens }).engines[0]).toMatchObject({
+ efforts: ["low", "medium", "high", "xhigh", "max", "ultra"],
+ });
+ });
+
it("names a model the installed CLI is too old for, with the version it needs, instead of dropping it (Fable 5.2 'gone' after an update)", () => {
const claude = engine("claude", [], {
models: { default: "claude-sonnet-5", options: [
diff --git a/server/routes/internal-models.ts b/server/routes/internal-models.ts
index 69c68dda8b..1c02130237 100644
--- a/server/routes/internal-models.ts
+++ b/server/routes/internal-models.ts
@@ -1,4 +1,4 @@
-import type { ModelSelection } from "../../shared/wire.ts";
+import { EFFORT_LEVELS, type ModelSelection } from "../../shared/wire.ts";
import { PASS, type RouteHandler } from "./table.ts";
/** Per engine without `search`, as in t3code's orchestrator_capabilities: one call lands whole in the bot's context. */
@@ -16,7 +16,7 @@ export interface MenuEngine {
instanceId: string;
driverKind: string;
displayName: string | undefined;
- models: { default: string; options: ReadonlyArray<{ id: string; label: string; orgBlocked?: true; needsCliUpdate?: string }> };
+ models: { default: string; options: ReadonlyArray<{ id: string; label: string; orgBlocked?: true; needsCliUpdate?: string; effortLevels?: readonly string[] }> };
adapter: { capabilities: { effortLevels?: readonly string[] } };
}
@@ -95,7 +95,12 @@ export function modelMenu(input: {
continue;
}
room -= listed.length;
- const efforts = engine.adapter.capabilities.effortLevels ?? [];
+ const effortByModel = new Map(engine.models.options.map((option) => [option.id, option.effortLevels]));
+ const fallbackEfforts = engine.adapter.capabilities.effortLevels ?? [];
+ const seenEfforts = new Set<string>(
+ listed.length ? listed.flatMap((id) => effortByModel.get(id) ?? fallbackEfforts) : fallbackEfforts,
+ );
+ const efforts = [...new Set([...EFFORT_LEVELS, ...fallbackEfforts])].filter((level) => seenEfforts.has(level));
engines.push({
instanceId, name,
...(listed.length ? { models: listed.map((id): MenuModel => {
diff --git a/server/startup-model-catalog.test.ts b/server/startup-model-catalog.test.ts
index b926c81b57..7559f2d1c4 100644
--- a/server/startup-model-catalog.test.ts
+++ b/server/startup-model-catalog.test.ts
@@ -118,6 +118,22 @@ describe("startup model catalogs", () => {
expect(readStartupModelCache("org-blocked")?.options[1]).toEqual({ id: "b", label: "B", orgBlocked: true });
});
+ it("preserves per-model effortLevels in the saved list so warm restarts do not leak unsupported efforts", () => {
+ writeStartupModelCache("per-model-efforts", {
+ default: "gpt-5.4",
+ options: [
+ { id: "gpt-5.4", label: "GPT-5.4", effortLevels: ["low", "high", "ultra"] },
+ { id: "gpt-5.3", label: "GPT-5.3", effortLevels: ["low", "high"] },
+ { id: "gpt-4o", label: "GPT-4o", effortLevels: [] },
+ ],
+ });
+ expect(readStartupModelCache("per-model-efforts")?.options).toEqual([
+ { id: "gpt-5.4", label: "GPT-5.4", effortLevels: ["low", "high", "ultra"] },
+ { id: "gpt-5.3", label: "GPT-5.3", effortLevels: ["low", "high"] },
+ { id: "gpt-4o", label: "GPT-4o", effortLevels: [] },
+ ]);
+ });
+
it("does not wait for a slow refresh when a later start already has a catalog", async () => {
seedBots();
writeStartupModelCache("slow", CACHED, STALE);
diff --git a/server/startup-model-catalog.ts b/server/startup-model-catalog.ts
index 34c35036d3..a629a0cffa 100644
--- a/server/startup-model-catalog.ts
+++ b/server/startup-model-catalog.ts
@@ -1,6 +1,7 @@
import { mkdirSync, readFileSync } from "node:fs";
import { dirname, join } from "node:path";
+import { isEffortLevel } from "../shared/wire.ts";
import { writeFileAtomic } from "./atomic.ts";
import { DATA_DIR } from "./config.ts";
import type { ModelCatalog } from "./contracts.ts";
@@ -54,11 +55,13 @@ function catalogFrom(value: unknown): ModelCatalog | null {
loaded?: unknown;
provider?: unknown;
contextWindow?: unknown;
+ effortLevels?: unknown;
variants?: unknown;
orgBlocked?: unknown;
needsCliUpdate?: unknown;
};
if (typeof option.id !== "string" || typeof option.label !== "string") return null;
+ const effortLevels = Array.isArray(option.effortLevels) ? option.effortLevels.filter(isEffortLevel) : undefined;
const variants = variantList(option.variants);
options.push({
id: option.id,
@@ -69,6 +72,7 @@ function catalogFrom(value: unknown): ModelCatalog | null {
...(typeof option.contextWindow === "number" && Number.isFinite(option.contextWindow)
? { contextWindow: option.contextWindow }
: {}),
+ ...(effortLevels !== undefined ? { effortLevels } : {}),
...(variants ? { variants } : {}),
...(option.orgBlocked === true ? { orgBlocked: true as const } : {}),
...(typeof option.needsCliUpdate === "string" ? { needsCliUpdate: option.needsCliUpdate } : {}),
diff --git a/server/testing/fake-codex-app-server.ts b/server/testing/fake-codex-app-server.ts
index 3f11a1464c..545ce140f1 100755
--- a/server/testing/fake-codex-app-server.ts
+++ b/server/testing/fake-codex-app-server.ts
@@ -59,6 +59,7 @@
// FAKE_CODEX_LUNA "1": model/list also offers gpt-6-luna
// FAKE_CODEX_TIERS "1": model/list rows list a Fast service tier, as codex-cli 0.167.2 does; gpt-page-two
// already runs on it by default
+// FAKE_CODEX_EFFORTS "1": model/list rows declare supportedReasoningEfforts (gpt-fake-default includes "ultra", gpt-page-two stops at "max")
// FAKE_CODEX_UPDATED_FILE while this file exists, the CLI was updated in place: --version answers codex-cli 0.162.1
// and model/list also offers gpt-6.1-sol
// FAKE_CODEX_MCP_START "1": on thread/start, start each `-c mcp_servers.*` mount as codex-cli 0.160.1 does
@@ -89,6 +90,7 @@ import { appendFileSync, existsSync, readFileSync, renameSync, unlinkSync, write
const mode = process.env.FAKE_CODEX_MODE ?? "happy";
const tiers = process.env.FAKE_CODEX_TIERS === "1";
+const efforts = process.env.FAKE_CODEX_EFFORTS === "1";
const FAST_TIERS = [{ id: "priority", name: "Fast", description: "Fastest inference with increased plan usage" }];
// Follow the spawning server down; on Windows ppid does not change after parent exit.
@@ -624,7 +626,10 @@ process.stdin.on("data", (chunk) => {
data: [
{ id: "gpt-hidden", displayName: "Hidden", hidden: true, isDefault: false },
{ id: "gpt-page-two", displayName: "GPT Page Two", hidden: false, isDefault: false,
- ...(tiers ? { serviceTiers: FAST_TIERS, defaultServiceTier: "priority" } : {}) },
+ ...(tiers ? { serviceTiers: FAST_TIERS, defaultServiceTier: "priority" } : {}),
+ ...(efforts
+ ? { supportedReasoningEfforts: [{ reasoningEffort: "low" }, { reasoningEffort: "medium" }, { reasoningEffort: "high" }, { reasoningEffort: "xhigh" }, { reasoningEffort: "max" }] }
+ : {}) },
],
nextCursor: null,
},
@@ -640,7 +645,8 @@ process.stdin.on("data", (chunk) => {
? [{ id: "gpt-6-astra", displayName: "GPT-6 Astra", hidden: false, isDefault: true }]
: []),
{ id: "gpt-fake-default", displayName: "GPT Fake Default", hidden: false, isDefault: !hasAstra,
- ...(tiers ? { serviceTiers: FAST_TIERS, defaultServiceTier: null } : {}) },
+ ...(tiers ? { serviceTiers: FAST_TIERS, defaultServiceTier: null } : {}),
+ ...(efforts ? { supportedReasoningEfforts: ["low", "medium", "high", "xhigh", "max", "ultra"] } : {}) },
...(process.env.FAKE_CODEX_LUNA === "1"
? [{ id: "gpt-6-luna", displayName: "GPT-6 Luna", hidden: false, isDefault: false }]
: []),
diff --git a/server/turn-route.test.ts b/server/turn-route.test.ts
index be8c005525..af917d8ba6 100644
--- a/server/turn-route.test.ts
+++ b/server/turn-route.test.ts
@@ -225,4 +225,22 @@ describe("routeDirectTurn", () => {
});
},
);
+
+ it("respects per-model effortLevels when stepping down a conversational turn", () => {
+ const codexBot = { replyStyle: "conversational" as const, modelSelection: { instanceId: "codex", model: "gpt-5.4", effort: "ultra" as const } };
+ const codexInstance = {
+ models: {
+ default: "gpt-5.4",
+ options: [{ id: "gpt-5.4", label: "GPT-5.4", effortLevels: ["medium", "high", "ultra"] as const }],
+ },
+ adapter: { capabilities: { effortLevels: ["low", "medium", "high", "ultra"] as const } },
+ };
+ const hi = { text: "hey, how are you?", images: [] };
+ expect(routeDirectTurn(codexBot, {}, [], hi, codexInstance, false)).toEqual({
+ tier: "simple",
+ model: "gpt-5.4",
+ effort: "ultra",
+ variant: undefined,
+ });
+ });
});
diff --git a/server/turn-route.ts b/server/turn-route.ts
index 847aacd56b..501c73815d 100644
--- a/server/turn-route.ts
+++ b/server/turn-route.ts
@@ -1,6 +1,6 @@
import type { ModelCatalog, ModelSelection } from "./contracts.ts";
import { isConversational, type ReplyStyle } from "../shared/reply-style.ts";
-import type { EffortLevel } from "../shared/wire.ts";
+import { offeredEffortLevels, type EffortLevel } from "../shared/wire.ts";
export type TurnTier = "simple" | "complex";
@@ -125,7 +125,9 @@ export function routeDirectTurn(
variant: bot.modelSelection.variant,
catalog: instance.quickModelsUsable?.() === false ? undefined : instance.models,
refused,
- effortLevels: instance.adapter.capabilities.effortLevels,
+ effortLevels: instance.models
+ ? offeredEffortLevels({ models: instance.models, adapter: instance.adapter }, bot.modelSelection.model)
+ : instance.adapter.capabilities.effortLevels,
contextTokens: task.usage?.context?.tokens,
});
}
diff --git a/shared/wire.ts b/shared/wire.ts
index bd90363f8f..497e650087 100644
--- a/shared/wire.ts
+++ b/shared/wire.ts
@@ -1 +1,2 @@
+export * from "../packages/phone-protocol/src/effort-levels.ts";
export * from "../packages/phone-protocol/src/wire.ts";
diff --git a/src/components/ModelPicker.simple.test.ts b/src/components/ModelPicker.simple.test.ts
index 4bff6b4890..d447a92a96 100644
--- a/src/components/ModelPicker.simple.test.ts
+++ b/src/components/ModelPicker.simple.test.ts
@@ -365,6 +365,32 @@ describe("the model picker in Simple mode", () => {
expect(atDefault).toContain('data-simple-effort-auto="true" class="px-2 pb-1 text-[12px] leading-4 text-ink-tertiary">Recommended. Effort is picked per message.</p>');
});
+ it("offers ultra and its tooltip hint only on models whose effortLevels include ultra", () => {
+ const codexEngine: InstanceInfo = {
+ ...fixture.instances[0]!,
+ instanceId: "codex",
+ driverKind: "codex",
+ displayName: "Codex",
+ capabilities: { effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] },
+ models: {
+ default: "gpt-5.4",
+ options: [
+ { id: "gpt-5.4", label: "GPT-5.4", effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] },
+ { id: "gpt-5.3", label: "GPT-5.3", effortLevels: ["low", "medium", "high", "xhigh", "max"] },
+ ],
+ },
+ };
+ fixture.instances = [codexEngine];
+ const withUltra = open(bot("ultra", "codex", "gpt-5.4"));
+ expect(thinking(withUltra).levels).toEqual(["low", "medium", "high", "xhigh", "max", "ultra"]);
+ const ultraBand = region(menu(withUltra.html), "data-simple-effort-band");
+ expect(ultraBand).toMatch(/aria-pressed="true"[^>]*>Ultra<\/button>/);
+ expect(ultraBand).toContain(">Maximum thinking with automatic task delegation. Slowest, for the toughest jobs.</p>");
+ fixture.values = [];
+ const withoutUltra = open(bot("high", "codex", "gpt-5.3"));
+ expect(thinking(withoutUltra).levels).toEqual(["low", "medium", "high", "xhigh", "max"]);
+ });
+
it("names the model on the Simple chip, quiet until hovered; thinking and route stay in its tooltip and the menu", () => {
const chip = render(bot("high")).nodes.find((node) => node.props["data-tour"] === "model")!;
const markup = renderToStaticMarkup(chip);
diff --git a/src/components/ModelPicker.test.ts b/src/components/ModelPicker.test.ts
index 03ca11b09f..0c67183312 100644
--- a/src/components/ModelPicker.test.ts
+++ b/src/components/ModelPicker.test.ts
@@ -134,6 +134,36 @@ describe("EffortRow", () => {
it("renames xhigh, the one level that does not capitalize cleanly", () => {
expect(renderEffort([engine(["xhigh"])])).toContain(">X-High<");
});
+
+ it("offers per-model effort levels (including Ultra) and clears unsupported effort on switch", () => {
+ const tieredEngine: InstanceInfo = {
+ ...engine(["low", "medium", "high", "xhigh", "max", "ultra"]),
+ models: {
+ default: "gpt-6.2-sol",
+ options: [
+ { id: "gpt-6.2-sol", label: "GPT-6.2-Sol", effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] },
+ { id: "gpt-6-luna", label: "GPT-6-Luna", effortLevels: ["low", "medium", "high", "xhigh", "max"] },
+ ],
+ },
+ };
+ fixture.instances = [tieredEngine];
+
+ const solMarkup = renderToStaticMarkup(createElement(EffortRow, {
+ bot: { ...bot("ultra"), modelSelection: { instanceId: "codex", model: "gpt-6.2-sol", effort: "ultra" } },
+ }));
+ expect(levelButtons(solMarkup).map((button) => button.label)).toEqual(["Default", "Low", "Medium", "High", "X-High", "Max", "Ultra"]);
+
+ const lunaMarkup = renderToStaticMarkup(createElement(EffortRow, {
+ bot: { ...bot(), modelSelection: { instanceId: "codex", model: "gpt-6-luna" } },
+ }));
+ expect(levelButtons(lunaMarkup).map((button) => button.label)).toEqual(["Default", "Low", "Medium", "High", "X-High", "Max"]);
+
+ expect(modelSelectionForPick(
+ { instanceId: "codex", model: "gpt-6.2-sol", effort: "ultra" },
+ tieredEngine,
+ "gpt-6-luna",
+ )).toEqual({ instanceId: "codex", model: "gpt-6-luna" });
+ });
});
diff --git a/src/components/ModelPicker.tsx b/src/components/ModelPicker.tsx
index 574c71fa6e..ed02ea2494 100644
--- a/src/components/ModelPicker.tsx
+++ b/src/components/ModelPicker.tsx
@@ -4,7 +4,7 @@ import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState, type
import { createPortal } from "react-dom";
import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp, KeyRound, Loader2, RefreshCw, X } from "lucide-react";
import { currentTaskBot, type Bot, type InstanceInfo, type ModelSelection } from "@/state/store"; import { sameFields, useStoreActions, useStoreDispatch, useStoreSelector } from "@/state/store-select";
-import type { EffortLevel } from "../../shared/wire";
+import { offeredEffortLevels, type EffortLevel } from "../../shared/wire";
import { filterCustomModels, partitionCustomModels, suggestedModels } from "@/lib/custom-models";
import { configuredModelInstances, isClaudeAccount, isCustomOnly, modelsAwaitEngine, SIGN_IN_FAMILY_LABEL, signInFamily } from "@/lib/engine-rail";
import { modelName, simpleModelMenu, variantSuffix } from "@/lib/simple-model-menu";
@@ -72,7 +72,7 @@ export function EffortRow({
if (instance?.capabilities?.modelVariants) {
return <ModelVariantRow bot={bot} threadId={threadId} updateBotDefault={updateBotDefault} className={className} label={label} compact={compact} quiet={compact} />;
}
- const levels = instance?.capabilities?.effortLevels;
+ const levels = offeredEffortLevels(instance, selection.model);
if (!levels?.length) return null;
if (compact) return (
@@ -523,7 +523,7 @@ export function ModelPicker({
);
const remote = window.ogb?.remoteClient?.active === true;
- const levels = active?.capabilities?.effortLevels ?? [];
+ const levels = offeredEffortLevels(active, selection.model);
const writeEffort = (effort: EffortLevel | undefined) => {
const { effort: _effort, ...model } = selection;
dispatch({ type: "setModel", botId: bot.id, threadId, ...(threadId && simpleUpdatesBotDefault ? { updateBotDefault: true } : {}),
diff --git a/src/components/model-picker-reasoning.ts b/src/components/model-picker-reasoning.ts
index 1fbd4b5743..05e06e74ad 100644
--- a/src/components/model-picker-reasoning.ts
+++ b/src/components/model-picker-reasoning.ts
@@ -1,5 +1,6 @@
import { useEffect, useRef, type RefObject } from "react";
import type { AppState, Bot, InstanceInfo, ModelSelection } from "@/state/store";
+import { offeredEffortLevels } from "../../shared/wire";
import type { ModelVariantOption } from "../../shared/runtime-events";
import { t } from "@/lib/i18n";
import type { LocaleKey } from "@/locales";
@@ -30,7 +31,7 @@ export function variantChoices(state: Pick<AppState, "instances" | "modelVariant
export function offersReasoning(state: Pick<AppState, "instances" | "modelVariantSessions">, instance: InstanceInfo, next: ModelSelection, threadId: string | undefined): boolean {
return instance.capabilities?.modelVariants
? Boolean(variantChoices(state, next, threadId))
- : Boolean(instance.capabilities?.effortLevels?.length);
+ : Boolean(offeredEffortLevels(instance, next.model).length);
}
/**
diff --git a/src/lib/model-choices.test.ts b/src/lib/model-choices.test.ts
index 99903d846c..cc41876fef 100644
--- a/src/lib/model-choices.test.ts
+++ b/src/lib/model-choices.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from "vitest";
import type { InstanceInfo, ModelSelection } from "@/state/store";
import { choiceIsSelected, modelChoices, withTypedModels } from "./model-choices";
+import { offeredEffortLevels } from "../../shared/wire";
import { simpleModelMenu } from "./simple-model-menu";
vi.hoisted(() => {
@@ -70,3 +71,11 @@ describe("OpenCode models typed by hand", () => {
expect(added(withTypedModels([opencode], onPickle, "opencode/brand-new"))).toEqual([{ id: "typed::opencode/brand-new", label: "opencode/brand-new · typed by hand" }]);
});
});
+
+describe("offeredEffortLevels", () => {
+ it("falls back cleanly when a partial instance omits models or options", () => {
+ expect(offeredEffortLevels({ capabilities: { effortLevels: ["low", "high"] } }, "gpt-5")).toEqual(["low", "high"]);
+ expect(offeredEffortLevels({ models: {}, adapter: { capabilities: { effortLevels: ["medium"] } } }, "gpt-5")).toEqual(["medium"]);
+ expect(offeredEffortLevels(undefined, "gpt-5")).toEqual([]);
+ });
+});
diff --git a/src/lib/model-choices.ts b/src/lib/model-choices.ts
index 7d0fb03755..44840967ff 100644
--- a/src/lib/model-choices.ts
+++ b/src/lib/model-choices.ts
@@ -1,4 +1,5 @@
import type { InstanceInfo, ModelSelection } from "@/state/store";
+import { offeredEffortLevels } from "../../shared/wire";
import { openCodeRunsTypedModel, typedOpenCodeModel, typedOpenCodeModelId } from "../../shared/opencode-model-id";
import { t } from "./i18n";
@@ -28,7 +29,7 @@ export function modelSelectionForPick(selection: ModelSelection, instance: Insta
const next: ModelSelection = { instanceId: instance.instanceId, model };
if (instance.instanceId === selection.instanceId) {
if (instance.capabilities?.modelVariants && model === selection.model && selection.variant !== undefined) next.variant = selection.variant;
- else if (!instance.capabilities?.modelVariants && selection.effort) next.effort = selection.effort;
+ else if (!instance.capabilities?.modelVariants && selection.effort && offeredEffortLevels(instance, model).includes(selection.effort)) next.effort = selection.effort;
}
return next;
}
diff --git a/src/lib/team-bulk-settings.test.ts b/src/lib/team-bulk-settings.test.ts
index 45b807872f..8b19030eaa 100644
--- a/src/lib/team-bulk-settings.test.ts
+++ b/src/lib/team-bulk-settings.test.ts
@@ -174,7 +174,46 @@ describe("team-wide settings", () => {
it("is offered in the team menu only when the caller passes the owner's action", () => {
const base = { onAddBots: vi.fn(), onRename: vi.fn(), onShare: vi.fn(), onDelete: vi.fn() };
expect(renderToStaticMarkup(createElement(TeamMenuItems, base))).not.toContain("Set for all bots");
- expect(renderToStaticMarkup(createElement(TeamMenuItems, { ...base, onSetForAll: vi.fn() }))).toContain("Set for all bots in this department…");
+ const markup = renderToStaticMarkup(createElement(TeamMenuItems, { ...base, onSetForAll: vi.fn() }));
+ expect(markup).toContain("Set for all bots in this department…");
+ });
+
+ it("scopes team effort choices and model switches to per-model effortLevels, including ultra", () => {
+ const codex = engine("codex", "codex", ["gpt-5.4", "gpt-5.3"], {
+ capabilities: { effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] },
+ models: {
+ default: "gpt-5.4",
+ options: [
+ { id: "gpt-5.4", label: "GPT-5.4", effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] },
+ { id: "gpt-5.3", label: "GPT-5.3", effortLevels: ["low", "medium", "high", "xhigh", "max"] },
+ ],
+ },
+ } as Partial<InstanceInfo>);
+ const codexNoUltra = engine("codex", "codex", ["gpt-5.3"], {
+ capabilities: { effortLevels: ["low", "medium", "high", "xhigh", "max", "ultra"] },
+ models: {
+ default: "gpt-5.3",
+ options: [{ id: "gpt-5.3", label: "GPT-5.3", effortLevels: ["low", "medium", "high", "xhigh", "max"] }],
+ },
+ } as Partial<InstanceInfo>);
+ const ultraBot = bot("u", { modelSelection: { instanceId: "codex", model: "gpt-5.4", effort: "ultra" } });
+ const otherBot = bot("o", { modelSelection: { instanceId: "codex", model: "gpt-5.3" } });
+
+ expect(teamEffortChoices([ultraBot], [codex], EFFORT_LEVELS)).toEqual(["low", "medium", "high", "xhigh", "max", "ultra"]);
+ expect(teamEffortChoices([otherBot], [codexNoUltra], EFFORT_LEVELS)).toEqual(["low", "medium", "high", "xhigh", "max"]);
+
+ expect(planTeamChange([ultraBot], [codex], { kind: "model", model: "gpt-5.3", effort: "ultra" })[0]).toMatchObject({
+ status: "skip",
+ reason: "Codex does not offer this effort level",
+ });
+ expect(planTeamChange([otherBot], [codex], { kind: "model", model: "gpt-5.4", effort: "ultra" })[0]).toMatchObject({
+ status: "apply",
+ patch: { modelSelection: { instanceId: "codex", model: "gpt-5.4", effort: "ultra" } },
+ });
+ expect(planTeamChange([ultraBot], [codex], { kind: "model", model: "gpt-5.3" })[0]).toMatchObject({
+ status: "apply",
+ patch: { modelSelection: { instanceId: "codex", model: "gpt-5.3" } },
+ });
});
});
diff --git a/src/lib/team-bulk-settings.ts b/src/lib/team-bulk-settings.ts
index 0fd72d84a9..87b0143086 100644
--- a/src/lib/team-bulk-settings.ts
+++ b/src/lib/team-bulk-settings.ts
@@ -6,7 +6,7 @@ import { approvalModeFor, supportsApprovalMode, type ApprovalMode } from "../../
import { atLeast, sameAccess, type BotAccess, type BotAccessLevel, type GrantedLevel } from "../../shared/bot-access";
import { botOwner } from "../../shared/bot-owner";
import { accessOfBot, withPerson } from "@/components/bot-access/access";
-import type { EffortLevel, ModelSelection } from "../../shared/wire";
+import { offeredEffortLevels, type EffortLevel, type ModelSelection } from "../../shared/wire";
/** Custom is per bot: it can only be granted through the desktop's confirmation for that one bot. */
export const TEAM_APPROVAL_MODES = ["ask", "edits", "auto", "full"] as const satisfies readonly ApprovalMode[];
@@ -63,8 +63,15 @@ export function teamEffortChoices(bots: readonly Bot[], instances: readonly Inst
const offered = new Set<EffortLevel>();
for (const bot of bots) {
const engine = engineOf(bot, instances);
- if (engine?.capabilities?.modelVariants) continue;
- for (const level of engine?.capabilities?.effortLevels ?? []) offered.add(level);
+ if (!engine || engine.capabilities?.modelVariants) continue;
+ const options = engine.models.options ?? [];
+ const levels = options.length
+ ? options.flatMap((option) => offeredEffortLevels(engine, option.id))
+ : (engine.capabilities?.effortLevels ?? []);
+ for (const level of levels) offered.add(level);
+ if (bot.modelSelection?.model) {
+ for (const level of offeredEffortLevels(engine, bot.modelSelection.model)) offered.add(level);
+ }
}
return order.filter((level) => offered.has(level));
}
@@ -103,12 +110,12 @@ export function planTeamChange(bots: readonly Bot[], instances: readonly Instanc
const next: ModelSelection = { instanceId: current.instanceId, model };
if (current.variant && model === current.model) next.variant = current.variant;
if (change.effort === undefined) {
- if (current.effort) next.effort = current.effort;
+ if (current.effort && offeredEffortLevels(engine, model).includes(current.effort)) next.effort = current.effort;
} else if (change.effort !== null) {
if (engine.capabilities?.modelVariants) {
return { bot, status: "skip", reason: t("teamSettings.skip.variantsOnly", { engine: engineName }) };
}
- if (!(engine.capabilities?.effortLevels ?? []).includes(change.effort)) {
+ if (!offeredEffortLevels(engine, model).includes(change.effort)) {
return { bot, status: "skip", reason: t("teamSettings.skip.effortUnsupported", { engine: engineName }) };
}
next.effort = change.effort;
diff --git a/src/locales/en.json b/src/locales/en.json
index 6ec1213444..f755699fbb 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -3258,6 +3258,7 @@
"model.effort.deep": "Deep",
"model.effort.deeper": "Deeper",
"model.effort.max": "Max",
+ "model.effort.ultra": "Ultra",
"model.blurb.smartest": "Smartest. Best for hard, long jobs.",
"model.blurb.balanced": "Fast and smart. Good for most work.",
"model.blurb.fastest": "Quickest and cheapest. Simple tasks.",
@@ -3289,6 +3290,7 @@
"model.simple.effortHint.high": "Careful thinking for harder problems. Slower.",
"model.simple.effortHint.xhigh": "Very careful, for tricky multi-step work. Slower still.",
"model.simple.effortHint.max": "Thinks as long as it needs. Slowest, for the hardest jobs.",
+ "model.simple.effortHint.ultra": "Maximum thinking with automatic task delegation. Slowest, for the toughest jobs.",
"model.simple.thinkingSummary": "{level} thinking",
"model.setupRequired": "Setup required",
"model.signInRequired": "Sign-in required",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 978cd3fe83..b335b5c5d6 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -3071,6 +3071,7 @@
"model.effort.deep": "Profundo",
"model.effort.deeper": "Mais profundo",
"model.effort.max": "Máximo",
+ "model.effort.ultra": "Ultra",
"model.blurb.smartest": "O mais inteligente. Ideal para trabalhos longos e difíceis.",
"model.blurb.balanced": "Rápido e inteligente. Bom para a maioria dos trabalhos.",
"model.blurb.fastest": "O mais rápido e barato. Tarefas simples.",
@@ -3102,6 +3103,7 @@
"model.simple.effortHint.high": "Raciocínio cuidadoso para problemas mais difíceis. Mais lento.",
"model.simple.effortHint.xhigh": "Muito cuidadoso, para tarefas complexas em várias etapas. Ainda mais lento.",
"model.simple.effortHint.max": "Pensa o quanto precisar. O mais lento, para as tarefas mais difíceis.",
+ "model.simple.effortHint.ultra": "Raciocínio máximo com delegação automática de tarefas. O mais lento, para as tarefas mais difíceis.",
"model.simple.thinkingSummary": "Raciocínio: {level}",
"model.setupRequired": "Precisa de configuração",
"model.signInRequired": "Precisa de login",
diff --git a/src/state/store.tsx b/src/state/store.tsx
index 9fd0e33a1f..97a0a1bad2 100644
--- a/src/state/store.tsx
+++ b/src/state/store.tsx
@@ -438,7 +438,7 @@ export interface InstanceInfo extends InstanceEndpointInfo {
aiTest?: import("../../shared/ai-ranking").AiTestState;
/** Why it didn't answer: in plain words when it said (signed out, a used-up limit…), and as a word from a fixed list. */
aiTestError?: string; aiTestReason?: import("../../shared/ai-ranking").AiTestReason;
- models: { default: string; options: Array<{ id: string; label: string; custom?: boolean; loaded?: boolean; provider?: string; variants?: ModelVariantOption[]; orgBlocked?: true; needsCliUpdate?: string; local?: import("../../shared/local-model").LocalModelFacts }> };
+ models: { default: string; options: Array<{ id: string; label: string; custom?: boolean; loaded?: boolean; provider?: string; variants?: ModelVariantOption[]; effortLevels?: readonly EffortLevel[]; orgBlocked?: true; needsCliUpdate?: string; local?: import("../../shared/local-model").LocalModelFacts }> };
capabilities?: {
computerMcp?: boolean;
agentsMcp?: boolean;