Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

fix: remove redundant maximum effort choices

Rach Pradhan87c54011585b
diff --git a/TUI/effort.zig b/TUI/effort.zig
index de419d84..a4d08e11 100644
--- a/TUI/effort.zig
+++ b/TUI/effort.zig
@@ -20,16 +20,21 @@ fn blurb(e: engine.Effort) []const u8 {
};
}
-fn hidesMax() bool {
+fn hides(e: engine.Effort) bool {
const p = engine.g_model_provider;
const m = engine.g_model_name;
- return std.mem.eql(u8, p, "xai") or std.mem.startsWith(u8, m, "grok");
+ if (std.mem.eql(u8, p, "xai") or std.mem.startsWith(u8, m, "grok"))
+ return e == .max or e == .ultra;
+ if (std.mem.eql(u8, p, "openai") or std.mem.eql(u8, p, "codex") or
+ std.mem.startsWith(u8, m, "gpt-") or std.mem.startsWith(u8, m, "openai/gpt-"))
+ return e == .max;
+ return false;
}
pub fn filter(query: []const u8, out: []engine.Effort) usize {
var n: usize = 0;
for (all) |e| {
- if (hidesMax() and (e == .max or e == .ultra)) continue;
+ if (hides(e)) continue;
const name = @tagName(e);
if (query.len > 0 and std.mem.indexOf(u8, name, query) == null) continue;
if (n >= out.len) break;
@@ -85,19 +90,41 @@ test "filter matches effort names" {
try std.testing.expectEqual(@as(usize, all.len), filter("", &buf));
}
-test "grok seat hides max and ultra" {
+test "seat effort lists and last-row keyboard selection" {
const saved_p = engine.g_model_provider;
const saved_m = engine.g_model_name;
defer {
engine.g_model_provider = saved_p;
engine.g_model_name = saved_m;
}
- engine.g_model_provider = "xai";
- engine.g_model_name = "grok-4.6";
- var buf: [8]engine.Effort = undefined;
- const n = filter("", &buf);
- try std.testing.expectEqual(@as(usize, 4), n);
- for (buf[0..n]) |e| try std.testing.expect(e != .max and e != .ultra);
+ const openai_levels = [_]engine.Effort{ .low, .medium, .high, .xhigh, .ultra };
+ const grok_levels = [_]engine.Effort{ .low, .medium, .high, .xhigh };
+ const cases = [_]struct { provider: []const u8, model: []const u8, levels: []const engine.Effort }{
+ .{ .provider = "openai", .model = "o3", .levels = &openai_levels },
+ .{ .provider = "codex", .model = "codex", .levels = &openai_levels },
+ .{ .provider = "proxy", .model = "gpt-5", .levels = &openai_levels },
+ .{ .provider = "proxy", .model = "openai/gpt-5", .levels = &openai_levels },
+ .{ .provider = "xai", .model = "gpt-5", .levels = &grok_levels },
+ .{ .provider = "openai", .model = "grok-4.6", .levels = &grok_levels },
+ .{ .provider = "other", .model = "other", .levels = all },
+ };
+ for (cases) |case| {
+ engine.g_model_provider = case.provider;
+ engine.g_model_name = case.model;
+ var buf: [8]engine.Effort = undefined;
+ const n = filter("", &buf);
+ try std.testing.expectEqualSlices(engine.Effort, case.levels, buf[0..n]);
+
+ var term: @import("sim.zig").Term = undefined;
+ term.init(std.testing.allocator, 80, 24);
+ defer term.deinit();
+ term.model.openOverlay(.effort);
+ term.model.overlay_sel = 0;
+ for (1..n) |_| _ = term.feed("\x1b[B");
+ try std.testing.expectEqual(case.levels[n - 1], pick(&term.model).?);
+ _ = term.enter();
+ try std.testing.expectEqual(case.levels[n - 1], term.model.effort);
+ }
}
test "effort overlay lists levels and marks current" {
diff --git a/evals/harness_behavior.jsonl b/evals/harness_behavior.jsonl
index 5b4d65c5..ec5e2a2d 100644
--- a/evals/harness_behavior.jsonl
+++ b/evals/harness_behavior.jsonl
@@ -1,3 +1,4 @@
+{"id": "openai-effort-max-alias", "why": "#864: the redundant Max choice is hidden for GPT seats; a legacy JSON Max selection must resolve to Ultra and retain its delegation guidance on the next turn.", "controls_before_prompt": [{"type": "set_model", "provider": "lmstudio", "model": "gpt-6-astra"}, {"type": "set_effort", "level": "max"}], "prompt": "Reply with effort ready.", "script": [{"text": "effort ready"}], "assert": [{"event": {"type": "model", "ok": true, "provider": "lmstudio", "model": "gpt-6-astra"}}, {"event": {"type": "effort", "ok": true, "level": "ultra"}}, {"request_contains": {"index": 0, "text": "Pick ONE shape"}}, {"final_text_contains": "effort ready"}]}
{"id": "goal-checklist-completes", "why": "#318: a standing goal must produce a checklist and be able to finish it. The regression was a goal born done, or one that could never be closed.", "args": ["--goal", "add a health endpoint and a test for it"], "prompt": "get the objective done", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "add the health endpoint", "status": "in_progress"}, {"content": "add a test for it", "status": "pending"}]}}, {"tool": "todo_write", "arguments": {"todos": [{"content": "add the health endpoint", "status": "completed"}, {"content": "add a test for it", "status": "completed"}]}}, {"text": "the endpoint and its test are in"}], "assert": [{"events_at_least": {"match": {"type": "tool_call", "name": "todo_write"}, "count": 2}}, {"request_contains": {"index": -1, "text": "add the health endpoint"}}, {"request_contains": {"index": -1, "text": "completed"}}, {"final_text_contains": "the endpoint and its test are in"}]}
{"id": "standing-goal-restated", "why": "#318: --goal is a standing objective, so it has to reach the model on every call, not only the first.", "args": ["--goal", "keep the build green"], "prompt": "what should I do next", "script": [{"text": "checking"}, {"text": "still checking"}], "assert": [{"request_contains": {"index": 0, "text": "keep the build green"}}, {"request_contains": {"index": -1, "text": "keep the build green"}}]}
{"id": "todo-empty-write-noop", "why": "6300514: a todo_write with no usable items must leave the list untouched. It used to wipe the checklist, and an empty list read as completion.", "args": [], "prompt": "plan two steps, then send an empty checklist", "script": [{"tool": "todo_write", "arguments": {"todos": [{"content": "survey the call sites", "status": "pending"}, {"content": "land the fix", "status": "pending"}]}}, {"tool": "todo_write", "arguments": {"todos": []}}, {"tool": "todo_read", "arguments": {}}, {"text": "the plan is unchanged"}], "assert": [{"events_at_least": {"match": {"type": "tool_call", "name": "todo_read"}, "count": 1}}, {"request_contains": {"index": -1, "text": "survey the call sites"}}, {"request_contains": {"index": -1, "text": "land the fix"}}]}
diff --git a/src/acp.zig b/src/acp.zig
index d13ffdb1..316bc4b3 100644
--- a/src/acp.zig
+++ b/src/acp.zig
@@ -151,12 +151,12 @@ fn liveModels(ctx: *anyopaque, arena: Allocator, w: *Io.Writer, req: proto.Reque
.current = std.mem.eql(u8, m.name, root.provider.model) and std.mem.eql(u8, m.provider, root.provider.id),
};
}
- const all_efforts = [_][]const u8{ "low", "medium", "high", "xhigh", "max", "ultra" };
- const levels: []const []const u8 = if (!root.effortApplies()) &.{} else if (@import("effort_route.zig").hidesMax(root.provider.id, root.provider.model)) all_efforts[0..4] else &all_efforts;
+ const er = @import("effort_route.zig");
+ const levels: []const []const u8 = if (!root.effortApplies()) &.{} else er.levels(root.provider.id, root.provider.model);
try proto.writeResult(w, req.id, .{
.models = rows,
.commands = proto.slashCommands(),
- .current = .{ .model = root.provider.model, .provider = root.provider.id, .effort = @tagName(root.reasoning), .fast = root.fast, .effortLevels = levels, .fastSupported = std.mem.eql(u8, root.provider.id, "codex") },
+ .current = .{ .model = root.provider.model, .provider = root.provider.id, .effort = er.normalize(root.provider.id, root.provider.model, @tagName(root.reasoning)), .fast = root.fast, .effortLevels = levels, .fastSupported = std.mem.eql(u8, root.provider.id, "codex") },
});
return true;
}
@@ -537,6 +537,41 @@ test "ACP advertises the complete REPL command catalog including compact" {
}
}
+test "OpenAI effort menu omits Max and keeps Ultra on the Responses wire" {
+ var state = std.heap.ArenaAllocator.init(testing.allocator);
+ defer state.deinit();
+ const a = state.allocator();
+ var root = try @import("agent_request_body_responses.zig").testAgentFor(a, "openai", .responses, "gpt-6-astra");
+ var keys: provider_mod.Keys = .{ .values = @splat(null) };
+ var aw: Io.Writer.Allocating = .init(a);
+ var live: LiveTurn = .{ .root = &root, .keys = &keys, .out = &aw.writer };
+ var d: Dispatch = .{ .turn = echoTurn, .ctx = &live, .extra = liveModels };
+ const expected = [_][]const u8{ "low", "medium", "high", "xhigh", "ultra" };
+ for ([_][]const u8{ "openai", "codex", "codegraff" }) |pid| {
+ root.provider.id = pid;
+ root.reasoning = .max; // saved Max remains a valid, visible selection
+ aw.clearRetainingCapacity();
+ try handleLine(&d, a, &aw.writer, "{\"id\":1,\"method\":\"graff/models\"}");
+ const result = try std.json.parseFromSliceLeaky(Value, a, aw.writer.buffered(), .{});
+ const current = result.object.get("result").?.object.get("current").?.object;
+ try testing.expectEqualStrings("ultra", current.get("effort").?.string);
+ const levels = current.get("effortLevels").?.array.items;
+ try testing.expectEqual(expected.len, levels.len);
+ for (expected, levels) |tag, level| try testing.expectEqualStrings(tag, level.string);
+ // The last advertised choice must serialize as API max, never ultra.
+ root.reasoning = std.meta.stringToEnum(main_mod.ReasoningEffort, levels[levels.len - 1].string).?;
+ const body = try root.buildBody(null, false, true, true);
+ defer testing.allocator.free(body);
+ const request = try std.json.parseFromSliceLeaky(Value, a, body, .{});
+ try testing.expectEqualStrings("max", request.object.get("reasoning").?.object.get("effort").?.string);
+ root.reasoning = .xhigh;
+ const extra = try root.buildBody(null, false, true, true);
+ defer testing.allocator.free(extra);
+ const extra_request = try std.json.parseFromSliceLeaky(Value, a, extra, .{});
+ try testing.expectEqualStrings("xhigh", extra_request.object.get("reasoning").?.object.get("effort").?.string);
+ }
+}
+
test "handleLine: live context occupancy precedes the terminal prompt reply" {
const was_cancelled = engine.cancel_flag.swap(false, .acq_rel);
defer engine.cancel_flag.store(was_cancelled, .release);
diff --git a/src/agent_prompt.zig b/src/agent_prompt.zig
index f0194441..1450e1c9 100644
--- a/src/agent_prompt.zig
+++ b/src/agent_prompt.zig
@@ -125,10 +125,8 @@ fn effortTier(effort: main_mod.ReasoningEffort) engine_events.ReasoningEffort {
};
}
-/// The badge names the effort that will actually go on the wire. Kimi
-/// normalizes the session knob against the catalog's allow-list (k3 allows
-/// low/high/max with default max, so a Medium session sends "max"); showing
-/// the raw knob would badge "Medium" over a request that runs at "max".
+/// The badge names the effective wire effort using the provider's UI tags.
+/// Kimi normalizes against its catalog; OpenAI displays API max as Ultra.
fn effectiveEffort(self: *Agent) ?engine_events.ReasoningEffort {
if (std.mem.eql(u8, self.provider.id, "kimi")) {
const wire = pricing.kimiThinkingEffort(self.provider.model, @tagName(self.reasoning)) orelse
@@ -139,9 +137,11 @@ fn effectiveEffort(self: *Agent) ?engine_events.ReasoningEffort {
return null;
}
if (!self.effortApplies()) return null;
- const wire = @import("effort_route.zig").wireEffort(self.provider.model, @tagName(self.reasoning));
+ const er = @import("effort_route.zig");
+ const wire = er.wireEffort(self.provider.model, @tagName(self.reasoning));
+ const display = er.normalize(self.provider.id, self.provider.model, wire);
inline for (std.meta.tags(main_mod.ReasoningEffort)) |tag| {
- if (std.mem.eql(u8, @tagName(tag), wire)) return effortTier(tag);
+ if (std.mem.eql(u8, @tagName(tag), display)) return effortTier(tag);
}
return effortTier(self.reasoning);
}
@@ -202,6 +202,16 @@ test "kimi effort badge names the normalized wire effort, not the raw knob" {
// No catalog row, no wire effort, no badge.
agent.provider.model = "unknown-xyz";
try std.testing.expectEqual(@as(?engine_events.ReasoningEffort, null), effectiveEffort(&agent));
+
+ // OpenAI presents API max as Ultra, including old saved Max settings.
+ agent.provider.id = "openai";
+ agent.provider.kind = .responses;
+ agent.provider.model = "gpt-6-astra";
+ try std.testing.expectEqual(engine_events.ReasoningEffort.ultra, effectiveEffort(&agent).?);
+ agent.reasoning = .ultra;
+ try std.testing.expectEqual(engine_events.ReasoningEffort.ultra, effectiveEffort(&agent).?);
+ agent.reasoning = .xhigh;
+ try std.testing.expectEqual(engine_events.ReasoningEffort.xhigh, effectiveEffort(&agent).?);
}
test "standing work snapshots goal, checklist, session, and a staged image" {
diff --git a/src/commands_effort.zig b/src/commands_effort.zig
new file mode 100644
index 00000000..8ee84cf4
--- /dev/null
+++ b/src/commands_effort.zig
@@ -0,0 +1,73 @@
+//! Provider-aware /effort and /reasoning selector.
+const std = @import("std");
+const main_mod = @import("main.zig");
+const Agent = @import("agent.zig").Agent;
+const ReasoningEffort = main_mod.ReasoningEffort;
+const pickers = @import("pickers.zig");
+const er = @import("effort_route.zig");
+
+const reasoning_levels = [_]pickers.PickItem{
+ .{ .name = "Low", .desc = "Fast responses with lighter reasoning" },
+ .{ .name = "Medium", .desc = "Balances speed and reasoning depth for everyday tasks" },
+ .{ .name = "High", .desc = "Greater reasoning depth for complex problems" },
+ .{ .name = "Extra high", .desc = "Extra high reasoning depth for complex problems" },
+ .{ .name = "Max", .desc = "Maximum reasoning depth for the hardest problems" },
+ .{ .name = "Ultra", .desc = "Maximum reasoning with automatic task delegation" },
+};
+
+fn normalized(root: *Agent, requested: []const u8) ?ReasoningEffort {
+ const tag = er.normalize(root.provider.id, root.provider.model, requested);
+ const effort = std.meta.stringToEnum(ReasoningEffort, tag) orelse return null;
+ return if (er.allows(root.provider.id, root.provider.model, tag)) effort else .high;
+}
+
+pub fn handle(root: *Agent, arena: std.mem.Allocator, line: []const u8, out: *std.Io.Writer) !bool {
+ if (!std.mem.startsWith(u8, line, "/effort") and !std.mem.startsWith(u8, line, "/reasoning")) return false;
+ const prefix: []const u8 = if (std.mem.startsWith(u8, line, "/effort")) "/effort" else "/reasoning";
+ const arg = std.mem.trim(u8, line[prefix.len..], " \t");
+ const levels = er.levels(root.provider.id, root.provider.model);
+ if (arg.len == 0 and main_mod.use_color and root.in != null) {
+ const title = try std.fmt.allocPrint(arena, "Reasoning level for {s} ›", .{root.provider.model});
+ var rows: [reasoning_levels.len]pickers.PickItem = undefined;
+ var tags: [reasoning_levels.len]ReasoningEffort = undefined;
+ const current = normalized(root, @tagName(root.reasoning)).?;
+ var cur: usize = 0;
+ for (levels, 0..) |tag, i| {
+ const effort = std.meta.stringToEnum(ReasoningEffort, tag).?;
+ tags[i] = effort;
+ rows[i] = reasoning_levels[@intFromEnum(effort)];
+ if (effort == current) cur = i;
+ }
+ const idx = pickers.listPickerAt(root, arena, out, title, rows[0..levels.len], cur) orelse return true;
+ root.reasoning = tags[idx];
+ } else if (arg.len != 0) {
+ const requested = if (std.mem.eql(u8, arg, "med"))
+ "medium"
+ else if (std.mem.eql(u8, arg, "extra") or std.mem.eql(u8, arg, "extra-high") or std.mem.eql(u8, arg, "extra high"))
+ "xhigh"
+ else
+ arg;
+ root.reasoning = normalized(root, requested) orelse {
+ try out.writeAll("usage: /effort ");
+ for (levels, 0..) |tag, i| {
+ if (i != 0) try out.writeByte('|');
+ try out.writeAll(tag);
+ }
+ try out.writeByte('\n');
+ try out.flush();
+ return true;
+ };
+ } else {
+ const current = normalized(root, @tagName(root.reasoning)).?;
+ try out.print("reasoning effort: {s}\n", .{reasoning_levels[@intFromEnum(current)].name});
+ try out.flush();
+ return true;
+ }
+ _ = @import("repl_glue.zig").saveThinkingSettings(root.io, root.gpa, root.reasoning, root.fast, root.ultracode_mode, root.show_thinking, root.ai_title);
+ try out.print("reasoning effort: {s}{s}\n", .{
+ reasoning_levels[@intFromEnum(root.reasoning)].name,
+ if (!root.effortApplies()) " (current model ignores it — applies to xai, codex, deepseek, codegraff)" else "",
+ });
+ try out.flush();
+ return true;
+}
diff --git a/src/commands_model.zig b/src/commands_model.zig
index 2d0c738a..53880d8c 100644
--- a/src/commands_model.zig
+++ b/src/commands_model.zig
@@ -29,7 +29,6 @@ const pickers = @import("pickers.zig");
const modelPicker = pickers.modelPicker;
const PickItem = pickers.PickItem;
const listPicker = pickers.listPicker;
-const listPickerAt = pickers.listPickerAt;
const pickUltracodeMode = pickers.pickUltracodeMode;
const reloadLoginKey = pickers.reloadLoginKey;
const offerProviderAuth = pickers.offerProviderAuth;
@@ -41,14 +40,6 @@ const serde = @import("serde.zig");
const oauth = @import("oauth.zig");
const images_command = @import("images_command.zig");
const images = @import("images.zig");
-const reasoning_levels = [_]PickItem{
- .{ .name = "Low", .desc = "Fast responses with lighter reasoning" },
- .{ .name = "Medium", .desc = "Balances speed and reasoning depth for everyday tasks" },
- .{ .name = "High", .desc = "Greater reasoning depth for complex problems" },
- .{ .name = "Extra high", .desc = "Extra high reasoning depth for complex problems" },
- .{ .name = "Max", .desc = "Maximum reasoning depth for the hardest problems" },
- .{ .name = "Ultra", .desc = "Maximum reasoning with automatic task delegation" },
-};
const vision = @import("vision.zig");
const stageImagePath = vision.stageImagePath;
@@ -351,41 +342,7 @@ pub fn tryHandle(root: *Agent, keys: *Keys, arena: Allocator, line: []const u8,
try out.flush();
return true;
}
- if (std.mem.startsWith(u8, line, "/effort") or std.mem.startsWith(u8, line, "/reasoning")) {
- const prefix: []const u8 = if (std.mem.startsWith(u8, line, "/effort")) "/effort" else "/reasoning";
- const arg = std.mem.trim(u8, line[prefix.len..], " \t");
- if (arg.len == 0 and main_mod.use_color and root.in != null) {
- const title = try std.fmt.allocPrint(arena, "Reasoning level for {s} ›", .{root.provider.model});
- const er = @import("effort_route.zig");
- const levels: []const PickItem = if (er.hidesMax(root.provider.id, root.provider.model)) reasoning_levels[0..4] else &reasoning_levels;
- const cur = @min(@intFromEnum(root.reasoning), levels.len - 1);
- const idx = listPickerAt(root, arena, out, title, levels, cur) orelse return true;
- root.reasoning = @enumFromInt(idx);
- } else if (std.mem.eql(u8, arg, "med")) {
- root.reasoning = .medium;
- } else if (std.mem.eql(u8, arg, "extra") or std.mem.eql(u8, arg, "extra-high") or std.mem.eql(u8, arg, "extra high")) {
- root.reasoning = .xhigh;
- } else if (arg.len != 0) {
- root.reasoning = std.meta.stringToEnum(main_mod.ReasoningEffort, arg) orelse {
- try out.writeAll("usage: /effort low|medium|high|xhigh|max|ultra\n");
- try out.flush();
- return true;
- };
- if (!@import("effort_route.zig").allows(root.provider.id, root.provider.model, @tagName(root.reasoning)))
- root.reasoning = .high;
- } else {
- try out.print("reasoning effort: {s}\n", .{reasoning_levels[@intFromEnum(root.reasoning)].name});
- try out.flush();
- return true;
- }
- _ = saveThinkingSettings(root.io, root.gpa, root.reasoning, root.fast, root.ultracode_mode, root.show_thinking, root.ai_title);
- try out.print("reasoning effort: {s}{s}\n", .{
- reasoning_levels[@intFromEnum(root.reasoning)].name,
- if (!root.effortApplies()) " (current model ignores it — applies to xai, codex, deepseek, codegraff)" else "",
- });
- try out.flush();
- return true;
- }
+ if (try @import("commands_effort.zig").handle(root, arena, line, out)) return true;
if (std.mem.startsWith(u8, line, "/keepcontext")) {
const arg = std.mem.trim(u8, line["/keepcontext".len..], " \t");
if (std.mem.eql(u8, arg, "on")) {
diff --git a/src/effort_route.zig b/src/effort_route.zig
index 74ae2d8d..ec4e672b 100644
--- a/src/effort_route.zig
+++ b/src/effort_route.zig
@@ -70,15 +70,34 @@ pub fn hidesMax(provider_id: []const u8, model: []const u8) bool {
return std.mem.eql(u8, provider_id, "xai") or grokFamily(model);
}
+fn openaiFamily(provider_id: []const u8, model: []const u8) bool {
+ return std.mem.eql(u8, provider_id, "openai") or std.mem.eql(u8, provider_id, "codex") or
+ std.mem.startsWith(u8, model, "gpt-") or std.mem.startsWith(u8, model, "openai/gpt-");
+}
+
+/// Picker tags, not API values: OpenAI's maximum is exposed as Ultra.
+/// Keep xAI's stricter allow-list ahead of model-family detection.
+pub fn levels(provider_id: []const u8, model: []const u8) []const []const u8 {
+ if (hidesMax(provider_id, model)) return &.{ "low", "medium", "high", "xhigh" };
+ if (openaiFamily(provider_id, model)) return &.{ "low", "medium", "high", "xhigh", "ultra" };
+ return &.{ "low", "medium", "high", "xhigh", "max", "ultra" };
+}
+
+/// Accept old saved/typed Max settings without putting Max back in the UI.
+/// Ultra keeps its existing wire mapping to `max` and delegation guidance.
+pub fn normalize(provider_id: []const u8, model: []const u8, requested: []const u8) []const u8 {
+ if (!hidesMax(provider_id, model) and openaiFamily(provider_id, model) and std.mem.eql(u8, requested, "max")) return "ultra";
+ return requested;
+}
+
pub fn allows(provider_id: []const u8, model: []const u8, tag: []const u8) bool {
- if (!hidesMax(provider_id, model)) return true;
- return std.mem.eql(u8, tag, "low") or std.mem.eql(u8, tag, "medium") or
- std.mem.eql(u8, tag, "high") or std.mem.eql(u8, tag, "xhigh");
+ for (levels(provider_id, model)) |level| if (std.mem.eql(u8, tag, level)) return true;
+ return false;
}
/// Wire `reasoning_effort` for an effort-capable provider. Flash / Gemini
/// default `medium` becomes `low`. grok maps max/ultra → high (xAI rejects
-/// `max`). Other seats still send ultra as `max` (Z.AI / Kimi).
+/// `max`). Other seats still send ultra as `max` (including OpenAI).
pub fn wireEffort(model: []const u8, requested: []const u8) []const u8 {
if (std.mem.eql(u8, requested, "medium") and omitsDefaultFlashEffort(model)) return "low";
if (grokFamily(model)) {
diff --git a/src/mainloop.zig b/src/mainloop.zig
index b30089b4..f75c2cfa 100644
--- a/src/mainloop.zig
+++ b/src/mainloop.zig
@@ -237,12 +237,12 @@ pub fn run(ctx: *Ctx) !void {
}
if (std.mem.eql(u8, rtype, "set_effort")) {
const level = if (parsed.object.get("level")) |v| (if (v == .string) v.string else "") else "";
- ctx.root.reasoning = std.meta.stringToEnum(main_mod.ReasoningEffort, level) orelse {
+ ctx.root.reasoning = std.meta.stringToEnum(main_mod.ReasoningEffort, @import("effort_route.zig").normalize(ctx.root.provider.id, ctx.root.provider.model, level)) orelse {
ctx.root.emit(.{ .type = "error", .message = "set_effort needs level low|medium|high|xhigh|max|ultra" });
continue;
};
_ = repl_glue.saveThinkingSettings(ctx.root.io, ctx.root.gpa, ctx.root.reasoning, ctx.root.fast, ctx.root.ultracode_mode, ctx.root.show_thinking, ctx.root.ai_title);
- ctx.root.emit(.{ .type = "effort", .ok = true, .level = level, .applies = ctx.root.effortApplies() });
+ ctx.root.emit(.{ .type = "effort", .ok = true, .level = @tagName(ctx.root.reasoning), .applies = ctx.root.effortApplies() });
continue;
}
if (std.mem.eql(u8, rtype, "set_fast")) {