Skip to content

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

gui: Long conversations stays in Settings when no Codex or Claude Code is here to hold it (Linka)

yetone9691997bb0aa
diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md
index 4906162e4..7a0e38b49 100644
--- a/docs/subsystems/gui-shell.md
+++ b/docs/subsystems/gui-shell.md
@@ -350,7 +350,7 @@ covers it in both engines, every language and a narrow window.
### Shared UI rules
-- Settings → General is laid out as macOS System Settings is (1ooogle on X): a row says its name alone when that says enough (Appearance, Colorblind mode, Language, Text size, the fonts, the tray click, Open at login, Show in Dock), and keeps one short line where the setting isn't clear from its name or has a consequence (Lightweight mode, Prevent sleep, Session terminal). Codex's and Claude Code's own settings (Codex subagents, Long conversations, background compaction, thread titles and descriptions, composer predictions, the auto-review and memories models) aren't here: they are in the agent's opened row on the Agents page (`AGENT_PREFS`, `connectPanel`), the panel's row has a Settings line that opens them in a sheet (`openAgentPrefs`), as does the agent's menu, and Settings' search finds them with a row that opens that sheet (`#agentPrefLinks`). Each row is one element moved between its places, so its handlers and state go with it (the owner, 10-20; `agent-prefs.test.cjs`). A font row's line shows only while its fonts load or fail; the text size keys are the choices' tooltip, and Colorblind mode's note is its Off/On control's (`#colorblindSegs`). Colorblind mode (`settings.Colorblind`, `data-colorblind="1"` on `:root`, #2073) switches the chart series (`--c1`…`--c7`) in both light and dark themes to an Okabe–Ito palette where adjacent series differ in hue and lightness. On a quota curve each window (`data-series`, its index mod 7, set by `drawQuotaPlot` and `quotaCurve`'s legend only) gets a dash of its own on `path.qc-line`, its legend key shows a sample of that line (`.qc-sample`) for the dot, and the even paces (`line.qc-even`) are dotted; the curve's tooltip says so. The balance curve sets no `data-series` and keeps its solid line, dashed fit and dot. The Context tab's "good" grade, which takes `--c2` as a colour rather than a series, keeps a blue (`--c1`). Language is one menu button showing the language picked, opened in the app's menu (`renderLangPick`). See `settings-general.test.cjs` and `quota-curve.test.cjs`. Open at login reads `autostart.Enabled`, which on macOS 13 and later also asks Background Task Management about magpie's launch agent (`SMAppService.statusForLegacyURL:`, matched by the plist's Label, not its path); a record the user switched off in System Settings › General › Login Items reads as needing allowing, and the row keeps On with one line saying so and a button that opens Login Items (`/api/open` allows that one `x-apple.systempreferences` URL). The status read again when the window comes back to the front clears the line. On macOS 12, in a build without cgo, or when the system can't be asked, the plist alone decides, as before (#2120, `login-allow.test.cjs`, `login_allow_test.go`).
+- Settings → General is laid out as macOS System Settings is (1ooogle on X): a row says its name alone when that says enough (Appearance, Colorblind mode, Language, Text size, the fonts, the tray click, Open at login, Show in Dock), and keeps one short line where the setting isn't clear from its name or has a consequence (Lightweight mode, Prevent sleep, Session terminal). Codex's and Claude Code's own settings (Codex subagents, Long conversations, background compaction, thread titles and descriptions, composer predictions, the auto-review and memories models) aren't here: they are in the agent's opened row on the Agents page (`AGENT_PREFS`, `connectPanel`), the panel's row has a Settings line that opens them in a sheet (`openAgentPrefs`), as does the agent's menu, and Settings' search finds them with a row that opens that sheet (`#agentPrefLinks`). Each row is one element moved between its places, so its handlers and state go with it (the owner, 10-20; `agent-prefs.test.cjs`). Long conversations is the exception with no Codex or Claude Code here, in gateway mode or a magpie in Docker: it sets the windows the gateway serves, which agents on other computers read, so it stays in General (`renderAgentPrefLinks`, Linka on Discord). A font row's line shows only while its fonts load or fail; the text size keys are the choices' tooltip, and Colorblind mode's note is its Off/On control's (`#colorblindSegs`). Colorblind mode (`settings.Colorblind`, `data-colorblind="1"` on `:root`, #2073) switches the chart series (`--c1`…`--c7`) in both light and dark themes to an Okabe–Ito palette where adjacent series differ in hue and lightness. On a quota curve each window (`data-series`, its index mod 7, set by `drawQuotaPlot` and `quotaCurve`'s legend only) gets a dash of its own on `path.qc-line`, its legend key shows a sample of that line (`.qc-sample`) for the dot, and the even paces (`line.qc-even`) are dotted; the curve's tooltip says so. The balance curve sets no `data-series` and keeps its solid line, dashed fit and dot. The Context tab's "good" grade, which takes `--c2` as a colour rather than a series, keeps a blue (`--c1`). Language is one menu button showing the language picked, opened in the app's menu (`renderLangPick`). See `settings-general.test.cjs` and `quota-curve.test.cjs`. Open at login reads `autostart.Enabled`, which on macOS 13 and later also asks Background Task Management about magpie's launch agent (`SMAppService.statusForLegacyURL:`, matched by the plist's Label, not its path); a record the user switched off in System Settings › General › Login Items reads as needing allowing, and the row keeps On with one line saying so and a button that opens Login Items (`/api/open` allows that one `x-apple.systempreferences` URL). The status read again when the window comes back to the front clears the line. On macOS 12, in a build without cgo, or when the system can't be asked, the plist alone decides, as before (#2120, `login-allow.test.cjs`, `login_allow_test.go`).
- Settings' search-provider picker offers **Off**, saved as `searcher: "off"`. Its help explains API-only search and suppresses provider fallback/own-search hints while off; the search priority row is hidden because no provider competes with the APIs. See [gateway search behavior](gateway-routing.md#turning-provider-search-off), [`renderSearcher`](../../internal/gui/assets/app.js), `TestSettingsSearchProviderOff` and `searcher-pick.test.cjs`.
- Settings' search APIs are asked in their listed order: each API's row (with its keys' row) is dragged as one, or moved with Alt+↑/↓, and has a switch that turns it off without removing its key (#2286). See [the search APIs' order](gateway-routing.md#the-search-apis-order-and-one-switched-off), `searchArrange` in [`app.js`](../../internal/gui/assets/app.js) and `search-order.test.cjs`.
- Settings' Search APIs add row has a base URL field under the key for every API (#1580): the vendor's own address is its placeholder, picking an API already added fills in its saved URL so a new key alone keeps it, and Add with no key changes only the URL. See [a search API's base URL](gateway-routing.md#a-search-apis-base-url), [`renderSearch`](../../internal/gui/assets/app.js) and `search-api.test.cjs`.
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index 1ee4156e7..2ff9dacb7 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -20885,6 +20885,12 @@ function renderAgentPrefLinks() {
const box = $("#agentPrefLinks");
box.replaceChildren();
homeAgentPrefRows();
+ // Long conversations sets the windows the gateway serves, which an agent
+ // on another computer reads too: with no Codex or Claude Code here to
+ // hold it (a gateway, magpie in Docker) it stays in Settings (Linka)
+ const loose = $("#fullContextRow");
+ if (!state.agents.some((a) => agentPrefsOf(a)?.includes(loose.id))) box.before(loose);
+ else if (loose.parentElement === box.parentElement) $("#agentPrefRows").append(loose);
for (const r of agentPrefRowEls) {
const agents = state.agents.filter((a) => agentPrefsOf(a)?.includes(r.id) && !a.id.includes("@wsl:"));
if (!agents.length || (r.id === "codexMemoriesRow" && r.hidden)) continue;
diff --git a/internal/gui/tests/agent-prefs.test.cjs b/internal/gui/tests/agent-prefs.test.cjs
index 9fcaa2389..1b4243ee8 100644
--- a/internal/gui/tests/agent-prefs.test.cjs
+++ b/internal/gui/tests/agent-prefs.test.cjs
@@ -6,7 +6,10 @@
// search still finds them, as a row saying where they are whose Open shows
// the agent's sheet. In the panel a "Settings" line opens the sheet, and so
// does the agent's menu; shut, the rows are back where they were. Gateway
-// mode writes no agent's files, so none of it shows. Five languages, wide
+// mode writes no agent's files, so none of it shows, but Long conversations:
+// it sets the windows the gateway serves, which agents elsewhere read, so
+// with no Codex or Claude Code here (a gateway, magpie in Docker) it stays
+// in Settings › General, on the size set before (Linka on Discord). Five languages, wide
// and narrow, Chromium and WebKit; no backend, the API is faked here.
const assert = require("node:assert/strict");
const fs = require("node:fs/promises");
@@ -32,8 +35,8 @@ function settingsPayload(over) {
};
}
-function server(lang, { gateway = false } = {}) {
- const settings = settingsPayload({ lang, ...(gateway ? { web: true, gatewayMode: "", gatewayOn: true } : {}) });
+function server(lang, { gateway = false, none = false, posts = [] } = {}) {
+ let settings = settingsPayload({ lang, compactAt: 200000, ...(gateway ? { web: true, gatewayMode: "", gatewayOn: true } : {}) });
// Codex with a memories field, so its memories row is there to show
const codex = agentRow("codex", "Codex");
codex.fields.push({ key: "memories", label: "memories", value: "", options: [{ value: "relay/m1", label: "m1", ref: "relay/m1" }] });
@@ -42,7 +45,13 @@ function server(lang, { gateway = false } = {}) {
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:${gateway}${gateway ? ",gateway: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: [codex, agentRow("claude", "Claude Code"), agentRow("pi", "Pi")], profiles: [], settings: { lang, theme: "light" }, fx: settings.fx });
+ if (url.pathname === "/api/state") return json({ agents: none ? [agentRow("pi", "Pi")] : [codex, agentRow("claude", "Claude Code"), agentRow("pi", "Pi")], profiles: [], settings: { lang, theme: "light" }, fx: settings.fx });
+ if (url.pathname === "/api/settings/full-context") {
+ const body = route.request().postDataJSON();
+ posts.push(body);
+ settings = { ...settings, fullContext: body.on, ...(body.at !== undefined ? { compactAt: body.at } : {}) };
+ return json(settings);
+ }
if (url.pathname === "/api/settings") return json(settings);
if (url.pathname === "/api/plugins") return json({ plugins: [] });
if (url.pathname === "/api/usage/quotas") return json([]);
@@ -161,4 +170,27 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await page.locator(".agent-pref-link").count(), 0, "no link rows");
assert.deepEqual(errors, []);
});
+
+ // Long conversations with nothing here to hold it: in Settings › General,
+ // showing the size set before, and a new size is saved from there
+ for (const [what, opts] of [["gateway mode", { gateway: true }], ["no Codex or Claude Code", { none: true }]]) {
+ test(`${engine}: ${what} keeps Long conversations in Settings`, async (t) => {
+ const posts = [];
+ const { page, errors } = await newPage(engine, t, 1100, "en", { ...opts, posts });
+ await page.goto("http://magpie.test/?view=settings&tab=general");
+ const row = page.locator("#setPage-general #fullContextRow");
+ await row.waitFor();
+ for (const id of CODEX.filter((id) => id !== "fullContextRow")) assert.equal(await page.locator(`#view-settings #${id}`).count(), 0, `${id} not in Settings`);
+ const segs = row.locator("#fullContextSegs");
+ assert.match(await segs.locator(".opt.on").textContent(), /200K/i, "the size set before");
+ const num = segs.locator("input.compact-num");
+ assert.match(await num.inputValue(), /200k/i);
+ await num.fill("150k");
+ await num.press("Enter");
+ await num.blur();
+ await page.waitForFunction(() => document.querySelector("#fullContextSegs .opt.on")?.textContent.includes("150"));
+ assert.deepEqual(posts.at(-1), { on: false, at: 150000 });
+ assert.deepEqual(errors, []);
+ });
+ }
}
diff --git a/internal/gui/tests/settings-general.test.cjs b/internal/gui/tests/settings-general.test.cjs
index cc7e8cdc5..e2d85e00d 100644
--- a/internal/gui/tests/settings-general.test.cjs
+++ b/internal/gui/tests/settings-general.test.cjs
@@ -86,7 +86,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
};
}, [bare, kept]);
for (const [sel, subs] of rows.bare) assert.deepEqual(subs, [], `${sel}'s row says its name alone`);
- assert.equal(await page.locator("#view-settings :is(#codexAgentsV1Row, #fullContextRow, #codexAsyncRow, #codexTitlesRow, #codexDescriptionsRow, #codexPredictionsRow, #codexAutoReviewRow, #codexMemoriesRow)").count(), 0, "an agent's own settings are on its row");
+ // Long conversations stays here with no Codex or Claude Code, as in
+ // this fixture (agent-prefs.test.cjs)
+ assert.equal(await page.locator("#view-settings :is(#codexAgentsV1Row, #codexAsyncRow, #codexTitlesRow, #codexDescriptionsRow, #codexPredictionsRow, #codexAutoReviewRow, #codexMemoriesRow)").count(), 0, "an agent's own settings are on its row");
for (const [sel, sub] of rows.kept) {
assert.equal(typeof sub, "object", `${sel}: ${sub}`);
assert.ok(sub.text.trim() && sub.lines <= 1, `${sel}: ${JSON.stringify(sub)}`);