ac4af582301a4e8a29245dbba767eba31334ddf9
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4300057264 |
provider: ZCode's check-in is asked again every 30 minutes, as Qoder's is (plugins#503)
ZCode's gift plans open as campaigns, some for under a day (the reporter's ran to 14:00 Beijing). With the check-in settled for the day after a done or inactive answer from noon on, a plan opening in the afternoon could be missed until it had closed. pluginRechecks now includes zcode, so the loop asks again 30 minutes after each answer. Run on mote: go test ./internal/provider/ ok (91s), go vet ok, gofmt clean. Broken by hand: without zcode in pluginRechecks, 4 zcode subtests of TestPluginCheckinQoderRechecksCampaigns are red. Not tried: a real ZCode account with a plan to claim (none open now). |
||
|
|
a05b373538 |
checkin: a plugin's until is when its answer stops holding (Qoder's 10:00 UTC+8)
sdytman on Discord: Qoder's daily credits start at 10:00, can the plugin's check-in follow it? Qoder's /me/campaigns opens each day's CLAIM_BENEFIT campaign at 10:00 and closes it at 09:59 the next day, UTC+8 (startAt and endAt, read with a real account on 10-28; Qoder.app polls the list every 5 minutes). A check-in before 10:00 meets the day before's campaign. Since #2696 the Qoder plugins are asked again every 30 minutes, so today's was claimed somewhere between 10:00 and 10:30; a plain plugin was settled for the Beijing day. auth.checkin may now answer until (RFC 3339 or epoch ms); host.js passes it as RFC 3339 (plugin.Checkin.Until), kept as ValidUntil. settled holds an answer only until then, whatever its outcome; the loop wakes at it instead of its next 30-minute look; an early done that carries it is not provisional (#3326), as the vendor said when its day turns. Instants throughout, so the machine's zone doesn't matter. The Qoder plugins send until from 0.2.43 (plugins fd40b20): the check-in now lands at 10:01. Run (mote): TestPluginCheckinAsksAgainAtUntil, minute by minute from 09:27 Beijing to the next day's 10:30, with time.Local UTC, UTC-8 and Beijing: asks at 09:27, 10:01, 00:00 (the Beijing day), 10:01; a failure in the 09:59 gap asked at 10:01:00 only. GOOS=linux and windows go vet; go test -tags nogui -timeout 45m ./... all ok (76 packages). gofmt -l clean. Broken by hand, each red: settled ignoring ValidUntil (no 10:01 asks); tick not waking at it (10:27 instead); provisional ignoring it (asked every 30 minutes from 00:00 to 10:00); host.js dropping until (ValidUntil zero). Not tried: the Qoder plugin's recheck path with until (the fake plugin is fakeco; the tick and settled it goes through are the same); a GUI change (none: until isn't shown). |
||
|
|
21f7f9df23 |
checkin: the Qoder plugins' check-in is asked again within the day, as the built-in's was (#2696)
The native Qoder and Qoder CN plugin check-in (pluginCheckinProvider) built
its checkiner without recheck, while the built-in qoderCheckiner set it.
So an inactive or done result was kept for the whole Beijing day, and a
press of "Check in now" was answered from that record too. Qoder CN's
campaign runs 10:00 to 09:59 the next day (mufanmu), so an early read
describes yesterday's campaign and said nothing about today's.
What changed:
- provider: pluginRechecks(id) is true for "qoder" and "qoder-cn" only,
and sets recheck on their checkiner. A press asks at once. The loop asks
again after wbCheckinEvery (30m) for inactive and done. Every other
plugin stays settled for the day.
- GUI (checkinRow): a Qoder account (built-in or plugin) whose check-in
found no campaign today keeps "Check in now". A press reports "Check-in
status refreshed" instead of "Checked in", since it may still find
none. The unused "Checked in" key is replaced in all four languages.
- docs/subsystems/provider-plugins.md names the exception and the tests.
Taken from LoKi's (lokic7123-star) patch on the issue: the recheck on the
Qoder plugin ids, the Check in now button for an inactive Qoder card, and
the neutral press status. Their GUI test was adapted into
qoder-checkin-recheck.test.cjs.
Left out, as the earlier review asked: the blanket 30-minute message, the
UTC timestamps and the client-computed next check. Also left out: the
"Already checked in today" wording and the "· credit" display. That is
not this bug, and the TUI and CLI would need the same change.
Run:
- Red on the old code:
- All 8 subtests of TestPluginCheckinQoderRechecksCampaigns
({qoder,qoder-cn} x {inactive,done} x {loop,press}) fail without
the fix.
- Forcing recheck on for every plugin turns
TestPluginCheckinOthersSettledForTheDay red.
- qoder-checkin-recheck.test.cjs is red on the origin/main assets (no
.ci-now on the card).
- At 91bb01e65 (base
|
||
|
|
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
|
||
|
|
62a1df8010 |
provider: a plugin's daily check-in reaches every sign-in, also two that share a display name (plugins#254)
AutoClaw's plugin can hold several sign-ins under one default display name,
which AutoClaw doesn't let the user change. plugin_checkin.go keyed each
account's check-in on "<provider>|<AccountID>", the display name, so
checkinNow's per-key dedupe asked only the first sign-in of each name, by
the loop and by Check in now alike; the others stayed 今日未签 for good,
and Settings showed one row, and one Off switch, per name.
Each sign-in is now keyed on the key plugin-auth.json keeps it under
(pluginCheckinKey: "autoclaw|autoclaw", "autoclaw|autoclaw#x1y2z3").
Two sign-ins never share it; a refresh writes the same key, and signing
in to an account already signed in goes back to its key (host.js
settle). The display name is shown only. Cards, Settings rows,
CheckinOff and Check in now all read the same key, so app.js is
unchanged. An account without an AccountID already had this key.
Upgrade (adoptLegacyPluginCheckins, run when the plugin's accounts are
listed): an entry kept as "<provider>|<display name>" goes
- in plugin-checkin.json, to the first sign-in in use of that name (the
one the old key's check-in asked) and only to it, and the old entry
is dropped: it isn't asked again today, and its namesakes, never asked,
are;
- in settings.CheckinOff, to every sign-in of that name: the user turned
that name off and none of its sign-ins was checked in since, so the
upgrade switches none on (settings.EditCheckinOff edits that field
alone from what the file holds).
A plugin-checkin.json that can't be read or parsed is left as it is and
carried over once it reads; writes go through writePrivate
(temp-and-rename). Known gap: a sign-in made the same day after another
was signed out can take the freed key and that day's result.
The fake plugin's check-in now records a signed-in account as
name@fake/uid so two of one name tell apart in the presses.
Tests:
- TestPluginCheckinTellsSignInsOfOneNameApart: four sign-ins, A/u1, A/u2,
B/u3, B/u4 (the reporter's case). All four pressed once, none again
that day, four entries kept, four Settings rows, every card marked;
with A/u2 off, Check in now the next day presses the other three.
- TestPluginCheckinCarriesOverDisplayNameEntries: a plugin-checkin.json
with fakeco|A@fake and fakeco|B@fake claimed today plus another
plugin's entry, and CheckinOff ["workbuddy|123", "fakeco|B@fake"].
A's check-in goes to its first sign-in only, the old entries go, the
other plugin's stays, both B sign-ins are off and workbuddy|123 is
kept; the loop then presses only A's namesake, and a second look
presses nothing.
- TestPluginCheckinCarriesNothingOverAnUnreadableFile.
Broken by hand, each red:
1. key back on the display name: TellsApart pressed only A@fake/u1 and
B@fake/u3; CarriesOver kept the old entries.
2. adoption not called: CarriesOver ("A's check-in went to ... ok false").
3. record to every heir: CarriesOver ("carried to both") and Unreadable.
4. Off to the first heir only: CarriesOver (CheckinOff lacks one B).
5. old entry kept: CarriesOver and Unreadable.
6. parse error ignored: Unreadable.
Run at
|
||
|
|
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. |
||
|
|
8c5b9f928d |
provider, agent, gui: subscription accounts can be turned off, and then no agent's sign-in is read (#1535, MaxHaiCom)
What changed: Settings → Privacy → Subscription accounts (On/Off), `magpie accounts discovery [on|off]` and MAGPIE_NO_ACCOUNTS=1 turn off account discovery. It stays on by default. While it is off, magpie reads none of the agents' sign-ins: ~/.claude/.credentials.json, .claude.json's account, ~/.codex/auth.json, Copilot's, Cursor's, Devin's, Kiro's, Gemini's, ZCode's, Command Code's and OpenCode's files. It runs no `security` / `secret-tool` for the Keychain or Secret Service, and asks no agent CLI who is signed in. It serves no subscription. API-key providers, middleware plugins and Pi extensions work as before. Why: the reporter runs magpie on machines where reading other tools' credentials isn't wanted. The owner delegated the call. How: settings.NoAccountDiscovery (kept per computer by KeepOwn) and settings.AccountDiscoveryOff(). The variable only ever turns discovery off. The gates sit at every reader (readAccountFile, discoveryOff) and at every route that reads or writes a sign-in, so a route that skips Accounts still reads nothing: - Accounts, All, Logins, usage, renewal, warm-up, session identities, check-ins; - switching, forgetting, SetLoginOn, StartSignIn, the imports; - moves onto plugins. The ones that write refuse with an error that names how to turn it back on. On the agent side, Agent.Source and OpenCode's auth.json are gated, and Codex wiring goes by magpie's stash instead of auth.json, so a toggle never rewires Codex. logins.json and plugin-auth.json are left untouched and serve again when discovery is turned back on. A change applies at once (ForgetAccounts). Docs: providers-accounts.md, README (en, zh-CN), and the site's CLI table (en, zh, ja). Run: - TestAccountDiscoveryOffReadsNoSignIn (provider) and TestAccountDiscoveryOffAgentsReadNoSignIn (agent). Every credential path is a FIFO that records each open, and security, secret-tool, claude, codex, cursor-agent, devin, kiro-cli, copilot and grok are fakes on PATH. Both fail with the gate removed: they show the opens and `security find-generic-password -s Claude Code-credentials`, among others. Both pass with the gate in place. - TestAccountDiscoverySetting and TestAccountsDiscoveryCmd. - account-discovery.test.cjs: chromium and webkit, 900 and 360 wide, en/zh/zh-TW/ja/de, 32/32. The neighbouring privacy, redact, settings-sections and i18n-keys GUI tests: 49/49. - The full `go test -tags nogui ./...`, gofmt -l, and go vet for darwin, linux and windows on the touched packages. Not tried: a real machine under fs_usage, and Linux and Windows at runtime. The FIFO tests are !windows. |
||
|
|
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. |