Commit Graph
282 Commits
Author SHA1 Message Date
yetone f03ed8c26e agents: Open in terminal on a Mac's Agents row (coolmantou)
coolmantou on Discord asked to start an agent from magpie's Agents list.
In the Mac app's window, an agent row's menu (openRowMenu, the one the
grip and a right-click open) now has "Open in terminal". This includes a
row under Not set up. Clicking it posts POST /api/agents/open with only
{agent: id}. The server finds that exact id in agent.Detected() (not
agent.Find's prefix match) and builds the line itself: the agent's
Launch() where it has one (agy, Claude Science, Cursor local), otherwise
its program's path, single-quoted (BinPath, new in internal/agent).
openTerminal then opens that line with the user's Session terminal
choice. The command never comes from the page. Other systems, the web
build, WSL agents and desktop apps with no program are refused, and
their rows have no item (agentJSON.terminal). The tray panel's rows don't
have the item either. The label is "Open in terminal", not "Terminal",
because the user's terminal can be iTerm or Ghostty. The string is in
en, zh, zh-TW, ja and de. Windows and Linux are #4474.

The core budget had 39 bytes left on main, so no budget was raised.
Instead:
- the item says nothing on success; the terminal opening is the answer,
  and a failure goes to statusErr;
- the omp roles' comment above OMP_UNSET was cut to what OMP_UNSET's
  values don't already say.
app.js is now 22 bytes under main's size.

Run:
- go test ./internal/gui ./internal/agent on mote (macOS) and in
  magpie-desktop (Linux, -tags nogui), both ok.
  - TestAgentOpenRunsOnlyTheAgent puts claude in a folder named
    "it's a' $(touch made1) `touch made2`; touch made3 #". It posts the
    ids "claude; touch made4", "claude'$(touch made5)'" and "cl"; none
    of them opens anything. It then runs the line made for claude
    through /bin/sh and checks that only the program ran.
  - After the rebase onto origin/main 2604d68db, the core budget
    first went red (1,536,904 > 1,536,586). It passed again after the
    trims above, along with TestAgentOpen* and TestAgentCommand*.
- gofmt -l clean. go vet on darwin, GOOS=linux -tags nogui and
  GOOS=windows for internal/gui and internal/agent: ok.
- GUI, both engines (wsl-run): agent-open-terminal.test.cjs is new,
  14/14 at the pushed tree. It covers every language, a row under Not set up, no item for
  the desktop app, the web build or the tray panel, and checks that the
  post body is the id only. Its goto has 30s, since a goto while
  another suite ran on the box took 5s once. i18n-keys and agent-disconnect pass.
- Real run on mote in a sandbox HOME: the endpoint was called through
  the real openTerminal with an `open` on PATH that records instead of
  opening. It returned 204, and the open args were -a
  /System/Applications/Utilities/Terminal.app <file>. The file was
  -rwx------ and read: #!/bin/sh / '<sandbox>/.local/bin/claude' /
  exec "${SHELL:-/bin/zsh}" -l.

Broken by hand:
- agentCommand returning the path unquoted: the Go test went red with
  "ran more than the agent: [made1 made2 made3]".
- The term item dropped from openRowMenu: the 10 row tests went red.
- The panel and web gates dropped: the 4 gate tests went red.

Not tried:
- No terminal app actually opened. The scratch run recorded what
  `open` would get instead.
- iTerm, Ghostty and the other Session terminal choices were not tried.
- Launch() agents (agy, Claude Science, Cursor local) were not opened
  for real; their lines were already quoted and used by
  "Copy launch command".
- The full Go suite and the whole GUI suite were started before the
  rebase and not waited on (ship at once).
2026-10-31 01:22:28 +08:00
yetone a45a0f1c5d signin: Settings can keep sign-in pages out of the default browser (max2020)
max2020 on Discord signs in from a separate, fingerprint browser so the
vendor never sees their default one. Every waiting sign-in already shows
its link with Copy link (since 52c8e838d), but magpie still opened the
page in the default browser first.

Settings › Privacy › Sign-in pages › "Open sign-in pages in the browser",
On by default, so nothing changes unless it is turned off. Off
(settings.SignInLinkOnly) opens nothing: /api/signin and
/api/plugin-signin go through openSignIn, which skips the open and
answers linkOnly; a web tab skips window.open on linkOnly, after an
install step too; the box says the page wasn't opened and its button
reads Open, not Open again. `magpie accounts add` and a plugin's
command-line login print the link without opening it. A plugin whose own
CLI opens the page (Grok Build on macOS and Windows, opened) still does.

Callbacks, by flow: Claude Code's login, Codex (localhost:1455), ChatGPT
API, Gemini/Antigravity and localhost plugins come back to this machine,
so another browser on it finishes them, and the pasted final address
covers one whose proxy keeps it off loopback. Copilot, Grok and other
device-code flows work from any browser.

Run:
- TestSignInLinkOnlyOpensNothing (new; built-in and plugin sign-in, the
  setting on and off) with TestPluginSignIn*, TestSettingsSave*,
  TestCoreScriptBudget and TestI18n* on mote: ok. Budget holds with no
  raise (app.js 1,313,244 of 1,315,316).
- signin-link-only.test.cjs (new; every language, Chromium and WebKit,
  900 and 360px), signin-link and account-discovery on WSL: 42/42 and
  the neighbours green.
- Full Go suite on WSL (go test -timeout 45m ./...): every package ok
  except internal/agent's TestInstalledVersion, TestGrokInstalled,
  TestOmpDetectedWithPiDir and TestZedAppPath, red the same on
  origin/main 387e8572a there (#4033, #3548); root, internal/cli and
  internal/gui need gtk4 there and were run with -tags nogui: ok.
- gofmt; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: clean.
- The whole GUI suite (both engines) is still running on mote at push
  time; reds it shows that aren't on file get issues.

Broken by hand: openSignIn ignoring the setting made the Go test red
("built-in: kept to its link, its page was opened 1 times"); dropping
startSignIn's linkOnly check made the GUI test red ("no page opened",
12 of 42).

Not tried: a real vendor sign-in from a fingerprint browser; Grok on
macOS/Windows still opens its own page; MCP server sign-ins unchanged.
2026-10-31 01:02:24 +08:00
yetone 995f84a0f9 codex: how early an expiring reset is used is a setting
A Codex reset card that would run out unused was spent 30 minutes before
it expired, a fixed resetExpiryLead. Now the lead is codexResetLead in
settings.json (minutes, 15 to 1440). Unset, out of range or unreadable
reads as 30m, never 0, and magpie never writes it unless the user does.

- settings: CodexResetLead and Settings.ResetLead(); the menu's values
  are 15m, 30m (default), 1h, 2h, 3h, 6h, 12h, 24h.
- provider: the spend (expiringResetSpent) and routing
  (Allowance.Restarts, through nextResetLook) read the same resetLead(),
  so they still agree (#717, #718). The "near" look cadence follows it:
  lead + 30m, at least 1h, so a look lands inside a long lead.
- GUI: Settings > Usage, under the Codex auto-use rows, a row "Codex:
  how early before one expires" with an app menu (no <select>), and the
  sub text says spending earlier loses what the windows have left. The
  four "before it expires" strings say the chosen lead. POST
  /api/settings/codex-reset-lead; the general save keeps the field.
  en, zh, zh-TW, ja, de.
- CLI: magpie quota auto-reset lead [30m|3h|<minutes>|default].
- app.js budget: the auto-use rows moved out to lazy autoresetown.js
  (painted in the same draw once loaded), so app.js and the core script
  stay under their budgets with no raise. The button sizes to its widest
  label (a grid of every label), so picking one never rewraps the row.

Run (all on mote through mote-run):
- go vet: darwin, GOOS=linux -tags nogui, GOOS=windows; nogui build.
- go test -tags nogui -timeout 45m ./... at 3955adccf (this change
  before the paint and sizer fixes, which touch only GUI assets): 81 ok.
  go test ./internal/gui at this head: ok.
- GUI, Chromium: codex-reset-lead, codex-auto-reset,
  codex-auto-reset-settings, segs-press-redraw, i18n-keys: 62/62.
  WebKit: every case of those files failed at browserType.launch
  (180s timeout) before a page loaded, both runs; mote's browser
  launches hang under #4125 (load ~26), so WebKit is not run.
- Rebased onto f7f2d75f2 (old-webkit's lazy list now has traywindows.js
  too): go build ./..., go vet -tags nogui ./internal/..., go test
  internal/gui (budgets included), cli, settings, gateway: ok. provider:
  ok but TestQuotaSpanCarriesEveryWindowField, red on main since
  7d4a63148 (#4457, fixed in ccbefe2a2). GUI old-webkit, i18n-keys,
  codex-reset-lead in Chromium: pass.
- Rebased again onto 62a1dcdd7 (clean): go test internal/gui (budgets)
  and internal/provider: ok; i18n-keys and Chromium codex-reset-lead
  12/12 pass; old-webkit 9/10, its Safari 15.0 case a WebKit launch
  timeout (#4125).

Broken by hand, each went red:
- resetLead() pinned to 30m: all 3 provider tests.
- resetExpiryNear pinned to 1h: the long-lead look test.
- ResetLead's range check turned into m == 0: TestResetLeadUnreadIsDefault.
- GUI resetLeadMinutes returning 30: codex-reset-lead in every language.
- The button without the sizer: de at 420px, "no click moved the page".

Not tried: a real Codex account spending a card at a non-default lead;
Windows and Linux runs (vet only). The whole GUI suite in Chromium on
mote has ~45 tests in 31 files crash with "browser has been closed" on
untouched origin/main c84c3e1c0 too (reducedMotion files, #4458).
2026-10-31 00:41:29 +08:00
yetone 7d4a631480 tray: pick which of a subscription's windows the menu bar shows (StrikingRaw on X)
Claude Pro's menu bar card drew its 5-hour and 7-day windows as two
small stacked numbers, and the user wanted one of them alone. Settings ›
Usage › Menu bar windows (under Allowances in the menu bar) lists a pill
per ticked subscription with two or more windows ("Claude Code · All
windows"), opening the app's menu: All windows, then each window. The
choice is settings.TrayWindows, by provider id (every account of it, the
in-use "|*" card too) and by window kind from the span ("5h", "1d", "7d",
"month", "15m", "name:<name>" when the span is unknown), so a vendor
reordering windows changes nothing. Unset shows every window as before;
a pick whose windows are all gone shows every window again, never an
empty card. Only the bar's rows and the Linux label are filtered; the
tooltip still says every window. One row draws at mpRowFont's 11pt
single-row size. Hidden on Windows (its tray shows no text). Per
computer through KeepOwn. The GUI learns kinds from trayKind on
/api/usage/quotas (withTrayKinds; model and aside windows get none). The
row's code is a lazily imported traywindows.js, so the core script
budget is not raised (app.js +4 lines for the call and the prefs keep).

Run:
- mote (macOS): go test -run 'TrayWindow|TrayUsage|WithTrayKinds|
  CoreScriptBudget|AppScript|TrayImage' ./internal/gui/ ok;
  ./internal/settings/ ok; davsync TestSync ok. TestTrayImageOneWindow
  draws through AppKit: Claude's card one line ("42%"), both windows two;
  the PNGs were looked at.
- mote: gofmt -l empty; go vet ./..., GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./... ok; go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build ok.
- magpie-desktop (Linux VM), --test-concurrency=1, BROWSER=chromium and
  webkit: tray-windows (en, zh, zh-TW, ja, de; picking All; hidden on
  Windows / single-window / no cards; 360px narrow), i18n-keys,
  old-webkit, tray-usages, tray-logos, tray-cost, quota-pace: 43/43 each.
After rebasing on ec5571d6f: the focused Go run above, davsync and vet of
the touched packages ok on mote; tray-windows, i18n-keys, old-webkit,
tray-usages 27/27 in chromium and webkit on the Linux VM.
Broken by hand: the row filter in trayCardText off -> TestTrayWindowsPicked
and TestTrayImageOneWindow red; trayWindows out of prefsKeep ->
tray-windows.test.cjs red in every language. Restored, green.
Not run: the full Go suite (owner: ship each verified fix at once; mote
was at load 20-27 under another session's full GUI suite) and the whole
GUI suite. The GUI ran on the Linux VM because mote's browsers crash or
hang under that load (#4125; TestTrayCellClickReleasedPanel is red the
same way on origin/main c84c3e1c0 there).
Not tried: the live app's real menu bar with a signed-in Claude account
(the AppKit drawer was exercised in-process instead); Linux tray label
on a real desktop.
2026-10-30 23:14:08 +08:00
yetone 2ec3453647 gui: the main window opens where it was left (jorbenzhu)
jorbenzhu on Discord: after every update and restart the panel is back in
the middle of the screen. It is the main window: after an update magpie
starts again with `magpie gui <tab>`, and Wails opens a window centred
unless told otherwise. Its size and maximised state were kept; its place
never was (gui-shell.md said "The window's position is not kept"), so
nothing was lost on upgrade, there was nothing to restore. The tray's
panel opens under the tray icon on the Mac and Windows, and where the
click was on Linux, so it is not what moved.

Now settings.WindowAt keeps the window's top left corner (system
coordinates across every screen), per machine like Window (KeepOwn, and
the Settings page's save carries it over). keepAt saves it once a move or
resize has rested 500ms, unless the window is maximised, full screen,
minimised or hidden; settings.Save writes through temp and rename, and an
unreadable settings file is left alone. On the first show placeMain puts
it back (putBack): openAt picks the screen holding most of the window and
moves it fully onto that screen's work area; when no screen holds any of
it (a monitor gone) or the screens or the file can't be read, it stays
centred. Under Wayland a window can't place itself, so nothing is kept or
restored there unless GDK_BACKEND is x11 (keepsPlace).

Run:
- mote, at 3f8f1d88b (on d99e213f5): go test -timeout 45m -count=1 ./...
  80 packages ok; internal/gui red only in its 10 real-window AppKit
  tests (TestDockJoinLeadsCommandTab, TestPanelCloseHidesIt,
  TestPanelJoinsFullScreenSpaces, TestPluginPageLoadsItsFilesInTheWindow,
  TestDockReopenKeepsTheWindowsSpace, TestMainWindowCorners,
  TestMainWindowRightToLeft, TestHandoverLeavesTheMenuBarIconForTheNextMagpie,
  TestTrayCellClickReleasedPanel, TestCoveredWindowStaysUp), each killed
  at its deadline. The same 10 fail the same way on origin/main
  fa427216a: mote has no console session (#4125).
- mote, after rebasing onto 024393fbb (two gateway commits, none of
  these files): internal/gui (less the 10 above), internal/settings and
  internal/gateway: ok.
- mote: gofmt -l; go vet ./internal/gui ./internal/settings; GOOS=linux
  go vet -tags nogui ./...; GOOS=windows go vet ./...; go build, and
  GOOS=windows / GOOS=linux -tags nogui builds: clean.
- Windows (win-run) and Linux (wsl-run, -tags gtk3): TestOpenAt,
  TestSettleAt, TestKeepsPlace, TestOpenSize, TestSettle*,
  TestSettingsSaveKeeps*, TestWindowMaximisedKeptAndOwn: ok.

Broken by hand (each red, then restored):
- api.go not carrying WindowAt over a Settings save:
  TestSettingsSaveKeepsWhatItDoesNotSend red ("WindowAt: [] after a save
  of the Settings page, was [-1440 120]").
- KeepOwn not keeping WindowAt: TestWindowMaximisedKeptAndOwn red.
- openAt without the clamp and the gone-screen check: TestOpenAt red in
  7 of 12 cases.

Real app, Linux X11 (magpie-desktop, Xvfb 1920x1080 + xfwm4, sandbox
HOME/XDG dirs, MAGPIE_ADDR 127.0.0.1:3447, gtk3 build of this tree):
first start centred (630,240 in X terms); xdotool moved it to 200,150 and
settings.json got windowAt; restarted, it opened at 200,150; windowAt
[5000,4000] (a gone monitor) opened centred; [1700,900] opened at
[1260,480], flush with the bottom right (660x600 + GTK's 26px shadow).

Not tried: the real app on macOS (mote has no console session, #4125)
and on Windows (a sandbox magpie.exe rewrites HKCU\Software\Classes\magpie,
which points at another session's build there). Wayland is not restored
by design. Multi-monitor setups with mixed scaling were not tried on real
hardware; openAt's cases cover a second screen left of and right of the
main one.
2026-10-30 21:56:29 +08:00
yetone bed604efb3 gui: the Sessions list and stats answers are written into buffers kept between polls, the stats a day at a time (#2278)
With the Sessions tab open, every poll grew each long answer's buffer
from nothing: writeJSONRows' `whole` (~8 MB of rows) and writeJSONSame's
buffer plus encoding/json's own encodeState for the stats (~6 MB of
days), which the Encoder grows to the whole value after each
collection. In 90 s of polls while an agent worked, writeJSONRows was
245 MB and the stats' writeJSONSame 209 MB of 2702 MB allocated.

- answerBuffer/keepAnswer keep two buffers, dropped 30 s after the last
  answer (as the usage scratch lingers). A ResponseWriter copies what
  it is written, and only the rows' sums outlive the call, so nothing
  reads a buffer once it is put back.
- writeSame is writeJSONSame over a write func; writeJSONRows and the
  stats handler use the kept buffers.
- statsAnswer encodes the stats a Day at a time, byte for byte the
  Encoder of struct{ sessions.Stats; Agents } (the page's tag rests on
  those bytes).

Bench (mote, ~/r2278/full, hmw.sh: a gateway call every 3 s, 10
endpoints polled every 5 s with X-Magpie-Had; second runs compared),
e13 = 3bce283df, e14 = this:
  total alloc 2702 -> 2308 MB, writeJSONRows 245 -> 110 MB,
  stats encoding 209 -> 46 MB, /api/sessions/stats handler 306 -> 128 MB,
  GCs in 90 s 85 -> 71, fp_peak 347 -> 360 MB (noise band 345-370).
  Polls 170 x 200 in both. One e14 run (y14) had 60 answers of "400 Bad
  Request" (15 bytes, <6 ms): Go's net/http refusing a malformed request
  header from the bench's tag file; y12 at the old code had the same 60,
  and a rerun had none. That run is not compared.

Tests: TestStatsAnswerWritesWhatEncodeDid (nil/empty/HTML/U+2028 days,
keys, agents, a hidden Sessions), TestAnswerBufferKeptForTheNext
(writeSame and writeJSONRows put a buffer back that the next answer
takes). Broken by hand, each red: writeSame without keepAnswer (red),
writeJSONRows without keepAnswer (red), statsAnswer keeping Encode's
newline (red).

At 9d6461416 rebased on 9e73f69af (mote): gofmt clean; go vet -tags nogui
./internal/gui/ ./internal/sessions/ for linux, windows, darwin ok;
go test ./internal/gui/ -run 'TestStatsAnswer|TestAnswerBuffer|
TestWriteJSONRows|Sessions|Stats|Same' ok; go test ./internal/sessions/ ok.

Full internal/gui on mote at the pre-rebase tree: every test ok but ten
real-window AppKit tests killed at their 20-40 s deadline (dock order,
panel close/space, plugin page, dock reopen, titlebar corners/RTL, tray
shown, released panel, window up), mote's #4125 / #2645, which this
change doesn't reach.
2026-10-30 19:05:17 +08:00
yetone 3bebc38393 gui: a key combination opens the quick panel from any app (ben hanks)
ben hanks on Discord asked for a global shortcut that opens the menu bar
or tray panel. Settings › General has a new row, Quick panel shortcut,
with none set by default. Clicking its field records the next combination:
a letter, a digit, Space or F1–F20 with Ctrl, Alt/Option or Cmd/Win, or an
F key on its own. Esc or a click elsewhere stops recording, and the cross
clears the shortcut. It is shown the system's way (⇧⌘K on a Mac,
Ctrl+Alt+K elsewhere).

POST /api/settings/panel-shortcut checks the combination, has the running
app bind it through Wails' GlobalShortcut (Carbon hot keys on the Mac,
RegisterHotKey on Windows, XGrabKey on X11), and saves it only once it is
bound. One the system refuses is not saved, the old one stays bound, and
the status line says why. A pressed shortcut toggles the panel as a tray
click does. The shortcut belongs to each computer (KeepOwn), the Settings
page's own save leaves it alone, and the old Mac process lets go of it as
it hands over. On Wayland no app may grab keys, so the field is turned off
and the row names the command (`magpie panel`) to bind in the desktop's
own keyboard settings.

Every string is in en, zh, zh-TW, ja and de. No size budget was raised:
app.js is 1,315,252 of its 1,315,316 after older comments were cut.

Run at this head (rebased on origin/main 1534474c8):
- mote (macOS 27): gofmt; go vet for darwin, GOOS=linux -tags nogui and
  GOOS=windows on internal/gui and internal/settings; go build ./...:
  ok. go test: settings ok; gui ok except TestMainWindowCorners/
  macOS_26_SDK, red on macOS 27 already (#3949).
- Windows (xiaomi-gpu, win-run): go test internal/gui internal/settings.
  settings ok; gui has 5 reds, the same 5 on origin/main d19afb4c9
  (TestGatewayHeldByAContainer #2107/#3649; TestLodyImportHandoff,
  TestImportStatusUnreadableIsUnknown, TestAionUiImportRow and
  TestUpdateThatWontStart #4115).
- Linux (WSL magpie-desktop, wsl-run -tags nogui): internal/gui (the
  Wayland branch included) and internal/settings: ok.
- GUI: panel-shortcut.test.cjs (new) in Chromium and WebKit, in all 5
  languages, faking both a Mac and Windows: ok. Whole suite (make test-ui)
  on mote: unfinished at the push. Three other sessions' suites were on
  the same box (load 130 to 250), and after 1605 tests it was still in
  the "c" files. Its reds so far are agent-panel-name-width and
  connect-snippet-shell and context-map (each on #4304), and allow-ips
  zh, which is red alone on origin/main too (#4357).

Broken by hand, each red:
- leaving the shortcut out of the general Settings save:
  TestPanelShortcutSetting "the Settings page's save changed the
  shortcut";
- dropping KeepOwn's line: "a synced setup took this computer's shortcut";
- dropping the recorder's stopImmediatePropagation: panel-shortcut.test.cjs
  "a key typing needs was sent, or a window key ran".
TestSettingsSaveKeepsWhatItDoesNotSend now sets the new field.

Real build on mote: a dev build in a sandbox HOME bound a saved
Ctrl+Option+Shift+Cmd+F18 as it started, and a POST of F16 saved it and
bound it.

Not tried:
- a real key press on any system: mote gives ssh no Accessibility access
  to post events, and Windows' ssh session has no desktop;
- the Windows and X11 refusal of a combination another app holds (only
  the fake). On the Mac, Carbon takes a combination a second app
  registered too, so both apps get it and magpie can't say so. This was
  checked on mote with a helper holding F17;
- Wails' GlobalShortcuts portal on Wayland, which isn't used;
- a Linux GUI-tag build (WSL has no gtk4/webkitgtk-6.0).
2026-10-30 12:06:33 +08:00
yetone 7db0810b03 sessions: stats asked again unchanged are not encoded again; lists made at their size (#2278)
The Sessions page asks for /api/sessions/stats (7, 30 and every day) and
the list every poll. On a full history (52G Codex + 13G Claude) the
stats for every day are ~6 MB of JSON, encoded and hashed again on each
ask even when the page already had them, because the read behind every
10s replaced the kept stats with an equal copy.

- statsKept has a gen, kept when the read behind finds the same stats
  (sameStats: From, To, Keys, Days, what is sent). The handler keeps the
  tag last sent per ?days with its gen and agent names, and an ask with
  that tag is answered X-Magpie-Same without encoding. Only the 32-char
  tag is kept, no body.
- MergeExternalStats grows Sessions once for every external session; a
  Clip and then an append a session copied the whole list over and over.
- listSessions makes its page and its latest map at their size.

Run on mote at this head (rebased on 484bdca7c, run again after):
- go test ./internal/gui/ ./internal/sessions/: sessions ok; gui ok but
  TestMainWindowCorners/macOS_26_SDK, red on mote's macOS 27 the same
  without this change (#3949).
- GOOS=linux/windows/darwin go vet -tags nogui on both packages, gofmt.
- Broken by hand: the read behind always taking a new gen makes
  TestStatsTagKeptWhileTheSame red ("gen 2, want 1 kept").
- Real full history on mote, magpie web polled with the page's
  X-Magpie-Had, 10 endpoints every 5s, cur = cdf8151a2:
  alloc in 60s 1755 MB -> 1342 MB; bytes.growSlice 393 -> 105 MB;
  CPU in 60s 4.25s -> 3.60s, GC mark 1.28s -> 0.88s.
Not tried: the Windows and Linux apps; the encoding is the same code.
2026-10-30 08:32:57 +08:00
yetone c7ae24f0a6 gui: the warm-up's usage read sets no memory limit, a cold start stops collecting nonstop (#2278)
The warm-up's QueryPage(All) and Codex effort ran under tightenGC(true):
GOGC 25 and a soft memory limit at what Go held when the read began. On
a cold start the heap reached that limit all live, and gctrace showed a
collection every ~160 ms from ~11 s to ~24 s, heap = live = limit, about
one core the whole time.

Now the read takes GOGC 25 only, as a page's request already did, and
tightenGC lost its limit parameter and heldMemory.

Measured on mote (M5 Pro), cold start with no caches, 390k calls in
usage.jsonl plus a growing Codex rollout, 10 endpoints polled every 5 s,
60 s each (coldx.sh: footprint each second, gctrace, ps cpu time):
- before (v0.1.2111 head): CPU 3:39.33, 1166 GCs, phys_footprint_peak 855 MB
- after: CPU 2:05.86 / 2:04.60 / 2:02.78, 618 GCs, peak 860 / 835 / 863 MB
The cold start reads no request index, so it builds one from every
session, the case the limit was added for; its peak is unchanged.

Tests at this head, through mote-run:
- go vet -tags nogui ./... for GOOS linux, windows and darwin: ok
- go test -timeout 45m ./internal/gui/ ./internal/usage/ ./internal/sessions/:
  usage, sessions ok; gui only TestMainWindowCorners/macOS_26_SDK, #3949.
TestUnderTightGCLimitsMemory became TestUnderTightGCSetsNoMemoryLimit;
the old code set a limit below MaxInt64, so it would be red there (not
run on the old code: tightenGC's signature changed).
2026-10-30 06:34:53 +08:00
yetone 9101bb8879 privacy: a request masking would change can go as written to a model you picked
jessyoungyu on X: when a masking rule hits, send the request to a
self-hosted model instead, so a prompt like 「百度这家公司怎么样」 gets an
answer about Baidu, not about a placeholder.

Settings › Privacy › Instead of masking, send to (settings
redactRouteTo). It is Off by default, and nothing changes for a user who
leaves it Off. It is picked in the app menu, and only models whose every
route is unmasked can be chosen: the provider is set to Send requests
unmasked, it is on this computer or the network, it has no account, and
any fallback or group member is unmasked too (gateway.MaskRoute, the
same rule as provider.SkipsRedaction). The setting is saved on its own
with POST /api/settings/redact-route, which checks it with MaskRoute.
The general settings save keeps the value.

Decisions:
- When a value would actually be masked on an agent's turn (maskHits.n
  > 0), serve sends the request to the chosen model unmasked. Warn-only
  hits don't count, and Block still answers 400.
- If that model fails, the request fails. It is never masked and re-sent
  to the model the agent asked for, and never goes to a cloud model with
  the unmasked text. Falling back to a masked cloud request would answer
  a different question in the background. The user picked this route
  because masking breaks the answer.
- Streaming works the same as on any route.
- The route is checked again on every request. A model that is gone or
  no longer unmasked, or that the caller's gateway key may not use,
  means the request is masked as before.
- Covered: agents' Messages, Chat, Responses and Gemini turns (serve,
  marked by serveAgent), count_tokens, Codex magpie-model turns, and
  Codex own-sign-in /responses (codexMaskRoute).
- Not covered: magpie's own asks (ownAsk clears the mark), embeddings,
  audio, images and video. These stay masked.

GUI: redactRouteRow lives in plugins/redact/settings.js and wraps
renderRedact, so app.js is byte-for-byte unchanged and the core budget
is not raised. Strings are added in zh, zh-TW, ja and de. Docs: gateway-routing.md,
gui-shell.md, and site/public/docs masking (en, zh, ja).

Tests: internal/gateway/mask_route_test.go
(TestMaskedRequestGoesToTheModelSet: unset, set, streamed, nothing to
mask, local fails, falls back to a vendor, no longer unmasked,
count_tokens; TestCodexSigninTurnGoesToTheModelSet;
TestMaskRouteTakesOnlyUnmaskedRoutes; TestMaskRouteOnlyForTheAgentsTurn);
internal/gui/redact_route_test.go; settings_keep_test.go;
internal/gui/tests/redact-route.test.cjs (every language, chromium and
webkit, 1100 and 640 wide).

Broken by hand, each red:
- serveAgent without the agent mark;
- MaskRoute taking any route (TestMaskedRequestGoesToTheModelSet,
  TestMaskRouteTakesOnlyUnmaskedRoutes; at the pushed head);
- the codex hook removed;
- count_tokens without the mark;
- ownAsk not clearing it;
- no key check;
- no reroute in serve;
- the GUI: no keep in the general save, no MaskRoute check on save, and
  the picker listing every model;
- the plugin script left out of index.html (redact-route.test.cjs 22 of
  24 red; at the pushed head).

Run on mote:
- at 221ede767's tree, this change on f5806ed21 (pushed on 44d697993,
  which adds only app.css lines and a Gateway page GUI test):
  go test -tags nogui ./internal/gui ./internal/settings ok (the core
  budget is green again since ec789445d; #4307, filed and closed);
  the mask-route tests in ./internal/gateway ok; GOOS=linux go vet
  -tags nogui ./internal/gui ./internal/gateway ok; GUI: node --test of
  redact-route, redact-*, privacy-*, mask-*, masking-*, settings-*,
  i18n-keys, account-discovery, sessions-reads and gui-de/ja/zh-tw:
  643 pass, 0 fail. gofmt -l clean.
- at the same change on af8f3a939, one rebase back (the only
  difference is index.html's script order and main's own commits):
  go test -timeout 45m ./internal/gateway (488s) ./internal/redact
  ./internal/settings ./internal/provider ok; GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go vet ./... ok.
The whole Go suite was not run; every package this change touches was
run above.

Not tried: a real self-hosted model (Ollama) with a real agent. The
local model is a fake Chat server in the tests.
2026-10-30 00:46:45 +08:00
yetone 5be581a1c3 gui: a magpie folder the user can't write gets a one-click Repair (YouWhat)
YouWhat on Discord (macOS): adding a custom provider failed with
"mkdir ~/.config/magpie: permission denied". ~/.config wasn't the user's
(a command run under sudo makes it root's), so magpie couldn't make its
folder. The app still ran because reads of a missing file mean "none",
but every save failed. The GUI saves showed the raw error; the
background writes (usage, quotas, caches) dropped theirs.

Now:
- appdir.Blocked() names the folder that keeps magpie from writing its
  config or cache folder: the folder itself, or the first one above it
  when it doesn't exist yet. Only folders inside the home folder are
  named. Unix only; on Windows it is "".
- /api/state carries configBlocked. A failed save whose error is a
  permission refusal comes back with code config_blocked. The window asks
  once a load, and again over the editor whose save failed. "Not now"
  returns to that editor as it was left. The tray panel doesn't ask.
- Repair (POST /api/config/repair): a folder the user owns gets u+rwx with
  no prompt. Another user's folder is chowned to the user, through the
  system's password prompt (update.AsAdmin, the updater's: osascript on a
  Mac, pkexec on Linux). That chown is not recursive for ~/.config, so the
  other apps' folders inside it stay as they are; magpie's own folder is
  chowned -R, since everything in it is magpie's. magpie web shows no
  prompt; it names the sudo command instead. Data never moves: every
  reader keeps the one path, so nothing splits.
- Words in en, zh, zh-TW, ja and de.
- The core-script budget goes up by 1,112 bytes (app.js stays under its
  own), with no room added.

Run (on mote via mote-run, at this tree, based on 17114b505):
- gofmt -l: empty. go vet ./... (darwin), GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./internal/appdir ./internal/update
  ./internal/gui ./internal/proc: appdir, update and proc ok. gui fails
  only TestMainWindowCorners/macOS_26_SDK, which fails the same on
  origin/main 17114b505 on mote (open: #3949). TestCoreScriptBudget's
  first red led to the raise above, and it passes after.
- Red on old code: TestBlockedConfigIsRepairedInOneClick at 17114b505
  fails with "failed save = 400 {"error":"mkdir …/.config/magpie:
  permission denied"}; want code config_blocked". Its sandbox HOME has
  .config at chmod 555, which is the reporter's error. With the change it
  passes: the save names ~/.config, Repair returns 204, the same save goes
  through into ~/.config/magpie/providers.json, and state clears.
  TestRepairOfAnotherUsersFolderAsksAnAdmin fakes another owner and checks
  that the script is "chown <uid>:<gid> '<~/.config>' && chmod u+rwx",
  with no -R, that magpie's own folder gets -R, and that web shows no
  prompt.
- GUI: config-blocked.test.cjs, cli-behind.test.cjs and i18n-keys.test.cjs
  in Chromium and WebKit (en, zh), 12/12 ok. The new file checks the keys
  in zh, zh-TW, ja and de. It is red on the old assets (2/2 not ok in
  Chromium).

Not tried: a real root-owned ~/.config and the real osascript or pkexec
prompt (no sudo on the test boxes). The script runs through the updater's
AsAdmin, which already runs a privileged script. The TUI and CLI don't
offer the repair yet: #4287.
2026-10-29 22:10:21 +08:00
yetone 8e5567161e settings: an older settings.json with no Dock choice keeps Hide
v0.1.2060 (1407c9a3b) made With window the default for a settings file
with no Dock choice. Before it, Hide was the default and was stored as
nothing, so a user who picked Hide can't be told from one who never
chose, and v0.1.2060 put both in the Dock and Command-Tab. That broke
"never let magpie's default override a value the user set".

What changes:
- A new field, dockSettled, marks a file whose Dock choice is read with
  With window as the default.
- A file without it is read the way an older magpie read it
  (settleDock): no Dock, dockWindow or dockNever means Hide (dockNever),
  and the next save writes it settled. This happens once.
- A missing file (a new install) is settled from the start, so it gets
  With window.
- A file nobody can read is read like an older one, Hide.
- The Settings page never sends dockSettled; the API save keeps the
  file's. Without that, a new install's first save from the page would
  turn into Hide.
- KeepOwn keeps it machine-local, like the choice itself.
- An older magpie writing the file drops the marker, and the file then
  reads as old (Hide unless it chose), which is what that magpie meant.
- v0.1.2060 users who picked a choice keep it. Those who picked nothing
  are back to Hide and can choose With window under Settings › Show in
  Dock.

Tests:
- TestOlderSettingsKeepHide: {} and {"theme":"dark"} read and save as
  Hide; dockWindow, dock and dockNever are kept; a second read is
  unchanged.
- TestNewInstallFollowsWindow: no file means With window, settled, and
  the first save reads back the same.
- TestSettingsSaveKeepsDockReading (gui, !nogui): a POST /api/settings
  from the page keeps a new install in the Dock while open, and keeps an
  old file's Hide.
- TestLoadChecked's unreadable-file default now expects the settled Hide.

Broken by hand (each red, then restored):
- settleDock not setting dockNever: TestOlderSettingsKeepHide red,
  "{"theme":"dark"} read as ... never false".
- The missing-file branch not settling: TestNewInstallFollowsWindow red,
  "settled false".
- api.go not carrying DockSettled: TestSettingsSaveKeepsDockReading red,
  "a new install: after a save from the page ... in the Dock ... false".

Run at this commit's tree (9bdb831b7 before this body, on origin/main
66b5e4a84), on mote via mote-run:
- gofmt -l: clean.
- go vet ./... (darwin), GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./...: all ok.
- go test -count=1 -timeout 45m ./internal/settings ./internal/gui:
  settings ok. In gui the only red is TestMainWindowCorners/macOS_26_SDK,
  which is red on origin/main on mote too (#3949).
- node --test dock-choice, settings-general and i18n-keys: 34/34 (5
  languages, chromium and webkit, 1000px and 440px).

Real app on mote: a -tags dev build, bundled as com.yetone.magpie.sbtest,
in a sandbox HOME on 127.0.0.1:3591/3592, launched with its window open,
type read with lsappinfo:
- An old {"theme":"dark"} file: UIElement (not in Command-Tab); the file
  now has dockNever and dockSettled.
- No file: Foreground; dockSettled is set, dockNever is not.
- An old {"dockWindow":true} file: Foreground.

Not tried:
- Closing the window by hand on mote, since ssh has no Accessibility.
- A downgrade to v0.1.2060 and back again with a real file (reasoned
  above).
2026-10-29 20:53:36 +08:00
yetone 1407c9a3bb gui: the Mac's window is in the Dock and Command-Tab while it is open, by default (ShouguangCao on X)
ShouguangCao on X: on the Mac, with the window (Settings) open, magpie
wasn't in Command-Tab, so going back to it to paste an API key copied in
another app took the menu bar.

Cause: Settings > Show in Dock already had "With window" (#101: Regular
activation policy while the main window is up, Accessory once it closes,
in openMain/hideMain through inDock and setDock), but the default was
Hide, so out of the box magpie stayed Accessory with its window open. The
main window is magpie's only window besides the tray panel, so no other
window kind needed it.

Change: With window is now the default. inDock is
`s.Dock || !s.DockNever && shown || fullscreen`; Hide is a choice of its
own, settings.DockNever (KeepOwn, like Dock and DockWindow), and the page
reads the choice through dockChoice (With window unless Show or Hide was
chosen) and saves dockNever with it. DockWindow is still written when
chosen, so an older magpie reading the file keeps With window. The tray
panel never calls dock(), so it is unchanged; Windows and Linux have no
Dock (setDock is a no-op there) and are unchanged.

For existing users: Hide was the default and was stored as nothing, so a
user who picked Hide before can't be told from one who never chose; both
now get With window, and choosing Hide again sticks (dockNever).

Run on mote at origin/main 2c89794ac + this commit; after rebasing onto
2d11cde05 (internal/provider only) the Go tests below were run again at
this head, same result:
- gofmt -l: nothing; go vet (darwin), GOOS=linux go vet -tags nogui,
  GOOS=windows go vet of internal/gui and internal/settings: ok;
  GOOS=linux go build -tags nogui and GOOS=windows go build: ok.
- go test -count=1 ./internal/gui/ ./internal/settings/: settings ok; gui
  ok except TestMainWindowCorners/macOS_26_SDK, red on origin/main
  2c89794ac on mote too (#3949, macOS 27).
- GUI, chromium + webkit: dock-choice (new, 5 languages),
  settings-general, lightweight, keep-awake, i18n-keys,
  classify-timeout-setting, image-timeout-setting, searcher-pick,
  side-effort, gui-de, gui-ja, gui-zh-tw: 158 of 159; the one red,
  searcher-pick chromium zh (a null box at line 224 under load ~30),
  passed 22 of 22 alone and is filed as #4274.
- Real app on mote (macOS 27.2): a bundle with its own bundle id, sandbox
  HOME, MAGPIE_ADDR 127.0.0.1:3591, launched with `open -n ... --args
  app`. A fresh settings.json (no dock keys) with the window open:
  lsappinfo type="Foreground" (in Command-Tab and the Dock). Through the
  real /api/settings (dev build's MAGPIE_DEV_UI) with the window open:
  Hide -> "UIElement", With window -> "Foreground", Hide -> "UIElement",
  nothing chosen -> "Foreground".

Broken by hand: inDock put back to `s.DockWindow && shown`:
TestDockFollowsWindowByDefault red ("default, window open: inDock =
false, want true"). dockChoice put back to read dockWindow: dock-choice
red 5 of 5 (chromium).

Not tried: closing the window by hand on mote and watching it leave
Command-Tab (ssh there has no Accessibility to press Cmd-W or the close
button); that path is #101's hideMain -> inDock(shown=false), unchanged,
and TestDockFollowsWindowByDefault covers "default, window closed".
Not tried on a real Command-Tab switcher by eye.
2026-10-29 20:38:00 +08:00
yetone 75a7db27b9 usage: an allowance card can be hidden from the Overview (whqtian_07012 on Discord)
whqtian wanted StepFun's plan card on Usage › Overview without its
balance card. Right-click a card (or long-press it on a touch screen)
and the app menu offers "Hide from Overview". With several accounts on
one card it says "Hide this account from Overview". A plan card that
carries its key's balance also offers "Hide its balance from Overview",
which keeps the plan. Each hidden card is saved as its tray card id plus
its kind (stepfun|balance, kimi|me@x|plan) in settings.UsageCardsHidden,
through POST /api/usage/arrange (cardsHidden). The Settings save keeps
it. Under the cards, a quiet "{n} hidden" line opens them, each with
Unhide, and Show all from two. It is the same pattern as the Agents
list's hide.

Display only: routing, caps, counting, the Accounts list, the tray
panel's Allowances (it has its own Arrange) and the menu bar cells
never see it. A cell clicked for a hidden card shows it until the page
is left (usagePeek). UI: the app menu, not a native select, no
coloured stripes, no new button on the cards.

Run at this head (rebased on 96a703a59):
- mote: go test -timeout 45m ./internal/gui ./internal/settings.
  settings ok. gui: only TestMainWindowCorners/macOS_26_SDK red, and it
  is red on origin/main 96a703a59 too (#3949, macOS 27).
  TestUsageArrangeCardsHidden and TestSettingsSaveKeepsWhatItDoesNotSend
  pass.
- Linux box (wsl-run): 107 GUI files that reach the Usage page, the
  quotas, the panel, i18n and gui-de/ja/zh-tw, in Chromium and WebKit:
  1362 of 1419 pass. usage-cards-hide passes in both engines, in en, zh,
  zh-TW, ja and de, at 1200px, 560px and 390px (touch, magpie web).
  i18n-keys passes. The 9 red files were run alone at origin/main
  96a703a59 and are red there too (57 red at the base, 51 at the head).
  #4120 has 7 of them. usage-ledger-open-settled (#4262) and
  usage-ledger-chart (#4263) are newly filed.

Rebased again on 9f36d768d, which changed app.js elsewhere. At this
head: usage-cards-hide, i18n-keys, usage-arrange, panel-arrange,
key-balance-card and usage-shared-balance on the Linux box, 72 of 72
pass. On mote, go test -run 'TestUsageArrange|TestSettingsSave'
./internal/gui: ok.

Not tried: a real StepFun account in the real app. The fixture is a
StepFun plan card with its key's balance plus a balance-only card. Not
run on Windows.
2026-10-29 18:52:05 +08:00
yetone 96a703a591 uninstall: magpie uninstall and Settings › Uninstall magpie put every agent back before magpie's files go
Jevik_AI on X (Windows, portable magpie) deleted magpie's folders by hand.
~/.codex/config.toml kept openai_base_url on 127.0.0.1:3425, and every
Codex turn then failed with a 502, with nothing left that knew why.
Deleting magpie's files never puts an agent back, so there is now an
uninstall that does.

- internal/uninstall: Run goes in this order. System removes the
  background service, opening at login, the Start menu shortcut
  (shortcut.Remove, with its App Paths key), the magpie:// links and the
  privacy model's helper. Agents ends Codex's account failover, then runs
  each connected agent's own Disconnect, or its offline disconnect for an
  app that is closed. That is the same code as the Agents page, so a value
  the user changed by hand since Connect stays theirs (e7f21dba5 for
  Codex). It then ports Codex's rollouts and restarts the Codex app's
  app-server (provider.RestartCodexAppWhenIdle, which says whether one was left on
  the old config). Data deletes magpie's folders, but keeps the Library's
  folder while it holds skills, servers or hooks the user's agents use.
  The executable is left where the user put it.
- `magpie uninstall [--yes]`: refuses while another magpie runs, and
  says which one. On a terminal it lists what goes and asks [y/N]; with
  no terminal, only --yes does it.
- Settings › About › Uninstall magpie: POST /api/uninstall runs System
  and Agents. If anything failed, nothing else is removed and the sheet
  offers Try again. Otherwise POST /api/uninstall/finish starts a
  detached `magpie uninstall --data-after <pid>` (Setsid on unix,
  DETACHED_PROCESS on Windows) and the app quits; the files go once it
  has ended, since WebView2 holds its folder open until then. A Codex app
  still on the old config is named before quitting. magpie web refuses
  both routes. Strings go through t() in all five languages.
- --data-after refuses a pid that is no process (0, negative, its own):
  kill(0) counts as alive, and a run given 0 waited out its 2 minutes.

Not done, and why:
- No restore on quit. Quitting keeps agents on magpie by design: the
  service or the next start serves them.
- No Apps & Features entry or Windows uninstall hook. A portable copy
  registers nothing with Windows, and an uninstaller that ran without
  magpie's own disconnect would leave the configs as they are. The
  `# magpie:` note above each line magpie writes (previous commit) is the
  recovery path for a copy deleted by hand.

Run at this head (db75663a0's tree, on 5d24bc6cc), on mote:
- gofmt -l clean; go vet ./... on darwin (-tags nogui), GOOS=windows and
  GOOS=linux -tags nogui: ok.
- go test -tags nogui -count=1 -timeout 45m on ., internal/uninstall,
  cli, gui (TestCoreScriptBudget included), provider, shortcut, edit,
  agent and proc: all ok.
- GUI at this head: mote was at load 100-120 with other sessions' GUI
  runs. Chromium crashed (SIGBUS) mid-file in settings-search and
  settings-sections after their en cases passed, WebKit failed to launch
  within 180s in s3-sync, settings-search and settings-sections, and
  fonts and title-bar-tools went red on unstable elements (#2984 has
  fonts under load). uninstall-settings had not reported when this was
  pushed.
- At the earlier base b3580c72c, on this machine: the full suite
  (-timeout 45m), red only on #3884, #3632 (both since fixed on main) and
  the core budget, which main's later move of Web search out (#4133) has
  room for now. GUI: 104 Settings and i18n files in chromium and webkit,
  uninstall-settings and i18n-keys green in both; the reds were #3797,
  #3876 and the load reds above.

Tried for real, in a sandbox HOME: `magpie uninstall` end to end with
Codex connected and a sandbox Codex app running (config.toml back
without magpie's lines, magpie's data gone, the exe kept, the app's
app-server restarted onto the restored config); codex-cli 0.162.1
reading the noted config.toml. Other agents were covered by tests only.
Not tried: the GUI's Uninstall in a real app window, a real
--data-after run waiting on a live app's pid, and the Windows box.

Broken by hand: --data-after's pid guard removed ->
TestUninstallDataAfterNeedsAProcess red (0, -1 and its own pid
accepted); restored, green.

At the pushed head (rebased on 51f66fe8b; the uninstall call adapted to
EndCodexFailover's (bool, error) on the way), on mote:
- gofmt clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok;
  go build ./... ok.
- go test -timeout 45m: internal/uninstall, edit, shortcut, cli, agent,
  provider ok; internal/gui red only on TestMainWindowCorners/macOS_26_SDK
  (#3949, macOS 27).
- GUI: uninstall-settings and i18n-keys, 30 pass 0 fail.
- WSL (magpie-desktop, CGO_ENABLED=0): uninstall, edit, shortcut,
  provider ok; agent red on TestGrokInstalled, TestOmpDetectedWithPiDir,
  TestZedAppPath, the same at origin/main 51f66fe8b (#4033, #3548).
2026-10-29 17:47:30 +08:00
yetone 1198cff601 gui: a model picker's row says how fast its provider answered this week, fastest first under a search
axuhere on X: with several providers serving one model, the list and the
model picker should show each one's speed and sort by it. Each row of an
agent's model picker now carries a quiet tag from the usage ledger's last
seven days: tokens a second, or the first token's wait when only that was
timed (title: "first token in Xs, N tokens a second"). Under a search,
rows that match equally go fastest first by about how long a 200-token
reply takes, the untimed last. Without a search the rows keep catalog
order, grouped by provider. "Fastest first" for a routing group already
existed as Speed first (d9a8148d7); nothing added there.

- GET /api/model-speeds (internal/gui/speeds.go): usage.SummarizeTop(Week)
  models by provider/model, the catalog ref an option carries; a model
  whose calls went to more than one host is left out.
- app.js: readSpeeds (once a minute, on a model picker opening, re-filters
  keeping the cursor), speedRank, speedTag. Existing i18n keys only.
  app.js 1,304,233 under its 1,311,735 budget, no raise.
- menu-scroll's strict fixture answers /api/model-speeds.

Run, at this head (rebased on bb3565309) unless said:
- mote: go test -run 'Budget|TestModelSpeedsByRef' ./internal/gui ok;
  go vet ./internal/gui darwin ok, GOOS=windows ok.
- picker-speeds.test.cjs: Chromium 1000/440px x en, zh, zh-TW, ja, de 10/10
  on mote; WebKit 10/10 on the Linux box (wsl-run), because WebKit launch
  hangs on mote at present (many pw_run.sh from several sessions, 0 WebKit
  processes). i18n-keys 4/4.
- Broken by hand: speeds.go without TPS -> TestModelSpeedsByRef red;
  filter() without the speedRank tie-break -> picker-speeds red
  ("fastest first, the untimed last").
- 57 other GUI files that open a model picker, Chromium, at the pre-rebase
  tree, concurrency 4 on mote at load ~30-40: 185 pass, 180 fail. One was
  real (menu-scroll's "Unexpected API: /api/model-speeds", fixed here); the
  rest were 5000ms locator timeouts and 11 WebKit launch timeouts. A rerun
  of those files at concurrency 2 was still running at push.

Not tried: native Linux go vet (the WSL box lacks gtk4/webkitgtk dev
packages); the real app with a real ledger; the full GUI or Go suite.
2026-10-29 17:09:13 +08:00
yetone d9cf85ae8b images: a routing group can be Settings > Images' image model (7up6666 on X)
Settings > Images > Image generation now offers each routing group with
a member that draws (gateway.GroupDraws: a member among its provider's
Drawers), with no provider of its own, so the picker puts it under
Routing groups as the Image recognition picker does. Picked, "group/<id>"
is what a request naming no model draws with, the Magpie Image MCP's
included: the gateway already drew on a group member by member in its
routing's order (drawingGroup, #2005), it was only never offered.

A picked group none of whose members draws any more (all removed, or a
group of chat models) is DrawerMissing (drawerMissing): the row says the
pick is missing and Automatic draws in its place, as for a removed model.
Before, a group of chat models would have been sent the drawing.
ListedDrawer and DrawerHidden leave a group ref as it is.

Run:
- mote, at this change on e84f40369: gofmt -l, go vet ./...,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., the
  Linux and Windows builds: ok. go test -count=1 -run
  "Draw|Drawer|Image|Budget|HiddenDrawers|Account|Aside" over
  internal/provider, gateway, gui and agent: all four ok (the new tests,
  TestImageGroupMovesOnToTheNextMember and the size budgets among them).
- wsl-run, Chromium and WebKit: the seven image GUI files and
  i18n-keys, 182 of 182.
- Rebased again onto 4d9058a98 (which changed app.js, api.go and
  i18n.js, "Picked only" among them) and run there: go vet
  ./internal/gui and go test -run "Budget|Image|Drawer" ./internal/gui
  ok; wsl-run, both engines: image-models-hide,
  provider-picked-only-shows-picks, images-missing and i18n-keys, 90 of 90.
  Pushed on 0366e35c1, which changes only internal/catalog after it.

New tests: TestImageGroupPickedInSettingsDraws (gateway: the group
pick draws with no model named, over HTTP and through the Magpie Image
MCP, moving past a member's 502; a chat-only group and one whose drawers
are gone are missing), TestImageGenOffersDrawingGroups (gui).

Broken by hand:
- drawerMissing without the GroupDraws check: the gateway test is red
  ("chat-only group: drawer \"group/talkers\" missing \"\"").
- api.go without the group loop: the gui test is red (group not offered).

Not tried: a real group of real image accounts; a GUI test (app.js is
unchanged: its picker already files an entry with no provider under
Routing groups); the real Linux app.
2026-10-29 15:50:37 +08:00
yetone ded4935745 providers: an image model can be unticked in its provider's editor, and leaves the lists (321sssrt on X)
A provider's editor lists its image models as chips under "Image models"
("图像模型"); a click unticks one, and Save keeps it as the provider's
HiddenDrawers, a deny list beside the Models allow list. An unticked
model leaves Settings > Images' picker, Automatic's choice (and so the
Magpie Image MCP's when nothing is picked), the gateway's /v1/models
image entries and Aside's image options (gateway.OfferedDrawers).

A hidden model still draws when a request names it (resolveDrawing reads
Drawers), and a Settings > Images pick made before it was hidden stays
the pick: it is still listed, as picked, and the row says it is unticked
in its provider and leaves the list once another is picked
(ImageGenHidden), so a pick never stops drawing in silence. A Save that
leaves hiddenDrawers out keeps them; [] clears them. Strings in en, zh,
zh-TW, ja, de. docs/subsystems/gateway-routing.md has the section.

Run, at this and the next commit on e84f40369:
- mote: gofmt -l (none); go vet ./...; GOOS=linux go vet -tags nogui
  ./...; GOOS=windows go vet ./...; GOOS=linux go build -tags nogui;
  GOOS=windows go build: ok. go test -count=1 -run
  "Draw|Drawer|Image|Budget|HiddenDrawers|Account|Aside" over
  internal/provider, gateway, gui and agent: all four ok.
- wsl-run (magpie-desktop, Playwright 1.62.0), Chromium and WebKit:
  image-models-hide (new: en, zh, zh-TW, ja, de at 1000px and 360px),
  images-missing, images-codex-one, image-mcp, image-timeout-setting,
  images-library-way and i18n-keys: 182 of 182.
- Rebased again onto 4d9058a98 (which changed app.js, api.go and
  i18n.js, "Picked only" among them) and run there: go vet
  ./internal/gui and go test -run "Budget|Image|Drawer" ./internal/gui
  ok; wsl-run, both engines: image-models-hide,
  provider-picked-only-shows-picks, images-missing and i18n-keys, 90 of 90.
  Pushed on 0366e35c1, which changes only internal/catalog after it.
Before the rebase (on e15b2277c): the same vet and builds ok, and the
four packages whole with -timeout 45m: internal/provider ok (1061s);
gateway, gui and agent were still running on a loaded mote when this
was pushed (the owner's rule: no commit held behind a full suite).
- New tests: TestHiddenDrawerLeavesListsButStillDraws (gateway),
  TestImageModelsHidden (gui), the HiddenDrawers round-trip in
  account_test.go.

Broken by hand:
- OfferedDrawers returning every drawer: the gateway test is red
  ("offered [gpt-image-hidden gpt-image-shown]").
- The GUI test against the old app.js, api.go, draw.go and i18n.js:
  21 of 26 red.

Not tried: real accounts; a full ./... run (mote at load 200 to 300);
the GUI run on mote (its Chromium crashed under that load, so the GUI
ran on WSL); the real Linux app.
2026-10-29 15:50:37 +08:00
yetone 1801c96bfb warm-up: Warm up now sends one account its warm-up at once (Codex and Claude)
A Windows user on Discord asked for a manual warm-up of a Codex account.
Settings > Warm-up and check-in now ends both the ChatGPT and the Claude
tab with a "Warm up now" row. Its text button sends the account's warm-up
right away. With one account it sends straight off. With several it opens
the app menu ("Warm up which account"), not a select. The row then says
"Warmed up {who} {when}", or "Couldn't warm up {who}: {why}" in red, and
the status line says the same.

What is sent: provider.WarmNow(agent, user) sends the scheduled warm-up's
own request to that one account and to no other. For Codex that is
warmCodexLogin; for Claude it is warmClaudeLogin over the gateway's
warmClaude (Claude Code's run in that account's config directory), set
through WarmClaudeVia. It works whether the warm-ups are on or off. An
account whose sign-in lapsed is refused with the reason. Afterwards the
allowance is read again (StaleAllowance / claudeWarmedNow), as after a
scheduled warm-up. The schedule's file is left to the schedule. The
Codex prompt, identity and base_instructions are unchanged: it is the
same body. The route is POST /api/warm-now, and /api/settings carries
claudeUsers beside codexUsers.

Claude gets the item too. It shares the warm-up engine and the same tab,
and the send is the same warmClaude the schedule uses.

No size budget was raised.

Run:
- WSL (wsl-run), Chromium and WebKit, with the GUI test
  warm-now.test.cjs in en/zh/zh-TW/ja/de at 900px and 440px: 22/22.
  The pressed button stays in place within 1px after two frames.
- WSL, the related files (warm-now, warm-at-own, warm-at-times,
  warm-reset-asleep, settings-groups, settings-search, i18n-keys):
  102/102.
- WSL, the other files that touch these lists (checkin-account,
  checkin-reason, checkin-reason-once, plugin-checkin, segs-press-redraw,
  settings-sections, usage-checkin): 169/170. The red is segs-press-redraw
  "webkit ja 440px: every Settings option..." with "could not bring the
  option into view" after 103s under load. It passed 3/3 alone and is
  filed as #4189.
- mote (macOS) at the final tree: go vet for internal/gui, provider and
  gateway; go test -run 'WarmNow|Budget|Warm' ./internal/gui
  ./internal/provider: ok. An earlier mote run, before the route move,
  ran go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./..., go build ./... and the budget tests: ok.
- Windows (win-run): go test -run 'TestWarmNow|TestCodexWarm|TestClaudeWarm'
  ./internal/provider/ ./internal/gui/: ok.
- WSL: go vet -tags nogui ./... is ok and gofmt -l is empty.
  go test -tags nogui -timeout 45m ./...: 75 packages ok, including
  internal/gui and internal/provider. internal/agent has 4 reds on the WSL
  box (TestInstalledVersion, TestGrokInstalled,
  TestCursorFolderFromTheEditorIsNotTheCLI, TestOmpDetectedWithPiDir). They
  are already filed as #4033 and #3548 (fake binaries hit WSL interop).
  internal/gateway has 1 red, TestUnroutedRequestShownThenAnswered: giveUp
  answers the 504 before it marks the route done. That is not this change,
  and it is filed as #4200.

At the head rebased on origin/main 9474eaf9c:
- mote: gofmt -l is empty. go vet passes for gui, provider and gateway,
  and GOOS=windows go vet passes for gui and provider. go test -run
  'WarmNow|Budget|Warm|I18n' ./internal/gui ./internal/provider: ok.
- WSL: warm-now, i18n-keys and warm-at-own GUI tests: 44/44.

Broken by hand (each was red, then restored and checked with cmp):
- WarmNow swallowing the Codex error: TestWarmNowSendsTheScheduledWarmUp
  went red on the refused request.
- Running Claude in ls[0]'s directory: TestWarmNowClaudeRunsClaudeCode
  went red.
- Dropping the lapsed check: TestWarmNowLapsedAccount went red.
- The menu always sending users[0]: warm-now.test.cjs went red (timed
  out) in both engines.

Not tried:
- A warm-up of a real account. The request-equality test compares
  against the scheduled warm-up's request through a fake vendor.
- Breaking the request-equality check by changing the body itself.
- The GUI suite on macOS, because mote's browsers hang (#4125).
2026-10-29 15:39:31 +08:00
yetone 29185e3bbc gateway: a request held too long before routing leaves a report its user can copy
Jason on Discord (#general, v0.1.1995, AirbuildEnvironment over Codex's
/backend-api/codex/responses) got the 2m 504: "magpie held this request
for 2m0s without routing it to any provider ... report it with magpie's
log". The desktop app runs the gateway in-process and logs only to
stderr, so there is no log for him to send.

giveUp now writes a report of the held request to a small file in
magpie's cache (held/, folder 0700, temp file renamed into place, the
newest 5 kept). It holds the time, version, OS, the method and path, the
model and agent, how long it was held, each named wait with its time and
whether it was still under way (noteWait now takes a kind: body, body
room, decision model, image description, plugin hooks, JS middleware,
Codex reset, masking), the body room's state, the requests in flight,
and a goroutine profile (function names and lines only, cut at 128KB).
It holds no body and no headers. Route.Held names the file. On the
Routing page, the request's story then says a report was saved, with
Copy Report and Open Folder (Open Folder is left out in magpie web).
GET /api/gateway/held/{name} reads only a report's own name. The 504's
text no longer points to a log: it names Copy Report on the Routing page
and the folder. The log line names the waits too. i18n is in zh, zh-TW,
ja and de, and docs/subsystems/gateway-routing.md has the section.

What held Jason's request is not known from what he sent. The waits that
count before routing are: the body arriving (idle deadline only), body
room (up to 100s, then 503), the decision model (see the next commit),
plugin hooks (11s), JS middleware (250ms a hook), image description
(bounded by the request) and the Codex reset (20s). Slots, RPM and
upstream come after the route begins. A WebSocket upgrade gets a 426.
The report names the wait, so the next one says which.

Run:
- mote, at 57b21abd9 before the rebase: go test ./internal/gateway
  -run 'Unrouted|Held|...' passed. The full go test ./... -timeout 45m
  was cut off when mote dropped off the network (2 packages ok). The
  full suite then went to the Windows box (see the next commit).
- xiaomi-gpu (Windows), node --test: routing-held-report 50/50 in
  chromium and webkit, 5 languages, 1100/420px, app and web.
  routing-held-request and i18n-keys pass. All routing-* and i18n*:
  1742 tests, 94 reds, none in i18n*. The same files are red alone at
  origin/main 033b17baf (22 of 46 in WebKit), recorded on #4124.
- GOOS=windows/darwin go vet ./internal/gateway ./internal/gui,
  GOOS=linux go vet ./internal/gateway, go build ./... : ok.
Broken by hand: leaving Route.Held unset turned
TestUnroutedHeldReportSaved red ("names no report"). Dropping the
story's report line in client.js turned routing-held-report red in both
engines.
Not tried: a real held request in the real app. Linux vet of
internal/gui (cgo for Wails, cross-compiled). The GUI test on macOS
WebKit, since mote was unreachable.
2026-10-29 15:10:34 +08:00
yetone 5eab14a8cc plugin pages: magpie web reaches a page's local service on its own address, so the chat page works from another computer
aigcfree (Discord DM) runs `magpie web --addr 0.0.0.0:3430` on an Ubuntu
server behind nginx and opens it from a Windows PC. Plugins -> 对话
(@magpie-community/page-chat) showed "127.0.0.1 refused to connect": the
page sends its frame to the chat server on 127.0.0.1, which in that
browser is the Windows PC.

A plugin now declares its page's service (package.json
magpie.page.service {port, option}: the port, or the plugin option that
holds it, from its plugins.json options; plugin.ServiceSpec). Served to a
browser (isWeb), /api/plugin-pages gives the page `service`:
_magpie/service/ under its token, and the bridge hands the frame
magpie.service as an absolute address. The desktop window and slot pages
get none, and the routes answer 404 there, so the local path is as before.

servePageService reverse-proxies /_magpie/plugin/<token>/_magpie/service/…
to 127.0.0.1:<port>. The service stays on loopback. The way in is the
page's own: the per-run token that only a signed-in /api hands out,
behind AllowGuard. Nothing is weakened:
- Host is set to 127.0.0.1:<port>, which the service's rebinding check
  wants.
- The window's cookie is taken off.
- Origin must be absent or null (403 otherwise).
- Set-Cookie is dropped.
- Every reply is sandboxed (sandbox allow-scripts; frame-ancestors
  'self'), with Referrer-Policy no-referrer and nosniff.
- The gateway's own port is never served, since a request from this
  server is loopback and the gateway takes that without a key.
- Event streams flush as they come (FlushInterval -1, X-Accel-Buffering:
  no for nginx). webCompressed no longer gzips text/event-stream, which
  held a stream back until gzip's buffer filled.
- A redirect to the service's own address is made relative.
- The entry starts the plugin host as the page's HTML does (pageHost).
- A service not up yet answers its frame with a 502 page that tries
  again in 2s.

page-chat 0.1.2 (magpie-community/plugins 4a46212, on dist) declares the
service, goes to magpie.service when given one (else 0.1.1's path:
127.0.0.1 on loopback, the SSH-tunnel note from elsewhere), and asks
api/… by relative address.

Docs: plugin-runtime.md P4 (the page row), gui-shell.md (no gzip for event
streams).

Tests: TestPluginPageServiceListedToBrowserOnly, TestPluginPageServiceSpec,
TestPluginPageServiceProxied (through webHandler: Host, cookie, Set-Cookie,
CSP, escaped path and query, foreign Origin 403, made-up token 404,
redirects, SSE first event before the end and not gzipped),
TestPluginPageServiceDown, TestServiceLocation; plugin-page.test.cjs
checks magpie.service in a browser page and its absence in a slot.

Run at 276683d85, this change on origin/main e61e10535. It was rebased
since onto c1660481c, a one-line WorkBuddy mover min in internal/provider.
181fd0a68
(another session's proxy, path _service/, {portOption}) is reverted
there by 3870ddf0a, and nothing of it is left:
- go test ./internal/gui/ ./internal/plugin/ -timeout 45m, native on the
  Windows box: every new test ok. 8 reds, none in code this touches:
  - 6 fail the same at origin/main c1660481c, run there by name:
    TestGatewayHeldByAContainer, TestLodyImportHandoff,
    TestImportStatusUnreadableIsUnknown, TestAionUiImportRow,
    TestUpdateThatWontStart, TestPiPackage. All are in #4115.
  - TestLoadConcurrentWithSavesAndEdits is red 2 of 3 alone here and red
    at c1660481c too (a rename "Access is denied"); it is in #1827.
  - TestDesktopSessionTitlesOnPages passes alone (3 of 3). In the package
    run it listed the box's real WSL Codex session. Filed as #4185.
- Earlier, at bc247a8cc, on mote: the new Go tests, and go vet of both
  packages.
- Not run at this tree: the full go test ./... . mote was at load 300+
  with three other sessions' full suites, and the Linux box had one. A
  run at an older base (fa5ff2fec) had 25 packages ok, internal/agent
  among them, and none red when it was stopped for the rebase.
- gofmt -l: clean. go vet ./internal/gui ./internal/plugin: darwin on
  mote, native Windows on xiaomi-gpu. A Linux vet from mote fails in wails'
  cgo files, and in WSL for lack of gtk4/webkitgtk-6.0 headers, both
  unrelated to this change; CI vets Linux with its headers.
- plugin-page.test.cjs on the Windows box, both engines: WebKit 3/3.
  Chromium's first test is #4180, which fails the same on origin/main
  f463a8aaf. The next commit fixes #4180 at its cause.
- Real: a sandbox magpie web on mote (0.0.0.0:3561, sandbox HOME,
  MAGPIE_WEB_KEY, the real chat package from a folder, a fake gateway).
  Playwright on the Windows box opened Plugins -> chat over the LAN in
  Chromium and WebKit. The frame went to
  http://mote.local:3561/_magpie/plugin/<tok>/_magpie/service/?theme=…
  with origin null. Its fonts.css and style.css came through the proxy. A
  sent message streamed back "remote chat works", and the fake gateway
  logged both POSTs.
  - From the Mac over the LAN: /api/plugin-pages without the cookie
    gives 401. A made-up token gives 404. A foreign Origin gives 403.
    POST api/chat without the chat token gives 403 (the service's own
    check). mote.local:3563 directly is refused (loopback only).
  - Before bun was reachable in the sandbox, the frame got the 502 retry
    page.
- Broken by hand, each red then restored:
  - Without the event-stream exclusion, the stream arrives gzipped.
  - Without the Host rewrite, the cookie strip or the web gate, each
    assertion is red.
  - With the bridge's service dropped, plugin-page.test.cjs is red in
    WebKit ("magpie.service").

Not tried:
- A real nginx in front.
- A WebSocket through the proxy (httputil handles the upgrade; the chat
  page uses none).
- TLS (--tls-cert).
- The desktop app with page-chat 0.1.2: its fallback is 0.1.1's path,
  covered by the plugin's launcher tests.
2026-10-29 14:28:24 +08:00
yetone f463a8aaf7 gui: Settings has Loading bird, which keeps magpie's bird off skeletons and stops looking for them
Yayoi_no_yume on X, agreed by GymlinZhu: they run magpie on a 1-core,
1GB server and asked for a way to turn the loading bird off. The owner
wanted the bird, so it stays on by default. Settings -> General now has
"Loading bird" (Off / On), below Reduce motion.

- settings.json keeps noBird (omitted when the bird is on), and boot.js
  passes it. A POST that leaves it out keeps it, as with the other prefs.
  theme.js sets data-bird="off" on <html> before the first paint, and
  applyPrefs changes it.
- skelBird (app.js): with the bird off, nothing looks for skeletons at
  all. No 250ms interval and no observer run. Turning it off mid-hop ends
  the hops, and the bird flies off.
- With the bird on, the look is driven by events. Before, the 250ms
  setInterval ran forever, scanning the DOM for .skeleton whether or not
  one existed. Now a MutationObserver watches for an added node that is or
  holds a skeleton, the 250ms look runs only while one is in the page,
  and the look stops itself once none are left.
- The README's bird (plugins.js bounceLoader): with the bird off, the four
  lines stand straight with no bird, and the box goes when the README
  comes.
- Strings are in en, zh, zh-TW, ja and de. App.js is 1,294,016 bytes, under
  its budget, which is not raised.

Tests:
- skeleton-bird.test.cjs adds three tests:
  - with no skeleton left, the look stops, and a skeleton added later
    starts it again;
  - with the setting saved off, no bird, no dip and no look ever starts
    (setInterval is wrapped to count the look);
  - the Settings row shows On by default; Off posts noBird:true, stops a
    running look, and a skeleton added after that starts none; On posts
    false and the look starts again.
- plugin-readme-bird.test.cjs: with the setting off, the lines stay
  straight, no .sk-bird is drawn, and the box goes at once.
- settings-general: #birdSegs is in the list of bare rows.
- TestSettingsNoBird: off by default, kept by a POST that leaves it out,
  cleared by false, in settings.json and boot.js.

Run at this head (rebased on e15b2277c):
- mote: go test -run "Budget|TestSettings|TestBoot|TestI18n"
  ./internal/gui ./internal/settings: ok. GOOS=linux, windows and darwin
  go vet -tags nogui of both: clean (on the pre-rebase base aad6546cd,
  with no Go change between the two). gofmt -l: clean.
- wsl-run (Linux), both engines: skeleton-bird, plugin-readme-bird,
  settings-general, reduce-motion and i18n-keys: 43 of 44 pass. The one
  red is skeleton-bird's original hopping test in WebKit. It is red 2 of
  2 on origin/main e15b2277c in the same place, filed as #4176 (also one
  line of #4120).
- Before the rebase, on mote in Chromium, the same five files all passed.
- wsl-run Chromium: settings-groups, settings-lines-wrap, settings-search,
  settings-sections, settings-shortcut, settings-tabs-stick, text-size,
  menu-scroll and i18n-keys: 76 of 76 pass.

Broken by hand:
- With birdOff() always false, the three new off tests go red (README,
  skeletons, Settings row).
- With the look never stopping itself, "with no skeleton left" goes red.

Not tried:
- WebKit on mote. Playwright's WebKit never launched there (180s launch
  timeouts at load 65-300), so macOS WebKit wasn't run; WebKit ran only on
  Linux.
- The whole GUI suite (970 files), because mote was under heavy load.
- The real app on any OS, and a real 1c1g server. The CPU saved wasn't
  measured.
2026-10-29 13:12:36 +08:00
yetone 628ac36fc9 agents: Add magpie says when nothing here opens the app's import link (sungt)
sungt (Discord #feedback, Windows, magpie 0.1.1976, Cindy 0.1.119, Cindy
open): on the Agents page Cindy's 添加 magpie "spins, no response".

What magpie got wrong: Cindy, AionUi and Lody take magpie only through
their import link, which magpie hands to rundll32 / open / xdg-open and
never waits on. A link nothing opens did nothing, the button never awaited
/api/open nor caught its error, and `magpie cindy add` printed "opened"
whatever happened.

- agent.OpenAppLink asks the system, without opening anything, whether
  something opens the link's scheme: Windows' HKCR\<scheme> (what
  Electron's setAsDefaultProtocolClient writes) and then the user's
  UrlAssociations UserChoice; macOS Launch Services (cgo builds); Linux
  `xdg-mime query default`. Only "none", or a registered program whose
  full path is gone, refuses the link (NoLinkHandlerError); anything
  unknown hands it over as before.
- /api/open (Cindy, AionUi, Lody after OpenLody) answers
  code no_link_handler with app, exe and said, an i18n.js key from
  linkSaid that api() puts through t() as it does bunSaid's.
- The import button now waits for /api/open and shows the result: "Sent
  to {name}: confirm adding magpie there", or the reason in the
  reader's language.
- The CLI's add returns the same error.

This is not verified as sungt's cause. Cindy was open, and Cindy
registers cindy:// at every start, so the check most likely passes on
their machine. If so, the spinner is Cindy's own import dialog
(previewProviderImport / fetching magpie's /v1/models). Cindy 0.1.119
wasn't available here. We still need Cindy's log around "received deep
link" from sungt.

Run (worktree at origin/main 536a98316, mote unless said):
- go test -tags nogui -count=1 ./internal/agent ./internal/gui
  ./internal/cli: agent ok, cli ok. gui is red only on
  TestCoreScriptBudget, #4133, which is red on origin/main
  (1531446 > 1530861, from a4e929212's context.js). This change adds 85
  bytes to app.js (1311673, under app.js's own 1311735) and makes the
  total 1531531. No budget was raised.
- node --test, chromium and webkit, every language: import-row,
  i18n-keys, plugin-bun-unstartable, agent-connect-no-models and
  agent-connect-all-hidden (api()'s error paths). Result: 84 pass, 0 fail.
- Windows (win-run): TestCommandProgram, TestOpenAppLinkSaysNothingOpensIt,
  TestSystemLinkHandlerNoSuchScheme (real registry lookup) and
  TestFolderVarsAreListed all pass. Earlier in this work:
  - rundll32 handed magpie's 719-char Cindy link byte for byte to a
    registered handler;
  - a temporary HKCU scheme was read as found, then as gone once its exe
    was deleted, and the key was removed afterwards.
- Linux (wsl-run, magpie-desktop, real xdg-mime): the same applink tests
  pass.
- macOS (mote): Launch Services finds https and mailto, and finds no
  handler for cindy, lody, aionui or a random scheme.
- gofmt -l is clean. go vet passes for GOOS=linux -tags nogui, for
  GOOS=windows, and with CGO_ENABLED=0 for internal/agent.

Red on the old code, each wiring reverted by hand:
- providers.go: TestImportLinkNothingOpens is red (204, link handed over).
- cli main.go: TestImportAddSaysNothingOpensIt is red (nil error, link
  handed to the browser).
- importButton: import-row is red (status "" where the Sent/err line was
  wanted).

Not tried:
- Cindy 0.1.119, or any real Cindy, on Windows.
- A real app whose registered exe was deleted.
- The full go test ./... and the whole GUI suite. mote was running
  another session's full suites, and there is one suite per machine.
2026-10-29 09:24:31 +08:00
yetone 5637cca141 settings: a notification when masking swaps a value for the first time (Must2333 on X)
Must2333 on X: "我还希望能即时的知道发生了替换,但不是通过随时监控网关的方式".
They want to know when magpie masks something without watching the
gateway or the 脱敏 page.

Settings › Usage has a new row, "Masking alert" (zh 脱敏提醒), after the
task done alert. Off/On, off by default. When on, a value masked for the
first time gives a system notification through the same notifier as the
other alerts. It says only how many new values, each kind and its count,
and the agents that sent them (two named, "+N" for more). It never says
the value, any piece of it, or the Head hint the 脱敏 page keeps. A click
opens the 脱敏 page on the latest record (clickView, "masking&key=<key>").

Why off by default: every other notification in this group is off until
turned on; turning one on asks macOS for notification permission; for
most users a notice each time masking works is noise, since masking's
expected behaviour is quiet protection. It is one row, in the group that
already holds the alerts, hidden while masking is switched off
(data-feature="redact") and in gateway mode.

Staying quiet:
- First time only: maskrec.Fresh says which values a record has that no
  record before it had. A conversation sends its whole history each turn,
  so a value is masked again every turn after its first. The index is by
  placeholder (HMAC-stable across restarts), filled from memory and from
  the days kept on disk, so a restart doesn't make a history new again.
  The days are read off the lock, since Hold takes it on the request's
  way. Values sent as written (Action "warn") are left out.
- A burst is one notification: records gather for 3s (maskGather).
- At most one every minute (maskGap); what comes in between is said
  together after it. At most 5000 records wait.
- With the setting off, nothing is kept.

The gateway tells the app through gateway.OnMasked, after maskrec.Hold,
with Snips and Back taken out; nil under `magpie serve`.

Strings: en, zh, zh-TW, ja, de, in i18n.js (the row) and in
mask_alert.go (the notification's title and kind names, the 脱敏 page's
own words for the kinds). docs/subsystems/gateway-routing.md has the
bullet. The core script budget isn't raised: main's 10-29 budget leaves
room for the row's 287 bytes.

Tests, each broken by hand and seen red:
- TestMaskAlertFirstTimeOnly: masks through redact.Mask as the gateway
  does; the history masked again says nothing, a new email in turn 4 is
  said alone. Red when flush counts r.Values instead of the fresh ones.
- TestMaskAlertNeverSaysTheValue: no 4-character piece of the key, email
  or phone, and no Head, in any of the 5 languages. Red with the Head
  added to the kind's name.
- TestMaskAlertCoalesces: a burst of 5 from 3 agents is one wait of
  maskGather and one notification ("+1"); two more 10s later wait
  maskGap-10s and are said as one; off keeps nothing. Red without the
  waiting check (5 waits) and without the maskGap wait ("waits 3s want
  50s").
- TestFreshOnlyTheFirstTime, TestFreshHeldWhileReading (maskrec). Red
  with loadFirst skipping the disk read (the history new after a
  restart), and with the index broken (both).
- TestDismissedAlertOpensNothing covers the mask notice's click.
- mask-alert.test.cjs: every language at 900 and 380px, both engines:
  the row after the task done alert, Off at first, On saves maskAlert,
  another save keeps it, Off saves false, no click moves the page, no
  left border, gone with masking switched off. Red with maskAlert taken
  out of prefsKeep, and with data-feature taken off the row.

Run:
- This change on main 2b6ff0fbf (its parent here, c93d9e0c0, changes
  only usage's Codex effort cache after it), on mote: go test ./internal/gui
  ./internal/maskrec ./internal/settings ./internal/gateway; GUI files
  mask-alert, turn-done, gateway-mode, settings-search, i18n-keys (68
  pass, 0 fail); gofmt -l; go vet for darwin, GOOS=windows, and
  GOOS=linux -tags nogui, all ok. internal/gui's one red is
  TestMainWindowCorners/macOS_26_SDK, #3949, red on main too.
- At the same change on main ddf31ca30, 23 commits back: the full Go
  suite on mote, -timeout 45m. Every package ok but internal/gui: the
  budget (since fixed by the rebase), TestMainWindowCorners (#3949), and
  nine real-window AppKit tests killed at their deadlines while mote's
  pboard was down (#4125). Run again once pboard was back, all nine
  passed.
- The whole GUI suite, both engines, every language, on the Windows box
  (mote's GUI run was cut short by the pboard crash, #4125): 14235
  tests, 13951 pass, 284 fail in 65 files. The same files at ddf31ca30:
  291 fail. All 22 mask-alert tests pass there. The 8 files red only at
  this change were run again at both commits and each goes red and
  green on its own, mostly WebKit (#4124).
- The real app on mote, in a sandbox HOME, with a fake upstream: what
  the upstream got was placeholders only ({{API_KEY_…}}, {{EMAIL_…}},
  {{PHONE_…}}). Three turns in a minute became one notification 3s after
  the first, and a new email in a later turn the next one, exactly 60.0s
  after.

Not tried:
- The banner itself: macOS refused notification permission to the
  sandbox bundle (ad hoc signed and dev signed, "didGrant: 0 hasError:
  1"), and no one was at mote's screen to allow it. What was seen is the
  send, in the app's log.
- Windows and Linux notifications, and a click from a real banner.
- Values masked again after the 30 days the records are kept are said
  again. Blocked requests and warn-only values aren't notified. No
  session id is shown.
2026-10-29 06:38:04 +08:00
yetone 97b6a36c5b gui: the sidebar's gateway names the LAN address while it is shared
coeo91 on Discord: with "Share on local network" on, the sidebar's line
still said "Gateway 127.0.0.1:3425". Shared, it now names where other
machines reach it: MAGPIE_PUBLIC_URL if set, else the address picked in
Settings (magpie.lanAddress), else the first LAN address. Its tooltip
names that and this computer's url. Not shared, it is unchanged.

- api.go: boot.js's sideGateway carries lan and lanURLs when shared, so
  the first paint is right.
- plugins/gateway/settings.js: sideLAN() picks the address and redraws
  the boot line once loaded (it loads after app.js); turning sharing
  on/off re-reads /api/providers and redraws, and picking an address
  redraws. The choice lives in the plugin so app.js and the core script
  budget stay under their limits (TestCoreScriptBudget passes); no budget
  raised, no new strings.
- app.js renderSideGw: uses self.sideLAN?.(g), tooltip adds " · " + url.

Run at this commit's tree, rebased on d4f1d6480 (after 581d64b7d's
lanPublic and the Gateway card; conflicts in settings.js and
public-url-default kept both sides), on mote (macOS 27, Playwright 1.62,
Chromium + WebKit, 5 languages):
- side-gateway-lan, public-url-default, public-url, sidebar,
  gateway-port, connect-address-kept, lan-public, lan-docker,
  gateway-card, browser-access, plugin-gateway, gateway-connect-keys,
  gateway-keys-empty, gateway-caller-keys, i18n-keys: 195 pass, 1 fail
  (i18n-keys "a plugin's words are its own", #4053, red on main).
- go test -timeout 45m ./internal/gui/...: only TestMainWindowCorners
  (#3949); budgets pass. gofmt -l clean; go vet ./internal/gui darwin,
  GOOS=windows, GOOS=linux -tags nogui ok.

Before the rebase (base 51e3169fb):
- side-gateway-lan (new), public-url-default, sidebar, gateway-port,
  connect-address-kept: 82 pass, 0 fail.
- gateway-caller-keys, i18n-keys, plugin-gateway, gateway-connect-keys,
  gateway-keys-empty: 47 pass, 1 fail (i18n-keys "a plugin's words are
  its own", red on origin/main 6104e88aa, #4053). gateway-caller-keys
  chromium en failed once at :137 in an earlier run and passed on the
  next; base 6104e88aa is red at the same line in webkit (#3797).
- go test -timeout 45m ./internal/gui/...: only TestMainWindowCorners
  fails, red on base too (#3949). TestCoreScriptBudget and
  TestBootSaysWhereItsGatewayListens pass.
- gofmt -l clean; go vet darwin, GOOS=windows ./..., GOOS=linux -tags
  nogui ./... ok (Go unchanged since).
- Full GUI suite: stopped at ~8,400 results under load 25-105 from other
  sessions (20 not ok). Each red file was rerun on base 6104e88aa; red
  there: gateway-key-models (#2648), header-centre (#3479), i18n-keys
  (#4053), key-replace webkit (#3476), menu-input-scroll (#3402),
  mobile-web (#3952), models-fold webkit (#4071, filed), quota-count-wrap
  webkit (#3404). credit-days, library-row-remove and plugin-github
  passed on rerun.

Broken by hand: origin/main's app.js -> side-gateway-lan red 10/10 at the
first-paint check (:35); without settings.js's /api/providers refresh ->
red 10/10 at the sharing-off check (:57); without the load-time redraw ->
red 10/10 at :35.

Not tried: the real app on a real LAN, the Linux and Windows GUIs, and
the rest of the full GUI suite past where it was stopped.
2026-10-28 22:26:02 +08:00
yetone 581d64b7d0 gateway: sharing lists this network's addresses first, and names one on the internet
The user whose network card holds a static public address (203.236.50.70,
27bf14790) asked on Discord, on the latest version, whether "Share on
local network" should be exposed at a public address. LANHosts kept the
interfaces' order, so the public address came first: Settings offered it
as the share address by default, and the Gateway page listed it under
"Local network". The gateway does answer there while shared (it listens
on every address), behind a gateway key, and nothing said so.

- LANHosts puts private addresses first (RFC 1918, 100.64/10 for
  Tailscale, 198.18/15 for proxy TUNs), the public ones after in the
  interfaces' order; LANURLs, magpie web's links and the CLI follow.
- gateway.PublicIP / PublicURLs name the internet ones; /api/settings
  and /api/providers' gateway give them as lanPublic.
- Settings marks such an address "On the internet" in the picker, and
  picked, the row says anyone online can reach magpie there with a key
  and to list the network's range under Allowed addresses (or, with a
  list, that only it gets in). The Gateway page lists it under "On the
  internet", not "Local network". zh, zh-TW, ja, de.
- Not changed: with no allow list every address is still let in.
  Refusing internet peers by default would shut out networks whose
  computers all hold public addresses (campus networks, this user's ISP
  setup), so the address is named and the allow list pointed to instead.

Run on mote at 4ca64c21b plus this change: gofmt; go vet ./internal/gateway
./internal/gui; GOOS=windows go vet ./internal/gateway ./internal/gui;
GOOS=linux go vet ./internal/gateway; go test ./internal/gateway -run
'LAN|Lan|URL|TLS|Public|Network|Share|Allow|Container' ok; go test -tags
nogui ./internal/gui ./internal/cli ok; node --test lan-public (new),
lan-docker, gateway-card, gateway-connect-keys, public-url,
browser-access, i18n-keys: 73/74, the red is i18n-keys' "a plugin's
words are its own" on routing's "masking…", #4053, red on main. Every
file using the caller-keys fixture (changed: lanPublic) at a8c71f198:
the reds are gateway-key-cycle, gateway-key-limit and a flaky
connect-snippet-shell, the same on untouched a8c71f198, filed as #4072.
Broken by hand: public-first order turns TestLANHostsKeepAPublicAddress
red; no Settings note, or no Gateway-page split, turns lan-public red
(3/3 chromium).
Not tried: a real machine with a public address on its card.
2026-10-28 22:15:00 +08:00
yetone 012c584cc1 usage: clear a model's usage, or all of it, from the Usage page
CrazyMouse_TT on X asked for a way to clear usage, all of it or one
model's, to measure a local model fresh after deploying it.

The Usage page's Models list has a "…" on each row (and a right-click
menu) with "Clear usage…", and "Clear all usage…" sits under the lists
below the "Counted from…" note. Each asks first, in a confirmation that
says what is deleted, that it can't be undone, and that key spending
limits and allowances still count the calls.

A clear is a mark in settings (usageCleared: provider, model, unix ms),
read at read time; usage.jsonl is never rewritten. The Overview hides
calls up to the mark in summarizeFrom; the Requests page, heatmap and
ledger/CSV hide them in Filter.keepsRow, their one choke point, and the
request index's meta carries the marks so its cache is dropped. Key
budgets, window holds and Codex reads go through usage.Visit and the raw
log, so a clear never resets a key's spending limit or a quota. A later
clear of the same model or of everything takes the place of an earlier
one. The marks ride the settings part of a sync (sync-backup.md) and a
save of the Settings page keeps them (api.go's keep list; the guard
test TestSettingsSaveKeepsWhatItDoesNotSend caught it missing).
gateway-sessions.md and sync-backup.md say so.

Run on mote (mote-run) at this tree, rebased on origin/main c26b2992e
(the Go packages and usage-clear.test.cjs; vet and the 68 GUI files
ran at the earlier base f835bd713, four commits behind):
- go test -tags nogui -timeout 45m ./internal/usage ./internal/settings
  ./internal/usageapi ./internal/gui: all ok after the
  keep-list fix (before it, TestSettingsSaveKeepsWhatItDoesNotSend red).
- gofmt -l: clean. GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./...: exit 0. (Linux vet without nogui fails in
  wails' cgo, as on main.)
- usage-clear.test.cjs: 32/32 in Chromium and WebKit, en/zh/zh-TW/ja/de,
  at 1200, 560 and 390 (web). With the old page.js/client.js/i18n.js it
  fails (TimeoutError).
- 68 GUI files the change can reach (every usage-*, gui-de/ja/zh-tw,
  i18n-keys, click-scroll, idle-ticks, mobile-web, panel-usage,
  sessions-purge): 941/980. The reds are filed and red on main
  (usage-ledger run alone at origin/main 84a6a2c42 too): i18n-keys "masking…" (#4053), mobile-web
  (#3952), usage-agents-hide (#2276, #3414), usage-ledger "newest live
  route needs no return-to-live button" (#3104, run alone at main too).
  i18n-keys first also named "Clear usage…" in Go comments of this
  change; reworded.
Broken by hand, each red: hides() always false (usage and gui tests),
keepsRow's clear check removed ("Requests after the clear: 5 rows"),
clearedKey out of the request meta ("after clearing everything: 3"),
the api.go keep line removed (UsageCleared [] after a save).

Not tried: the full go ./... suite and the whole GUI suite (mote was
busy with other sessions' full suites), the real app, a sync between
two computers. usage.jsonl doesn't shrink, and the Sessions tab's
figures are not cleared.
2026-10-28 21:13:09 +08:00
yetone ae03279458 masking: the local model is on by default; the rules mask alone until it is downloaded
The owner's plan (10-28, after the xuanwo/_kaichen reports under the
masking demo): with AstrLink Guard picked, the Chinese-name heuristic
is off and only nicknames like 小王/老李 stay a rule; with Privacy Filter
it is as before; every format rule stays; the model is on by default,
masks with the rules alone until its download finishes, and no longer
answers 503 for it.

- masking.ModelWanted(st): on when the user turned it on, off when the
  user turned it off (new RedactModelOff, set by SetRedactModel(false),
  remove, and cancelling the default's own download), on when the
  default's download finished (RedactModelAuto). A settings file from
  before this, with a model name picked or files on disk and the model
  off, reads as the user's off: magpie's default doesn't override it.
- Until the picked model is installed, requests are masked by the rules
  alone and fetch starts its download (one try per model per hour,
  never under testing.Testing(), nothing where the model can't run).
  When it finishes, settings.UseDefaultRedactModel records the default
  (it refuses when the user has set anything) and the model warms.
- model(..., strict): a model that fails holds requests back (503)
  only when the user turned it on; under the default the rules mask
  alone. The Privacy page says which ("…the rules mask requests alone"
  in en, zh, zh-TW, ja, de; /api/privacy-model has `chosen`).
- redact.Options.NamesByModel (AstrLink Guard picked): zhNameSpans
  keeps only zhNick candidates (小/老 + a surname).
- KeepOwn and POST /api/settings keep both new fields.
- Docs: gateway-routing.md, site masking docs (en, zh, ja).

Run (mote, Go 1.26.8):
- gofmt clean; go vet of masking, settings, redact, gui; GOOS=linux go
  vet of masking, settings, redact; GOOS=windows go vet of the four.
  (GOOS=linux vet of internal/gui needs cgo, as on main.)
- go test -count=1 -timeout 45m ./... at base 7fd77a944: every package
  ok except internal/gui. Its reds: TestCoreScriptBudget (+64 bytes,
  fixed by dropping a comment, budget not raised), TestPrivacyModelPick
  and TestSettingsSaveKeepsWhatItDoesNotSend (updated for the new
  default and fields), TestMainWindowCorners (#3949, red on origin/main
  e8c7dddcb too), and three AppKit tests killed at 20-30s under load
  just before mote rebooted, which pass in the rerun.
- Rerun at base 6bec526f7: internal/gui (only #3949 red), masking,
  settings, redact ok. GUI node tests privacy-model, masking-records,
  masking-demo, routing-masking, i18n-keys, gui-zh-tw, gui-ja, gui-de:
  Chromium 199/199, WebKit 106/106.
- At the pushed base 9e33962c0: TestCoreScriptBudget, TestSettingsSave*,
  TestPrivacyModel* ok; i18n-keys and privacy-model 68/68 in both
  engines.
- At the pushed base 7fcf642ee (masking in the request archive):
  -run 'Mask|Redact|Archive|Privacy' in masking, gateway, redact ok.

Broken by hand, each red: the nick filter off
(TestChineseNamesByModelOnlyNicks), ModelWanted needing RedactModel
(TestModelOnByDefault), strict ignored (TestDefaultModelFailingIsTheRules,
TestNoModelYetMasksByTheRules).

Not tried: a real default download in a sandbox HOME (the tests fake the
model). Known limit: a user who turned the model on before model picks
existed and then deleted it has no name or files left, so reads as new
and gets the default on.
2026-10-28 16:55:24 +08:00
yetone 9e33962c05 gui: Settings has Reduce motion, stilling magpie as the system's does (#3813)
CupOfBread asked for a switch that turns magpie's motion off to save
resources on the desktop, and linull24 saw the Routing page keep a
phone's browser busy. magpie already stills its animations under the
system's Reduce Motion: 46 @media (prefers-reduced-motion: reduce)
rules across app.css and the plugins' styles, and calm() in the
scripts. Settings -> General now has "Reduce motion" (Off / On) that
does the same without the system setting.

- settings.json keeps reduceMotion; boot.js passes it; a POST that
  leaves it out keeps it, as the other prefs.
- theme.js's holdStill(on) sets data-motion="reduce" on <html> and sets
  the media of every stylesheet rule written for reduced motion to
  "all" (and back when turned off), so the same rules apply and no CSS
  is written twice. layout.js calls it before the first paint when the
  saved setting is on; applyPrefs calls it on a change.
- calm() is true when data-motion is reduce too, so the scripts'
  motion (Routing's stage, Library, Usage) holds still with it.
- routing.css: the reduced-motion rule for the live dot was
  .rt-livedot, which lost to .rt-livedot.on's animation; it is now
  .rt-livedot.on, so the dot stands still with either setting.

Measured on mote (Chromium 390x844, 4x CPU throttle, live Routing
traffic, CDP Performance over 10s, two runs each): main-thread task time
0.18 and 0.22 s/s with it off, 0.090 and 0.085 s/s on; style recalc
0.021/0.025 off, 0.008/0.011 on.

Tests: reduce-motion.test.cjs (new, both engines): saved on, the
reduced-motion rules apply from the start (a probe's live dot has no
animation, calm() is true); Off restores them and posts false; On again
posts true. TestSettingsReduceMotion: off by default, kept by a POST
that leaves it out, cleared by false, in settings.json and boot.js.
The Settings row is in settings-general's list of rows.

Run on mote at this head (rebased on e8c7dddcb): go test -run
"TestCoreScriptBudget|TestAppScriptBudget|TestSettings|TestBoot|TestI18n"
./internal/gui ./internal/settings: ok (the core budget not raised);
GOOS=linux, windows and darwin go vet -tags nogui of both: clean.
reduce-motion, settings-general, i18n-keys, routing-live-calm,
codex-descriptions, codex-predictions, codex-titles and old-webkit:
61 pass, 1 fail, the Safari 15.0 styles check below.
gofmt -l: clean.

Not tried: the real Linux (WebKitGTK) and Windows (WebView2) apps; the
setting changes only which existing CSS rules apply. old-webkit's
"Safari 15.0" check is red on origin/main from c490165b1's :has() in
.proto-menu (#4020), not from this change.
2026-10-28 16:50:16 +08:00
yetone e8c7dddcb4 notices: the release carries the third-party licence notices
The owner asked for the licence notices in the release package (moejs
alpha.11 compiles Intl's data in, which carries its own notices).
THIRD_PARTY_NOTICES is embedded in the binary (main.go, //go:embed) and
handed to internal/notices; `magpie licenses` prints it, GET /api/notices
serves it, and Settings › About has an Open-source licenses row that
opens it in a dialog, in every language. `make app` copies the file into
the .app's Resources too. The core's scripts are 1,527,245 bytes, their
budget raised to it with no room added; app.js stays under its own.

Run at this head (rebased on origin/main):
- win-run (Windows 11): go vet -tags nogui . ./internal/notices
  ./internal/cli; go test TestNoticesFollowMoejs (.), ./internal/cli,
  TestCoreScriptBudget (./internal/gui): ok.
- wsl-run (Ubuntu 24.04): go vet -tags nogui ./..., go build -tags
  nogui: ok.
Run at the pre-rebase head 14e2d13fb, on mote (macOS):
- gofmt; make app's copy byte-identical to the file; `magpie licenses`
  output equal to the file; GOOS=linux/windows vet and build;
  go test . ./internal/cli: ok. ./internal/gui: only
  TestMainWindowCorners red, the same on origin/main (#3949).
- about-notices.test.cjs: chromium and webkit, en zh zh-TW ja de, 1100
  and 420px: all ok.
Broken by hand: TestNoticesFollowMoejs red with the embedded file cut.
Not run: the GUI suite at this head. The rebase met main's cancelAsk
helper where showNotices sat, and the dialog's Done now uses it (the
same stopPropagation + closeConfirmAsk). The whole GUI suite at
14e2d13fb was cut off when mote went down at load ~50: the files it
reached outside About had reds, most of them 180s browser-launch
timeouts, the rest passing in other languages or the other engine; they
are run again once mote is back, and any that stay red are filed.
2026-10-28 16:40:03 +08:00
yetone 6af83172d3 gui: the masking demo shows no video where WebKitGTK can't play one (avk458 on X)
On Omarchy (Arch + Hyprland) without gst-plugins-good, opening Masking's
"How masking works" aborted WebKitWebProcess about 3s later: WebKitGTK
2.52.6 gives every <video>, muted ones too, an autoaudiosink, which lives
in libgstautodetect.so ("no such element factory autoaudiosink", then a
SIGABRT). The window was left frozen on its last frame ("一点就崩溃再点
magpie就卡死了").

Cause: b90e81da1's noVideo was only in GET /api/settings. The page's
state.settings comes from /api/state, which never carried it, so a demo
opened before Settings was visited set the webm src. The GUI fixture put
noVideo into /api/state's settings and hid it.

Now boot.js says noVideo (app only, not a browser tab) before the page
paints, and demo.js reads window.bootPrefs.noVideo; the poster shows
instead. Also, for BoyC338's memory question: folded, or with the page
left, the video lets go of its source (removeAttribute src + load), so
no decoder or buffer is held; opened again it goes on from where it was.

Run:
- mote: GUI masking-demo, masking-records, i18n-keys in Chromium and
  WebKit: 116 pass, 0 fail.
- mote: go test -run 'TestBootSaysNoVideo|TestBoot|TestSettings|
  TestFontSettingsAPIAndBoot|Budget' ./internal/gui ok; gofmt -l none;
  vet for darwin, GOOS=windows, GOOS=linux -tags nogui ok.
- WSL magpie-desktop: go test -tags gtk3 -run 'TestBootSaysNoVideo|
  TestGstAutodetect|TestWebkitDefaults|TestSettings' ./internal/gui ok.
- Real app on omarchy, v0.1.1840 release: Masking > demo row aborted
  WebKitWebProcess (coredump 07:10:10 UTC), window frozen. Built this
  tree with make release-linux in WSL and ran it there: demo opens with
  the poster and animates, fold/reopen, Agents and back to Masking all
  respond; no coredump, no autoaudiosink line, both web processes alive.
These ran at base ea53eb126; rebased onto 05ed578bd (redact/gateway
changes, none in internal/gui) and the budgets run again before push.

Broken by hand:
- demo.js reading state.settings?.noVideo: the poster test is red in
  both engines.
- hold() commented out: the folded test is red in WebKit.
- boot flag removed: TestBootSaysNoVideo is red.

Not tried: a Linux system with gst-plugins-good (the video path there
is unchanged); arm64 Linux. Recovering a window whose web process died
(web-process-terminated) is not handled by magpie or Wails; not in this
commit.
2026-10-28 15:25:53 +08:00
yetone 7b63feb908 gui: a browser tab's font rows show on a nogui magpie, and Text size no longer flashes
Norcleeh (Discord #general, after v0.1.1788): in magpie's web GUI the
interface-font and code-font rows "flash once and disappear" on refresh.

Cause, reproduced on a real nogui `magpie web` on mote in Chromium and
WebKit, at 127.0.0.1, localhost and the LAN address: a nogui build
(Docker, magpie-cli) has fonts.Available false, so boot.js carried no
`fonts` flag and app.js never showed the font rows at all. What flashed
was the Text size row: index.html shows it, and renderSettings hid it
for a browser tab 40-120ms later (`#textSizeRow.hidden = web`).

Fix:
- A browser tab always gets the font rows. Its /api/fonts answers the
  server's families plus a common list (Arial, Menlo, Consolas, PingFang
  SC, Microsoft YaHei, Noto Sans CJK SC, JetBrains Mono, ...) and never
  errors for a tab; fonts.js keeps only what this browser can draw, and
  "System default" is always offered, so with nothing kept the rows still
  show with it.
- The app-only rows (Text size, tray, login, tray usage) carry
  .app-only, which `body.web .app-only` hides before first paint, so none
  of them paints in a tab.
- The boot `fonts` flag is gone. app.js and core both got smaller; no
  budget changed.
- docs/subsystems/gui-shell.md "Desktop fonts" says so.

Run (mote-run, at this head rebased on 98e23350f):
- go build ./... and -tags nogui; gofmt -l clean; GOOS=linux go vet
  -tags nogui ./internal/gui and GOOS=windows go vet ./internal/gui
  ./internal/fonts ok (at the pre-rebase head).
- go test -tags nogui -run 'Font|Budget|Boot' ./internal/gui
  ./internal/fonts ok (and with cgo before the rebase); the new
  TestBrowserTabFontsWithoutInstalledFonts covers nogui, a failed read
  and a merge with the server's own families.
- fonts, i18n-keys, settings-general, text-size, web-page: 76/76.
- Before the rebase, 20 files (fonts, font-cascade, win-fonts,
  login-allow, omarchy, settings-general/-search/-sections/-groups/
  -lines-wrap/-tabs-stick, text-size, tray-usages, web-page,
  web-app-standalone, gui-de, gui-ja, gui-zh-tw, i18n-keys) 259 tests,
  all ok but i18n-keys' "Runs as" (#3897, green now on main).
- Whole GUI suite before the rebase, --test-concurrency=4 beside other
  sessions' load: 13,626 tests, 160 red in 31 files. Those 31 files
  run alone at head and at base 0a7633136: 166 vs 157 red, the same
  tests at other widths/languages (routing-*, segs-press-redraw's
  webkit 900/440px, usage-*); mobile-web's "matches origin/main" needs
  .git, which a mote-run copy lacks; old-webkit's :has() is on base.
  segs-press-redraw alone: 7 red at head, 8 at base.
- New GUI test, both engines, en and zh: "a browser tab's font rows show
  on a nogui magpie and nothing flashes" records every rAF frame. Red on
  the old assets (uiFontRow never shows). Broken by hand: without the
  .app-only CSS rule it goes red with textSizeRow painting ~20 frames
  then going away (the reported flash); with
  `row.hidden = web && fontList?.length === 0` it goes red.
- Real servers on mote, both engines, 3 origins: nogui shows the rows
  (19 families in Chromium, 21 in WebKit), Text size never shown; a cgo
  desktop server 204/181 families.

Not tried: a Windows server with the fix (old code showed the rows),
WebKit over a LAN tunnel, Brave/Safari fingerprinting modes, the full
Go suite.
2026-10-28 12:25:39 +08:00
yetone 833f51adcf gui: a browser tab has the font rows too, with its own choice
Norcleeh on Discord: magpie opened in a browser had no font setting in
Settings > General, while the app does. The rows were hidden on purpose:
/api/fonts answered 404 to a browser page and boot sent it no choice,
since the list is the fonts of the computer magpie runs on and the tab
can be on another one.

Now a browser tab (magpie web, or the app's page in a browser) has both
rows wherever magpie can read its fonts (boot's fonts; a nogui build
can't, and keeps them hidden). Its list is /api/fonts less the families
this browser doesn't draw (fonts.js here(): text in the family measures
apart from monospace's or serif's on a canvas), so another computer's
fonts and Safari's user-installed ones aren't offered. The choice is the
browser's own, in localStorage (magpie.fonts), applied by fonts.js
before the first paint; it neither changes nor takes the app's
settings.UIFont/CodeFont, and a settings save from a browser still
keeps the app's.

Run on mote at this tree (on b90e81da1), also GOOS=linux (nogui) and
GOOS=windows go vet ./internal/gui/..., go build, gofmt -l:
- fonts.test.cjs, font-cascade.test.cjs, win-fonts.test.cjs, i18n-keys
  and the 42 drag/arrange GUI files, Chromium and WebKit, en and zh (and
  ja/de where a file has them). The reds are 32 subtests in 4 files
  that fail the same on origin/main b90e81da1 run alone (and one from
  a stray path in the run command): i18n-keys "a
  plugin's words are its own" (#3897), routing-rule-drag webkit de
  (#3789), segs-press-redraw webkit (#3922), usage-agents-hide (#3414).
- go test -tags nogui ./internal/gui (TestCoreScriptBudget and
  TestFontSettingsAPIAndBoot included) ok; go test ./internal/gui -run
  Font (cgo, CoreText) ok.
- Real use: magpie built on mote, `magpie web` in a sandbox HOME, real
  /api/fonts (204 families). Chromium offered 204, WebKit 179; Georgia
  picked in each, the body drew it and kept it across a reload, and no
  settings.json was written.
Broken by hand: fontsOn = !web (rows hidden as before): the new test
red in all four engine/language cases; here() returning the list
unfiltered: red with "a family this browser doesn't draw isn't
offered".
Not tried: a browser on a different computer from magpie (the canvas
filter is what covers it, checked with a family the test machine
lacks), Firefox, the Windows and Linux apps' pages in a browser.
Budget: not raised; the previous commit's 1,097 bytes cover it.
2026-10-28 08:01:46 +08:00
yetone b90e81da14 gui: on Linux without gst-plugins-good the masking demo shows her poster
On stock Omarchy (Arch + Hyprland, WebKitGTK 2.52.6, GStreamer 1.28.6
with gst-plugins-base and -bad only), opening the masking demo aborted
WebKitWebProcess about three seconds in, so the app's window went blank.
WebKitGTK gives every video, a muted one too, an audio sink it makes with
autoaudiosink ("GStreamer element autoaudiosink not found", then a NULL
g_signal_connect, then SIGABRT); that element is in gst-plugins-good.
canPlayType can't tell: an Ogg Theora copy, "probably" playable there,
crashed the same way, so no other format would do.

The Linux app now looks for libgstautodetect.so in GStreamer's plugin
folders (its variables' and the system's): GStreamer's core there and
autodetect in none of them means no video (webkitPlaysVideo). Settings
state says noVideo then, in the app only (magpie web plays in the user's
own browser), and the demo sets no src: she is her poster and the sheets
move on the frame clock, as when the video can't load. No GStreamer folder
found says nothing, and video stays on.

Run at this head (origin/main 0f053024f + this change; the runs were at
ec6c2de52 + this change, and 0f053024f changes only README and site/):
- mote: node --test masking-demo, masking-records: 110 pass, 0 fail
  (Chromium and WebKit; the new poster test in both).
- magpie-desktop (WSL, Ubuntu 24.04): go test -tags gtk3 -run
  'TestGstAutodetect|TestWebkitDefaults|TestRenderNodeOpens|TestSettings'
  ./internal/gui: ok.
- mote: GOOS=linux CGO_ENABLED=0 go vet -tags gtk3, GOOS=windows go vet
  and go vet of ./internal/gui: ok. gofmt -l: none.
- omarchy, the real check on the real system, from a test binary built
  at this head: webkitPlaysVideo() is false
  ([/usr/lib/gstreamer-1.0 /usr/lib64/gstreamer-1.0]); on magpie-desktop,
  which has gst-plugins-good, true.
- omarchy, WebKitGTK driven from Python on `magpie web`'s page: with the
  demo's webm src set, the web process aborts every time (core dumps
  23:07:33, 23:10:17, 23:12:59, and 23:18:30 with an .ogv); with no src,
  as this change does, it stays up and T runs (2.99 -> 4.39 s).
- Broken by hand: gstAutodetect returning true makes TestGstAutodetect
  red ("stock omarchy: gstAutodetect = true, want false"); demo.js setting
  src regardless makes the poster test red in both engines.

Not tried: clicking the demo row in the real desktop app on omarchy (no
pointer tool there); the app's half was checked through the same
WebKitGTK and the detection through the real folders, separately.
2026-10-28 07:31:02 +08:00
yetone dc1af8231b ghtoken: a Settings token GitHub refuses is said, and requests go without one (#3926)
A GitHub token in Settings → Network and sharing that GitHub refused
(401, expired or revoked) failed every plugin and skill check, so a
stale token was worse than none. Now it is treated as an environment
token already was: the request is asked again without it, the token
isn't sent again while magpie runs or until the field changes, and the
anonymous answer (60 an hour) is the one taken. This overturns the
package comment and TestSettingsTokenRefusedStaysAnError: the token
being the user's choice is a reason to tell them, not to fail the
check.

The page stays honest about it:
- Settings › Network and sharing still shows the token, masked, with
  Remove, and says in red that GitHub refused it and requests go
  without one until it is replaced (/api/settings githubTokenRefused).
  Before, a refused token simply read as none being set.
- After a Settings token's refusal requests go anonymous, not with
  GITHUB_TOKEN/GH_TOKEN: the user put the Settings one ahead of those,
  and the page says "without one".

Patch by MYCF711 (fix/settings-token-fallback, 7d93f1b5): the ghtoken
change and its tests. Changed from it: the notice is in Settings' row,
where the token lives, instead of the patch's Plugins page note,
which cost ~630 bytes of core script the budget (28 bytes of room at
c54478904) doesn't have; the Library's skill checks reach Settings'
row too. Token() doesn't fall through to the environment; the
library's skill check test (the sibling the patch left red) expects
the anonymous answer; the unreachable new Refused() message is
dropped (Refused's "where" now holds for a refused Settings token).
app.js stays in its budget by shortening renderGitHubToken's comment.

Run at this tree (base c54478904), on mote:
- go test -tags nogui ./internal/ghtoken ./internal/plugin
  ./internal/library ./internal/gui: ok (TestCoreScriptBudget
  included; no budget raised). GOOS=linux and windows go vet, go build
  ./...: clean.
- github-token-refused.test.cjs (new; chromium and webkit, en and zh,
  1000 and 440px): red 8 of 8 against origin/main's assets, green
  with the change. With github-token and i18n-keys: 21 of 22; the red
  is i18n-keys "a plugin's words are its own" ("Runs as"), red at
  origin/main 74dcf40aa alone too (#3897).
- Every GUI file that opens Settings › Network and sharing
  (allow-ips, api-key-theme, bare-ids, browser-access, cors-origins,
  gateway-port, lan-docker, proxy-test, settings-proxy-auth,
  settings-proxy-remember): 126 of 126.
- Broken by hand: Token() falling through to GITHUB_TOKEN after the
  Settings token's refusal turns TestSettingsTokenRefusedGoesWithoutEnvToken
  red; MYCF711 showed TestSettingsTokenRefusedAskedAgainWithout red with
  from == "settings" back in Do.

Not tried: a real revoked token against api.github.com. The Plugins and
Library pages have no notice of their own (Settings' row says it).
2026-10-28 03:50:46 +08:00
yetone e056779a67 gui: the app serves its page to a browser, behind its key (Settings › Browser access)
jiakun_zhao on X ran `magpie web` in a terminal beside the desktop app,
to manage it through a Cloudflare tunnel. Settings › Network and sharing ›
Browser access now has the app serve the same page itself: Off, This
computer (127.0.0.1, for a tunnel or SSH forward) or Local network.

Access is magpie web's, unchanged: the key in the link is traded for the
cookie (webGuard), the allow list holds, and the gateway's client routes
on the page's port need a gateway key (onePort). A rebound Host and
Origin: null get no cookie. There is no way to serve it without the key.
The key and choice live in web-page.json (0600) beside settings.json, so
a sync never carries them. GET/POST /api/web-page are the app windows'
alone: a browser on the page can't read the key or turn the page off. A
busy port (magpie web, the magpie before an update) is tried every 4s;
`magpie web` on the same port opens the app's link instead.

Run at d43b7c40d (this change on ef155a5ca), then rebased onto the four
newer main commits, which touch gateway, usage, proc and library only:
- gofmt -l internal/gui internal/cli: nothing. go vet, GOOS=linux go vet
  -tags nogui and GOOS=windows go vet of internal/gui and internal/cli:
  clean. go build: ok.
- go test -timeout 45m ./internal/gui/ ./internal/cli/: ok (180s, 70s).
- GUI, alone: browser-access.test.cjs and model-test-one.test.cjs pass in
  both engines; i18n-keys 23 of 24, its red is #3897 ("Runs as" from
  7f827b3b0), not this change. agent-stale-copies.test.cjs 80 of 80 at
  8d343a811 (this change before the rebase).
- Full GUI suite at 8d343a811: cut short. The disk filled (708MB free):
  browsers failed to launch with ENOSPC in agent-stale-copies, which then
  passed 80 of 80 alone, and node ended with exit 7 before the rest of
  the files ran. There is no full GUI record for this change.

Not tried: a real Cloudflare tunnel to the page, and Local network from
another machine.
2026-10-27 18:58:16 +08:00
yetone 8b0132b3d2 codex: the Codex app sends again on every system as soon as magpie takes a used-up ChatGPT account over, and gets it back at the reset
Ethereal499 and Isdavexxx on X, MasterYi on Discord, #540. The Codex app greys
Send for every model, magpie's too, while the ChatGPT account it is signed in
to is used up. Its composer's gate (ChatGPT.app 26.1013) reads authMethod
"chatgpt" plus rate limit allowed=false, and it asks account/read only when its
app-server starts. ef37b6fb7 (v0.1.1381) could fail in practice:
- (a) The reopen was macOS-only, ran once per time out, only from the GUI
  process. A Windows or Linux user, a magpie without its window, or a second
  time out stayed greyed.
- Switch-back: the app stayed on magpie (authMethod null, no cloud tasks or
  Log out) after the reset. Nothing restarted it.
- (c) Detection lag: the account was read every 5 minutes.
- The notice sat on the Providers page, not on Codex's Agents row.

Now:
- The gateway process (`provider.KeepCodexAppOnItsProvider`, every 3s, on
  every OS) ends the Codex app's own app-server each time `Agent.AppOut`
  flips, both ways. The app starts another at once and reads account/read
  afresh. Its window, threads and drafts stay.
- It never ends an app-server while a Codex request is in flight through
  magpie or ended in the last 10s (`Server.CodexBusy`, Codex's requests only),
  or while a session under the Codex home has a turn open (`codexTurnOpen`).
- It ends only the app's own app-server. That one runs on stdio; one another
  program starts with `--listen` is left alone (Miyi Helper runs one on this
  Mac). It must also run on magpie's Codex home (`proc.EnvOf`: ps -E on macOS,
  /proc on Linux; Windows can't tell).
- The exit is clean (`proc.End`: SIGTERM, or TerminateProcess with code 0 on
  Windows). The app shows any other exit as a crash.
- A listing that fails is taken up again at the next look. One that outlives
  3 ends, or is denied, makes the row say to quit and reopen.
- The active account is read every minute while it is held or a window is at
  90% or more (`codexLookEvery`).
- Codex's Agents row says "On magpie until <reset> · ChatGPT allowance used
  up". Hovering it, or opening the row, says what is off until then (cloud
  tasks, the usage meter, Log out) and that it all comes back on its own. In
  en, zh, zh-TW, ja and de.
- Removed: gui's keepCodexAppSending/codexAppOut, provider's episode
  bookkeeping, and the Providers-page notice.

Not changed, by design:
- A Codex own model that no magpie account serves stays as it is: magpie
  can't serve that turn.
- Account discovery off and "Only switch Codex's sign-in" (login=chatgpt) are
  the user's own choices, and are left alone.

Full suite green at cff1a9686 (on origin/main 6ce0f14b9), below. At
4541b3e97 (rebased on 430e3050d, which touched gateway.go, app.js and
i18n.js beside this) ran: gofmt -l, go build ./..., go vet on darwin,
linux (-tags nogui ./...) and windows; go test -run Codex ./internal/provider
./internal/agent ok; GUI codex-app-out (22 ok) and codex-app-stale (20 ok),
chromium and webkit. Pushed rebased on b92cb2f59 (two more commits,
neither in these files), built, not rerun.

Run at this commit (cff1a9686, on origin/main 6ce0f14b9), with a private
GOCACHE (another session ran go clean -cache mid-run):
- gofmt -l: clean. go build ./...: ok.
- go vet: darwin (touched packages); GOOS=linux -tags nogui ./...;
  GOOS=windows (touched packages).
- go test -count=1 -timeout 45m: internal/proc, internal/provider,
  internal/agent, internal/gateway, internal/gui all ok, skipping four
  tests red on main without this change, each already filed:
  TestUnreadLoginsWriteErrorsKeepCredentials (#3632, a synctest crash
  since 091153bf) and TestFetchAsksOneListOnceForTwoBasesOfIt,
  TestFetchUnionsProtocolListsWithoutChat, TestFetchAsksASharedBaseOnce
  (#3854, since 6eb510f78). All three of the latter fail the same at
  origin/main 6ce0f14b9 and at 353519f55 without this commit.
- GUI at cff1a9686, chromium and webkit, 231 cases ok: codex-app-out (5 languages, 980 and 440px),
  i18n-keys, gui-de/ja/zh-tw, codex-app-stale, codex-accounts-via,
  agent-stale-copies, agent-app-restart, agent-failover, agent-connect,
  agent-layout, agent-expand-steady, agent-connected-unfolded,
  agent-notice-lang and codex-signin-always.
- Windows box (cross-built test binaries): proc and provider's Codex app
  tests pass. TestEndExitsClean passes there and goes red with exit code 1.
- Broken by hand, each went red:
  - Codex-only busy: TestCodexBusy.
  - The 90% cadence: TestCodexLookEvery.
  - The retry after a failed listing: TestCodexAppServerUnknown.
  - The turn guard: TestCodexAppServerRestartedEachWay.
  - The --listen exclusion: TestCodexAppOwnServer.
  - Code 0 on Windows: TestEndExitsClean.
  - The row's notice: codex-app-out.test.cjs, 4 of 4.
- Real app: ChatGPT.app 26.1013 in a sandbox HOME/CODEX_HOME, with this
  build serving on 3492/3493. Codex was put on magpie as Sync does for a held
  account (model_provider = "magpie", codex.out in stash.json). OpenAI's usage
  reading to the app was never faked.
  - The first listing ran out at load ~200, so the timeout is now 30s. The
    next look ended the app-server, and the app started another 12s later.
    Its profile went from "Pro · Usage · Log out" to "magpie" with no reopen,
    and /api/state carried appOut.
  - Undoing it ended the app-server again, and the profile came back to Pro,
    Usage and Log out.
  - The owner's own ChatGPT app (its app-server on ~/.codex) was never
    touched.
- One webkit codex-app-out run at load 291 had one red subtest, name lost.
  It passed 3 of 3 alone and in two full webkit runs.

Not tried:
- The Windows Store app (not installed on the box), and a real Codex app
  on Linux.
- A real used-up account.
- A turn running in the real app while the switch happens (unit-tested
  only).
2026-10-27 15:57:41 +08:00
yetone 7aeae59670 privacy: masked words can match as whole words only, by a switch under Masked words (acmilan_)
Settings › Privacy's masked words (脱敏词) were found anywhere: ABC masked
the ABC inside XABCD, and 123456 the middle of 91234567 or 0.123456. A
new row under "Masked words in any case", "Whole words only" (仅完整单词
匹配), makes each word match only where no letter, digit or _ is beside
it, and for a number no "." and digit either, so a decimal counts as one
value: ABC masks "ABC IS xxx" and name='ABC' but not XABCD or ABCDEF;
123456 masks a 123456 of its own but not 91234567, 0.123456 or 123456.78
("the code is 123456." still is). Chinese and Japanese letters count as
no letter there, since those scripts put no spaces between words: 张三
is still found in 我的同事张三今天来了, and ABC in 用ABC做. It is
independent of any case and works with it (xabc then Abc! masks only
Abc). A match inside a longer word is passed over one letter at a time,
so a whole one after it is still found. Off by default and for every
existing user: settings.json without redactWordsWhole reads false, and a
page from before it that saves without the field keeps what was set
(api.go, as redactWordsAnyCase). Each match goes as {{TERM_…}} and comes
back as written. Translated in zh, zh-TW, ja, de.

redact.Options.WordsWhole (wholeWord, wordRune); settings.RedactWordsWhole
(redactWordsWhole) reaches it through internal/masking; prefsKeep sends it
on every Settings save. docs/subsystems/gateway-routing.md has a bullet
for the user's own words, any case and whole words.

Tests, each red when its part is broken by hand:
- TestWordsWhole (internal/redact), the reporter's literal examples plus
  CJK and any case: with the whole-word check skipped, 10 cases FAIL
  "1 masked, want 0"; with the decimal check off, FAIL on 0.123456 and
  123456.78; with Han/kana counted as letters, FAIL on 张三, 用ABC做 and
  これはABCです. Every case round-trips through Restore.
- TestWordsWholeJSON: a request body and a tool call's escaped
  arguments; with the check skipped, FAIL "XABCD not kept as written".
- TestCountTokensRedacted/words_whole (internal/gateway): with
  masking.go not passing the setting, FAIL "redaction off changed
  content: …X{{TERM_…}}D…"; words_inside holds the default unchanged.
- TestSettingsRedactWordsWholeKept (internal/gui): with the not-sent
  guard removed, FAIL "…redactWordsAnyCase…: whole words false".
- redact-words-whole.test.cjs: 20 of 20 (Chromium and WebKit, en, zh,
  zh-TW, ja, de, 1100 and 640px); with prefsKeep's field removed,
  WebKit fails "a later save keeps it".

Run, in worktree magpie-wt/redact-wholeword at base 353519f55, sandbox HOME,
pinned caches, pipefail, tee'd:
- go test -tags nogui ./internal/redact ./internal/masking
  ./internal/settings ./internal/gui (TestCoreScriptBudget, i18n)
  ./internal/gateway ./plugins/redact: all ok.
- GUI: redact-words-whole, redact-words-any-case, i18n-keys 44/44;
  gui-zh-tw, gui-ja, gui-de 9/9.
- gofmt -l clean; go vet (darwin), GOOS=linux -tags nogui and
  GOOS=windows vet of the changed packages clean; go build,
  GOOS=linux go build -tags nogui, GOOS=windows go build ok.

Not run: the full go test ./... and the whole GUI suite (machine load
over 200 with other sessions' runs); the change reaches only the
packages above. Not tried: a real vendor request with the switch on;
the gateway test checks the body that goes out. A letter written as a
\u escape inside a tool call's arguments reads as no letter beside a
word (unescapedView), so it doesn't stop a match there.

Rebased onto origin/main 83368d994 (usage, signin, agent, gateway stream,
web page port, guard; app.js and gateway-routing.md touched elsewhere):
go test -tags nogui ./internal/redact ./internal/masking ./internal/gui
(budget, i18n) ok; redact-words-whole and i18n-keys 24/24.

Then onto 83368d994 (Codex thread descriptions; settings.go, app.js, i18n.js):
gofmt clean; go test ./internal/settings ./internal/masking ./internal/redact
and ./internal/gui -run 'Budget|I18n|Settings' ok.
2026-10-27 15:34:38 +08:00
yetone 83368d9946 codex: thread descriptions can be turned off, as titles can (cybercaius)
cybercaius on Discord asked to turn Codex's thread descriptions off.
Titles and predictions had an Off; descriptions only had "as Codex
sends it" or a model.

Codex's settings on the Agents page now offer Off for "Thread
descriptions", worded as the titles' Off ("Off", "no description,
nothing sent", in zh, zh-TW, ja and de too). settings.CodexDescriptions
takes "off", /api/settings/codex-descriptions accepts it, and the
gateway answers a thread_description side turn itself through
sentNowhere, as titles' Off does: a finished response.completed with no
output, nothing sent upstream, and Routing/Usage recording it as
answered by magpie with the reason. Both routes take it (the Codex
backend path and /v1/responses).

Why an empty reply is enough: in ChatGPT.app's app.asar the
thread_description helper reads the reply's {"description"}; with no
message it records an "empty" result, not an error, and the thread's
description is left as it was.

The docs (gateway-routing.md) say each of titles and descriptions has
its own Off and neither turns off the other. No CLI change: titles' Off
isn't settable from the CLI either. docs/reference.md doesn't list
these settings.

Run:
- gofmt -l: nothing. go vet: darwin ./..., GOOS=linux -tags nogui
  ./..., GOOS=windows ./...: ok.
- go test -timeout 45m ./internal/gateway ./internal/gui
  ./internal/settings before the rebase: gui ok, settings ok; gateway
  had TestDisabledCodexModels ("no space left on device") and
  TestHistoryKeepsDaysAndDropsOld red during a moment the disk was
  full; both pass -count=5.
- Rebased on f0ffee34c: TestCodexDescriptions/Titles/Predictions in
  gateway, gui and settings ok; go vet of the three packages ok.
- Whole GUI suite (916 files, both engines, every language,
  --test-concurrency=4, box at load 100 to 200 from other sessions):
  13328 tests, 13144 pass, 184 fail. The 33 red files were run again
  on main 508911e43: the same tests red there (quota-refresh-order
  #3679, routing-* #3408 #3409 #3410 #3411 #3412 #3799 #1612 #2658,
  gateway-caller-keys #3797, menu-input-scroll #3402, key-replace
  #3476, phone-web #3180, old-webkit #3403, header-centre #3479,
  quota-count-wrap #3404, icon-tile #3858 new, provider-detect-draft
  #3859 new, ...). The rest, run again at the rebased head: green
  except s3-sync (#3413), search-first (#3795), usage-agents-hide
  (#3414), usage-fold (#3415), usage-ledger, all red the same on
  f0ffee34c, and library-row-remove 1 of 3 (#3099). codex-descriptions,
  codex-titles, codex-predictions and i18n-keys green at the rebased
  head.

Broken by hand:
- the gateway's off branch removed: gateway TestCodexDescriptionsSetting
  red (magpie knows no model "off", no response.completed);
- the API's "off" check removed: gui TestCodexDescriptionsSetting red
  (400);
- settings validation without "off": gui and gateway tests red (400 /
  "must be a model's id ... not \"off\"");
- the picker's Off option removed: codex-descriptions.test.cjs red in
  chromium and webkit, en and zh.

Not tried: a real Codex app session with descriptions Off; the app's
side is read from its minified code only.
2026-10-27 15:30:31 +08:00
yetone 353519f557 gui: a Sessions or Usage poll's reads are collected under GOGC 25, and two reads under it at once put back what was set before
An open Sessions or Usage window polls every 15 s, and a poll's reads
allocate ~330 MB to keep ~105 MB. At GOGC 100 the heap grew to twice
what it kept before a collection, so Activity Monitor showed ~280-360 MB
during each poll. Each /api/sessions* and /api/usage* GET now runs under
GOGC 25, the warm-up's usage read's setting, without the memory limit
that read also takes: held at heldMemory, every poll collected over and
over and the window spent 5x the CPU.

underTightGC put back what it found, so two reads at once ended with the
second's 25 for good when the first ended first. A count now holds it:
the first read sets GOGC (and the limit, for the warm-up), the last puts
back what was there before the first.

Measured in a sandbox HOME over the real session and usage data (6 GUI
polls 15 s apart after a warm start, footprint right after each poll /
10 s later; CPU over the 6 polls):
- origin/main: 326 326 326 290 364 281 MB / 188-217 MB; 5.2 s
- GOGC 25 + memory limit: 190 176 172 161 216 186 / 149-172; 20.7 s
- this (GOGC 25 only): 278 217 220 197 248 214 / 186-209; 5.6 s
/api/sessions 495 ms vs 653 ms on main, the other routes the same.

TestTightGCOverlappingReads ends two overlapping reads in either order;
with the count taken out (each read putting back what it found) it is red,
"one read still in flight under GOGC=100, want 25".

Run at this head (ea7c0067e + this): gofmt -l clean; GOOS=linux, windows,
darwin go vet -tags nogui ./internal/gui/ clean; go test -timeout 45m
./internal/gui/ ok (203.3s; a run before it had three
reds that were all "no space left on device", the disk filled by
another build of mine). Then rebased onto 6eb510f78, whose only
internal/gui change is web.go's home-screen manifest: gofmt and the
three vets clean again, and -run 'TightGC|Warm|Held|PageRead|Sessions'
./internal/gui/ ok.
Not tried: the Linux and Windows apps' own footprint.
2026-10-27 14:31:17 +08:00
yetone ea7c0067e0 privacy: each local model's confidence threshold is the user's to set
Yayoi_no_yume on X asked for the privacy model's threshold to be
adjustable: they read it as fixed at 0.5, and from their own use find
0.85-0.95 right for AstrLink. The 0.5 is Privacy Filter's (pf-serve's
argv default); AstrLink Guard already masked at its publisher's 0.8.

Both models now find at a floor of 0.5 (pii.Floor) and give each span
its score: Guard's least token probability (rounded through float32,
so a span read back from the cache file sits on the same side of a
threshold), pf-serve's own. masking.model keeps the spans at
pii.Threshold or over: settings.RedactModelScore[model] when it is in
[0.5, 1), else the model's MinScore (Privacy Filter 0.5, AstrLink
Guard 0.8). Settings -> Privacy shows a Confidence threshold row under
the model (app menu, 0.5 to 0.95 and Default), /api/privacy-model
takes do:"score". The setting is this computer's own, like the model.

The defaults stay. TestMaskEval's cases, rules + model + magpie's
checks, by threshold:

  Privacy Filter 0.5-0.8   masked 41/42  kept 112/113
  Privacy Filter 0.85-0.95 masked 40/42  (a Chinese name lost)
  AstrLink Guard 0.5-0.7   masked 42/42  kept 112/113
  AstrLink Guard 0.8-0.85  masked 41/42  (a phone in a tool result)
  AstrLink Guard 0.9       masked 40/42
  AstrLink Guard 0.95      masked 40/42  kept 113/113

The model alone does raise fewer false alarms higher up (Privacy
Filter's found-in-keep falls from 47 at 0.5 to 27 at 0.95, Guard's
from 8 to 2), but the checks after it drop most of those already, so
a higher threshold mostly costs values that should be masked.

Cache file: found-<model>.bin is now "pfound02" with a float32 score
per span. A "pfound01" file is still read, each span with score 1, so
texts cached before mask as they did and aren't asked again. For those
texts a higher threshold drops nothing and a lower one doesn't add a
Guard span scored 0.5-0.8 until the cache turns over (20000 answers).
merge() keeps the surer score of spans it joins. The eval recordings
(eval-model.json, eval-astrlink.json) were made again with scores,
from a scratch cache, the live found files untouched.

Run in the worktree at 11dcc743f + this change:
- go vet / gofmt -l on the touched packages: clean
- go test -count=1 -timeout 45m ./internal/pii/... ./internal/masking
  ./internal/redact ./internal/settings ./internal/gui ./internal/gateway: all ok (gateway 546s, rerun
  after an earlier run hit "no space left on device" on this machine;
  every failure in that run was a TempDir mkdir). This run caught
  TestSettingsSaveKeepsWhatItDoesNotSend wanting RedactModelScore set;
  it is now
- GUI: privacy-model.test.cjs 64/64 (chromium + webkit, 5 languages,
  1100 and 640px; the new threshold menu test among them),
  i18n-keys 4/4, redact-kinds, redact-rule-edit,
  redact-rule-row, redact-shape, redact-words-any-case all pass.
  masking-records 82/82, routing-masking 10/10, privacy-usage-stats 4/4,
  mask-actions 22/22. privacy-hides-accounts was 3/4 once (webkit en,
  page.goto's 5s at load ~290, the class of #3525, commented there),
  then 4/4 three times. Not run: the rest of the GUI suite.
Rebased on 508911e43 (which touched internal/pii fetch and mirror): at
that head, go build ./..., Linux and Windows go vet of pii, masking,
settings and redact, gofmt -l, and go test of pii/..., masking, redact,
settings and gui all ok; gateway not run again after the rebase.
Broken by hand: masking.model keeping every span (TestModelThreshold
  red); Threshold taking any value (TestModelThreshold red); the cache
  writing 1 for every score (TestRestartReadsWhatWasFound red); merge
  not keeping the surer score (TestMergeAcrossPieces red, after its
  joined span was made surer than the one it joins).
Not tried: the real app's window, Windows, Privacy Filter on a GPU
with the new score read (pf-serve itself is unchanged; it always sent
the score).
2026-10-27 14:10:33 +08:00
yetone 5215108e53 gui: magpie web shows MAGPIE_PUBLIC_URL at the sidebar's foot and in About's Gateway URL, as the Gateway page does (noahhrreion on Discord)
noahhrreion runs magpie in Docker and sets the gateway's address with
MAGPIE_PUBLIC_URL; the address at the foot of the page didn't show it.
Since #1551 a page other machines open (magpie web) shows
MAGPIE_PUBLIC_URL, while they are let in, as the gateway's address on the
Gateway page, starts Connect and its snippets at it, and uses it for
Settings' MCP addresses. Two places still said the container's loopback:
- the sidebar's gateway line (renderSideGw): it drew providers' and
  boot.js's `url` only. It now draws `publicURL` in magpie web, and
  boot.js's `sideGateway` carries it (same rule as settingsState: shared,
  or MAGPIE_ADDR on the network, as the image's 0.0.0.0 is)
- Settings › About's Gateway URL: in magpie web it is the public URL,
  and the separate Public address row, then the same, is left out
In the app on this computer both stay the local address that agents here
are pointed at, as before. The address list in Share on local network
already gives MAGPIE_PUBLIC_URL alone, and Connect and the copy buttons
were already at it.

Run (worktree at origin/main 11dcc743f + this, darwin/arm64, load ~150):
- go test -count=1 ./internal/gui/: ok (TestBootSaysWhereItsGatewayListens
  now checks publicURL is in sideGateway on the network and absent on
  loopback; the script budget tests pass, not raised)
- gofmt -l clean; go vet darwin and windows on internal/gui. The linux vet
  of internal/gui doesn't build Wails without cgo on this Mac, in Wails
  itself, as on main
- public-url-default.test.cjs, Chromium and WebKit, en zh zh-TW ja de,
  1100 and 420 wide: 26 pass
- the 18 GUI files on the changed caller-keys fixture plus sidebar,
  gateway-port, i18n-keys, settings-general, settings-sections and
  settings-search, 3 wide: 322 pass, 4 fail. Rerun 1 wide, 3 passed and
  gateway-caller-keys webkit stayed red at line 137; it is red 4 of 5
  on 11dcc743f without this change too, #3797. gateway-key-models webkit
  (#2648) and gateway-own-key zh 440 (#3842, filed now) passed alone.
Broken by hand:
- renderSideGw back on g.url: public-url-default's magpie web test red
  at 1100 wide
- About back on s.gateway: red at both widths
- boot.js without publicURL: TestBootSaysWhereItsGatewayListens red
Not tried: a real Docker container with MAGPIE_PUBLIC_URL; the page was
driven with a faked API. Not asked of the reporter yet: whether they open
magpie web, or the desktop app, which keeps the local address.
2026-10-27 13:30:16 +08:00
yetone ecd0638276 gui: the Sessions list is encoded once, into the answer it is sent as
writeJSONRows marshalled each row on its own, joined the rows, and wrote
the join into a buffer that grew from nothing: three copies of the ~8 MB
list on every 15 s poll. The rows are now encoded straight into the
answer, whose buffer is made the size of the last answer of that key;
each row's bytes (for its sum and for a delta) are a slice of it. The
answer is byte for byte what it was, so tags and deltas are unchanged.

A/B on the same live history (rss-bin ab5.sh, 8 polls 15 s apart,
11dcc743f vs this): writeJSONRows 224MB -> 126MB allocated, json.Marshal
128MB -> 30MB. Total allocation in the second run was higher, all of it
in usage's readRequestBlocks/s2.Decode (a usage block rebuild of the live
data during that run), which this path doesn't reach; footprint per poll
is within the runs' noise.

New TestWriteJSONRowsWritesWhatMarshalDid compares the answer with the
old construction for 0..3 rows (HTML, U+2028, quotes, newlines, 1e21),
with and without other fields, twice each so the second uses the sized
buffer, and checks a delta's changed row and runs. Broken by hand
(a row's slice keeping its comma) it goes red on the delta.

Run at this head (rebased on 11dcc743f, origin/main fetched): gofmt
clean; go vet -tags nogui ./internal/gui/ on linux, windows, darwin ok;
go test -count=1 -timeout 45m ./internal/gui/ ok (234s).
Not run: the other packages (only internal/gui changed) and the GUI JS
suite (no asset changed).
2026-10-27 13:11:16 +08:00
yetone 94a70f1a0d gui: what a Sessions or Usage poll threw away goes back once the page rests
An open window's Sessions and Usage polls allocate ~330 MB every 15 s to
keep ~105 MB, and Go's scavenger hands the freed pages back only slowly,
never while the next collection's goal covers them: between polls the
footprint sat at 336-392 MB. The gateway already hands its requests'
pages back once it rests (#3472), but the window's reads go through the
GUI's handler, not the gateway's, so nothing ever did that for them.

held now counts the /api/sessions and /api/usage reads (readingPage),
and once none has been in flight for 3 s (a poll's reads come within a
second of one another) it calls debug.FreeOSMemory, as the warm-up does
after its reads.

Measured on a copy of the owner's real history (rss-home, 3581/3582,
8 GUI-like poll cycles 15 s apart, footprint 10 s into each rest), at
c2c08850f vs this change:
- footprint at rest: 336-392 MB -> 164-193 MB
- footprint right after a poll: 336-392 MB -> 181-276 MB (358 on the
  first)
- process CPU over the 8 cycles: 6.55 s -> 6.27 s
- /api/sessions mean 256 -> 305 ms, /api/usage/requests 232 -> 154 ms
  (one run each, the live history changing under them)

Tests: TestPageReadsReleasedAtRest (no release while a read is in
flight, one when the last ends, a cut-short rest waited out again) and
TestHeldCountsPageReads (sessions and usage counted, /api/state not).
Broken by hand: without the in-flight check the first fails ("released
while a read was in flight"); without readingPage in held the second
fails for both paths.

Run at this head (rebased on 8fba65d0b): go test ./internal/gui/ ok (94s); the two new tests
-count=20 ok; gofmt clean; GOOS=linux and GOOS=windows go vet -tags
nogui ./internal/gui/ ok.
Not run: the GUI JS suite (no script changed), the full ./... suite.
2026-10-27 08:29:11 +08:00
yetone 9ae7912210 agent: plain agy starts Antigravity CLI on magpie in a new terminal
agy takes magpie's gateway, key (GEMINI_API_KEY, GOOGLE_GEMINI_BASE_URL)
and --model only from how it is started, so a user on magpie had to copy
the launch command at every start (bestony on Discord). Now:

- magpie agy run [args…] execs the real agy with the env and --model when
  agy's settings.json is on magpie's model (a --model/-model the user
  gives wins), and runs agy untouched otherwise. On Windows agy is a child
  through proc and its exit code is passed through. It refuses when "agy"
  on PATH resolves to magpie itself. magpie agy env prints what run adds
  (PowerShell's function reads it, since the desktop exe has no console).
- update.ShellFunction puts a function named agy in a marked block
  (# >>> magpie agy >>> … # <<< magpie agy <<<) of each shell profile
  cliShells finds: .zshrc (ZDOTDIR), the bash profile a terminal reads
  (.bash_profile, or .bash_login/.profile on macOS when that is missing),
  config.fish once its folder exists, and the PowerShell 7 / Windows
  PowerShell profiles where the execution policy runs them. Only the block
  is written, in place, temp-and-rename, CRLF and BOM kept; a profile that
  can't be read is not written; only files inside the home are. The
  function falls back to `command agy` when the magpie it names is gone.
- Set to a magpie model writes the block, stepping out takes it out (the
  file comes back byte for byte), and Sync at start writes it for users
  already wired.
- Notice, Launch tooltip and the connect panel say plain agy works in a
  new terminal, with the command for a terminal open now. Strings in
  i18n.js for zh, zh-TW, ja, de. docs/reference.md and
  docs/subsystems/agent-wiring.md updated.

Run at this head (base a3d4f8c5c, origin/main just fetched):
- go test -tags nogui -count=1 -timeout 45m ./internal/agent/...
  ./internal/cli/... ./internal/update/... ./internal/gui/...
  ./internal/proc/... : all ok.
- go vet ./... (darwin), GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... : clean. gofmt -l on the changed files: none.
- GUI (node --test, chromium + webkit): agy-launch, cursor-local-launch,
  agent-connect, agent-connect-no-models, agent-connect-all-hidden,
  agent-connected-unfolded, connect-address-kept, connect-snippet-shell,
  agent-notice-lang, agent-leave-magpie, agent-disconnect, copy-command,
  i18n-keys, gui-de, gui-ja, gui-zh-tw: 0 fail. Not the whole GUI suite.
- Real try, sandbox HOME under the scratchpad, nogui build, fake agy on
  PATH printing its args and the two env vars, env -i:
  magpie provider add deepseek + magpie agy deepseek/deepseek-chat wrote
  the block after the user's two .zshrc lines; `zsh -i -c 'agy -p hi'` got
  --model magpie/deepseek/deepseek-chat, GEMINI_API_KEY=magpie-agy and
  GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:38712; `agy --model x` kept x;
  wiring again left .zshrc's mtime alone and added .bash_profile once it
  existed, and `bash -l -i -c 'agy -p hi'` got the same; `magpie agy env x`
  refused; magpie agy default took both blocks out, .zshrc equal to the
  original, and plain agy ran with no env and no --model.

Broken by hand, each red, then restored:
- no fnInHome check: TestShellFunction, TestShellProfiles red.
- block appended instead of replaced in place: TestShellFunction red.
- unreadable profile treated as empty: TestShellFunction red.
- blank line before the block left on removal: TestShellFunction,
  TestWithFnBlock red.
- --model always added: TestAgyRun red.
- Sync without agyShell: TestAgyShell red. Stepping out without
  agyShell(false): TestAgyShell red.
- app.js typed row off, typed tooltip off: agy-launch 4 of 10 red each.

Not tried: PowerShell on Windows for real (vet only); WSL; a user's own
`alias agy` (an alias beats the function); a terminal already open needs
the copied command; macOS bash started non-login reads .bashrc, which
isn't written; a Documents folder redirected outside the profile isn't
written.
2026-10-27 07:30:16 +08:00
yetone 8bc72bf10a gui: the Sessions tab's 15 s reads send only what changed, not the ~8 MB list
Every 15 s the Sessions tab read /api/sessions (7.9 MB over a long
history, 5000 rows) and /api/sessions/stats (0.7 to 5.7 MB), parsed both
and ran JSON.stringify over the old and new answers to find them the
same. While an agent works one row changes, so it was all of it, every
poll, in the WebView.

- writeJSONSame (api.go) tags an answer with a hash of its bytes. An ask
  whose X-Magpie-Had is that tag gets X-Magpie-Same and no body, and the
  page keeps the object it has. Used for the stats.
- writeJSONRows does the same for the list, and keeps each row's hash
  for the last 4 lists it sent. Asked with the tag of one of those, it
  sends X-Magpie-Delta: sessions and a list of only the new rows, each
  run of old rows written [from, count].
- api() in app.js sends the tag it has, rebuilds a delta on the rows it
  holds (the same objects), and remembers each answer's tag. The tab
  compares answers by tag, so it no longer stringifies 8 MB twice.
- Not an ETag and a 304: on Windows Wails strips If-None-Match from
  WebView2's requests and turns a 304 into a 505.

Run at this head (macOS, go1.27, parent eee571999 = origin/main):
- TestSessionsSentOnceWhileTheSame: an unchanged answer is sent with no
  body, another tag gets it whole, and after a new session the list is
  the new row plus [0,1], which rebuilt on the old list equals the whole
  answer. Red with the Had check or the delta turned off by hand.
- tests/sessions-same.test.cjs (chromium and webkit, en and zh): no body
  sent again while unchanged, and the very objects kept. One new session
  sends a delta, and the old row is the object the tab had. The new
  title is drawn. Red in chromium with the client's rebuild removed.
- go test -tags nogui -timeout 45m ./internal/gui/ ./internal/sessions/
  ./internal/usage/: ok. gofmt -l clean; GOOS=linux and GOOS=windows
  go vet -tags nogui ./internal/gui/ ./internal/sessions/: ok.
- GUI: the 72 files that read /api/sessions or its stats, and
  i18n-keys, both engines: 1081 tests, 1053 pass, 28 fail. The fails are
  usage-agents-hide (#3414) and usage-ledger's "newest live route needs
  no return-to-live button" (#3104). Each file fails the same alone
  with eee571999's app.js and page.js (5/11 and 14/3 in chromium).
- A built binary on the real history (~15.9k sessions, a Claude Code
  session being written), six reads 15 s apart sending the last tag:
  20,753 B once (only this session's row), then 0 B with Same five
  times; the list was 7,928,438 B whole. Each rebuilt list equalled a
  whole read taken just after it. Stats asked again: 0 B, against
  5,688,332 B whole.

Not run: the whole GUI suite (~12.5k tests, ~5 h at this load). It was
stopped at 1,218 tests with only account-discovery red, which is #3497
and is red the same with this change's app.js and page.js put back.
Not tried: the Windows app (WebView2) and the Linux app.
2026-10-27 06:18:24 +08:00
yetone a019f4ffc0 masking, settings, gui: the local model the user picks (#3578)
settings.RedactModelName holds the pick ("" for none, read by
pii.Choose), this computer's own like RedactModel, kept by KeepOwn and
by the GUI's settings save. /api/privacy-model returns the chosen
model's status and every model's, and takes {do: pick, model}: picked
while off it is saved for the next On; picked while on it is
downloaded, and once on disk it is saved and the other model stopped.
Remove deletes both. masking runs the picked model.

TestPrivacyModelPick and TestMaskingUsesThePickedModel fail on the old
code (no pick; Privacy Filter always).

Run: go test ./internal/settings ./internal/gui ./internal/masking
./internal/gateway -run 'Mask|Redact|Privacy|PII|Unmasked'
./internal/gwmw at the pushed head.
2026-10-27 02:01:16 +08:00
yetone 4a33cf0a98 update: a Stable channel in Settings → About, and magpie update channel
ssharpcc on X reads every changelog before updating, for fear of a ban
when behind, and with many releases a day that is a lot of reading.
Settings → About → Update channel (zh: 更新渠道, 稳定版 / 每个版本) picks
Every version, the default and today's behaviour, or Stable: one version
a week, the newest that had been out three days as the week began
(Monday 00:00 UTC), and an urgent release at once. usemagpie.ai chooses
it from the release list (the previous commit); a release is urgent when
a line of its notes starts with "**Urgent release:**", which
magpie-releases' release run writes from an `Urgent: <why>` trailer
(magpie-releases 73f6cff).

- settings: updateChannel, "" or "stable"; anything else is refused.
- update: on Stable the feed is asked with channel=stable; What's new
  shows every release since the installed one (up to 1500) instead of
  the newest 40, so a week's notes read as one list.
- gui: the row is segs, never a <select>; a save that doesn't send the
  channel keeps it; switching asks the feed again at once, and a
  download from every version newer than Stable's pick is dropped,
  never restarted into. What's new's notes are kept per channel.
- cli: magpie update channel [stable|every] ("all" too), and it says
  which with nothing after it.
- docs: reference.md's Update channel (the rule and the marker); the
  privacy pages (en, zh, ja) name ?channel=stable on /api/latest.

The full Go and GUI suites were not run: the disk was at 3 GB free and
other sessions had GUI suites and a 45-minute gateway run going the
whole time.

Run, at this tree before the rebase:
- gofmt -l (clean); go vet on darwin, GOOS=linux -tags nogui and
  GOOS=windows for ./internal/update/... ./internal/cli/...
  ./internal/settings/... ./internal/gui/.
- go test -count=1 ./internal/update/... ./internal/cli/...
  ./internal/settings/...: ok. ./internal/gui -run
  'TestUpdateChannelSwitch|TestWhatsNewKeyedByChannel|TestCoreScriptBudget':
  ok (the app.js budget passes).
- GUI, chromium and webkit: update-channel (22: en, zh, zh-TW, ja, de at
  900 and 420 wide: default lit, Stable saved, kept by another save,
  kept over a reload, Every saved back, no click scrolls, no sideways
  scroll at 420), i18n-keys, gui-ja, gui-de, gui-zh-tw and every
  update-*.test.cjs: 253 of 253 pass.
- The live feed: /api/latest?channel=stable answers 0.1.1327 (out
  2026-10-22 21:55 UTC, the last before Friday 10-23 00:00) with 15
  assets after the first real cron run filled the ledger (400 releases
  back to 10-10); /api/notes 0.1.1200..0.1.1327 gives 124 notes, none
  empty (1213 and 1218 were never published).

After rebasing on afc99490f: TestCoreScriptBudget, the channel Go tests
(update, cli, gui) and GUI i18n-keys + update-channel (both engines,
26 of 26) pass again.

Broken by hand, each red: the feed asked without channel=stable
(TestLatestAsksTheChannel); Stable capped at 40 (TestStableNotesAreAll);
any channel saved (TestUpdateChannelSaved); "all" dropped
(TestUpdateChannelCmd); a save without the field clearing it, no new ask
on a switch, the newer download kept (TestUpdateChannelSwitch); one
notes key for both channels, What's new capped at 40 on Stable
(TestWhatsNewKeyedByChannel); app.js's other saves dropping the channel,
Stable's click saving "" (update-channel 11 of 11 red); the zh label or
a de subtitle taken out (update-channel and i18n-keys red).

Not tried: the full go test ./... and the whole GUI suite (above); a
real app switching channel against the live feed; Windows and Linux
runs (vet only); a real urgent release.

Requested by ssharpcc on X.
2026-10-26 21:09:44 +08:00
yetone a1174674da codex: subagents and memories follow the session's magpie model; auto-review can too (cybercaius on Discord)
Codex's side calls ask for one of Codex's own models by its bare name
whatever the conversation is on: a subagent goes on the model the lead
names in spawn_agent, memories on gpt-5.6-luna/terra, auto-review on
codex-auto-review. With Codex signed in to ChatGPT and the conversation
routed onto one of magpie's models, each of those went to the ChatGPT
account instead (cybercaius: "can't pick follow the main model").

- gateway (codexFollowTo, codexLeads): a collab_spawn or memory call
  that asks for a bare model, with nothing set for it (no magpie
  subagent model, no [agents] default_subagent_model, no [memories]
  extract/consolidation_model in Codex's config), goes on the model its
  conversation's own turns go on (parent thread, own thread, else the
  key's last turn), when that is a magpie model the key may use. A task
  the ChatGPT backend sealed stays on ChatGPT. The trace shows a
  subagent's pick as {asked -> to}.
- agent.CodexSideSet reads Codex's config.toml for those keys; an
  unreadable config counts as set (leave as sent).
- Auto-review gets "Same as the session" (settings value "session"):
  codexcat writes each magpie entry's own id as its
  auto_review_model_override. Not the default: codex-auto-review runs
  free on a ChatGPT sign-in (#1593).
- GUI: the option in all languages; Memories' default text says it
  follows the session. app.js stays under its budget by folding five
  identical writingPrefs then/catch chains into prefWrite.

Ran (sandbox HOME, -tags nogui -count=1 -timeout 45m):
- go test ./internal/gateway ./internal/agent ./internal/codexcat
  ./internal/settings ./internal/cli ./internal/gui: ok.
  ./internal/provider: FAIL with "close of synctest channel from outside
  bubble" in filememo.Forget (TestUnreadLoginsWriteErrorsKeepCredentials),
  which is #3632 on main; this change touches nothing there.
- TestCodexSubagentFollowsTheSession and TestCodexMemoriesFollowTheSession
  go red with codexFollowTo returning "" (broken by hand).
  TestCodexSideCallsKeepTheConfigsModel, TestCodexSideCallsStayOnChatGPT,
  TestCodexSideSet, TestCodexAutoReviewFollowsTheSession pass.
- GUI (playwright 1.62.0, chromium + webkit): codex-auto-review (en, zh,
  zh-TW, ja, de), codex-memories, codex-memories-settings, codex-titles,
  codex-predictions, codex-descriptions, settings-general, agent-prefs,
  i18n-keys: 120/120 pass. TestCoreScriptBudget passes, budget unchanged.
- gofmt -l clean; go vet -tags nogui for linux, windows and darwin ok.

Again after rebasing on origin/main 49f15d124 (25341b4ca on top touches
only internal/redact; rebuilt): nogui builds (darwin, linux,
windows), TestCoreScriptBudget, the tests above, and the GUI files 120/120.

Not tried: a real Codex with a real ChatGPT account and a relay model.
2026-10-26 15:35:12 +08:00
yetone c26a418d23 agent: an import app's status magpie can't read is unknown, not "not added"
Agent.Added now returns (added, known). Cindy's reader turned any
failure (a locked, corrupt or unreadable cindy-local-v1.db) into "Not
added", which told a user who had added magpie that they hadn't. Now
an unreadable database is unknown: /api/agents leaves `added` out and
the row shows the "confirm it there" hint, as it does for Lody. A
stopped WSL distro's app is unknown too, not "not added".

Cindy's database is also read without writing beside it. A mode=ro
open of a WAL database while Cindy was closed made cindy-local-v1.db-wal
and -shm in Cindy's own folder. It now goes through
sessions.OpenUntouched, which is what the Cursor reader already did
(immutable with no log, from a copy with one), moved out of
openCursorStore so both share it.

The CLI's list still offers `magpie cindy add` when the status is
unknown; it never said magpie was missing.

Run: go test ./internal/agent ./internal/sessions ./internal/cli ok;
go test ./internal/gui -run 'Import|Lody|Cindy|Agents' ok.

Broken by hand: Cindy's reader put back on the mode=ro open made
TestCindyHasClosedWALAndUnreadable red ("Cindy's folder changed:
cindy-local-v1.db -> cindy-local-v1.db,cindy-local-v1.db-shm,
cindy-local-v1.db-wal"); api.go ignoring `known` made
TestImportStatusUnreadableIsUnknown red. Both restored, both green.

Not tried: a real Cindy install; the read is tested on fixture
databases only.
2026-10-25 16:49:29 +08:00