Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/provider/reasoning-effort.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ describe("supportedEfforts", () => {
test("unknown model gets the safe subset", () => {
expect(supportedEfforts("some-random-model")).toEqual(["low", "medium", "high"]);
});

test("grok-4.6 includes xhigh", () => {
expect(supportedEfforts("grok-4.6")).toEqual(["low", "medium", "high", "xhigh"]);
});

test("grok-4.5 stays on the unknown-model subset without xhigh", () => {
expect(supportedEfforts("grok-4.5")).toEqual(["low", "medium", "high"]);
});

test("grok-composer-2.5-fast stays on the unknown-model subset without xhigh", () => {
expect(supportedEfforts("grok-composer-2.5-fast")).toEqual(["low", "medium", "high"]);
});
});

describe("validateEffort", () => {
Expand All @@ -97,6 +109,11 @@ describe("validateEffort", () => {
expect(validateEffort("unknown", "xhigh").ok).toBe(false);
expect(validateEffort("unknown", "minimal").ok).toBe(false);
});

test("accepts xhigh on grok-4.6 and rejects it on grok-4.5", () => {
expect(validateEffort("grok-4.6", "xhigh")).toEqual({ ok: true });
expect(validateEffort("grok-4.5", "xhigh").ok).toBe(false);
});
});

describe("cycleReasoningEffort", () => {
Expand All @@ -118,6 +135,11 @@ describe("cycleReasoningEffort", () => {
setModelReasoningCapabilities({ "chat-only-model": false });
expect(cycleReasoningEffort("chat-only-model", "medium")).toBeUndefined();
});

test("wraps high to xhigh to low on grok-4.6", () => {
expect(cycleReasoningEffort("grok-4.6", "high")).toBe("xhigh");
expect(cycleReasoningEffort("grok-4.6", "xhigh")).toBe("low");
});
});

describe("reasoning capability gate", () => {
Expand Down
7 changes: 7 additions & 0 deletions src/provider/reasoning-effort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ const MAX_EFFORT_CODEX_MODELS: readonly string[] = ["gpt-5.6-sol", "gpt-5.6-terr
// purpose: these are the levels the broadest range of reasoning models accept.
const UNKNOWN_MODEL_EFFORTS: readonly ReasoningEffort[] = ["low", "medium", "high"];

// grok-4.6 accepts xhigh; grok-4.5 and composer stay on the unknown-model subset.
const GROK_46_EFFORTS: readonly ReasoningEffort[] = ["low", "medium", "high", "xhigh"];
const GROK_46_MODELS: readonly string[] = ["grok-4.6"];

function isKnownOpenAIReasoningModel(model: string): boolean {
return model.startsWith("gpt-5") || model.startsWith("o1") || model.startsWith("o3") || model.startsWith("o4");
}
Expand Down Expand Up @@ -75,6 +79,9 @@ export function supportedEfforts(
if (isKnownOpenAIReasoningModel(model)) {
return [...DEFAULT_EFFORTS];
}
if (GROK_46_MODELS.includes(model)) {
return [...GROK_46_EFFORTS];
}
return [...UNKNOWN_MODEL_EFFORTS];
}

Expand Down
Loading