Commit Graph
1 Commits
Author SHA1 Message Date
yetoneandggbdpq b33633d593 codexcat: every reasoning level in magpie-models.json says a description (#5024)
Codex fails the whole model_catalog_json on one supported_reasoning_levels
entry without a description ("missing field `description` at line 189"),
so Codex would not start. The entries magpie writes from a vendor's own
Codex entry (a sub2api's) kept the vendor's levels as written, the
description only where the vendor gave one, and levels made for an effort
of the user's the vendor doesn't list were {"effort": ...} alone. Every
level of such an entry now says a description: the vendor's own where it
gave one, else the effort's display name. Entries magpie makes itself
already wrote one.

Changed from the contributor's patch: the levels are read with a checked
type assertion. The patch's bare .([]any) panicked ("interface {} is nil,
not []interface {}") on a vendor entry with no levels for a model with no
efforts, which would have taken down the whole catalog write; the test has
that case now.

Run (mote): go test -tags nogui ./internal/codexcat/ (ok);
go test -tags nogui ./internal/provider/ ./internal/usage/ ./internal/catalog/;
go vet -tags nogui ./internal/codexcat/; gofmt -l (empty).
Broken by hand: with the old listedEntry, TestCodexListedLevelsSayDescription
fails ("level medium says description \"\", want \"Medium\"", and the
same for high, low, xhigh); with the patch's unchecked assertion it panics.
Real Codex (codex-cli 0.165.0, sandbox CODEX_HOME): a catalog whose levels
lack description fails "missing field `description`"; the same catalog with
descriptions loads and Codex starts.
Not tried: Windows (the reporter's OS); nothing here is OS-specific.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-06 10:06:51 +08:00