Skip to content

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

gui: Warm up on reset says a window that resets during sleep starts on waking

yetone9d6436311af9
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index 38aea801f..7ca5198b4 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -1082,6 +1082,7 @@ const I18N = {
"Sent through Claude Code.": "通过 Claude Code 发送。",
"One tiny request, sent only to an account whose 5-hour window isn't running then.": "只发一条极小的请求,且只发给那时 5 小时窗口没在计时的账号。",
"A computer asleep then sends it on waking, up to an hour late; later than that, the day is left be.": "届时电脑若在睡眠,醒来后一小时内补发;超过则跳过当天。",
+ "Nothing is sent while the computer sleeps: a window that resets then starts when it wakes, and counts from then.": "电脑睡眠时不会发送:睡眠期间重置的窗口在唤醒后开启,从唤醒时开始计时。",
"With Weekly and 5-hour on, a window that would still be running then isn't started on its reset: the windows follow one another from this time.": "同时开启「每周和 5 小时」时,届时仍在计时的窗口不在重置时开启:窗口从此时间起依次衔接。",
"Time of day": "时间",
"last started {when}": "上次启动于{when}",
@@ -4974,6 +4975,7 @@ const I18N = {
"Sent through Claude Code.": "透過 Claude Code 傳送。",
"One tiny request, sent only to an account whose 5-hour window isn't running then.": "只發一條極小的請求,且只發給那時 5 小時時段沒在計時的帳號。",
"A computer asleep then sends it on waking, up to an hour late; later than that, the day is left be.": "屆時電腦若在睡眠,醒來後一小時內補發;超過則跳過當天。",
+ "Nothing is sent while the computer sleeps: a window that resets then starts when it wakes, and counts from then.": "電腦睡眠時不會發送:睡眠期間重置的時段在喚醒後開啟,從喚醒時開始計時。",
"With Weekly and 5-hour on, a window that would still be running then isn't started on its reset: the windows follow one another from this time.": "同時開啟「每週和 5 小時」時,屆時仍在計時的時段不在重置時開啟:時段從此時間起依次銜接。",
"Time of day": "時間",
"last started {when}": "上次啟動於{when}",
@@ -8836,6 +8838,7 @@ const I18N = {
"Sent through Claude Code.": "Claude Code 経由で送信します。",
"One tiny request, sent only to an account whose 5-hour window isn't running then.": "ごく小さなリクエストを 1 件、その時点で 5 時間枠が動いていないアカウントにだけ送ります。",
"A computer asleep then sends it on waking, up to an hour late; later than that, the day is left be.": "その時刻にコンピュータがスリープしていた場合は、復帰後 1 時間以内なら送信します。それより遅ければその日はスキップします。",
+ "Nothing is sent while the computer sleeps: a window that resets then starts when it wakes, and counts from then.": "コンピュータのスリープ中は送信しません。スリープ中にリセットされた期間は復帰時に開始され、そこから数えます。",
"With Weekly and 5-hour on, a window that would still be running then isn't started on its reset: the windows follow one another from this time.": "「週と 5 時間」がオンのときは、その時刻にまだ動いている枠はリセット時に開始されません。枠はこの時刻から順に続きます。",
"Time of day": "時刻",
"last started {when}": "最終開始 {when}",
@@ -12728,6 +12731,7 @@ const I18N = {
"Sent through Claude Code.": "Über Claude Code gesendet.",
"One tiny request, sent only to an account whose 5-hour window isn't running then.": "Eine winzige Anfrage, nur an Konten, deren 5-Stunden-Zeitfenster dann nicht läuft.",
"A computer asleep then sends it on waking, up to an hour late; later than that, the day is left be.": "Schläft der Computer dann, sendet er sie beim Aufwachen bis zu einer Stunde später; danach entfällt der Tag.",
+ "Nothing is sent while the computer sleeps: a window that resets then starts when it wakes, and counts from then.": "Während der Computer schläft, wird nichts gesendet: Ein Zeitfenster, das dann zurückgesetzt wird, startet beim Aufwachen und zählt ab dann.",
"With Weekly and 5-hour on, a window that would still be running then isn't started on its reset: the windows follow one another from this time.": "Ist „Wöchentlich und 5 Stunden“ an, wird ein Zeitfenster, das dann noch laufen würde, nicht beim Reset gestartet: die Zeitfenster folgen ab dieser Uhrzeit aufeinander.",
"Time of day": "Uhrzeit",
"last started {when}": "zuletzt gestartet {when}",
diff --git a/internal/gui/assets/index.html b/internal/gui/assets/index.html
index d00e4e08e..bb60055f5 100644
--- a/internal/gui/assets/index.html
+++ b/internal/gui/assets/index.html
@@ -295,7 +295,7 @@
<div class="warm-panes" data-feature="warmups">
<div class="list prefs" id="codexWarmList" role="tabpanel" aria-labelledby="warmTab-codex">
<div class="row pref">
- <div class="who"><div class="name" data-t>Warm up on reset</div><div class="sub" id="warmSub"></div></div>
+ <div class="who"><div class="name" data-t>Warm up on reset</div><div class="sub" id="warmSub" title="Nothing is sent while the computer sleeps: a window that resets then starts when it wakes, and counts from then." data-tt></div></div>
<div id="warmSegs"></div>
</div>
<div class="row pref">
@@ -305,7 +305,7 @@
</div>
<div class="list prefs" id="claudeWarmList" role="tabpanel" aria-labelledby="warmTab-claude">
<div class="row pref">
- <div class="who"><div class="name" data-t>Warm up on reset</div><div class="sub" id="claudeWarmSub"></div></div>
+ <div class="who"><div class="name" data-t>Warm up on reset</div><div class="sub" id="claudeWarmSub" title="Nothing is sent while the computer sleeps: a window that resets then starts when it wakes, and counts from then." data-tt></div></div>
<div id="claudeWarmSegs"></div>
</div>
<div class="row pref">
diff --git a/internal/gui/tests/warm-reset-asleep.test.cjs b/internal/gui/tests/warm-reset-asleep.test.cjs
new file mode 100644
index 000000000..7f47f792b
--- /dev/null
+++ b/internal/gui/tests/warm-reset-asleep.test.cjs
@@ -0,0 +1,70 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// Warm up on reset across sleep (LEO_CHEN_X on X, 10-24): nothing runs
+// while the computer sleeps, so a window that resets then is started when
+// it wakes (keepWarm, codex_warmup.go, within a minute) and counts from
+// then: a full 5-hour window on opening the lid. Codex's and Claude Code's
+// Warm up on reset rows say so in their line's title (index.html's
+// data-tt, translated with the page), as Daily warm-up's says what a
+// sleeping computer does with its time. en, zh, zh-TW, ja, de;
+// 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 } = require("./reader.cjs");
+
+const assets = path.resolve(__dirname, "../assets");
+
+function serve(lang) {
+ const settings = { theme: "light", lang, currency: "usd", codexWarmup: "all", claudeWarmup: "week", codexWarmed: "2026-10-24T01:00:00Z", codexUsers: ["[email protected]"] };
+ return async (route) => {
+ const req = route.request(), url = new URL(req.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/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true } });
+ 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 ASLEEP = {
+ en: "Nothing is sent while the computer sleeps: a window that resets then starts when it wakes, and counts from then.",
+ zh: "电脑睡眠时不会发送:睡眠期间重置的窗口在唤醒后开启,从唤醒时开始计时。",
+ "zh-TW": "電腦睡眠時不會發送:睡眠期間重置的時段在喚醒後開啟,從喚醒時開始計時。",
+ ja: "コンピュータのスリープ中は送信しません。スリープ中にリセットされた期間は復帰時に開始され、そこから数えます。",
+ de: "Während der Computer schläft, wird nichts gesendet: Ein Zeitfenster, das dann zurückgesetzt wird, startet beim Aufwachen und zählt ab dann.",
+};
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const lang of Object.keys(ASLEEP)) {
+ test(`${engine} ${lang}: Warm up on reset says what a sleeping computer does`, 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: 440, height: 800 } })).newPage();
+ page.setDefaultTimeout(5000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.route("**/*", serve(lang));
+ await watchSettingsReads(page);
+ await page.goto("http://magpie.test/?view=settings&tab=usage");
+ await settingsDrawn(page);
+ for (const id of ["#warmSub", "#claudeWarmSub"]) {
+ const sub = page.locator(id);
+ // the language's own, once the page has put its words in
+ await page.waitForFunction(([id, want]) => document.querySelector(id)?.title === want, [id, ASLEEP[lang]]).catch(() => {});
+ const [shown, title] = await sub.evaluate((e) => [e.textContent, e.title]);
+ assert.equal(title, ASLEEP[lang], `${id}: what a sleeping computer does`);
+ assert.ok(shown && !shown.includes(title), `${id}: the line keeps its purpose, the fine print in the title (${shown})`);
+ }
+ assert.deepEqual(errors, []);
+ });
+ }
+}