Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
provider: Claude Code stays listed, signed out, when every saved account's sign-in is gone
yetone1bd99194eab5
diff --git a/docs/subsystems/providers-accounts.md b/docs/subsystems/providers-accounts.mdindex 033014368..7b307776f 100644--- a/docs/subsystems/providers-accounts.md+++ b/docs/subsystems/providers-accounts.md@@ -35,7 +35,7 @@ keys and accounts per request is in [Gateway routing and fallback](gateway-routi| Token refresh | Each account refreshes through its vendor. For example, `codexToken` refreshes within 5 minutes of expiry and writes the rotated tokens back where it read them (`codexStore.write`: `~/.codex/auth.json`, or Codex's keychain item), every other field kept, for Codex CLI. Before refreshing a sign-in read from the keychain it asks the item again, so a rotation Codex made since isn't spent twice. A 400 or 401 from the vendor's refresh endpoint means it was refused (`refreshFailed`). | [`account.go`](../../internal/provider/account.go) || Codex's credential store | Codex 0.162 keeps its ChatGPT sign-in where `cli_auth_credentials_store` in `$CODEX_HOME/config.toml` says (`codex-rs/login/src/auth/storage.rs`): `file` (default) is `auth.json`; `keyring` the system keychain alone; `auto` the keychain, else `auth.json`, on read and on save; `ephemeral` Codex's memory. Saved to the keychain, Codex removes `auth.json` (#2312, #2367, Dony2050). On macOS magpie reads that item through `security`, as it reads Claude Code's: service `Codex Auth`, account `cli|` + the first 16 hex digits of SHA-256 of the canonical CODEX_HOME (`codexKeychainAccount`), the value auth.json's JSON on one line. `readCodexLogin` is the one reader: `codexAccount`, `codexToken`, `liveLogin`, `CodexAPIKeySignedIn`, `codexLoginAuth`, the usage card's `codexUntil`, session identities and the agent's wiring (`provider.CodexSignIn`: `codexChatGPT`, `Agent.Source`) go through it. `keyring` with no item is signed out; `auto` with no item, or one the keychain wouldn't give, is `auth.json`, as Codex does. An item the keychain wouldn't give under `keyring` is not known (`codexStoreError`), never signed out. With `[features] secret_auth_storage` on (Codex's default on Windows) keyring and auto mean Codex's encrypted auth storage, which magpie doesn't read; nor does it read the Linux or Windows keychain. There `keyring` and `ephemeral` are not known, `auto` is `auth.json` when Codex left one, and the saved accounts' reason says to set `file` (`codexSignedOutWhy`). Requirements an admin manages (`requirements.cli_auth_credentials_store`) aren't read. Reading the secret can put up to two macOS prompts in front of the user, who may type their password, so one read per item is in flight at a time and waits up to 2 minutes for them (`keychainAsk`, `askCodexKeychain`), outside the cache's lock. A reader waits at most 5s from when that ask started (`keychainHold`) and is otherwise told magpie is waiting for an answer (`errKeychainWaiting`); no request or page waits out the prompt. `security` exit 44 is no item; 51 (errSecAuthFailed) or 128 (errSecUserCanceled) is denied or cancelled (`errKeychainRefused`); the 2 minutes running out is no answer (`errKeychainNoAnswer`); anything else is `errKeychainUnread`. Each says so in the saved accounts' reason, and none of them is signed out. A read the keychain gave is kept while the item is unchanged: after 10s a reader asks only the item's modification date (`Stat`, `find-generic-password` without `-w`, which shows no prompt) and reads the secret again only when Codex or magpie changed it (#2367: with "Allow" once, background polls asked again every ~30s). A refusal or no answer is kept 10 minutes (#2408). magpie's own writes (`codexStore.write`, `keepCodexKeychain`) keep the date of what they wrote; a switch, sign-out or refresh forgets a read (`forgetCodexKeychain`) so the next one checks the date, but keeps a refusal; switching and refreshing read afresh. Beside a refusal, no answer or waiting, the saved accounts' line has Try again (`Exclusion.Retry`, `keychain-retry`, `RetryCodexKeychain`), which reads once past the refusal, and the reason says "Always Allow" lets `/usr/bin/security` read the item, so macOS stops asking each time Codex changes it. A switch or a first sign-in (`saveCodexLogin`) writes the store Codex reads, and refuses when that store couldn't be read, when config.toml doesn't parse, or when it is one magpie doesn't read; it leaves an `auth.json` beside the item to Codex. Signing the last account out (`deleteCodexLogin`) removes the item, then `auth.json`, as `codex logout`. Not tried against an item Codex itself wrote: macOS may ask whether magpie can read it, and Codex whether it can read one magpie rewrote. | [`codex_store.go`](../../internal/provider/codex_store.go), [`codex_store_test.go`](../../internal/provider/codex_store_test.go), [`codex_keychain_ask_unix_test.go`](../../internal/provider/codex_keychain_ask_unix_test.go) || A revoked sign-in | A 401 whose words say the sign-in itself is gone (`SignInRevoked`: ChatGPT's `token_revoked`, `invalid_grant`, `refresh_token_reused`; never `token_expired`, a 403, a 5xx or a network error) marks the account for the credential it was sent with (`NoteRevokedSignIn`, #1793). A saved ChatGPT account is refreshed first, as Codex does on a 401, and a refresh that goes through marks nothing. The mark is a hash of the header, never the credential, kept in `logins.json` as `Refused: "revoked:<mark>"` with the account's `Lapsed`, and read back after a restart. While the account has that credential, the gateway doesn't send its requests (`RevokedSignIn`); its row says Sign-in required with Sign in again. Signed in anew (`upsertLogin` with another credential, `addSideLogin`), refreshed, or served a request (`ServedSignIn`), it is clear. Claude (`claude_auth.go`), Copilot (`copilot_lapsed.go`: GitHub's 401/403 on the token exchange, the CLI's stand-in or the usage read, cleared when a token is served) and plugins keep their own marks. | [`signin_revoked.go`](../../internal/provider/signin_revoked.go), [`copilot_lapsed.go`](../../internal/provider/copilot_lapsed.go) |-| Saved accounts | `logins.json` remembers every Codex and Claude Code account seen signed in. A switch moves the credentials into the agent's own store and saves the ones it replaces. A saved account that is on (`SetLoginOn`) stands behind the agent's own. Its tokens stay in `logins.json`. | [`logins.go`](../../internal/provider/logins.go), [`logins_on.go`](../../internal/provider/logins_on.go) |+| Saved accounts | `logins.json` remembers every Codex and Claude Code account seen signed in. A switch moves the credentials into the agent's own store and saves the ones it replaces. A saved account that is on (`SetLoginOn`) stands behind the agent's own. Its tokens stay in `logins.json`. While Claude Code is signed out, a saved Claude account stands in for its own (`claudeStandIn`); with every saved account's sign-in gone, Claude Code is still listed, on the one seen last, signed out (`claudeListed`), its accounts each saying to sign in again, so it never leaves the Providers list (LeeHom on Discord). Claude Code's own account while still `Held` is never listed that way, since the sign-in it may have left on disk would be served. An account whose every login in use has lapsed is `Provider.SignedOut`: `magpie providers` and the TUI say "<user> is signed out", as the app's row does. | [`logins.go`](../../internal/provider/logins.go), [`logins_on.go`](../../internal/provider/logins_on.go), [`claude_dirs.go`](../../internal/provider/claude_dirs.go) || Sign-in in magpie | `StartSignIn` runs the vendor's own browser OAuth with its client and takes the tokens at a callback on this machine. A browser that can't reach that callback (magpie on a server or in Docker) ends on a page that won't load; its address, pasted (`SubmitSignInCallback`), goes through the same callback handler (`pastedCallback`). ChatGPT's sign-in comes back only to port 1455; when that port can't be opened, the sign-in still starts and waits for the pasted address alone, and says why in `CallbackBlocked` with the port in `CallbackPort`: `reserved` for Windows' WSAEACCES on a port in a range it excludes for Hyper-V, WSL or Docker, `busy` for anything else, such as another program holding it (`callbackBlocked`, #1782). A plugin's browser sign-in (`auto`) whose page names a port on this machine to come back to takes its pasted address too: magpie opens it there on 127.0.0.1, for the plugin's own listener (`pluginCallback`, `loopbackPorts`); Command Code's page posts its key from script, so it offers the API key way instead. A Claude account is signed in by Claude Code itself. Signing in brings back an account removed from magpie (`ShowAccount`). A sign-in started in magpie (`StartSignIn`, `StartPluginSignIn`) reads as done (`SignInStatus`, `WaitSignIn`) only after `finish` has run `ShowAccount` for its account, so the window, which opens the account as soon as it sees done, finds it listed. If providers.json can't be written then, the account stays hidden and the sign-in still ends done. Signing in to a plugin's provider from the command line (`pluginLogin`, with a key or the browser) brings it back too. It also takes off the mark a sign-in its vendor turned away left on the account (`Lapsed`) and shows again the agent's own account removed in magpie (`clearPluginLapse`). The window's plugin sign-in does the same with the browser (`pluginDone`, then `finish`) or with a key (`PluginAPIKey`); a key and the command line share these steps in `PluginSignedIn`. A sign-in leaves through the proxy the account's own requests will use (#1663): `ProxyOfLogin` (the account's, else the subscription's, else the global one) for the account being signed in again, the subscription's for a new one. Every request of the flow goes through `signInFlow.via`, Claude Code's own login gets it as *_PROXY (`netproxy.EnvWith`), and a plugin's sign-in runs its fetch under that proxy (`via` in `host.js`; `plugins_cli.go` for the command line). The window's sign-in box shows it as a "Proxy: …" link (`signInProxyLink`, the app menu, no userinfo shown) with Global, Direct, the subscription's and each account's proxy, or a typed one; picking one starts the sign-in again through it (`SignInOptions.Proxy`), and when it ends the pick is kept as the account's (`keepSignInProxy`: the subscription's own when it is its only account, else the account's entry). Global isn't offered while the subscription has a proxy and other accounts, since nothing could keep it. The browser's own leg goes through the browser's network, not magpie's. Signing out leaves through the same exit: a ChatGPT account's refresh token is revoked through its own proxy, read before the account is forgotten (`forgetSIWCLogin`), and Devin's CLI, asked who is signed in or for its models, runs with the account's proxy (`devinCommand`, `devinProxy`). | [`signin.go`](../../internal/provider/signin.go), [`claude_signin.go`](../../internal/provider/claude_signin.go), [`pluginsignin.go`](../../internal/provider/pluginsignin.go), [`pluginsignin_paste.go`](../../internal/provider/pluginsignin_paste.go), [`proxy.go`](../../internal/provider/proxy.go), [`plugins_cli.go`](../../internal/cli/plugins_cli.go) || Import from files | `ImportLogins` (ChatGPT, Claude), `ImportGoogleAccounts` (Antigravity) and `ImportFactoryKeys` take other tools' files, from the window (`signin/import`) or `magpie accounts import` (#1453). ChatGPT reads Codex's `auth.json`, CLIProxyAPI's and Cockpit Tools' files, Sub2API's export (`sub2apiEntry`) and codexbar's `~/.codexbar/config.json` (`codexbarEntries`: the `openai_oauth` provider's accounts and `openAI.remoteConnectionAccounts`, the workspace from `openAIAccountId`). Each ChatGPT and Google sign-in is refreshed before it is added, so the tool the file came from is signed out of it; both surfaces say so first, and the command imports nothing without `--yes` or a yes. Claude reads CLIProxyAPI's files and Sub2API's export, whose Claude account says its email as Anthropic does, `email_address`, in `credentials` or `extra`, and keeps its `scope`, `account_uuid` and `org_uuid` as Claude Code's scopes, `accountUuid` and `organizationUuid` (#1975); a file with no email is refused, as Claude Code's own `.credentials.json` is. Claude's are kept as the file has them. A refresh token magpie holds already is `exists`, never refreshed; accounts are matched by email and workspace, or for Claude organization (`sameLogin`). An entry with an access token and no refresh token is refused (`accessOnly`). One file of several that holds no account is a failed row with its place (`ImportedAccount.File`), never skipped. The files are only read. | [`login_import.go`](../../internal/provider/login_import.go), [`google_import.go`](../../internal/provider/google_import.go), [`factory_key.go`](../../internal/provider/factory_key.go), [`accounts_cli.go`](../../internal/cli/accounts_cli.go) || Used-up switch | When the account Codex or Claude Code is signed in to has used its allowance, the agent is signed in to the next account that is on and has room (#208). For Codex, *Only switch Codex's sign-in* (`SwitchOnly`, `SetSwitchOnly`) keeps magpie's `openai_base_url` failover out of Codex's config, so the switch is all magpie does (#1907); an unreadable providers.json reads as switch-only, so the failover is not written on a guess. | [`codex_switch.go`](../../internal/provider/codex_switch.go) |diff --git a/internal/cli/providers_cli.go b/internal/cli/providers_cli.goindex 0d2c91be6..0c9f6c0cf 100644--- a/internal/cli/providers_cli.go+++ b/internal/cli/providers_cli.go@@ -137,6 +137,41 @@ const providerUsage = `usage:magpie provider set my-relay id=relay (renames it: groups and agents on my-relay/… move to relay/…)(family: a tag for which agents are shown its models, see magpie visible)`+// keyColumn is what magpie providers says of p's key or account.+func keyColumn(p provider.Provider) string {+ switch {+ case p.Off:+ return faint.Render("○ switched off")+ case p.Account != nil && signedOut(p):+ // every account in use refused: listed to be signed in again,+ // as the app's row says, never "signed in"+ return amber.Render("○ "+p.Account.User+" is signed out") + muted.Render(" · sign in again")+ case p.Account != nil:+ return green.Render("●") + " " + muted.Render("signed in as "+p.Account.User)+ case p.IsVertex() && !p.Ready():+ // no project an address can be made of (providers.json edited+ // by hand): nothing is asked, as the app's row says+ return amber.Render("○ needs a project")+ case p.IsVertex():+ // no key: a token minted from the user's Google credentials,+ // traded for a service account's when it impersonates one+ who := "Google credentials"+ if p.Vertex != nil && p.Vertex.Impersonate != "" {+ who += " as " + p.Vertex.Impersonate+ }+ return green.Render("●") + " " + muted.Render(who)+ case p.Key != "":+ return green.Render("●") + " " + muted.Render(provider.Mask(p.Key))+ case p.Ready():+ return green.Render("●") + " " + muted.Render("no key needed")+ default:+ return amber.Render("○ no key")+ }+}++// signedOut is Provider.SignedOut, for a test to stand in for.+var signedOut = provider.Provider.SignedOut+// providers: `magpie providers`func providers() error {all := provider.All()@@ -159,30 +194,7 @@ func providers() error {if p.Preset == "" && p.Account == nil {r.name += " " + faint.Render("custom")}- switch {- case p.Off:- r.key = faint.Render("○ switched off")- case p.Account != nil:- r.key = green.Render("●") + " " + muted.Render("signed in as "+p.Account.User)- case p.IsVertex() && !p.Ready():- // no project an address can be made of (providers.json edited- // by hand): nothing is asked, as the app's row says- r.key = amber.Render("○ needs a project")- case p.IsVertex():- // no key: a token minted from the user's Google credentials,- // traded for a service account's when it impersonates one- who := "Google credentials"- if p.Vertex != nil && p.Vertex.Impersonate != "" {- who += " as " + p.Vertex.Impersonate- }- r.key = green.Render("●") + " " + muted.Render(who)- case p.Key != "":- r.key = green.Render("●") + " " + muted.Render(provider.Mask(p.Key))- case p.Ready():- r.key = green.Render("●") + " " + muted.Render("no key needed")- default:- r.key = amber.Render("○ no key")- }+ r.key = keyColumn(p)n := len(p.Exposed())if t, ok := p.Listed(); ok {r.models = fmt.Sprintf("%d of %d models", n, len(p.Available())) + muted.Render(" · fetched "+ago(t))diff --git a/internal/cli/providers_signed_out_cli_test.go b/internal/cli/providers_signed_out_cli_test.gonew file mode 100644index 000000000..05a8fe250--- /dev/null+++ b/internal/cli/providers_signed_out_cli_test.go@@ -0,0 +1,25 @@+package cli++import (+ "strings"+ "testing"++ "github.com/yetone/magpie/internal/provider"+)++// An account whose every sign-in in use was refused is listed signed out,+// to be signed in again, never "signed in as" (LeeHom on Discord: two+// Claude Pro accounts gone from the list, then "needs sign in again").+func TestProvidersSaySignedOut(t *testing.T) {+ out := map[string]bool{"claude": true}+ signedOut = func(p provider.Provider) bool { return out[p.ID] }+ t.Cleanup(func() { signedOut = provider.Provider.SignedOut })+ gone := keyColumn(provider.Provider{ID: "claude", Account: &provider.Account{User: "[email protected]"}})+ if !strings.Contains(gone, "[email protected] is signed out") || !strings.Contains(gone, "sign in again") || strings.Contains(gone, "signed in as") {+ t.Fatalf("signed-out row: %q", gone)+ }+ in := keyColumn(provider.Provider{ID: "codex", Account: &provider.Account{User: "[email protected]"}})+ if !strings.Contains(in, "signed in as [email protected]") {+ t.Fatalf("signed-in row: %q", in)+ }+}diff --git a/internal/provider/claude_dirs.go b/internal/provider/claude_dirs.goindex 30b749cfd..a487a8f53 100644--- a/internal/provider/claude_dirs.go+++ b/internal/provider/claude_dirs.go@@ -303,6 +303,30 @@ func claudeStandIn(ls []savedLogin) string {return user}+// claudeListed is the saved account the Claude Code provider is listed on+// while Claude Code is signed out: the stand-in, else, with every account's+// sign-in gone, the one seen last, signed out. Listed without one, Claude+// Code left the Providers list with every account on it, which read as a+// ban (LeeHom on Discord: two Claude Pro accounts vanished); listed on a+// signed-out one, it says to sign in again, and its token says why it+// can't be used (claudeSavedDir). Never one still Held: Claude Code's own+// sign-in, which it may have left on disk after a logout, and which would+// then be served as if signed in (TestClaudeSignedOut). "" with no such+// account saved.+func claudeListed(ls []savedLogin) string {+ if u := claudeStandIn(ls); u != "" {+ return u+ }+ user := ""+ var seen time.Time+ for _, l := range ls {+ if l.Agent == "claude" && !l.Held && claudeSignedOut(l) != "" && (user == "" || l.Seen.After(seen)) {+ user, seen = l.User, l.Seen+ }+ }+ return user+}+// claudeLogoutLapse is why the account Claude Code was signed in to can't// be used once Claude Code let go of it: logged out, which revokes the// sign-in it held, or emptied that sign-in once Anthropic refused it.@@ -356,12 +380,12 @@ func claudeSignedOut(l savedLogin) string {}// claudeStandInAccount is the Claude Code provider while Claude Code is-// signed out, on claudeStandIn's account; false with no account saved.+// signed out, on claudeListed's account; false with no account saved.func claudeStandInAccount() (Provider, bool) {loginsMu.Lock()ls := readLogins()loginsMu.Unlock()- user := claudeStandIn(ls)+ user := claudeListed(ls)if user == "" {return Provider{}, false}diff --git a/internal/provider/claude_logout_test.go b/internal/provider/claude_logout_test.goindex 9ce6edaac..f1a617f3f 100644--- a/internal/provider/claude_logout_test.go+++ b/internal/provider/claude_logout_test.go@@ -178,3 +178,72 @@ func TestClaudeSignInWhileLoggedOut(t *testing.T) {t.Fatalf("on: %v", users)}}++// Every saved Claude account's sign-in gone while Claude Code is signed out+// (LeeHom on Discord: two Claude Pro accounts vanished from Providers, and+// were taken for a ban): the one Claude Code held went with its sign-in,+// and the other had gone the same way before. Claude Code stays on the+// Providers list, signed out, each account on it saying to sign in again,+// and its token says so too; none is served as if it could be used.+func TestClaudeAllSignedOutStaysListed(t *testing.T) {+ home := claudeHome(t)+ t.Setenv("CLAUDE_CONFIG_DIR", "")+ noAnthropic(t)+ cred := claudeSignIn(t, home, time.Now().Add(time.Hour))+ writeFile(t, filepath.Join(home, ".claude.json"), map[string]any{"oauthAccount": map[string]any{"emailAddress": "[email protected]"}})+ far := time.Now().Add(24 * time.Hour).UnixMilli()+ seen := time.Now().Add(-time.Hour).UTC().Truncate(time.Second)+ writeFile(t, loginsPath(), []map[string]any{+ {"agent": "claude", "user": "[email protected]", "plan": "pro", "on": true, "seen": seen, "lapsed": claudeLogoutLapse,+ "auth": map[string]any{"claudeAiOauth": map[string]any{"accessToken": "tok-two", "refreshToken": "r-two", "expiresAt": far, "subscriptionType": "pro"}}},+ })+ loginsMu.Lock()+ loginsSeenAt.Store(0)+ loginsMu.Unlock()+ if p, ok := find(All(), "claude"); !ok || p.Account.User != "[email protected]" {+ t.Fatalf("signed in: %v %+v", ok, p.Account)+ } else if p.SignedOut() {+ t.Fatal("a signed-in Claude Code reads as signed out")+ }++ // Claude Code lets go of its sign-in: Anthropic refused it, or /logout+ os.Remove(cred)+ os.Remove(filepath.Join(home, ".claude.json"))+ forgetClaudeCredential()+ loginsMu.Lock()+ loginsSeenAt.Store(0)+ loginsMu.Unlock()++ p, ok := find(All(), "claude")+ if !ok || p.Account == nil {+ t.Fatalf("Claude Code left the Providers list with every account signed out: %v", ok)+ }+ if p.Account.User != "[email protected]" {+ t.Fatalf("listed as %q; want the one seen last", p.Account.User)+ }+ if _, _, err := p.Account.Token(context.Background()); err == nil || err.Error() != claudeLogoutLapse {+ t.Fatalf("token of a signed-out account: %v", err)+ }+ ls := Logins("claude")+ if len(ls) != 2 {+ t.Fatalf("logins: %+v", ls)+ }+ listedOn := false+ for _, l := range ls {+ if l.Lapsed != claudeLogoutLapse {+ t.Fatalf("not signed out: %+v", l)+ }+ listedOn = listedOn || l.On && l.User == "[email protected]"+ }+ // the row reads as signed out: the account it names is the one on+ if !listedOn {+ t.Fatalf("the listed account isn't on: %+v", ls)+ }+ if u := InUseLogin("claude"); u != "[email protected]" && u != "" {+ t.Fatalf("in use %q", u)+ }+ // what magpie providers, the TUI and the app's row say of it+ if !p.SignedOut() {+ t.Fatal("listed on a signed-out account, the provider doesn't say it is signed out")+ }+}diff --git a/internal/provider/logins.go b/internal/provider/logins.goindex d2ecd61db..e7e3ef58a 100644--- a/internal/provider/logins.go+++ b/internal/provider/logins.go@@ -813,6 +813,33 @@ func onlySeenMoved(was, next []savedLogin, now time.Time) bool {return err1 == nil && err2 == nil && bytes.Equal(ja, jb)}+// SignedOut says that p is a signed-in account whose every account in use+// (on, or the one the agent is signed in to) has had its sign-in refused:+// listed, so it can be signed in again, but not "signed in". It is what+// the app's Providers row says as "{user} is signed out", for magpie+// providers and the TUI to say the same (LeeHom on Discord: Claude Code+// listed on two lapsed accounts).+func (p Provider) SignedOut() bool {+ if p.Account == nil {+ return false+ }+ ls := Logins(p.Account.Agent)+ if _, ok := PluginOf(p.ID); ok && p.IsPlugin() {+ ls = Logins(p.ID)+ }+ n := 0+ for _, l := range ls {+ if !l.On && !l.Active {+ continue+ }+ if l.Lapsed == "" {+ return false+ }+ n+++ }+ return n > 0+}+// Logins lists the remembered accounts of an agent ("" for every one),// the active one flagged.func Logins(agent string) []Login {@@ -881,7 +908,9 @@ func Logins(agent string) []Login {ls := readLogins()standIn := ""if _, ok := active["claude"]; !ok {- standIn = claudeStandIn(ls)+ // the one the provider is listed on (claudeStandInAccount), a+ // signed-out one too, which the row then says is signed out+ standIn = claudeListed(ls)}back := map[string]string{}for a, user := range active {diff --git a/internal/tui/pages.go b/internal/tui/pages.goindex 4323f6b54..a8736eb94 100644--- a/internal/tui/pages.go+++ b/internal/tui/pages.go@@ -729,6 +729,9 @@ func localAddressAsk(pr provider.PresetDef, crumbs []string, now string, then fu// listError is provider.Provider.ListError; tests stand in for it.var listError = provider.Provider.ListError+// signedOut is Provider.SignedOut, for a test to stand in for.+var signedOut = provider.Provider.SignedOut+func (m model) viewProviders() string {var b strings.Builderb.WriteString(m.header())@@ -750,6 +753,9 @@ func (m model) viewProviders() string {switch {case p.Off:r.key = "○ switched off"+ case p.Account != nil && signedOut(p):+ // every account in use refused, as magpie providers says it+ r.key = "○ " + p.Account.User + " is signed out"case p.Account != nil:r.key = "● " + p.Account.Usercase p.IsVertex() && !p.Ready():diff --git a/internal/tui/signed_out_test.go b/internal/tui/signed_out_test.gonew file mode 100644index 000000000..ce23840d4--- /dev/null+++ b/internal/tui/signed_out_test.go@@ -0,0 +1,37 @@+package tui++import (+ "strings"+ "testing"++ "github.com/yetone/magpie/internal/provider"+)++// An account whose every sign-in in use was refused reads as signed out+// on the Providers page, as magpie providers and the app say it (LeeHom on+// Discord), not as a green signed-in account.+func TestProvidersSaySignedOut(t *testing.T) {+ home(t)+ m := model{w: 160, h: 40}+ m.provs = []provider.Provider{+ {ID: "claude", Name: "Claude Code", Account: &provider.Account{User: "[email protected]"}},+ {ID: "codex", Name: "Codex", Account: &provider.Account{User: "[email protected]"}},+ }+ signedOut = func(p provider.Provider) bool { return p.ID == "claude" }+ t.Cleanup(func() { signedOut = provider.Provider.SignedOut })+ var claude, codex string+ for _, l := range strings.Split(m.viewProviders(), "\n") {+ switch {+ case strings.Contains(l, "Claude Code"):+ claude = l+ case strings.Contains(l, "Codex"):+ codex = l+ }+ }+ if !strings.Contains(claude, "○ [email protected] is signed out") {+ t.Fatalf("signed-out row: %q", claude)+ }+ if !strings.Contains(codex, "● [email protected]") || strings.Contains(codex, "signed out") {+ t.Fatalf("signed-in row: %q", codex)+ }+}