Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

checkin: an early "already checked in" is asked again, not kept for the day (#3326)

yetone45fa29973c9c
diff --git a/docs/subsystems/provider-plugins.md b/docs/subsystems/provider-plugins.md
index bc3e24a8d..a97afc1fd 100644
--- a/docs/subsystems/provider-plugins.md
+++ b/docs/subsystems/provider-plugins.md
@@ -44,7 +44,7 @@ A plugin can press its vendor's daily check-in (签到) itself: its `auth` hook
The hook returns `{outcome, credit?, streak?, message?}`. `outcome` is one of `claimed` (checked in now), `done` (already in today), `ineligible`, `inactive` (no check-in event now), `captcha` or `failed`. A throw, or an outcome not in that list, is `failed` with the reason. `captcha` means the vendor wants a captcha: magpie never solves one, and says "check in in its own app" instead. A plugin must not solve captchas either.
-[`plugin_checkin.go`](../../internal/provider/plugin_checkin.go) runs these through the same `checkiner` as the built-in check-ins ([`checkin.go`](../../internal/provider/checkin.go)): each signed-in, in-use account once a Beijing day, the first look 2 minutes after start and then every 30 minutes, a `failed` asked again after 30 minutes, every other outcome settled for the day. The Qoder and Qoder CN plugins are the exception, as magpie's own Qoder check-in is (`recheck`, `pluginRechecks`, #2696): a campaign can open mid-day (Qoder CN's ran 10:00 to 09:59 the next day), so the loop asks again 30 minutes after the last answer whatever it was, and *Check in now* asks at once, and their card keeps *Check in now* for an `inactive` result. Every other plugin keeps the day's result. Results are kept in `plugin-checkin.json` by `provider|<sign-in key>` (`pluginCheckinKey`: the key `plugin-auth.json` keeps the sign-in under, `autoclaw` or `autoclaw#x1y2z3`), never by the display name: two sign-ins can share a name (AutoClaw's default can't be changed), and keyed by it only the first of them was ever checked in, by the loop or *Check in now* (plugins#254). The sign-in key holds over a refresh and over signing in to the same account again (`settle` in `host.js` puts it back under its key); a sign-in made after one was signed out the same day may take the freed key, and with it that day's result. An entry kept by `provider|<display name>` before then is carried over once the plugin's accounts are listed (`adoptLegacyPluginCheckins`): a check-in goes to the first sign-in in use of that name, the one the old key asked, and only to it, so its namesakes are asked and none twice; an `Off` in `settings.CheckinOff` goes to every sign-in of that name, since none of them was checked in while it was off. A `plugin-checkin.json` that can't be read or parsed is left as it is and carried over once it reads; until then no plugin account is checked in, and each says why (`readCheckins`, as for every vendor's check-in file). A failure is recorded as failed and never resets an account, a key or a previous day's result. Each account's Usage card has the check-in row (`checkinBy: "plugin:<provider>"`), and Settings → Usage has a Plugins tab with a Daily check-in switch per provider (`settings.PluginCheckins`, `POST /api/settings/plugin-checkin {provider, on}`; *Check in now* is `POST /api/usage/plugin-checkin {provider}`). `magpie accounts checkin` and `c` on the TUI's Usage page include them. Every check-in, built-in or a plugin's, also skips an account listed in `settings.CheckinOff` by its file key (#1902): `checkinNow` asks nothing for it, by the loop or a press, `CheckinAccounts()` lists each account with its own `on` for Settings (`checkinAccounts`, a row each under the vendor's switch when it has two or more, `POST /api/settings/checkin-account {key, on}`), and its card carries `checkinOff`.
+[`plugin_checkin.go`](../../internal/provider/plugin_checkin.go) runs these through the same `checkiner` as the built-in check-ins ([`checkin.go`](../../internal/provider/checkin.go)): each signed-in, in-use account once a Beijing day, the first look 2 minutes after start and then every 30 minutes, a `failed` asked again after 30 minutes, every other outcome settled for the day. A `done`, `inactive` or `ineligible` answered before noon Beijing (`checkinSureHour`) for an account magpie hasn't seen claim that Beijing day is provisional (`provisional`, #3326): a vendor whose day turns at UTC midnight (08:00 Beijing) or later still answers yesterday's "already" at 00:00, and magpie took it for today's and never asked again. The loop asks it again 30 minutes after the answer, until a claim or an answer from noon on, so at most 24 more asks a day and none once magpie claims; a press (`soon`) asks it again at once, whatever the hour, since the vendor's answer is what the press is for. A claim stamps `Claimed`, carried over while later answers that day say done, so a done after magpie's own claim is settled. Such a record is sent with `again: true` (`shown`, never kept), and the card, Settings, TUI and CLI say the vendor said already checked in and magpie asks again later, not "Checked in today", and the card keeps *Check in now*. A vendor whose day turns after noon Beijing (a US day) is not covered. The Qoder and Qoder CN plugins are the exception, as magpie's own Qoder check-in is (`recheck`, `pluginRechecks`, #2696): a campaign can open mid-day (Qoder CN's ran 10:00 to 09:59 the next day), so the loop asks again 30 minutes after the last answer whatever it was, and *Check in now* asks at once, and their card keeps *Check in now* for an `inactive` result. Every other plugin keeps the day's result. Results are kept in `plugin-checkin.json` by `provider|<sign-in key>` (`pluginCheckinKey`: the key `plugin-auth.json` keeps the sign-in under, `autoclaw` or `autoclaw#x1y2z3`), never by the display name: two sign-ins can share a name (AutoClaw's default can't be changed), and keyed by it only the first of them was ever checked in, by the loop or *Check in now* (plugins#254). The sign-in key holds over a refresh and over signing in to the same account again (`settle` in `host.js` puts it back under its key); a sign-in made after one was signed out the same day may take the freed key, and with it that day's result. An entry kept by `provider|<display name>` before then is carried over once the plugin's accounts are listed (`adoptLegacyPluginCheckins`): a check-in goes to the first sign-in in use of that name, the one the old key asked, and only to it, so its namesakes are asked and none twice; an `Off` in `settings.CheckinOff` goes to every sign-in of that name, since none of them was checked in while it was off. A `plugin-checkin.json` that can't be read or parsed is left as it is and carried over once it reads; until then no plugin account is checked in, and each says why (`readCheckins`, as for every vendor's check-in file). A failure is recorded as failed and never resets an account, a key or a previous day's result. Each account's Usage card has the check-in row (`checkinBy: "plugin:<provider>"`), and Settings → Usage has a Plugins tab with a Daily check-in switch per provider (`settings.PluginCheckins`, `POST /api/settings/plugin-checkin {provider, on}`; *Check in now* is `POST /api/usage/plugin-checkin {provider}`). `magpie accounts checkin` and `c` on the TUI's Usage page include them. Every check-in, built-in or a plugin's, also skips an account listed in `settings.CheckinOff` by its file key (#1902): `checkinNow` asks nothing for it, by the loop or a press, `CheckinAccounts()` lists each account with its own `on` for Settings (`checkinAccounts`, a row each under the vendor's switch when it has two or more, `POST /api/settings/checkin-account {key, on}`), and its card carries `checkinOff`.
The switch is off by default. For a provider whose vendor magpie checked in through the plugin's fetch before (WorkBuddy, Trae CN, MiniMax Code, Qoder), it follows that vendor's existing switch until set on its own, and magpie's own check-in leaves that provider's accounts to the plugin (`pluginChecksIn`), so an account is never checked in twice.
@@ -196,7 +196,7 @@ Gateway parity tests in [`plugin_parity_test.go`](../../internal/gateway/plugin_
[`plugin_decide_test.go`](../../internal/gateway/plugin_decide_test.go) runs the fake plugin (`FAKE_DECIDE`) with a decision API: its marked and `jev-*` models are classifiers and not offered to agents, chat to one is refused, a group saves one as classifier, not beside a chat model, and a group of decision models alone, and each classifier's question reaches the fake vendor at `/v1/systemone` through the plugin's fetch. With `FAKE_DECIDE=models` the marks without `decide` change nothing.
-[`plugin_checkin_test.go`](../../internal/provider/plugin_checkin_test.go) runs the fake plugin's `auth.checkin` (`FAKE_CHECKIN`) through the schedule: off, each outcome, no second press the same day, failures only after the retry window, the next day, cards and Settings, and the vendor check-in stepping aside; `TestPluginCheckinTellsSignInsOfOneNameApart` signs in four accounts under two names, two of each (plugins#254), and checks each is checked in, kept, carded and switched off on its own, and `TestPluginCheckinCarriesOverDisplayNameEntries` upgrades a file and an `Off` kept by display name. `TestPluginCheckinQoderRechecksCampaigns` holds the Qoder plugins' recheck, by the loop and a press, after `inactive` and `done`, and `TestPluginCheckinOthersSettledForTheDay` every other plugin's day; `qoder-checkin-recheck.test.cjs` covers the card's press. `plugin-checkin.test.cjs` covers the card row and the Settings tab.
+[`plugin_checkin_test.go`](../../internal/provider/plugin_checkin_test.go) runs the fake plugin's `auth.checkin` (`FAKE_CHECKIN`) through the schedule: off, each outcome, no second press the same day, failures only after the retry window, the next day, cards and Settings, and the vendor check-in stepping aside; `TestPluginCheckinTellsSignInsOfOneNameApart` signs in four accounts under two names, two of each (plugins#254), and checks each is checked in, kept, carded and switched off on its own, and `TestPluginCheckinCarriesOverDisplayNameEntries` upgrades a file and an `Off` kept by display name. `TestPluginCheckinQoderRechecksCampaigns` holds the Qoder plugins' recheck, by the loop and a press, after `inactive` and `done`, `TestPluginCheckinOthersSettledForTheDay` every other plugin's day from noon Beijing, and `TestPluginCheckinEarlyDoneAskedAgain` the reporter's 00:00:28 done asked again by the loop and a press (#3326); `checkin-early-done.test.cjs` covers that card; `qoder-checkin-recheck.test.cjs` covers the card's press. `plugin-checkin.test.cjs` covers the card row and the Settings tab.
[`plugin_options_test.go`](../../internal/plugin/plugin_options_test.go) loads `testdata/options` in a real host: which declared options are kept and how they are capped, the user's value over the default at start, and a change read by the plugin after `SetProviderOptions` without a restart. [`plugin_option_api_test.go`](../../internal/gui/plugin_option_api_test.go) covers the endpoint, a bad key, and a Settings save keeping the values. `plugin-options.test.cjs` covers the editor in Chromium and WebKit, 1100 and 420 wide, in every language.
diff --git a/internal/cli/accounts_cli.go b/internal/cli/accounts_cli.go
index 3c8777f88..1974cd709 100644
--- a/internal/cli/accounts_cli.go
+++ b/internal/cli/accounts_cli.go
@@ -749,6 +749,16 @@ func checkinWorkBuddy(asJSON bool) error {
r.User = strings.TrimSpace(r.Vendor + " " + r.User)
}
}
+ // an answer that may be the vendor's day before: asked again
+ // later (#3326)
+ later := ""
+ if r.Again {
+ later = " · magpie asks again later"
+ if r.Outcome == provider.CheckinDone {
+ fmt.Println(muted.Render("·"), r.User, muted.Render("says already checked in · its day may not have turned"+later))
+ continue
+ }
+ }
switch r.Outcome {
case provider.CheckinClaimed, provider.CheckinDone:
line := fmt.Sprint(green.Render("✓"), " ", r.User, " checked in today")
@@ -763,9 +773,9 @@ func checkinWorkBuddy(asJSON bool) error {
}
fmt.Println(line)
case provider.CheckinIneligible:
- fmt.Println(muted.Render("·"), r.User, muted.Render("not eligible for the check-in"))
+ fmt.Println(muted.Render("·"), r.User, muted.Render("not eligible for the check-in"+later))
case provider.CheckinInactive:
- fmt.Println(muted.Render("·"), r.User, muted.Render("no check-in event now"))
+ fmt.Println(muted.Render("·"), r.User, muted.Render("no check-in event now"+later))
case provider.CheckinCaptcha:
fmt.Println(muted.Render("·"), r.User, muted.Render(strings.TrimSpace("asks for a captcha: check in in its own app "+r.Msg)))
case provider.CheckinOwnApp:
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index af2f66689..4aaf9072f 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -17702,14 +17702,21 @@ function checkinRow(q, first, subs) {
switch (r.outcome) {
case "claimed":
case "done":
+ if (r.again) {
+ // "already in" before noon with no claim magpie saw: maybe the
+ // vendor's day before, so not shown as today's (#3326)
+ kind = "wait";
+ text = t("{name} says already checked in; its day may not have turned yet, so magpie asks again later", { name: checkinVendorName(r, q.name) });
+ break;
+ }
kind = "ok";
text = t("Checked in today") + (r.credit ? " +" + r.credit : "") + (r.streak ? " · " + t("{n}-day streak", { n: r.streak }) : "");
break;
case "ineligible":
- text = t("Not eligible for the daily check-in");
+ text = t("Not eligible for the daily check-in") + (r.again ? " · " + t("magpie asks again later") : "");
break;
case "inactive":
- text = t("No check-in event now");
+ text = t("No check-in event now") + (r.again ? " · " + t("magpie asks again later") : "");
break;
case "captcha":
// the vendor wants a captcha, which magpie never solves
@@ -17761,9 +17768,11 @@ function checkinRow(q, first, subs) {
};
row.append(auto);
// pressed now: shown while an account isn't in today and could be; a
- // Qoder campaign can open later in the day, so its inactive too (#2696)
+ // Qoder campaign can open later in the day, so its inactive too (#2696),
+ // and an answer magpie asks again, which may be the vendor's day before
+ // (#3326)
const later = /^(plugin:)?qoder(-cn)?$/.test(by);
- const due = subs.filter((x) => x.checkins && !x.checkinOff && (x.checkinBy || "") === by && !(x.checkin?.day === today && x.checkin.outcome !== "failed" && !(later && x.checkin.outcome === "inactive")));
+ const due = subs.filter((x) => x.checkins && !x.checkinOff && (x.checkinBy || "") === by && !(x.checkin?.day === today && x.checkin.outcome !== "failed" && !x.checkin.again && !(later && x.checkin.outcome === "inactive")));
if (due.length) {
const now = el("button", "text ci-now", t("Check in now"));
now.type = "button";
@@ -23605,6 +23614,8 @@ function wbCheckinLine(r) {
switch (r.outcome) {
case "claimed":
case "done":
+ // maybe the vendor's day before (#3326)
+ if (r.again) return t("{user}: {name} says already checked in; magpie asks again later", { user: r.user, name: checkinVendorName(r) });
return t("{user} checked in today", { user: r.user }) + (r.credit ? " +" + r.credit : "")
+ (r.streak ? ", " + t("{n}-day streak", { n: r.streak }) : "");
case "ineligible":
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index ada7476dd..56c6b2acd 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -1098,6 +1098,9 @@ const I18N = {
"last checked in {day}": "上次签到于 {day}",
"Not eligible for the daily check-in": "不符合签到条件",
"No check-in event now": "当前没有签到活动",
+ "{name} says already checked in; its day may not have turned yet, so magpie asks again later": "{name} 回复已签到,但它的签到日可能还没翻页,magpie 稍后会再问",
+ "magpie asks again later": "magpie 稍后再问",
+ "{user}: {name} says already checked in; magpie asks again later": "{user}:{name} 回复已签到,magpie 稍后再问",
"Check-in failed; magpie tries again later": "签到失败,magpie 稍后重试",
"Check-in failed": "签到失败",
"Not checked in yet today": "今日尚未签到",
@@ -4984,6 +4987,9 @@ const I18N = {
"last checked in {day}": "上次簽到於 {day}",
"Not eligible for the daily check-in": "不符合簽到條件",
"No check-in event now": "目前沒有簽到活動",
+ "{name} says already checked in; its day may not have turned yet, so magpie asks again later": "{name} 回覆已簽到,但它的簽到日可能還沒換日,magpie 稍後會再問",
+ "magpie asks again later": "magpie 稍後再問",
+ "{user}: {name} says already checked in; magpie asks again later": "{user}:{name} 回覆已簽到,magpie 稍後再問",
"Check-in failed; magpie tries again later": "簽到失敗,magpie 稍後重試",
"Check-in failed": "簽到失敗",
"Not checked in yet today": "今日尚未簽到",
@@ -8840,6 +8846,9 @@ const I18N = {
"last checked in {day}": "最終チェックイン {day}",
"Not eligible for the daily check-in": "毎日のチェックインの対象外です",
"No check-in event now": "現在チェックインイベントはありません",
+ "{name} says already checked in; its day may not have turned yet, so magpie asks again later": "{name} はチェックイン済みと答えましたが、まだ日付が切り替わっていない可能性があるため、magpie は後でもう一度確認します",
+ "magpie asks again later": "magpie が後でもう一度確認します",
+ "{user}: {name} says already checked in; magpie asks again later": "{user}:{name} はチェックイン済みと答えました。magpie が後でもう一度確認します",
"Check-in failed; magpie tries again later": "チェックインに失敗しました。magpie が後で再試行します",
"Check-in failed": "チェックインに失敗しました",
"Not checked in yet today": "今日はまだチェックインしていません",
@@ -12726,6 +12735,9 @@ const I18N = {
"last checked in {day}": "zuletzt eingecheckt {day}",
"Not eligible for the daily check-in": "Nicht berechtigt für den täglichen Check-in",
"No check-in event now": "Derzeit keine Check-in-Aktion",
+ "{name} says already checked in; its day may not have turned yet, so magpie asks again later": "{name} meldet bereits eingecheckt; sein Tag hat vielleicht noch nicht gewechselt, daher fragt magpie später erneut",
+ "magpie asks again later": "magpie fragt später erneut",
+ "{user}: {name} says already checked in; magpie asks again later": "{user}: {name} meldet bereits eingecheckt; magpie fragt später erneut",
"Check-in failed; magpie tries again later": "Check-in fehlgeschlagen; magpie versucht es später erneut",
"Check-in failed": "Check-in fehlgeschlagen",
"Not checked in yet today": "Heute noch nicht eingecheckt",
diff --git a/internal/gui/tests/checkin-early-done.test.cjs b/internal/gui/tests/checkin-early-done.test.cjs
new file mode 100644
index 000000000..79c5562bf
--- /dev/null
+++ b/internal/gui/tests/checkin-early-done.test.cjs
@@ -0,0 +1,97 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// #3326 (connoryang331): AutoClaw CN, WorkBuddy, Trae and others answered
+// "already checked in" at 00:00 Beijing, before their own day had turned,
+// and magpie showed "Checked in today" and never asked again. An answer
+// magpie asks again (again: true) is not shown as today's check-in: its
+// card says the vendor said already, magpie asks again later, and keeps
+// Check in now, whose press asks the vendor. A done answer magpie keeps
+// (no again) is still "Checked in today" with no press. English,
+// Simplified and Traditional Chinese, Japanese and German, the window and
+// the panel's 440px; the API is faked here.
+const assert = require("node:assert/strict");
+const fs = require("node:fs/promises");
+const path = require("node:path");
+const { test } = require("node:test");
+const { chromium, webkit } = require("playwright");
+const { watchSettingsReads, settingsDrawn, reach } = require("./reader.cjs");
+
+const assets = path.resolve(__dirname, "../assets");
+const today = new Date(Date.now() + 8 * 3600e3).toISOString().slice(0, 10);
+const card = (provider, name, user, by, checkin) => ({
+ provider, name, plan: "Pro", user, windows: [{ name: "Credits", used: 1 }],
+ checkins: true, checkinBy: by, checkin: { user, by, day: today, ...checkin },
+});
+const quotas = () => [
+ card("plugin:autoclaw-cn", "AutoClaw CN", "hu", "plugin:autoclaw-cn", { vendor: "AutoClaw CN", outcome: "done", again: true }),
+ card("plugin:fakeco", "FakeCo", "ann", "plugin:fakeco", { vendor: "FakeCo", outcome: "done", credit: 50 }),
+];
+
+function serve(lang, asked) {
+ const settings = { theme: "light", lang, quotaLeft: false, currency: "usd", pluginCheckins: { "autoclaw-cn": true, fakeco: true } };
+ return async (route) => {
+ const url = new URL(route.request().url());
+ const json = (data) => route.fulfill({ json: data });
+ if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` });
+ if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
+ if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings });
+ if (url.pathname === "/api/settings") return json(settings);
+ if (url.pathname === "/api/usage/plugin-checkin") {
+ asked.push(route.request().postDataJSON());
+ return json([{ outcome: "claimed", credit: 200 }]);
+ }
+ if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true } });
+ if (url.pathname === "/api/usage/quotas") return json(quotas());
+ if (url.pathname === "/api/groups") return json({ groups: [], models: [] });
+ if (url.pathname === "/api/plugins") return json({ plugins: [] });
+ if (url.pathname.startsWith("/api/")) return json({});
+ const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
+ const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
+ try { await route.fulfill({ body: await fs.readFile(file), contentType }); } catch { await route.fulfill({ status: 404, body: "" }); }
+ };
+}
+
+const again = {
+ en: "AutoClaw CN says already checked in; its day may not have turned yet, so magpie asks again later",
+ zh: "AutoClaw CN 回复已签到,但它的签到日可能还没翻页,magpie 稍后会再问",
+ "zh-TW": "AutoClaw CN 回覆已簽到,但它的簽到日可能還沒換日,magpie 稍後會再問",
+ ja: "AutoClaw CN はチェックイン済みと答えましたが、まだ日付が切り替わっていない可能性があるため、magpie は後でもう一度確認します",
+ de: "AutoClaw CN meldet bereits eingecheckt; sein Tag hat vielleicht noch nicht gewechselt, daher fragt magpie später erneut",
+};
+const done = { en: "Checked in today +50", zh: "今日已签到 +50", "zh-TW": "今日已簽到 +50", ja: "今日はチェックイン済み +50", de: "Heute eingecheckt +50" };
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
+ for (const width of [900, 440]) {
+ test(`${engine} ${lang} ${width}px: an early "already checked in" is not today's and can be pressed`, async (t) => {
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ const page = await (await browser.newContext({ viewport: { width, height: 900 }, reducedMotion: "reduce" })).newPage();
+ page.setDefaultTimeout(5000);
+ const errors = [], asked = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.route("**/*", serve(lang, asked));
+ await watchSettingsReads(page);
+ await page.goto("http://magpie.test/?view=usage");
+ await settingsDrawn(page);
+ const of = (user) => page.locator(".subscription-card", { hasText: user });
+ for (const user of ["hu", "ann"]) await of(user).locator(".wb-checkin").first().waitFor();
+
+ const hu = of("hu").locator(".wb-checkin").first();
+ assert.equal((await hu.locator(".ci-say").textContent()).trim(), again[lang]);
+ assert.equal(await hu.getAttribute("data-state"), "wait", "not shown as checked in");
+ const ann = of("ann").locator(".wb-checkin").first();
+ assert.equal((await ann.locator(".ci-say").textContent()).trim(), done[lang]);
+ assert.equal(await of("ann").locator(".ci-now").count(), 0, "a kept done is settled, no press");
+
+ const now = of("hu").locator(".ci-now");
+ assert.equal(await now.count(), 1, "an answer magpie asks again keeps Check in now");
+ await reach(page, now);
+ await now.click();
+ await page.waitForFunction(() => document.querySelector("#status")?.textContent);
+ assert.deepEqual(asked, [{ provider: "autoclaw-cn" }], "the press asks the vendor");
+ assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), "no sideways scroll");
+ assert.deepEqual(errors, []);
+ });
+ }
+ }
+}
diff --git a/internal/provider/checkin.go b/internal/provider/checkin.go
index a016afc3f..0c4d9c244 100644
--- a/internal/provider/checkin.go
+++ b/internal/provider/checkin.go
@@ -2,11 +2,15 @@ package provider
// A daily check-in, whichever vendor's: WorkBuddy's (workbuddy_checkin.go)
// and Trae CN's (trae_checkin.go). Each account in use is checked in once
-// a Beijing day, except Qoder's campaigns, rechecked every 30 minutes.
+// a Beijing day, except Qoder's campaigns, rechecked every 30 minutes,
+// and an answer that may be the vendor's day before (provisional, #3326),
+// asked again every 30 minutes until a claim or an answer from noon on.
+// A press asks the vendor again for a done, inactive or ineligible one.
// What came of it is kept in the vendor's file by its key for reuse
// (see workbuddy_checkin.go for when a failure is tried again).
import (
+ "cmp"
"context"
"encoding/json"
"log"
@@ -85,6 +89,18 @@ func (c checkiner) checkinNow(ctx context.Context, soon bool) []WorkBuddyCheckin
asked[a.key] = true
prev, seen := st[a.key]
settled := prev.settled(day, now, soon)
+ // a press asks the vendor again for a done, inactive or
+ // ineligible magpie saw no claim for: answered from the record,
+ // a press never reached the vendor (#3326). A claim, and an
+ // answer the user acts on (own-app, captcha), stand.
+ if soon && prev.unclaimedAnswer() {
+ settled = false
+ }
+ // and the loop asks again an answer that may be the vendor's
+ // day before (#3326)
+ if settled && prev.provisional() {
+ settled = now.Sub(prev.At) < wbCheckinEvery
+ }
if c.recheck {
settled = settled && !soon && now.Sub(prev.At) < wbCheckinEvery
if prev.Checked() && !prev.ValidUntil.IsZero() {
@@ -93,7 +109,7 @@ func (c checkiner) checkinNow(ctx context.Context, soon bool) []WorkBuddyCheckin
}
if seen && settled {
prev.User, prev.By = a.User, c.by
- out = append(out, prev)
+ out = append(out, prev.shown())
continue
}
r := a.do(ctx)
@@ -101,9 +117,16 @@ func (c checkiner) checkinNow(ctx context.Context, soon bool) []WorkBuddyCheckin
if r.Offline && seen && prev.Day == day && prev.Offline {
r.Tries = prev.Tries + 1
}
+ switch {
+ case r.Outcome == CheckinClaimed:
+ r.Claimed = now
+ case seen && prev.claimedOn(day):
+ // a done after magpie's own claim is that claim
+ r.Claimed = cmp.Or(prev.Claimed, prev.At)
+ }
st[a.key], changed = r, true
r.User, r.By, r.Asked = a.User, c.by, true
- out = append(out, r)
+ out = append(out, r.shown())
}
if changed {
if b, err := json.MarshalIndent(st, "", " "); err == nil {
diff --git a/internal/provider/plugin_checkin_test.go b/internal/provider/plugin_checkin_test.go
index 944878c56..02b3f92d6 100644
--- a/internal/provider/plugin_checkin_test.go
+++ b/internal/provider/plugin_checkin_test.go
@@ -129,16 +129,17 @@ func TestPluginCheckinRunsAsTheBuiltinsDo(t *testing.T) {
if rs := loop.checkinNow(ctx, false); len(rs) != len(keys) || len(pressed(t, presses)) != len(keys) {
t.Fatalf("a minute on: %+v, pressed %q", rs, pressed(t, presses))
}
- // past wbCheckinRetry: the failures only, not the captcha
+ // past wbCheckinRetry: the failures, and the done given before noon
+ // (#3326), not the captcha
now = now.Add(wbCheckinRetry)
loop.checkinNow(ctx, false)
- if p := pressed(t, presses)[len(keys):]; strings.Join(slices.Sorted(slices.Values(p)), ",") != "ck-odd,ck-throw" {
+ if p := pressed(t, presses)[len(keys):]; strings.Join(slices.Sorted(slices.Values(p)), ",") != "ck-done,ck-odd,ck-throw" {
t.Fatalf("past the retry, pressed again %q", p)
}
// the next Beijing day: each again
now = time.Date(2026, 10, 7, 0, 5, 0, 0, beijing)
loop.checkinNow(ctx, false)
- if p := pressed(t, presses); len(p) != 2*len(keys)+2 {
+ if p := pressed(t, presses); len(p) != 2*len(keys)+3 {
t.Fatalf("the next day, pressed %q", p)
}
@@ -538,27 +539,122 @@ func TestPluginCheckinQoderRechecksCampaigns(t *testing.T) {
}
}
-// Every other plugin's check-in is settled for the Beijing day: neither
-// the loop after 30 minutes nor a press asks again (#2696 changes Qoder's
-// alone).
+// Every other plugin's check-in is settled for the Beijing day by a claim,
+// or by a done, inactive or ineligible answered from noon Beijing on: the
+// loop doesn't ask again after 30 minutes (#2696 changes Qoder's alone).
+// A press asks again for any of those but a claim: the record is not the
+// vendor's answer now (#3326).
func TestPluginCheckinOthersSettledForTheDay(t *testing.T) {
- for _, first := range []string{CheckinInactive, CheckinDone, CheckinClaimed} {
+ for _, first := range []string{CheckinInactive, CheckinDone, CheckinIneligible, CheckinClaimed} {
t.Run(first, func(t *testing.T) {
claudeHome(t)
- now := time.Date(2026, 10, 18, 1, 0, 0, 0, time.UTC)
+ now := time.Date(2026, 10, 18, 4, 0, 0, 0, time.UTC) // 12:00 Beijing
outcome, calls := first, 0
p := pluginCheckinCounter("fakeco", &outcome, &calls)
p.checkiner(func() time.Time { return now }).checkinNow(context.Background(), false)
outcome = CheckinClaimed
for _, step := range []time.Duration{31 * time.Minute, 5 * time.Hour} {
now = now.Add(step)
- for _, press := range []bool{false, true} {
- got := p.checkiner(func() time.Time { return now }).checkinNow(context.Background(), press)
- if len(got) != 1 || got[0].Outcome != first || calls != 1 {
- t.Fatalf("press=%v at %s: got %+v after %d asks; want %s kept after 1", press, now, got, calls, first)
- }
+ got := p.checkiner(func() time.Time { return now }).checkinNow(context.Background(), false)
+ if len(got) != 1 || got[0].Outcome != first || got[0].Again || calls != 1 {
+ t.Fatalf("loop at %s: got %+v after %d asks; want %s kept after 1", now, got, calls, first)
}
}
+ got := p.checkiner(func() time.Time { return now }).checkinNow(context.Background(), true)
+ want, wantCalls := CheckinClaimed, 2
+ if first == CheckinClaimed {
+ wantCalls = 1
+ }
+ if len(got) != 1 || got[0].Outcome != want || calls != wantCalls {
+ t.Fatalf("press at %s: got %+v after %d asks; want %s after %d", now, got, calls, want, wantCalls)
+ }
})
}
}
+
+// #3326 (connoryang331): at 00:00:28 Beijing AutoClaw CN, WorkBuddy,
+// CodeArts, Trae CN, MiniMax and Raccoon answered "already in" (done) for
+// accounts whose day's credits were still to claim; magpie kept it as the
+// day's, the loop never asked again, and a press answered from the record.
+// An answer magpie saw no claim for, given before noon Beijing, is asked
+// again every 30 minutes; a press asks at once.
+func TestPluginCheckinEarlyDoneAskedAgain(t *testing.T) {
+ early := time.Date(2026, 10, 23, 0, 0, 28, 0, beijing)
+ run := func(p pluginCheckinProvider, now time.Time, press bool) WorkBuddyCheckin {
+ t.Helper()
+ got := p.checkiner(func() time.Time { return now }).checkinNow(context.Background(), press)
+ if len(got) != 1 {
+ t.Fatalf("at %s: %+v", now, got)
+ }
+ return got[0]
+ }
+ t.Run("loop", func(t *testing.T) {
+ claudeHome(t)
+ outcome, calls := CheckinDone, 0
+ p := pluginCheckinCounter("autoclaw-cn", &outcome, &calls)
+ now := early
+ if r := run(p, now, false); r.Outcome != CheckinDone || !r.Again || calls != 1 {
+ t.Fatalf("at midnight: %+v after %d asks", r, calls)
+ }
+ // shown so on the card too, and in Settings
+ if r := shownCheckins(pluginCheckinPath())["autoclaw-cn|ann"]; !r.Again {
+ t.Fatalf("kept: %+v", r)
+ }
+ if r := run(p, now.Add(29*time.Minute), false); r.Outcome != CheckinDone || !r.Again || calls != 1 {
+ t.Fatalf("29 minutes on: %+v after %d asks", r, calls)
+ }
+ now = now.Add(wbCheckinEvery)
+ if r := run(p, now, false); r.Outcome != CheckinDone || !r.Again || calls != 2 {
+ t.Fatalf("30 minutes on: %+v after %d asks", r, calls)
+ }
+ // the vendor's day turns
+ outcome = CheckinClaimed
+ now = now.Add(wbCheckinEvery)
+ if r := run(p, now, false); r.Outcome != CheckinClaimed || r.Again || calls != 3 {
+ t.Fatalf("after the vendor's turn: %+v after %d asks", r, calls)
+ }
+ // a claim settles the day, for the loop and a press
+ for _, step := range []time.Duration{wbCheckinEvery, 5 * time.Hour} {
+ now = now.Add(step)
+ for _, press := range []bool{false, true} {
+ if r := run(p, now, press); r.Outcome != CheckinClaimed || calls != 3 {
+ t.Fatalf("press=%v at %s: %+v after %d asks", press, now, r, calls)
+ }
+ }
+ }
+ })
+ t.Run("press", func(t *testing.T) {
+ claudeHome(t)
+ outcome, calls := CheckinDone, 0
+ p := pluginCheckinCounter("autoclaw-cn", &outcome, &calls)
+ run(p, early, false)
+ outcome = CheckinClaimed
+ if r := run(p, time.Date(2026, 10, 23, 10, 54, 0, 0, beijing), true); r.Outcome != CheckinClaimed || !r.Asked || calls != 2 {
+ t.Fatalf("pressed at 10:54: %+v after %d asks", r, calls)
+ }
+ })
+ t.Run("done all day", func(t *testing.T) {
+ claudeHome(t)
+ outcome, calls := CheckinDone, 0
+ p := pluginCheckinCounter("autoclaw-cn", &outcome, &calls)
+ var last WorkBuddyCheckin
+ for now := early; wbCheckinDay(now) == "2026-10-23"; now = now.Add(wbCheckinEvery) {
+ last = run(p, now, false)
+ }
+ // 00:00:28 to 11:30:28 provisional, 12:00:28 the day's
+ if calls != 25 || last.Again || last.Outcome != CheckinDone {
+ t.Fatalf("%d asks, last %+v", calls, last)
+ }
+ })
+ t.Run("done after magpie's claim", func(t *testing.T) {
+ claudeHome(t)
+ outcome, calls := CheckinClaimed, 0
+ // Qoder's is rechecked after a claim, and then answers done
+ p := pluginCheckinCounter("qoder", &outcome, &calls)
+ run(p, early, false)
+ outcome = CheckinDone
+ if r := run(p, early.Add(wbCheckinEvery), false); r.Outcome != CheckinDone || r.Again || r.Claimed.IsZero() || calls != 2 {
+ t.Fatalf("done after the claim: %+v after %d asks", r, calls)
+ }
+ })
+}
diff --git a/internal/provider/trae_checkin_test.go b/internal/provider/trae_checkin_test.go
index 01253cd56..41ad3a2c5 100644
--- a/internal/provider/trae_checkin_test.go
+++ b/internal/provider/trae_checkin_test.go
@@ -140,8 +140,10 @@ func TestTraeCheckinAnswers(t *testing.T) {
t.Fatalf("9095: %+v", rs)
}
dev.asked()
- if rs := c.checkinNow(ctx, true); rs[0].Outcome != CheckinIneligible || len(dev.asked()) != 0 {
- t.Fatalf("9095 asked again: %+v", rs)
+ // a press asks again, on the same device: a 9095 from before the
+ // vendor's day turned may be yesterday's (#3326)
+ if rs := c.checkinNow(ctx, true); rs[0].Outcome != CheckinIneligible || strings.Join(dev.asked(), ", ") != "POST /status, POST /claim" {
+ t.Fatalf("9095 pressed: %+v", rs)
}
// a failure that got no answer is tried again the same day
diff --git a/internal/provider/workbuddy_checkin.go b/internal/provider/workbuddy_checkin.go
index 947874749..d421bf443 100644
--- a/internal/provider/workbuddy_checkin.go
+++ b/internal/provider/workbuddy_checkin.go
@@ -122,6 +122,57 @@ type WorkBuddyCheckin struct {
Vendor string `json:"vendor,omitempty"`
// Asked is true of one checked in on this run, not one read back.
Asked bool `json:"-"`
+ // Claimed is when magpie last saw the account's credits claimed,
+ // carried over while later answers that day say done: a done after
+ // magpie's own claim is the day's, one before it may be yesterday's
+ // (#3326).
+ Claimed time.Time `json:"claimed,omitzero"`
+ // Again says the answer is provisional (provisional): magpie asks
+ // the vendor again later that day. Worked out when shown, never
+ // kept.
+ Again bool `json:"again,omitempty"`
+}
+
+// checkinSureHour is the Beijing hour from which a done, inactive or
+// ineligible answer is taken as the day's. Before it, the vendor's own
+// day may not have turned: at 00:00:28 Beijing AutoClaw CN, WorkBuddy,
+// CodeArts, Trae CN, MiniMax and Raccoon answered "already in" for
+// accounts whose day's credits were still to claim, and a claim at 10:54
+// paid them (#3326, connoryang331, 14 of 29 accounts). Days that turn at
+// UTC midnight (08:00 Beijing) and Qoder CN's 10:00 campaigns are past by
+// noon; a vendor counting a US day isn't covered.
+const checkinSureHour = 12
+
+// claimedOn says whether magpie saw the account's credits claimed on day.
+func (r WorkBuddyCheckin) claimedOn(day string) bool {
+ return r.Outcome == CheckinClaimed && r.Day == day || !r.Claimed.IsZero() && wbCheckinDay(r.Claimed) == day
+}
+
+// provisional says whether r is an answer that may describe the vendor's
+// day before (#3326): a done, inactive or ineligible one given before
+// checkinSureHour, on a day magpie saw no claim. The loop asks such an
+// account again every wbCheckinEvery until a claim, or one of these
+// answers from checkinSureHour on, settles the day: at most 24 more
+// asks a day for an account that was in early, none once magpie claims.
+func (r WorkBuddyCheckin) provisional() bool {
+ return r.unclaimedAnswer() && r.At.In(beijing).Hour() < checkinSureHour
+}
+
+// unclaimedAnswer says whether r is the vendor's word on how its day
+// stands (done, inactive or ineligible) on a day magpie saw no claim:
+// one a press asks the vendor again for, as it may have changed.
+func (r WorkBuddyCheckin) unclaimedAnswer() bool {
+ switch r.Outcome {
+ case CheckinDone, CheckinInactive, CheckinIneligible:
+ return !r.claimedOn(r.Day)
+ }
+ return false
+}
+
+// shown is r as a reader is given it: Again worked out.
+func (r WorkBuddyCheckin) shown() WorkBuddyCheckin {
+ r.Again = r.provisional()
+ return r
}
// Checked says whether the day's credits are in, claimed now or before.
@@ -228,12 +279,16 @@ func wroteCheckins(path string, st map[string]WorkBuddyCheckin) {
}
// shownCheckins is readCheckins for a reader that only shows the entries:
-// on an error, what last read (logged by readCheckins).
+// on an error, what last read (logged by readCheckins); each with Again
+// worked out.
func shownCheckins(path string) map[string]WorkBuddyCheckin {
st, _ := readCheckins(path)
if st == nil {
st = map[string]WorkBuddyCheckin{}
}
+ for k, r := range st {
+ st[k] = r.shown()
+ }
return st
}
diff --git a/internal/provider/workbuddy_checkin_test.go b/internal/provider/workbuddy_checkin_test.go
index b27989ba0..424f96055 100644
--- a/internal/provider/workbuddy_checkin_test.go
+++ b/internal/provider/workbuddy_checkin_test.go
@@ -182,7 +182,8 @@ func TestWorkBuddyCheckinOncePerDay(t *testing.T) {
}
// Checked in already (in WorkBuddy), or the event not running: nothing is
-// claimed, and that holds for the day.
+// claimed, and, answered from noon Beijing on (checkinSureHour), that holds
+// for the day; an earlier one is asked again (#3326).
func TestWorkBuddyCheckinNothingToClaim(t *testing.T) {
for _, tc := range []struct {
name string
@@ -194,7 +195,7 @@ func TestWorkBuddyCheckinNothingToClaim(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
srv := tc.f.serve(t)
- now := time.Date(2026, 3, 1, 2, 0, 0, 0, time.UTC)
+ now := time.Date(2026, 3, 1, 4, 0, 0, 0, time.UTC) // 12:00 Beijing
c := wbCheckinFixture(t, srv, &now)
rs := c.checkinNow(context.Background(), false)
if len(rs) != 1 || rs[0].Outcome != tc.outcome {
@@ -212,13 +213,13 @@ func TestWorkBuddyCheckinNothingToClaim(t *testing.T) {
}
}
-// A claim refused as already made (1001) or not eligible (1002) is that
-// day's answer, not asked again.
+// A claim refused as already made (1001) or not eligible (1002) from noon
+// Beijing on is that day's answer, not asked again by the loop.
func TestWorkBuddyCheckinRefused(t *testing.T) {
for code, outcome := range map[int]string{wbCheckinAlready: CheckinDone, wbCheckinIneligible: CheckinIneligible, wbCheckinEnded: CheckinInactive} {
f := &fakeWBCheckin{active: true, claimCode: code}
srv := f.serve(t)
- now := time.Date(2026, 3, 1, 2, 0, 0, 0, time.UTC)
+ now := time.Date(2026, 3, 1, 4, 0, 0, 0, time.UTC) // 12:00 Beijing
c := wbCheckinFixture(t, srv, &now)
rs := c.checkinNow(context.Background(), false)
if len(rs) != 1 || rs[0].Outcome != outcome {
@@ -524,3 +525,26 @@ func TestWorkBuddyCheckinUnauthorizedThroughPlugin(t *testing.T) {
t.Fatalf("asked %v", paths)
}
}
+
+// #3326: magpie's own check-ins go through the same checkiner, so a done
+// WorkBuddy gives before its day turns is asked again too, and claimed
+// once it has.
+func TestWorkBuddyCheckinEarlyDoneAskedAgain(t *testing.T) {
+ f := &fakeWBCheckin{active: true, checked: true}
+ srv := f.serve(t)
+ now := time.Date(2026, 10, 22, 16, 0, 28, 0, time.UTC) // 00:00:28 Beijing
+ c := wbCheckinFixture(t, srv, &now)
+ if rs := c.checkinNow(context.Background(), false); len(rs) != 1 || rs[0].Outcome != CheckinDone || !rs[0].Again {
+ t.Fatalf("at midnight: %+v", rs)
+ }
+ f.mu.Lock()
+ f.checked = false
+ f.mu.Unlock()
+ now = now.Add(wbCheckinEvery)
+ if rs := c.checkinNow(context.Background(), false); len(rs) != 1 || rs[0].Outcome != CheckinClaimed {
+ t.Fatalf("30 minutes on: %+v", rs)
+ }
+ if s, cl := f.counts(); s != 2 || cl != 1 {
+ t.Fatalf("status %d, claims %d", s, cl)
+ }
+}
diff --git a/internal/tui/checkin_test.go b/internal/tui/checkin_test.go
index c3c912fd5..24e5ef585 100644
--- a/internal/tui/checkin_test.go
+++ b/internal/tui/checkin_test.go
@@ -220,3 +220,24 @@ func TestTraeOwnAppSaysTraeRefused(t *testing.T) {
t.Errorf("WorkBuddy's own-app: %q", wb)
}
}
+
+// #3326: an "already in" magpie asks again (Again: before noon Beijing,
+// with no claim magpie saw) may be the vendor's day before, so it is not
+// shown as today's check-in.
+func TestCheckinAgainNotShownAsToday(t *testing.T) {
+ now := time.Date(2026, 10, 23, 0, 0, 28, 0, time.FixedZone("CST", 8*3600))
+ r := provider.WorkBuddyCheckin{User: "177", By: "plugin:autoclaw-cn", Vendor: "AutoClaw CN", Day: "2026-10-23", Outcome: provider.CheckinDone, Credit: 200, Again: true}
+ if w := checkinWords(r); strings.Contains(w, "checked in today") || !strings.Contains(w, "asks again later") {
+ t.Errorf("words: %q", w)
+ }
+ if c := checkinCell(provider.SubscriptionQuota{Checkins: true, Checkin: &r}, now); strings.Contains(c, "✓") || !strings.Contains(c, "asked again later") {
+ t.Errorf("cell: %q", c)
+ }
+ r.Again = false
+ if w := checkinWords(r); !strings.Contains(w, "checked in today +200") {
+ t.Errorf("settled done: %q", w)
+ }
+ if c := checkinCell(provider.SubscriptionQuota{Checkins: true, Checkin: &r}, now); !strings.Contains(c, "✓") {
+ t.Errorf("settled cell: %q", c)
+ }
+}
diff --git a/internal/tui/pages.go b/internal/tui/pages.go
index a7fdf522f..2ddb0b042 100644
--- a/internal/tui/pages.go
+++ b/internal/tui/pages.go
@@ -948,6 +948,13 @@ func checkinWords(r provider.WorkBuddyCheckin) string {
who = "WorkBuddy"
}
switch r.Outcome {
+ case provider.CheckinDone, provider.CheckinInactive, provider.CheckinIneligible:
+ if r.Again {
+ // maybe the vendor's day before (#3326)
+ return who + ": " + againWords(r)
+ }
+ }
+ switch r.Outcome {
case provider.CheckinClaimed, provider.CheckinDone:
s := who + " checked in today"
if r.Credit > 0 {
@@ -976,6 +983,18 @@ func checkinWords(r provider.WorkBuddyCheckin) string {
return who + " couldn't check in: " + msg
}
+// againWords is a provisional answer (WorkBuddyCheckin.Again) in words:
+// it may be the vendor's day before, so magpie asks again later (#3326).
+func againWords(r provider.WorkBuddyCheckin) string {
+ switch r.Outcome {
+ case provider.CheckinDone:
+ return "says already checked in · its day may not have turned, magpie asks again later"
+ case provider.CheckinIneligible:
+ return "not eligible now · magpie asks again later"
+ }
+ return "no check-in event now · magpie asks again later"
+}
+
// ownAppName is the vendor whose own app alone gets r's check-in credits.
func ownAppName(r provider.WorkBuddyCheckin) string {
switch {
@@ -1011,6 +1030,10 @@ func checkinCell(q provider.SubscriptionQuota, now time.Time) string {
if r == nil || r.Day != provider.CheckinDay(now) {
return sMuted.Render("签到 not yet today · c")
}
+ if r.Again && r.Outcome == provider.CheckinDone {
+ // "already in" that may be the vendor's day before (#3326)
+ return sMuted.Render("签到 said already · asked again later · c")
+ }
switch r.Outcome {
case provider.CheckinClaimed, provider.CheckinDone:
s := sOK.Render("签到 ✓")