foobra's screenshot on #1907 (v0.1.1224 on) had both "Keep Codex
signed in to [the first account]" and "Only switch Codex's sign-in"
ticked. The account Codex was on had 0% of its five hours left and the
other had 100%. Codex stayed on the spent account, through a restart of
Codex Desktop and the CLI. With KeepLogin on, NextLogin never moves the
sign-in (#524), and switch-only sends nothing through the gateway. So the
pair meant that no account change ever happened, while the switch-only
tick says moving the sign-in is the one thing magpie does. Picking "the
first account" in the keep picker ticks KeepLogin too, so it is easy to
land in this state without meaning to.
Now Provider.keepsLogin() is KeepLogin && !SwitchOnly. loginSwitching,
keptAs (KeepLoginAs) and LoginRanks go by it, so under switch-only the
sign-in moves at the spent share and back once the first has room. That
holds whether the user kept the first account or one of their choosing,
and for Codex and Claude Code alike (switchedAgents). The saved
KeepLogin/KeepLoginAs is left as the user wrote it, and it holds again
once switch-only is unticked. SetKeepLogin(true) and SetKeepLoginAs
refuse while switch-only is on, because there they would do nothing.
GUI: the keep tick and picker are hidden while switch-only is on, and
keptLogin() and the Routing note treat KeepLogin as off then. The
Accounts hint for a switched sign-in said "the gateway moves on to the
next", which isn't true under switch-only. It now says "magpie moves on
to the next", which holds in both modes, in en, zh, zh-TW, ja and de.
app.js ends up 29 bytes smaller than origin/main, so TestCoreScriptBudget
holds without a raise (a first version had been 661 over).
Run (on mote unless said otherwise):
- TestSwitchOnlyMovesASignInKeptOnOne (Codex, kept on the first and on a
chosen account) and TestClaudeSwitchOnlyMovesASignInKeptOnOne are new.
With keepsLogin put back to plain KeepLogin by hand, all three cases
are red ("switched to \"\""). With the change they are green.
- go test -run 'SwitchOnly|KeepLogin|KeptLogin|CodexLoginOrderedAndKept'
on internal/provider, agent, gateway and davsync: ok at this head
(rebased on accb951ab).
- keep-login.test.cjs has 4 new cases (switch-only with keep on the
first or on spare, en and zh). With app.js put back to origin/main,
4 of 12 are red in Chromium. The GUI files keep-login, switch-only,
claude-switch-only, i18n-keys, agent-switch-accounts, pool-ends,
account-return, routing-account-order and account-arrange gave
185 of 186 in Chromium and WebKit, at base e863f520c. The one red was
claude-switch-only "chromium 420 ja", where the element was detached
before the test clicked anything, under load ~90. That file passed
32 of 32 twice alone. Filed as #4344.
- After the hint and budget change: go test -run 'Budget|I18n'
./internal/gui ok; keep-login, i18n-keys and switch-only .test.cjs
60 of 60 (Chromium and WebKit).
- gofmt -l is clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui
and GOOS=windows go build are ok (at base e863f520c).
- The full go test ./... -timeout 45m follows this push, once mote is
free; its result goes on #1907.
Not tried: a real ChatGPT or Claude account, and Codex Desktop itself.
Also not covered here: Claude Code not connected and switched by Make
first (cn_Vincentzyx on X). There, a saved Claude account has no usage
reading unless magpie has heard of it, so the switch can find no spare
with known room. That is a separate cause.