gui: the Version row's Restart is named Restart only (realfxw on X)

With automatic updates off, Settings › About's Version row shows Check
and a bare Restart. realfxw restarted again and again, reading Restart
as "install the update", while his build was newer than Daily's and no
update was on offer.

Why the button is there: 74bba1fa6 added it for yansheng1003 on X, to
start magpie again as it is so start-only settings apply (LAN set by
hand in settings.json, environment variables). It does something, so
it stays, named for what it does: "Restart only" (仅重启, 僅重啟,
再起動のみ, Nur neu starten). It still shows only while no update is on
offer; the paths that install an update keep their own buttons. No
description text is added. The plain "Restart" key stays for the
agent dialogs that use it.

A longer "Restart without updating" was tried first: at 420 wide it
squeezed en's "Automatic updates are off" onto two lines, the row grew
and update-auto's "a view at its top stays at its top" went red (top
25, 2 of 2 runs, both engines). "Restart only" keeps that line on one.

TestCoreScriptBudget: app and core budgets +5, the longer word alone;
renderUpdate draws it on every window, so there is no page to move it
to.

Tests: version-restart.test.cjs gains "automatic updates off, the button
beside Check says it doesn't update", every language at 900 and 400
wide (buttons on one line, no sideways scroll, no page errors).

Run, on mote:
- Red on old: the new case against origin/main's assets, chromium, 31
  failures (['Check','Restart'] where the new label is expected).
- At this head (rebased on 35a03fee0):
  - gofmt -l internal/gui empty;
  - go vet ./internal/gui for darwin, linux -tags nogui and windows;
  - go build ./... for darwin, linux -tags nogui and windows;
  - go test -run 'TestCoreScriptBudget|TestI18n|TestRestart|TestUpdate'
    ./internal/gui ok.
- GUI, the 32 files it can reach (update-*, version-*, i18n-*,
  gui-zh-tw, gui-ja, gui-de, settings-search*, old-webkit, refresh-page,
  settings-update-source), chromium and webkit: 356 of 358 in each engine; the two reds are old-webkit's, below.
  - Before the rebase: update-auto, version-restart, update-check,
    i18n-keys, gui-de, gui-ja and gui-zh-tw passed 70 of 70 in each
    engine.
- old-webkit's two reds (guideback.js from cb1fe6d5d isn't in its
  list) fail the same on a fresh origin/main 35a03fee0, alone, in both
  engines; recorded on #6570.

Not run: the full Go suite (mote at load ~50, mica's disk full).
Not tried: the real app's About page with automatic updates off.
This commit is contained in:
yetone
2026-11-18 22:32:44 +08:00
parent 35a03fee0f
commit 1b360f08c2
5 changed files with 42 additions and 13 deletions
+4 -1
View File
@@ -1354,7 +1354,10 @@ and `update-wait.test.cjs`.
What a user changes is meant to apply live, and most of it does; a restart
is the way out for what doesn't yet, without quitting and opening magpie by
hand (yansheng1003 on X: "请在刷新旁边增加一个重启按钮"). Settings › Version
has **Restart** beside Check while no update is on offer: not once one is
has **Restart only** beside Check while no update is on
offer, named for what it does: a bare Restart beside Check read as
installing an update (realfxw on X restarted again and again on a
version newer than Daily's). It isn't shown once one is
found, downloading, downloaded (its Restart to update is the only one) or
blocked, nor with a newer version named or a download failed, whose own
buttons fill a narrow row (`renderUpdate`), and the tray's
+4 -2
View File
@@ -22763,8 +22763,10 @@ async function renderUpdate(r, u) {
}
// magpie started again as it is (yansheng1003 on X), in versionrow.js;
// not beside an update on offer, whose own path restarts, nor past a
// narrow row's room
if (!/^(ready|downloading|found|available|blocked)$/.test(u.state) && !u.newest && !(u.state === "error" && u.latest)) btn(t("Restart"), () => import("./versionrow.js").then(() => restartSelf(r, u)), u.state === "checking");
// narrow row's room. Named for what it does: a bare Restart beside
// Check read as installing an update (realfxw on X restarted again and
// again on a version newer than Daily's)
if (!/^(ready|downloading|found|available|blocked)$/.test(u.state) && !u.newest && !(u.state === "error" && u.latest)) btn(t("Restart only"), () => import("./versionrow.js").then(() => restartSelf(r, u)), u.state === "checking");
if (kept && !pageShown) kept.remove();
}
+4
View File
@@ -2605,6 +2605,7 @@ const I18N = {
"magpie's models are in VS Code's Chat model picker, under magpie (VS Code 1.122 or later). If they don't show, run Developer: Reload Window in VS Code.": "magpie 的模型位于 VS Code 聊天模型选择器的 magpie 分组下(需 VS Code 1.122 或更高)。若未出现,请在 VS Code 中运行 Developer: Reload Window。",
"Later": "稍后",
"Restart": "重启",
"Restart only": "仅重启",
"Codex's background service restarted": "Codex 的后台服务已重启",
"Codex app-server restarted": "Codex 的 app-server 已重启",
"Its app-server restarts and signs in to the new account; its window stays. A running turn stops.": "它的 app-server 会重启并登录新账号;窗口保持不变。正在运行的回合会停止。",
@@ -8084,6 +8085,7 @@ const I18N = {
"magpie's models are in VS Code's Chat model picker, under magpie (VS Code 1.122 or later). If they don't show, run Developer: Reload Window in VS Code.": "magpie 的模型位於 VS Code 聊天模型選擇器的 magpie 分組下(需 VS Code 1.122 或更高)。若未出現,請在 VS Code 中執行 Developer: Reload Window。",
"Later": "稍後",
"Restart": "重啟",
"Restart only": "僅重啟",
"Codex's background service restarted": "Codex 的後臺服務已重啟",
"Codex app-server restarted": "Codex 的 app-server 已重新啟動",
"Its app-server restarts and signs in to the new account; its window stays. A running turn stops.": "它的 app-server 會重新啟動並登入新帳號;視窗保持不變。正在執行的回合會停止。",
@@ -13532,6 +13534,7 @@ const I18N = {
"magpie's models are in VS Code's Chat model picker, under magpie (VS Code 1.122 or later). If they don't show, run Developer: Reload Window in VS Code.": "magpie のモデルは VS Code のチャットのモデルピッカーの magpie の下にあります(VS Code 1.122 以降)。表示されない場合は VS Code で Developer: Reload Window を実行してください。",
"Later": "後で",
"Restart": "再起動",
"Restart only": "再起動のみ",
"Codex's background service restarted": "Codex のバックグラウンドサービスを再起動しました",
"Codex app-server restarted": "Codex の app-server を再起動しました",
"Its app-server restarts and signs in to the new account; its window stays. A running turn stops.": "app-server を再起動して新しいアカウントでサインインさせます。ウィンドウはそのままです。実行中のターンは止まります。",
@@ -19023,6 +19026,7 @@ const I18N = {
"magpie's models are in VS Code's Chat model picker, under magpie (VS Code 1.122 or later). If they don't show, run Developer: Reload Window in VS Code.": "Die Modelle von magpie stehen in der Modellauswahl des VS-Code-Chats unter magpie (VS Code 1.122 oder neuer). Erscheinen sie nicht, führen Sie in VS Code Developer: Reload Window aus.",
"Later": "Später",
"Restart": "Neu starten",
"Restart only": "Nur neu starten",
"Codex's background service restarted": "Hintergrunddienst von Codex neu gestartet",
"Codex app-server restarted": "App-Server von Codex neu gestartet",
"Its app-server restarts and signs in to the new account; its window stays. A running turn stops.": "Sein App-Server startet neu und meldet sich mit dem neuen Konto an; das Fenster bleibt offen. Ein laufender Turn wird angehalten.",
File diff suppressed because one or more lines are too long
+28 -8
View File
@@ -1,14 +1,18 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
// Settings › About's Version row restarts magpie as it is (yansheng1003 on
// X: "请在刷新旁边增加一个重启按钮"):
// - up to date, the row has Restart beside Check, on one line at 400px
// - up to date, the row has Restart only beside Check, on
// one line at 400px
// too; a click posts /api/restart with the tab the window is on and says
// Restarting…;
// - in a browser (magpie web), the page reloads once another run of
// magpie answers /api/update, of the same version;
// - a restart that can't be arranged says so and gives the buttons back;
// - an update downloaded has its own Restart to update, and no second
// Restart.
// Restart;
// - with automatic updates off and nothing checked yet, the button beside
// Check says it doesn't update (realfxw on X restarted again and again
// on a bare Restart, waiting for an update).
// Every language, both engines; no backend, the API is faked here.
const assert = require("node:assert/strict");
const fs = require("node:fs/promises");
@@ -19,17 +23,17 @@ const { watchSettingsReads, settingsDrawn } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const words = {
en: { version: "Version", latest: "Up to date", check: "Check", restart: "Restart", restarting: "Restarting…", failed: "Couldn't restart magpie", update: "Restart to update" },
zh: { version: "版本", latest: "已是最新", check: "检查", restart: "重启", restarting: "正在重启…", failed: "无法重启 magpie", update: "重启以更新" },
"zh-TW": { version: "版本", latest: "已是最新", check: "檢查", restart: "重啟", restarting: "正在重啟…", failed: "無法重啟 magpie", update: "重啟以更新" },
ja: { version: "バージョン", latest: "最新です", check: "確認", restart: "再起動", restarting: "再起動中…", failed: "magpie を再起動できませんでした", update: "再起動してアップデート" },
de: { version: "Version", latest: "Aktuell", check: "Prüfen", restart: "Neu starten", restarting: "Neustart…", failed: "magpie konnte nicht neu gestartet werden", update: "Zum Aktualisieren neu starten" },
en: { version: "Version", latest: "Up to date", check: "Check", restart: "Restart only", off: "Automatic updates are off", restarting: "Restarting…", failed: "Couldn't restart magpie", update: "Restart to update" },
zh: { version: "版本", latest: "已是最新", check: "检查", restart: "仅重启", off: "自动更新已关闭", restarting: "正在重启…", failed: "无法重启 magpie", update: "重启以更新" },
"zh-TW": { version: "版本", latest: "已是最新", check: "檢查", restart: "僅重啟", off: "自動更新已關閉", restarting: "正在重啟…", failed: "無法重啟 magpie", update: "重啟以更新" },
ja: { version: "バージョン", latest: "最新です", check: "確認", restart: "再起動のみ", off: "自動アップデートはオフです", restarting: "再起動中…", failed: "magpie を再起動できませんでした", update: "再起動してアップデート" },
de: { version: "Version", latest: "Aktuell", check: "Prüfen", restart: "Nur neu starten", off: "Automatische Updates sind ausgeschaltet", restarting: "Neustart…", failed: "magpie konnte nicht neu gestartet werden", update: "Zum Aktualisieren neu starten" },
};
function server(lang, ctl) {
const settings = {
theme: "light", lang, tray: "panel", quotaLeft: false, currency: "usd", proxy: "", redact: false, redactWords: [],
version: "0.1.400", dir: "~/.config/magpie", gateway: "http://127.0.0.1:3425", proxyNow: "none", proxySource: "none",
noAutoUpdate: !!ctl.off, version: "0.1.400", dir: "~/.config/magpie", gateway: "http://127.0.0.1:3425", proxyNow: "none", proxySource: "none",
visionModels: [], imageGenModels: [], workbuddyCheckins: [], lanURLs: [], fx: { rate: 7.2, at: new Date().toISOString(), stale: false },
};
return async (route) => {
@@ -149,6 +153,22 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
}
});
for (const width of [900, 400]) {
await t.test(`${lang} ${width}px: automatic updates off, the button beside Check says it doesn't update`, async () => {
const ctl = { posts: [], off: true, update: { state: "", current: "0.1.400", run: 111 } };
const { page, errors } = await open(browser, lang, ctl, width);
const row = versionRow(page, lang);
await row.locator(".sub", { hasText: w.off }).waitFor();
assert.deepEqual(await buttons(row), [w.check, w.restart]);
const tops = await row.locator(".val button").evaluateAll((bs) => bs.map((b) => Math.round(b.getBoundingClientRect().top)));
assert.equal(new Set(tops).size, 1, `the buttons wrap: tops ${tops}`);
const over = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
assert.ok(over <= 0, `the page scrolls sideways by ${over}px`);
assert.deepEqual(errors, []);
await page.context().close();
});
}
await t.test(lang + ": an update downloaded has no second Restart", async () => {
const ctl = { posts: [], update: { state: "ready", current: "0.1.400", latest: "0.1.401", run: 111 } };
const { page, errors } = await open(browser, lang, ctl, 900);