Commit Graph
2 Commits
Author SHA1 Message Date
yetone b4b82e5857 agents: Codex's profile list drops a deleted provider's models (JNDliuliuM on X)
Codex wired by its profile alone (codex -p magpie) kept offering the models
of a provider that was deleted. The profile's model was one of that
provider's, so it no longer resolved as a magpie model, wired() was false,
and the profile's Sync returned before it wrote magpie-models.json again.
The old list stayed, new providers' models never reached it. The Sync now
writes the list again whenever the profile names magpie as provider and its
list, even when the model it was set to is gone. All-of-Codex scope already
did this (asProvider and ownCatalog), as did the models_cache.json staling.

Found by syncing a sandbox HOME in both scopes after a provider edit and a
provider delete: only profile scope plus delete left the old list.
TestCodexProfileListDropsADeletedProvider is red on the old code (listed
added/m2 and added/m3 after the delete) and green now.

Run on mote: internal/agent package, go vet darwin, linux nogui, windows.
Not tried: a real Codex CLI reading the list; the viaBase models_cache.json
path (covered by existing tests, not changed).
2026-11-12 14:14:36 +08:00
yetone 80dcd34729 codex: connect Codex through codex -p magpie alone (hpnjstar on X)
The Codex agent gets an "applies to" field: All of Codex (as before) or
"codex -p magpie only". In the second mode magpie writes
<CODEX_HOME>/magpie.config.toml (model_provider, model, effort,
model_catalog_json, its own [model_providers.magpie]) and a catalog beside
it, and never touches config.toml: its top-level model_provider, model and
openai_base_url stay the user's. Disconnect deletes that file and magpie's
catalog (kept if the user added to it). Plain `codex` keeps its own provider.

Codex 0.165 reads `--profile NAME` from NAME.config.toml and refuses -p while
config.toml holds a legacy [profiles.NAME] or profile = "NAME", so this is
the file form, not a [profiles.magpie] table. Codex without profile files
(older than the May 2026 removal of legacy profiles) isn't served in this
mode. The choice changes only while Codex is disconnected, so the two wirings
never share a config. Only magpie's models are offered in this mode; no
joining, failover or subagent fields.

Run (mote, at the rebased head): go test ./internal/agent ./internal/gui ok;
gofmt clean; go vet darwin, linux nogui, windows ok; GUI i18n-keys,
i18n-en-no-cjk, gui-zh-tw, codex-signin-always, agent-connect,
agent-disconnect in Chromium and WebKit. Real codex 0.165.0 in a sandbox
CODEX_HOME against a fake server: `codex -p magpie` sent one request
(Bearer magpie, model fake/m1); plain `codex` sent none; config.toml was
byte-identical after connect, effort change, sync and disconnect.
Broken by hand: letting scope change while connected turns two
TestCodexProfileOnly tests red.
Not tried: a real account, the Codex app, the GUI row in a live window, an
older Codex without profile files. gui-de and gui-ja "has every zh string"
are red on main without this change (#6234).
2026-11-12 10:10:28 +08:00