Commit Graph
299 Commits
Author SHA1 Message Date
yetone 1c9c359f9d gui: Usage cards keep their place as they come in (liuzhengdong99 on X)
liuzhengdong99 on X: 用量界面每张卡片取数的时间不一致,导致卡片渲染时高度一直
跳动——滑到上面看某张卡片,视图会被拽回下面. The allowance cards come in
at different times: each vendor's read (the page asks again every 1.5s
while X-Magpie-Reading says a read is under way), then the curves'
history. Every answer redraws the cards (renderQuotas), and packUsage
grows the ones above the card being read. Nothing kept that card in
place: the view's scroll guard (keepInView) only knew elements by node,
and the cards are new nodes on each draw, so the browser's anchoring was
the only thing holding them. It anchored on nodes that were being
replaced, and the reader ended up dragged down.

Fix:
- The Overview keeps the card being read in place: the highest card (or
  part of the page under the cards) that starts in sight, found again by
  its data-key after a redraw (keepInView's new `only` mode with pinnedAt),
  and followed after every packUsage (followPin). The browser's own
  anchoring stays on while nothing is kept: at the page's top, on
  another tab, and while the cards are dragged or moved by keys (unpin,
  so a dropped card lands where its slot showed).
- Placeholders from the last known height: each card's height drawn in
  full is kept by its key (localStorage magpie.usageCardTall, 1s
  debounce, 200 keys at most). A card still waiting on its read or its
  curve (usageWaiting: quotasReading, the new flag loadQuotas sets, or
  no history answer yet) is packed and held at least that tall, in the
  column count the cards were last whole in at that width. On the next
  start, no card in sight moves.
- loadQuotaHist counts its first answer even when it is empty, so a
  user with no history isn't left waiting (found by usage-pack: the
  cards held their first packing at 560px).

No new animation, nothing scrolls the page on its own (click-scroll
passes), and the layout is unchanged once the cards are in.

Run (mica, Playwright 1.62.0, Chromium + WebKit):
- usage-cards-steady.test.cjs (new): 20 tests, all 5 languages, 1100px
  and 420px. On the old assets (MAGPIE_ASSETS) it was red 8 of 8 in en
  and ja. With the hold disabled, the second visit goes red.
- At ee079814b + this change (then rebased onto 1c29e2c7d, which changes
  only app.css, redact.css and a new contrast test; script budgets
  measured again, unchanged): go test ./internal/gui/ (budgets included),
  gofmt, and usage-pack, usage-cards-steady, usage-drag, usage-arrange,
  click-scroll and i18n-keys: go ok (300s), 64 of 64 GUI tests pass.
- Every usage-*, quota-*, view-*, account-arrange, click-scroll,
  i18n-keys and gui-de/ja/zh-TW file (151 files), run before the empty-history fix and the last
  rebase, head vs origin/main.
  No red at head is new. The reds that are also on base: account-arrange
  (#6010), quota-count-wrap (#3404), quota-curve (#6789),
  quota-refresh-order (#6180), quota-credits (#6807), usage-ledger
  (#5048, #6003), routing-* (#7016), gui-ja (#7144),
  view-trackpad-coast (#4724), view-wheel-unheard (#5158), plus the
  whole-suite reds in #6975 and #6934. usage-pack and usage-drag went
  red at head along the way and are fixed here.

Not tried: the real app (WebKitGTK on Linux, WebView2 on Windows,
WKWebView on macOS) and the full GUI suite.
2026-11-19 13:01:23 +08:00
yetoneandrecih bfbc22e190 claude: an idle session is saved whenever the gateway ends or hands over (#7017)
recih: after magpie web restarted (an update's re-exec, or Quit and
start again) the next Claude turn replayed the whole conversation
instead of resuming its session. Web.Wait closed the page server and
never drained the gateway, so abortAll never ran and claude-shelf.json
was never written.

- Web.Wait drains the gateway (Close: page server, then stopServing)
  before the plugin hosts end and before update.Reexec.
- Desktop quit: OnShutdown calls stopServing.
- Signals: web, serve, the TUI and the app register their gateway with
  the signal handler (stopGatewayOnSignal). SIGINT, SIGTERM and SIGHUP
  drain it, sessions saved, before magpie dies of the signal. The return
  path waits for a drain the signal already started. The TUI and the
  app take SIGINT/SIGTERM themselves, but SIGHUP (the terminal closing)
  stays with magpie. runTUI, runGUI and runPanel now register
  tui.StopGateway and gui.StopServing for it (added in review).
- Handover: the successor answered a Claude turn before the predecessor
  had saved its shelf. The predecessor now serves
  GET /_magpie/claude-ready on its callback socket, answered once
  abortAll has run. A Claude turn on the successor waits for it.
  - The predecessor saves only after every request it holds has ended,
    of any provider, which can take up to handedOffDrain (15m).
  - Added in review: the wait is bounded by predecessorWait (90s, inside
    Claude Code's ten minutes for a reply). Past that, the turn goes on
    as before, as a replay, and no later turn waits
    (errPredecessorSlow).
  - loadShelf still reads a shelf written later, at the next turn with
    no session found.
  - A predecessor without the endpoint (404) keeps the old race.
- Sweep: sweepSessions removed session files older than idleLongest.
  That included a session kept for hours past a quota 429
  (keepForReset) and one moving from the shelf to a run.
  - Those are now protected: the shelf file, the in-memory shelf, the
    resuming set and active runs.
  - An unreadable shelf skips the sweep.
  - loadShelf and the sweep's snapshot are serialised by shelfFileMu.
    The bridge lock is held only for the shelf maps, never across the
    file's reads (added in review: the branch read the file under b.mu,
    which every Claude turn takes).

From recih's branch fix/web-restart-session-persistence (7a0261cc1,
fab0ea651), with the review's follow-ups. Not taken from the branch:
the .github/workflows/test.yml change (contributors.md: .github/ stops
for the maintainer), and the test-flake commits in other packages,
which are separate goals.

Red on origin/main 48fffb60c (the branch's tests, trimmed to what
compiles there), on mica:
- TestWebShutdownKeepsClaudeSession quit and restart: no
  claude-shelf.json ("Web.Wait did not keep the idle Claude session").
  Restart is a real Unix re-exec of the test binary with a fake claude.
- TestDesktopShutdownDrainsGateway.
- TestClaudeHandoverWaitsForSavedSession: "the successor answered
  before the predecessor saved its session".
- TestClaudeSweepKeepsQuotaSessions: 5 of 5 subtests swept the kept
  session.

Broken by hand: with runTUI's, runGUI's and runPanel's
stopGatewayOnSignal defer removed, TestHangupDrainsTheGatewayFirst
fails tui, app and panel ("SIGHUP never drained the gateway"), on
mote.
Run on mote at e4506887c (this stack on origin/main 7300be4d0):
go test -timeout 45m ./...: 101 packages ok, 2 FAIL, both open issues
that fail the same at 7300be4d0 on mote, where an ssh session forwards
127.0.0.1:3425 to a real magpie: internal/cli's
TestHealthcheckFindsTheRunningGatewayWithoutMagpieAddr,
TestUpdateRestartsTheGatewayItFindsWithoutMagpieAddr and
TestUpdateFindsAMagpieThatWroteNoRecord (#6223), internal/gui's
TestLaneLimitRoutes (#5150). On mica: gofmt -l clean; go vet ./...,
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go
build, GOOS=linux go build -tags nogui, GOOS=windows go build all ok.
go test -race -count=2 of the new and touched tests in internal/gateway,
gui, plugin, tui ok on mote.
Not tried: a real desktop app quit or update with a real Claude
account; SIGHUP from a real terminal closing.

Rebased since. At dc507aefd on mote: go vet (darwin, GOOS=linux
-tags nogui, windows) ok; go test of internal/cli, tui, plugin,
gateway, gui, claudebridge ok but for the same #6223 and #5150 reds.
At 939fe31b6 (on origin/main 78b6d47cc) on mote: gofmt -l clean, the
three vets ok, the stack's tests with TestClaude* and
TestCoreScriptBudget ok in all six packages. Pushed on b400566f9 after
a clean rebase; the commits between touch no Go file this stack does.

Co-authored-by: recih <240406+recih@users.noreply.github.com>
2026-11-18 23:06:38 +08:00
yetone 1b360f08c2 gui: the Version row's Restart is named Restart only (realfxw on X)
With automatic updates off, Settings › About's Version row shows Check
and a bare Restart. realfxw restarted again and again, reading Restart
as "install the update", while his build was newer than Daily's and no
update was on offer.

Why the button is there: 74bba1fa6 added it for yansheng1003 on X, to
start magpie again as it is so start-only settings apply (LAN set by
hand in settings.json, environment variables). It does something, so
it stays, named for what it does: "Restart only" (仅重启, 僅重啟,
再起動のみ, Nur neu starten). It still shows only while no update is on
offer; the paths that install an update keep their own buttons. No
description text is added. The plain "Restart" key stays for the
agent dialogs that use it.

A longer "Restart without updating" was tried first: at 420 wide it
squeezed en's "Automatic updates are off" onto two lines, the row grew
and update-auto's "a view at its top stays at its top" went red (top
25, 2 of 2 runs, both engines). "Restart only" keeps that line on one.

TestCoreScriptBudget: app and core budgets +5, the longer word alone;
renderUpdate draws it on every window, so there is no page to move it
to.

Tests: version-restart.test.cjs gains "automatic updates off, the button
beside Check says it doesn't update", every language at 900 and 400
wide (buttons on one line, no sideways scroll, no page errors).

Run, on mote:
- Red on old: the new case against origin/main's assets, chromium, 31
  failures (['Check','Restart'] where the new label is expected).
- At this head (rebased on 35a03fee0):
  - gofmt -l internal/gui empty;
  - go vet ./internal/gui for darwin, linux -tags nogui and windows;
  - go build ./... for darwin, linux -tags nogui and windows;
  - go test -run 'TestCoreScriptBudget|TestI18n|TestRestart|TestUpdate'
    ./internal/gui ok.
- GUI, the 32 files it can reach (update-*, version-*, i18n-*,
  gui-zh-tw, gui-ja, gui-de, settings-search*, old-webkit, refresh-page,
  settings-update-source), chromium and webkit: 356 of 358 in each engine; the two reds are old-webkit's, below.
  - Before the rebase: update-auto, version-restart, update-check,
    i18n-keys, gui-de, gui-ja and gui-zh-tw passed 70 of 70 in each
    engine.
- old-webkit's two reds (guideback.js from cb1fe6d5d isn't in its
  list) fail the same on a fresh origin/main 35a03fee0, alone, in both
  engines; recorded on #6570.

Not run: the full Go suite (mote at load ~50, mica's disk full).
Not tried: the real app's About page with automatic updates off.
2026-11-18 22:32:44 +08:00
yetone 4d79bebfa7 usage: speed counts all output, reasoning and tool calls too, from the first output (Archivemylife on X)
Archivemylife on X: speed should be the upstream's usage over the local
time, with no split into reasoning, tools and answer, since reasoning and
tool calls are tokens too.

Speed is now every output token the vendor's usage counts (reasoning and
tool-call arguments included) over the time from the first output of any
kind to the end of the reply. The first output is the earlier of the first
content (TTFT) and the first sign of reasoning, firstToken.reasoningMs in
ttft.go, which works the same in every protocol:
- a Responses reasoning item's start;
- an Anthropic thinking or redacted_thinking block's start;
- sealed (hidden) thinking;
- reasoning deltas spread over 100 ms or more. Deltas that came at once
  are a buffered burst and tell none.

A summary is no sign (summaryPart: a Responses reasoning summary, a Gemini
thought, or a summary translated from another protocol via
firstToken.summarized), because it is written after some of the reasoning
it sums up (#1463). A reply that reasoned with no sign of when it began
counts only its answer, its output less the reasoning, from its first text,
and none with no text. Before this, a reply that reasoned always counted
only its answer, and a reply that wrote tool calls after reasoning told no
speed. Burst and held-content checks judge the answer's part.

The same definition holds everywhere:
- gateway: speed.go, trace.go, codex_backend.go;
- usage.DecodeOf, for the Usage cards, rows and `magpie usage`;
- the Usage page's ledDecode;
- the Routing page's decodeOf and its ranking (fast routing reads
  noteTrySpeed, which uses DecodeOf).

settledCountVersion goes to 8, so settled heat totals are counted again.
The rule text is in en, zh, zh-TW, ja and de. Docs: reference.md, and
gui-shell.md under "Streamed output speed".

Red on the old code (scratch worktree at 589e4ba6d):
- TestCodexPreambleThenReasoningTellsSpeed: "reasoning seen from 0 ms;
  want 3166".
- TestVisibleReasoningSpeed: 100/1000 and 0/0 where 1500/14000 was
  wanted.

Run at this head (rebased on dc507aefd), on mote:
- go test -tags nogui -count=1 -timeout 45m ./...
  - gateway ok (1132s), usage ok, routes ok.
  - Red, filed, and caused by mote's own gateway on 127.0.0.1:3425:
    internal/cli TestHealthcheckFindsTheRunningGatewayWithoutMagpieAddr,
    TestUpdateRestartsTheGatewayItFindsWithoutMagpieAddr and
    TestUpdateFindsAMagpieThatWroteNoRecord (#6223, #6471); internal/gui
    TestLaneLimitRoutes (#5150).
- go vet for gateway and usage on darwin, GOOS=linux -tags nogui and
  GOOS=windows: ok. gofmt -l: clean.
- GUI, 18 files in Chromium and WebKit (reasoning-speed, usage-speed-*,
  usage-ledger, routing and the i18n files): 242 of 270 pass. The rest are
  usage-ledger "newest live route needs no return-to-live button" (#6003)
  and usage-speed-all-models "asked for 7d" (#5834). Both are red the same
  way on origin/main dc507aefd, in a run of its own.

Rebased again on 70ad7cf30, which touches gateway.go and usage/page.js.
At that head, on mote: go vet for gateway and usage; go test -run
"Reasoning|Speed|Decode|Ultra|Uncounted" for gateway and usage, ok;
reasoning-speed, usage-reads-note, usage-speed-every-row and i18n-keys in
both engines, 66 of 66.

Not tried: a real account per vendor. The timing is taken from recorded
stream shapes in the tests: Responses, Anthropic, Chat and Gemini, native
and translated.
2026-11-18 21:30:25 +08:00
yetone 1c0ecec0f6 library: a magpie in Docker keeps skills and prompts for its clients
fenglian980510 on X: in the Docker gateway the Library had MCP and no
Skills. Since f285426ac a page that shows no agent (no agents found, as
in a container, or gateway mode) drew the MCP tab alone. 5a9b5720d then
let another computer's magpie take a remote's skills and prompts (Use its
skills and prompts, GET /v1/magpie/library), but a Docker magpie had no
way to hold any, and anything it held was ticked for no agent, so Borrow
gave it to none on the client. The borrow change didn't re-derive the
agentless page.

- client.js: with no agent shown, the Library has Instructions, MCP
  servers and Skills (AGENTLESS_TABS), with nothing of agents (no chips,
  agents' own skills, projects or Agents list) and a line saying a
  magpie that adds this one as a provider takes them. It opens on MCP
  unless the reader picked one of the three. Strings in zh, zh-TW, ja, de.
- library: Shared says NoAgents when the page shows none (NoAgentsShown,
  set by gui.gatewayMode). Borrow gives such a new skill or set ticked
  for none to the agents here that take skills or instructions and
  aren't hidden (givenHere); one ticked for agents keeps them.
- docs: docker.html en/zh/ja (zh and ja still said there is no Library
  at all), reference.md, library, gui-shell and mcp-router pages; the
  search index rebuilt.

Rebased on origin/main 5cf1d3846 (runs below at 589e4ba6d; the five
commits since touch none of these files but gui-shell.md, which
rebased clean, and docs-index.mjs writeAll left the index unchanged).
The search index was rebuilt through
docs-index.mjs's writeAll after the rebase). What was run:
- At this head, on Linux (WSL magpie-desktop): gofmt -l (0 files),
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok
  (mote and mica were over their load bars).
- At this head, on WSL: go test -tags nogui ./internal/library
  ./internal/gui ./internal/gateway ./internal/provider
  ./internal/testenv -count=1 -timeout 45m: all ok.
- At this head, on WSL: library-agentless-skills, library-mcp-agentless,
  i18n-keys, gateway-mode*, library-* and i18n-* (both engines, every
  language the files run): 1975 of 2010 ok. The 35 reds are in 11
  tests, all red on main too: library-all, library-commands-import,
  library-group-steady, library-mcp-copy-config, library-mcp-off-fold,
  library-open-again (#7097), library-bili (#6015: 82/2 alone, with and
  without this change), gateway-model-chip-height (#7108: red 2 of 3
  alone at main). library-bili-settings and library-mcp-json pass alone
  at both (22/22, 32/32).
- At 998e40c85 (the same change on origin/main 48fffb60c), on mica
  (load 25-35 on 12 cores): go test ./... -timeout 45m, 100 packages ok
  and 3 red, each also red or passing alone at the base 534b85bf9:
  internal/dirent (4 tests, red alone at both, #7031), internal/gui
  TestGatewayModeListsNoOwnSessions (passes alone 3/3, #7064),
  internal/sessions TestWSLStoppedDistroKept (passes alone, #7071).
  gofmt and darwin/linux/windows vet ok there too.
- At 998e40c85, on WSL: 239 GUI files that reach the Library (library-*,
  i18n-*, gateway-mode*, web-page*, any file naming the Library):
  4530 of 4688 ok. The 24 red files rerun at concurrency 2: 151 red at
  998e40c85, 155 at 48fffb60c, the same files (#7097, with #6990,
  #4566, #3922, #6570, #4716 for segs-press-redraw, old-webkit and
  title-bar-tools).
- Not on macOS this round: mote and mica each had another session's full
  GUI suite running all the while.

Broken by hand:
- Borrow's two NoAgents branches set to false:
  TestBorrowFromAMagpieWithNoAgents red ("a skill ticked for none there
  went to [] here, not [claude gemini]").
- origin/main's client.js and i18n.js: library-agentless-skills and
  library-mcp-agentless red at "the tabs", 44 of 44.

Not tried: a real Docker magpie with a second magpie borrowing from it
across two machines. site/search-index.mjs run as a script hangs on its
circular import of docs-index.mjs (as on main); the index was written
through docs-index.mjs's writeAll.
2026-11-18 21:29:39 +08:00
yetone 9314999a4a ccswitchlink: a ccswitch:// link that still reaches magpie goes to CC Switch, and so does the scheme (asombrado_a on X)
@asombrado_a (X, 2122995130097713493) has CC Switch and magpie both
installed, and a ccswitch://v1/import link opened magpie. magpie claims
magpie:// only since 03314b25a (v0.1.4455), but v0.1.3981 to v0.1.4454
claimed CC Switch's scheme too, and what they registered stays:
- macOS: Launch Services keeps the old Info.plist's ccswitch claim after
  the bundle is rewritten in place (seen on mote below);
- Windows: HKCU\Software\Classes\ccswitch running magpie.exe;
- Linux: magpie-ccswitch.desktop as the x-scheme-handler/ccswitch default.

The owner's call in 03314b25a stands: magpie doesn't read CC Switch's
links. A ccswitch:// link that reaches magpie anyway is now handed on:
- cli.run, before anything is read, moved or started (Windows, Linux:
  `magpie ccswitch://…`), and the Mac's URL event in gui.Run call
  ccswitchlink.Forward;
- macOS: `open -b com.ccswitch.desktop <link>`, then `lsregister -f` on
  magpie's own bundle, which reads its current Info.plist and drops the
  claim;
- Windows: the handler's program when it isn't this magpie, else
  %LOCALAPPDATA%\Programs\CC Switch\cc-switch.exe (where CC Switch's
  per-user MSI installs it); when the handler ran this magpie the key is
  rewritten as that MSI writes it ("URL:com.ccswitch.desktop protocol",
  URL Protocol, DefaultIcon, shell\open\command "exe" "%1");
- Linux: CC Switch's .desktop entry in the XDG data dirs (its first
  start's cc-switch-handler.desktop with %u first, else the package's
  "CC Switch.desktop", whose Exec has no %u, so the link is appended) is
  run, and a default that is magpie-ccswitch.desktop moves to it; magpie's
  entry is removed while it runs this magpie or a gone binary. Any other
  default is left alone.
- No CC Switch: ErrNotInstalled, nothing opened, the claim kept, so
  magpie opens such a link as it does now (it says it reads magpie://
  links only).

Existing users: nothing changes until a ccswitch:// link reaches magpie.
The first one is opened in CC Switch and the claim goes back, so later
links go to CC Switch directly.

CC Switch's facts come from farion1231/cc-switch (tauri.conf.json's
deep-link schemes ["ccswitch"], wix per-user-main.wxs, lib.rs's
register_all) and its v4.0.35 assets: macOS.zip's Info.plist
(com.ccswitch.desktop, CFBundleURLSchemes ccswitch), the portable zip's
cc-switch.exe, the .deb's "CC Switch.desktop" and /usr/bin/cc-switch.

Run (this tree on d74754970, then again where named after a rebase on
589e4ba6d, which touches none of these files):
- mote: go test -count=1 ./internal/ccswitchlink ./internal/cli
  ./internal/gui ok; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build ok; gofmt -l empty.
- wsl-run (magpie-desktop) and win-run (xiaomi-gpu): go test -count=1
  -v ./internal/ccswitchlink ok (Windows writes a test key of its own,
  Software\Classes\magpie-test-ccswitch-<pid>, removed after).
- Full suite on mica (go test -count=1 -timeout 45m ./..., on
  d74754970): 101 packages ok; reds, all filed and none in a package this
  touches: internal/dirent's watch tests (#7031; red alone on a fresh
  origin/main 589e4ba6d too), TestGatewayModeListsNoOwnSessions (#7064)
  and TestWSLStoppedDistroKept (#7071), both ok alone on mica.
- After the rebase on 589e4ba6d: go vet ./..., GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go build, gofmt -l on mote ok;
  ./internal/ccswitchlink and ./internal/gui ok on mote; ./internal/cli
  ok on mica. On mote three cli tests reach the 127.0.0.1:3425 an ssh
  port forward holds there (#6223).
- Real, macOS (mote, in ~/runs, cleaned up with lsregister -u): a test
  bundle registered with the old ccswitch claim kept it 5s after its
  Info.plist was rewritten without it; the built Forward then opened
  the real CC Switch v4.0.35 app and the dump showed the claim gone.
  Without CC Switch registered it returned ErrNotInstalled.
- Real, Linux (magpie-desktop, sandbox HOME and XDG dirs): with
  magpie-ccswitch.desktop as the real xdg-mime default, Forward ran
  cc-switch-handler.desktop's Exec with the link and the default was
  cc-switch-handler.desktop after.
- Broken by hand: no lsregister call (darwin), no xdg-mime default
  (linux) and no handBack (windows) each turned their test red.
- GUI suite: not run; no page, app.js or i18n change.

Not tried: a real CC Switch install on Windows (the box's real HKCU
ccswitch key is left alone; the test uses its own key), and a real
CC Switch .deb or AppImage on Linux (its entry was faked with the
package's own bytes).
2026-11-18 20:07:09 +08:00
yetone c5cb1c0588 gui: the tray's logo is 16pt, as large as other apps' menu bar icons
qingnianxiaozhe on X: magpie's A\ in the menu bar looked a size smaller
than another app's A\ beside it. magpie fitted each logo to a 14pt box,
so the A\ (about 1.37:1) drew 14x10pt. Claude.app's menu bar template
(TrayIconTemplate@2x.png, 48x48 px) has 32x32 px of ink, a 16pt glyph,
and in the reporter's screenshot the other A\ is 32x22 px against
magpie's 28x20 px at 2x. mpLogo is now 16; the letter in a ring (a logo
that can't be read) grows with it. The two 10pt rows of percentages are
unchanged and still fit the 22pt bar.

Tests: the logo boxes in the tray tests follow the 16pt box (offsets 28
-> 32, 34 -> 38 px at 2x); TestTrayImageLogoSizes now wants 27-33 px of
a 32 px box.

Run on mote (macOS 27.2):
- go test ./internal/gui -run Tray -count=1 -v: ok.
- Broken by hand (mpLogo back to 14): TestTrayImageLogoSizes FAILs
  ("alma spans 24 px of a 32 px box", codex/zcode/workbuddy 26 px) and
  TestTrayImagePlain FAILs ("238 px with logos, 182 without").
- Rendered by the real drawing code (trayImagePNG, 22pt bar at 2x)
  next to Claude.app's own template icon: the A\ is 28 px wide before
  and 32x24 px of ink after, as wide as Claude's 32 px spark; the
  percentages are the same text at the same size. The before/after
  strips are kept outside the repo (tray-toolbar-scratch/before and
  after/strip-{light,dark}.png).
Suite and checks, on mote at aa31e737c8d271455865615fafdf512e09073663 (this commit and its pair, the
tray logo size / the toolbar menu):
- go test -count=1 -timeout 45m ./... in a sandbox HOME, caches pinned:
  exit 0, 103 packages ok, none FAIL (internal/gateway 1633s,
  internal/agent 949s, internal/provider 470s, internal/gui 295s).
- gofmt -l internal/gui: nothing. go vet ./..., GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build: all ok.
- No GUI asset changed, so the Playwright suite wasn't run.
After a rebase onto 42c43c002 (Antigravity sessions, internal/gui
sessions reads; no file in common), at the pushed head:
go vet, GOOS=windows and GOOS=linux -tags nogui go vet of ./internal/gui/...
and go test -count=1 ./internal/gui/...: ok.
Then rebased onto f7e0f68ca (Codex instructions, internal/provider
only), not run again.

Not tried: a screen screenshot of the real menu bar (no Screen
Recording permission over ssh on mote; the image is the one the app
hands NSStatusItem); the reporter's notch Mac, where the bar is 24pt.
2026-11-18 16:08:15 +08:00
yetone add1e75ee3 gui: no Icon and Text menu on a right-click by the traffic lights
AlanWang1027713 on X: a right-click on the main window's title bar, by
the lights, offered "Icon and Text / Icon Only / Text Only". It comes
from the empty NSToolbar that MacTitleBarHiddenInset puts there to
inset the lights; NSThemeFrame's menuForEvent: lists its display modes.
insetLights takes the toolbar away only in the macOS 26 design, so on
macOS 27, with an older SDK and in a right-to-left layout the toolbar,
and its menu, stayed.

quietToolbar turns the menu off where the toolbar stays:
allowsDisplayModeCustomization = NO (macOS 15+), and AppKit's own
_setWantsToolbarContextMenu: NO for macOS 12-14, each looked up with
respondsToSelector, since the SDK that builds magpie may be older than
the system it runs on. Nothing about the title bar's shape changes.

windowshape.Of now reads the menu a right-click 20pt below the top,
120pt in, gets from the window frame (TitlebarMenu), and
TestMainWindowCorners and TestMainWindowRightToLeft fail when the main
window gets one, or when the reference toolbar window doesn't (so the
probe is proven to see it).

Run on mote (macOS 27.2), real makeMain window:
- go test ./internal/gui -run 'TestMainWindowCorners|TestMainWindowRightToLeft'
  -count=1 -v: ok. Each stage logs "title bar menu []" next to the
  reference toolbar window's ["Icon and Text" "Icon Only" "Text Only" "-"]
  (macOS 26 SDK) and ["-"] (macOS 15 SDK). Lights [[26 26] [49 26] [72 26]],
  66pt title bar and 16pt corners with the 26 SDK, [[19 19] [39 19]
  [59 19]] and 38pt with the 15 SDK: the same as without the change.
- Broken by hand (quietToolbar call taken out): both FAIL, "a right-click
  on the title bar gets a menu: ["Icon and Text" "Icon Only" "Text Only"
  "-"]" (26 SDK) and ["-"] (15 SDK).
- A probe app on mote: either switch alone empties the frame's menu.
Suite and checks, on mote at aa31e737c8d271455865615fafdf512e09073663 (this commit and its pair, the
tray logo size / the toolbar menu):
- go test -count=1 -timeout 45m ./... in a sandbox HOME, caches pinned:
  exit 0, 103 packages ok, none FAIL (internal/gateway 1633s,
  internal/agent 949s, internal/provider 470s, internal/gui 295s).
- gofmt -l internal/gui: nothing. go vet ./..., GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build: all ok.
- No GUI asset changed, so the Playwright suite wasn't run.
After a rebase onto 42c43c002 (Antigravity sessions, internal/gui
sessions reads; no file in common), at the pushed head:
go vet, GOOS=windows and GOOS=linux -tags nogui go vet of ./internal/gui/...
and go test -count=1 ./internal/gui/...: ok.
Then rebased onto f7e0f68ca (Codex instructions, internal/provider
only), not run again.

Not tried: a screen screenshot (screencapture over ssh has no Screen
Recording permission on mote; the menu is read from AppKit instead);
macOS 12-14, where only the private selector applies.
2026-11-18 16:08:15 +08:00
yetone cb1fe6d5d9 gui: Get started put away comes back from Settings › General
Once the Agents page's Get started card was hidden (POST
/api/settings/guide {hidden:true}) nothing in the app brought it back.
Hiding it now says where it comes back ("Get started hidden; Settings ›
General brings it back"), and General has a Get started row with Show,
only while the card is hidden and would otherwise show (setup not done,
not gateway mode). Show posts {hidden:false}, redraws the Agents page and
says so; the row goes. The row lives in guideback.js, imported by
navpages.js beside the sidebar's pages, so the core grows by one status
line. Settings' search finds it by its name.

Run (mote, at this tree):
- getting-started, nav-pages-hidden, nav-pages-order, settings-general,
  settings-search, i18n-keys, gui-de, Chromium and WebKit, every
  language: 117 tests, all pass after the fake server answered
  /api/settings with the guide flag as the real one does.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand, each red, then put back:
- renderNavPages not calling guideBack: getting-started 20 of 60 red
  (the row never shows).
- the hide's status line removed: getting-started 30 of 60 red.

Not tried: the real app window.
2026-11-18 13:46:51 +08:00
yetone de321cc92e gui: Settings' search finds by a part's name, unfolds an Advanced around a hit, and reaches the settings sheets build
Three gaps in Settings' search (the UI/UX scan's item 12):
- every part matched its tab's id too, so "usage" brought all of
  Allowances (id usage), rows that never say it included. A part is now
  found by its name; Observability still answers to "otel".
- a hit under a folded Advanced (Network and sharing's Name) stayed
  folded, so the part showed with nothing in it to see. It is unfolded
  while the search lasts and folded again when it ends (setFolds, in the
  lazy provlinks.js, so the core grows by two calls).
- what an agent's sheet or the Claude editor draws only when opened
  wasn't in the page to be found: Claude Code's prompt cache (main and
  subagents), its commit signature (Co-Authored-By), an agent's own
  fields (permission mode) and the Claude editor's run mode (claude -p).
  Each has a link row now, in the agent's or provider's name; Open opens
  the sheet or editor and lights the row, again if the editor draws it
  anew once the provider list is in (lightWhen).

docs/subsystems/gui-shell.md says so.

Run (mote, at this tree, rebased on origin/main 98355866f):
- settings-search-reach (new), settings-search, provider-prefs,
  provider-prefs-layout, settings-groups, settings-back,
  settings-tabs-stick, settings-hints, i18n-keys, gui-de, claude-mode,
  claude-cache, claude-attribution, claude-permission-mode,
  claude-lean-prompt-setting, claude-extra-usage-setting, agent-prefs,
  sync-own-fields, update-row-steady, win-caption; Chromium and WebKit,
  every language: 349 of 355 pass. The 6 red are settings-groups' "warm-ups
  and check-in" (an extra "Spend extra usage" row), red the same on
  origin/main 98355866f and filed as #6597.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS':
  ok, no budget raised.

Broken by hand, each red in both engines and every language (12 of 12),
then put back:
- the old code (origin/main): "usage" brings Menu bar cost.
- the tab's id put back in a part's words: the same.
- setFolds' unfold removed: "its Advanced unfolded".
- the fold-back on clear removed: "folded again after the search".
- sheetLinks not called: "Co-Authored" finds nothing.
- the run mode's link left out: "claude -p" finds nothing.
- lightWhen lighting only its first find: the editor's run-mode row is
  never lit (the editor draws it anew).

Not tried: the real app window; agents other than Claude Code with own
fields (the rows come from the same a.own list).
2026-11-18 13:16:18 +08:00
yetone 74bba1fa67 gui: Settings › Version and the tray restart magpie with no update (yansheng1003 on X)
yansheng1003 asked for a Restart beside Check: "每次改了需要重新magpie,
都要自己退出再启动麻烦". The Version row now has Restart after Check
while no update is on offer (found, downloading, downloaded, blocked, a
newer version named or a failed download each have their own buttons,
which restart through the update and fill a 420px row), and the tray's
Restart magpie is always shown:
with an update ready it installs it as before, with none it starts this
magpie again as it is.

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

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

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

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

Not tried: the tray item and a restart in the real macOS, Windows and
Linux apps (only magpie web was restarted for real).
2026-11-18 12:58:38 +08:00
yetone b0c2b5e261 gui: a page left out of the sidebar still opens from a link, ?view= or a search hit
Settings › General › Sidebar pages (magpie.navHidden) took a page out of
the sidebar, and offView then sent every way to it (a link, ?view=, a
Settings search hit, a plugin's show()) to Agents or Providers with
nothing said, so the page was unreachable. offView now redirects only a
page gateway mode or a switched-off built-in plugin leaves out. Hiding
stays a sidebar choice: the window's own kept page (magpie.lastView)
isn't reopened when it is hidden, so a fresh window still opens on the
first page, or Providers when Agents is hidden too (keptView in
start.js).

nav-pages-hidden: with Library hidden, show("library") and ?view=library
open Library; a kept lastView of library opens Providers.

Run (mica, at this tree; mote at load 27):
- nav-pages-hidden, nav-pages-order, last-page, gateway-mode, Chromium
  and WebKit: 19 pass, 1 red, last-page WebKit, red the same on
  origin/main and filed (#7033).
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand, each red, then put back:
- the new test on origin/main's app.js and start.js: 2 of 2 red (line
  69, Library not opened), both engines.
- keptView without the navMine check: Chromium red at line 76 (the
  window reopened the hidden page).

Not tried: the real app window, the full GUI suite.
2026-11-18 12:31:23 +08:00
yetone 169446a1d7 gui: the Mac's menu bar item takes its clicks from the start, so the first click after a restart keeps the panel open (Refeccd on Discord)
Refeccd on Discord: "每次更新后,第一次在菜单栏点击唤起主界面会出现闪退现象
(实际程序未退出,只是隐藏了)" (macOS, automatic updates).

Cause: 182803ea7 made the panel lazily, on its first open, and
trayOwnClicks (mpOwnClicks, the local monitor that sends the item's
action on mouse-down and drops the event) was installed in makePanel.
So the first click after every start went through the button's own
mouse-down tracking: the panel came up, the tracking loop took focus
back, and HideOnFocusLost hid it at once. Later clicks were fine,
because by then the monitor was in. Every update restarts magpie, so
it showed after each one.

Now trayOwnClicks runs right after the tray item is made, in app.go,
before any click can arrive; makePanel no longer installs it (the
monitor is dispatch_once, so nothing is installed twice).

Run (mica):
- go test -count=1 ./internal/gui/: ok (153.7s).
- Quick tests, go vet (darwin, GOOS=windows, GOOS=linux -tags nogui)
  on mote: ok; gofmt -l clean.
- TestTrayOwnsClicksBeforeThePanel is red with the call moved back
  into makePanel (broken by hand), green with the fix.

Not tried: a real tray click after a restart (no click can be driven
over ssh); the reporter's case is reasoned from the code path above.
2026-11-18 03:34:06 +08:00
yetone 05d46f42e5 gui: Claude's menu bar cards can show Anthropic's A\ mark (qingnianxiaozhe on X)
qingnianxiaozhe asked for Anthropic's A\ in the menu bar in place of
Claude's logo. Settings › Usage › Menu bar Claude logo (Mac only, shown
while logos are on and a ticked card is Claude's, under the magpie icon
row) picks Claude's logo
(the default, unchanged) or the A\.

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

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

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

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

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

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

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

Run, at this commit on dbbb2f26b plus 9d5d8baf2 (the site index):
- go test ./... -count=1 -timeout 45m on Linux (WSL magpie-desktop, Go
  1.26.8), at the tree before the boot.js move: 99 packages ok,
  internal/gateway included (959s); ., internal/cli and internal/gui
  don't build there without GTK headers. On mica (macOS): . and
  internal/cli ok; internal/gui/... ok at this commit, after the two
  reds that run found (the core budget, the keep test) were fixed.
- go vet and GOOS=linux -tags nogui / GOOS=windows go vet of
  internal/gui and internal/settings, earlier the whole tree on all
  three: ok. gofmt -l clean.
- site: node --test *.test.mjs, 132/132.
- GUI: the 135 files the change reaches (settings, network, LAN, i18n,
  old-webkit, core budget) on mica: 16 files had reds. Run again on this
  tree and on its base, the same tests are red on both (allow-ips
  #4357, settings-hints #6107/#6353, lan-join #6353, i18n-keys #6877,
  old-webkit #6030/#5919 and the rest of the 16) but two:
  search-mcp-library (WebKit, #4756) and gateway-pause (WebKit de 420px,
  #6684), red only beside other files: alone, 0 of 10 and 0 of 3 red on
  both trees.
2026-11-17 03:11:31 +08:00
yetone 34606000da gui: the tray panel's Usage tab ends in a heatmap of recent weeks (eiyuuzaki2333 on X)
Asked for "a heatmap like GitHub's / Codex's, also in the tray". The
window already has one (Usage › Requests, 53 weeks, #1369), so no second
copy goes on the Overview, which counts gateway calls only while the
heatmap counts session-file calls too. The tray panel had none.

The panel's Usage tab now ends in a card of the recent weeks, one cell a
day, Monday on top, as many weeks as the card fits (8 to 53: about 25 at
the panel's 440, 17 at 320). It goes after the chart and ranking, so
nothing above it moves. Its shades are the existing monochrome accent
ramp (.l0 to .l4) and follow the tab's own Tokens / Cost / Requests
switch, with no new read; a provider or computer picked above narrows it.
A tooltip says the day and its tokens, requests and cost. Weeks with no
call show no card. No animation.

It reads the existing cached /api/usage/heatmap, at most once a minute
and again when a pick changes; the tab's own 10 s reads don't wait for
it, and no endpoint was added. The card, its reads and tooltip live in
plugins/usage/page.js, which shares its grid (heatGridOf, taken out of
drawLedHeat as it was) and tooltip (ledHeatTip, now told the metric and
provider) with the Requests tab. app.js keeps one guarded call in
renderPanelUse: the ledger read can come back before page.js has run, so
page.js draws the tab again when it loads. Both script budgets hold it
at this base with no raise. The card
is .pu-heat, not .pu-card, so the chart's card stays the tab's one
.pu-card. The panel's light pills are its card's white, so a quiet day
there is a 7% shade of the text over the card.

Run (rebased on origin/main 2896e82cc):
- panel-heatmap.test.cjs (new), Chromium and WebKit, en zh zh-TW ja de,
  440 light and 320 dark: 12 of 12, 3 runs on mote. Red 12 of 12 with
  MAGPIE_ASSETS at origin/main's assets.
- Affected files (usage-heatmap, panel-usage, panel-usage-models,
  panel-usage-first-account, panel-currency-provider, panel-units-follow,
  number-units, usage-chart-axis, usage-head-steady, usage-phone-head,
  i18n-keys, phone-no-sideways) and TestCoreScriptBudget: green but
  phone-no-sideways de 375, the same with origin/main's assets (#5869).
- At 2896e82cc again: panel-heatmap, panel-usage, panel-usage-models,
  usage-heatmap, panel-usage-first-account green; i18n-keys red on a
  routing-plugin phrase 2896e82cc's claude_image_budget_test.go added,
  red on origin/main alone (#6877).
- Whole GUI suite on mica at 91b3af847 (concurrency 4): not finished.
  The runner exited 7 with no message twice (after ~2231 and ~2371
  tests); the third part, grip-inset on, is still running, ~10,900
  tests in. None of the red files is touched by this change. Under the
  whole-suite load (#6709, #6782), with their issues:
  agent-details-ready #6369 #6373, agent-switch-accounts #5925,
  claude-quota-onboarding #6179, bark #6543, api-key-theme #6444,
  aside-native #6212, agent-menu-label #6371, allow-ips #4959,
  account-refresh-holds #6003, account-arrange #6010, desktop-tiers
  #6475, quota-refresh-order #6180, provider-max-output and
  provider-many-keys #6209, rest-try-now and key-switch #6232,
  provider-fetch-again, provider-typed, provider-picks-stay,
  provider-models-rest and menu-scroll #6532, omp-roles #6432,
  recovered-file #4320, quota-bars-alike #6700, login-export #6628,
  gateway-key-arrange #6268, first-untick #6660, editor-hints #6156,
  connect-address-kept #6755, recent-call-bodies #6665, quota-credits
  #6807, models-works-only #4391, codex-memories-settings #6372,
  panel-options-fold #6794, reset-providers #6196, quota-curve #6789,
  model-copy-id #4621, modal-backdrop #6663, loop-guard-setting #6662,
  lightweight #6340, keychain-retry #6661, key-replace #3476,
  key-balance-card #6414, gateway-pause #6684, duplicate-pause and
  key-box-once #6424, codex-async-compact #6658, name-suffix-remote
  #5147, menu-input-scroll #3402, rollup-short #6560, remote-magpie
  #6099, plugin-signin-no-url #5938, plugin-signed-out-account #5998,
  plugin-page-foreign-error #6117, plugin-option-placement #6559,
  phone-no-sideways #5869, partners #6664, panel-fold #5796, omarchy
  #4624, old-webkit #6030, model-api-preset #5838, mobile-web #6790,
  library-open-again #6751, key-import #6416, grip-inset #6293,
  fast-ultra and fast-pick #6201, ctx-session-line #5801, context-cap
  #6514, codex-auto-reset #6232, panel-usage-first-account #6181
  (green alone at this head), lan-join #6353, icon-tile #6759,
  model-chip-steady, header-centre, last-page, nav-timeout,
  plugin-card-update #6709. With no issue before, filed as #6876:
  data-folder, plugin-move-unserved, name-suffix-where-named,
  group-editor-selected, found-skill-pick-remove, quota-count-wrap,
  nav-sub-fold, model-suffix-own, account-models,
  account-models-available.
- Looked at screenshots of the panel at 440 and 320, light and dark, en
  zh de ja, with the tooltip shown.

Not tried: the real app's tray panel on macOS, Windows or Linux
webviews, real accounts' usage.
2026-11-16 20:58:35 +08:00
yetone 187d067241 gui: a page's row in Sidebar pages is dragged by a finger too (chet030714 on X)
v0.1.4296's page order "根本拖不动" on a phone. Reproduced in Chromium
with real touch input (CDP Input.dispatchTouchEvent, 390px, hasTouch,
isMobile): the press on the grip went pointerdown, pointermove,
lostpointercapture, and the drag ended before it began. A finger (and a
pen, where the browser does so) is captured by what it pressed, here the
grip span inside the row; dragRows then takes the capture on the row,
the grip loses it, and its lostpointercapture bubbled to the row's
listener in dragListen, which cancelled the drag. A mouse has no
implicit capture, which is why the mouse test and the desktop app were
fine (mouse drags passed in Chromium and WebKit, 1100px and 390px).

dragListen now cancels only on the handle's own lostpointercapture. The
fix is in the shared listener, so every dragRows/dragCards whose handle
holds a child (the accounts' rows, a model's rows, plugin pages) gets it.
On a coarse pointer the grip is 40px wide instead of 26, a finger's
target. Alt+Up/Down is unchanged. No new motion: the rows' existing
0.16s strong ease-out shift (none under reduced motion) is what a finger
drag shows. The listener's lines were written shorter so app.js stays
under its budget (4 bytes of room left), no raise.

Run:
- nav-pages-order.test.cjs: a finger drag (CDP touch) and a pen drag
  (CDP pointerType pen) on the phone's menu, Chromium; WebKit checks the
  grip shows. 10/10 (Chromium, WebKit x en/zh/zh-TW/ja/de) on mica.
  Red on origin/main 269e54de5's app.js: "a finger dragged Masking up",
  chromium en and zh (2/2). The pen step passes on the old code too
  (Chromium's CDP pen isn't implicitly captured), so it guards nothing
  old, only the path.
- The drag GUI files (account-arrange, agent-grip, codex-model-order,
  drag-rows-shift, gateway-key-arrange, group-arrange, group-member-drag,
  group-member-row-drag, panel-arrange, plugin-page-arrange,
  provider-order, routing-rule-drag, usage-arrange, usage-drag,
  tap-lost-click, tap-inverted, tap-click, search-order, nav-pages-order)
  on mica: 196 pass / 12 fail. The 12 are account-arrange (53 !== 52,
  #6010) and gateway-key-arrange 420px (#6268); both fail the same 12 at
  origin/main 269e54de5's assets.
- go test ./internal/gui/ on mote: ok (TestCoreScriptBudget included).

Not tried: a real phone (iOS Safari, Android Chrome); WebKit touch,
which Playwright can't send; a real pen; the Wails windows.
2026-11-16 17:03:53 +08:00
yetone 269e54de5f gui: an update restart nobody clicked comes back in the tray alone (eating_dream on X)
eating_dream on X (v0.1.4303, macOS, Restart automatically on, a check
every half hour, prerelease channel): after each automatic update the
main window came back over what they were doing. A restart by itself
brought the window back when it was up (#2096), and minimised when it
was (#3495).

Now every restart nobody clicked comes back with the tray icon alone, on
every system, the window closed even when it was up. That covers
Settings' AutoRestart, `magpie update` from a terminal, a Remote
magpie's ask, and another copy replacing this binary. The restart path
is restartBySelf, which updates.autoRestart calls. It still takes no
focus and the Mac's Dock icon joins without coming to the front
(quiet_restart.go). A restart the user clicked (the pill, Settings, the
tray) opens the window as it was. No new setting.

restartInto loses its minimised parameter, and markQuietRestart writes
the seconds alone. An older version restarting into this one still asks
for its window and may write "<seconds> minimised", so the reading side
(takeQuietRestart, quietMinimised, showMinimised) stays. host.mainUp
had no caller left, so it moved into the Windows test that reads it.

Tests:
- New TestRestartBySelfComesBackToTheTray: by itself asks for no
  window, clicked asks for it.
- TestRestartBySelfComesBackQuietly now checks restartBySelf's mark and
  reads an older version's minimised mark (markOldQuietRestart, which
  the Windows minimised and quiet tests use too).

Run, at fd407bc99 + this change:
- mote-run:
  - go test ./internal/gui -count=1 -timeout 45m: ok
  - go vet ./internal/gui, GOOS=windows go vet ./internal/gui,
    GOOS=linux go vet -tags nogui ./internal/gui: clean
  - gofmt -l: clean
- Broken by hand: restartBySelf asking for the window (the old
  behaviour with it up) fails "windows asked for [true true], want
  [false true]". The old code read the window through a live Wails
  window, so the test can't run against it as it was.
- win-run go test ./internal/gui -run 'Quiet|BySelf|Minimised|RestartBy':
  ok. TestRestartMinimisedComesBackMinimised and
  TestRestartBySelfAsksNoAttention skip over ssh (session 0).
- wsl-run go test -tags nogui ./internal/gui -run 'Quiet|BySelf|Beside': ok

Not tried: a real automatic restart of the app on any system, and the
Windows desktop tests in the signed-in session. The first update into
this version is still made by the old one, which brings the window
back once.

Docs: gui-shell.md, restart by itself.
2026-11-16 16:37:40 +08:00
yetone e0f9218f91 update: Restart to update goes into the newest version out, not an older download (char1es_lu on X)
char1es_lu on X: Restart to update put in a version downloaded a while
ago, and right after the restart magpie offered an update again. Since
b05a525a3 (0.1.4051) a restart never asked the feed while a copy was
downloaded and waiting (keepsStaged). The clock's check runs every half
hour or more and magpie releases many times a day, so that copy was
often a release or more behind.

Every restart now asks the feed first (recheck, a check marked
restarting). This covers the page's Restart to update, the tray's, and
the restart AutoRestart or a click waits for. If a newer version is out
it is downloaded in place of the waiting copy, and the restart goes
into it once it is in. A restart waiting for an idle gateway takes it
too: run's waiting rule doesn't apply to the restart's own check. The
clock's check during that wait still keeps the waiting copy.

The feed is still not asked in two cases:
- The copy was downloaded by a restart's own check, or that check found
  it to be the newest (restartGot). The header's Update restarts once a
  click's download is in, and asking again there was elis_pina's loop of
  downloads that never restarted. This also stops a feed slower than
  recheck's wait from asking on every poll.
- Downloads wait for a click (NoAutoDownload). The copy clicked for is
  what goes in (sakamotokurome, iiiiiimone on X).

The update dialog's freshen still names the waiting copy (keep).

Trade-off: a click may now wait for a download (canlee886's earlier
complaint). The header's Update and the tray restart by themselves once
it is in. Settings' Version card shows the download and needs a second
click, which restarts without asking again. Making the card follow by
itself needs app.js bytes, and its budget has no room (tried: 337 over).

Tests:
- TestRestartTakesTheNewestOut replaces TestRestartTakesTheDownloadWaiting.
  With a fake feed it steps 0.1.11 waiting, 0.1.12 out, through the
  page's click, the restart once it is in (0.1.13 out, feed not asked),
  the tray (0.1.14), AutoRestart's wait (0.1.16) and the dialog.
- TestUpdateStagedGivesWayToNewer now checks that a restart's recheck
  takes 0.1.13 with downloads automatic, and keeps 0.1.11 on a click.
- The recheck lines in TestUpdateClockFetchesNewerThanWaiting asserted
  the old rule and are gone.

Run (mote-run, at 9c4e87736 + this change):
- go test ./internal/gui ./internal/update -count=1 -timeout 45m: ok, ok
- gofmt -l internal/: clean
- On the old update.go, TestRestartTakesTheNewestOut and
  TestUpdateStagedGivesWayToNewer fail: "the page's click ... Latest:0.1.11,
  1 downloads, want 0.1.12 after 2".
- Broken by hand:
  - Without restartGot set: "the restart once it is in: Latest:0.1.13,
    the feed asked 1 times".
  - With run's old waiting rule: "AutoRestart restarted into 0.1.15,
    want 0.1.16".

Docs: gui-shell.md "When an update downloads" and reference.md.
Not tried: a real release feed and real app restart; the fake feed
covers the updater only.
2026-11-16 16:37:40 +08:00
yetone b010fba05b gui: the pages go in the reader's own order, in the sidebar and a phone's tab bar (chet030714 on X)
Settings › General › Sidebar pages, where pages are hidden, now also puts
them in order: a row is dragged by its grip (shown on hover, always on a
touch screen), or moved with Alt+↑/↓. The order is kept for this browser in
localStorage magpie.navOrder, beside magpie.navHidden. The sidebar and the
header's tabs follow it at once, and a phone's tab bar (phonetabs.js)
shows the first four with the rest under More. Providers is listed (it can
be moved, never hidden). While the order isn't the home one the sidebar's
group names (Work, Models, ...) are left out, since a reordered list breaks
the groups; Default order (shown only then) removes the key and puts the
pages and their names back. A page the kept order doesn't name (new in an
update) goes after the page it follows at home. Plugin pages keep their
place in their group. A reader who never reorders sees nothing change.

navOrder and navArrange live in the new navorder.js, imported by navHides
only once an order is kept (and by navpages.js with the menu), so what is
left in app.js is that one line: +107 on both core budgets, explained there.
old-webkit's list of on-demand scripts names navorder.js.

Built on the unpushed WIP 10b9ee22c (page-order worktree), cherry-picked
onto origin/main; the WIP test clicked the aria-disabled Providers row
without force, and its reload checks now wait for the async import.

Run:
- nav-pages-order.test.cjs (new): Chromium and WebKit, en/zh/zh-TW/ja/de,
  10/10 pass. Red on origin/main (no menu opens), 5/5 chromium.
- The whole GUI suite (make test-ui) on mote at the first, inline version
  (navArrange ran on every start; the final version runs nothing new for
  a reader with no order), stopped after 4,171 ok / 171 not ok, none in a
  nav, sidebar or phone file. Five of the red files (agent-switch-accounts,
  gateway-key-arrange, first-untick, data-folder, api-key-theme) rerun on
  mica at this tree and at origin/main c1ab9a494: 34 pass / 56 fail on both.
- At the final tree on mica: every nav*, phone*, side*, sidebar*, i18n*,
  last-page, menu-scroll*, settings-search and old-webkit file:
  377 pass / 42 fail; the reds (menu-scroll, nav-timeout,
  phone-no-sideways, side-effort, old-webkit) fail the same at origin/main
  c1ab9a494, and last-page webkit's (two requests cut off counted as page
  errors, #5972's kind) passed 3 of 3 alone; go test ./internal/gui/...: ok.
  old-webkit's two reds are #6570/#6030 (navpages.js, headerpresets.js
  missing from its list) and #5919, the same on origin/main.

Not tried: a finger drag on a real phone (the test taps the menu and
checks the grip shows; the drag is the mouse path dragRows shares), and
the real app's window (Wails); the GUI tests load the real assets.
2026-11-16 14:06:03 +08:00
yetone 023a563735 install: the Windows install dialog says the download can be deleted
@jiangshangmuyun on X updated on Windows and found a new magpie while
"the original is still there". That is by design since 14807bcf2: a
magpie-windows-amd64.exe kept in a folder of the user's own is asked
about and installed to <folder>\magpie\magpie.exe, a copy, and the
download is left where it was. Nothing said it could go.

Now the install dialog (installDialog, Windows' task dialog) has a
footer naming the exe it was opened from: "Once magpie is installed,
you can delete D:\Tools\magpie-windows-amd64.exe." It is in each
language the dialog speaks (en, zh, zh-TW, ja, de), and stays under a
refusal too. The file is never deleted by magpie; only the words are
new. The footer is TASKDIALOGCONFIG's pszFooter (offset 132 in the
packed 64-bit layout), left empty when the exe can't be told.

Tests: TestInstallDialogSaysTheDownloadCanGo (every language names
the exe once, no format error; none without an exe). Broken by hand:
zh's text without %s goes red with %!(EXTRA ...).

Run: go test ./internal/gui/ ./internal/update/ on mote (ok) and on
the Windows box: the new and existing install tests ok; 11 reds there
(TestGatewayHeldByAContainer, the four %AppData% import rows,
TestProviderSaveClientCert, TestPageAwayLetsStatsGo,
TestPluginAgentMissingSaysSo, TestGatewayModeStatsNameTheGatewaySessions,
TestUpdateThatWontStart, TestPackagedByDpkg) fail the same at a fresh
origin/main 9dcec6751 and are open (#6068, #4603, #6810, #5928, #6059); GOOS=windows go vet (amd64, arm64) of
internal/gui and internal/update on mote; gofmt -l clean. Real dialog:
a throwaway test (not committed) opened taskDialog on xiaomi-gpu's
console session with comctl32 6 and read it back through UI
Automation, en and zh: the footer is there under the buttons, full
path included.

Not run: a Linux go vet of internal/gui (the box has no gtk4/webkit
headers; installdir.go is pure Go and compiles on darwin). Not tried:
the real installed app's first start from D:\, or a screenshot of the
dialog (the console renders black over SSH-started captures).
2026-11-16 11:51:12 +08:00
yetone c6a67dd412 gui: the Windows main window is resized from its edges again (Puremilk_chun on X)
Since 0.1.4274 (dd77094ca) the main window on Windows is frameless, and
Puremilk_chun on X couldn't resize it. Wails' frameless window answers
WM_NCCALCSIZE with the whole window as the page, so Windows has no
resize border left: the invisible band outside a window's edge, where
Windows 11 users grab it, answered HTNOWHERE, and only Wails' 4px band
inside the page resized, which on the right lies under the page's
10px scrollbar (.view is overflow-y: scroll) and did nothing.

mainFrameCalc (mainframe_windows.go), asked first by appWndProc for
the main window alone, lets DefWindowProc work out the frame as for a
framed window and then puts the page's top back at the window's top.
The left, right and bottom are Windows' own resize border again; the
header is still the title bar, with the caption buttons, the shadow,
the rounded corners and snap as dd77094ca made them; the top is resized
by Wails' band. Maximised or in full screen Wails sizes the window as
before. keepResizeFrame names the window on Wails' runtime ready (the
first main window is made before the main loop runs) and has Windows
work the frame out again. gui-shell.md says so.

Run (at this tree, rebased on origin/main 3b643f397):
- gofmt -l clean. mote: GOOS=windows go vet ./internal/gui, go vet
  ./internal/gui, go test -count=1 ./internal/gui: ok.
- xiaomi-gpu (win-run): go test -count=1 ./internal/gui: TestMainWindowKeepsResizeBorder
  ok; 10 reds, all red the same at origin/main 3b643f397 run by name on
  the same box: TestPageAwayLetsStatsGo (filed #6810), the other nine in
  #6068, #5324, #5928 and #6059.
  WSL magpie-desktop: go vet -tags gtk3 ./internal/gui: ok.
- TestMainWindowKeepsResizeBorder (Windows): a real window answering
  as Wails' frameless one; the main window's left, right, bottom and
  bottom-right hit HTLEFT/HTRIGHT/HTBOTTOM/HTBOTTOMRIGHT, its page
  starts at the window's top, maximised the page is the whole window,
  and another window is left alone.
- Windows 11 on xiaomi-gpu, 100% scale, sandbox USERPROFILE, port
  3481, a real mouse (mouse_event) on each edge and corner, 2px inside
  and 3px outside, the window placed at 200,133 1000x640:
  - 0.1.4281: outside every edge hits 0 and nothing moves; inside, the
    right edge and bottom-right do nothing (the scrollbar takes the
    press, no mousemove reaches drag.ts), the others resize.
  - this tree: outside, right/left/bottom/br/bl hit 11/10/15/17/16 and
    resize 60px; inside as 4281; the header drags the window; the
    maximise button maximises to the work area and restore brings back
    the same rect; a screenshot shows the header at the top edge with
    the caption buttons, the border and the shadow.

Broken by hand: with mainFrameCalc answering false,
TestMainWindowKeepsResizeBorder is red (left/right/bottom/br hit 1,
"the page starts at the window's left edge").

Not tried: 150% scale (changing the display's scale would move other
sessions' windows on that box); snap (WS_THICKFRAME and the styles are
unchanged); the inside band under the scrollbar on the right is left
as it was, the outside border now covers that edge.

Rebased on f64c7e54f (routing, provider and a gui-shell.md paragraph
elsewhere): on xiaomi-gpu TestMainWindowKeepsResizeBorder ok; on mica
gofmt, GOOS=windows go vet and go vet ./internal/gui ok.
2026-11-16 10:50:49 +08:00
yetone b34243823e routing: accounts' resets stay in their column, and resizing over many accounts is smooth (lexrus on X)
lexrus on X: on Routing's Accounts and keys, at some widths "resets in
3h" ran over the next column and the right column's words were cut, and
with many accounts dragging the window's edge was janky.

Overlap: the window parts' widths (--wk/--wv/--wr) were taken from the
widest window of the whole list, so one provider's long reset pushed
every row past its column. They are now per provider, and CSS caps each
part to its row.

Jank: the list was CSS columns, and the browser balanced every row again
on each layout. packActs (plugins/routing/client.js) places each
provider's box (and a long box's rows) itself under .rt-acts.packed with
--px/--py: down a column and on into the next, ends as level as a binary
search on the cap allows, a heading never last in a column. It runs on
the window's resize, on render, and a frame after a box's height changes.
Side mode (min1150, beside the requests) is unchanged: one scrolled
column, nothing placed. Measured on mote with a 100-row fixture, per
resize step: WebKit layout 26.6ms -> 5.9ms, frame p90 35 -> 18ms;
Chromium layout 8.24ms -> 2.86ms.

Test: routing-account-windows-fit.test.cjs, 4 and 20 Codex accounts, en
and zh, Chromium and WebKit, widths 420-1600: no window part runs past
or is cut, a provider's lines start together, the list isn't CSS
columns, boxes sit inside the list in column order without overlapping,
2+ columns at 700-1099. Broken by hand: the old assets are red on the
overlap; packing turned off is red ("the list isn't CSS columns").
gui-shell.md says how the columns are placed.

Run on mote at this change on origin/main 7bdda0450 (pushed on
3b643f397, which changes internal/provider only):
- the 209 GUI files that open Routing or read its files, plus
  i18n-keys and builtins: 3736 pass, 42 fail. Every red is red the same
  on a clean origin/main 7bdda0450 copy, or is filed: quota-bars-alike
  (#6700), ctx-session-line (#5801), quota-credits (#6807, filed now),
  routing-pin-away (#6512), routing-row-swap (#3799),
  routing-story-shrinks (#3954), mobile-web (needs .git for its
  origin/main baseline; #3952, #5013). routing-idle-frame's one WebKit
  red came under load (#3773) and passed 2 of 2 alone at this head.
- go test ./internal/gui: ok. gofmt -l: clean (no Go changed).

Not tried: the real Wails app, Linux WebKitGTK, Windows WebView2, and
lexrus's own accounts.
2026-11-16 10:42:18 +08:00
yetone dd77094ca2 gui: on Windows the header is the window's title bar (258a14 on X)
With a wallpaper, Windows' main window had a white native title bar over
the page, cut off from it ("内容区域和标题栏有割裂感"). On Windows the main
window is now frameless (mainFrameless), as the Mac's header already is
the title bar: the page and its wallpaper run to the top edge. Wails v3's
frameless window keeps WS_OVERLAPPEDWINDOW, so the shadow, Windows 11's
rounded corners, snap (Win+arrows, drag to an edge) and Wails' resize
edges stay. The header draws minimise, maximise/restore and close at its
right (#wincap, wincap.js, imported in that window alone), Windows-sized
with Segoe Fluent Icons, in the theme's colour, Close red on hover
(.1s ease); the header's refresh and pin sit left of them and stay
no-drag. A double click on what drags the window maximises or restores
it. The app tells the page when the window is (un)maximised (captionJS),
which swaps the glyph and its tooltip and keeps Wails' resize edges off
while maximised so the corner pixel is Close's. The buttons stay over a
dialog's scrim (wincap.js undoes modalBackground's inert on them). The
Mac, Linux, the tray panel and the web page are unchanged.

TestCoreScriptBudget: +27 on both budgets for the one import line in
app.js, past the 29 bytes of room there were; the rest lives in
wincap.js and app.css.

Run (mote, at this tree on origin/main 256910f17):
- gofmt -l clean; go vet ./internal/gui, GOOS=windows go vet
  ./internal/gui, go test -count=1 ./internal/gui: ok.
- Linux: go vet -tags gtk3 ./internal/gui on WSL magpie-desktop: ok
  (at the tree before the rebase).
- GUI: win-caption (new), brand, header-centre, header-zoom-fit,
  i18n-keys, modal-backdrop, providers-withdrawn, text-size,
  sidebar-overlay-scrollbar, both engines, every language: 125 ok,
  7 red, all red on origin/main too: header-centre webkit (#3479),
  modal-backdrop Linux window/panel (#6663), text-size webkit (#6561).
- A 47-file run of every GUI file the header, modal or Windows path
  reaches (mica, before the rebase): the same reds plus mobile-web
  (no .git in a run copy, #5013) and sidebar-overlay-scrollbar de
  webkit once (#1863, commented).
- Whole GUI suite (mica, load ~99): started at the pre-rebase tree and
  synced to the rebased one mid-run, so it isn't a clean record. Its
  reds in 28+ files match main's: 10 of those files alone on mote give
  the same 121 of 218 red at origin/main 256910f17 and at this tree
  (#6709, commented).
- Windows 11 on xiaomi-gpu, built from this tree, sandbox USERPROFILE,
  port 3461: screenshots light/dark with and without a wallpaper, and
  maximised; double click on the bar maximises and restores, max/restore
  and min buttons work (IsIconic true after min), Win+Left snapped to
  half the screen, Win+Up/Down maximise and restore.

Broken by hand: win-caption is red on the old assets (5 of 5 cases);
without wincap.js's MutationObserver it is red 10 of 10 ("the caption
buttons aren't" inert); #457's +0.5 in fitTop turns header-zoom-fit red.

Not tried: Windows 11's snap-layouts flyout over maximise (it needs
Wails' composition hosting, not shown); dragging the window and its
resize edges with a real mouse (a firewall prompt of another session's
magpie dims the desktop and swallows input; buttons and double click
were driven through CDP instead).
2026-11-16 03:37:02 +08:00
yetone 261f482260 gui: Disconnect and quit puts the agents back for the next start, which connects them again (jtbbtnt54249 on X)
jtbbtnt54249, on LolingVerse's agy thread: "很多都这样,退出有时候又要重新开启".
Several agents' switches were off after quitting magpie and had to be
turned on again by hand.

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

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

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

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

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

Not tried: clicking the pin in the real app (no Accessibility over
ssh), a real Windows or Linux window, Wayland (hidden by design). At
the default 660px window, the English tabs now scroll about 15px, as
Japanese and German already did on main.
2026-11-15 23:05:56 +08:00
yetoneandliu-kan 923cc8747f routing: filtering groups reuses indexed lookups and cards (liu-kan, #6744)
Ported from liu-kan's routing_mod_filter branch at 5aca86598 (#6744).
Typing in the Routing groups filter re-ran every member's lookups as a
linear .find over all models, deciders, drawers and accounts, and redrew
the whole page each keystroke. Now a lazy index (Maps built first-match
like .find, splitMember and memberInfo cached, search text cached per
group and locale) is rebuilt whenever `groups` is reassigned (it never
is mutated in place) and dropped 5 minutes after both Routing pages are
hidden. The filter's input redraws only the group list from cached
cards, falling back to a full draw when groups or the locale changed.
No look, matching or saved config change; no new strings; app.js
untouched (client.js is outside the core budget).

Measured (mote, Playwright, 4000 models, 20 groups x 20 members, 16
keystrokes, ms per keystroke incl. layout):
  chromium: before mean 4767.6 / median 5086.3, after 0.37 / 0.2
  webkit:   before mean 4813 / median 5075,     after 0.88 / 1

Run:
- go test -count=1 ./internal/gui/ on 2bc25a2d6 (mote): ok 137.9s. Main since
  (1f04ed219) touches no routing file.
- New and touched GUI files (group-filter-render, group-index,
  group-search-cache, routing-group-plans) on 2bc25a2d6 on mote:
  54 pass, 0 fail.
- make test-ui (both engines) on mica before the rebase onto 2bc25a2d6
  (main's two routing commits since touch the stage only): the run
  stopped after 453 of 1542 files, 5788 results. Its 34 red files were
  each run on origin/main and on this branch: the same tests fail on
  both (main 2bc25a2d6: 378 pass / 204 fail; branch identical but one
  context-cap Settings flake, #6514). Each has an issue: #6010, #5814,
  #5982, #6369, #6371, #6365, #5925, #4959, #6444, #6212, #6543,
  #6029, #6179, #6658, #3293, #6372, #5972, #6514, #5801, #4870,
  #6475, #6424, #6156, #6201, #6660, #5013, #6268, #6293, #5049
  (group-editor-selected), #5594 (group-new-head), #3479, #6414, #4086.
- The other 1089 files: a run on mica went bad under another session's
  suite (load 117) and was stopped; a whole suite at 2bc25a2d6 is
  queued on mote behind the suite lock, followed up after push.

Not tried: the real app, a Linux WebKitGTK app, Windows.

Co-authored-by: liu-kan <liukan@126.com>
2026-11-15 20:25:50 +08:00
yetone b0d634b850 routing: Expand picks how far the stage opens, models or accounts (ipsikent on X)
ipsikent asked on X for a setting for how deep the Routing page opens:
often only which model a route uses matters, not which provider's account
it went to. Expand, at the end of the stage's top line, opens a menu
(openProtoMenu) with Automatic (as before: long lists folded, short ones
open), Models (two or more accounts or keys of one provider fold into the
row naming the model, and start folded) and Accounts (every fold starts
open). Models and Accounts open every group in the group. The pick is
kept in localStorage magpie.routingDepth; picking one forgets the stage's
remembered folds, so every row follows it at once, and a row clicked
after it is kept as before. Accounts and keys isn't changed. Display only:
the gateway's choice of seat is untouched.

It sits in the stage card's top line, not the page head: in the head it
pushed Hide accounts onto a second line at 420px in English. "Expand" is
in the core dictionary, since i18n-keys finds the word in plugged.go.

Run (mica, at this tree on 2649d5d72):
- node --test routing-depth.test.cjs: 20 of 20, Chromium and WebKit, en,
  zh, zh-TW, ja, de, at 1100 and 420. Red on origin/main's routing files
  (no #rtDepth).
- i18n-keys, i18n-en-no-cjk, routing-group-fold, routing-keys-fold,
  routing-fold-accounts-together: ok.
- Screenshots at 1100 (zh) and 420 (en, de): one-line page head, Expand
  at the card's right.
The whole GUI suite is queued on mote behind another session's (suite
lock); its reds get issues.

Not tried: the real app, WebKitGTK.
2026-11-15 17:49:41 +08:00
yetone 5bccfb4ef2 usage: a table's provider with several accounts is one folded row; an empty Account column is left out (#6740, jay68xu on X)
jay68xu on X: the Usage page gets hard to scan with many providers and
accounts. This change covers the table view only, as the issue's comment asks.

In the Allowances table (Usage > Overview, Table), a provider with
several accounts is now one row. The row shows the chevron, the
provider's icon and name, "N accounts" (a string every language already
has), and each window column's mean share over the accounts. A failed
read counts for nothing in the mean. The provider's accounts sit under
it, folded until the row (or its button, with Enter or Space) is
clicked. Each provider's open state is kept in localStorage
magpie.quotaTableOpen, the way the cards' folds are kept. A provider
with one account is one row, as before. Sorting orders accounts within
a provider, then providers by their mean (window columns) or by their
first row. The Account column is left out when no row names an account.
Window columns and Other already appear only when some row has one.
There is no motion: a toggle redraws the table, and the chevron turns.
app.js is untouched (quotatable.js loads lazily), and there are no new
strings.

Run at this tree (base origin/main d99762075):
- usage-table-groups.test.cjs (new, 40 tests: both engines x en, zh,
  zh-TW, ja, de x 1100px and 420px): all 20 chromium cases are red on
  the old quotatable.js and app.css (0 pass, 20 fail).
- The 4 table files (usage-table-groups, usage-quota-table,
  usage-table-acct-lines, usage-account-subcards), both engines, on
  mote: 102 pass, 0 fail.
- Every usage-*.test.cjs plus i18n-keys and i18n-en-no-cjk, both
  engines, on mote: 1597 pass, 106 fail. All of the reds are in 11
  files that don't touch the table. Run alone, those 11 files give the
  same not-ok list on this tree and on origin/main d99762075 (diffed).
  Their issues are #3414, #6003, #6294, #3415, #2163, #6295, #4263,
  #5048, #6499 and #5834. The three files with no issue were filed as
  #6743 (usage-chart-line, usage-upload, usage-quiet-refresh).
- go test ./internal/gui/ on mica: ok (153.8s), which includes
  TestCoreScriptBudget. The budget was not raised.
- gofmt -l: clean (no Go changed).

Not tried: the real app, WebKitGTK on Linux, Windows, real accounts.
The issue's 代理出口 and 管理页 columns aren't magpie's. No GUI table
or i18n string has them.
2026-11-15 15:54:29 +08:00
yetone dd89f12556 gui: the no-activate hook's handle is swapped atomically, and the Windows exit doc says what the unhook leaves to endProcess (#6705)
On top of wizd's unhook (#6705, afe3b3ff7, kept as authored with its test): noActivateHook becomes an atomic.Uintptr
that unhookNoActivate swaps to 0, so the three places that unhook
(OnShutdown, the main-thread window's WM_DESTROY, Run's return) take it
off once without a racy read-then-clear. Nothing hooks it again:
hookNoActivate runs its SetWindowsHookEx under noActivateOnce, and
noActivateHooked stays true after the unhook.

07dfd0bb8's endProcess (TerminateProcess on itself) and awaitExit are
kept and the gui-shell doc says why: they still cover the other DLL
detaches, an os.Exit while the app runs (Wails' fatal error, which this
unhook doesn't reach), and an update from a version before the fix.

Exit paths reviewed: Quit (tray, page) runs Wails' cleanup, whose
shutdown tasks run on the main thread (InvokeSync), so OnShutdown
unhooks on the hook's thread before Run returns into endProcess. A
restart to update quits the same way. Wails' SingleInstance os.Exit in a
second instance comes in application.New, before any window exists, so
no hook is on. SIGINT/SIGTERM in the app go to Wails (ownSignals), so
through OnShutdown. The handover's quitBy exitNow is Mac/Linux only.

Run at this tree on base 72e06980e (the rebase onto 028b07b4b adds only
routing JS and docs), on xiaomi-gpu (Windows 11 26200,
Go 1.26.8) through win-run:
- TestUnhookNoActivatePreventsExitDeadlock -count=3: PASS 3/3.
- broken by hand (unhookNoActivate returning at once), at the tree before
  the rebase: unhook and destroy-main both FAIL "process hung in
  ExitProcess (stderr=fatal error: exitsyscall: syscall frame is no longer
  valid ...)".
- go test ./internal/gui: 11 reds. TestCoreScriptBudget (app.js 10 bytes
  over its budget) is red the same on macOS at 72e06980e with no script
  touched here; filed as #6733. The other 10 (TestGatewayHeldByAContainer,
  TestLodyImportHandoff, TestImportStatusUnreadableIsUnknown,
  TestAionUiImportRow, TestCherryStudioImportRow, TestProviderSaveClientCert,
  TestPageAwayLetsStatsGo, TestPluginAgentMissingSaysSo,
  TestGatewayModeStatsNameTheGatewaySessions, TestUpdateThatWontStart) fail
  the same on origin/main 9cd5f3652 run alone there, and are filed in
  #6068 (also #5324, #5928, #6059).
- In the signed-in session (scheduled task /IT, where msctf is loaded):
  TestRestartBySelfAsksNoAttention (window, tray),
  TestRestartBySelfComesBackQuietly and TestUnhookNoActivatePreventsExitDeadlock
  pass.
- A real build (go build -tags production -H windowsgui) run as `magpie
  app` in a sandbox profile (USERPROFILE/APPDATA/LOCALAPPDATA redirected,
  MAGPIE_ADDR :3461, page on :3462) in the signed-in session, quit four
  times through POST /api/window/quit?now=1: each exited in 51-62ms. The
  magpie:// handler it registered was put back afterwards.
On mica: gofmt -l clean, go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok.

Not tried: a restart to update of a real build on Windows (needs a staged
update); the wedge itself in a real app (07dfd0bb8's endProcess already
ends the normal quit without ExitProcess, so it can't be brought on at
will); Windows on arm64.
2026-11-15 12:39:32 +08:00
Wizard 7ce93508f0 gui: unhook noActivateHook before process exit on Windows (#6705)
Two full-memory dumps on Windows 11 (magpie.DMP on v0.1.4196 and magpie2.dmp on v0.1.4185) show why ExitProcess throws in exitsyscall and wedges with one thread left (#5922, #6678, #6705):

1. hookNoActivate installs a thread-local WH_CBT hook (noActivateCBT, Go callback #93) on Wails' main thread and never unhooks it.
2. When the process exits through runtime.exit(0) -> ExitProcess (for example from Wails' SingleInstance handover os.Exit, Wails' fatal os.Exit, or before 07dfd0bb8's endProcess), runtime.exit(0) acquires runtime.finlock and enters ExitProcess via runtime.stdcall with g1.syscallsp set.
3. Inside ExitProcess -> RtlExitUserProcess -> LdrShutdownProcess -> RtlpFlsDataCleanup -> msctf!CicFlsCallback -> msctf!SYSTHREAD::DestroyThreadMessageWindow -> win32u!NtUserDestroyWindow, Windows dispatches HCBT_DESTROYWND (nCode=4) to noActivateCBT on the main thread.
4. noActivateCBT calls w32.CallNextHookEx, whose nested Go syscall clears g1.syscallsp = 0 on return. When cgocallbackg then calls runtime.exitsyscall, gp.syscallsp < sp triggers 'fatal error: exitsyscall: syscall frame is no longer valid'.
5. runtime.fatalthrow.func1 calls runtime.exit(2) on the same thread (m0), which attempts to lock runtime.finlock a second time and self-deadlocks forever while still holding Wails' single-instance mutex and WebView2 profile handles.

Fix: unhook noActivateHook (w32.UnhookWindowsHookEx) when Wails' main-thread window receives WM_DESTROY in appWndProc, in OnShutdown, and when Run returns.

TestUnhookNoActivatePreventsExitDeadlock reproduces the exact FLS window-destruction callback on ExitProcess's last thread: without unhookNoActivate the child process throws 'exitsyscall: syscall frame is no longer valid' and wedges with 1 thread left; with unhookNoActivate (or WM_DESTROY on the main-thread window) it exits 0 cleanly.

Fixes #6705
2026-11-15 12:39:32 +08:00
yetone 028b07b4bd routing: a folded fold of accounts on one plan shows its bar in the app (Sdsi134a on X)
Sdsi134a on X: on the Routing stage, "Command Code Plan · 3 accounts" folded
said only "3 available", with no quota, though the accounts are on one plan.
foldQuota (ea1a8ae80, chen2652) was meant to show that figure and bar, but
it never could in the app: cardFor matched only cards whose kind is
"subscription", and /api/usage/quotas sends this computer's cards with no
kind (SubscriptionQuota.Kind is omitempty and set only on a remote magpie's
cards). The tests' fixtures carried kind: "subscription", so they passed.
cardFor now takes a card of this computer whose kind is subscription or
none. This also lets the accounts list's per-account windows (#1833) and
the failed-read line (dd9cd59a1) find their cards in the app.

The fold's figure now also says when its window starts again, the soonest
of the accounts' ("5 hours 40% used · renews in 2 h 10 min"), as an account
row does; no new strings. Hide plans on the groups page
(magpie.routingGroupPlans, f362d3b9a) folds the figure and bar away here
too (plansHidden). Mixed plans: nothing, as before.

Run (base 9cd5f3652; rebased onto 72e06980e, whose new commits touch no
routing or GUI file):
- routing-fold-accounts-together.test.cjs, its cards now in the API's shape
  (no kind), plus the reset and the Hide plans case: 22/22 on mote,
  chromium + webkit, en zh zh-TW ja de, 1100 and 420px. With the old
  client.js: 22/22 red (the figure never appears). With the plansHidden gate
  taken out by hand: 11/11 chromium red ("hidden plans").
- With it, on mica: routing-account-windows, -card-error, -group-plans,
  -free-seat, -groups-page, -pooled-card, -remote-windows, -read-allowances,
  -seat-windows, -wallet-lapse, -fold-all, -folder, i18n-keys,
  i18n-en-no-cjk: 306/306.
- go test -count=1 ./internal/gui/ on mote: ok.
Not tried: the real app with several real accounts on one plan (the owner
has none such); the whole GUI suite.

Reported-by: Sdsi134a
2026-11-15 12:35:22 +08:00
yetone 862660144e gui: a page's tabs in the sidebar fold from its own row, with a disclosure chevron (hkwok06 on X)
Opening Settings unrolled its tabs in the window's sidebar and nothing
said they would fold again; only opening another page (the gateway)
put them away. The open page's row now carries a quiet disclosure
chevron, as a Mac sidebar's: turned to its list while the list shows
(down for the pages above, up for Settings, whose list opens above its
row), and clicking the row or the chevron again folds the list and
unfolds it, the page staying open on its tab. A list folded stays
folded, per page, until it is opened again (localStorage
magpie.navFolded). The same holds for Usage, Library and Plugins.
The chevron is muted, turns in 200ms on the strong ease-out, and
doesn't move under prefers-reduced-motion. aria-expanded says the
state; Enter on the focused row toggles it too.

The chevron and the fold live in navicons.js (navFoldRows, navFold),
imported with the first list; app.js keeps 123 bytes (navList shared
with navMine, the two rows' clicks asking navFold first), with the
budgets raised by that and the reason in core_budget_test.go.

Run (mote):
- nav-sub-fold.test.cjs (new), chromium + webkit, en zh zh-TW ja de:
  red on the old code (12 of 12, "Settings' row shows a disclosure
  chevron"), green 12 of 12 on this change.
- After rebasing on origin/main 38a90a34c: nav-sub-fold,
  nav-sub-unroll and i18n-keys: pass 38, fail 0; TestCoreScriptBudget
  ok; go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet
  -tags nogui ./..., go build ./... ok; gofmt -l clean.
- 45 GUI files the change can reach (nav-*, sidebar/side-*,
  settings-*, menu-scroll, click-scroll, i18n, gui-*, text-size,
  plugin-panels, ...): all pass except menu-scroll's scrollable
  dropdowns (#6532), nav-timeout (#5425) and settings-groups'
  warm-ups and check-in (#6597), which fail the same 5 tests on clean
  origin/main 38a90a34c (pass 8 fail 31 on both).

Not tried: the whole GUI suite (mote and mica were both loaded by other
sessions' suites), and the real app on Linux WebKitGTK and Windows.
2026-11-15 12:05:32 +08:00
yetone 1ac137e100 update: a version found is downloaded at once, not when Update is clicked
canlee886 on X (11-13, again 11-15): with downloads automatic, magpie
showed a new version and downloaded it only after a click on Update.
0.1.4051 made a click go into the copy downloaded and waiting, but the
clock's check (byClock) also kept that copy, so every version out after
it waited for the click: the pill said Update while the newest had never
been fetched. A failed download likewise waited, as a pill to click, for
the next 6-hour check, and a "found" version stayed found when downloads
were turned back on.

Every check that finds a newer version now downloads it with downloads
automatic: the clock's (5 s after start, then UpdateEvery), Check now,
the Version row's refresh and a page asking for notes in another
language (relang now starts the clock's check when the feed names a
newer version). A newer one replaces the one waiting. Only a restart's
check and the update dialog's (keep: recheck, freshen), a restart
waiting for the gateway to go idle (waiting) and downloads on a click
leave it, so a click on Update still restarts at once.

One download at a time stays (begin refuses a check meanwhile); such a
check now sets again (supersede), and the feed is asked again once the
download is in, so a newer version found then takes its place. The
minute loop fetches what was left (fetchDue): "found" once downloads are
automatic, and a failed download (error with retry) after 30 minutes.
docs/subsystems/gui-shell.md has the rule (When an update downloads).

Tests: TestUpdateClockLeavesWaitingDownload, which held the old rule, is
now TestUpdateClockFetchesNewerThanWaiting; new TestUpdateFetchDue,
TestUpdateCheckDuringDownloadTakesNewer (one download in flight at most)
and TestUpdateWaitingRestartKeepsItsDownload.

Broken by hand: putting u.byClock back in the keep-staged condition
turns TestUpdateClockFetchesNewerThanWaiting red (0.1.12 out, still
0.1.11, 1 download); supersede as a no-op turns
TestUpdateCheckDuringDownloadTakesNewer red (never took 0.1.12);
fetchDue false for found turns TestUpdateFetchDue red; dropping
u.waiting turns TestUpdateWaitingRestartKeepsItsDownload red (0.1.12, 2
downloads).

Run at this tree on
ec8125e68, on mote: go test -count=1 -run 'Update|Restart|Fresh|Download|Notes|
Recheck|Relang|Wait' ./internal/gui/ ok. On mica (mote's load was 24.5
over its 18 cores): go vet ./internal/gui/
./internal/update/, GOOS=linux go vet -tags nogui ./internal/gui/,
GOOS=windows go vet ./internal/gui/ ok; gofmt -l clean;
go test -count=1 -timeout 45m ./... (mica): 101 packages ok, no FAIL
(gateway 945s, agent 296s, gui 187s).

Not tried: a real app updating across two published releases; no GUI
file changed, so no GUI run.
2026-11-15 03:45:30 +08:00
yetone 93762f968a usage: small, idle clients fold into one Other row
WJaunita45604 on X: test runs leave dozens of randomly named clients of
~10K tokens each in the Usage page's Agents list, and the page crawls.
renderUsage draws every Agents row again at each refresh whose summary
changed, at ~0.1ms of DOM and layout a row: with 400 clients a redraw
took 30-54ms in Chromium and 45-66ms in WebKit, with 2000 136-178ms and
224-246ms (probe at 1200px, Bun/SiYuan/translate-web and N clients).

A client not hidden folds when it is past the 5 with the most tokens,
under 1% of the period's tokens, and either made no call in the last 3
days (the agent group's new `last`) or is past the top 20; two or more
fold, or none do. No setting. Other sits at the list's foot with the
folded groups' sums (usageSum), so totals stay exact, and opens with a
click, Enter or Space; open, it draws the folded rows with their own
actions 100 at a time (Show {n} more). Closed they aren't drawn at all:
with 400 or 2000 clients a redraw now fits one frame (~13-20ms in both
engines), as with none.

Run at 442964d70 + this change, on mote (then rebased clean onto
9afec644c, which touches sync/library/update only; go test -run
'Budget|Size|I18n|Css' ./internal/gui ./internal/usage ok there):
gofmt -l clean; go vet ./internal/usage ./internal/usageapi
./internal/gui on darwin, linux (-tags nogui) and windows: ok;
go test ./internal/usage (58s), ./internal/usageapi, ./internal/gui
(137s): ok.
GUI, both engines: usage-*, i18n-*, mobile-web, own-requests and
ledger-cache-unknown files: 1740 tests, 1663 pass, 77 fail. The reds:
usage-agents-hide #6003/#3414, mobile-web #3952, usage-cards-hide
#6294, usage-range-times #6499, usage-hidden-way-back #6295,
usage-fold #3415, usage-speed-all-models #5834 fail the same way at
base 442964d70 (those 7 files there: 152 pass, 70 fail, the same
usage-agents-hide error "536.7 -> 586.98"); usage-ledger's "newest
live route needs no return-to-live button" is #5048/#6003 (the
Requests tab, which this doesn't touch); usage-chart-dates (chromium)
timed out launching the browser (180s) under load.
The new usage-agents-other.test.cjs: 33/33 (chromium + webkit, en zh
zh-TW ja de, three widths).
Perf probe at 1200px, one redraw: 400 clients 30–54ms (Chromium) and
45–66ms (WebKit) before, 2000 clients 136–178ms and 224–246ms; after,
both fit one frame (~13–20ms), the same as no clients.
Broken by hand: USAGE_FOLD_TOP=0 turns the rule test red; dropping the
100-row cap turns the page test red ("151 !== 100").
Not run: the full GUI suite (mote and mica were both running other
sessions' suites).
2026-11-15 02:51:18 +08:00
yetone 07dfd0bb8f update: a magpie stuck in its exit on Windows no longer holds the restarted one (BESTLJP0412 on X)
BESTLJP0412 on X (Windows 11 26200, 0.1.4179 to 0.1.4193, WebView2 157):
after an update's restart the window stayed "Not Responding", and a
process with a single thread sat on port 3425 and the WebView2 profile.

A Go process has several threads while it runs; one left means it is in
ExitProcess (os.Exit on Windows), which ends every other thread and then
runs each loaded DLL's detach on the last one. A detach that waits for a
thread already ended (WebView2's, COM's) never returns, so the old magpie
never ends, its handles stay open, and the new one waited its 60s
(awaitGone), went on beside it, and hung on the held port and profile.

Both ends fixed:
- the old one: cli.Main ends through endProcess, on Windows
  TerminateProcess on itself instead of ExitProcess. Everything magpie
  writes is written by then; the kernel closes every handle and no
  detach runs.
- the new one: awaitGone's wait for the old magpie (awaitExit) looks at
  its thread count every 250ms; one thread for a second is a magpie stuck
  in its exit, and it is ended (opened with PROCESS_TERMINATE). This is
  what fixes the update from 0.1.4193 and older, which still exit through
  ExitProcess.

docs/subsystems/gui-shell.md says how a Windows restart waits and ends.

Tests (Windows, real processes; the stuck detach is a fiber-local storage
callback set to kernel32's Sleep with INFINITE, which ExitProcess runs on
its last thread and TerminateProcess doesn't):
- cli TestEndProcessSkipsAStuckDetach: first checks the stand-in is real
  (os.Exit there hangs with exactly 1 thread left), then that
  endProcess(3) ends with code 3. Broken by hand (TerminateProcess taken
  out): red, "endProcess hung in a DLL's detach, as os.Exit does".
- update TestAwaitGoneEndsAMagpieStuckInItsExit: a predecessor stuck that
  way is ended in ~1.4s. Broken by hand (the thread check skipped): red,
  "the start went on after 20.022s with the old magpie still stuck".

Run:
- win-run on xiaomi-gpu (Windows 11): go test ./internal/cli ok (179s);
  ./internal/update all ok but TestPackagedByDpkg, red the same on
  origin/main 442964d70 (#4603, a ':' file name on NTFS).
- mote: gofmt; go vet, GOOS=windows go vet, GOOS=linux -tags nogui go vet
  of internal/cli and internal/update ok.
- mica: full go test ./... -timeout 45m started at this tree; still running
  at push (ship-at-once rule), result to follow on the issue thread if red.

Not tried: a real update restart of the app on Windows with a stuck
WebView2 detach (the hang can't be brought on at will there); the fix is
checked with the FLS stand-in above.
2026-11-15 02:31:56 +08:00
yetone 1edebf0500 tray: a card with more than two windows shows them all, in columns of two (jen_celeus on X) 2026-11-15 01:11:08 +08:00
yetone 221c91fae3 gui: the gateway card opens the chat page
The gateway card gets a "Chat page" button beside Restart gateway while
the gateway runs. It opens <gateway>/deepseek-chat/ in the browser, or,
in web mode, the public URL's chat page. Both buttons sit in one
.gw-acts group, so a narrow card wraps them together, and Restart keeps
its .gw-fix class (the takeover, pause and port-holder tests read the
first .gw-fix). The label is translated in zh, zh-TW, ja and de.

Run: gateway-chat-page.test.cjs in Chromium and WebKit, every language,
at 1100 and 420 wide, on mica: ok. It is red without this change (no
button). At 058119705 + this change, on mica, every gateway-*.test.cjs,
i18n-keys and i18n-en-no-cjk in both engines: 328 of 343 pass in
Chromium. The reds are gateway-card's "7 !== 6" (#6029) and
gateway-key-arrange at 420px (#6268), and in WebKit gateway-pause's
"click moved the row" in one language (#6684). All of them are red the
same on an origin/main 3f09b9ffc copy. go test ./internal/gui (budgets): ok.
Go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) and gofmt: clean.
2026-11-14 23:56:19 +08:00
yetone 47684ef176 usage: a table column is what its windows are of, not their names
normalcoder_ on X: in Usage > Overview's table, Antigravity's
"Gemini · 5 hours / 7 days" landed in the last ("Other") column, since
columns were keyed by window name. That holds for every provider whose
names don't match the column keys.

columnOf keys a pooled window to its pool's column (poolWord, "Claude &
GPT" under Claude) and names the window in the cell; any other window
goes by its span (spanOf: "Weekly", "7 days" and "7d" share a column,
headed by the name most rows use, a number on a tie); a window with no
span goes by its name.

Run (mote, chromium + webkit, en zh zh-TW ja de, 1100 and 420px):
usage-account-subcards.test.cjs 40/40 here, 40/40 red on origin/main
0b8c4bfc3. It covers the previous commit's sub-cards as well. The usage
GUI reds are those named in the previous commit, the same on main.

Not run: the whole GUI suite before the push.
2026-11-14 23:49:02 +08:00
yetone 2a6ab83d8a usage: each account of a provider's card is a card of its own; the ⋯ keeps its room
normalcoder_ on X (v0.1.4079, Usage > Overview): accounts inside a provider
card were told apart by a hairline only, and the card's ⋯ was drawn over
the end of the head ("Show the other accounts in brief" was hidden).

- renderQuotas puts each account of a card with several into a
  .subscription-acct box (a provider's keys, a balance a line, stay
  lines); quotaCardMenu looks through the box for the account's head.
- The head keeps 18px for the ⋯ whether it shows or not; where nothing
  hovers, the ⋯ is always shown.
- Core budgets +57 (app.js) / +81 (core): renderQuotas draws every card,
  so there is no page to move it to.

Run (mote, both engines):
- usage-card-menu-room.test.cjs: 20/20 here; red 20/20 on origin/main
  0b8c4bfc3. usage-account-subcards.test.cjs (next commit) guards the
  sub-cards; red on origin/main too.
- go test ./internal/gui -run Budget: ok.
- ~110 usage/quota/i18n GUI files: every red is the same on origin/main
  0b8c4bfc3 and filed: usage-agents-hide (#3414), usage-cards-hide de 560
  (#6294), usage-fold webkit (#6003, #3415), usage-hidden-way-back (#6295),
  usage-ledger Requests (#5048), usage-range-times (#6499),
  usage-speed-all-models (#5834).
- usage-fold "most on one screen" is red on main (#4790, 12 chromium of
  15 wanted); with the boxes it is 11, one account fewer.

Not run: the whole GUI suite before the push; the real Linux app.
2026-11-14 23:49:01 +08:00
yetone cfd70c60c2 update: the old pill quiet ran through 0.1.4181, not 0.1.4179
Comments and docs only: v0.1.4180 and v0.1.4181 were tagged before 3f09b9ffc landed, so they still hold the pill for 3 days. No code changed; nothing run beyond gofmt -l (clean).
2026-11-14 23:48:04 +08:00
yetone 3f09b9ffc6 update: the header's Update pill shows a waiting update at once; only its x holds it, for 3 days (visamzh, normalcoder_ on X)
visamzh (0.1.4174, 0.1.4176 downloaded, Update button and Automatic
updates on) and normalcoder_ (0.1.4079) saw no Update pill for about two
days. Cause: 36eebea13 (v0.1.3879, 11-12) set /api/update's quiet until
this version had been behind for update.Quiet (3 days), counted from the
first newer version seen and kept per running version. With a release
every few minutes, every update starts that clock over, so on any version
a user updates within 3 days the pill never lit, whether a download was
waiting (ready) or one was found with downloads off (found), on every OS.
The Version row and the tray's Restart to update still offered it.

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

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

Run (mica/mote, macOS, Go 1.26.8), at this tree:
- go test -count=1 ./internal/update ./internal/gui: ok, before and
  after the rebase onto 0b8c4bfc3 (also i18n-keys, i18n-en-no-cjk, update-quiet, update-hide there: 118/118). go vet darwin, GOOS=linux -tags
  nogui, GOOS=windows: clean. gofmt -l clean.
- Broken by hand (old semantics: first-seen sets the clock, Lit needs it
  past Quiet): TestPillLightsWhenANewerVersionIsOut,
  TestDismissalHoldsForTheQuiet and TestUpdateQuietUntilBehindAWhile
  (ready, found, available: quiet true, want false) red.
- GUI, Chromium + WebKit: update-quiet.test.cjs (en, zh, zh-TW, ja, de;
  panel 420, narrow window 400, window 900; ready and found show the
  pill, quiet hides it and Settings says Hidden for 3 days with Show
  again) and update-hide.test.cjs pass; update-quiet red on the old
  app.js (Settings row). 52 GUI files touching Settings, updates, i18n
  and menus: 882/935; the reds (menu-scroll, settings-hints,
  settings-search, settings-lines-wrap, settings-groups warm-ups) are
  the same 50 at origin/main aa358555f run alone (54 pass / 50 fail
  both), filed as #1550, #5982, #6133, #6353, #6597. plugin-card-update
  webkit was red only under --test-concurrency=3 and passes alone.
Not run: the full go test ./... and the whole GUI suite (mote over its
load, mica running another session's GUI suite); not tried in the real
app with a real download waiting.
2026-11-14 23:47:47 +08:00
yetone 90efddabae gui: providers can be picked and removed together (eiyuuzaki2333 on X)
Many API providers added meant removing them one at a time. Select, by
the Providers search box (shown with two or more), puts a box on every
row as Routing's groups and Library's lists have it: a click on a row
picks it rather than open its editor, Shift picks the rows shown
between, and the bar's box picks every row shown. Remove asks once, in
the app's own dialog, with the count and every name, then posts
POST /api/providers/delete {ids}. That runs provider.Delete for each
id, as the editor's Remove does, inside one agent.Reseat, so agents
move once, to where they end up. One it can't remove comes back in
`unremoved` with why, stays picked and is named in the status; the call
is refused only when nothing was removed. Done or Escape ends picking.

The rows, bar and removal are in pvpick.js, imported when Select is
first clicked. The core grows 270 bytes (pvSel, the button's click and
two lines in renderProviders), and coreScriptBudget is raised by that
with the reason. "{name} wasn't removed: {error}" moves from Library's
words into core i18n.js, since core code says it now.

Run (rebased on origin/main e6e0585bd, on mica; mote was over its 18
cores):
- go test -tags nogui ./internal/gui/ ./internal/provider/: ok
  (TestProvidersDeleteSeveral new; TestCoreScriptBudget ok after the raise).
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok; go build: ok.
- GUI, chromium + webkit: provider-bulk-remove (new: en, zh, zh-TW, ja,
  de at 420 and 1100px), provider-remove, provider-find, provider-order,
  providers-off-fold, provider-search, provider-list-off,
  group-bulk-remove, library-pick-remove, i18n-keys, i18n-en-no-cjk: ok.
  found-skill-pick-remove's ja/de 420px subtests are red, and red the
  same at origin/main e6e0585bd in a clean worktree (#5013).
Broken by hand: the handler deleting only ids[:1] turns
TestProvidersDeleteSeveral red ("listed after: [b c d]"); the page
posting only the first id turns provider-bulk-remove red in every
language. Restored, green.
Not run: the full Go suite and the full GUI suite (mote overloaded,
mica running another session's GUI suite); not tried in the real app
with real providers.
2026-11-14 22:18:09 +08:00
yetone 1ab2c39843 tray: the menu bar and panel leave out what Usage's Overview hides (onkashiko on X)
onkashiko on X: a quota hidden in the main window still showed from the
menu bar. 7ea1e6a4b made the tray panel and the TUI leave out Overview-hidden
cards and rows, but two gaps were left:

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

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

Run on mica (mote at load 117 on 18 cores), at base ee6352b63:
- go test -count=1 -timeout 45m ./internal/gui ./internal/tui
  ./internal/provider ./internal/settings: all ok.
- go vet of those packages; GOOS=linux go vet -tags nogui and GOOS=windows
  go vet of internal/gui, internal/tui, internal/provider: clean. gofmt -l
  clean.
- GUI (Chromium + WebKit, en/zh/zh-TW/ja/de): panel-hidden-balance (new),
  panel-page-hidden, panel-arrange: 28/28. panel-balance-order,
  usage-rows-hide pass. usage-cards-hide and usage-hidden-way-back are red
  at "de 560" (no sideways scroll), the same 8 on an origin/main
  ee6352b63 copy (#6294, #6295). tray-cell-click "chromium zh/en" is red
  1 run in 3 on origin/main as on this tree (#5215).
Broken by hand: panel-hidden-balance is red on origin/main's assets
(the plan card carries the hidden balance, MiniMax's balance gone);
TestTrayLeavesOutWhatTheOverviewHides is red with trayShown returning
trayPick, TestUsageArrangeWakesTheMenuBar red with the onTrayUsage call
removed.
At the pushed head (rebased on 534b1a334, which adds installdir_windows.go):
GOOS=windows go vet ./internal/gui ./internal/update and go test -run
"TestTray|TestUsageArrange|TestCoreScriptBudget" ./internal/gui: ok.
Not tried: the real menu bar on a Mac or Windows with a real account; no
full go test ./... (a full suite was running on mica).
2026-11-14 19:37:57 +08:00
yetone 61e2035d39 gui: a Windows start no one can answer is never asked where to install, so the gateway comes up (v0.1.4160-4166 release check)
Every magpie-releases build from v0.1.4160 to v0.1.4169 failed
windows-check (amd64 and arm64) at "Launch magpie": the exe logged
"magpie 0.1.4166 started (app, ...)" and the gateway never answered, so
none of those versions has assets.

Cause: 14807bcf2 made a copy still named as the site's download
(magpie-windows-amd64.exe) a download wherever it is kept, asked about
through the install dialog. The release check starts
dist\magpie-windows-amd64.exe, so update.Settle now put up the task
dialog. The question comes before anything starts in gui.Run, the
gateway included (Install opens the installed copy in this one's place),
and on the runner no one answers it, so the app waited on it forever.

Now askInstallFolder leaves update.AskFolder unset when no one can
answer (unanswerable): CI set, as every CI service sets it (GitHub's
CI=true), or a window station no one sees (a service, a start over
SSH; GetUserObjectInformation UOI_FLAGS without WSF_VISIBLE). Unasked,
a copy kept outside Downloads runs where it is with nothing recorded
(isDownload's existing ask=false rule), and one in Downloads installs
to the default as it did with no dialog. A person's start on their own
desktop is asked as 14807bcf2 has it. The gateway can't start before
the answer instead: Install forwards to the installed copy and this one
quits, so its gateway would have to be handed over first.

Also fixes #6648: TestSettleAsksAboutADownloadKeptElsewhere expected
forwards() true on every OS, but forwarding is Windows' alone (as its
sibling checks at install_test.go:382/452 already say), so it was red
on Linux and macOS since 14807bcf2.

Tests: TestNoInstallQuestionOnCI (Windows: CI=true leaves AskFolder
nil) and TestInstallQuestionNeedsSomeoneToAnswer (any OS).

Run:
- Reproduced on xiaomi-gpu (Windows 11) as the CI step does it: the exe
  built with go-winres's manifest (so the task dialog exists), named
  dist\magpie-windows-amd64.exe, started `app` with CI=true in the
  logged-in console session (session 1, through a schtasks /it task),
  sandbox USERPROFILE/LOCALAPPDATA/APPDATA/TEMP, MAGPIE_ADDR on a port
  of its own, polling /v1/models 30x2s. At ee6352b63: RED, "the gateway
  never answered", nothing after the start line. With this change:
  GREEN, "install: not asking where to install: CI=true", gateway
  answered, still up 5s later, nothing installed.
- Over SSH (session 0) with CI unset: the question is skipped ("no one
  sees this desktop"); the app then exits on WebView2's controller
  there (no desktop), which is that session's, not this change's.
- Broken by hand: askInstallFolder reading another variable ->
  TestNoInstallQuestionOnCI red ("asks where to install with CI=true").
- win-run go test -count=1 -run 'TestNoInstallQuestionOnCI|
  TestInstallQuestionNeedsSomeoneToAnswer|TestInstallWords' -v
  ./internal/gui/: ok.
- wsl-run go test -tags nogui -count=1 ./internal/update/ (magpie-desktop,
  Ubuntu 24.04): ok (#6648's red gone).
- mica-run: gofmt -l internal/ clean; GOOS=windows go vet and GOOS=linux
  go vet -tags nogui ./internal/update/ ./internal/gui/ clean; darwin go
  vet clean.
- win-run go test -count=1 ./internal/update/: ok except
  TestPackagedByDpkg (#4603, open, untouched).
- mica-run go test -count=1 ./internal/update/ (macOS): ok.

Not run before the push: the full suite (mote at load 144) and the
whole ./internal/gui package (running on xiaomi-gpu and mica at push;
the release blocker didn't wait for it). Not tried: a real person's double-click from D:\下载 after this
change (the dialog path itself is unchanged).
2026-11-14 19:28:21 +08:00
yetone ee6352b638 gui: black's dark page is #000000, and a dark colour darkens the page in its hue (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS on X (tweet 2121543612278472704), on the dark theme:
「现在的纯黑……感觉色对不上」 beside Chrome's black, and the darkest navy of
the system's picker 「感觉是有浅灰存在,所以导致深变浅」. Their screenshots:
black's page (2,1,7), Chrome's (0,0,0); navy #191047's page (24,23,29),
card (31,30,36), the grey of Graphite's.

Why (appearance.go ground()):
- the dark grounds went down by the same amount on every channel, so
  app.css's cool grey cast stayed: black's page was #000003, its card
  #08080c, a blue-black next to Chrome's #000000;
- how dark a pick is was its mean channel against the page's. #191047's
  mean (37) is above the page's (27), so a deep navy counted as light
  and only got a breath of hue (0.08): the same grey page as Graphite.

What changes:
- darkness(): a pick's OKLab lightness under 0.4 (Graphite #52525b is
  0.44, every preset 0.51 or more) is how far the dark grounds go
  toward black; 1 for black. #191047 is 0.23, so 0.43.
- as a ground goes down it loses the grey's cool cast by as much, and
  takes more of the pick's hue (0.08 + 0.25 x darkness). Black's page
  is #000000 with neutral steps above it (card #090909); navy's page is
  a near-black navy.
- Graphite, the presets, colours lighter than 0.4 and the light theme
  are unchanged; lifted() (where the ink starts) is unchanged.

Measured (Settings > General zh, dark, 1200px; screenshot pixels, the
same in Chromium and WebKit), before -> after:
- black: page #000003 -> #000000, card #08080c -> #090909
- #191047: page #191821 -> #0c0b17, card #22212a -> #151420
- #130830: page #17161e -> #0b0813, card #201f27 -> #14111c
- Default, Graphite (#1a1a1e / #232327), teal, #7f1d1d: unchanged

Tests:
- TestDarkPickDarkensPage: black's grounds are neutral greys; three
  dark blues draw a darker, blue page with text >= 7:1 and the accent
  >= 4.4:1; Graphite and the presets have darkness 0.
- TestBlackIsBlack: black's page is #000000 exactly.
- appearance-look: black's dark page is rgb(0, 0, 0); #191047 draws a
  dark navy page with Settings' list on its card (dark), and keeps the
  light page's lightness (light). Fixture gains #191047.

Run on mote (load ~22-35 over its 18 cores; mica's disk is full, 116MB
free), at this change on origin/main dbac411b2:
- gofmt -l internal/gui clean; go vet -tags nogui ./internal/gui, the
  same with GOOS=linux, GOOS=windows go vet ./internal/gui: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gui: ok (112s).
- Whole GUI suite (node --test internal/gui/tests/*.test.cjs, both
  engines, every language): cut short at 8650 of ~8700 results to push
  (coordinator); 8279 ok, 371 not ok. appearance-look 20/20 here and
  every accent, look and Settings case ok. Reds outside this change
  (accounts, keys, Check in, quick panel shortcut, gateway card, under
  the box's load); api-key-theme (#6444) and omarchy (#6027) are the
  reds named on origin/main by 90ad90646. Not rerun on a base copy.
- Broken by hand: with the old ground(), TestBlackIsBlack and
  TestDarkPickDarkensPage are red (#000003, blue-grey grounds), and
  appearance-look's dark case is red in both engines ("black's page is
  black").

Not tried: the real macOS app, WebView2, WebKitGTK; the full Go suite;
the GUI reds' base comparison.
2026-11-14 19:10:06 +08:00
yetone 14807bcf20 update: a Windows download kept outside Downloads asks to install too
@XBJNTMs2mDbsvPH on X: on Windows magpie ran from wherever the
downloaded exe was and updated itself in place there, so deleting the
download deleted magpie, and opening copies of different versions left
several Magpie entries in the Start menu.

Cause: update.Settle installed the exe into %LOCALAPPDATA%\Programs\magpie
only when it ran from the known Downloads or Desktop folder or a temp
folder. A browser set to save elsewhere (D:\下载), or a download moved
into a folder of the user's own, never counted, so that copy stayed the
app, updated in place, and each copy opened was an app of its own to
Windows (its own path: taskbar, Start's lists, Open at login,
Magpie.lnk repointed at whichever ran last).

Now an exe still named as the site's download
(magpie-windows-amd64.exe, "… (1).exe", arm64; downloadName) counts as a
download wherever it is, but only through the existing install dialog,
never unasked (no dialog, no install). Installed, it opens the installed
copy as a download in Downloads does, and a newer one replaces it.
Cancel on such a copy is kept in HKCU\Software\magpie NotInstalled (the
exe's path): it runs where it is from then on, is not asked again and
never forwards; another copy is still asked. Cancel in Downloads is not
recorded, as before. forwards() (no magpie.com beside a forwarding
copy) follows the same rule. Uninstall's ForgetInstallDir takes the new
value out with InstallLocation. A renamed copy (D:\Tools\magpie.exe)
is left alone as before. No new UI: the dialog is the one from 49c9491b7.

The shortcut code itself makes only one Magpie.lnk and repoints it; it
was not changed.

Tests: TestSettleAsksAboutADownloadKeptElsewhere and
TestSettleDeclinedElsewhereIsKept (fakes, any OS), TestDeclinedRecord
(real HKCU, a key of its own, Windows). TestSettleLeavesAChosenPlace now
uses a renamed copy and checks nothing is asked.

Run:
- win-run (xiaomi-gpu, Windows 11) go test -count=1 ./internal/update/
  ./internal/uninstall/ ./internal/shortcut/ ./internal/gui/: update,
  uninstall, shortcut ok except TestPackagedByDpkg (#4603, untouched);
  gui red TestGatewayHeldByAContainer and TestLodyImportHandoff (#6068,
  untouched).
- win-run go test -run 'TestSettle|TestDeclinedRecord|TestForward|
  TestNoCompanion|TestInstall' -v ./internal/update/: ok.
- Broken by hand on Windows: the name check off -> both new tests red
  (settle = "" want the installed; declined ""); the decline record
  ignored -> TestSettleDeclinedElsewhereIsKept red ("asked again").
- win-run go vet ./internal/update/ ./internal/uninstall/ ./internal/gui/
  and wsl-run go vet -tags nogui ./internal/update/ ./internal/uninstall/
  (magpie-desktop, covers install_other.go): clean. gofmt -l clean.
- win-run go test -count=1 . (TestAllLazyPatternsCompile and the other
  root guards, the new pattern included): ok.

Not run: the full suite and a darwin vet (mote at load 126-142, mica's
disk full). Not tried: the real app's dialog on an interactive Windows
desktop from a non-Downloads folder (the box's HKCU\Software\magpie and
Start menu are shared with other sessions' magpie there), and the
reporter's duplicate Start entries were not reproduced; which list
showed them is not known.
2026-11-14 18:20:53 +08:00
yetone 7ea1e6a4b3 usage: the tray panel and the TUI leave out what the Usage page hides
onkashiko on X: a provider whose allowance card was hidden in the main
window (Usage > Overview, "Hide from Overview") still showed in the menu
bar's panel. The panel's Allowances tab had only its own Arrange list
(panelUsageHidden) and read the full cards.

Now the panel leaves out a card whose cardHideKey is in usageCardsHidden
and the rows in usageWindowsHidden (withoutHiddenRows), as Overview does;
a menu bar cell's card still shows (panelPeek). A subscription whose
every card the page hides counts in the foot's "{n} hidden" and shows as
hidden in Arrange; Show there
also drops its keys from usageCardsHidden, since the panel follows the
page. All of it is panelPageCut in the Usage plugin's page.js, which every
window loads, so the core scripts get no bigger (TestCoreScriptBudget
unchanged). Hiding from the panel alone still leaves the page as it is. The
panel reads settings again each time it is shown (loadBack), so a hide or
unhide in the main window reaches it with no restart.

Siblings: magpie tui's Usage page leaves out the same cards and rows
(usageShown, read at every quota read). The menu bar's cells and tooltip
show only the cards picked in Settings, so they keep a hidden card as
before; routing, caps and counting are unchanged.

Run:
- panel-page-hidden.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/de,
  10/10 green; red on the old app.js/panelarrange.js (cards still drawn).
- TestUsagePageLeavesOutWhatTheAppHides (new): green; red on the old
  pages.go (balance, account and row still listed).
- GUI: the 128 files that read the panel, Usage or tray code, chromium +
  webkit, every language, on mote: 17 files red, rerun alone at
  concurrency 1 here 123/449 red and at origin/main 015860f2d 122/449,
  the same tests but tray-cell-click's chromium en, which is red alone on
  main too (#5215); the rest noted on #5475. tray-cell-click + panel-arrange +
  panel-page-hidden together before the last rebase (no GUI file changed
  in it): 21 of 22, the one red tray-cell-click's (#5215). At this head
  (after the move into page.js): panel-page-hidden, panel-arrange,
  panel-balance-order and i18n-keys green; the reds in key-balance-card
  (de), panel-fold, tray-cell-click (zh) and usage-cards-hide are each
  in the origin/main 015860f2d record above.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./...) on mica
  under suite.lock at 734f06b64 (this change before the move into
  page.js): 97 packages ok; internal/gui red only on TestCoreScriptBudget
  (fixed by the move), internal/gateway red from "too many open files in
  system" at mica's load ~65. At this head on mote: internal/gateway,
  internal/gui, internal/tui, internal/settings and internal/redact (the
  one commit rebased over) ok; gofmt -l clean; go vet, GOOS=linux go vet
  -tags nogui and GOOS=windows go vet ./... clean; go build ok.
- Rebased onto origin/main 667ac8bd6 (5faed634d): internal/gui (budget
  included), internal/tui and internal/settings ok on mote;
  panel-page-hidden + panel-arrange 18 of 18.
Not tried: the real tray panel by hand on a live install.
2026-11-14 14:10:24 +08:00
yetone 90ad90646a gui: black draws a black dark theme, not Graphite's grey (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS, on v0.1.4124 (tweet 2121468612238266666), with three
dark-theme screenshots of Settings > General, one each with Default,
Graphite and a custom black picked: 「这三个颜色……都显示是一样的」,
「尤其是黑色始终一直是灰色」. Their screenshots show the same page in all
three: ground (25,25,27), card (32,32,34).

Why:
- v0.1.4124 tints the grounds with the pick's hue only (base + k*(c -
  mean(c))), lightness kept. Black and Graphite have no hue, so they
  changed nothing. Default draws no look at all (magpie's own).
- accentOn lifts a dark pick toward white only until it reads at 4.5:1,
  so black's dark ink came out #8a8a8a, next to Graphite's #89898f.

What changes (appearance.go):
- ground(): on the dark theme, a pick darker than the theme's background
  darkens every dark ground by as much (depth()). Black draws a black page
  (#000003), with cards, pills, lines, menus and the tray panel the same
  steps above it as in app.css (card #08080c, line #18181e). Graphite,
  and any colour as light as the ground, draw as before.
- lifted(): black's ink starts most of the way to white, so it is a light
  mono ink (#e0e0e0, dark text on its buttons), not Graphite's grey. On
  the light theme black is #000000, as before. The sibling, white on the
  light theme, now gets a dark ink instead of a mid grey.
- The light theme's grounds keep their lightness: a white pick would melt
  its white cards into the page.
- app.css: a swatch's edge and the chosen ring take a little of the text's
  ink, so the black swatch stays seen on the black page it draws.
- Default stays magpie's own look (grey grounds, indigo accent) for every
  user. Not changed here.

Tests:
- TestBlackIsBlack: black's dark page is black and each ground keeps its
  step; Graphite moves nothing; black's ink is light in dark (>= 1.8:1
  from Graphite's) and #000000 in light; white's light ink is dark; text
  reads >= 7:1 on black's grounds.
- appearance-look.test.cjs: "Default, Graphite and black are three looks",
  light and dark, both engines: three different --accent values; Graphite
  keeps the grey page; in dark, black's page is black, Settings' list sits
  on black's card a step above it, its ink is light; in light, black is
  #000000 ink.
- TestLookFixture's fixture gains #000000 and #52525b.

Run on mote (mote was unreachable for ~20 minutes; the red check ran on
mica), at this commit rebased on origin/main fc896a9f6:
- gofmt -l internal/gui: clean. go vet -tags nogui ./internal/gui, the
  same with GOOS=linux, and GOOS=windows go vet ./internal/gui: ok
  (before the rebase onto fc896a9f6, which touched nothing in gui).
- go test -tags nogui -timeout 45m ./internal/gui: ok (95s, before the
  rebase); at the rebased head go test -run
  'TestAccent|TestLook|TestTint|TestWallpaper|TestBlack|Budget': ok.
- node --test, both engines (the files run every language at 420 and
  1000px where they have that matrix): appearance-look 44/44, i18n-keys
  4/4 at the rebased head; checkbox-look 8/8, seg-contrast 14/14,
  settings-general 20/20, settings-sections 10/10, input-look 20/20
  before the rebase. api-key-theme 0/6 (#6444) and omarchy 8/14 (#6027)
  are red with the same cases on a copy of origin/main fc896a9f6.
- Broken by hand: with origin/main's appearance.go and its fixture
  regenerated for #000000 and #52525b, the new GUI case is red in dark in
  both engines ("black's page is black, not rgb(26, 26, 30)"); light
  passes there, as black was already #000000 ink on the light theme.
- Screenshots, both engines, Settings > General zh at 1200, Default /
  Graphite / black, light and dark, before (origin/main's lookCSS) and
  after (before shots on mica, after on mote): dark black's page goes (26,26,30) -> (0,0,3), card (35,35,39)
  -> (8,8,12); Default and Graphite unchanged; black's ring still shows.

Not tried:
- the real macOS app, WebView2 and WebKitGTK;
- the full Go and GUI suites.
2026-11-14 13:59:58 +08:00
yetone 27c998aba0 usage: the tray panel's and Requests' costs follow each provider's currency
onkashiko on X: with Currency set to By provider, the menu bar panel
still showed every cost in one currency; providers and models were not
each in their own. drawLedColumns and drawLedRank (shared by the tray
panel and the window's Requests tab) formatted every value with no
provider, so fmtCost fell back to the Totals in currency.

- usageapi.Ledger echoes the provider a page is filtered to
  (`provider`, omitempty).
- app.js: ledProv(l, split, id) names the provider of a value: the
  ledger's filter, the row's provider (provider split), the provider
  part of a modelAt id, or for a model split the provider(s) that served
  it when they all share a currency. ledFormat/ledFormatLong take it,
  so the rank's values and sub-lines, the tooltip's rows and the axis
  (when one provider is picked) are in that provider's currency. Sums
  (the panel total, the tooltip total, a model served in two currencies)
  stay in the Totals in currency.
- page.js: the Requests head and the cost head use the filter's
  provider; the heatmap tip too. Other fmtCost calls are sums or
  sessions with no provider and are unchanged.
- core script budget +491 (1,269,040 -> 1,269,531): drawLedColumns and
  drawLedRank are drawn by the panel, so there is no lazy page to move
  this to; packed to the shortest form.
- docs/subsystems/gui-shell.md says how By provider reaches the panel.

Run:
- At 065fb6a8b (rebased on 7d5475769), mote: gofmt clean;
  TestCoreScriptBudget and TestLedgerSaysItsOneProvider ok;
  panel-currency-provider.test.cjs 20/20 (chromium + webkit x en, zh,
  zh-TW, ja, de; panel 440/320px, window 1100/420px, no sideways
  scroll, no page errors).
- At ff3ab573d (same change on 90932ed1f), mica, under suite.lock:
  go vet darwin, linux nogui, windows ok; builds for all three ok;
  go test -tags nogui -count=1 -timeout 45m ./... : 99 packages ok,
  exit 0. mote: go test usageapi, gui, usage ok.
- GUI suite, the 155 files the change can reach, mote: 2581 tests, 105
  failures in 13 files; the same 13 files give 104 at 90932ed1f. The
  one extra is tray-cell-click webkit en, flaky on both trees run
  alone (head green twice, base red once). Filed: grip-inset,
  key-balance-card, panel-fold, tray-cell-click, usage-* (#6293,
  #6294, #6295, #6499, #6003, #5872, #6414, #5869, #5796, #5215,
  #4790); panel-shortcut's 20 reds newly filed as #6606.

Broken by hand:
- panel-currency-provider on the old assets (MAGPIE_ASSETS): 20/20 red,
  with the reporter's symptom (DeepSeek $1.00, SiliconFlow $0.500
  under By provider).
- TestLedgerSaysItsOneProvider red with `out.Provider = f.Provider`
  removed.

Not tried: the real app's tray panel with real yuan and dollar
providers.
2026-11-14 12:42:46 +08:00