Skip to content

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

gui: Codex's and Claude Code's own settings are in the agent's row on the Agents page, not in Settings

yetonef1e4516da238
diff --git a/docs/reference.md b/docs/reference.md
index 67a32afc2..13f87b436 100644
--- a/docs/reference.md
+++ b/docs/reference.md
@@ -2316,9 +2316,10 @@ expose it publicly without gateway-key authentication.
Such a page is in **gateway mode**: it shows Providers, Gateway, Routing,
Usage, Plugins and Settings, with no Agents, Sessions or Library tab, and
Settings leaves out what is written into this machine's agents (provider in
-model names, Codex subagents, long conversations, Codex thread titles,
-Codex thread descriptions, Codex composer predictions) and
-the desktop's alerts and tray. `magpie web` is in it by itself when it finds
+model names) and the desktop's alerts and tray. Codex's and Claude Code's own
+settings (Codex subagents, long conversations, Codex thread titles and the
+rest) are on the Agents page, in the agent's opened row, so a gateway has
+none of them. `magpie web` is in it by itself when it finds
no agents on its machine, as in the container, and with
`magpie web --gateway`. *Settings › General › Gateway mode* picks Automatic,
On or Off for this machine (it wins over both); Off brings every page back.
diff --git a/docs/subsystems/agent-wiring.md b/docs/subsystems/agent-wiring.md
index 53ce23217..9b263d41b 100644
--- a/docs/subsystems/agent-wiring.md
+++ b/docs/subsystems/agent-wiring.md
@@ -20,7 +20,7 @@ something else shows up as drift.
| What came before | The stash (`stash.json`) remembers what the config said before magpie pointed it at the gateway, so Disconnect restores it rather than guessing. | [`stash.go`](../../internal/agent/stash.go) |
| Disconnect and preview | `Disconnect` runs `Unwire`, then returns each field still on magpie to its default. Last it runs `Restore`: Pi and its kin (`piLike`: Pi, OmO, Prime Agent; and MothX, its one `settings.json`) copy `settings.json` and `models.json` aside (`*.before-magpie`, `beforeMagpie`) before magpie's first write, and put that copy back byte for byte where what Disconnect left is the same JSON; a file that wasn't there goes again when only empty objects are left in it. `DisconnectPreview` runs the real Disconnect on a copy under a temporary home, in a subprocess (`DryRunArg`), and diffs the files. The preview is never a second account of what Disconnect does. | [`applied.go`](../../internal/agent/applied.go), [`preview.go`](../../internal/agent/preview.go) |
| Keeping configs current | `Reseat` moves agents off a model magpie no longer serves (#200). `OnGateway` and `Rewire` write the new gateway address into every connected agent when the port changes. `Source` and `Stale` say what an unconnected agent runs on, and whether running copies still use the old list. | [`reseat.go`](../../internal/agent/reseat.go), [`rewire.go`](../../internal/agent/rewire.go), [`connectinfo.go`](../../internal/agent/connectinfo.go) |
-| Codex background compaction | Settings › Long conversations' Codex background compaction (`CodexAsyncCompact`, `CodexAsyncCompactPercent`, #2490) writes `[features.async_compaction]` `enabled = true` and `model_async_compact_threshold_percent` (Codex 0.163 reads it only in that table) into each Codex config magpie routes, on every `Sync`. Codex starts a background compaction only on a provider whose `capabilities.remote_compaction` is `"v2"`, which it gives OpenAI and Azure alone, so `[model_providers.magpie]` gets `capabilities = { remote_compaction = "v2" }` too, also when the user turned the feature on by hand (#2493); `putProvider` carries the table's capabilities over when it writes it again. What magpie wrote is in the stash under `codex.async`: a value the user set, or changed since, is never written over and stays when the switch goes off; a bare `async_compaction = true`, an inline or dotted table is the user's as written. | [`codex_async.go`](../../internal/agent/codex_async.go) |
+| Codex background compaction | Long conversations' Codex background compaction, in Codex's opened row on the Agents page (`CodexAsyncCompact`, `CodexAsyncCompactPercent`, #2490) writes `[features.async_compaction]` `enabled = true` and `model_async_compact_threshold_percent` (Codex 0.163 reads it only in that table) into each Codex config magpie routes, on every `Sync`. Codex starts a background compaction only on a provider whose `capabilities.remote_compaction` is `"v2"`, which it gives OpenAI and Azure alone, so `[model_providers.magpie]` gets `capabilities = { remote_compaction = "v2" }` too, also when the user turned the feature on by hand (#2493); `putProvider` carries the table's capabilities over when it writes it again. What magpie wrote is in the stash under `codex.async`: a value the user set, or changed since, is never written over and stays when the switch goes off; a bare `async_compaction = true`, an inline or dotted table is the user's as written. | [`codex_async.go`](../../internal/agent/codex_async.go) |
| Named omp profiles | omp keeps a profile's settings under `~/.omp/profiles/<name>` (or under `PI_CONFIG_DIR`), each with its own `config.yml` and `models.yml`. Every such profile is an agent of its own — `omp#<name>` on Windows, `omp#<name>@wsl:<distro>` in a distro — so each can be connected, drifted and disconnected on its own. They share omp's model lists (`ListsFor`), and the default `omp` row is the folder `ompDir`/`ompIn` already pick, so an `OMP_PROFILE` that row is already pointed at is not listed twice. A name omp refuses is not a row: `default`, a trailing dot, or a Windows reserved device name (`aux`, `nul`, `com1`, `lpt9.x`, `con.work`), on every platform (`ompProfileOK`). A distro's profile names come from its probe and are kept in `wsl.json`; a stopped distro is never started to list them, its profile rows showing what was last seen (`asleep`). | [`omp.go`](../../internal/agent/omp.go), [`wsl.go`](../../internal/agent/wsl.go) |
| WSL twins | On Windows each running distro is probed once, without starting a stopped one. The `wslKinds` agents found there become agents of their own, `<id>@wsl:<distro>`, edited through `\\wsl.localhost\<distro>`. A kind is found by its folder under the distro's home or by its command there (not one on a Windows drive). Where another tool shares one of them, the kind leaves it out: Gemini CLI is found by its command alone, because Antigravity keeps `~/.gemini` too. Goose is found by its folder alone, because a `goose` command can be pressly's migration tool. Reasonix also needs the version its command gives (`accept`), because the old npm client is named `reasonix` too. The gateway address and key follow the distro's networking: mirrored or NAT (`place`, `keyAt`). `ListsFor` keeps a twin's model picks under the Windows twin's id (#927). | [`wsl.go`](../../internal/agent/wsl.go), [`gatewaykey.go`](../../internal/agent/gatewaykey.go) |
| Settings tuned from use | Usage › Context's "Tuned for you" advises, per agent, the settings that would have spent the fewest tokens on the user's own calls of the range, and puts one in on a click. Package `tune` replays the calls `sessions.Calls` reads from the agents' session files under each candidate value (`Compact`, `CacheTTL`); `tuneOf` picks the agents and models (Claude Code per model, Codex pooled). `TuneRead`, `TuneApply` and `TuneUndo` know where each setting lives: Claude Code's `modelSettings.<model>.autoCompactWindow` (where its `/autocompact` saves), `promptCacheTtl` and `subagentPromptCacheTtl` in `~/.claude/settings.json`; Codex's top-level `model_auto_compact_token_limit`. The advice is weighed by tokens alone: it is labelled "Fewest tokens", and a compaction window it would change says it doesn't measure how well the agent keeps the task after a compaction, and that a lower window compacts more often (#1854, `context-tune.test.cjs`). A compaction row's "Other window…" opens the app menu with every value of the curve, each with its estimated extra tokens over the fewest and about how many compactions it would have made (`Point.compacts`, from the same replay), and puts the one picked in like Use (#1860). An agent whose files time its compactions also has their wait weighed (HirotaNagai on X): Claude Code's `compact_boundary` line says `compactMetadata.durationMs`, which `sessions` puts on the first call after it, and Codex compacts by a call of its own (the record a `compacted` line names, in rollouts since 2026-09), whose time is the compaction's (`Call.Compact`; an older rollout's compaction has no call and stays untimed). With 3 or more timed for a model (`minTimed`), `Facts.took` is their median seconds, each window says its wait (`Point.wait`, its compactions × `took`), and the row says what a compaction took, the wait at the advice against the window now, and the cheaper window the advice passed over for waiting longer (`Compaction.cheapest`, `wait_cheapest`) when it saves 3% or more; the advice is labelled "Tokens + wait", its caveat says tokens and waiting only, and the picker says each window's wait with "Fewest tokens" on the cheapest (`context-tune.test.cjs`). An agent or model with fewer timed reads and is advised as before. | [`internal/tune`](../../internal/tune/tune.go), [`tune.go`](../../internal/agent/tune.go), [`internal/gui/tune.go`](../../internal/gui/tune.go) |
@@ -106,7 +106,7 @@ something else shows up as drift.
- Codex signed in to ChatGPT and not connected still gets `openai_base_url` while more of its ChatGPT accounts are on in magpie (`failover`, stash `codex.failover`; with a CC Switch mirror as its provider, the mirror's `base_url` and `codex.mirror_failover`), so a turn its own account has no allowance for goes on to the next — never for a Codex that reaches the gateway from another machine, where that path takes a named key alone and the failed-over turn came back a 401 (#2145, `TestCodexFailoverBeyondLoopbackNotWritten`); Sync takes one it wrote before off again. That Codex is `FailingOver`: not `Wired`, yet its requests go through magpie. The Agents row says so and what turns it off (`FailoverSaid` in the CLI and TUI, `failover` in `/api/state`, a button to Providers › Codex in the GUI), and the gateway hands it only its own models from `/backend-api/codex/models` (`CodexOwnOnly`, set on `gateway.CodexOwnOnly` by main; its ETag carries `provider.CodexOwnListTag`, and Sync ages a `models_cache.json` without it). A connected WSL Codex shares the gateway path, so while one is connected every Codex gets magpie's models (#1385). A base URL the user wrote by hand (#856) isn't failover's and stays a plain not-connected row. A Codex the user disconnected gets no failover till they connect it again. The app serving the gateway takes failover out as it quits (`EndFailover`, `EndCodexFailover` in `OnShutdown`), so a Codex left on its own goes straight to OpenAI rather than retrying a gateway that's gone (Leon920717 on X); the next start's Sync writes it again. Codex's app-server read the old base URL as it started and keeps it, and `KeepCodexDaemonCurrent` ends with magpie, so `EndCodexFailover` restarts it there when no codex session is on it (`codexDaemonCheck`); with one on it, it stays on the gone gateway until the user restarts it (thisisvainxx on X: "several restarts"). A connected Codex keeps magpie as it quits: its model is one of magpie's, and Disconnect is what puts its own config back. A magpie that ends without quitting (killed, a crash, `magpie serve`) leaves failover in place.
- A Codex thread keeps the provider it was started on. While a magpie model is on, CC Switch's provider tables go through magpie too (`takeTables`), and get their own base URL back when Codex steps off magpie (`giveTables`, stash `codex.tables`). CC Switch's OpenAI mirror (a table of another id, `name = "OpenAI"`, `requires_openai_auth`, no `base_url`) isn't reached by `openai_base_url`, which takes only the built-in provider to magpie: a thread started on it and reopened went straight to ChatGPT, which refused the magpie model picked in it, and magpie never saw the request (#1796). While Codex goes to magpie by the base URL, `takeMirrors` gives each such mirror magpie's ChatGPT backend as its `base_url` (stash `codex.mirrors`), and `giveMirrors` takes it off again; a mirror a profile names, or one whose `base_url` was changed since, stays as it is. Moving the threads onto another provider is the Sessions page's Move (#887).
- An agent's config is written in the form the installed version reads, taken from what that version declares, not the latest one. VSCodium has no Copilot Chat of its own, and the Marketplace's last one (0.48.1) has no Custom Endpoint provider, only OpenAI Compatible (`customoai`, #1014). magpie reads the provider list in the package.json of the `github.copilot-chat` installed under `~/.vscode-oss/extensions` (`vscodeChatOf`). It writes its group for `customendpoint` when that is declared, for `customoai` when only that is, with each model's window as `maxInputTokens` + `maxOutputTokens` and the token as `x-api-key` (that version drops an Authorization in `requestHeaders`). A missing or unreadable extension keeps `customendpoint`. Sync rewrites a group written for the other provider, and Check reports it, as it does a Copilot Chat declaring neither. That Copilot Chat registers its providers only while signed in to GitHub with a personal Copilot plan, which the Notice says.
-- Tuned settings are written only on the user's click, never by Sync or Connect. The value there before is stashed once (`tune.<agent>.<knob>[.<model>]` in `stash.json`), so Undo puts it back, or takes the key out (and a `modelSettings` entry left empty). A value the user changed after the click is theirs: Undo then only forgets the stash. A variable that comes before the setting (`CLAUDE_CODE_AUTO_COMPACT_WINDOW`, `FORCE_PROMPT_CACHING_5M`, `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, in settings.json's `env` or magpie's own) is shown as `locked` and Apply refuses, since the setting would change nothing. Claude Code compacts at the smaller of the window set and the model's own (its `/autocompact` says "capped to 200k by model"), so advice starts from that, and a model that isn't Claude's has no window here (magpie's own compact wiring serves it). Codex's window is the one magpie's catalog lists for each model it ran (typed, or the vendor's), and with none in config.toml it runs now at what magpie tells Codex (`provider.CompactFor`, else Settings › Long conversations, as `codexcat` writes it); a model of magpie's whose window isn't known caps nothing short of 1M (or the user's own larger value), never the largest prompt seen (zhemu on Discord: a 1M model at 750K was offered up to 410K), and only Codex's own models, outside the catalog, keep 272K or the largest prompt (`codexWindow`, `TestTuneWindowsAreTheUsers`). Advice changes a value only when the replay saves 3% or more, and of the windows within 1% of the cheapest takes the largest; with the compactions timed, it never advises a window that compacts more often than the one now, so never a longer wait: of the windows that compact no more often it takes the cheapest, and of those within 3% of that (`sameCost`, the same bar as changing at all) the one that compacts least, the larger of two that compact as often. Tokens and seconds share no unit the files measure, so the advice doesn't trade one for the other at a guessed rate; a cheaper window that waits longer is said with its wait in the row and the picker, for the user to choose. The wait per compaction is taken as the same at every window: the files time compactions only near the window the user ran with, too narrow to fit how it grows with the prompt. Tokens are weighed as billed: cache reads 0.1, 5-minute writes 1.25, hour writes 2, output 5 for Claude; reads 0.1, writes 1, output 8 otherwise.
+- Tuned settings are written only on the user's click, never by Sync or Connect. The value there before is stashed once (`tune.<agent>.<knob>[.<model>]` in `stash.json`), so Undo puts it back, or takes the key out (and a `modelSettings` entry left empty). A value the user changed after the click is theirs: Undo then only forgets the stash. A variable that comes before the setting (`CLAUDE_CODE_AUTO_COMPACT_WINDOW`, `FORCE_PROMPT_CACHING_5M`, `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, in settings.json's `env` or magpie's own) is shown as `locked` and Apply refuses, since the setting would change nothing. Claude Code compacts at the smaller of the window set and the model's own (its `/autocompact` says "capped to 200k by model"), so advice starts from that, and a model that isn't Claude's has no window here (magpie's own compact wiring serves it). Codex's window is the one magpie's catalog lists for each model it ran (typed, or the vendor's), and with none in config.toml it runs now at what magpie tells Codex (`provider.CompactFor`, else Long conversations in the agent's opened row, as `codexcat` writes it); a model of magpie's whose window isn't known caps nothing short of 1M (or the user's own larger value), never the largest prompt seen (zhemu on Discord: a 1M model at 750K was offered up to 410K), and only Codex's own models, outside the catalog, keep 272K or the largest prompt (`codexWindow`, `TestTuneWindowsAreTheUsers`). Advice changes a value only when the replay saves 3% or more, and of the windows within 1% of the cheapest takes the largest; with the compactions timed, it never advises a window that compacts more often than the one now, so never a longer wait: of the windows that compact no more often it takes the cheapest, and of those within 3% of that (`sameCost`, the same bar as changing at all) the one that compacts least, the larger of two that compact as often. Tokens and seconds share no unit the files measure, so the advice doesn't trade one for the other at a guessed rate; a cheaper window that waits longer is said with its wait in the row and the picker, for the user to choose. The wait per compaction is taken as the same at every window: the files time compactions only near the window the user ran with, too narrow to fit how it grows with the prompt. Tokens are weighed as billed: cache reads 0.1, 5-minute writes 1.25, hour writes 2, output 5 for Claude; reads 0.1, writes 1, output 8 otherwise.
- A plugin's agent writes each key in place (JSON, YAML or env), the user's comments and other keys kept. An object or array `connect` returns is taken as its JSON text (`agentplug.keys`), so it is written in the order the plugin gave it, not sorted as a Go map would be: Kilo lists its effort variants in key order (#1890, `TestPluggedKeepsPluginOrder`). What each key held before the first write is stashed under `plugin:<id>:<path>`, typed, and its own model or Disconnect puts every key back and takes out the ones that weren't there; the file is never written whole. A `connect` that throws or takes over a second writes nothing and says why. Its gateway key is `magpie-<id>` (`agentKeyAt`), and usage names its requests by that key or by its `ua` words (`usage.PluginAgents`). Its `agent.library` (instructions, `mcp` with `mcpFormat`, skills) gives it the Library's three as well, written by `internal/library` as any agent's are ([library](library.md)); a `mcpFormat` outside `agentplug.MCPFormats`, or an `mcp` without one, keeps the plugin from loading.
- StepCode config root resolves to the parent of an absolute `STEP_CODING_AGENT_DIR` (agent resources directory differs from config root; relative values ignored), or `STEPCODE_CONFIG_DIR` under home when native, defaulting to `~/.stepcode` ([`stepcode.go`](../../internal/agent/stepcode.go)). Project configs override global configs in StepCode, but magpie manages global configuration only (`config.toml` and `models.json`). Detection is strictly directory-only via `agentDir`, avoiding collision with Smallstep's bare `step` command on `PATH`. Wiring performs an atomic two-file edit (`models.json` provider block and `config.toml` top-level defaults/scope) backed by `stash.json`. Custom fields within `providers.magpie` are preserved during sync, and the original provider block is restored on disconnect. A renamed provider's `magpie/<old>/` entries in `enabledModels` follow it, a glob or a thinking level included, and the scope remembered for disconnect follows too; the user's other entries stay. Disconnect restores original defaults, preserves user native changes and custom scope edits, and removes newly created files only when empty.
- MothX's folder is `$MOTHX_DIR` as it is (no `~`), else `%APPDATA%\mothx` on Windows, else `~/.mothx`; a WSL distro's is its `~/.mothx` ([`mothx.go`](../../internal/agent/mothx.go)). Its `thinkingFormat` is `openai` unless the user set one: with it empty, MothX picks Qwen's `enable_thinking`, DeepSeek's `thinking` or Doubao's levels by the model id, which for magpie's ids says nothing of the vendor that serves them. MothX's `/model` and `/statusline … global` rewrite the whole file, so Disconnect after one takes out magpie's provider, the pick and a `providers` left empty (MothX omits an empty one), and keeps the rest.
diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md
index 4c71707ec..4ab2efccf 100644
--- a/docs/subsystems/gui-shell.md
+++ b/docs/subsystems/gui-shell.md
@@ -349,7 +349,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, the Codex model rows, Open at login, Show in Dock), and keeps one short line where the setting isn't clear from its name or has a consequence (Long conversations, Lightweight mode, Prevent sleep, Session terminal, Codex subagents). 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`). 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.css b/internal/gui/assets/app.css
index d854cee9b..38872924e 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -4164,3 +4164,20 @@ input[type="checkbox"]:disabled { opacity: .45; }
.row.pref .sub.proxy-check { margin-top: 3px; white-space: normal; overflow-wrap: anywhere; }
.proxy-check[hidden] { display: none; }
.row.pref .sub.proxy-check.err { color: var(--red); }
+
+/* an agent's own settings (AGENT_PREFS): Settings' rows, in the agent's
+ opened row or its sheet (openAgentPrefs), one column, their lines
+ wrapped rather than cut */
+.modal .editor.agent-prefs > .ebody { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; }
+.agent-prefs .list.prefs { margin: 0; }
+:is(.ag-prefs, .agent-prefs) .row.pref .sub { white-space: normal; }
+/* the agent row's own .who rules reach the settings it holds */
+body .row.agent .ag-prefs .row.pref .who { display: block; }
+.ag-v > .ag-prefs { margin: 0; font-size: 13px; color: var(--fg); }
+/* narrow, the controls go under the words, not the words down to a letter
+ a line */
+:is(.ag-prefs, .agent-prefs) .row.pref { flex-wrap: wrap; row-gap: 8px; }
+:is(.ag-prefs, .agent-prefs) .row.pref .who { flex: 1 1 240px; min-width: 0; }
+:is(.ag-prefs, .agent-prefs) .compact-at { flex: 0 1 auto; min-width: 0; flex-wrap: wrap; row-gap: 6px; }
+/* Settings' search finds them; not searching, the links stay out */
+#view-settings:not(.set-searching) #agentPrefLinks { display: none; }
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index 00af998e6..ad0c025a4 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -387,7 +387,7 @@ function renderAgentsLoading() {
let agentArranging = false, agentRenderPending = false;
function renderAgents() {
- renderCodexMemories(); // Settings' row is the same field
+ renderCodexMemories(); // the Codex sheet's row is the same field
if (agentArranging) { agentRenderPending = true; return; }
if (unhideCleared()) return; // it renders again with the hiding dropped
const page = $("#view-agents");
@@ -467,6 +467,10 @@ function renderAgents() {
// command as its one control, in words
const launchOnly = !!a.launch && !a.fields.length && !a.import;
if (a.launch && !launchOnly) extras.append(launchButton(a));
+ // the panel's opened row has no room for the settings: a line of its
+ // own opens them in a sheet; the window's opened row holds them
+ // (connectPanel)
+ if (mode === "panel" && agentPrefsOf(a)) fields.append(agentPrefsButton(a));
if (extras.childNodes.length) fields.append(extras);
// an app that takes magpie by a link of its own (Cindy) has nothing to
// pick: its row opens the link, and the app asks to add magpie
@@ -1973,6 +1977,19 @@ function connectPanel(a, { fields, fieldBtn }) {
if (detail.detail) { const f = a.fields.find((x) => x.key === key); kv(t(f?.label || key), line(t(detail.detail))); }
}
if (CONNECT_COST[a.id]) kv(t("Once connected"), line(t(CONNECT_COST[a.id])));
+ // its own settings, the rows Settings had (agentPrefRows), here where
+ // the agent is; shown once they are read, so none opens on a default
+ const own = agentPrefsOf(a);
+ if (own) {
+ const list = el("div", "list prefs ag-prefs");
+ homeAgentPrefRows();
+ list.append(...own.map((id) => $("#" + id)));
+ kv(t("Settings"), list);
+ if (!prefs) {
+ list.hidden = true;
+ loadSettings().then(() => { list.hidden = false; }, (e) => status(e.message, "err"));
+ }
+ }
if (a.launch) {
const cp = el("button", "ag-quiet", t("Copy"));
cp.type = "button";
@@ -3564,6 +3581,8 @@ function openAgentMenu(anchor, a, inFold) {
: [
{ name: "Move up", icon: MOVE_UP, key: ALT + "↑", off: i <= 0, run: () => moveAgent(a.id, i - 1) },
{ name: "Move down", icon: MOVE_DOWN, key: ALT + "↓", off: i < 0 || i >= shown.length - 1, run: () => moveAgent(a.id, i + 1) },
+ // its own settings, as the square on its row opens them
+ ...(agentPrefsOf(a) ? [{ name: t("{agent} settings", { agent: a.name }), literal: true, icon: PREFS_GLYPH, sep: true, run: () => openAgentPrefs(a) }] : []),
// for a config rewritten in a way magpie can't see: set it again anyway
...(reapply ? [{ name: "Apply again", icon: REAPPLY, sep: true, run: () => reapplyAgent(a) }] : []),
...(a.drift?.kind === "replaced" ? [{ name: "Keep current settings", icon: CHECK, run: () => keepAgent(a) }] : []),
@@ -3735,6 +3754,24 @@ function subEffortTitle(a, f, opt) {
(f.value ? "" : "\n" + t(a.id === "claude" || a.id.split("@wsl:")[0] === "claude-desktop" ? "the effort Claude Code asks for" : "the session's effort, or the subagent model's own default"));
}
+// agentPrefsButton: the panel's line that opens the agent's own settings
+// (openAgentPrefs), named as its other lines are
+function agentPrefsButton(a) {
+ const b = el("button", "field side agent-prefs-open");
+ b.type = "button";
+ const c = el("span", "chev");
+ c.append(svg(CHEV_R, 10, 1.6));
+ // what is in it, by the rows' own names
+ homeAgentPrefRows();
+ const names = agentPrefsOf(a).map((id) => $("#" + id)).filter((r) => !r.hidden).map((r) => r.querySelector(".name").textContent);
+ b.append(el("span", "k", t("Settings")), el("span", "v", names.join(" · ")), c);
+ b.title = t("{agent} settings", { agent: a.name });
+ b.setAttribute("aria-label", b.title);
+ b.setAttribute("aria-haspopup", "dialog");
+ b.onclick = (ev) => { ev.stopPropagation(); openAgentPrefs(a); };
+ return b;
+}
+
// launchButton copies the command that starts an agent on magpie, for one
// that takes the gateway only from its environment (agy)
function launchButton(a) {
@@ -19495,8 +19532,7 @@ function renderSettings() {
row(t("Community"), t("questions, ideas and feedback, on Discord or GitHub"), "", join, repo);
// gateway mode leaves out what is written into this computer's agents'
// files, and the alerts its desktop would show
- for (const r of [$("#plainNamesSegs").parentElement, $("#codexAgentsV1Segs").parentElement, $("#fullContextSegs").parentElement, $("#codexAsyncRow"),
- $("#codexTitlesRow"), $("#codexDescriptionsRow"), $("#codexPredictionsRow"), $("#codexAutoReviewRow"), $("#usageAlertRow"), $("#balanceAlertRow"), $("#resetReminderRow"), $("#turnDoneRow")]) r.hidden = gatewayMode;
+ for (const r of [$("#plainNamesSegs").parentElement, $("#usageAlertRow"), $("#balanceAlertRow"), $("#resetReminderRow"), $("#turnDoneRow")]) r.hidden = gatewayMode;
// the parts' tabs, one gone whose rows are all hidden here
setSetTab(setTab);
}
@@ -20137,59 +20173,8 @@ function renderTrayUsage(s, keep) {
renderAlerts(s, keep);
$("#plainNamesSegs").replaceChildren(suffixSegs());
sayNoNamesInSettings();
- // Codex's own models in multi-agent V1 (their subagents' tasks go as text),
- // so a GPT lead can run a subagent on magpie's other models (#141). Where
- // Codex's own multi_agent_v2 is on in the config magpie routes it wins, and
- // magpie writes nothing: the row says so and the user turns it off.
- const v1Warn = $("#codexAgentsV1Warn");
- v1Warn.hidden = !s.notice;
- v1Warn.textContent = s.notice ? tNotice(s.notice) : "";
- $("#codexAgentsV1Segs").replaceChildren(segs([["off", t("Off")], ["on", t("On")]], s.codexAgentsV1 ? "on" : "off", (v) =>
- writingPrefs(api("settings/codex-agents-v1", { on: v === "on" })).then((ns) => { prefs = ns; renderSettings(); if (ns.notice) status(tNotice(ns.notice), "warn", 9000); }).catch((e) => { status(t(e.message), "err"); renderSettings(); })));
- // a 1M model's whole window, or compacting at the working one (X: Chen,
- // 70–90s to a first token at 550K)
- // at a size the user types too, not 272K alone (#876); a provider's own
- // Compact at comes before either
- const setCompact = (body) => writingPrefs(api("settings/full-context", body)).then((ns) => { prefs = ns; renderSettings(); }).catch((e) => { status(t(e.message), "err"); renderSettings(); });
- const at = contextsText({ "*": s.compactAt || 272000 });
- const compactSegs = segs([["off", t("Compact at {n}", { n: at.toUpperCase() })], ["on", t("Full window")]], s.fullContext ? "on" : "off", (v) => setCompact({ on: v === "on" }));
- const compactNum = input(s.compactAt ? at : "", "272k");
- compactNum.className = "words compact-num";
- compactNum.hidden = !!s.fullContext;
- compactNum.title = t("Compact at");
- compactNum.setAttribute("aria-label", t("Compact at"));
- compactNum.onchange = () => {
- const r = parseContexts(compactNum.value);
- const n = r.map?.["*"] || 0;
- if (r.error || Object.keys(r.map).some((k) => k !== "*")) return status(t("Compact at: {v} is not a number of tokens like 272k", { v: compactNum.value.trim() }), "err");
- setCompact({ on: false, at: n });
- };
- const compactRow = el("div", "compact-at");
- compactRow.append(compactSegs, compactNum);
- $("#fullContextSegs").replaceChildren(compactRow);
- // Codex's background compaction (#2490): [features.async_compaction] and
- // its threshold, written where magpie routes Codex (codex_async.go)
- const setAsync = (body) => writingPrefs(api("settings/codex-async-compact", body)).then((ns) => { prefs = ns; renderSettings(); }).catch((e) => { status(t(e.message), "err"); renderSettings(); });
- const asyncSegs = segs([["off", t("Off")], ["on", t("On")]], s.codexAsyncCompact ? "on" : "off", (v) => setAsync({ on: v === "on" }));
- const asyncNum = input(s.codexAsyncCompactPercent ? s.codexAsyncCompactPercent + "%" : "", "65%");
- asyncNum.className = "words compact-num";
- asyncNum.hidden = !s.codexAsyncCompact;
- asyncNum.title = t("Background compaction at");
- asyncNum.setAttribute("aria-label", t("Background compaction at"));
- asyncNum.onchange = () => {
- const v = asyncNum.value.trim().replace(/\s*%$/, "");
- const n = v === "" ? 0 : Number(v);
- if (!Number.isInteger(n) || n < 0 || n > 100) return status(t("Background compaction at: {v} is not a percent from 1 to 100", { v: asyncNum.value.trim() }), "err");
- setAsync({ on: true, percent: n });
- };
- const asyncRow = el("div", "compact-at");
- asyncRow.append(asyncSegs, asyncNum);
- $("#codexAsyncSegs").replaceChildren(asyncRow);
- renderCodexTitles(s);
- renderCodexDescriptions(s);
- renderCodexPredictions(s);
- renderCodexAutoReview(s);
- renderCodexMemories();
+ renderAgentPrefs();
+ renderAgentPrefLinks();
const rate = s.fx?.rate;
const currencySub = $("#currencySub");
currencySub.textContent = t("What a cost — the Usage page's, the tray panel's, the TUI's and the CLI's — is shown as; a vendor's own balance, already in its own currency, is never converted");
@@ -20733,6 +20718,149 @@ function renderAlerts(s, keep) {
$("#turnDoneSegs").replaceChildren(segs(turnOpts, String(d), (v) => savePrefs({ ...keep, turnDoneAlert: Number(v) })));
}
+// AGENT_PREFS: an agent's own settings, by its id, each a row kept in
+// #agentPrefRows and shown in the agent's sheet (openAgentPrefs). They sat
+// in Settings, apart from the agents they set (the owner, 10-20); Long
+// conversations is Codex's and Claude Code's both, in each one's sheet.
+const AGENT_PREFS = {
+ codex: ["codexAgentsV1Row", "fullContextRow", "codexAsyncRow", "codexTitlesRow", "codexDescriptionsRow", "codexPredictionsRow", "codexAutoReviewRow", "codexMemoriesRow"],
+ claude: ["fullContextRow"],
+};
+const agentPrefsOf = (a) => gatewayMode ? null : AGENT_PREFS[a.id.split("@wsl:")[0]];
+const PREFS_GLYPH = "M2.75 4.75h10.5M2.75 11.25h10.5M5.75 3.25v3M10.25 9.75v3";
+let agentPrefRowEls = null;
+// homeAgentPrefRows puts back the rows a sheet took with it when another
+// dialog replaced it, so every row is in the page to be drawn
+function homeAgentPrefRows() {
+ const box = $("#agentPrefRows");
+ agentPrefRowEls ||= [...box.children];
+ for (const r of agentPrefRowEls) if (!r.isConnected) box.append(r);
+}
+
+// openAgentPrefs: the agent's own settings in a sheet, as the Manage
+// agents one opens; the settings read first, so it opens on what is set
+async function openAgentPrefs(a) {
+ const ids = agentPrefsOf(a);
+ if (!ids) return;
+ try { await loadSettings(); } catch (e) { return status(e.message, "err"); }
+ homeAgentPrefRows();
+ const ed = el("div", "editor agent-prefs");
+ const head = el("div", "ehead");
+ head.append(el("b", "", t("{agent} settings", { agent: a.name })));
+ const list = el("div", "list prefs");
+ for (const id of ids) list.append($("#" + id));
+ const bar = el("div", "bar");
+ const done = el("button", "primary", t("Done"));
+ done.type = "button";
+ done.onclick = () => closeConfirmAsk();
+ bar.append(el("span", "grow"), done);
+ ed.append(head, list, bar);
+ confirmAsk = ed;
+ openModal(ed);
+ // an opened row it took them from has them back once the sheet is shut
+ const m = $("#modal"), back = new MutationObserver(() => {
+ if (!m.hidden && m.firstElementChild.contains(ed)) return;
+ back.disconnect();
+ homeAgentPrefRows();
+ if (agentExpanded) renderAgents();
+ });
+ back.observe(m, { attributes: true, attributeFilter: ["hidden"], childList: true, subtree: true });
+}
+
+// renderAgentPrefs draws those rows, wherever they are: the sheet's
+// controls are the ones Settings had, written the same way
+function renderAgentPrefs() {
+ const s = prefs;
+ if (!s) return;
+ homeAgentPrefRows();
+ // Codex's own models in multi-agent V1 (their subagents' tasks go as text),
+ // so a GPT lead can run a subagent on magpie's other models (#141). Where
+ // Codex's own multi_agent_v2 is on in the config magpie routes it wins, and
+ // magpie writes nothing: the row says so and the user turns it off.
+ const v1Warn = $("#codexAgentsV1Warn");
+ v1Warn.hidden = !s.notice;
+ v1Warn.textContent = s.notice ? tNotice(s.notice) : "";
+ $("#codexAgentsV1Segs").replaceChildren(segs([["off", t("Off")], ["on", t("On")]], s.codexAgentsV1 ? "on" : "off", (v) =>
+ writingPrefs(api("settings/codex-agents-v1", { on: v === "on" })).then((ns) => { prefs = ns; renderSettings(); if (ns.notice) status(tNotice(ns.notice), "warn", 9000); }).catch((e) => { status(t(e.message), "err"); renderSettings(); })));
+ // a 1M model's whole window, or compacting at the working one (X: Chen,
+ // 70–90s to a first token at 550K)
+ // at a size the user types too, not 272K alone (#876); a provider's own
+ // Compact at comes before either
+ const setCompact = (body) => writingPrefs(api("settings/full-context", body)).then((ns) => { prefs = ns; renderSettings(); }).catch((e) => { status(t(e.message), "err"); renderSettings(); });
+ const at = contextsText({ "*": s.compactAt || 272000 });
+ const compactSegs = segs([["off", t("Compact at {n}", { n: at.toUpperCase() })], ["on", t("Full window")]], s.fullContext ? "on" : "off", (v) => setCompact({ on: v === "on" }));
+ const compactNum = input(s.compactAt ? at : "", "272k");
+ compactNum.className = "words compact-num";
+ compactNum.hidden = !!s.fullContext;
+ compactNum.title = t("Compact at");
+ compactNum.setAttribute("aria-label", t("Compact at"));
+ compactNum.onchange = () => {
+ const r = parseContexts(compactNum.value);
+ const n = r.map?.["*"] || 0;
+ if (r.error || Object.keys(r.map).some((k) => k !== "*")) return status(t("Compact at: {v} is not a number of tokens like 272k", { v: compactNum.value.trim() }), "err");
+ setCompact({ on: false, at: n });
+ };
+ const compactRow = el("div", "compact-at");
+ compactRow.append(compactSegs, compactNum);
+ $("#fullContextSegs").replaceChildren(compactRow);
+ // Codex's background compaction (#2490): [features.async_compaction] and
+ // its threshold, written where magpie routes Codex (codex_async.go)
+ const setAsync = (body) => writingPrefs(api("settings/codex-async-compact", body)).then((ns) => { prefs = ns; renderSettings(); }).catch((e) => { status(t(e.message), "err"); renderSettings(); });
+ const asyncSegs = segs([["off", t("Off")], ["on", t("On")]], s.codexAsyncCompact ? "on" : "off", (v) => setAsync({ on: v === "on" }));
+ const asyncNum = input(s.codexAsyncCompactPercent ? s.codexAsyncCompactPercent + "%" : "", "65%");
+ asyncNum.className = "words compact-num";
+ asyncNum.hidden = !s.codexAsyncCompact;
+ asyncNum.title = t("Background compaction at");
+ asyncNum.setAttribute("aria-label", t("Background compaction at"));
+ asyncNum.onchange = () => {
+ const v = asyncNum.value.trim().replace(/\s*%$/, "");
+ const n = v === "" ? 0 : Number(v);
+ if (!Number.isInteger(n) || n < 0 || n > 100) return status(t("Background compaction at: {v} is not a percent from 1 to 100", { v: asyncNum.value.trim() }), "err");
+ setAsync({ on: true, percent: n });
+ };
+ const asyncRow = el("div", "compact-at");
+ asyncRow.append(asyncSegs, asyncNum);
+ $("#codexAsyncSegs").replaceChildren(asyncRow);
+ renderCodexTitles(s);
+ renderCodexDescriptions(s);
+ renderCodexPredictions(s);
+ renderCodexAutoReview(s);
+ renderCodexMemories();
+}
+
+// renderAgentPrefLinks: Settings' search still finds the settings an agent's
+// sheet holds, each a row saying where it is that opens the sheet; shown
+// only while searching (app.css)
+function renderAgentPrefLinks() {
+ const box = $("#agentPrefLinks");
+ box.replaceChildren();
+ homeAgentPrefRows();
+ 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;
+ const row = el("div", "row pref agent-pref-link");
+ const who = el("div", "who");
+ const name = r.querySelector(".name");
+ const n = el("div", "name", name.textContent);
+ n.dataset.en = name.dataset.en || name.textContent;
+ who.append(n);
+ who.append(el("div", "sub", t("In {agent}'s settings, on the Agents page", { agent: agents.map((a) => a.name).join(", ") })));
+ // the row's own line, unshown, is searched as well
+ const sub = r.querySelector(".sub:not(.err)");
+ if (sub) {
+ const says = el("span", "", sub.textContent);
+ says.hidden = true;
+ says.dataset.en = sub.dataset.en || sub.textContent;
+ who.append(says);
+ }
+ const go = el("button", "text", t("Open"));
+ go.type = "button";
+ go.onclick = async () => { if (await show("agents") !== false) openAgentPrefs(agents[0]); };
+ row.append(who, go);
+ box.append(row);
+ }
+}
+
// renderCodexDescriptions picks the model for descriptions independently
// of titles; an empty setting preserves Codex's requested model.
function renderCodexDescriptions(s) {
@@ -20844,8 +20972,10 @@ function renderCodexAutoReview(s) {
// subagent squares, and wasn't found). It is the card's own field, picked
// in the same picker and written the same way, so the row and the square
// show one setting; renderAgents draws the row again after every pick.
+// The row is in Codex's sheet now (openAgentPrefs), not Settings.
// No Codex with a memories field to pick: no row.
function renderCodexMemories() {
+ homeAgentPrefRows();
const row = $("#codexMemoriesRow");
if (!row) return;
const a = state.agents.find((x) => x.id === "codex");
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index a579d460c..9018dfe49 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -1043,6 +1043,8 @@ const I18N = {
"Codex’s own pick": "由 Codex 决定",
"as Codex picks it": "按 Codex 默认选择",
"Codex memories model": "Codex 记忆整理模型",
+ "{agent} settings": "{agent} 设置",
+ "In {agent}'s settings, on the Agents page": "在 Agent 页的 {agent} 设置里",
"no title, nothing sent": "不生成标题,不发出请求",
"A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins": "GPT 主代理可在 magpie 的其他模型上开子代理。仅对新会话生效;Codex 自身的 multi_agent_v2 优先",
"Codex's own multi_agent_v2 is on in the config magpie routes, which takes over the multi-agent V1 magpie's models ask for; turn it off in Codex's config to run subagents on magpie's models.": "Codex 自身的 multi_agent_v2 在 magpie 接管的配置里开着,会盖过 magpie 模型所需的 multi-agent V1;请在 Codex 的配置里把它关掉,才能让子代理跑在 magpie 的模型上。",
@@ -4795,6 +4797,8 @@ const I18N = {
"Codex’s own pick": "由 Codex 決定",
"as Codex picks it": "按 Codex 預設選擇",
"Codex memories model": "Codex 記憶整理模型",
+ "{agent} settings": "{agent} 設定",
+ "In {agent}'s settings, on the Agents page": "在 Agent 頁的 {agent} 設定裡",
"no title, nothing sent": "不生成標題,不發出請求",
"A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins": "GPT 主代理可在 magpie 的其他模型上開子代理。僅對新會話生效;Codex 自身的 multi_agent_v2 優先",
"Codex's own multi_agent_v2 is on in the config magpie routes, which takes over the multi-agent V1 magpie's models ask for; turn it off in Codex's config to run subagents on magpie's models.": "Codex 自身的 multi_agent_v2 在 magpie 接管的設定裡開著,會蓋過 magpie 模型所需的 multi-agent V1;請在 Codex 的設定裡把它關掉,才能讓子代理跑在 magpie 的模型上。",
@@ -8517,6 +8521,8 @@ const I18N = {
"Codex’s own pick": "Codex に任せる",
"as Codex picks it": "Codex の既定どおり",
"Codex memories model": "Codex メモリ整理のモデル",
+ "{agent} settings": "{agent} の設定",
+ "In {agent}'s settings, on the Agents page": "エージェントページの {agent} の設定にあります",
"no title, nothing sent": "タイトルなし、送信なし",
"A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins": "GPT のリードが magpie の他のモデルでサブエージェントを起動します。新しいスレッドのみ。Codex 自身の multi_agent_v2 が優先されます",
"Codex's own multi_agent_v2 is on in the config magpie routes, which takes over the multi-agent V1 magpie's models ask for; turn it off in Codex's config to run subagents on magpie's models.": "magpie が中継する設定で Codex 自身の multi_agent_v2 がオンになっており、magpie のモデルが必要とする multi-agent V1 を上書きします。magpie のモデルでサブエージェントを動かすには、Codex の設定でオフにしてください。",
@@ -12269,6 +12275,8 @@ const I18N = {
"Codex’s own pick": "Wie Codex es wählt",
"as Codex picks it": "Codex’ Standard",
"Codex memories model": "Codex-Modell für Erinnerungen",
+ "{agent} settings": "Einstellungen von {agent}",
+ "In {agent}'s settings, on the Agents page": "In den Einstellungen von {agent}, auf der Seite Agenten",
"no title, nothing sent": "kein Titel, nichts gesendet",
"A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins": "Ein leitendes GPT startet Subagenten auf anderen magpie-Modellen. Nur neue Threads; Codex’ eigenes multi_agent_v2 hat Vorrang",
"Codex's own multi_agent_v2 is on in the config magpie routes, which takes over the multi-agent V1 magpie's models ask for; turn it off in Codex's config to run subagents on magpie's models.": "Codex' eigenes multi_agent_v2 ist in der von magpie gerouteten Konfiguration an und überstimmt so das multi-agent V1, das magpie-Modelle brauchen; schalte es in Codex' Konfiguration aus, damit Subagenten auf magpie-Modellen laufen.",
diff --git a/internal/gui/assets/index.html b/internal/gui/assets/index.html
index 8e1a6c1bc..46541fc24 100644
--- a/internal/gui/assets/index.html
+++ b/internal/gui/assets/index.html
@@ -193,38 +193,8 @@
<div class="who"><div class="name" data-t>Provider in model names</div></div>
<div id="plainNamesSegs"></div>
</div>
- <div class="row pref">
- <div class="who"><div class="name" data-t>Codex subagents on any model</div><div class="sub" data-t>A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins</div><div class="sub err" id="codexAgentsV1Warn" hidden></div></div>
- <div id="codexAgentsV1Segs"></div>
- </div>
- <div class="row pref">
- <div class="who"><div class="name" data-t>Long conversations</div><div class="sub" data-t>Codex and Claude Code compact at 272K (non-Claude [1m] too) or the size typed; full window: slower, costlier</div></div>
- <div id="fullContextSegs"></div>
- </div>
- <div class="row pref" id="codexAsyncRow">
- <div class="who"><div class="name" data-t>Codex background compaction</div><div class="sub" data-t>Codex 0.163 and later summarise while a turn goes on, past the share of the window typed (65% when empty); a value set in its own config stays</div></div>
- <div id="codexAsyncSegs"></div>
- </div>
- <div class="row pref" id="codexTitlesRow">
- <div class="who"><div class="name" data-t>Codex thread titles</div></div>
- <div class="val" id="codexTitlesPick"></div>
- </div>
- <div class="row pref" id="codexDescriptionsRow">
- <div class="who"><div class="name" data-t>Codex thread descriptions</div></div>
- <div class="val" id="codexDescriptionsPick"></div>
- </div>
- <div class="row pref" id="codexPredictionsRow">
- <div class="who"><div class="name" data-t>Codex composer predictions</div></div>
- <div class="val" id="codexPredictionsPick"></div>
- </div>
- <div class="row pref" id="codexAutoReviewRow">
- <div class="who"><div class="name" data-t>Codex auto-review model</div></div>
- <div class="val" id="codexAutoReviewPick"></div>
- </div>
- <div class="row pref" id="codexMemoriesRow" hidden>
- <div class="who"><div class="name" data-t>Codex memories model</div></div>
- <div class="val" id="codexMemoriesPick"></div>
- </div>
+ <!-- Codex's and Claude Code's own settings are on the Agents page (AGENT_PREFS); while searching, a row here says where -->
+ <div id="agentPrefLinks"></div>
<div class="row pref" id="loginRow">
<div class="who"><div class="name" data-t>Open at login</div></div>
<div id="loginSegs"></div>
@@ -452,6 +422,41 @@
</div>
</div>
+<!-- an agent's own settings, drawn here and shown in its sheet or opened row (AGENT_PREFS) -->
+<div id="agentPrefRows" hidden>
+ <div class="row pref" id="codexAgentsV1Row">
+ <div class="who"><div class="name" data-t>Codex subagents on any model</div><div class="sub" data-t>A GPT lead spawns subagents on magpie’s other models. New threads only; Codex’s own multi_agent_v2 still wins</div><div class="sub err" id="codexAgentsV1Warn" hidden></div></div>
+ <div id="codexAgentsV1Segs"></div>
+ </div>
+ <div class="row pref" id="fullContextRow">
+ <div class="who"><div class="name" data-t>Long conversations</div><div class="sub" data-t>Codex and Claude Code compact at 272K (non-Claude [1m] too) or the size typed; full window: slower, costlier</div></div>
+ <div id="fullContextSegs"></div>
+ </div>
+ <div class="row pref" id="codexAsyncRow">
+ <div class="who"><div class="name" data-t>Codex background compaction</div><div class="sub" data-t>Codex 0.163 and later summarise while a turn goes on, past the share of the window typed (65% when empty); a value set in its own config stays</div></div>
+ <div id="codexAsyncSegs"></div>
+ </div>
+ <div class="row pref" id="codexTitlesRow">
+ <div class="who"><div class="name" data-t>Codex thread titles</div></div>
+ <div class="val" id="codexTitlesPick"></div>
+ </div>
+ <div class="row pref" id="codexDescriptionsRow">
+ <div class="who"><div class="name" data-t>Codex thread descriptions</div></div>
+ <div class="val" id="codexDescriptionsPick"></div>
+ </div>
+ <div class="row pref" id="codexPredictionsRow">
+ <div class="who"><div class="name" data-t>Codex composer predictions</div></div>
+ <div class="val" id="codexPredictionsPick"></div>
+ </div>
+ <div class="row pref" id="codexAutoReviewRow">
+ <div class="who"><div class="name" data-t>Codex auto-review model</div></div>
+ <div class="val" id="codexAutoReviewPick"></div>
+ </div>
+ <div class="row pref" id="codexMemoriesRow" hidden>
+ <div class="who"><div class="name" data-t>Codex memories model</div></div>
+ <div class="val" id="codexMemoriesPick"></div>
+ </div>
+</div>
<script src="i18n.js"></script>
<script src="kernel.js"></script>
<!-- the built-in plugins' own scripts (pluginrt.Manifest.Client) -->
diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go
index d6f09f3c6..afe1b9594 100644
--- a/internal/gui/core_budget_test.go
+++ b/internal/gui/core_budget_test.go
@@ -15,8 +15,8 @@ import (
// so a page can't quietly grow back into the core; a change that needs more
// raises them and says why in its commit.
const (
- appScriptBudget = 1_292_000 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20)
- coreScriptBudget = 1_469_000 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it
+ appScriptBudget = 1_292_000 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20)
+ coreScriptBudget = 1_495_000 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20)
)
func TestCoreScriptBudget(t *testing.T) {
diff --git a/internal/gui/tests/agent-expand-steady.test.cjs b/internal/gui/tests/agent-expand-steady.test.cjs
index 9ba569625..bfac76ecd 100644
--- a/internal/gui/tests/agent-expand-steady.test.cjs
+++ b/internal/gui/tests/agent-expand-steady.test.cjs
@@ -11,6 +11,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { reach } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const model = (id, label) => ({ key: "model", label: "model", value: id, options: [{ value: id, label, ref: "relay/" + id, note: "Relay · via magpie" }] });
@@ -92,7 +93,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// another row open: the one open slides shut, this one opens
await page.locator(`${row} .ag-link`).click();
await page.waitForTimeout(700);
- await page.locator('.row.agent[data-id="goose"] .ag-link').click();
+ // Codex's opened row holds its own settings, so Goose's is wheeled to
+ const goose = page.locator('.row.agent[data-id="goose"] .ag-link');
+ await reach(page, goose);
+ await goose.click();
await page.waitForTimeout(1000);
assert.equal(await page.locator(".row.agent .ag-exp").count(), 1);
assert.equal(await page.locator('.row.agent[data-id="goose"] .ag-exp').count(), 1);
@@ -100,7 +104,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// reduced motion: open at once
await page.emulateMedia({ reducedMotion: "reduce" });
- await page.locator('.row.agent[data-id="goose"] .ag-link').click();
+ await reach(page, goose);
+ await goose.click();
await page.waitForTimeout(500);
const now = await heights(page, 120);
assert.equal(now[0], full, "opened at once: " + now);
diff --git a/internal/gui/tests/agent-models-loading.test.cjs b/internal/gui/tests/agent-models-loading.test.cjs
index 32c2535b6..d8597cc68 100644
--- a/internal/gui/tests/agent-models-loading.test.cjs
+++ b/internal/gui/tests/agent-models-loading.test.cjs
@@ -54,6 +54,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/");
// the list opens from Pick in the connected row, opened
await page.locator('.row.agent[data-id="codex"] .ag-link').click();
+ // "elsewhere" is the page's lead line: the opened row holds Codex's own
+ // settings and its Disconnect button, so a fixed point could hit one
+ const lead = await page.locator("#agentsLead").boundingBox();
+ const away = () => page.mouse.click(lead.x + lead.width / 2, lead.y + lead.height / 2);
const entry = page.locator('.row.agent[data-id="codex"] .ag-exp .ag-chips .ag-quiet');
await entry.waitFor();
const boxes = () => page.locator(".am-pop:not(.leaving)").count();
@@ -70,13 +74,13 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await entry.click();
await page.waitForTimeout(1000);
assert.equal(await boxes(), 1, "one box at most");
- await page.mouse.click(900, 650);
+ await away();
await page.waitForTimeout(500);
assert.equal(await boxes(), 0, "a click elsewhere closes it");
// a click elsewhere while it loads: it doesn't come up
await entry.click();
- await page.mouse.click(900, 650);
+ await away();
await page.waitForTimeout(1000);
assert.equal(await boxes(), 0, "a click away while it loads takes it back");
diff --git a/internal/gui/tests/agent-models-redraw.test.cjs b/internal/gui/tests/agent-models-redraw.test.cjs
index a093479a9..389709855 100644
--- a/internal/gui/tests/agent-models-redraw.test.cjs
+++ b/internal/gui/tests/agent-models-redraw.test.cjs
@@ -11,6 +11,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { reach } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -94,8 +95,13 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
t.after(() => browser.close());
await page.goto("http://magpie.test/");
await page.locator('.row.agent[data-id="codex"] .ag-link').click();
- // Plain, with nothing set, is folded under the two connected ones
- await page.locator("#agents .agent-more").click();
+ // Plain, with nothing set, is folded under the two connected ones; Codex's
+ // opened row holds its own settings, so the fold is wheeled into sight
+ // once that row has slid open
+ const more = page.locator("#agents .agent-more");
+ await page.waitForFunction(() => !document.getAnimations().length);
+ await reach(page, more);
+ await more.click();
await page.locator('#agents .agent-more[aria-expanded="true"]').waitFor();
const pop = page.locator(".am-pop:not(.leaving)");
const redraw = () => page.evaluate(() => renderAgents());
diff --git a/internal/gui/tests/agent-prefs.test.cjs b/internal/gui/tests/agent-prefs.test.cjs
new file mode 100644
index 000000000..9fcaa2389
--- /dev/null
+++ b/internal/gui/tests/agent-prefs.test.cjs
@@ -0,0 +1,164 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// An agent's own settings are where the agent is (the owner, 10-20: Codex's
+// and Claude Code's rows sat in Settings › General, apart from the agents
+// they set). In the window, Codex's opened row holds its eight and Claude
+// Code's its one, Long conversations; Settings has none of them, but its
+// 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
+// and narrow, Chromium and WebKit; no backend, 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, agentRow, openAgentSettings } = require("./reader.cjs");
+
+const assets = path.resolve(__dirname, "../assets");
+const CODEX = ["codexAgentsV1Row", "fullContextRow", "codexAsyncRow", "codexTitlesRow", "codexDescriptionsRow", "codexPredictionsRow", "codexAutoReviewRow", "codexMemoriesRow"];
+
+function settingsPayload(over) {
+ return {
+ theme: "light", lang: "en", tray: "panel", quotaLeft: false, currency: "usd",
+ dock: false, dockWindow: false, proxy: "", redact: false, redactPersonal: false, redactWords: [],
+ codexWarmup: "", claudeWarmup: "", codexWarmAt: "", claudeWarmAt: "", workbuddyCheckin: false, noStats: false,
+ trayUsage: "", trayUsageEvery: 3, vision: "", imageGen: "",
+ version: "0.1.400", dir: "~/.config/magpie", gateway: "http://127.0.0.1:3425",
+ proxyNow: "none", proxySource: "none", login: false,
+ visionModels: [], imageGenModels: [], workbuddyCheckins: [], lanURLs: [], titleModels: [],
+ fx: { rate: 7.2, at: new Date().toISOString(), stale: false },
+ ...over,
+ };
+}
+
+function server(lang, { gateway = false } = {}) {
+ const settings = settingsPayload({ lang, ...(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" }] });
+ 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:${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/settings") return json(settings);
+ if (url.pathname === "/api/plugins") return json({ plugins: [] });
+ if (url.pathname === "/api/usage/quotas") return json([]);
+ if (url.pathname === "/api/groups") return json({ groups: [], models: [] });
+ if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true } });
+ 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 want = {
+ en: { titles: "Codex thread titles", sheet: "Codex settings", open: "Open" },
+ zh: { titles: "Codex 会话标题", sheet: "Codex 设置", open: "打开" },
+ "zh-TW": { titles: "Codex 會話標題", sheet: "Codex 設定", open: "開啟" },
+ ja: { titles: "Codex のスレッドタイトル", sheet: "Codex の設定", open: "開く" },
+ de: { titles: "Codex-Thread-Titel", sheet: "Einstellungen von Codex", open: "Öffnen" },
+};
+// the ids of an agent's settings rows shown in `box`, in order
+const shownIn = (page, box) => page.locator(box).evaluate((b) => [...b.querySelectorAll(":scope [id$=Row]")].filter((r) => r.checkVisibility()).map((r) => r.id));
+const sheet = (page) => page.locator("#modal:not([hidden]) .editor.agent-prefs");
+const noSideScroll = (page, what) => page.evaluate(() => [document.documentElement.scrollWidth, innerWidth]).then(([w, iw]) => assert(w <= iw, `${what}: no sideways scroll: ${w} > ${iw}`));
+
+async function newPage(engine, t, width, lang, opts) {
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ const page = await browser.newPage({ viewport: { width, height: 760 }, reducedMotion: "reduce" });
+ page.setDefaultTimeout(8000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.route("**/*", server(lang, opts));
+ await watchSettingsReads(page);
+ return { page, errors };
+}
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const lang of Object.keys(want)) {
+ for (const width of [1100, 440]) {
+ test(`${engine} ${lang} ${width}: an agent's own settings are in its opened row, and Settings' search finds them there`, async (t) => {
+ const { page, errors } = await newPage(engine, t, width, lang);
+ const w = want[lang];
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page, "codex");
+ const codexBox = '.row.agent[data-id="codex"] .ag-prefs';
+ assert.deepEqual(await shownIn(page, codexBox), CODEX, `${lang} ${width}: Codex's eight`);
+ assert(await page.locator(codexBox).evaluate((b) => b.scrollWidth <= b.clientWidth + 1), `${lang} ${width}: the rows fit the opened row`);
+ await noSideScroll(page, `${lang} ${width} Codex`);
+ await openAgentSettings(page, "claude");
+ assert.deepEqual(await shownIn(page, '.row.agent[data-id="claude"] .ag-prefs'), ["fullContextRow"], `${lang} ${width}: Claude Code's one`);
+
+ // none in Settings; its search says where they are
+ await page.goto("http://magpie.test/?view=settings");
+ await page.locator("#setQ").waitFor();
+ for (const id of CODEX) assert.equal(await page.locator(`#view-settings #${id}`).count(), 0, `${lang}: ${id} not in Settings`);
+ assert.equal(await page.locator(".agent-pref-link").first().isVisible(), false, "no link rows till searching");
+ await page.locator("#setQ").fill(w.titles);
+ const link = page.locator(".agent-pref-link").filter({ hasText: w.titles });
+ await link.waitFor();
+ await noSideScroll(page, `${lang} ${width} search`);
+ await link.getByRole("button", { name: w.open, exact: true }).click();
+ await sheet(page).waitFor();
+ assert.equal(await sheet(page).locator(".ehead").textContent(), w.sheet);
+ assert.deepEqual(await shownIn(page, "#modal .editor.agent-prefs"), CODEX, `${lang} ${width}: the sheet has Codex's eight`);
+ assert(await page.locator("#view-agents").isVisible(), "Open goes to the Agents page");
+ await page.keyboard.press("Escape");
+ await page.locator("#modal").waitFor({ state: "hidden" });
+ // shut, every row is back in the page, none lost with the sheet
+ for (const id of CODEX) assert.equal(await page.locator(`#${id}`).count(), 1, `${lang}: ${id} back`);
+ assert.deepEqual(errors, []);
+ });
+ }
+
+ test(`${engine} ${lang}: in the panel a Settings line and the agent's menu open its sheet`, async (t) => {
+ const { page, errors } = await newPage(engine, t, 360, lang);
+ const w = want[lang];
+ await page.goto("http://magpie.test/?mode=panel&view=agents");
+ // the panel shows a row's controls once it's opened
+ await page.locator('.row.agent[data-id="codex"] .ag-sum').click();
+ const line = page.locator('.row.agent[data-id="codex"] .agent-prefs-open');
+ await line.waitFor();
+ assert.equal(await line.getAttribute("aria-label"), w.sheet);
+ assert.equal(await page.locator('.row.agent[data-id="pi"] .agent-prefs-open').count(), 0, "Pi has none");
+ await noSideScroll(page, `${lang} panel`);
+ await line.click();
+ await sheet(page).waitFor();
+ assert.deepEqual(await shownIn(page, "#modal .editor.agent-prefs"), CODEX);
+ assert(await page.locator("#modal .dialog").evaluate((d) => d.scrollWidth <= d.clientWidth + 1), `${lang}: the sheet fits 360`);
+ await page.keyboard.press("Escape");
+ await page.locator("#modal").waitFor({ state: "hidden" });
+
+ await page.locator('.row.agent[data-id="claude"] .ag-handle').click();
+ await page.getByRole("menuitem", { name: w.sheet.replace("Codex", "Claude Code") }).click();
+ await sheet(page).waitFor();
+ assert.deepEqual(await shownIn(page, "#modal .editor.agent-prefs"), ["fullContextRow"]);
+ await page.keyboard.press("Escape");
+ await page.locator("#modal").waitFor({ state: "hidden" });
+ for (const id of CODEX) assert.equal(await page.locator(`#${id}`).count(), 1, `${lang}: ${id} back`);
+ assert.deepEqual(errors, []);
+ });
+ }
+
+ test(`${engine}: gateway mode shows none of an agent's settings`, async (t) => {
+ const { page, errors } = await newPage(engine, t, 1100, "en", { gateway: true });
+ // it has no Agents page: asked for, the Providers page shows
+ await page.goto("http://magpie.test/?view=agents");
+ await page.locator("#view-providers").waitFor();
+ assert.equal(await page.locator("#view-agents").isVisible(), false, "no Agents page");
+ assert.equal(await page.locator(".ag-prefs, .agent-prefs-open").count(), 0, "no rows, no line");
+ await page.goto("http://magpie.test/?view=settings");
+ await page.locator("#setQ").fill("Codex");
+ assert.equal(await page.locator(".agent-pref-link").count(), 0, "no link rows");
+ assert.deepEqual(errors, []);
+ });
+}
diff --git a/internal/gui/tests/bare-ids.test.cjs b/internal/gui/tests/bare-ids.test.cjs
index 6a7483cb6..0abf99fbf 100644
--- a/internal/gui/tests/bare-ids.test.cjs
+++ b/internal/gui/tests/bare-ids.test.cjs
@@ -98,7 +98,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const segs = page.locator("#bareIdsSegs .opt");
await segs.first().waitFor();
const row = page.locator("#bareIdsRow");
- assert.equal(await page.locator("#codexTitlesRow").evaluate((r) => r.hidden), gateway, "gateway mode as faked");
+ assert.equal(await page.locator("#usageAlertRow").evaluate((r) => r.hidden), gateway, "gateway mode as faked");
assert(await row.isVisible(), "the row is drawn");
assert.equal((await row.locator(".name").textContent()).trim(), w.name);
assert((await row.locator(".sub").textContent()).includes(w.sub), "the sub says what it does");
diff --git a/internal/gui/tests/codex-async-compact.test.cjs b/internal/gui/tests/codex-async-compact.test.cjs
index da18a3647..6416afe80 100644
--- a/internal/gui/tests/codex-async-compact.test.cjs
+++ b/internal/gui/tests/codex-async-compact.test.cjs
@@ -1,5 +1,5 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
-// Settings → Long conversations' Codex background compaction (#2490): Off /
+// Codex's settings, on its opened row: background compaction (#2490): Off /
// On, and with it on the share of the window Codex starts at, typed as a
// percent (empty: Codex's own 65%). Each posts settings/codex-async-compact
// on its own, a value that isn't 0 to 100 is refused before anything is
@@ -10,6 +10,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { watchSettingsReads, agentRow, openAgentSettings } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -23,7 +24,7 @@ function serve(lang, posts) {
const json = (data) => route.fulfill({ json: data });
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:${JSON.stringify(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: { lang, theme: "light" } });
+ if (url.pathname === "/api/state") return json({ agents: [agentRow("codex", "Codex")], profiles: [], settings: { lang, theme: "light" } });
if (url.pathname === "/api/providers") return json(providers);
if (url.pathname === "/api/groups") return json({ groups: [], models: [] });
if (url.pathname.startsWith("/api/provider/")) {
@@ -71,13 +72,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const errors = [], posts = [];
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", serve(lang, posts));
- await page.goto("http://magpie.test/?view=settings");
+ await watchSettingsReads(page);
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page);
const row = page.locator("#codexAsyncRow");
await row.getByText(w.name, { exact: true }).waitFor();
assert.equal(await row.locator("select").count(), 0, "no native select");
const num = row.locator("input.compact-num");
assert(await num.isHidden(), "no threshold while off");
- const view = () => page.locator("#view-settings").evaluate((v) => v.scrollTop);
+ const view = () => page.locator("#view-agents").evaluate((v) => v.scrollTop);
const before = await view();
await row.getByText(w.on, { exact: true }).click();
await page.waitForFunction(() => document.querySelector("#codexAsyncRow input.compact-num")?.hidden === false);
diff --git a/internal/gui/tests/codex-auto-review.test.cjs b/internal/gui/tests/codex-auto-review.test.cjs
index 4f5b46dde..9955412f6 100644
--- a/internal/gui/tests/codex-auto-review.test.cjs
+++ b/internal/gui/tests/codex-auto-review.test.cjs
@@ -1,17 +1,17 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
-// Settings' "Codex auto-review model" (#938, guitaoliu: Codex's auto-review
+// Codex's "Codex auto-review model" (#938, guitaoliu: Codex's auto-review
// runs on the conversation's model, with no way to pick a cheaper one): by
// default Codex's own pick; the app's menu (no native select) offers
// magpie's models and groups; a pick posts settings/codex-auto-review on its
// own, its button shows the choice under a name alone (1ooogle on X), a refusal is said and the row keeps
-// what it had, and no click scrolls the Settings page.
+// what it had, and no click scrolls the Agents page, where Codex's row holds it.
// English and Chinese, Chromium and WebKit; no backend, 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, wheelTo } = require("./reader.cjs");
+const { watchSettingsReads, wheelTo, agentRow, openAgentSettings } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -40,7 +40,9 @@ function server(lang, posted) {
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:false};` });
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: { lang, theme: "light" }, fx: cur.fx });
+ // agents below Codex, so its opened row is not the list's end: a choice
+ // that rewraps its row at the very bottom must move the list
+ if (url.pathname === "/api/state") return json({ agents: [agentRow("codex", "Codex"), agentRow("claude", "Claude Code"), agentRow("pi", "Pi")], profiles: [], settings: { lang, theme: "light" }, fx: cur.fx });
if (url.pathname === "/api/settings/codex-auto-review") {
const body = req.postDataJSON();
posted.push(["codex-auto-review", body]);
@@ -71,11 +73,11 @@ const want = {
en: { name: "Codex auto-review model", own: "Codex’s own pick" },
zh: { name: "Codex 自动审批模型", own: "由 Codex 决定" },
};
-const view = (page) => page.locator("#view-settings").evaluate((v) => v.scrollTop);
+const view = (page) => page.locator("#view-agents").evaluate((v) => v.scrollTop);
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of ["en", "zh"]) {
- test(`${engine} ${lang}: Codex's auto-review runs on the model Settings picks`, async (t) => {
+ test(`${engine} ${lang}: Codex's auto-review runs on the model Codex's settings pick`, async (t) => {
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
const context = await browser.newContext({ viewport: { width: 900, height: 480 }, reducedMotion: "reduce" });
const page = await context.newPage();
@@ -91,8 +93,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await browser.close();
});
await watchSettingsReads(page);
- await page.goto("http://magpie.test/?view=settings");
- await settingsDrawn(page); // rows found are the ones that stay (#1659)
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page); // on Codex's opened row, not in Settings (the owner, 10-20)
const row = page.locator("#codexAutoReviewRow");
const pick = page.locator("#codexAutoReviewPick button");
await pick.waitFor();
@@ -105,7 +107,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// moved the page would show
await wheelTo(page, pick, 200); // each wheel landed before the next (#2370)
const before = await view(page);
- assert(before > 0, "the settings list must scroll to the row");
+ assert(before > 0, "the agents list must scroll to the row");
// the app's menu: Codex's own pick and magpie's models and groups
const choose = async (text) => {
diff --git a/internal/gui/tests/codex-descriptions.test.cjs b/internal/gui/tests/codex-descriptions.test.cjs
index 192de58cf..f255a0642 100644
--- a/internal/gui/tests/codex-descriptions.test.cjs
+++ b/internal/gui/tests/codex-descriptions.test.cjs
@@ -1,18 +1,18 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
-// Settings' "Codex thread descriptions" (#1198, congee949): Codex's
+// Codex's "Codex thread descriptions" (#1198, congee949): Codex's
// thread_description requests go where this says, apart from the titles'
// setting. By default Codex's own (ChatGPT); the app's menu (no native
// select) offers magpie's models; a pick posts settings/codex-descriptions
// on its own, the titles' setting untouched, its button shows the choice
// under a name with no line of its own (as the titles' row, 1ooogle on X),
-// and no click scrolls the Settings page.
+// and no click scrolls the Agents page, where Codex's row holds it.
// English and Chinese, Chromium and WebKit; no backend, 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, wheelTo } = require("./reader.cjs");
+const { watchSettingsReads, wheelTo, agentRow, openAgentSettings } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -41,7 +41,9 @@ function server(lang, posted) {
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:false};` });
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: { lang, theme: "light" }, fx: cur.fx });
+ // agents below Codex, so its opened row is not the list's end: a choice
+ // that rewraps its row at the very bottom must move the list
+ if (url.pathname === "/api/state") return json({ agents: [agentRow("codex", "Codex"), agentRow("claude", "Claude Code"), agentRow("pi", "Pi")], profiles: [], settings: { lang, theme: "light" }, fx: cur.fx });
if (url.pathname === "/api/settings/codex-descriptions") {
const body = req.postDataJSON();
posted.push(["codex-descriptions", body]);
@@ -70,11 +72,11 @@ const want = {
en: { name: "Codex thread descriptions", own: "Codex’s own (ChatGPT)" },
zh: { name: "Codex 会话描述", own: "Codex 自带(ChatGPT)" },
};
-const view = (page) => page.locator("#view-settings").evaluate((v) => v.scrollTop);
+const view = (page) => page.locator("#view-agents").evaluate((v) => v.scrollTop);
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of ["en", "zh"]) {
- test(`${engine} ${lang}: Codex's description requests go where Settings says`, async (t) => {
+ test(`${engine} ${lang}: Codex's description requests go where Codex's settings say`, async (t) => {
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
const context = await browser.newContext({ viewport: { width: 900, height: 480 }, reducedMotion: "reduce" });
const page = await context.newPage();
@@ -90,8 +92,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await browser.close();
});
await watchSettingsReads(page);
- await page.goto("http://magpie.test/?view=settings");
- await settingsDrawn(page); // rows found are the ones that stay (#1659)
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page); // on Codex's opened row, not in Settings (the owner, 10-20)
const row = page.locator("#codexDescriptionsRow");
const pick = page.locator("#codexDescriptionsPick button");
await pick.waitFor();
@@ -106,7 +108,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// moved the page would show
await wheelTo(page, pick, 200); // each wheel landed before the next (#2370)
const before = await view(page);
- assert(before > 0, "the settings list must scroll to the row");
+ assert(before > 0, "the agents list must scroll to the row");
// the app's menu: Codex's own and magpie's models
await pick.click();
diff --git a/internal/gui/tests/codex-memories-settings.test.cjs b/internal/gui/tests/codex-memories-settings.test.cjs
index 6e101ffc5..d23a38256 100644
--- a/internal/gui/tests/codex-memories-settings.test.cjs
+++ b/internal/gui/tests/codex-memories-settings.test.cjs
@@ -1,12 +1,13 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
-// Settings' "Codex memories model" (#985, Hu9956: the model Codex writes its
+// Codex's "Codex memories model" (#985, Hu9956: the model Codex writes its
// memories with was only the notebook square on Codex's card, beside the
-// subagent squares, and wasn't found). The row sits under "Codex auto-review
+// subagent squares, and wasn't found), in its settings on its opened row
+// (Settings had them till the owner, 10-20). The row sits under "Codex auto-review
// model" with its name alone (1ooogle on X); unset it is
// Codex's own pick. It opens the app's model picker (no native select), and
// a pick posts Codex's memories field as the card's square does: the square
// lights with it, and Default picked on the square puts the row back. No
-// Codex with the field: no row. The square's label names it. No click
+// Codex with the field: no row, and Claude Code's settings haven't it. The square's label names it. No click
// scrolls the page. Chromium and WebKit, en/zh/ja/de, 440px and wide; no
// backend, the API is faked here.
const assert = require("node:assert/strict");
@@ -14,7 +15,7 @@ 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 { watchSettingsReads, openAgentSettings, reach } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const models = [{ value: "gpt-5.5", label: "GPT-5.5", ref: "openai/gpt-5.5" }, { value: "gpt-5.4-mini", label: "GPT-5.4 mini", ref: "openai/gpt-5.4-mini" }];
@@ -25,7 +26,7 @@ const agents = (codex) => codex ? [{
{ key: "subagent", label: "subagents", value: "", options: models },
{ key: "memories", label: "memories", value: "", options: models },
],
-}] : [{ id: "claude", name: "Claude Code", path: "/test/settings.json", icon: "claude-color", fields: [{ key: "model", label: "model", value: "", options: [] }] }];
+}] : [{ id: "claude", name: "Claude Code", path: "/test/settings.json", icon: "claude-color", wired: true, fields: [{ key: "model", label: "model", value: "relay/m1", options: [{ value: "relay/m1", label: "m1", ref: "relay/m1" }] }] }];
const settings = (lang) => ({
theme: "light", lang, tray: "panel", quotaLeft: false, currency: "usd",
@@ -77,12 +78,12 @@ const W = {
ja: { name: "Codex メモリ整理のモデル", own: null, square: null, def: null },
de: { name: "Codex-Modell für Erinnerungen", own: null, square: null, def: null },
};
-const view = (page) => page.locator("#view-settings").evaluate((v) => v.scrollTop);
+const view = (page) => page.locator("#view-agents").evaluate((v) => v.scrollTop);
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const width of [440, 1100]) {
for (const lang of ["en", "zh", "ja", "de"]) {
- test(`${engine} ${width}px ${lang}: Settings picks the model Codex writes its memories with, the card's square in step`, async (t) => {
+ test(`${engine} ${width}px ${lang}: Codex's settings pick the model it writes its memories with, the card's square in step`, async (t) => {
const w = W[lang];
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
const context = await browser.newContext({ viewport: { width, height: 520 }, reducedMotion: "reduce" });
@@ -99,8 +100,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await browser.close();
});
await watchSettingsReads(page);
- await page.goto("http://magpie.test/?view=settings");
- await settingsDrawn(page); // rows found are the ones that stay (#1659)
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page);
const row = page.locator("#codexMemoriesRow");
const pick = page.locator("#codexMemoriesPick button");
await pick.waitFor();
@@ -122,12 +123,12 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// scrolled by a wheel till the row is mid-view, so a click that
// moved the page would show
- const box = await page.locator("#view-settings").boundingBox();
+ const box = await page.locator("#view-agents").boundingBox();
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
const top = () => pick.evaluate((e) => e.getBoundingClientRect().top);
for (let i = 0; i < 60 && (await top()) > 200; i++) { await page.mouse.wheel(0, 100); await page.waitForTimeout(30); }
const before = await view(page);
- assert(before > 0, "the settings list must scroll to the row");
+ assert(before > 0, "the agents list must scroll to the row");
// the app's model picker, Default first
await pick.click();
@@ -142,23 +143,22 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.waitForTimeout(300);
assert.equal(await view(page), before, "picking a model scrolled the page");
- // the card's square is the same setting, and says what it is
- await page.evaluate(() => show("agents"));
+ // the card's square, on the same opened row, is the same setting,
+ // and says what it is
const codex = '.row.agent[data-id="codex"]';
- await page.locator(`${codex} .ag-link`).click();
const square = page.locator(`${codex} .extras-cell .field.extra.set[data-key="memories"]`);
await square.waitFor();
if (w.square) assert.equal(await square.getAttribute("aria-label"), w.square);
assert.equal(await square.getAttribute("title"), await square.getAttribute("aria-label"));
assert((await square.getAttribute("title")).startsWith(w.name), "the square's tooltip names it");
+ await reach(page, square);
await square.click();
await page.locator("#pop:not([hidden]) #list li").first().waitFor();
await page.locator("#pop #list li").first().click();
await page.waitForFunction(() => !document.querySelector('.row.agent[data-id="codex"] .field.extra.set[data-key="memories"]'));
assert.deepEqual(sets.at(-1), { agent: "codex", field: "memories", value: "" });
- // and Settings shows Codex's own again
- await page.evaluate(() => show("settings"));
+ // and the row shows Codex's own again
if (w.own) await page.locator("#codexMemoriesPick button", { hasText: w.own }).waitFor();
assert.equal(await row.locator(".sub").count(), 0);
assert.deepEqual(errors, []);
@@ -175,10 +175,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", server("en", [], false));
t.after(() => browser.close());
await watchSettingsReads(page);
- await page.goto("http://magpie.test/?view=settings");
- await settingsDrawn(page); // rows found are the ones that stay (#1659)
- await page.locator("#codexAutoReviewPick button").waitFor();
- await page.waitForTimeout(300);
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page, "claude");
+ await page.locator('.row.agent[data-id="claude"] .ag-prefs #fullContextRow').waitFor();
+ assert.equal(await page.locator(".ag-prefs .row.pref").count(), 1, "Claude Code's settings are Long conversations alone");
assert.equal(await page.locator("#codexMemoriesRow").isHidden(), true);
assert.deepEqual(errors, []);
});
diff --git a/internal/gui/tests/codex-predictions.test.cjs b/internal/gui/tests/codex-predictions.test.cjs
index 7045821da..6d1d73c7d 100644
--- a/internal/gui/tests/codex-predictions.test.cjs
+++ b/internal/gui/tests/codex-predictions.test.cjs
@@ -1,12 +1,12 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
-// Settings' "Codex composer predictions" (#1970, pluo): the Codex app's
+// Codex's "Codex composer predictions" (#1970, pluo): the Codex app's
// guess at the user's next message, a hidden turn that reads the whole
// conversation again, goes where this says. By default Codex's own
// (ChatGPT); Off answers it with no prediction; the app's menu (no native
// select) offers magpie's models; a pick posts settings/codex-predictions
// on its own, the titles' and descriptions' settings untouched, its button
// shows the choice under a name with no line of its own (as its siblings,
-// 1ooogle on X), and no click scrolls the Settings page.
+// 1ooogle on X), and no click scrolls the Agents page, where Codex's row holds it.
// Five languages, 1100 and 420 wide, Chromium and WebKit; no backend, the
// API is faked here.
const assert = require("node:assert/strict");
@@ -14,7 +14,7 @@ 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 { watchSettingsReads, agentRow, openAgentSettings } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -43,7 +43,9 @@ function server(lang, posted) {
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:false};` });
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: { lang, theme: "light" }, fx: cur.fx });
+ // agents below Codex, so its opened row is not the list's end: a choice
+ // that rewraps its row at the very bottom must move the list
+ if (url.pathname === "/api/state") return json({ agents: [agentRow("codex", "Codex"), agentRow("claude", "Claude Code"), agentRow("pi", "Pi")], profiles: [], settings: { lang, theme: "light" }, fx: cur.fx });
if (url.pathname === "/api/settings/codex-predictions") {
const body = req.postDataJSON();
posted.push(["codex-predictions", body]);
@@ -75,12 +77,12 @@ const want = {
ja: { name: "Codex の入力予測", own: "Codex 自身(ChatGPT)", off: "オフ" },
de: { name: "Codex-Eingabevorhersagen", own: "Eigene von Codex (ChatGPT)", off: "Aus" },
};
-const view = (page) => page.locator("#view-settings").evaluate((v) => v.scrollTop);
+const view = (page) => page.locator("#view-agents").evaluate((v) => v.scrollTop);
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const width of [1100, 420]) {
for (const lang of Object.keys(want)) {
- test(`${engine} ${lang} ${width}: Codex's composer predictions go where Settings says`, async (t) => {
+ test(`${engine} ${lang} ${width}: Codex's composer predictions go where Codex's settings say`, async (t) => {
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
const context = await browser.newContext({ viewport: { width, height: 480 }, reducedMotion: "reduce" });
const page = await context.newPage();
@@ -96,8 +98,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await browser.close();
});
await watchSettingsReads(page);
- await page.goto("http://magpie.test/?view=settings");
- await settingsDrawn(page); // rows found are the ones that stay (#1659)
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page); // on Codex's opened row, not in Settings (the owner, 10-20)
const row = page.locator("#codexPredictionsRow");
const pick = page.locator("#codexPredictionsPick button");
const shows = (s) => page.locator("#codexPredictionsPick button", { hasText: s }).waitFor();
@@ -116,12 +118,12 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// scrolled by a wheel till the row is mid-view, so a click that
// moved the page would show
- const box = await page.locator("#view-settings").boundingBox();
+ const box = await page.locator("#view-agents").boundingBox();
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
const top = () => pick.evaluate((e) => e.getBoundingClientRect().top);
for (let i = 0; i < 80 && (await top()) > 200; i++) { await page.mouse.wheel(0, 100); await page.waitForTimeout(30); }
const before = await view(page);
- assert(before > 0, "the settings list must scroll to the row");
+ assert(before > 0, "the agents list must scroll to the row");
const pickItem = async (s) => {
await pick.click();
await page.locator("#pop:not([hidden]) #list li").first().waitFor();
diff --git a/internal/gui/tests/codex-subagents-lead.test.cjs b/internal/gui/tests/codex-subagents-lead.test.cjs
index c131e355c..4b1a8ca77 100644
--- a/internal/gui/tests/codex-subagents-lead.test.cjs
+++ b/internal/gui/tests/codex-subagents-lead.test.cjs
@@ -13,6 +13,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { reach } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const models = [{ value: "gpt-6.1-sol", label: "GPT-6.1 Sol", ref: "openai/gpt-6.1-sol" }, { value: "gpt-6-astra", label: "GPT-6 Astra", ref: "openai/gpt-6-astra" }];
@@ -105,11 +106,19 @@ for (const engine of engines) {
await browser.close();
});
await page.goto("http://magpie.test/");
- // a row's squares are in the row opened, one row open at a time
+ // a row's squares are in the row opened, one row open at a time; an
+ // opened Codex row holds Codex's own settings and is tall, so the link
+ // and the square are wheeled into sight
const open = async (id) => {
- const row = `.row.agent[data-id="${id}"]`;
- if (await page.locator(`${row} .ag-link`).getAttribute("aria-expanded") !== "true") await page.locator(`${row} .ag-link`).click();
+ const link = page.locator(`.row.agent[data-id="${id}"] .ag-link`);
+ if (await link.getAttribute("aria-expanded") !== "true") {
+ await page.waitForFunction(() => !document.getAnimations().length);
+ await reach(page, link);
+ await link.click();
+ }
await page.locator(square(id)).waitFor();
+ await page.waitForFunction(() => !document.getAnimations().length);
+ await reach(page, page.locator(square(id)));
};
await open("codex@wsl:Ubuntu");
assert.equal(await page.locator(square("codex@wsl:Ubuntu")).getAttribute("aria-label"), w.lead + "\n" + w.hint);
diff --git a/internal/gui/tests/codex-titles.test.cjs b/internal/gui/tests/codex-titles.test.cjs
index d6b991317..b6896d06c 100644
--- a/internal/gui/tests/codex-titles.test.cjs
+++ b/internal/gui/tests/codex-titles.test.cjs
@@ -1,17 +1,17 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
-// Settings' "Codex thread titles" (#705, DuGuaiYA: Codex's thread_title
+// Codex's "Codex thread titles" (#705, DuGuaiYA: Codex's thread_title
// requests go through its own ChatGPT sign-in even on magpie's models): by
// default Codex's own (ChatGPT); the app's menu (no native select) offers
// Off and magpie's models; a pick posts settings/codex-titles on its own,
// its button shows the choice under a name with no line of its own
-// (1ooogle on X), and no click scrolls the Settings page.
+// (1ooogle on X), and no click scrolls the Agents page, where Codex's row holds it.
// English and Chinese, Chromium and WebKit; no backend, 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, wheelTo } = require("./reader.cjs");
+const { watchSettingsReads, wheelTo, agentRow, openAgentSettings } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -40,7 +40,9 @@ function server(lang, posted) {
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:false};` });
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: { lang, theme: "light" }, fx: cur.fx });
+ // agents below Codex, so its opened row is not the list's end: a choice
+ // that rewraps its row at the very bottom must move the list
+ if (url.pathname === "/api/state") return json({ agents: [agentRow("codex", "Codex"), agentRow("claude", "Claude Code"), agentRow("pi", "Pi")], profiles: [], settings: { lang, theme: "light" }, fx: cur.fx });
if (url.pathname === "/api/settings/codex-titles") {
const body = req.postDataJSON();
posted.push(["codex-titles", body]);
@@ -69,11 +71,11 @@ const want = {
en: { name: "Codex thread titles", own: "Codex’s own (ChatGPT)", off: "Off" },
zh: { name: "Codex 会话标题", own: "Codex 自带(ChatGPT)", off: "关闭" },
};
-const view = (page) => page.locator("#view-settings").evaluate((v) => v.scrollTop);
+const view = (page) => page.locator("#view-agents").evaluate((v) => v.scrollTop);
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of ["en", "zh"]) {
- test(`${engine} ${lang}: Codex's title requests go where Settings says`, async (t) => {
+ test(`${engine} ${lang}: Codex's title requests go where Codex's settings say`, async (t) => {
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
const context = await browser.newContext({ viewport: { width: 900, height: 480 }, reducedMotion: "reduce" });
const page = await context.newPage();
@@ -89,8 +91,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await browser.close();
});
await watchSettingsReads(page);
- await page.goto("http://magpie.test/?view=settings");
- await settingsDrawn(page); // rows found are the ones that stay (#1659)
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page); // on Codex's opened row, not in Settings (the owner, 10-20)
const row = page.locator("#codexTitlesRow");
const pick = page.locator("#codexTitlesPick button");
await pick.waitFor();
@@ -105,7 +107,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// moved the page would show
await wheelTo(page, pick, 200); // each wheel landed before the next (#2370)
const before = await view(page);
- assert(before > 0, "the settings list must scroll to the row");
+ assert(before > 0, "the agents list must scroll to the row");
// the app's menu: Codex's own, Off and magpie's models
await pick.click();
diff --git a/internal/gui/tests/compact-at.test.cjs b/internal/gui/tests/compact-at.test.cjs
index f199ac631..86b332c3b 100644
--- a/internal/gui/tests/compact-at.test.cjs
+++ b/internal/gui/tests/compact-at.test.cjs
@@ -4,7 +4,8 @@
// editor has Compact at beside Context window and Max output, in the same
// form: one size for all its models, model=size for one, shown as set,
// sent with the Save, a value that isn't a number of tokens refused before
-// anything is sent. Settings → Long conversations takes a size of its own
+// anything is sent. Long conversations, in Codex's and Claude Code's
+// settings on their opened rows (here Claude Code's), takes a size of its own
// beside Compact at / Full window; a typed size posts settings/full-context
// with it, and no click or typing scrolls the page.
// English and Chinese, Chromium and WebKit; no backend, the API is faked here.
@@ -13,6 +14,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { watchSettingsReads, agentRow, openAgentSettings } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -26,7 +28,7 @@ function serve(lang, posts) {
const json = (data) => route.fulfill({ json: data });
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:${JSON.stringify(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: { lang, theme: "light" } });
+ if (url.pathname === "/api/state") return json({ agents: [agentRow("claude", "Claude Code")], profiles: [], settings: { lang, theme: "light" } });
if (url.pathname === "/api/providers") return json(providers);
if (url.pathname === "/api/groups") return json({ groups: [], models: [] });
if (url.pathname.startsWith("/api/provider/")) {
@@ -71,6 +73,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const errors = [], posts = [];
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", serve(lang, posts));
+ await watchSettingsReads(page);
await page.goto(`http://magpie.test/?view=${view}`);
return { page, errors, posts };
};
@@ -103,7 +106,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
});
test(`${engine} ${lang}: Long conversations compacts at a size the user types`, async (t) => {
- const { page, errors, posts } = await open(t, "settings");
+ const { page, errors, posts } = await open(t, "agents");
+ await openAgentSettings(page, "claude");
const row = page.locator("#fullContextSegs");
const num = row.locator("input.compact-num");
await num.waitFor();
@@ -111,7 +115,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await row.locator("select").count(), 0, "no native select");
assert(await row.getByText(w.at("272K"), { exact: true }).isVisible(), "272K by default");
assert.equal(await num.inputValue(), "");
- const view = () => page.locator("#view-settings").evaluate((v) => v.scrollTop);
+ const view = () => page.locator("#view-agents").evaluate((v) => v.scrollTop);
const before = await view();
await num.fill("lots");
await num.press("Enter");
diff --git a/internal/gui/tests/gateway-mode.test.cjs b/internal/gui/tests/gateway-mode.test.cjs
index 319ca9136..a15233b5d 100644
--- a/internal/gui/tests/gateway-mode.test.cjs
+++ b/internal/gui/tests/gateway-mode.test.cjs
@@ -3,9 +3,9 @@
// the gateway for other computers' agents. boot.js says so and the page
// opens on Providers with no Agents or Library tab, an address
// kept for one of them opening Providers; Settings leaves out what is
-// written into this computer's agents' files (provider in model names,
-// Codex subagents, long conversations, Codex thread titles) and the
-// desktop's alerts, and General has the switch — Automatic, On, Off —
+// written into this computer's agents' files (provider in model names;
+// the Codex and Claude Code settings live on the Agents page, which is
+// gone) and the desktop's alerts, and General has the switch — Automatic, On, Off —
// saying why it is on. Off brings the tabs and the rows back at once, the
// Agents page opening again; Automatic takes them away again. magpie web
// not in gateway mode keeps every tab, and the switch is magpie web's
@@ -16,6 +16,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { watchSettingsReads, agentRow, openAgentSettings } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -34,7 +35,7 @@ function settingsPayload(over) {
}
// agents says whether magpie found agents here: Automatic is on without
-// notice is Settings' warning for the Codex subagents row, when the answer
+// notice is the warning on Codex's subagents row, when the answer
// carries one
function server(lang, posts, { web = true, gateway = true, agents = false, notice } = {}) {
const why = (mode) => (mode === "on" || mode === "off" ? mode : agents ? "" : "no-agents");
@@ -45,7 +46,7 @@ function server(lang, posts, { web = true, gateway = true, agents = false, notic
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:${web}${web && 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: [], profiles: [], settings: { lang, theme: "light" }, fx: cur.fx });
+ if (url.pathname === "/api/state") return json({ agents: agents ? [agentRow("codex", "Codex")] : [], profiles: [], settings: { lang, theme: "light" }, fx: cur.fx });
if (url.pathname === "/api/settings/gateway-mode") {
const { mode } = req.postDataJSON();
posts.push(["gateway-mode", mode]);
@@ -72,7 +73,8 @@ function server(lang, posts, { web = true, gateway = true, agents = false, notic
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)];
- await route.fulfill({ body: await fs.readFile(file), contentType });
+ try { await route.fulfill({ body: await fs.readFile(file), contentType }); }
+ catch { await route.fulfill({ status: 404, body: "" }); }
};
}
@@ -88,7 +90,7 @@ const KEPT = ["sessions", "providers", "routing", "gateway", "usage", "plugins"]
const tabs = (page) => page.evaluate(() => [...document.querySelectorAll("#nav button[data-view]")].filter((b) => !b.hidden && b.offsetParent).map((b) => b.dataset.view));
const viewShown = (page) => page.evaluate(() => [...document.querySelectorAll("main.view")].filter((v) => !v.hidden).map((v) => v.id));
// the rows gateway mode leaves out of Settings, each shown or not
-const agentRows = (page) => page.evaluate(() => ["#plainNamesSegs", "#codexAgentsV1Segs", "#fullContextSegs", "#codexTitlesPick", "#codexAutoReviewPick", "#usageAlertSegs", "#balanceAlertSegs", "#resetReminderSegs", "#turnDoneSegs"]
+const agentRows = (page) => page.evaluate(() => ["#plainNamesSegs", "#usageAlertSegs", "#balanceAlertSegs", "#resetReminderSegs", "#turnDoneSegs"]
.map((s) => !document.querySelector(s).closest(".row").hidden));
async function noSelectNoBorder(page, where) {
@@ -145,7 +147,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal((await page.locator("#gatewayModeRow .name").textContent()).trim(), L[lang].mode, where);
assert.match(await page.locator("#gatewayModeSub").textContent(), new RegExp(L[lang].noAgents), where);
assert.equal(await page.locator("#gatewayModeSegs .opt.on").evaluate((b) => [...b.parentElement.children].filter((x) => x.matches(".opt")).indexOf(b)), 0, `${where}: Automatic picked`);
- assert.deepEqual(await agentRows(page), [false, false, false, false, false, false, false, false, false], `${where}: agents' rows in gateway mode`);
+ assert.deepEqual(await agentRows(page), [false, false, false, false, false], `${where}: agents' rows in gateway mode`);
await noSelectNoBorder(page, where);
// Off: the tabs and the rows are back, Settings stays open
@@ -154,7 +156,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.deepEqual(posts.filter((p) => p[0] === "gateway-mode"), [["gateway-mode", "off"]], where);
assert.deepEqual(await tabs(page), ["agents", "sessions", "library", "providers", "routing", "gateway", "usage", "plugins"], `${where}: off`);
assert.deepEqual(await viewShown(page), ["view-settings"], `${where}: Settings stays`);
- assert.deepEqual(await agentRows(page), [true, true, true, true, true, true, true, true, true], `${where}: rows back`);
+ assert.deepEqual(await agentRows(page), [true, true, true, true, true], `${where}: rows back`);
assert.doesNotMatch(await page.locator("#gatewayModeSub").textContent(), new RegExp(L[lang].noAgents), where);
await clickStill(page, '#nav button[data-view="agents"]', `${where}: Agents`);
assert.deepEqual(await viewShown(page), ["view-agents"], `${where}: the Agents page opens`);
@@ -165,7 +167,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.waitForFunction(() => document.querySelector('#nav button[data-view="agents"]').hidden);
assert.deepEqual(posts.filter((p) => p[0] === "gateway-mode").at(-1), ["gateway-mode", ""], where);
assert.deepEqual(await tabs(page), KEPT, `${where}: automatic`);
- assert.deepEqual(await agentRows(page), [false, false, false, false, false, false, false, false, false], where);
+ assert.deepEqual(await agentRows(page), [false, false, false, false, false], where);
// the Settings page's own saves never send it
assert.ok(posts.filter((p) => p[0] === "settings").every((p) => !("gatewayMode" in p[1])), where);
assert.deepEqual(errors, [], where);
@@ -198,7 +200,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
});
}
-// Settings' Codex subagents row carries the warning element
+// Codex's settings (its opened row on the Agents page) carry the subagents
+// row's the warning element
// #codexAgentsV1Warn: with `notice` in the settings answer it shows the text
// (translated), without one it stays hidden. magpie writes nothing here — the
// user turns Codex's own multi_agent_v2 off themselves (#141, #1028 review).
@@ -218,9 +221,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// window mode: the gateway switch is the web's alone, so the agents' rows
// are shown and the warning row is rendered here
await page.route("**/*", server("en", posts, { web: false, gateway: false, agents: true, notice: withNotice ? notice : undefined }));
- await page.goto("http://magpie.test/");
- await page.waitForSelector("#nav button.on");
- await page.locator("#prefs").click();
+ await watchSettingsReads(page);
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page);
await page.locator("#codexAgentsV1Segs .opt").first().waitFor();
const warn = page.locator("#codexAgentsV1Warn");
assert.equal(await warn.isVisible(), withNotice, `${where}: the warning row`);
@@ -241,9 +244,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await on.click();
await page.waitForFunction(() => !document.querySelector("#codexAgentsV1Warn").hidden);
assert.deepEqual(posts.filter((p) => p[0] === "codex-agents-v1").slice(-1), [["codex-agents-v1", true]], `${where}: the on post`);
- // a reload restores the Settings view from the URL, and the settings
- // answer still carries the warning
+ // after a reload Codex's settings, opened again, still carry the
+ // warning
await page.reload();
+ await openAgentSettings(page);
await page.locator("#codexAgentsV1Segs .opt").first().waitFor();
assert.equal(await page.locator("#codexAgentsV1Warn").isVisible(), true, `${where}: back after a reload`);
}
@@ -267,9 +271,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const errors = [];
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", server(lang, [], { web: false, gateway: false, agents: true, notice: warning + " " + restart }));
- await page.goto("http://magpie.test/");
- await page.waitForSelector("#nav button.on");
- await page.locator("#prefs").click();
+ await watchSettingsReads(page);
+ await page.goto("http://magpie.test/?view=agents");
+ await openAgentSettings(page);
await page.locator("#codexAgentsV1Segs .opt").first().waitFor();
const warn = page.locator("#codexAgentsV1Warn");
assert.equal(await warn.isVisible(), true, `${engine} ${lang}: the warning row`);
diff --git a/internal/gui/tests/login-allow.test.cjs b/internal/gui/tests/login-allow.test.cjs
index ee45e5b74..03292e8ce 100644
--- a/internal/gui/tests/login-allow.test.cjs
+++ b/internal/gui/tests/login-allow.test.cjs
@@ -16,7 +16,7 @@ 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 { watchSettingsReads, settingsDrawn, reach } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const loginItems = "x-apple.systempreferences:com.apple.LoginItems-Settings.extension";
@@ -100,13 +100,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// scrolled to as a reader would, with the wheel, once the page has come
// in (it comes in animated: a place read mid-way isn't where it rests)
await page.evaluate(() => Promise.all(document.getAnimations().map((a) => a.finished.catch(() => {}))));
- let b = await open.boundingBox();
- for (let i = 0; i < 40 && b.y + b.height > page.viewportSize().height; i++) {
- await page.mouse.move(width / 2, 300);
- await page.mouse.wheel(0, 200);
- await page.waitForTimeout(50);
- b = await open.boundingBox();
- }
+ // (reach waits for each wheel's scroll to land and for the button to be
+ // the thing under the pointer: a fixed pause read a stale place, and
+ // the click landed beside it)
+ await reach(page, open);
+ const b = await open.boundingBox();
await page.mouse.click(b.x + b.width / 2, b.y + b.height / 2);
for (let i = 0; i < 50 && !opened.length; i++) await page.waitForTimeout(50);
assert.deepEqual(opened, [loginItems]);
diff --git a/internal/gui/tests/mobile-web.test.cjs b/internal/gui/tests/mobile-web.test.cjs
index 1b73f3f93..46016de93 100644
--- a/internal/gui/tests/mobile-web.test.cjs
+++ b/internal/gui/tests/mobile-web.test.cjs
@@ -13,6 +13,7 @@ const path = require("node:path");
const { execFileSync } = require("node:child_process");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { reach } = require("./reader.cjs");
const { PNG } = require("playwright-core/lib/utilsBundle");
const assets = path.resolve(__dirname, "../assets");
@@ -183,7 +184,10 @@ async function agentsFit(page) {
for (const agent of agentRows) {
const row = page.locator(`.row.agent[data-id="${agent.id}"]`);
await row.waitFor();
- // opened, its pickers in the row
+ // opened, its pickers in the row; the last row opened can push this one
+ // out of sight, so it is wheeled to once that one has slid open
+ await page.waitForFunction(() => !document.getAnimations().length);
+ await reach(page, row.locator(".ag-link"));
await row.locator(".ag-link").click();
await row.locator(".ag-exp").waitFor();
const bad = await row.evaluate(row => {
@@ -201,11 +205,21 @@ async function agentsFit(page) {
// Code's tiers do (#1397, fc5dfa3c): it opens their menu
const keys = [...new Set(agent.fields.map((f) => agent.id === "omp" && OMP_ROLES.includes(f.label) ? "tiers" : f.key))];
for (const key of keys) {
- await row.locator(`.field[data-key="${key}"]`).click();
- await page.locator("#pop").waitFor();
+ try {
+ const field = row.locator(`.field[data-key="${key}"]`);
+ await page.waitForFunction(() => !document.getAnimations().length);
+ await reach(page, field);
+ await field.click();
+ await page.locator("#pop").waitFor();
+ } catch (e) { throw new Error(`${agent.id} ${key} open: ${e.message.split("\n")[0]}`); }
assert.equal(await page.locator("#pop").isVisible(), true, agent.name + ": " + key + " opens");
- await page.locator('#nav [data-view="agents"]').click();
- await page.locator("#pop").waitFor({ state: "hidden" });
+ // shut by a tap on the header's name: a picker opened low in a tall
+ // row (Codex's holds its own settings) can cover the phone's tab bar,
+ // and the page's lead line can be scrolled under the header's tabs
+ const brand = await page.locator("header.top .brand").boundingBox();
+ await page.mouse.click(brand.x + brand.width / 2, brand.y + brand.height / 2);
+ try { await page.locator("#pop").waitFor({ state: "hidden" }); }
+ catch (e) { throw new Error(`${agent.id} ${key} shut: ${e.message.split("\n")[0]}`); }
}
}
}
diff --git a/internal/gui/tests/panel-effort.test.cjs b/internal/gui/tests/panel-effort.test.cjs
index af1d902bc..0a92a3a93 100644
--- a/internal/gui/tests/panel-effort.test.cjs
+++ b/internal/gui/tests/panel-effort.test.cjs
@@ -16,6 +16,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { reach } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const levels = ["minimal", "low", "medium", "high", "xhigh", "max"].map((value) => ({ value }));
@@ -136,8 +137,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
for (const id of ids) {
// Hermes picks no model once started: its pickers stay in the row
const more = page.locator(`${row(id)} .ag-link`);
- // the one open slides shut before this one opens
- if (await more.count()) { await more.click(); await page.locator(`${row(id)} .ag-exp`).waitFor(); }
+ // the one open slides shut before this one opens; Codex's opened row
+ // holds its own settings, so the next row is wheeled into sight once
+ // it has slid open
+ if (await more.count()) {
+ await page.waitForFunction(() => !document.getAnimations().length);
+ await reach(page, more);
+ await more.click();
+ await page.locator(`${row(id)} .ag-exp`).waitFor();
+ }
icons.push(await lit(page, id));
}
const panel = await load("en", [], "http://magpie.test/?mode=panel");
diff --git a/internal/gui/tests/reader.cjs b/internal/gui/tests/reader.cjs
index c2b45ac74..e66db3a14 100644
--- a/internal/gui/tests/reader.cjs
+++ b/internal/gui/tests/reader.cjs
@@ -137,4 +137,17 @@ async function openPart(page, id) {
await page.locator(`:is(#setTab-${id}, .nav-s[data-of=setTab-${id}]):visible`).press("Enter");
}
-module.exports = { inView, reach, wheelTo, click, openPart, watchSettingsReads, settingsDrawn };
+// agentRow is a connected agent as /api/state lists it, opened by its
+// Details; openAgentSettings opens it on the Agents page, where its own
+// settings are (Settings had them till the owner, 10-20), and waits till
+// they are read and drawn. Watch the settings reads first.
+const agentRow = (id, name) => ({ id, name, icon: id, wired: true, fields: [{ key: "model", label: "model", value: "relay/m1", options: [{ value: "relay/m1", label: "m1", ref: "relay/m1" }] }] });
+async function openAgentSettings(page, id = "codex") {
+ const link = page.locator(`.row.agent[data-id="${id}"] .ag-link`);
+ await reach(page, link);
+ await link.click();
+ await page.locator(`.row.agent[data-id="${id}"] .ag-prefs`).waitFor();
+ await page.waitForFunction(() => __settingsReads.asked > 0 && __settingsReads.asked === __settingsReads.drawn);
+}
+
+module.exports = { inView, reach, wheelTo, click, openPart, watchSettingsReads, settingsDrawn, agentRow, openAgentSettings };
diff --git a/internal/gui/tests/segs-press-redraw.test.cjs b/internal/gui/tests/segs-press-redraw.test.cjs
index f0d998cb7..d6766263c 100644
--- a/internal/gui/tests/segs-press-redraw.test.cjs
+++ b/internal/gui/tests/segs-press-redraw.test.cjs
@@ -14,7 +14,7 @@ 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 { watchSettingsReads, settingsDrawn, reach } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const words = { en: { on: "On", off: "Off" }, zh: { on: "开启", off: "关闭" }, ja: { on: "オン", off: "オフ" }, de: { on: "An", off: "Aus" } };
@@ -229,7 +229,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await settle(page);
if (tab === "usage") {
for (const id of ["codex", "claude", "wb", "trae", "minimax", "qoder", "plugins"]) {
- await page.locator("#warmTab-" + id).click();
+ // the last sweep can leave the tabs above or below the view (a
+ // narrow window scrolls them sideways, which the click does)
+ const warm = page.locator("#warmTab-" + id);
+ const away = await warm.evaluate((e) => {
+ const b = e.getBoundingClientRect(), v = e.closest(".view").getBoundingClientRect();
+ return b.top < v.top || b.bottom > v.bottom;
+ });
+ if (away) await reach(page, page.locator("#warmTabs"));
+ await warm.click();
await sweep(tab);
}
} else if (tab === "sync") {
diff --git a/internal/gui/tests/settings-general.test.cjs b/internal/gui/tests/settings-general.test.cjs
index b5ccec160..cc7e8cdc5 100644
--- a/internal/gui/tests/settings-general.test.cjs
+++ b/internal/gui/tests/settings-general.test.cjs
@@ -7,6 +7,8 @@
// rows show only there), with the API faked:
// - the rows whose names say enough have no line under them, and the lines
// kept are each one line, not cut short on a wide window;
+// - Codex's and Claude Code's own settings aren't here: they are on the
+// agents' rows (the owner, 10-20);
// - Language is a button (never a native <select>) showing the language;
// its menu, the app's own, lists all six, and a pick saves lang and
// draws the page in it, the button staying under the pointer;
@@ -23,9 +25,9 @@ const names = { en: "English", zh: "简体中文", "zh-TW": "繁體中文", ja:
const appearance = { en: "Appearance", zh: "外观", "zh-TW": "外觀", ja: "外観", de: "Darstellung" };
const system = { en: "System", zh: "跟随系统", "zh-TW": "跟隨系統", ja: "システム", de: "System" };
// the rows whose name says enough, found by the control they hold
-const bare = ["#themeSegs", "#colorblindSegs", "#langPick", "#textSizeSegs", "#traySegs", "#plainNamesSegs", "#codexTitlesPick", "#codexAutoReviewPick", "#loginSegs", "#dockSegs"];
+const bare = ["#themeSegs", "#colorblindSegs", "#langPick", "#textSizeSegs", "#traySegs", "#plainNamesSegs", "#loginSegs", "#dockSegs"];
// the rows that keep a line, one each
-const kept = ["#fullContextSegs", "#lightweightSegs", "#keepAwakeSegs", "#sessionTerminalRow .sess-pick"];
+const kept = ["#lightweightSegs", "#keepAwakeSegs", "#sessionTerminalRow .sess-pick"];
function serve(lang, posted, st) {
const settings = () => ({ lang, theme: "light", searchVendors: [], searchAPIs: [], ...st });
@@ -84,6 +86,7 @@ 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");
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)}`);