Skip to content

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

settings: lightweight mode is off for a user who never chose

yetonec627652e9a22
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index a74d79bde..eeafc4357 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -19360,7 +19360,7 @@ function renderSettings() {
s.dock ? "on" : s.dockWindow ? "window" : "off", (v) => savePrefs({ ...keep, dock: v === "on", dockWindow: v === "window" })));
// a closed window's webview let go (#580): the app's windows alone
$("#lightweightRow").hidden = web;
- $("#lightweightSegs").replaceChildren(segs([["off", t("Off")], ["on", t("On")]], s.lightweight !== false ? "on" : "off",
+ $("#lightweightSegs").replaceChildren(segs([["off", t("Off")], ["on", t("On")]], s.lightweight === true ? "on" : "off",
(v) => savePrefs({ ...keep, lightweight: v === "on" })));
// the display kept on too (#975): an agent recording the screen found it locked
$("#keepAwakeSegs").replaceChildren(segs([["off", t("Off")], ["on", t("On")], ["display", t("Screen on too")]],
diff --git a/internal/gui/tests/README.md b/internal/gui/tests/README.md
index 1af82f750..077548ee7 100644
--- a/internal/gui/tests/README.md
+++ b/internal/gui/tests/README.md
@@ -2158,8 +2158,8 @@ WebKit, in English and Chinese:
node --test internal/gui/tests/plugin-progressive.test.cjs
`lightweight.test.cjs` checks Settings → General's Lightweight mode row
-(#580): on for a user who never chose, Off and On saved as `lightweight`
-false and true without the page moving, another setting's save keeping the
+(#580): off for a user who never chose, On and Off saved as `lightweight`
+true and false without the page moving, another setting's save keeping the
choice or leaving it unchosen (no `lightweight` posted), no left-border
accent, and no such row on a browser's page (`web`). English and Chinese,
Chromium and WebKit, with `/api/settings` faked:
diff --git a/internal/gui/tests/lightweight.test.cjs b/internal/gui/tests/lightweight.test.cjs
index 41b68f0ee..6f3a4b3d3 100644
--- a/internal/gui/tests/lightweight.test.cjs
+++ b/internal/gui/tests/lightweight.test.cjs
@@ -1,7 +1,7 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
// somls on #580: GUI版可否增加轻量模式,关闭面板退出webview,减少资源占用.
-// Settings → General has a Lightweight mode row, on for a user who never
-// chose: Off and On are saved as lightweight false and true, the click
+// Settings → General has a Lightweight mode row, off for a user who never
+// chose (the owner, 10-21: "太卡" on by default): On and Off are saved as lightweight false and true, the click
// moving nothing; the page saved again elsewhere keeps the choice, or
// leaves it unchosen; a browser's page (web) has no window
// to let go and shows no such row. In English and Chinese, with the API faked.
@@ -72,7 +72,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await row.locator(".name").innerText(), w.name);
assert.equal(await row.locator(".sub").innerText(), w.sub);
const opt = (name) => row.locator("#lightweightSegs .opt", { hasText: name });
- assert.equal(await row.locator("#lightweightSegs .opt.on").innerText(), w.on, "on for a user who never chose");
+ assert.equal(await row.locator("#lightweightSegs .opt.on").innerText(), w.off, "off for a user who never chose");
const where = () => page.evaluate(() => [scrollX, scrollY, document.scrollingElement.scrollTop, ...[...document.querySelectorAll("*")].filter((e) => e.scrollTop).map((e) => e.scrollTop)]);
const before = await where();
const click = async (loc) => {
@@ -88,19 +88,19 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await click(page.locator("#dockSegs .opt").first()).catch(() => {});
for (let i = 0; i < 20 && posted.length === n; i++) await page.waitForTimeout(50);
if (posted.length > n) assert.equal("lightweight" in posted.at(-1), false, `another setting's save chose it: ${JSON.stringify(posted.at(-1))}`);
- await click(opt(w.off));
- for (let i = 0; i < 50 && posted.at(-1)?.lightweight !== false; i++) await page.waitForTimeout(50);
- assert.equal(posted.at(-1)?.lightweight, false, `posted ${JSON.stringify(posted)}`);
- assert.equal(st.lightweight, false);
- assert.equal(await row.locator("#lightweightSegs .opt.on").innerText(), w.off);
- // another setting saved keeps it off
+ await click(opt(w.on));
+ for (let i = 0; i < 50 && posted.at(-1)?.lightweight !== true; i++) await page.waitForTimeout(50);
+ assert.equal(posted.at(-1)?.lightweight, true, `posted ${JSON.stringify(posted)}`);
+ assert.equal(st.lightweight, true);
+ assert.equal(await row.locator("#lightweightSegs .opt.on").innerText(), w.on);
+ // another setting saved keeps it on
n = posted.length;
await click(page.locator("#dockSegs .opt").last()).catch(() => {});
for (let i = 0; i < 20 && posted.length === n; i++) await page.waitForTimeout(50);
- if (posted.length > n) assert.equal(posted.at(-1).lightweight, false, "another setting's save turned it on");
- await click(opt(w.on));
- for (let i = 0; i < 50 && posted.at(-1)?.lightweight !== true; i++) await page.waitForTimeout(50);
- assert.equal(posted.at(-1).lightweight, true);
+ if (posted.length > n) assert.equal(posted.at(-1).lightweight, true, "another setting's save turned it off");
+ await click(opt(w.off));
+ for (let i = 0; i < 50 && posted.at(-1)?.lightweight !== false; i++) await page.waitForTimeout(50);
+ assert.equal(posted.at(-1).lightweight, false);
assert.deepEqual(await where(), before, "the clicks moved the page");
// the row has no coloured stripe down its left
const left = await row.evaluate((e) => getComputedStyle(e).borderLeftWidth);
diff --git a/internal/gui/tests/segs-glide.test.cjs b/internal/gui/tests/segs-glide.test.cjs
index dee899467..0426077cc 100644
--- a/internal/gui/tests/segs-glide.test.cjs
+++ b/internal/gui/tests/segs-glide.test.cjs
@@ -132,8 +132,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const errors = [];
// WebKit's notice of a ResizeObserver loop is no error of the page's
page.on("pageerror", (e) => { if (!/ResizeObserver loop/.test(e.message)) errors.push(e.message); });
- // turned off by the user, so On is a glide away (it is on for one
- // who never chose)
+ // turned off by the user, so On is a glide away
const st = { lightweight: false }, ctl = { hold: 0, refuse: false };
await page.route("**/*", serve(lang, st, ctl));
// opened on another tab: General is drawn while hidden
diff --git a/internal/settings/lightweight_test.go b/internal/settings/lightweight_test.go
index f84469de0..8a39e4d5f 100644
--- a/internal/settings/lightweight_test.go
+++ b/internal/settings/lightweight_test.go
@@ -2,16 +2,24 @@ package settings
import "testing"
-// Lightweight mode (#580) is on for a user who never chose, and kept off
-// for one who turned it off; it is saved and read back, and is this
-// computer's own: a sync or a restored backup keeps it as it is here.
+// Lightweight mode (#580) is off for a user who never chose (the owner,
+// 10-21: too slow to have by default), on for one who turned it on, and
+// kept off for one who turned it off; it is saved and read back, and is
+// this computer's own: a sync or a restored backup keeps it as it is here.
func TestLightweightKeptAndOwn(t *testing.T) {
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
- if !Load().LightweightOn() {
- t.Fatal("off for a user who never chose")
+ if Load().LightweightOn() {
+ t.Fatal("on for a user who never chose")
}
off, on := false, true
s := Load()
+ s.Lightweight = &on
+ if err := Save(s); err != nil {
+ t.Fatal(err)
+ }
+ if !Load().LightweightOn() {
+ t.Fatal("turned on, but read back off")
+ }
s.Lightweight = &off
if err := Save(s); err != nil {
t.Fatal(err)
diff --git a/internal/settings/settings.go b/internal/settings/settings.go
index 75fe1796e..9fd09e1b8 100644
--- a/internal/settings/settings.go
+++ b/internal/settings/settings.go
@@ -371,8 +371,9 @@ type Settings struct {
// Lightweight lets the webview of a window closed — the tray panel or
// the main window — go once it has stayed closed a while, and makes it
// again when it is opened (#580): less memory, a moment's wait. This
- // computer's own (KeepOwn). Nil is on: a user who never chose has it,
- // one who turned it off keeps it off (LightweightOn).
+ // computer's own (KeepOwn). Nil is off: a window made again on each
+ // opening was too slow to have by default (the owner, 10-21: "太卡");
+ // one who turned it on keeps it on (LightweightOn).
Lightweight *bool `json:"lightweight,omitempty"`
// KeepAwake keeps this computer from going to sleep by itself while
// agents work through the gateway and for a while after (xiao_wang24004
@@ -968,11 +969,12 @@ func CarryPerModel(in, cur *Settings) {
// models that can take more.
const WorkingWindow = 272000
-// LightweightOn says whether lightweight mode is on: unless the user
-// turned it off. A hidden webview kept for good holds what its page drew
-// while hidden, which grew ~20 MB a minute on Windows under steady
-// requests (#2515).
-func (s Settings) LightweightOn() bool { return s.Lightweight == nil || *s.Lightweight }
+// LightweightOn says whether lightweight mode is on: only when the user
+// turned it on. It was on for a user who never chose, since a hidden
+// webview kept for good holds what its page drew while hidden (~20 MB a
+// minute on Windows under steady requests, #2515), but each opening then
+// waited for the page to load again.
+func (s Settings) LightweightOn() bool { return s.Lightweight != nil && *s.Lightweight }
// Working is the context window an agent is told for a model with one of
// n tokens (see FullContext).