Files
magpie/docs
yetone 80c22eecba agents: Codex leaves a model unchecked in its provider's list (JNDliuliuM on X)
JNDliuliuM: after picking new models for a provider, Codex CLI didn't
change, and after a restart it was still on the old model. magpie wrote
the new list, but Codex's `model` (config.toml, or magpie.config.toml for
`codex -p magpie`) stayed on the model the user had unchecked. Resolve
still takes any provider/model, so Codex kept starting on it and asking
the vendor for it.

Tried with the real codex-cli 0.165.0 in a sandbox CODEX_HOME, profile
wiring: the list was swapped from sub/old-a, sub/old-b to sub/new-x,
sub/new-y. After a restart, /model listed only the new ones, but the
status line still read sub/old-a, as the profile named it.

What changed:
- provider.Unpicked(id) reports a model the user has since unchecked:
  the provider has picks, its served models lack the model, and it isn't
  a decision model. This is the same rule ResolveRoute already applies
  to routing groups (#3911).
- agent.pickedInstead moves such a model to the first model of that
  provider that magpie lists for the agent now.
- Codex's Sync calls it before its other model branches, through set, as
  picking the model does. The profile's Sync calls it through put. The
  Codex app reads the same config.toml, so it follows too.
- Left alone:
  - a provider with no picks, whose list is the vendor's and may lack
    the model (#2642);
  - a provider with none of its models listed any more.

Run on mote:
- TestCodexLeavesAModelUncheckedInItsProvider (as provider, beside a
  ChatGPT sign-in, profile) and TestCodexKeepsAModelOfAProviderWithNoPicks;
- go test ./internal/agent/ ./internal/provider/;
- go vet for darwin, linux and windows on both packages;
- gofmt.
Result: internal/agent ok (470s). internal/provider is red only on
TestHostBuildsNoList (a Gemini provider's Host allocates 5 times), which
is #6479 and was already red on main.

Broken by hand: with the Codex Sync call disabled, the "as its provider"
and "beside the sign-in" subtests are red ("model = sub/old after sub/old
was unchecked"). With the profile call disabled, the "by its profile"
subtest is red.

Not tried:
- the fixed magpie with a real Codex;
- the Codex app.

Not changed, filed as #6504: other agents' model fields, and Codex's
subagent and compaction models.
2026-11-13 17:37:48 +08:00
..