Commit Graph
400 Commits
Author SHA1 Message Date
yetone 1bd1a08a3a mcpauth: a server never reached says it is the network, and is asked twice (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS on X clicked Sign in on the Library's Notion server
(https://mcp.notion.com/mcp) and got "couldn't reach mcp.notion.com: Post
"https://mcp.notion.com/mcp": EOF", then asked whether the server supports
sign-in at all. It does (Notion answers 401 with OAuth metadata, checked
with curl from here); the first request's connection was cut on their
side of the network.

- discover asks the initialize probe once more when it gets no answer:
  Go never sends a POST again by itself, so a kept-alive connection that
  a proxy or the server closed reads EOF and failed the sign-in.
- The failure is mcpauth.UnreachableError, with the host and the proxy
  the request went through (redacted) or none. api.go says it with an
  i18n key (unreachableSaid): the network, not the server's sign-in, with
  the way it went and what to do, Go's words kept in brackets. zh,
  zh-TW, ja, de.

Run at this head's tree on mica (mote at load 33):
- go test ./internal/mcpauth/ ./internal/gui/ ./internal/library/: ok
- go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet on
  internal/mcpauth and internal/gui: ok
- GUI: mcp-*.test.cjs, i18n-*.test.cjs, signin-browser-down: 328/328,
  Chromium and WebKit; mcp-signin gains the direct and proxy cases in en
  and zh.
Broken by hand: without the second ask, TestSignInAsksAgainAfterACut
Connection and TestSignInUnreachableSaysTheWay/direct go red, the first
with exactly the reporter's message.
Rebased on f6a538ece (also i18n.js): go test -run Budget|I18n
./internal/gui/ and i18n-keys, mcp-signin, image-resolution GUI
(32/32) run again at this head on mica: ok.
Not tried: a real cut connection to mcp.notion.com from the reporter's
network; the full Go and GUI suites.
2026-11-19 00:32:47 +08:00
yetone 74bba1fa67 gui: Settings › Version and the tray restart magpie with no update (yansheng1003 on X)
yansheng1003 asked for a Restart beside Check: "每次改了需要重新magpie,
都要自己退出再启动麻烦". The Version row now has Restart after Check
while no update is on offer (found, downloading, downloaded, blocked, a
newer version named or a failed download each have their own buttons,
which restart through the update and fill a 420px row), and the tray's
Restart magpie is always shown:
with an update ready it installs it as before, with none it starts this
magpie again as it is.

Both go through restartSelfNow (restart.go), the updater's own way of
starting again: on macOS and Linux the gateway's socket is handed over
(beginHandover), so requests in flight carry on; otherwise the bundle or
binary is started again (update.Relaunch, relaunchBinary), and on
Windows requests in flight are cut. magpie web runs itself again in
place. POST /api/restart answers 204 and then quits, or 400 "magpie
couldn't start again: quit it and open it again", and the row says
Couldn't restart magpie with the reason and gives its buttons back.
/api/update now says its run (the time this process started), so a
browser's page reloads once another run answers.

The click, its error and the reload are in versionrow.js, imported when
Restart is pressed. The mirror's Download from GitHub click moved there
too, so app.js stays under its budget with no raise (TestCoreScriptBudget
at 1,088,248 and 1,272,581, as they were). The route is named in the
CLI's notYet list. Words in en, zh, zh-TW, ja and de.

What needed a restart before, besides an edited path plugin (the commit
before): most settings already applied live (proxies, OTel, HTTPS/mTLS,
LAN from the GUI, allow-lists, CORS, shortcuts, tray, language, name,
fonts, port, hand-edited caller-keys, oidc-rules and library.json).
Still start-only: LAN switched by hand in settings.json, environment
variables, and in-memory routing state such as a rate-limited account's
order; Restart is for those.

Run:
- Full Go suite (mote, -timeout 45m) at the head before the rebase and
  before versionrow.js: 101 packages ok; the reds were
  TestEveryRouteHasACommandOrIsNamed, TestEveryRouteIsNamedForTheCLI
  (the route unnamed) and TestCoreScriptBudget, all fixed here.
- At this head (mote): go test ./internal/gui -run
  'TestCoreScriptBudget|TestEveryRouteIsNamedForTheCLI|TestRestart|
  TestUpdateSaysItsRun|TestTrayMenu' ok; ./internal/cli -run
  TestEveryRouteHasACommandOrIsNamed ok. go build, go vet, GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./... ok; gofmt -l
  clean.
- GUI (mote, both engines, at this tree): update-*.test.cjs,
  version-restart, settings-update-source, refresh-page, old-webkit,
  i18n-keys and i18n-en-no-cjk: 628 pass, then 6 red in update-check
  (Restart not dimmed while a check runs), fixed here (Restart dims
  with Check); update-check, version-restart and old-webkit again: 90
  pass, 0 fail.
- Real restart (mote, sandbox HOME): a built magpie web with
  MAGPIE_WEB_KEY, signed in through ?k=; POST /api/restart answered 204,
  the same pid ran again with a new run, and the cookie still signed in.
- Broken by hand: restartAppFrom returning true on an error, and
  TestRestartStartsMagpieAgain is red; version-restart.test.cjs on the
  old app.js is red (21 on chromium); with Restart shown beside an
  update on offer again, "no Restart beside an update on offer" is red
  in all 5 languages and both engines (12 fails).
- The whole GUI suite is still running on mica at push time; its reds
  are compared against origin/main and fixed or filed after.

Not tried: the tray item and a restart in the real macOS, Windows and
Linux apps (only magpie web was restarted for real).
2026-11-18 12:58:38 +08:00
yetone ba3a25421b gui: /api/state sends no saved proxy password, LAN key, Bark key or GitHub token
/api/settings strips these (settingsState), but /api/state, which the
window polls after nearly every click, sent settings.Shared() whole, so
every saved proxy's password and key, the old LAN key, the Bark key and
the GitHub token went with it. /api/state?last=1 (the start's read of
the last state) put settings.Load() in whole too. Both now go through
stateSettings. The page reads none of these from the state (grep of
assets: no .lanKey, .barkKey or .githubToken, and saved proxies come
from /api/settings). The kept state file never held settings
(keptFile empties them), so nothing on disk needs rewriting.

Found while writing the saved-proxy Test: a probe of /api/state carried
a saved proxy's password.

TestLastKnownState used the GitHub token as its mark of today's
settings; the theme is that mark now, and the test asks that the token
is not sent.

Run (at this head's tree):
- mote: go test ./internal/gui -count=1 -timeout 45m: ok (182.9s).
- mote: TestStateSendsNoCredentials and TestLastKnownState -race ok.
- Broken by hand: stateSettings' strip commented out, TestStateSends
  NoCredentials red on all four secrets in /api/state and ?last=1.
- mote: Linux and Windows go vet ./... ok; gofmt -l clean.
2026-11-18 06:42:01 +08:00
yetone b2b3d488c1 settings: an SSH server as a saved proxy, and a failed proxy says why
@laiuuui on X (tweet 2122704105005314155) was told to put Gemini behind
a proxy in a supported region. Their VPSes give only SSH (address, port,
password or key), and every http:// proxy they added failed with Go's
words alone.

A saved proxy can now be an SSH server. Settings > Network > Add proxy
has Proxy | SSH; SSH asks for the server, the user and the password, and
Advanced (closed) holds a private key and the trusted host key. magpie
logs in itself with golang.org/x/crypto/ssh (no ssh command) and resolves
the @id to a SOCKS5 server of its own on loopback, which takes only its
own random login and carries each CONNECT as a direct-tcpip channel, as
ssh -D does: lazy login, keepalive@openssh.com every 20s, one re-login
when a channel finds the connection dead.
- Save logs in first: a refused login is said there and nothing is kept.
- The host key is trusted on first use, kept in authorized_keys form and
  shown as its SHA256 fingerprint; another key is refused
  (HostKeyChangedError, both fingerprints said) until Trust a new key.
- The key is a secret like the password: left out of backups and
  syncs without keys, kept on a sync that has none.
- ssh:// typed as a plain address is refused: its login goes with a
  saved proxy.

A failed proxy says why (netproxy.Why: an English template the page
translates in all five languages, Go's words after it): an SSH server
typed as http:// or socks5:// ("is an SSH server, not a proxy: add it as
SSH"), a refused login, keyboard-interactive refused (OpenSSH without
PAM, "unexpected message type 51"), nothing listening, not SSH, TLS on a
plain proxy, 407, timeouts, hangups, and a server that logs in but won't
forward (AllowTcpForwarding no, or macOS 27's sshd, which hangs up on
every forward, OpenSSH's own ssh -W too). A check the user asks for
reads the server's first bytes when Go's text can't tell: Go reads a
real OpenSSH banner ("SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.20") as an
HTTP status line with a malformed code, and an SSH server's banner can
reach Go's transport before its request goes out
("readLoopPeekFailLocked", found red 1 of 20 on mica, then 40 of 40
green). Each save is tested at once.

app.js keeps one line (api() hands a proxy_why reply to proxies.js,
where proxyWhy now lives); both script budgets are raised by that line's
52/54 bytes, with the reason in core_budget_test.go.

Run (mica, at this head on origin/main 81c666e1c):
- go test -tags nogui ./internal/netproxy/... ./internal/settings/
  ./internal/davsync/ ./internal/gui/ ./internal/provider/
  ./internal/backup/...: ok
- GOOS=linux and GOOS=windows go vet of netproxy, settings, gui; gofmt -l
  internal: clean
- GUI, chromium and webkit, en/zh/zh-TW/ja/de, 1100 and 420px:
  saved-ssh-proxy, saved-proxies, i18n-keys, provider-proxy-missing:
  64/64
- Tests use netproxy/sshtest, an SSH server on loopback that answers
  channels itself; nothing reaches the network.

Broken by hand, each red: accepting any host key
(TestSSHProxyRefusesAChangedHostKey); no login check on the SOCKS end
(TestSSHProxyLocalEndNeedsItsLogin); no SSH banner case and no banner
probe (TestProxyFailureNamesAnSSHServer, its OpenSSH-banner case); no
type-51 case (TestSSHProxySaysWhyItFailed, keyboard-interactive); no
code 2 for a hangup (TestSavedSSHProxyThatWontForward, both cases);
api() not handing proxy_why to proxies.js (saved-ssh-proxy, 20 of 20
cases red: err.why is already a failed move's reason).

Real use: Ubuntu 24.04 OpenSSH_9.6p1 (WSL magpie-desktop, a user sshd
on loopback, key login): the host key was learned, a Cloudflare trace
through the tunnel came back ip=104.194.93.45 loc=US, a wrong password
said "turned the login away", a changed host key said both
fingerprints, and http:// and socks5:// pointed at the sshd both said
"is an SSH server". mote's and mica's sshd (macOS 27, OpenSSH 10.5 and
10.3) log in and refuse every forward, now said as "won't forward
connections".

Not tried: a password login against a real sshd (the user sshd had no
shadow access), a real VPS, and the full go test ./... and full GUI
suite: both mote and mica were running other sessions' GUI suites the
whole time.
2026-11-18 01:01:30 +08:00
yetone 5bfa57e3d3 usage: check one model on one provider with a few fixed-answer calls, kept beside the other providers
skingstyle48487 on X runs more than ten relays and asked for something
like the "pelican test" to spot one that waters a model down. In a
follow-up (2122694296054972815) they said speed, failures and the model's
name show whether a relay is fast and stable, not whether the model got
weaker. They asked for small tests with known answers, the share of right
answers and of right tool calls, and relays compared side by side.

On Usage › Requests › Model speed › Providers, each row has a Check… that
opens a dialog. Opening it sends nothing; only its Check makes the calls.
POST /api/relay-check (gateway.CheckRelay) makes 6 small streamed Chat
Completions calls through the gateway, pinned to provider/model as an
agent would, three at a time:
- write 1 to 40;
- 1234 × 5678, 987 × 654 and 2468 × 1357;
- weather in Paris and time in Tokyo, each call offering both tools,
  so the right one has to be picked.

Each part says what it found, never a verdict on the provider:
- whether the answer was the expected one, and what came back;
- the model the reply named, when the ledger would call it another
  model (usage.Swapped, not SameSpelled or ListedAs);
- the provider that answered, when the call was handed on;
- how many input tokens the 118-character prompt was counted as;
- first token, tok/s and the whole time.

The dialog heads the parts with "Answers right: n of m" and "Right tool
calls: n of m". The numbers come from the gateway's own usage records (a
tap in appendUsage keyed on the request's context), not from each
protocol's reply. The tally of each provider's last check is kept in the
window's storage. The Providers table then shows Answers and Tool calls
columns: sortable, amber when short of all, a dash for providers not
checked, so relays are compared side by side. The dialog code is a
lazily loaded root script (relaycheck.js), as app.js has no room left.

Run, at this head:
- mote: go test -timeout 45m ./internal/gateway ./internal/gui
  ./internal/cli ./internal/usage: ok (the full ./... suite passed at
  41d88731c, before the fixed-answer calls; mote and mica were each
  running another session's GUI suite at this head);
- gofmt -l, GOOS=linux go vet -tags nogui ./... and GOOS=windows go
  vet ./...: clean;
- go test -run 'CheckRelay|ReadChatStream' -v ./internal/gateway
  (5 tests pass);
- usage-model-speed.test.cjs, chromium and webkit, en, zh, zh-TW, ja and
  de at 400px: 12/12;
- i18n-keys and old-webkit: their only reds are the three on origin/main,
  each filed (#6877 ", with an image", #5919 :has(), #6030
  headerpresets.js);
- TestCoreScriptBudget and the app.js budget: ok, not raised.
Broken by hand:
- taking tapUsage out of appendUsage turns TestCheckRelayAnsweredAsAsked
  and TestCheckRelaySaysWhatDiffers red;
- dropping the tool-name check turns TestCheckRelayCountsEachAnswer red
  (get_weather for Tokyo read as right);
- pressing Check as the dialog opens turns the GUI test red ("opening the
  dialog sends no call").
Not tried:
- the whole GUI suite at this head (both machines busy with another
  session's suite);
- a real relay (fakes only);
- a context-window probe;
- a comparison with the vendor's own count_tokens;
- a periodic check (the check runs only on a press).
2026-11-17 23:13:03 +08:00
yetone 05d46f42e5 gui: Claude's menu bar cards can show Anthropic's A\ mark (qingnianxiaozhe on X)
qingnianxiaozhe asked for Anthropic's A\ in the menu bar in place of
Claude's logo. Settings › Usage › Menu bar Claude logo (Mac only, shown
while logos are on and a ticked card is Claude's, under the magpie icon
row) picks Claude's logo
(the default, unchanged) or the A\.

- settings.TrayAnthropicMark, kept per computer through KeepOwn like the
  other menu bar choices; settingsapi.Keys saves it; a change wakes the
  menu bar (onTrayUsage).
- trayAnthropic swaps the icon of cells whose card logo is claude-color
  or a plugin's claudecode-color (trayCell.Logo) for trayAnthropicMark,
  an SVG drawn here (two paths, no other app's bytes), and marks it mono
  so mpGlyph paints it in the bar's text colour. Menu bar logos off
  wins.
- The row's code is trayClaudeRow in traywindows.js (lazy). app.js only
  adds the key to prefsKeep; to stay in TestCoreScriptBudget without a
  raise, renderTrayUsage's no-card branch moved into trayWindowsRow,
  which now hides Windows' figure row itself when no card is ticked.
- en, zh, zh-TW, ja, de strings; docs/subsystems/gui-shell.md bullet.

Tests: TestTrayAnthropicMark (which cells change, input not mutated,
plain cells stay plain), TestTrayAnthropicMarkSVG,
TestTrayAnthropicMarkSaved (POST as the page does, saved and woken once
per change), TestTrayImageAnthropicMark (darwin: renders the real
AppKit image light and dark, the logo rect differs, the rest of the
image is identical), tray-anthropic-mark.test.cjs (five languages, 900
and 400px, Chromium and WebKit: row, two logos, default Claude, A\
posts true, another setting's save keeps it, back to false, no row with
no Claude card / logos off / no card / Win32, no page errors, no
sideways scroll). The GUI test waits for the redraw after a save rather
than a fixed time: a click on a control drawn before the save lands
sends the old value back (any setting, not new here).

Broken by hand: trayAnthropicMark taken out of prefsKeep turns the GUI
test red ("a save of another setting keeps the A\") in all languages;
taken out of settingsapi.Keys turns TestTrayAnthropicMarkSaved red.

Run:
- mica, at 2fa9295ed (this tree less the doc bullet): go test -timeout
  45m -count=1 ./... : 103 ok, exit 0.
- mote, at this head's code: gofmt -l clean; go vet ./...;
  GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./... ok;
  internal/settings, settingsapi, davsync ok; internal/gui -run
  "Tray|CoreScript|Budget|EveryRoute" ok.
- mote GUI, Chromium and WebKit, the 20 files that touch the menu bar
  rows, Settings search or prefs (tray-*, settings-search, side-effort,
  searcher-pick, quota-pace, proto-menu-overflow, classify/image-timeout,
  i18n-*): tray-bird first went red (its row must follow the logos row),
  so the Claude row sits after the magpie icon row. side-effort is 5/5
  red in both engines on origin/main a922e3864 too (#6353).
- After rebasing on a922e3864, at this head: gofmt clean; go vet
  internal/gui, settings; go test -run Tray|CoreScript|Budget|EveryRoute|
  Settings internal/gui, settings, settingsapi ok; tray-anthropic-mark,
  tray-bird, tray-logos, tray-windows, tray-usages, settings-search 51/51
  in Chromium and 51/51 in WebKit.
- i18n-keys: "a plugin's words are its own" red, the same on origin/main
  (routing's ", with an image" in claude_image_budget_test.go), #6877.
- Real AppKit renders of the menu bar image (trayImagePNG, light and
  dark) looked at: "A\ 42%/18%" reads at 14pt.

Not run: the whole GUI suite (mote and mica each had another session's
full GUI suite running); the files above are the ones this can reach. Not tried: a screenshot of the live menu bar of a built app.
2026-11-17 21:50:54 +08:00
yetone ead91a9a50 gui: a browser tab's title names this magpie: MAGPIE_NAME or Settings › Network and sharing › Advanced › Name (starballl on X)
starballl on X (tweet 2122376116220633444) runs several magpie web pages
and every tab is titled "magpie", so they can't be told apart. A magpie
now has a name, and a browser tab's title is "<name> · magpie" (plain
"magpie" with none).

- settings.Name, set in Settings › Network and sharing › Advanced › Name
  (instancename.js, imported when Settings is drawn, so nothing is added
  to app.js's core). Advanced is closed until a name is set.
- MAGPIE_NAME (Docker, magpie web) names it while the field is empty and
  is the field's placeholder. It is read, never written, so a name typed
  in Settings always wins and clearing the field goes back to it.
- One line, at most 60 characters (settings.CleanName).
- This computer's own (KeepOwn): sync and a restored backup never bring
  another magpie's name. A Settings save that leaves `name` out keeps it
  (settingsapi.Merge).
- boot.js titles a browser tab itself for the first paint, so app.js's
  core gains only the line in applyPrefs, which sets the title again from
  every settings read (TestCoreScriptBudget was 74 bytes over with a
  title function in app.js). Only a browser page (web) is retitled: the
  app's windows and tray keep "magpie".
- Docker docs (en, zh, ja) list MAGPIE_NAME; docs/reference.md and
  docs/subsystems/gui-shell.md say how it works.

Tests:
- TestInstanceName (internal/gui): the variable alone names it at boot;
  a saved name wins over it, trimmed; a save without `name` keeps it;
  KeepOwn keeps it; cleared goes back to the variable; no name, none at
  boot. Broken by hand, each red: KeepOwn without Name ("KeepOwn took
  \"other\""), Merge without the keep ("a save without the name changed
  it to \"\""), boot.js with s.Name in place of InstanceName ("named by
  the variable alone: boot <nil>"), boot.js not setting the title ("a
  browser tab's boot.js sets no title"). The app window's boot.js sets
  none.
- TestSettingsSaveKeepsWhatItDoesNotSend now sets Name: the page's other
  saves leave it out, and it is kept.
- instance-name.test.cjs: title from the first paint, the field under a
  closed Advanced, save and clear retitle the tab, Advanced open after a
  reload, 360px, the app's window keeps "magpie"; en, zh, zh-TW, ja, de,
  Chromium and WebKit, 16/16. 14 of 16 red with applyPrefs not setting
  the title.

Run, at this commit on dbbb2f26b plus 9d5d8baf2 (the site index):
- go test ./... -count=1 -timeout 45m on Linux (WSL magpie-desktop, Go
  1.26.8), at the tree before the boot.js move: 99 packages ok,
  internal/gateway included (959s); ., internal/cli and internal/gui
  don't build there without GTK headers. On mica (macOS): . and
  internal/cli ok; internal/gui/... ok at this commit, after the two
  reds that run found (the core budget, the keep test) were fixed.
- go vet and GOOS=linux -tags nogui / GOOS=windows go vet of
  internal/gui and internal/settings, earlier the whole tree on all
  three: ok. gofmt -l clean.
- site: node --test *.test.mjs, 132/132.
- GUI: the 135 files the change reaches (settings, network, LAN, i18n,
  old-webkit, core budget) on mica: 16 files had reds. Run again on this
  tree and on its base, the same tests are red on both (allow-ips
  #4357, settings-hints #6107/#6353, lan-join #6353, i18n-keys #6877,
  old-webkit #6030/#5919 and the rest of the 16) but two:
  search-mcp-library (WebKit, #4756) and gateway-pause (WebKit de 420px,
  #6684), red only beside other files: alone, 0 of 10 and 0 of 3 red on
  both trees.
2026-11-17 03:11:31 +08:00
yetone 8707ea7757 gateway: Codex's prompt suggestions go on a model set for them (@0xcb198609 on X)
The Codex app's home-page prompt suggestions (thread_source
ambient_suggestions, and their safety check, ambient_suggestion_safety;
the Routing page's 提示词建议) are a background agentic turn that reads
the project and connected apps. The app asks for the model its server
config names (codex-app-model-routing's
codex_ambient_suggestions_model_slug, gpt-6-luna) with provider model
fallback on, so with magpie as Codex's provider they ran on the
provider's default model, often auto: @0xcb198609 saw 76.9k tokens in
113s on deepseek-v4-pro. Codex has no config.toml key for that model,
only an on/off switch in the app (store key ambient-suggestions-enabled,
Settings › Configuration › Homepage suggestions; read from the 26.1106
bundle).

magpie now has a setting for it, "Codex prompt suggestions" in Codex's
row on the Agents page (Settings, beside Codex composer predictions):
- Empty, the default, is Codex's own pick: nothing moves. A value the
  user set is never overridden.
- A model or group of magpie's puts both calls there: in serve as the
  codex-suggestions move (the Routing page says why), and on the ChatGPT
  backend's route before the split, carrying the asked model to serve so
  the trace and ledger keep it. codexOwnOffMagpie leaves a bare
  gpt-6-luna to magpie while the setting is on (codexSideSet).
- A target that is disabled, unserved or not allowed to the gateway key
  leaves the call as asked, with a log line (compactRefused).
- To fit app.js's script budget without raising it, the suggestions and
  auto-review pickers share codexPick with codexSidePick, and every
  Codex row's button comes from condButton. The new route is named for
  the CLI (settings_parity_test.go). agent-prefs and settings-general
  list the new row.
- The row's tooltip and the Routing page's Suggestions story say where
  Codex turns them off. magpie's old story said "Suggested prompts",
  which the current app no longer shows; corrected in all five languages
  from the app's own locale files.

Run (mote, at this head rebased on e25210b6e):
- go test -timeout 45m ./...: ok, every package (101). A first run
  at e97271f02 had cli and gui red on the CLI-parity guard and
  TestCoreScriptBudget; both fixed here, without raising the budget.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: clean. gofmt -l: clean.
- TestCodexSuggestionsMoved/Left/MovedOffChatGPT/ModelRefusesBareName,
  TestCodexSuggestionsSetting: ok.
- GUI: codex-suggestions (new), codex-predictions, codex-auto-review,
  routing-kind, i18n-keys: 58/58 ok before the rebase; at this head
  codex-suggestions, i18n-keys, agent-prefs, routing-kind 84/84 ok.
  Every GUI file that opens Codex's row or the Routing kind stories
  (26) ran too: red only in codex-async-compact (zh, zh-TW) and
  codex-memories-settings (chromium scroll), both red the same on
  origin/main e25210b6e and filed as #6658 and #6372.
- Rebased last onto 90d54a267 (internal/sessions and internal/usage
  only): internal/sessions, internal/usage, TestCoreScriptBudget, the
  route guards and the CodexSuggestions tests ok again there.

Broken by hand: codexSuggestionsTo returning "" and codexSideSet's new
case off: TestCodexSuggestionsMoved red (m1 sent, and a 404 "magpie
knows no model gpt-6-luna"), TestCodexSuggestionsMovedOffChatGPT red.

Not tried: a real Codex app's prompt suggestions against magpie (no
Codex.app here or on mote); the whole GUI suite (only the files that
open Codex's row, its settings or the Routing kind stories).
2026-11-16 18:59:40 +08:00
yetone c38753a7ee search: Settings can ask every search API at once, results merged (heyiwei5 on X)
The search APIs are asked in order: the next only when one fails or
finds nothing. Asking several together, with their pages merged and
repeats dropped, has existed since #2845 but only through
`magpie search mix`. Settings › Models › Web search now has an Advanced
fold, shown with two or more search APIs on, holding "Ask the search
APIs: In order | All at once". All at once marks every API on as mix
(POST /api/settings/search-api {"mix":[...]}, provider.MixSearchAPIs);
In order clears the marks. In order stays the default. A mix of some of
the APIs, set from the CLI, opens the fold with neither choice on and
names the APIs it asks.

Run (mote, at this tree):
- go test ./internal/gui -count=1: ok.
- TestSearchAPIsMixedFromSettings at origin/main's api.go: build fails
  (searchAPIJSON has no Mix), so it is red on the old code.
- node --test search-mix, search-count, search-api, i18n-keys:
  72/72 pass, chromium and webkit, en/zh/zh-TW/ja/de, 1100 and 560px.
- search-mix.test.cjs at origin/main's assets: 0 of 30 pass (red).
- gofmt -l: clean.
- After rebasing on b010fba05 (GUI pages): the gui Budget/I18n/mix Go
  tests and search-mix + i18n-keys GUI (34/34) pass again.

Not tried: the whole GUI suite, and a real search through mixed APIs
with real keys (the merge itself is unchanged since #2845).
2026-11-16 14:12:48 +08:00
yetone 261f482260 gui: Disconnect and quit puts the agents back for the next start, which connects them again (jtbbtnt54249 on X)
jtbbtnt54249, on LolingVerse's agy thread: "很多都这样,退出有时候又要重新开启".
Several agents' switches were off after quitting magpie and had to be
turned on again by hand.

Looked for a shared path that flips agents off. The row's switch is
Wired() alone, and nothing automatic disconnects an agent except a
removed plugin, the gateway pause (which reconnects on resume) and
Put agents back when quitting (which reconnects at start). The quit
question's Disconnect and quit, though, ran each row's Disconnect,
which leaves the disconnectedKey mark: every agent it listed stayed off
at every start after, and RewireOnStart skips a marked agent. Users
choose it so their agents work while magpie is closed, not to leave
magpie for good.

Now Disconnect and quit posts quit/disconnect (quitDisconnect), which
runs agent.RestoreOnQuit on the agents the question lists: their own
files back, no mark, recorded in quit.restored, so the next start's
RewireOnStart connects them again, the setting on or off. This covers
every agent the question lists: every detected agent wired to magpie,
built-in, plugin and WSL ones alike. A failure answers an error naming
the agent and magpie stays open. Its tooltip says magpie connects them
again when it opens (en, zh, zh-TW, ja, de).

Run at this tree (parent 99a54fa87, origin/main just fetched):
- TestQuitDisconnectComesBackOnStart red on the old api.go and
  restoreonquit.go (404 on POST /api/quit/disconnect), green after.
- mote: go test -count=1 ./internal/gui ok (145s).
- mica: node --test quit-ask, quit-ask-setting, restore-on-quit,
  i18n-keys, i18n-en-no-cjk: 178 of 178 pass, chromium and webkit,
  every language.
- gofmt -l clean; go vet ./internal/gui on darwin and GOOS=windows ok.
  Linux vet of internal/gui needs GTK/WebKitGTK headers, which neither
  mote nor magpie-desktop has; not run.

Not tried: a real quit of the app with real agents; the agent-level
RestoreOnQuit then RewireOnStart path is covered by
TestRestoreOnQuitAndRewireOnStart. Agents disconnected this way by an
older magpie keep their mark and stay off until switched on once.
2026-11-15 23:30:05 +08:00
yetone 139a6be2bb gui: a pin in the title bar keeps the main window on top (NovaStudiosss on X)
NovaStudiosss wanted to watch Usage and Routing while working in other
apps. The main window's toolbar now has a pin between Refresh and
Settings. A click keeps the window above other apps' windows
(Wails SetAlwaysOnTop through POST /api/window/ontop?on=1|0) and saves
it as settings.json's onTop, which this computer keeps for itself
(KeepOwn, not synced). makeMain opens the window pinned on the next
start, and boot.js shows the pin pressed before the first paint.
There is no pin in the panel, in a browser's page (magpie web) or
under Wayland, where always-on-top is ignored (GDK_BACKEND=x11 keeps
it). A refused pin goes back up. Tooltips "Keep on top" and "Stop
keeping on top" are in every language. A Settings save keeps onTop
(settingsapi.Merge), which a test showed was lost before.

Run (rebased on a80a920f5):
- go test -tags nogui ./internal/gui ./internal/settings
  ./internal/settingsapi on mica: ok. TestPinKeepsWindowOnTop,
  TestPinRefusedWithoutAWindowToPin, TestSetOnTop*, TestOnTopOwn and
  the settings-save keep test.
- At the rebased head, TestPinRefused had served webHost through
  Handler and left webPage set, which turned TestSessionTitlesName-
  OtherAgents and TestCursorEditorChatsAreNotCalledCursorCLI red in a
  full package run. It now goes through webPageHandler, and the package
  is ok. TestWebPageHandlerEveryWhere misses a webHost passed in a
  variable.
- window-pin.test.cjs (chromium + webkit, en zh zh-TW ja de) and
  i18n-keys: 36 pass.
- Full GUI suite on mote (pre-rebase tree, still running at push): about
  380 reds so far, none in window-pin. Seven of the red files
  (account-arrange, agent-details-ready, api-key-theme, bark,
  agent-switch-accounts, allow-ips, agent-bulk-visibility) were run on
  origin/main 30de93e9e: 77 of the same reds, and none red only here.
- go vet for darwin, windows, linux nogui and linux gtk3. Windows
  go test ./internal/gui ./internal/settings: ok. gofmt clean.
- Broken by hand: without the route, or without renderOnTop, the Go
  and GUI tests go red. Without the Merge line the settings-save test
  goes red.
- Real app on mote: with onTop saved, the main window opens at the
  floating level (CGWindowList layer 3, 0 unpinned).

Not tried: clicking the pin in the real app (no Accessibility over
ssh), a real Windows or Linux window, Wayland (hidden by design). At
the default 660px window, the English tabs now scroll about 15px, as
Japanese and German already did on main.
2026-11-15 23:05:56 +08:00
yetone 5bd41301b9 warm-up: All accounts warms every account in use at one press (CoderMaurice on X)
CoderMaurice on X: with several Claude accounts, Warm up now had to be
pressed once per account. With two or more accounts, the Warm up… menu on
the Warm up now row (a Claude Code or Codex provider's editor, the warm-up
section) now starts with All accounts. It sends POST /api/warm-all, and
provider.WarmAll sends Warm up now to every account that is in use (the
one the agent is on, or one turned on beside it) and whose windows aren't
all running already, going by the cached readings the Usage page shares.
It runs three at a time. An account that is turned off or paused, or
already in its windows, is sent nothing. An account whose sign-in lapsed
is sent nothing and is listed as failed, as Warm up now treats it. The
row's line lists the accounts warmed, the ones already in a window, and
each refusal with its reason (in red).
Accounts that are turned off aren't listed. A gateway rest is not read
(the provider package can't see it). An account rested for a used-up
window is still inside that window, so it is skipped as running.

"All accounts" moves from the usage plugin's i18n.js into core i18n.js,
since the core uses it now. It and two new strings are in zh, zh-TW, ja
and de. app.js stays inside its budget: the single-account and
all-accounts results now go through one formatter.

Run at a1968a0b5 (rebased on origin/main aecf27efb), on mica:
- go test -run 'WarmAll|WarmNow|CoreScriptBudget|Budget' ./internal/provider
  ./internal/gui: ok. New: TestWarmAllWarmsEachIdleAccountInUse,
  TestWarmAllOnlyCodexAndClaude, warm-all cases in TestWarmNowAPISaysWhy.
- Broken by hand: with the "running" skip removed from warmAll,
  TestWarmAllWarmsEachIdleAccountInUse FAILs (busy@ and spent@ warmed).
  With the All accounts item removed from the menu, warm-now.test.cjs
  FAILs ("Warm up all warms every account at one press" and the menu
  list assertion).
- GUI, Chromium and WebKit, en/zh/zh-TW/ja/de, 900px and 440px:
  warm-now, i18n-keys, i18n-en-no-cjk, usage-accounts: 54/54 pass. Before
  the rebase, plan-name-fits, provider-prefs-layout and quota-warm also
  passed (54/54 with usage-accounts).
- gofmt -l: clean. go vet, GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of internal/provider and internal/gui: ok.
  go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok.

Not run: the full go test ./... and the full GUI suite. Both mote and
mica had other sessions' GUI suites running throughout, and this ships
now per the owner's ship-immediately rule. Both will run when a machine
is free. Not tried: a real Warm up all against several real Claude
accounts (the send per account is the unchanged WarmNow).
2026-11-15 11:00:37 +08:00
yetone 3f09b9ffc6 update: the header's Update pill shows a waiting update at once; only its x holds it, for 3 days (visamzh, normalcoder_ on X)
visamzh (0.1.4174, 0.1.4176 downloaded, Update button and Automatic
updates on) and normalcoder_ (0.1.4079) saw no Update pill for about two
days. Cause: 36eebea13 (v0.1.3879, 11-12) set /api/update's quiet until
this version had been behind for update.Quiet (3 days), counted from the
first newer version seen and kept per running version. With a release
every few minutes, every update starts that clock over, so on any version
a user updates within 3 days the pill never lit, whether a download was
waiting (ready) or one was found with downloads off (found), on every OS.
The Version row and the tray's Restart to update still offered it.

Now being behind holds nothing: ready, found and available light the
pill at once. Only the pill's x (or right-click) holds it, for
update.Quiet across the releases out meanwhile (Behind.Hushed), which
keeps 36eebea13's answer to "always lit" (the x used to hold only until
the next release, minutes later). An urgent release still lights it
through that. The old notes' "since" is never read as a dismissal.
Settings > Update button says "Hidden for 3 days" whenever the x holds
(it said "Hidden for <v> until a newer version is out" only while that
exact version was latest), and Show again lifts the hold
(update.Unhush, an empty update-skip). The x's label and toast say
3 days instead of "until the next version" (en, zh, zh-TW, ja, de).

Users on 0.1.3879 to 0.1.4179 get it with their next update: Settings >
About > Restart to update, the tray's Restart to update, or quitting.
0.1.4079 still checks, downloads and verifies the newest release: its
updater code (LatestEvery + Stage, sandbox HOME on mica) fetched
0.1.4178, passed download, verify (SHA256SUMS signature, attestation)
and unpack, and stopped only at the Team ID check because the probe
binary is unsigned.

Run (mica/mote, macOS, Go 1.26.8), at this tree:
- go test -count=1 ./internal/update ./internal/gui: ok, before and
  after the rebase onto 0b8c4bfc3 (also i18n-keys, i18n-en-no-cjk, update-quiet, update-hide there: 118/118). go vet darwin, GOOS=linux -tags
  nogui, GOOS=windows: clean. gofmt -l clean.
- Broken by hand (old semantics: first-seen sets the clock, Lit needs it
  past Quiet): TestPillLightsWhenANewerVersionIsOut,
  TestDismissalHoldsForTheQuiet and TestUpdateQuietUntilBehindAWhile
  (ready, found, available: quiet true, want false) red.
- GUI, Chromium + WebKit: update-quiet.test.cjs (en, zh, zh-TW, ja, de;
  panel 420, narrow window 400, window 900; ready and found show the
  pill, quiet hides it and Settings says Hidden for 3 days with Show
  again) and update-hide.test.cjs pass; update-quiet red on the old
  app.js (Settings row). 52 GUI files touching Settings, updates, i18n
  and menus: 882/935; the reds (menu-scroll, settings-hints,
  settings-search, settings-lines-wrap, settings-groups warm-ups) are
  the same 50 at origin/main aa358555f run alone (54 pass / 50 fail
  both), filed as #1550, #5982, #6133, #6353, #6597. plugin-card-update
  webkit was red only under --test-concurrency=3 and passes alone.
Not run: the full go test ./... and the whole GUI suite (mote over its
load, mica running another session's GUI suite); not tried in the real
app with a real download waiting.
2026-11-14 23:47:47 +08:00
yetone 0b8c4bfc34 agent: Claude Code's permission mode is set in magpie and kept (EricChenChannel on X)
The report: "every time I configure settings.json it is overwritten and
reset" for permissions.defaultMode = bypassPermissions.

Cause, reproduced in a sandbox HOME with Claude Code 2.1.316: magpie's
writes to ~/.claude/settings.json are key-level and kept the user's
permissions block. Claude Code itself drops the mode: it ignores
bypassPermissions at launch unless skipDangerousModePermissionPrompt is
true, and its auto-mode nudge and /config write defaultMode over it.

Change:
- agent.Field gets Own: the user's own setting of the agent. Apply does
  not record it, Disconnect neither clears nor restores it, Pick never
  connects the agent for it, magpieValueIn is false for it, and profiles
  (Fields, ApplyFields, InUse) and the WSL copy leave it alone. So the
  mode outlives disconnecting magpie and switching profiles.
- Claude Code's permission_mode field (default, acceptEdits, plan, auto,
  dontAsk, bypassPermissions; "" removes the key) writes
  permissions.defaultMode, and bypassPermissions also writes
  skipDangerousModePermissionPrompt: true so Claude Code honours it.
- GUI: own fields go in agentJSON.own, apart from fields, and
  agentcompact.js draws them in an Advanced fold (collapsed) under the
  agent's settings, with the app menu (no <select>). app.js unchanged.
  Labels in en, zh, zh-TW, ja, de (zh: 高级 › 权限模式 › 跳过权限确认).
- docs/subsystems/agent-wiring.md: Fields and options row.

Run at this tree (base aa358555f, origin/main at commit time), on mote/mica:
- go test ./internal/agent -run 'Permission|Profile' ; ./internal/profile ;
  ./internal/gui -run 'Budget|PermissionMode|AgentOwn|AgentModels': ok
- GUI claude-permission-mode.test.cjs in chromium and webkit, en and zh:
  4/4; i18n-keys, i18n-en-no-cjk: ok
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok

Broken by hand:
- Own: false on the field: TestClaudePermissionModeOutlivesMagpie
  ("disconnecting took the mode to \"\"") and TestProfileLeavesPermissionMode
  ("a profile wrote the permission mode") went red.
- Without the GUI own/fields split, the "not a picker on the row" check in
  claude-permission-mode.test.cjs went red.

Not run yet: the full go test ./... and the full GUI suite. Both machines
had another session's GUI suite running; they run next and their result
goes on the follow-up. Not tried: a real Claude Code session's /config
changing the mode back (Claude Code's own write; this change can't stop it).
2026-11-14 23:11:16 +08:00
yetone e0ed2c4d81 gateway: model ids without the provider can be listed alone, in place of provider/model
qQianye on X (v0.1.4094 in Docker, several WorkBuddy accounts): the
client on their computer lists every model as provider/model and they
want those hidden. The advice was the Agents page's model list, but
gateway mode (what the Docker image's web page runs as) has no Agents
page. Settings › Network and sharing › Model ids without the provider
was drawn there already, but only added bare ids beside the prefixed
ones, so the list got longer, not shorter.

The row is now Off / On / Only. Only (settings.BareModelIDsOnly,
POST /api/settings/bare-ids {"on":true,"only":true}) lists each bare id
in place of the first row it stands for (provider.OnlyBare) and leaves
the other rows it stands for out: the found group it reaches
(auto/glm-5.3) and every provider's row of that model it reaches. A row
the bare id doesn't reach (b/vendor/m9, whose bare id names provider
vendor), a held key's row whose bare id isn't listed for it, and other
groups keep their ids, so no model leaves the list. Requests by
provider/model are served as before; only /v1/models changes. Another
magpie's list is unchanged. Claude Code's discovery, which drops a bare
row it wouldn't keep because the full row is there, lists it by its
alias with Only (there is no full row). Off clears Only.

Run, at this commit (base 3dbbb173e, origin/main unchanged at push):
- go test -count=1 -timeout 45m ./... on mica: 101 packages ok, no FAIL
  (log kept whole at mica:~/runs/qq-sb/suite.log). gofmt -l clean;
  go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... clean.
- GUI (Chromium + WebKit, 420 and 900, all five languages) on mica:
  bare-ids, i18n-keys, i18n-en-no-cjk, gateway-mode, settings-tabs-stick:
  66/66 pass. Not the whole GUI suite: mote was over its load and mica
  holds another session's GUI run.
- Broken by hand: with Only ignored in listModels, TestBareModelIDsOnly
  is red (every provider row listed); with Claude Code's bare rule left
  as before it is red (1 of 5 models listed to discovery).
- Docker-style run on mica: the built binary as `magpie serve
  --web` with the image's env (HOME/XDG under a sandbox, MAGPIE_ADDR,
  MAGPIE_WEB_KEY), two custom providers serving kimi-k3 and glm-5.3; the
  page boots with gateway:true and draws #bareIdsRow. /v1/models:
  Off  auto/kimi-k3 auto/glm-5.3 wb1/kimi-k3 wb1/glm-5.3 wb2/kimi-k3 wb2/glm-5.3
  On   the same, then kimi-k3 glm-5.3
  Only kimi-k3 glm-5.3
  kimi-k3 answered by wb1, wb2/kimi-k3 still by wb2.
Not tried: a real WorkBuddy plugin account, and a client reaching it
through another magpie (whose list never takes bare ids).
2026-11-14 21:05:50 +08:00
yetone 1ab2c39843 tray: the menu bar and panel leave out what Usage's Overview hides (onkashiko on X)
onkashiko on X: a quota hidden in the main window still showed from the
menu bar. 7ea1e6a4b made the tray panel and the TUI leave out Overview-hidden
cards and rows, but two gaps were left:

- The menu bar's cells, its tooltip and Windows' tray figure still showed a
  hidden card and its hidden rows. trayUsageCards now goes through
  trayShown: a cell naming an account takes the card the Overview still
  shows (its balance with its plan hidden), a cell following the account
  in use (`|*`) picks that account among every card as before and is left
  empty while its card is hidden, never moved to another account. Hidden
  rows are left out, a card never left with none. settings.TrayUsages is
  untouched, so the cell comes back with the card.
- POST /api/usage/arrange now wakes the menu bar (onTrayUsage) when
  cardsHidden or windowsHidden is sent, so a hide or unhide reaches it at
  once rather than at the next tick (3 minutes by default).
- The panel hid a card after keyCards had put a key's balance on its plan's
  card, so "Hide its balance from Overview" left the balance on the panel's
  plan card, and a hidden plan took its unhidden balance with it.
  panelPageCut now takes the quotas as read and leaves the hidden out before
  keyCards, as overviewCards does; gone counts a merged card hidden only
  when its plan and balance both are.

The Go hide rule (cardHideKey/usageShown) moved from internal/tui to
internal/provider (ShownQuotas, QuotaCardHidden, QuotaRowsShown,
QuotaHideKey), shared by the TUI and the menu bar. Not changed: Bark's
daily push still warns about a near-limit hidden card (an alert, not a
display). Docs: settings.go comments, docs/subsystems/gui-shell.md.

Run on mica (mote at load 117 on 18 cores), at base ee6352b63:
- go test -count=1 -timeout 45m ./internal/gui ./internal/tui
  ./internal/provider ./internal/settings: all ok.
- go vet of those packages; GOOS=linux go vet -tags nogui and GOOS=windows
  go vet of internal/gui, internal/tui, internal/provider: clean. gofmt -l
  clean.
- GUI (Chromium + WebKit, en/zh/zh-TW/ja/de): panel-hidden-balance (new),
  panel-page-hidden, panel-arrange: 28/28. panel-balance-order,
  usage-rows-hide pass. usage-cards-hide and usage-hidden-way-back are red
  at "de 560" (no sideways scroll), the same 8 on an origin/main
  ee6352b63 copy (#6294, #6295). tray-cell-click "chromium zh/en" is red
  1 run in 3 on origin/main as on this tree (#5215).
Broken by hand: panel-hidden-balance is red on origin/main's assets
(the plan card carries the hidden balance, MiniMax's balance gone);
TestTrayLeavesOutWhatTheOverviewHides is red with trayShown returning
trayPick, TestUsageArrangeWakesTheMenuBar red with the onTrayUsage call
removed.
At the pushed head (rebased on 534b1a334, which adds installdir_windows.go):
GOOS=windows go vet ./internal/gui ./internal/update and go test -run
"TestTray|TestUsageArrange|TestCoreScriptBudget" ./internal/gui: ok.
Not tried: the real menu bar on a Mac or Windows with a real account; no
full go test ./... (a full suite was running on mica).
2026-11-14 19:37:57 +08:00
yetone 80a315a70a gui: a closed or hidden page lets its Sessions and Usage caches go in 30 s
What a visit to the app's page read stayed until each cache's own idle
timer fired: the Sessions stats after 2 minutes, the Requests chunks
trimmed at 2 and forgotten 5 after that, each chunk's derived keys at 3.
On a real history (acctp, requests-v1.bin 71.5 MB) a web page open 70 s
and closed held 123 MB at the close, 108 MB a minute on, 74-76 MB three
to five minutes on, and was back to the tray's 52 MB only at ten.

The page now says it has gone from view (POST /api/page-away, sent from
the visibilitychange listener every window already has, when hidden: a
browser fires it as a tab closes, and the Mac window's orderOut
dispatches it too). 30 s later (pageAwayFor), unless a Sessions or Usage read
was in flight or ended since, the stats, overviews and tags go
(letGoStats, split out of forgetIdleStats), the Requests chunks and each
chunk's derived caches go (usage.ForgetPages: trim(0) + dropDerived,
idle timers stopped) and the pages go back to the system. A second tab
still polling, or a tab looked away from for under 30 s, keeps them. The
beacon writes nothing, so held's provider.Changed passes it by. The panel
sends it as well when it hides; it reads no Sessions or Usage page, so
there is nothing of its own to keep.

Tests: TestPageAwayLetsStatsGo (red with the forget skipped, and red
when a read after the beacon is ignored, both broken by hand) and
TestForgetPagesLetsChunksGoAtOnce.

The core script budget goes up 83 bytes, with the reason in its
comment: the beacon is folded into the existing listener and packed to
its shortest form (335 over as first written, with a pagehide listener
and a panel check).

Measured on mote (pageclose2.sh, the acctp history, a web page open
70 s and closed, footprint-overlay build like the release):
  before (w88): close 123 MB, +60 s 108, +180 s 76, +300 s 74, +600 s 52;
                peak 154
  after  (w89): close 123 MB, +45 s 92, +90 s 90, +180 s 54, +600 s 53;
                peak 149, 3.08 s CPU over 11 min
  final (w90, visibilitychange only): close 122 MB, +45 s 93, +90 s 90,
                +180 s 55, +600 s 52; peak 152

Run: go test ./internal/gui ./internal/usage on mote (ok);
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./... (ok);
16 visibility GUI files + i18n-keys in chromium and webkit: red only in
routing-pin-away (the same subtest red alone at origin/main 4739ec92c,
2026-11-14 17:00:00 +08:00
yetone 13cb07fde7 codexcat: an OpenAI model is compacted where Codex's own catalog holds it, GPT-6.1 Terra at 500K (@flower__daisy on X)
@flower__daisy: Codex compacts often after connecting to magpie, "don't
Codex models have 500k now?". Codex's bundled catalog (rust-v0.165.0 to
rust-v0.169.0, models-manager/models.json) gives gpt-6.1-terra a
context_window of 500000; every other listed model 272000 (red-latest
372000). Long conversations' default, the working window, told Codex to
compact every model with a longer window at 272K, "what OpenAI does
with its own models". For GPT-6.1 Terra that is no longer what OpenAI
does:
- a ChatGPT account's codex/gpt-6.1-terra in magpie, with no entry in
  Codex's models_cache.json, got context_window 500000 and
  auto_compact_token_limit 272000;
- an OpenAI API key, relay or found auto/ gpt-6.1-terra got models.dev's
  922K and 272000.
Codex's own entries, passed through beside a ChatGPT sign-in, were
already as the backend gave them.

codexcat.Working is now Long conversations' threshold, except that at
its default an OpenAI model is held to the window official Codex holds
it to (OwnWindow: the account's models_cache.json list, else the bundled
catalog, matched by longest prefix as Codex does), never above the
model's own window. A size the user set (CompactAt, Codex's own Long
conversations) and Full window are as they were. Another vendor's model
and a routing group keep 272K. A model whose window magpie doesn't know
gets the same threshold. The Context tab's advice (tune.go codexWindow)
and the Long conversations row (codexWindowUnder) read it too.

Tests:
- TestBundledWindowsAreCodexOwn: bundledWindows equals the
  context_window of every model in testdata's rust-v0.166.0 models.json.
- TestCodexCatalogHoldsOpenAIModelToCodexWindow: terra on an API key,
  a dated auto/ id, a 400K relay, codex/ at 500K, a relay with no
  window; sol, DeepSeek, Claude and a group at 272K; the account's list
  before the bundled one; CompactAt 300K and Full window as set.
  Broken by hand: with entriesAt back on work.Working, 6 cases red
  (codex/gpt-6.1-terra told [500000 272000]).

Run (mica, mote over its load): go test ./internal/codexcat; go vet
codexcat and gui for darwin, linux (nogui), windows; gofmt -l; go test
./internal/gui -run 'Tune|CodexWindow|Codex.*Window|LongConv|Compact';
then -run 'Codex|Compact|Window|Tune|Catalog|Ultra|Relist' over
gateway, provider, agent, gui and codexcat: all ok (gateway 280s).
Full suite: queued on mica behind another session's suite.lock, not
finished at push (the owner's ship-at-once rule).

Not tried: a real Codex 0.169 session running past 272K on GPT-6.1
Terra through magpie. Claude Code and Grok Build keep the 272K working
window for every model; no Anthropic or xAI catalog gives an OpenAI
model a window of its own.
2026-11-14 14:50:56 +08:00
yetone 667ac8bd6f settings: a look at one setting takes the shared settings, not a copy
settings.Load() copies the whole Settings (clone + deepCopy of every map
and slice) for each caller. 133 places read one field of it and threw
the rest away: the proxy for every outgoing request (netproxy), the
GitHub token, the China mirror switch, a model's output cap, wire or
price on a gateway request. With a real account in the tray, Load's
clone was 26.6 MB of the 318 MB the process allocated in its first
seven minutes, most of it through netproxy.For on each request.

Each of them now reads settings.Shared(), the read-only settings every
caller is given for the same settings.json. Only reads were changed:
a scalar field (string, bool, int, float) or a map field's index
read. A caller that keeps a whole map or slice, or calls a method on
the settings, still takes Load's copy.
2026-11-14 14:02:49 +08:00
yetone 7d5475769b gui: the page's files are typed from magpie's own table, not the system's
Handler registered the page's five types with mime.AddExtensionType. The
first call makes the mime package read and parse the system's whole type
table (/etc/apache2/mime.types on macOS, ~18,000 allocations) and keep
it: ~2 MB of an idle tray magpie's live heap (pprof inuse_space on a
real-account tray run on mote). http.ServeContent asks the same table
for any file whose Content-Type isn't set.

Now assetTypes names every type the page's own files, plugin pages'
files and provider icons are served as. servedAs sets it before
ServeContent looks at the name, so neither the registration nor
ServeContent reads the system table. The system's table (Windows'
registry, which another program may change) still never decides how the
page's files are read.
2026-11-14 12:34:47 +08:00
yetone c5b40bf898 claude-desktop: after Use Claude Magpie the lit row is Claude Magpie, and its Code tab's row says it is on magpie (xMopf7RF on X)
xMopf7RF on X, 0.1.4111: clicking Use Claude Magpie seemed to connect
their own Claude Desktop, and left "Claude Code · Claude Magpie" saying
"Not connected · uses its own settings" with its switch off.

The wiring was right: with the Separate app on, connecting claude-desktop
writes only Claude-Magpie-3p's config (desktopSets), and the user's own
Desktop is left alone. The page said otherwise twice:
- the row that turned on was still named Claude Desktop. While the
  Separate app is on, state() now names the claude-desktop row Claude
  Magpie (desktopiso.Name), since that is the only config it wires.
- the claude#magpie-desktop row is not wired itself, and need not be:
  Desktop's Code tab runs Claude Code with
  CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST, so its requests go through
  Claude Magpie whatever that folder's settings.json says. While Claude
  Magpie is on magpie, the row carries twinCode (agent.DesktopTwinCode)
  and its line, lit, says "On magpie through Claude Magpie" (en, zh,
  zh-TW, ja, de).

The core script budget goes up 67 for that one connectLine line, cut to
the shortest words that say it; the Agents rows draw it, so there is no
page to move it to. docs/subsystems/agent-wiring.md says both.

Tests:
- TestClaudeMagpieCodeTabRowIsOnThroughIt (agent): DesktopTwinCode only
  for claude#magpie-desktop, only while Claude Magpie is on magpie.
- TestClaudeMagpieRowsAfterUseClaudeMagpie (gui): sandbox HOME, POST
  connect after turning the Separate app on: the wired row is named
  Claude Magpie, the Code tab row has twinCode, the user's own Desktop
  config is unchanged and no Claude-3p folder is made.
- desktop-twin-code.test.cjs: clicks Use Claude Magpie; no lit row is
  named Claude Desktop, the Code tab row's line is lit and fits, the
  click doesn't scroll; en/zh/zh-TW/ja/de, 1100 and 640 wide, Chromium
  and WebKit.

Run (mica; mote's load was over its cores), at e0889719c + this change
(the one later main commit, a83fe2325, is CSS and Go appearance only):
- gofmt -l clean; go vet -tags nogui ./internal/agent ./internal/gui on
  darwin, GOOS=linux and GOOS=windows: ok.
- go test -tags nogui -count=1 ./internal/gui (whole package, budget
  included): ok; ./internal/agent -run 'Claude|Desktop': ok.
- node --test, both engines, every agent-*, desktop-*, library-desktop-*
  and i18n-* file (78 files, 1358 tests): 1303 pass, 55 red in 4 files,
  each red the same at origin/main e0889719c and filed:
  agent-details-ready (#6373, #6369), agent-switch-accounts (#5925),
  agent-menu-label (#6371), desktop-tiers (#6475). desktop-twin-code 20
  of 20, desktop-twin, desktop-isolated, desktop-isolated-claude,
  library-desktop-twin, i18n-keys, i18n-en-no-cjk ok.

Broken by hand: at origin/main e0889719c (api.go given only the
TwinCode field, DesktopTwinCode stubbed false), both Go tests are red
("Claude Magpie on: \"Claude Desktop\" wired false"; the code row not
on), and desktop-twin-code is 20 of 20 red ("Not connected · Claude
Code · Claude Magpie uses its own settings").

Not tried: a real Claude Magpie.app in a sandbox HOME on this change
(005178104 did one for the button itself); this change only names rows
and reads the same wiring.
2026-11-14 11:42:50 +08:00
yetone 8ce32d7008 agent: the window's drift poll remembers which values are magpie's per stamp
/api/drift runs every agent's Drift every 15s while the window is up.
Each Drift asked every field's whole option list whether a value is one
of magpie's, and the model lists under them are built again once a
minute. With real accounts on mote (acgui6, w74), that was 27 MB of the
50 MB magpie allocated in three minutes with the window open.

DriftShown, which only /api/drift calls, keeps magpieValueIn's answer per
agent, field, value and settings while provider.StampNow stays the same,
5 minutes at most. Drift is unchanged for Reapply, rewiring, a launch and
/api/state, which act on the answer.

A provider resting or a model retired by its date is something the stamp
can't see. The window's drift row now shows that within 5 minutes, not 1.

Run: TestDriftShownAsksAValueOncePerStamp and the Drift tests on mica.
Broken by hand (the memo never hit): red, "five polls built the options
5 times, want 1".

Suite on mica at 6c88d61f0 + this commit: gofmt clean; go vet
internal/agent for darwin, linux and windows, internal/gui on darwin; go
test ./internal/agent ok (194.9s); ./internal/gui red only in
TestCoreScriptBudget (1269382 > 1268961). That test is red on
origin/main 6c88d61f0 as well, and #6518 is taken. This change adds no
script.
2026-11-14 09:58:49 +08:00
yetone 5211fd3ba2 usage: a currency "By provider" shows each provider's costs in what it sells in
onkashiko on X: DeepSeek, Kimi (China), Zhipu and other domestic vendors
price in yuan, the rest in dollars, and one currency for every cost made
the Usage page read wrong for half of them.

Settings > Usage > Currency gains a third choice, By provider. With it,
a figure of one provider's calls (a model's, an account's, a key's row,
a request, a routing try, a quota card's whole) shows in the currency
that provider sells in, and every sum across providers (the total,
agents, sessions, charts, the tray, Bark's daily, the day page) in the
currency a "Totals in" row picks, a row shown only while By provider is
chosen. GUI, TUI and CLI agree. Costs stay stored in dollars; only the
display converts, at the live rate (internal/fx).

Which providers sell in yuan (provider.PricesInYuan): a .cn host; a
preset at its own site that is a yuan preset (deepseek, zhipu,
volcengine, tencent-cloud, bailian, siliconflow…), ends in -cn, or is in
its China region; a plugin id ending in -cn; a provider of one's own
with a yuan models.dev catalog served at that catalog's site. A relay
made from DeepSeek's preset, Z.ai, Kimi's and MiniMax's international
endpoints stay in dollars: they share a catalog with their Chinese
twins, so the catalog alone can't tell.

Known limit: models.dev has only dollar prices (converted from the
vendors' yuan at ~6.7-7.0), so a yuan figure is that dollar price at
today's rate and can differ a few percent from the vendor's own list.

A second ask from onkashiko: set the currency of the menu bar and of
the totals apart, sums converted by themselves.

So Settings > Usage also gains an Advanced fold (closed by default, open while
set) with one row, Menu bar currency: Same as totals (the default), $ or
¥ (settings.TrayCurrency, TrayCostIn). It sets the menu bar's totals
cards and the tray tooltip's cost; the Usage page, the panel, the TUI,
the CLI and Bark's daily message stay in the totals' currency
(totalsCurrency). Like the other menu bar settings it stays on this
computer (KeepOwn). Every sum is still made in dollars and converted
once, at the live rate, so a mixed-currency total is never added up
from yuan and dollars.

Settings' currency rows (Currency, Totals in, Menu bar currency and the
rate in the tooltip) moved out of app.js into currencyprefs.js, imported
when Settings draws its usage prefs, and costInYuan is packed: the core
is 3 bytes under coreScriptBudget, with no raise.

Run:
- go test -count=1 at this tree on mote: internal/settings,
  settingsapi, tui, cli, catalog, provider, fx and gui all ok
  (TestCoreScriptBudget included). The full go test ./... and the whole
  GUI suite are queued behind other sessions' suites on suite.lock
  (mote and mica, load 35 and 60) and had not started at push.
- GUI files at this tree (mica): currency-provider, currency, i18n-keys,
  i18n-en-no-cjk, tray-cost, tray-totals, every settings-*, old-webkit:
  362 pass, 28 red. Every red is red the same at origin/main ac0b5c287
  on mote, and filed: settings-search (#6133, #6353), settings-hints
  (#6107, #6353), settings-lines-wrap de 440px (#6353), old-webkit
  appearance.js (#6467) and :has() (#5919). The one red of this change,
  settings-groups' list of Usage's parts (now with the Advanced fold),
  is fixed here: 14 of 14.
- currency-provider.test.cjs (new): en, zh, zh-TW, ja, de at 900 and
  420px, both engines; By provider, Totals in ¥, then Advanced: $ for
  the menu bar with totals in ¥, totals stay ¥21.60, the fold opens
  itself after a reload. Plus currency.test.cjs (3 choices now),
  i18n-keys, i18n-en-no-cjk, tray-cost: green in both engines.
- TestTrayCostIn (values, refused eur/provider, KeepOwn),
  TestFXByProvider (trayCurrency vs totalsCurrency), TestCoreScriptBudget.
- gofmt -l clean; GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., GOOS=linux go build -tags nogui,
  GOOS=windows go build on mote at this tree: ok.
- Broken by hand, each red: costInYuan ignoring the provider (GUI
  test: deepseek showed $1.00 for ¥7.20), PricesInYuan without the
  preset's site check (a relay made from DeepSeek's preset read as
  yuan), CostIn without its By provider branch (settings test),
  TrayCostIn ignoring TrayCurrency (TestTrayCostIn, TestFXByProvider),
  the fold not opening while set (webkit), the row saving into
  totalCurrency (chromium).
- Real app in a sandbox HOME on mote (dev build, magpie web and magpie
  usage) with DeepSeek, OpenAI and Z.ai presets and one call each: the
  window and the CLI both show deepseek-v4-pro ≈¥15.44, gpt-4.1 ≈$1.00,
  glm-4.6 ≈$0.290 and the total ≈¥24.07 at 6.685; /api/settings' fx
  carries yuan ["deepseek"].
Not tried: Windows and Linux windows and trays, the real menu bar with
Menu bar currency changed (drawn natively; covered through trayCurrency
in Go), a real Kimi CN or Zhipu account.
2026-11-13 22:46:00 +08:00
yetone 6bc0d1e203 claude-desktop: Claude Magpie's Code tab on a Claude Code folder of its own (#6459)
The Separate app (Claude Magpie.app, #5671) kept its own Desktop
userData, but its Code tab's bundled Claude Code still read and wrote
the user's ~/.claude: their CLAUDE.md, skills, plugins and history went
into the twin, and the twin's sessions into theirs (xMopf7RF on X).

An opt-in, macOS-only switch under the Separate app's Advanced fold
(settings.DesktopIsolatedClaude, POST /api/settings/desktop-isolated-
claude, `magpie claude-desktop launcher claude-dir on|off`) gives it
~/.claude-magpie-desktop:

- desktopiso.Script exports CLAUDE_CONFIG_DIR in the app's launch
  script; turning the option on or off remakes the app, and the hint
  says to quit and reopen Claude Magpie, since a running one keeps its
  environment.
- desktopOn writes Desktop's model windows, caps and explore entries
  into that folder's settings.json instead of ~/.claude's while it is on
  (desktopCodeDir, desktopClaudeSync); off moves them back. The folder
  is kept when it is turned off, and shows as the claude# row "Claude
  Code · Claude Magpie".
- The fold is drawn by claudemagpie.js, imported the first time it
  shows; what stays in app.js is the import (isoLazy) and the fold's
  place, 216 bytes, so the core budget goes up by 180 (the 36 of room
  there was taken first).

Run:
- gofmt -l clean; go vet ./internal/... on darwin, GOOS=windows and
  GOOS=linux -tags nogui vet of agent, cli, desktopiso, gui, settings,
  settingsapi (mote).
- go test agent, cli, desktopiso, desktopdir, settings, settingsapi,
  gui, library on mote: all ok except cli's three healthcheck/update
  tests, which ask the gateway mote's own magpie serves on :3425
  (#6223, the same with or without this change).
- TestCoreScriptBudget and TestSettingsSaveKeepsWhatItDoesNotSend at
  this commit and the next.
- GUI on mote, Chromium and WebKit: desktop-isolated-claude (five
  languages, 1100 and 640px), desktop-isolated, i18n-keys,
  i18n-en-no-cjk, old-webkit, and every agent*/desktop*/claude* file
  (98 files, 1,595 of 1,662 pass). Every red is the same on origin/main
  92bce5c72 run alone: old-webkit (#6467, #5919), agent-details-ready
  (#6373), agent-switch-accounts (#5925), claude-quota-onboarding
  (#6179), agent-menu-label (#6371), desktop-tiers Chromium (#6475).
- A real Claude Desktop on mote in a sandbox HOME (~/sb6459, removed
  after): `claude-desktop magpie`, `launcher add`, `launcher claude-dir
  on`. The window and caps moved into .claude-magpie-desktop/
  settings.json, ~/.claude kept only its theme, the script exported
  CLAUDE_CONFIG_DIR, and the launched Desktop's main process and
  children had it in their environment. `claude-dir off` moved them
  back and dropped the export; `launcher remove` removed the app.
  mote's real ~/.claude was listed before and after: unchanged.

Broken by hand:
- desktopOn without the clone-folder branch: TestClaudeDesktopIsolated
  ClaudeDir red (the window stays in ~/.claude).
- The fold without its ontoggle: desktop-isolated-claude red ("shut by
  the redraw").
- settingsapi not keeping the field: TestSettingsSaveKeepsWhatItDoes
  NotSend red.

Not tried: a Code-tab session driven in the real Desktop's UI, so
bundled Claude Code writing into the folder was not seen in this run
(an earlier look at #6459 saw it). Library has no targets for the
clone's folder yet (#6469). The whole GUI suite (1,484 files) was not
run; the files on the Agents page and every i18n file were.
2026-11-13 16:02:12 +08:00
yetone 507d612340 mcpauth: an MCP server's sign-in page is opened only when it is a web page
A sign-in to an MCP server opens the authorization_endpoint its metadata
names, and the GUI handed that URL to the system (open / xdg-open /
rundll32 url.dll,FileProtocolHandler) without looking at its scheme. A
server the user added in the Library could name file:///…/Some.app, a
file://\\host\share\x.exe UNC path, smb:// or an app's scheme, and
pressing Sign in would launch, mount or hand off what the server chose.
/api/open already kept to http(s); this path skipped it.

- mcpauth.WebURL: http or https with a host. start refuses any other
  authorization endpoint before a flow (and its callback listener) exists.
- gui.openMCPSignIn checks it again before OpenURL, so a State that
  didn't come through start is still not opened.

Test: TestAuthorizeEndpointIsAWebPage (file:, UNC file:, smb:, vscode:,
javascript:, https with no host) — red with the check turned off by hand
(the sign-in started at file:///System/Applications/Calculator.app?…),
green with it.

Run (mote; mica's disk is full, mote at load ~33, small run only):
go test -count=1 ./internal/mcpauth/... ok; go test -run
'MCP|SignIn|Library' ./internal/gui ok; go vet darwin ./internal/mcpauth
./internal/gui, GOOS=windows, GOOS=linux -tags nogui ok; gofmt -l clean.
Not run: the full suite.
2026-11-13 15:22:32 +08:00
yetone f3ad175fb2 library: an MCP server's sign-in keeps to its link when Settings say so (hkxhkxhkx on X)
hkxhkxhkx asked for magpie never to open OAuth pages in the browser on
its own. Settings › Privacy › Sign-in pages › "Open sign-in pages in the
browser" (signInLinkOnly, since a45a0f1c5) already does that for every
account's sign-in, built-in and plugin, in the window, a web tab and the
command line (`magpie accounts add`, a plugin's login; `magpie settings
set signInLinkOnly true` sets it there). Audit of every route that opens a
sign-in page: the one it missed is an MCP server's OAuth sign-in from the
Library, which /api/library/mcp-signin opened in the default browser
whatever the setting. The TUI starts no sign-in; `magpie web` opens
magpie's own page (it has --no-open), not a vendor's.

Now /api/library/mcp-signin goes through openMCPSignIn: with the setting
on it opens nothing and answers linkOnly. The Library opens no tab of its
own on linkOnly (web), opens the server's editor from a row's sign-in, and
shows the same words as an account's link-only sign-in, the link with Copy,
and Open in browser. No new strings.

Still opened whatever the setting: a plugin whose own sign-in opens the
page or a Chrome window (Grok Build's CLI on macOS and Windows; agnes,
inkstone, astudio, mclaw, sensenova drive Chrome to sign in).

Run (Linux, magpie-desktop via wsl-run; mote was over its load the whole
time with eight full suites queued, mica's disk full):
- TestMCPSignInLinkOnlyOpensNothing (new), TestSignInLinkOnlyOpensNothing,
  TestMCPSignInSaysTheBrowserDidntOpen, TestOpenSignInLinkOnlyAsked,
  TestCoreScriptBudget, TestI18n* (-tags nogui): ok.
- mcp-signin-link-only.test.cjs (new; en, zh, zh-TW, ja, de; desktop and
  web; 1100 and 420px; Chromium and WebKit) with signin-browser-down,
  mcp-signin, mcp-signin-click, mcp-accounts, signin-link-only and
  i18n-keys: 146/146.
Broken by hand: the route back on openError, the new Go test red ("its
page was opened 1 times"); client.js back to main's, the new GUI test red
(no link-only note).
Not tried: a real MCP server's sign-in in the app; the whole GUI suite;
the full Go suite before the push (started after it).
2026-11-13 15:13:13 +08:00
yetone a65dade2e3 gui: an accent colour of your own and a picture behind the pages (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS asked for colours beyond the three themes and for a
local picture. Settings › General gains two rows under Appearance:

- Accent color: magpie's own, six quiet presets (Blue, Teal, Green,
  Orange, Pink, Graphite) and a swatch that opens the system's colour
  picker. Saved as settings.accent (#rrggbb only, checked in saveOwn;
  `magpie settings set accent "#0d9488"` works through settingsapi.Keys).
  The server draws it (appearance.go accentVars): darkened on the light
  theme and lightened on the dark one until it reads as text at 4.5:1
  on the background and cards, with white or near-black text on it,
  whichever reads better. Never under Omarchy, whose theme is the look.
- Background image: Choose… takes a PNG, JPEG, GIF or WebP of 16 MB at
  most, sent as base64 JSON to POST /api/appearance/wallpaper, saved as
  `wallpaper` in magpie's folder (edit.WriteAtomic); settings.Wallpaper
  is its stamp. A thumbnail, Change and Remove show; Remove deletes the
  file. It is drawn behind the window's pages (never the tray panel)
  under a veil of the theme's background at 84%, so text reads as on
  the plain page; the cards stay opaque, and body's colour stays the
  theme's, which Windows' title bar tint reads.

boot.js puts the look's stylesheet in before the first paint and says
which look it drew (bootPrefs.look); applyPrefs asks /api/appearance/css
only when the settings' look differs. The rows, with the Colorblind,
Reduce motion and Loading bird rows, are drawn by appearance.js,
imported when Settings draws, so the core scripts stay under their
budgets with no raise (app.js 2,393 under, the core 503 under).
A save of Settings that doesn't send accent keeps it (Merge guard),
and the wallpaper stamp is kept by every Settings save.

fonts.test.cjs: the two new rows push the font row to the foot of its
560×620 window, where Playwright's click scrolled it in by a pixel and
the test read that as the page moving; the reader now scrolls it in
first with the wheel. settings_keep_test sets Wallpaper; the three
/api/appearance routes are named in the CLI parity test's notYet.

Run (mote, at this change on origin/main 406ad72f1; after the rebase
on fa3ee5a7e, which touched only the Library plugin and the site here,
the core budget, TestEveryRoute*, TestSettings*, TestAccent*,
TestWallpaper*, appearance-look and i18n-keys again, the same result):
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  internal/gui, settings, settingsapi: clean.
- go test -count=1 ./internal/gui/... ./internal/settings/...
  ./internal/settingsapi/... ./internal/cli/...: ok.
  (go vet ./internal/cli too.)
- GUI, chromium and webkit: appearance-look (picking a preset, the
  reader's own and back; boot.js's look not fetched again; choosing
  and removing a picture; the rows keep their height while
  appearance.js loads; en, zh, zh-TW, ja, de at 420 and 1000px: rows
  fit, words translated), fonts, settings-general, settings-sections,
  settings-groups, reduce-motion, skeleton-bird, i18n-en-no-cjk: green.
  Red the same at origin/main 7693cf263 without this change, all
  filed: api-key-theme (#6444, filed now), i18n-keys "No folder"
  (#6422), settings-search and settings-lines-wrap de 440px (#6353).

Broken by hand, each red, then restored:
- Merge guard removed: TestAccentSetting red ("a save without the
  accent changed it").
- accentInk = 1.0: TestAccentReadable red.
- applyPrefs' lookPaint call removed: appearance-look's accent and
  picture tests red in chromium.
- the thumbnail made 66px tall: the row-height test red.

Not tried: the real app on Windows, Linux or Omarchy (title bar tint
with a picture, WebKitGTK drawing the layers), the system's real colour
picker dialog (the test sets the input's value), a 16 MB picture in the
real web views, and the whole GUI suite (queued on mote's suite lock
after the tag).
2026-11-13 13:52:41 +08:00
yetone 2f34649a6e gui: Claude and Codex accounts get "Sign in on another computer…", the link alone (Wing8Aqua on X)
Adding an account opened the local browser, the only way not to being a
Privacy setting nobody finds. The ideal sign-in is often another machine
(another region). Under Claude's and Codex's accounts a row starts the
sign-in kept to its link: /api/signin takes linkOnly, opens nothing here
and the window shows the link with Copy and Open in browser (f4f104d1c)
and the paste-back field for the address the other browser ends on. The
setting and the default are unchanged; other subscriptions are not given
the row (plugin sign-ins are not touched).

Run: see push notes.
2026-11-13 11:02:15 +08:00
yetone 5f5307ab6d gui: each embedded file is hashed once, not on every load
revalidated read each embedded file again on every request to make its
ETag, and the page "/" read and hashed every file it names to version
their URLs. A release's files never change, so each one's sum (and the
versioned page) is now kept in a sync.Map after its first read. A dev
build (-tags dev) reads from disk and keeps nothing.

Measured: TestStaticFilesHashedOnce, 20 loads each, on mote:
  with the memo   green (app.js under 1x its size, page under 6x its)
  memo off by hand  app.js 26,516,856 B; page 165,916,424 B (~8 MB a
                    page load) - red
Run on mote: go vet ./internal/gui and -tags dev; go test -run
"StaticFilesHashedOnce|VersionedFilesKept|WebCompresses|PageFilesRevalidate|Revalidat"
./internal/gui ok.
Not tried: the full GUI suite (no change to what is served).
2026-11-13 05:31:22 +08:00
yetone 3d4c8edcea gui: Open the Codex app is in Codex's row menu, not a button on its row
ee1553913 (Yink88564391 on X) put an Open button on Codex's Agents row,
between its Details and its model picker, so that row's Details sat
further left than every other row's (the owner, 11-13: "导致整个页面在
视觉上不是对齐的"). The button is gone. Codex's row menu, beside Open in
terminal, has "Open the Codex app" where the desktop app is installed
and Open Codex with doesn't say Terminal (openApp); it posts agents/open
with the id alone as the button did. With no app, Open in terminal is
the menu's only way, as before the button. The tray panel and the web
build have neither. Its CSS and the "Open Codex in a terminal" words go;
comments and the setting's error say "Open Codex with", not the button.

codex-open-button.test.cjs now opens the menu, and checks every
connected row's Details and model picker start at one x.

Run (mica): GUI codex-open-button 62/62, agent-open-terminal 24/24,
agent-prefs 56/56, i18n-keys, i18n-en-no-cjk, chromium and webkit,
en/zh/zh-TW/ja/de, 900 and 400px; go vet internal/gui, settings,
provider; go test internal/gui, settings, provider, agent -run
"Codex|Budget|Settings" ok; gofmt clean.
Broken by hand: the button put back on the row turns the line-up check
red (codex 479 vs claude 532 at 900px, every language).
Again at 5c1c38f63 after the rebase onto dbaf9d68c (mica): codex-open-button 62/62,
i18n-keys, go test internal/gui -run "Budget|Codex" ok.
Not tried: a real Codex app open from the menu; Windows and Linux.
2026-11-13 04:22:45 +08:00
yetone 926b1e7dfb provider, gui: put back what 8c7328f3a took out of main by mistake (35aaaa4b9, 2fa79aef3, 797a23cad)
8c7328f3a (remote quotas: a Remote set to Select none still tells its
cards) was committed from a stale tree. Beside its own three files
(docs/subsystems/providers-accounts.md, remote_quotas_scope.go,
remote_quotas_test.go) it wrote 21 files back to their state before
35aaaa4b9, which took out:

- 35aaaa4b9, the Codex client setting (codex_request.go, codex_tier.go,
  settings.go, settingsapi.go, api.go, app.js, i18n.js, index.html,
  codex-client.test.cjs and the rest);
- 2fa79aef3, a save of the bytes a file already holds changes nothing
  (#6289: logins.go, logins_unchanged_test.go);
- 797a23cad, the tray's words (traywords.go, traytip_words_test.go).

The 21 files are checked out from 8c7328f3a^. After this commit
`git diff 8c7328f3a^ --stat` names only the three remote-quota files,
so main is the three lost commits plus 8c7328f3a's own change.

Run (mica, at this tree): gofmt -l clean; go test -count=1 -tags nogui
./internal/provider ./internal/settings ./internal/settingsapi ok.
./internal/cli and . are red on main already, not from this: the
codex-client and codex-open routes have no notYet entry, and
catalog.go's mmddSnapshot is compiled at launch (1ca2c62c4). Both are
fixed in the next two commits.
2026-11-13 02:00:40 +08:00
yetone 8c7328f3a6 remote quotas: a Remote set to Select none still tells its cards (@LOYSoLuI4PG4WlN on X)
On 0.1.3929 a Remote magpie added for the Usage page's quotas showed none
of the remote's subscriptions any more. cfd49e36a made a Remote's cards
follow its enabled models, and remoteCardWanted answered no card at all for
a provider that serves no model (Select none). Select none is documented to
serve no model while its balance and usage are still read and shown
(Provider.NoModels), and a Remote kept only to read quotas is set that way.
Now every card is wanted then; picks still narrow cards by their whole
provider path (93b855d90), and a list not read leaves all shown.

Run (mote): TestRemoteSelectNoneStillShowsItsCards is red on origin/main
797a23cad's scope file put back by hand ("map[]") and green with the fix;
-run 'Remote|Quota|Card' in internal/provider and internal/gateway ok;
go vet darwin/linux/windows of both packages ok; gofmt clean. GUI: remote-*,
usage-*, routing-remote-windows, panel-usage*, name-suffix-remote and
statusline-remote files in chromium and webkit: 74 red, all in usage-agents-hide,
usage-cards-hide, usage-fold, usage-hidden-way-back, usage-ledger,
usage-range-times, usage-speed-all-models, usage-compact-counts and
remote-magpie's address test; the same files are red the same on origin/main
797a23cad (75 red), already filed (#6003, #5475, #3414). The change is Go only.
Not tried: a real second magpie in sandbox HOMEs (a fake peer in the test),
the full Go suite (started after the tag).
2026-11-13 01:25:57 +08:00
yetone 35aaaa4b94 codex: a setting for which client the requests to ChatGPT say they come from, CLI or Codex Desktop (ouhthuo on X)
ouhthuo wants the originator "Codex Desktop", with which, they say, a
high-effort gpt-6.1-sol request is routed to a newer model. magpie sent
codex_cli_rs on every request, and codexSign even overwrote a real Desktop's
own originator.

Settings > Codex > "Codex client" (CLI, the default, or Codex Desktop; the
settings key codexClient is "" or "desktop", POST /api/settings/codex-client,
no free text). codexClientHeaders is the one place that sets originator and
User-Agent, so the model requests, the /wham usage and reset calls, the token
refresh, the device and code sign-in exchanges and "test as" all follow it.
Desktop sends originator "Codex Desktop" and the UA shape codex-rs builds for
it: Codex Desktop/<codex version> (<os>; <arch>) unknown (Codex Desktop; <app
build>). Source: codex-rs login/src/auth/default_client.rs and a captured
Desktop UA. The default is unchanged; base_instructions and the identity
prompt are untouched. The OAuth authorize URL keeps codex_cli_rs.

The row sits in the Codex agent preferences, 5 languages. The two Codex menu
buttons share one helper (codexMenuPick) so app.js stays inside its budget
without raising it.

Run (mote): TestCodexClientSetting (red with codexClientHeaders ignoring the
setting), settings, settingsapi, gui and provider Codex tests ok; gofmt clean;
go vet darwin, windows and linux nogui clean; GUI codex-client,
codex-service-tier, codex-open-button, i18n-keys, i18n-en-no-cjk,
settings-general, click-scroll in chromium and webkit ok. Real Codex account
in a sandbox HOME: gpt-6.1-sol and gpt-6-sol at high effort answer under both
identities with identical usage; the reply's model field only echoes the
requested name, so whether the served model differs can't be told from here.
Red and not mine, already filed: settings-search (#6133, #5982) and
agent-prefs "Settings line" (#6139) fail on origin/main, TestMoveToPlugin
#5524.

Not tried: the real Desktop app (not installed here); the app build number
in the UA is the newest seen in local logs and can go stale.
2026-11-13 01:17:30 +08:00
yetone 65f1fdd1d1 gui: the history's warm-up starts with the app's page, not at start
sessionRoutes started warmSessions when the routes were made, so a
magpie started at login, by `magpie tray`, or as `magpie web` with no
page read every session's stats, the Requests page's whole history and
Codex's effort for nobody. What those reads kept went two minutes later
(statsIdle, requestIdle), so the reads were pure cost unless a window
opened in those minutes. The warm-up now starts when the app's page is
first served (GET / or /index.html, not mode=panel); the steady GC
setting is still made with the routes. On Linux and Windows the main
window is still made at start, so the warm-up runs there as before.

Measured on mote with the real account's history (~15.6k sessions),
the sandbox HOME at ~/r2278/acct, proxies to 127.0.0.1:9:
- `tray` start, CPU in the first 30 s: w34 2.67 s, w35 0.96 / 1.04 s.
- `web` with no page, at 150 s: footprint 104 -> 64 MB, live heap
  62 -> 9 MB, CPU 2.52 -> 0.65 s.
- normal launch (window shown): the warm-up still runs in the first
  30 s (warmStart 0.84 s, warmStats 0.47 s, QueryPage 0.31 s), as on
  w34 (0.73 s).
- `panel` start: no warm-up in the profile, 1.62 s CPU, no panic.

Tests: TestWarmsSessions (app page, panel page, assets, HEAD), and
-run 'TestWarmsSessions|TestPanelOnFirstOpen|TestMainOnFirstOpen|Warm|Cold'
./internal/gui ok on mica; go vet ./internal/gui and GOOS=windows go vet
./internal/gui ok.
Not run: the full suite, the GUI suite (no page script changed), Linux
GUI vet (no gtk4 dev packages in WSL).
Not tried: a first Sessions page asked within seconds of opening the
window after a hidden start; it takes turns with the warm-up
(coldTurns), as a first start's window did before.
2026-11-13 00:32:17 +08:00
yetone ee1553913d gui: Codex's Agents row has an Open button, for the app or the terminal by a setting (Yink88564391 on X)
The Codex row on the Agents page now has an Open button beside the start
button. It opens the Codex desktop app (mac and Windows) when it is
installed, else Codex's CLI in a terminal. "Open Codex with" in Codex's
details (Automatic, Codex app, Terminal) picks which; it is this computer's
own setting (settings.CodexOpen, kept across a sync and a Settings save).
The row menu's Open in terminal still opens the terminal. The web build has
no button.

Run (mica): go test internal/gui, agent, settings, settingsapi, provider
ok; gofmt clean; GOOS=windows vet and GOOS=linux -tags nogui vet clean;
GUI codex-open-button (62), agent-open-terminal (24), i18n-keys,
codex-service-tier in chromium and webkit, en/zh/zh-TW/ja/de, narrow.
agent-prefs lists the new row.
Broken by hand: codexOpensApp always false turns TestCodexOpenButton red.
Budget: coreScriptBudget +1,112 for this code, packed small, no page to
move it to.
Reds on main before this change, same count at e18aca103 without it:
agent-details-ready (16 chromium), gui-ja and gui-de (one string),
agent-prefs panel-sheet test (5 chromium), and from 4e0026661
plugin-signed-out-account, plugin-signin-no-url, saved-signedout-remove,
signin-proxy. Not caused here; not fixed here.
Not tried: a real Windows launch of the Codex app, a real macOS app open,
Linux.
2026-11-13 00:11:20 +08:00
yetone 6edf7a69e5 usage: hide and show single quota rows of an Overview card (wangshaowei39 on X)
Antigravity's card lists Claude & GPT, Gemini and more. A row group can now be
hidden from Usage > Overview the way a card can: right-click or long-press a
row, or use the card's "..." menu, and choose "Hide <group> from Overview". The
"Hidden" line under the cards lists hidden cards and rows with an Unhide button
and Show all. The last group of a card cannot be hidden (use the card's own
hide). Persisted as settings usageWindowsHidden ("<card>|<group>"), changed
through /api/usage/arrange { windowsHidden } and kept by the Settings save.
Table view and tray panel are untouched.

Run (on mote):
- go test: TestUsageArrange*, TestUsageArrangeWindowsHidden (new), TestSettingsSave*,
  settings_keep guard, TestCoreScriptBudget, ./internal/settings, ./internal/settingsapi;
  gofmt clean; go vet darwin, linux nogui, windows.
- GUI, chromium and webkit: usage-rows-hide (new, 5 languages x 1200/560/390;
  32/32), usage-card-more 32/32, usage-arrange, usage-all-accounts 24/24,
  i18n-keys 4/4.
- usage-cards-hide and usage-hidden-way-back: "de 560" red (no sideways scroll
  635 vs 560); the same red on a clean origin/main a5e5f539a, filed as #6294.
Broken by hand: withoutHiddenRows returning its input turns usage-rows-hide
16/16 red in chromium.
Not tried: a real Antigravity account (fixtures only); full suite starts after
the tag.
2026-11-12 23:45:43 +08:00
yetone e18aca1038 agents: an agent's own context window, and a routing group's own Compact at (ul3140773077392, NovaStudiosss on X)
ul3140773077392 on X: dsh compacts earlier than other harnesses at the same
window, so one global size per model fits none. An agent's sheet (Agents,
the agent's Settings line) now holds "Context window": a size for every
model, or model=size pairs (provider/model, group/<id>, provider/*, a bare
model id, *). Empty follows each model's own window. It is applied in
provider.CatalogFor, the choke point every agent's model list goes through,
so dsh's contextWindow, Codex's catalog and Claude Code's window all read
it, and a window set this way makes Codex/Claude compact at that window
(Entry.WindowSet). Stored in settings.AgentContexts, kept by a general
save (settingsapi); POST /api/settings/agent-contexts and
`magpie model window <agent> [model=size...|off]`.

NovaStudiosss on X: Routing, a group's Edit, Advanced already had "Context"
(the window agents are told). It now has "Compact at" beside it
(Group.Compact; compactSet reads it before the members' smallest), also
`magpie group ... compact=`.

GUI: agentwindow.js, loaded on demand through agentcompact.js so app.js
stays inside its budget (TestCoreScriptBudget passes; the "Context window
in {agent}" label reuses the existing "Context window" key). Every agent
with fields now has a sheet; agent-prefs' Pi expectation says so.

Run at the pushed head, on mote: go vet (darwin; linux -tags nogui;
windows) on provider, agent, cli, gui, settings, settingsapi; gofmt clean;
go test provider, cli, settings, settingsapi, gui (TestCoreScriptBudget
and cli's route table fixed here), agent -run Dsh; node --test agent-window
and group-compact (chromium and webkit, en zh zh-TW ja de, 900 and 420px),
agent-compact, agent-prefs, compact-at. Reds seen identically on a
detached origin/main 4e0026661: agent-prefs webkit "in the panel a
Settings line..." (#6139) and old-webkit "compat.js is the first" / "styles
hold up in Safari 15.0" (#5919, #3403).

Broken by hand, each red then restored: withAgentWindows out of CatalogFor
(TestAgentOwnContextWindow, TestDshOwnContextWindow); the group branch in
compactSet (TestGroupOwnCompactAt); the settingsapi keep line
(TestSettingsSaveKeepsWhatItDoesNotSend); the window row in the sheet
(agent-window tests); compact dropped from the group save
(group-compact tests).

Not tried: a real dsh with a real account (its compaction is dsh's own;
the test reads the window magpie hands it), the full GUI suite (queued
behind another run on mote), Windows and Linux runs of the new tests.
2026-11-12 23:01:29 +08:00
yetone 4519eea711 gui: Settings › About has Report a problem, which copies the details and opens the feedback post (River_WLan on X)
A user who hit a problem had to work out what to tell us. Settings ›
About now has a Report a problem row with an Open button: it copies a
short block to the clipboard (magpie version, OS name and version,
architecture, and whether this is the app or the browser page), says it
was copied, and opens the feedback post
https://x.com/magpie_router/status/2119861020978188499 so the user can
paste it in a reply. GET /api/feedback builds the block and the URL.

The block holds no account names, keys, paths, host or user names, and
nothing is put in a URL: the opened address has no query or fragment.
The TUI has no Community links, so it gets nothing here. The core script
budget is raised by 458 bytes for the row and its translations
(1,263,851 to 1,264,309 with the provider commit under it).

Run, on mica: new TestFeedbackBlockHoldsNoPrivateFacts (version, OS,
arch, surface; no home dir, host or USER; URL with no ? or #; macOS
version present; unknown surface becomes app) and about-report.test.cjs
(clipboard gets the block, /api/open gets the post URL with no
diagnostics), chromium and webkit, en zh zh-TW ja de, widths 1100 and
420, 40 of 40 with about-website; vet on darwin, windows and linux nogui
clean. Broken by hand: a "Home:" line added to the block turns the Go
test red. A loaded run of the About files plus gui-de/ja/zh-tw and the
i18n files had 40 reds in usage and picker files; the reachable ones
were run alone on origin/main 5e933e153 (see the provider commit under
this one: usage-hidden-way-back #6295 and usage-agents-hide #3414 are
red there; the rest pass alone).

Not tried: the Linux app (WebKitGTK) and Windows; the clipboard write in
the Wails webview rather than a browser.
2026-11-12 19:31:11 +08:00
yetone 36eebea136 update: the header's Update pill waits until it is news (certhon520, jkd6688, Yuyuaneth, milianxinqi on X)
A release comes every few minutes, so a downloaded update was always
waiting and the pill (window and tray panel) never went out. /api/update
now says "quiet" while this version has been behind for less than 3 days
(update.Quiet, the Stable channel's soak; counted from the first newer
version seen, kept in update-behind.json for the version running), and the
pill stays away. An urgent release ("**Urgent release:**" in the latest's
notes or any release between, fetched once per check) lights it at once and
a dismissal does not hide it. The x dismissal now also starts the quiet over,
so the pill is not back with the next release. Settings > Version, the tray's
Restart to update, quit and Restart automatically are unchanged. Plugins'
dot is for plugins that do not update by themselves; left alone.

Run (mote): go test ./internal/update (ok), go test -run Update|Asset|Budget|Script ./internal/gui (ok),
gofmt, go vet darwin / linux nogui / windows clean, update-quiet.test.cjs 21/21 in chromium and
webkit across en, zh, zh-TW, ja, de, panel and window. Broken by hand: dropping
!u.quiet in app.js (11 red), forcing Quiet=false in jsonIn (TestUpdateQuietUntilBehindAWhile red).
Not tried: a real 3-day wait, and the urgent range lookup against the live site.
2026-11-12 18:00:00 +08:00
yetone 4940aed1d8 gui: times follow the system's region, not the webview's (iXerol on X)
A Mac set to English with Japan as its region (AppleLocale en_JP, 24
hours) showed 12 hours: with neither AppleICUForce24HourTime nor
AppleICUForce12HourTime set, the page formatted in WKWebView's
navigator.language (en-US). boot.js now carries the system's own tag as
"locale" (macOS: `defaults read -g AppleLocale`, with @rg= winning;
Windows: Control Panel\International LocaleName; Linux: LC_ALL, LC_TIME,
LANG), and intlLang takes it over navigator.language for English. The two
forced clock switches still win over the region's clock. A browser tab
keeps its own locale.

Run (mica): go test -run 'HourCycle|LocaleTag|Boot' ./internal/gui ok;
gofmt -l clean; go vet darwin, linux nogui, windows on internal/gui clean;
GUI hc-clock, reset-clock-formats, dates-gui-lang, i18n-keys, header-relang,
desktop-lang in chromium and webkit: 0 fail. Real AppleLocale on this Mac
reads en_SG. Broken by hand: intlLang back to navigator.language turns the
new en-JP case red in both engines. Not tried: a real Windows or Linux
session with a regional format that differs from the display language; full
suite starts after the tag.
2026-11-12 17:16:34 +08:00
yetone 8a705a5e5f tray: the menu bar's counts follow Settings' 万/亿 units (jipairamen on X)
The tray's totals (the Σ cell and the tooltip) always said K, M and B.
trayCount now takes the tray's language and, in zh or zh-TW with
chineseUnits on, says 1.33 亿 / 68.1 万 (億 and 萬 in Traditional) as the
page's fmtN does; English and the other languages are unchanged. The tray
is also read again when chineseUnits changes, with no restart.

The TUI and the CLI are English-only and the setting means nothing there
(settings.ChineseUnits: "when magpie speaks Chinese"), so they keep K/M/B.

Run (on mote): TestTrayCountFollowsChineseUnits, new, red with the unit
branch switched off by hand (all 8 cases and the total card), green after;
go test ./internal/gui ./internal/settings ok; go vet darwin, linux
(nogui) and windows clean; gofmt clean.
Not tried: the live menu bar (never run the live binary).
2026-11-12 16:03:34 +08:00
yetone 5dd63727ce gui: a state sends each option once, its lists as indexes into them
After 647071f2b the real account's /api/state was still 346,210 bytes:
17 lists, 327KB, most of them each agent's 231-255-option catalog with a
few models of its own first, so no two were alike. The state now sends
each option once, in "options", and each list as the indexes of its
options ("optionLists"); api() in app.js looks each one up as it puts a
field's list back, a fastFor of "*" still given the agent's id.

shareOptions tells alike options apart by sorting pointers to them by
Value (slices.SortStableFunc on int32 indexes), not in a map, and each
list is a run of one []int32: a map sized for the options made
TestStateWriteGrowsNoBufferItsSize allocate 977KB for its 1.6MB state
(12,000 options unlike each other), the bar is half the state; now it
passes. writeStateJSON writes the indexes through one 512-byte buffer
and each option alone, as each agent is.

Run, at this tree on mote:
- go vet ./internal/gui; go test ./internal/gui: ok (TestCoreScriptBudget,
  TestStateWriteGrowsNoBufferItsSize, TestStateSendsEachOptionListOnce,
  which now also counts the 7 options its 4 lists name once each).
- state-option-lists.test.cjs: 16/16, Chromium and WebKit, 5 languages,
  1000px and 420px; crush's list now starts with one model of its own,
  an index past the shared catalog's. Broken by hand: without the
  options lookup in app.js, red (8 of 8 Chromium).
- Real account (sandbox HOME with its data), magpie-w19: GET /api/state
  159,767 bytes (689,949 before 57443ac5f, 346,210 at v0.1.3848),
  14,765 gzipped, 7-9ms a GET; ?last=1 159,779. Its agents, lists put
  back, are equal to w18's.

Not tried: the whole GUI suite; a real window drawing this state.
2026-11-12 14:24:46 +08:00
yetone 57443ac5f5 gui: a state sends each fields' option list once
With real accounts /api/state was 689,949 bytes, and agents[].fields
carried 707,970 of them before escaping: the model field's options, the
whole ~51KB catalog, went once per agent, 13 of 16 agents alike (crush
and dsh twice). Each window shown, each click that answers with a state
and every start's kept state (agents-state.json) encoded, sent, parsed
and held it again per agent.

writeStateJSON now sends each list once, in the state's last field
optionLists, and a field names its list by "list" (from 1) in place of
"options" (shareOptions). The lists are encoded one by one, as the
agents are, so no buffer grows to their size. The kept file is written
the same way, so its sum still matches. api() in app.js puts each
field's list back before anything reads the state, so every reader sees
the state as it was; the agents now share one array, which setFast
already treated as one model in every agent's lists. POST answers that
write the state with writeJSON are unchanged.

Run:
- go vet ./internal/gui; go test ./internal/gui (mote) ok.
- TestStateSendsEachOptionListOnce: red with shareOptions returning s
  unchanged (0 lists sent), green with it.
- state-option-lists.test.cjs, Chromium and WebKit, en zh zh-TW ja de
  at 1000px and en zh at 420px: 16 of 16. Red with api()'s line taken
  out.
2026-11-12 14:10:22 +08:00
yetone 698ed4adb5 gateway: a busy port names the program holding it, and Tailscale's serve gets its fix (pluoki on X)
The Gateway page, `magpie serve` and the app log said only "port N is held by another program". pluoki's was `tailscale serve` on the same port number.

proc.PortHolder reads the holder (lsof on the Mac, /proc on Linux, Get-NetTCPConnection on Windows). Tailscale's daemon is root's and often unreadable, so `tailscale serve status --json` is the fallback for the port. gateway.NoteHeld / PortHeld.Sentence say who holds it, and for Tailscale give `tailscale serve --https=<other> http://127.0.0.1:<port>`. Shown in the `magpie serve` standby line and bind error, the app log, `gatewayHeld` in /api/state (Gateway page) and Start's "taken" answer, in en, zh, zh-TW, ja, de. A holder that can't be read says nothing; the old wording stands. Nothing is killed or touched.

Run: gofmt clean; go vet darwin, linux nogui, windows (mica); go test ./internal/proc ok; targeted holder/gateway tests on macOS (mica), Windows (win-run) and Linux (wsl-run); parser tests with real lsof output; GUI gateway-port-holder, gateway-takeover, gateway-older, gateway-skew, gateway-port, i18n-keys, i18n-en-no-cjk in chromium and webkit. Real run on WSL: a holder named tailscaled on the LAN address with magpie on 0.0.0.0 gives the Tailscale sentence at the bind error; a Python holder on loopback gives "held by python3.12 (pid N)".
Broken by hand: each fix reverted in turn, its test went red.
gateway-card.test.cjs is red on origin/main too (#6029). internal/gateway, gui and cli package runs were still going at push; the full suite follows the tag.
Not tried: a real `tailscale serve` (changes live config), a real Windows holder end to end, the bind-error path on macOS (a wildcard bind coexists with a specific one there).
2026-11-12 09:46:34 +08:00
yetone 50ce30d56e gui: times follow the system's 12 or 24 hour clock (iXerol on X)
An en-US Mac set to 24-Hour Time showed Routing's request times in 12
hours: no webview hands the page the system's clock, and navigator.language
carries only the region. boot.js now says it as hourCycle ("h23" or "h12",
left out when the system names none, and for a browser tab, which keeps its
own): macOS from AppleICUForce24HourTime / AppleICUForce12HourTime, Windows
from Control Panel\International sTimeFormat, Linux from gsettings
clock-format. intlLang() adds -u-hc-<cycle> to its tag, so every formatter
that takes it follows, and the places that forced 24 hours (hour12: false,
hourCycle h23) spread hourClock() instead: 24 unless the system says 12.
Read once per 30s, so a change in System Settings shows at the next load.

Run on mote: new hc-clock.test.cjs (en-US on a 24h system, en-GB on a 12h
one, a silent system), chromium and webkit; Go tests for the three readers
and boot.js; gofmt; go vet darwin, windows and linux nogui; internal/gui
tests; GUI files of gui-*, i18n-*, panel-*, quota-*, reset-*, routing-*,
usage-* in chromium and webkit. TestCoreScriptBudget was over by 77 bytes
and passes with two app.js comments cut, no raise.
Broken by hand: hc-clock goes red (2 of 3) without the intlLang suffix.
Not tried: a real Windows or Linux session's setting (the readers are
unit-tested on their formats), a live Mac.
2026-11-11 04:13:38 -08:00
yetone e3e774be7a agents: Claude Code's Co-Authored-By commit signature on or off from its settings (9_bishi on X)
Claude Code's row in Agents > Settings gets a "Commit signature" On/Off menu. Off writes
Claude Code's own key attribution.commit = "" in settings.json; On takes out only what
hid it (attribution.commit "" , attribution false, includeCoAuthoredBy false), so the
default comes back. A custom attribution text is the user's own: the row shows "Your own
text", is disabled, and is never written over. attribution.pr is untouched.
Route POST /api/settings/claude-attribution, S2 in the settings parity test.

Run at the rebased head (on 967fefcec), on mote with a private GOCACHE:
- go test ./internal/agent -run Claude, ./internal/cli -run Parity|Settings,
  ./internal/gui -run Budget|Script: ok
- GUI claude-attribution.test.cjs + i18n-keys.test.cjs in chromium and webkit: 6/6 each
  (en and zh, fake API)
- gofmt -l clean; go vet darwin, linux (-tags nogui), windows: ok
- agent-prefs.test.cjs chromium: 5 of 28 red, identical at base 745d209dc and here
  (#6139); not from this change.
Broken by hand: Off writing "x" instead of "" turns TestClaudeAttributionSet red.
Not tried: a real Claude Code making a real commit, the Windows box, the full suite
before the tag (started after it), webkit for agent-prefs.
2026-11-11 18:14:10 +08:00
yetone 4cc20f93c0 routing: a group says whether its requests are masked (1dwsdqwd2 on X)
Group.Redact: unset follows each member's provider (Send requests
unmasked), "on" masks as Settings say whichever provider, "off" sends
to every member as written. In a group in a group any "on" wins over
"off"; Settings with masking off still masks nothing. Every route that
reaches a group asks the same way: unredactedRoute (a provider's
fallback groups and provider.GroupsAfter), unmaskedMembers, maskedFor
and MaskRoute, and candidate.unmasked() for embeddings, images, video,
decide and count_tokens. A shared group never carries it (export and
import clear it; an import over a group keeps the old one). A save that
doesn't name it keeps it; "follow" clears it. The Routing group editor
gets a Masking row (menu, no select) in zh, zh-TW, ja, de, reusing core
strings; the Privacy page's unmasked warning counts groups set to off.

Run at the pushed head's parent (rebased on origin/main): gofmt -l, go
vet provider/gateway/gui, go test provider gateway gui cli (gateway ok
1091s, gui ok, cli ok); provider red only in
TestCancelledPluginSignInSavesNothing, open as #5047, green alone x10,
not touched here. group_redact_test.go broken by hand (UnmaskedBy's
on/off cases deleted): 5 tests red. group-redact.test.cjs: 5 languages
x 2 widths x chromium and webkit, 30 of 30; i18n-keys green.
Not tried: a real vendor request through a masked group.
2026-11-11 17:54:42 +08:00
yetone 2c644da040 settings: a Quick check tests image, speech, transcription and search with one real call (EV_John_Liu on X)
EV_John_Liu on X: "现在不是有图片生成、asr、tts管线和网络搜索。能不能做个快速
检测。可用". Settings › Models now ends with a Quick check: a row per
pipeline, each with Test, and Test all. A check makes the smallest real
call through the gateway, the way an agent's request goes:

- image generation: the image model in force (drawer), prompt "a dot", n 1
  (quality low for gpt-image);
- text to speech: the first enabled model that serves speech, "Hi.";
- speech to text: the first that serves transcription, 1s of silence as a
  16 kHz WAV;
- web search: one query through the searcher in force.

A row says ok with the model and how long it took, the vendor's error with
its status (provider.APIError's reading), or that nothing is set up. A 200
with an empty body is not ok. A check costs the user money, so it runs only
on a click: drawing the page calls nothing (the GUI test counts calls).
Disabled models are skipped. tts/whisper models are read from the
provider's own list, since the kept listing leaves them out.
POST /api/pipelines/check answers "Another magpie serves the gateway"
when this one doesn't serve it. pipecheck.js is loaded lazily, so the
core script budget is unchanged.

Run at this head (rebased on ce0cbff61). mote's disk was full (113 MB
free), so the Go and GUI runs went to the Linux box (WSL magpie-desktop):
- gofmt -l clean; go vet linux (-tags nogui) and windows on the Linux box,
  darwin on mote once it had room: all clean.
- go test -tags nogui ./internal/gui/ ok (2033s); go test -run
  'TestCheck|TestPipeline|TestAudio|TestSpeech|TestTranscri'
  ./internal/gateway/ ok; go build -tags nogui . ok.
- pipeline-check.test.cjs, chromium and webkit, en/zh/zh-TW/ja/de, 1100px
  and 400px: 16 of 16 ok. i18n-keys, search-key-list and video-gen-pick
  ok.
- Red the same at origin/main ce0cbff61, not this change: old-webkit
  (headerpresets.js #6030, Safari 15 :has() #5919), settings-search
  (/api/update/using, #5982), settings-hints ja/de 420px in both engines
  (#6073, Linux numbers added there).

The test brings a row into view with the wheel and waits for the scroll
to rest (WebKit's runs on after the event; script scrolls are put back
by app.js), then presses where the button is.

Broken by hand, each red, then restored:
- FirstServing ignoring the provider's own model list: SpeechSaysAWord,
  SpeechSaysTheVendorsError, TranscriptionSendsASecondOfSilence red.
- taking a disabled model: TestCheckSkipsADisabledModel red.
- any answer counted ok: SpeechSaysTheVendorsError red (OK:true Status:400).
- a check run when the page draws: pipeline-check.test.cjs 8 of 8 red in
  chromium (a row showing "Testing…").
- not red: a press that scrolls #view-settings, or that adds 60px above
  the list. app.js holds the clicked element in both cases, so the test's
  "stays put" check guards that app-wide rule (click-scroll owns it), not
  pipecheck.js.

Not tried: a real call to any vendor (fakes only); the real app window
on Windows, Linux or macOS; the whole GUI suite (only the files this can
reach, listed above).
2026-11-11 15:10:25 +08:00
yetone f5e1b10913 settings: longest context can hold a model's own window too (WJaunita45604 on X)
v0.1.3681's Longest context left a window the user set for a model, or "*"
on its provider, alone even when longer. Settings > Models > Routing now has
a menu beside the field: "Models without their own" (the default, as before)
or "Every model". In both modes the shorter of the cap and the user's own
window is told; they differ only when the user's own is longer (own keeps it,
every model brings it down). Settings.ContextCapAll, Settings.CappedOwn,
POST /api/settings/context-cap-mode {all}, magpie model context-cap all|own.
Applied in provider.windowIn (so /v1/models, catalogs, compaction), Codex's
CodexNativeWindow/CodexWindow (the list's ETag tag carries the mode) and the
gateway fallback window. i18n in zh, zh-TW, ja, de.

Run (wsl-run, mote's disk was full): provider (full), settings, settingsapi,
codexcat packages; cli -run ContextCap; gateway -run ContextCap|ModelsList;
GUI context-cap, i18n-keys, model-load, settings-places, settings-general in
chromium and webkit; TestCoreScriptBudget; gofmt; go vet nogui and
GOOS=windows vet. Broken by hand: windowIn's CappedOwn removed turns
TestContextCapAllHoldsTheUsersOwnWindowsToo red.
Not tried: the whole Go and GUI suites, a real Codex reading the list, macOS
or Windows runs, GUI in zh-TW/ja/de beyond the i18n-keys check.
2026-11-11 14:28:17 +08:00
yetone 059d995d56 gateway keys: the list reads the ledger once for all keys, and a proxy's web page is said by its title (aiandcloud on X)
aiandcloud (2.98B tokens, 12,654 requests a day, server mode behind a
proxy) saw Gateway keys draw a Cloudflare 524 page as raw HTML.

Slow list: every poll of /api/caller-keys read up to a month of ledger
rows once per window per key. budget.AllOf now reads each distinct window
once for all keys, and keeps the settled blocks' sums with a cursor
(usage.VisitFrom), so a poll only reads what was appended since; the
unfinished tail block is always read again. A rewritten or shorter log
resets the cursor. All(k) is AllOf of one key.
Numbers (BenchmarkAll vs BenchmarkReadEach, 8 keys x day/week/month,
31 days x 12000 rows/day = 372k rows, warm): 211-228 ms before, 23.5 ms
after.

Raw HTML: fail() now turns an error string holding a web page (a remote
magpie's or a vendor's 524/502 page inside the JSON error) into a short
said/what pair, "A proxy in front of magpie answered, not magpie ({what})"
with the page's title, translated in all 5 languages (key already in
i18n.js). The browser already handled non-JSON bodies (notJSON, #2032).

Run (Windows box, mote ssh was down earlier): go test budget, usage, gui
(AllOf, Budget, FailSays, I18n, Keys); gateway-keys-proxy-page and
gateway-key-limit GUI files in chromium and webkit, 5 languages: 24/24;
gofmt; vet windows, linux nogui, darwin (mote, only a clang deprecation
warning). Broken by hand: with the old fail() TestFailSaysAProxyPageByItsTitle
is red; with VisitFrom's reset() removed TestAllOfIsWhatEachWindowRead is red.
Not tried: a user-scale cold ledger, a server behind a real Cloudflare,
the full suite before the tag (started after).
2026-11-11 13:00:54 +08:00