Creat.wu set magpie's "New sessions" effort to the highest level. A new
session started at it, but picking another model (a routing group) dropped
the effort back to the model's default.
Codex: on a switch, the TUI's /model highlights and saves the picked model's
preset default_reasoning_effort. The desktop app keeps the current effort only
if the new model lists it, and otherwise uses defaultReasoningEffort. Both come
from magpie's catalog default_reasoning_level, which codexcat.DefaultEffort
always set to the middle level. A group's levels are the intersection of its
members' levels, so a group often lacks xhigh or max.
- The catalog default is now codexcat.ModelDefault: the model_reasoning_effort
set in config.toml when the model takes it. Otherwise it is the model's
nearest level (catalog.NearestEffort: by rank, a tie going up, never
"none"), so xhigh on low/high/max gives max. When the effort is left at
Default, the default is still the middle of the road.
- This covers both magpie-models.json and the list the gateway hands a
signed-in Codex. The effort is now part of that list's tag, so Codex asks
for the list again.
- Setting the effort in magpie rewrites the list, or marks Codex's cached
list stale.
- An effort the model picked in magpie doesn't take now settles on the
nearest level, not the middle.
- The gateway's fitEffort uses the same NearestEffort.
Claude Code: Opus 5.5 and later read only
modelSettings.<model>.effortLevel. A level set while on one of them was
written only there, so a routing group or another vendor's model picked
afterwards (which reads the top effortLevel) started at its own default.
- The top effortLevel is now written too.
- A reset takes the top one out only when it is the level written beside
the model's own; a top level the user set themselves stays.
- max was already written to the env and applied to every model.
Grok Build: picking a model without the chosen default_reasoning_effort
deleted the key. It now keeps the model's nearest level.
Checked and not affected:
- WorkBuddy, ZCode, Kimi and MiniMax keep per-model levels (keptEffort).
- Qoder and Command Code keep one level for each model by their own design.
- AtomCode keeps one model table each.
What was run:
- Real codex 0.162.1, `codex debug models` with CODEX_HOME in the
scratchpad, on a catalog from CatalogAt(..., "xhigh"). It renders
default_reasoning_level max for low/high/max, high for a low/medium/high
group and xhigh for a model that has xhigh.
- New tests TestCodex/Grok/ClaudeNewSessionEffortLastsModelSwitch,
TestNearestEffort and TestModelDefault. The three agent tests, plus the
updated TestCodexCustomProviderModelHasEfforts and
TestClaudeEffortModelSettings, fail on the old code: the source files were
checked out from the parent with the tests kept.
- gofmt -l is clean. go vet -tags nogui ./internal/... passes for GOOS
darwin, linux and windows.
- go test -tags nogui: internal/agent, catalog, codexcat and provider pass in
full before the rebase.
- In gateway, only TestOTelWaterfallIncludesUnbilledFallback failed. The
root span was in a second export, which is #1794, fixed on main by
6ae6b3402.
- After rebasing on origin/main, catalog and codexcat pass in full. gateway
-run 'Effort|OTel|Reasoning' and agent -run 'Effort|Codex|Claude|Grok'
pass.
Not tried: the Codex desktop app's picker by hand. Its behaviour was read
from ChatGPT.app's app.asar.
29 lines
925 B
Go
29 lines
925 B
Go
package catalog
|
|
|
|
import "testing"
|
|
|
|
// NearestEffort: the level itself where it is taken; else the closest by
|
|
// rank, a tie going up; never "none" as a stand-in; unknown or no levels
|
|
// leave it as asked.
|
|
func TestNearestEffort(t *testing.T) {
|
|
for _, c := range []struct {
|
|
want string
|
|
levels []string
|
|
got string
|
|
}{
|
|
{"xhigh", []string{"low", "medium", "high", "xhigh", "max"}, "xhigh"},
|
|
{"xhigh", []string{"low", "high", "max"}, "max"},
|
|
{"xhigh", []string{"low", "medium", "high"}, "high"},
|
|
{"max", []string{"low", "medium", "high"}, "high"},
|
|
{"medium", []string{"low", "high"}, "high"},
|
|
{"minimal", []string{"none", "low", "high"}, "low"},
|
|
{"none", []string{"low", "high", "max"}, "low"},
|
|
{"high", nil, "high"},
|
|
{"odd", []string{"low"}, "odd"},
|
|
} {
|
|
if g := NearestEffort(c.want, c.levels); g != c.got {
|
|
t.Errorf("NearestEffort(%q, %v) = %q, want %q", c.want, c.levels, g, c.got)
|
|
}
|
|
}
|
|
}
|