Files
magpie/docs
yetone 247794c613 codex: an account that is out takes over for other models too (reverses f37742e14)
With one ChatGPT account out and nothing to serve Codex's own model on
(provider.CodexServesWhileOut false), f37742e14 left Codex on its sign-in
to keep the account's menu. But the Codex app greys Send for every model
while authMethod is chatgpt and /wham/usage says not allowed, so shamen
(mac, banner "Codex 和工作使用额度已用完"), chenhan and xiaoq6285 could send
nothing on GLM-5.3 or any other magpie model. A grey Send for every model
costs more than the menu, so this is the owner's product call: sending on
other models comes first.

When joined, on ChatGPT and held, and magpie has a model on no ChatGPT
account (codexOtherModel), Sync makes magpie the provider on that
stand-in, keeps the user's model in codex.out_own and the stand-in in
codex.out_stand, and at the reset puts Codex back joined on its own model
(#540 way back). Once per held/unheld transition: on the stand-in the model
is magpie's, so the branch is not met again. With nothing else to offer,
Codex stays on its sign-in as in f37742e14. Nothing about identity,
base_instructions or the account's state is changed or faked; magpie only
becomes the provider, as for any held account.

Run (mote-run, win-run, sandbox HOME, fake upstream; no real exhausted
account was tried):
- go test -tags nogui ./internal/agent -run Codex: ok; ./internal/provider
  -run CodexServes: ok; win-run ./internal/agent: see the tag notes.
- gofmt -l, go vet linux/windows/native on internal/agent: clean.
- New TestCodexOwnModelOneSpentAccountTakenOverForOtherModels: takeover,
  three more Syncs with no config write and no codexAppRoute change, the
  reset back once, a further Sync changing nothing. TestCodexOwnModel-
  OneSpentAccountStaysOnItsSignIn now covers only the nothing-else case
  (fake provider deleted).
- Broken by hand: new branch disabled -> the new test red; the
  !isMagpie(m) one-shot guard removed -> red.
Not tried: a real exhausted account in the Codex app; the stand-in picked
by the user is indistinguishable from staying on it and gives way to the
own model at the reset (documented in agent-wiring.md).
2026-11-04 10:05:32 +08:00
..