ac4af582301a4e8a29245dbba767eba31334ddf9
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a8ecf4020e |
provider: a check-in file that can't be read or parsed stops the check-in
readCheckins, the reader every daily check-in shares (WorkBuddy, Trae CN,
MiniMax Code, Qoder and the plugins' own), took a file it couldn't read
or parse as empty. The next check-in then asked the vendor again for
every account and wrote its answers over the file: an account could be
checked in twice in one day, and the entries it couldn't read were lost.
readCheckins now returns an error for a file that is there but can't be
read, or doesn't parse into entries (cut short, zeroed, empty, `[]`,
`null`). A file not there is still empty. On the error:
- checkiner.checkinNow asks nothing and writes nothing. Each account it
would look at is `failed` with the reason (the path and why), so the
loop tries again after 30 minutes and a press (GUI, TUI, `magpie
accounts checkin`) says why. The error is logged once while it stays
the same.
- The readers that only show results (WithCheckins, *Checkins(),
PluginCheckins) go through shownCheckins, which gives what last read
from the file in this process, so a card keeps its last good data.
- adoptLegacyPluginCheckins' own strict copy of the read now uses
readCheckins too.
Docs: providers-accounts.md no longer lists check-in marks among the
caches written over; provider-plugins.md says the plugin file's case.
Test: TestCheckinUnreadableFileLeftAlone writes a cut-short, zeroed,
empty, `[]` and `null` workbuddy-checkin.json, runs the loop and a press
against a fake WorkBuddy, and checks no status or claim request went out,
the file is byte for byte unchanged, and the result says the path; a
folder in place of plugin-checkin.json does the same through a plugin
checkiner. TestCheckinMissingFileIsEmpty and
TestCheckinUnreadableKeepsLastGood cover the other two sides.
Broken by hand (checkinNow taking the error as an empty map again): the
test went red, every case claimed (Asked true), and green once restored.
Run in a worktree at origin/main
|
||
|
|
75cbc7e1e5 |
provider: a subscription switched off or removed makes no background requests, no claude auth status every minute (Riko on Discord)
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. |
||
|
|
69b6772794 |
provider: Qoder check-ins follow the campaign window, so a campaign open past Beijing midnight is claimed and the next one isn't missed (#1173)
Qoder and Qoder CN campaigns run on [startAt, endAt) windows that cross Beijing midnight, so a campaign claimed yesterday could stand in for the whole new day and the next campaign was never claimed. - A campaign is active by its upstream window, so one still open after Beijing midnight can be claimed. - A saved result records the campaign's end in `until`, and is reused only on the same Beijing day, within 30 minutes and before that end; after that the list is read again (about 48 list reads per account per day, `inactive` included). - Manual check-in always verifies upstream; failures and older records without `until` keep the old retry behaviour. - Only Qoder sets `recheck`; WorkBuddy, Trae CN and MiniMax keep their once-a-day settlement. |
||
|
|
87487c5ef0 | plugin, provider: a plugin can press its vendor's daily check-in itself (auth.checkin), and magpie runs it as its own check-ins (Lemon on Discord #feedback: provider 每日签到的方法能放到插件里面去做吗; ARNO earlier asked for Qoder's) — the check-ins magpie had (WorkBuddy, Trae CN, MiniMax Code, Qoder) are each written in magpie against the vendor's endpoint, even for a subscription that moved to its plugin, so a plugin author had no way to give their provider one. A plugin's auth hook may now have checkin(getAuth, provider) beside usage: the host lists the provider with checkin: true (plugin.Provider.Checkin) and answers checkin({provider, account}) (plugin.AccountCheckin), refreshing the account as usage does, with {outcome, credit, streak, message}; outcome is claimed, done, ineligible, inactive, captcha or failed, and a throw or an outcome outside these is failed with the reason. internal/provider/plugin_checkin.go runs these through checkin.go's checkiner, as the built-ins are: each signed-in account in use once a Beijing day (first look 2 minutes after start, then every 30), a failure asked again after wbCheckinRetry, every other outcome settled for the day, results kept in plugin-checkin.json by provider|account; a failure is recorded as failed and resets nothing. captcha is new (CheckinCaptcha): the vendor wants a captcha, which magpie never solves, so it is said as "check in in its own app", not as a failure, and not asked again that day. The results mark the account's Usage card (checkinBy "plugin:<provider>", WithCheckins), so the card's check-in row, its Auto check-in and Check in now work for it (POST /api/settings/plugin-checkin {provider, on}, POST /api/usage/plugin-checkin {provider}); Settings → Usage gains a Plugins tab, shown while such a plugin is signed in, a Daily check-in row per provider with Off/On and how each account went; magpie accounts checkin and c on the TUI's Usage page include them (the TUI's "no account" line names check-in plugins). The switch (settings.PluginCheckins, by provider) is off by default; for WorkBuddy, Trae CN, MiniMax Code and Qoder it follows that vendor's existing switch until set on its own, and magpie's own check-in through the plugin's fetch leaves a provider whose plugin checks in to it (pluginChecksIn), so no account is checked in twice. The Settings page's save carries PluginCheckins over (TestSettingsSaveKeepsWhatItDoesNotSend's fixture names it). No plugin declares the hook yet; Qoder's check-in stays magpie's own here. TestPluginCheckinRunsAsTheBuiltinsDo (the fake plugin with FAKE_CHECKIN, five accounts answering claimed, done, captcha, a throw and an unknown outcome: off presses nothing; on, each outcome kept with its vendor; a minute on nothing pressed again; past the retry only the two failures; the next day all five; PluginCheckins and the cards marked; another provider's press asks none) and TestPluginCheckinTakesOverTheVendors (a qoder plugin without the hook leaves magpie's Qoder check-in its account, with it none; PluginCheckinOn's fallbacks) pass -race -count=10, and the latter fails with pluginChecksIn stubbed false; TestTUIChecksPluginsIn passes -race -count=20. plugin-checkin.test.cjs (the card's row with the captcha said, Auto check-in posting {provider, on}, no page move; the Settings Plugins tab at 440px with the row fitting, no sideways scroll, On posting) passes on Chromium and WebKit in en, zh, ja and de; usage-checkin, i18n-keys, gui-ja, gui-de and settings-* pass. go test -tags nogui ./internal/..., go vet, gofmt -l, linux (nogui) and windows builds pass. Not tried with a real plugin or account: no published plugin has the hook yet. docs/subsystems/provider-plugins.md (the hook's contract) and docs/reference.md say it. | ||
|
|
8b52c521fa | qoder: daily check-in for Qoder and Qoder CN (ARNO on Discord) — while Settings › Daily check-in › Qoder (or the card's Auto check-in) is on, the gateway claims each plugin account's claimable daily credits (campaigns with actionType CLAIM_BENEFIT on openapi.qoder.sh / openapi.qoder.com.cn, as wallechfox/qoder-checkin claims them) once a Beijing day, through the plugin's fetch on its device token (@magpie-community/opencode-qoder-auth 0.2.7, now the mover's min). One claimed already is done, none listed is no event, an expired sign-in or an old plugin says so. Kept in qoder-checkin.json by site and uid; shown on the usage card, in the TUI's and CLI's check-in. Built-in (unmoved) accounts aren't checked in. Not tried with a real Qoder account. qoder_checkin_test (fake campaigns, both sites; -race -count=3) and usage-checkin (Chromium and WebKit, en and zh, fails without the GUI change) pass; go test provider/gui/tui/settings/gateway, vet, linux/windows/nogui builds pass. |