sherlock_23333 on X: once the ChatGPT account Codex is signed in to ran out, the Codex app's Send stayed greyed even on a magpie model, through restarts and reconnects. The gate is the Codex app's own (ChatGPT.app 26.1021, composer gM): Send is blocked while its authMethod is chatgpt and its own /wham/usage says rate_limit.allowed false with no credits. magpie's one lever is the takeover (codex.out): magpie becomes Codex's provider without requires_openai_auth, so the app-server reports no ChatGPT account and the gate lifts. That runs only when provider.CodexUsedUp says the account is held, and CodexUsedUp read LoginUsage, which returns nothing for a provider switched off or removed in magpie (leftAlone). So a user who turned Codex off in magpie once its allowance ran out never got the takeover, and one already taken over was put back on the held account. Now, with Codex left alone, CodexUsedUp reads the active account alone (codexHoldReading) while Codex takes magpie's models beside its sign-in or magpie is its provider for the held account (Agent.HoldMatters, via the new provider.CodexHoldMatters hook). At most once a minute (the loginReading cache), with the token as Codex keeps it, never renewed or written (codexTokenAsKept); the Usage page still shows nothing of it. Codex's prompts and base_instructions are untouched. Run atf41b63232+ this change, on mote via mote-run: gofmt -l clean; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; go build ./... all ok. go test -count=1 -timeout 45m ./internal/provider ./internal/agent: ok (219s, 340s). Rebased on9f25de56c(a Cursor mover min and a GUI test), then at9f25de56c+ this change: go vet and go test -count=1 -timeout 45m of ./internal/provider ./internal/agent again: ok (178s, 273s).8c63c5b78(plugin speech models; no file in common) landed on main after that run and this is rebased onto it; the two packages were not run again with it. Broken by hand: without the leftAlone branch in CodexUsedUp, TestCodexHoldReadLeftAlone fails ("switched off: CodexUsedUp = false on a held account"); with the left-alone token read sent back through codexToken, it fails with the expired sign-in refreshed once. Not tried: the reporter's own config (whether their Codex was off in magpie is inferred, not confirmed); the real Codex app against a held account; internal/gateway's suite (no gateway code changed); Linux and Windows test runs (vet only).
30 lines
1.1 KiB
Go
30 lines
1.1 KiB
Go
package provider
|
|
|
|
// A provider the user switched off (Provider.Off) or whose account they
|
|
// removed from magpie (Provider.Hidden) is left alone in the background:
|
|
// no CLI is asked who is signed in (`claude auth status`, `cursor-agent
|
|
// about`, `devin auth status`), no allowance is read, no sign-in renewed,
|
|
// no window warmed, no account switched, no daily check-in made and no
|
|
// model list fetched. What was last known of it is still shown. Each of
|
|
// those ran every minute or so for a Claude switched off, and a request
|
|
// made just as a proxy came back up after a restart went out on the
|
|
// machine's own address (Riko on Discord).
|
|
//
|
|
// One read is kept for Codex: the account it is signed in to, while it
|
|
// takes magpie's models, for whether the Codex app holds it
|
|
// (codexHoldReading), which decides where Codex sends at all.
|
|
|
|
// leftAlone says whether magpie leaves provider id alone in the
|
|
// background: switched off, or its account removed from magpie.
|
|
func leftAlone(id string) bool {
|
|
if id == "" {
|
|
return false
|
|
}
|
|
for _, p := range load().Providers {
|
|
if p.ID == id && (p.Off || p.Hidden) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|