Riko switched Claude off in Providers, and magpie still ran `claude auth status --json` about every minute. Off only kept the gateway from routing to it. Every page and request lists accounts, which re-asked the CLI, and the background loops went on reading allowances, renewing, switching, warming, checking in and fetching lists. The same held for each sibling with a CLI or account check: Cursor (`cursor-agent about`), Devin (`devin auth status`) and the rest. What changed: - left_alone.go: leftAlone(id), true for a provider that is Off or Hidden (account removed). - account.go claudeIdentity and cli_identity.go get (Cursor, Devin): the CLI isn't asked; what it said last (memory or cli-identity.json) is served, so the account stays listed to switch on again. - subscription_usage.go: claude, cursor and grok are checked as hidden before their account is looked up (the look-up ran the CLI). - login_usage.go loginUsageAt, keepalive.go RenewLogins, codex_switch.go NextLogin, codex_warmup.go keepWarm: leftAlone where only accountRemoved (or nothing) was checked. - models.go newDue: a provider that is off has no list fetched. - checkin.go: each check-in account knows its card's provider; the loop skips one that is left alone, a press still checks it in (minimax, trae, qoder, workbuddy, plugin check-ins set it). - docs/subsystems/providers-accounts.md says so. Not covered: KeepPluginsListed lists every plugin at once in the host. A Cursor switched off that was never asked who is signed in isn't listed until switched on. What was run: - TestLeftAloneRunsNoCLI: fake claude, cursor-agent and devin on PATH log each run; with claude and cursor off and devin removed, All, Hidden, fetchSubscriptionUsage, LoginUsage, RenewLogins, SwitchWhenSpent and FetchNew run three times over stale caches and no CLI is run; switched back on, all three are asked again. - Break check: with the source changes reverted it fails with "switched off or removed, the CLIs were run: [claude_auth_status_--json cursor-agent_about_--format_json devin_auth_status ...]"; with only the claude gate removed only claude is logged, with only cliIdentity's only cursor and devin. - go test -tags nogui -timeout 45m ./internal/provider ./internal/gateway: ok (399s, 1271s). - gofmt -l: clean. go vet (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean, under set -o pipefail.
26 lines
958 B
Go
26 lines
958 B
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).
|
|
|
|
// 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
|
|
}
|