Commit Graph
2246 Commits
Author SHA1 Message Date
yetoneandJoeyWu-tech 761e0e0105 gui: a Settings option pressed through two redraws clicks its newest self (#3922)
Browser access draws twice per renderSettings: once at once, and once
more when its /api/web-page answer comes. When that answer landed
between the release and the click segs' pointerup sets off, the option
the release found was gone by the click and nothing was sent, which
segs-press-redraw's sweep saw on Network's web-page list. The click now
goes to the control's newest self (same segsWho, same option), found
again whether or not a draw came since; dragged off or gone still picks
nothing.

From Coffemon's patch on #3922 (JoeyWu-tech, fix/3922-segs-newest,
c1b5575af and e8c831736): the test's new redrawn-twice case, reveal()
waiting for each wheel's scroll to land, and the README entry, taken as
is. The app.js change is his, shorter: his kept b when still there and
looked up the newest self otherwise (+298 bytes); the lookup finds b
itself when b is still there, so it is used alone (+129 bytes). Main's
core had 18 bytes of room left when this landed; TestCoreScriptBudget
is green and no budget is raised.

What was run (mote, Playwright 1.62.0, Chromium and WebKit, en, zh, ja,
de, 900 and 440px):
- The new test on main's app.js: 22 of 42 red, both engines.
- With this change: 42 of 42.
- Broken by hand (the newest self's option taken as [0], not p.i):
  Chromium 17 red.
- go test -run TestCoreScriptBudget ./internal/gui: ok.

Not tried: the real app's webview, or a loaded Mac.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:58:22 +08:00
yetone ae03279458 masking: the local model is on by default; the rules mask alone until it is downloaded
The owner's plan (10-28, after the xuanwo/_kaichen reports under the
masking demo): with AstrLink Guard picked, the Chinese-name heuristic
is off and only nicknames like 小王/老李 stay a rule; with Privacy Filter
it is as before; every format rule stays; the model is on by default,
masks with the rules alone until its download finishes, and no longer
answers 503 for it.

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

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

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

Not tried: a real default download in a sandbox HOME (the tests fake the
model). Known limit: a user who turned the model on before model picks
existed and then deleted it has no name or files left, so reads as new
and gets the default on.
2026-10-28 16:55:24 +08:00
yetone a1f06bd780 gui: a browser tab offers the fonts of the computer it runs on (Norcleeh)
Norcleeh (Discord #general): magpie in Docker, used through the web GUI,
Settings' font menu doesn't list the fonts he installed on his own
computer; the app does. Cause, confirmed in the code: a tab's list is
/api/fonts, the server's families (none in a nogui build such as Docker)
plus commonFamilies, filtered by what the browser draws. A family that
is only on the browser's computer was never offered, and a choice the
server doesn't list was dropped by desktopFonts.available.

Now (webfonts.js, which only a browser tab loads; the app's windows are
unchanged):
- Where the Local Font Access API is (Chromium on https or localhost),
  the press that opens a family menu calls queryLocalFonts() once a
  page, and at load when the local-fonts permission is already given.
  The families join the list with their real styles ("SemiBold
  Condensed Italic" -> weight 600, 75%, italic).
- Elsewhere (Safari, Firefox, a plain-http LAN address, a refused
  permission) the menu's search says "Search or type a font name…" and
  offers Use "name" for a family the list lacks, enabled when the canvas
  probe says this browser draws it, greyed with "This browser can't find
  this font" when not; Enter takes it.
- A chosen family the server doesn't list stays in the tab's list on
  later loads while the browser draws it, so it keeps being applied.
- The app's menu (openProtoMenu), never a <select>. Strings in zh,
  zh-TW, ja and de. docs/subsystems/gui-shell.md says so.
Budget: no raise. here() moved out of fonts.js into webfonts.js, which
isn't a core script: loadFonts import()s it in a tab only (the page has
no CSP). The core is 106 bytes smaller than origin/main's.

Run (mote-run). At this head on e8c7dddcb: gofmt, go build ./... and
-tags nogui, go test -run 'Font|Budget|Boot|Asset' ./internal/gui
./internal/fonts ok; fonts, i18n-keys, web-page, settings-general,
inner-scroll-contain 114/114. Earlier, on 6af83172d (with a <script>
loader in place of the import):
- fonts, font-cascade, win-fonts, i18n-keys, settings-* (10 files),
  text-size, web-page, web-app-standalone, mobile-web, gui-de, gui-ja,
  gui-zh-tw, menu-scroll, omarchy, proto-menu-overflow: 311 tests
  before the rebase, 300 ok. Red: mobile-web's 8 "desktop
  matches origin/main" subtests (they read origin/main through git, and
  a mote-run copy has no .git), and settings-lines-wrap webkit zh 440px
  (a Models tab press timing out at 8s under load). At the rebased
  head: fonts, i18n-keys, settings-general, web-page,
  settings-lines-wrap: fonts' WebKit half and a lines-wrap zh-TW press
  timed out at mote load ~210 (the box then rebooted); rerun at load
  ~14, fonts WebKit 21/21 and settings-lines-wrap 20/20, the rest of the
  first run ok. The 8s press is filed as #4026.
- New tests in fonts.test.cjs, Chromium and WebKit, en and zh, 1000px
  and 440px: "a browser tab lists the fonts of the computer it runs on"
  (queryLocalFonts stubbed: not asked before the press, asked once in
  it, families and real styles offered, applied, no settings POST) and
  "a browser tab takes a typed font when the API is missing/refused".
  All 16 red on origin/main's assets (MAGPIE_FONT_ASSETS): this
  computer's families not offered, the search not taking a name.
- Broken by hand: merge() without the tab's own chosen families: the
  typed tests go red at "kept across a reload, though the server lists
  no such font" in all 8 cases.
- go build ./... and -tags nogui, gofmt -l, GOOS=linux go vet -tags
  nogui ./internal/gui, GOOS=windows go vet ./internal/gui ok; go test
  -tags nogui -run 'Font|Budget|Boot|Asset' ./internal/gui
  ./internal/fonts ok.
- Real use on mote: a nogui `magpie web` in a sandbox HOME (server list
  57 common families). Chromium with local-fonts granted: 204 families,
  185 only on this Mac; Baskerville picked, drawn, kept across a reload.
  WebKit (no API): typed Didot, offered and taken, kept across a reload.

Not tried: Chromium's real permission prompt (Playwright grants it),
Firefox, a browser on another computer than magpie's, a Docker image
run, the full Go suite (no Go change).
2026-10-28 16:55:01 +08:00
yetone 9e33962c05 gui: Settings has Reduce motion, stilling magpie as the system's does (#3813)
CupOfBread asked for a switch that turns magpie's motion off to save
resources on the desktop, and linull24 saw the Routing page keep a
phone's browser busy. magpie already stills its animations under the
system's Reduce Motion: 46 @media (prefers-reduced-motion: reduce)
rules across app.css and the plugins' styles, and calm() in the
scripts. Settings -> General now has "Reduce motion" (Off / On) that
does the same without the system setting.

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

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

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

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

Not tried: the real Linux (WebKitGTK) and Windows (WebView2) apps; the
setting changes only which existing CSS rules apply. old-webkit's
"Safari 15.0" check is red on origin/main from c490165b1's :has() in
.proto-menu (#4020), not from this change.
2026-10-28 16:50:16 +08:00
yetone ceaebd6b0b gui: Codex's descriptions, predictions and titles pickers are one function
renderCodexDescriptions, renderCodexPredictions and renderCodexTitles
were the same 20 lines three times, differing only in the setting's key,
the button's label, the Off note and the API path. They now call one
codexSidePick(s, key, aria, none, path). Each picker builds the same
button, options and request as before, in the same #<key>Pick slot.

It takes about 1.5KB out of the core scripts, room that the next commit
(#3813's Reduce motion) needs under TestCoreScriptBudget, which stays
where it is.

Run on mote at the tree of this and the next commit (before the rebase
onto origin/main; rerun after it is in the next commit's body):
codex-descriptions, codex-predictions and codex-titles in every engine
and language they cover, with reduce-motion, settings-general, i18n-keys
and routing-live-calm: 56 pass, 0 fail. go test -run
"TestCoreScriptBudget|TestAppScriptBudget|TestSettings|TestBoot|TestI18n"
./internal/gui ./internal/settings: ok. An earlier run of the same files
on a mote at load 30 to 56 timed the browsers out at 180s (webkit zh
passed there in 128s); the rerun after mote restarted passed whole.
2026-10-28 16:47:07 +08:00
yetone e8c7dddcb4 notices: the release carries the third-party licence notices
The owner asked for the licence notices in the release package (moejs
alpha.11 compiles Intl's data in, which carries its own notices).
THIRD_PARTY_NOTICES is embedded in the binary (main.go, //go:embed) and
handed to internal/notices; `magpie licenses` prints it, GET /api/notices
serves it, and Settings › About has an Open-source licenses row that
opens it in a dialog, in every language. `make app` copies the file into
the .app's Resources too. The core's scripts are 1,527,245 bytes, their
budget raised to it with no room added; app.js stays under its own.

Run at this head (rebased on origin/main):
- win-run (Windows 11): go vet -tags nogui . ./internal/notices
  ./internal/cli; go test TestNoticesFollowMoejs (.), ./internal/cli,
  TestCoreScriptBudget (./internal/gui): ok.
- wsl-run (Ubuntu 24.04): go vet -tags nogui ./..., go build -tags
  nogui: ok.
Run at the pre-rebase head 14e2d13fb, on mote (macOS):
- gofmt; make app's copy byte-identical to the file; `magpie licenses`
  output equal to the file; GOOS=linux/windows vet and build;
  go test . ./internal/cli: ok. ./internal/gui: only
  TestMainWindowCorners red, the same on origin/main (#3949).
- about-notices.test.cjs: chromium and webkit, en zh zh-TW ja de, 1100
  and 420px: all ok.
Broken by hand: TestNoticesFollowMoejs red with the embedded file cut.
Not run: the GUI suite at this head. The rebase met main's cancelAsk
helper where showNotices sat, and the dialog's Done now uses it (the
same stopPropagation + closeConfirmAsk). The whole GUI suite at
14e2d13fb was cut off when mote went down at load ~50: the files it
reached outside About had reds, most of them 180s browser-launch
timeouts, the rest passing in other languages or the other engine; they
are run again once mote is back, and any that stay red are filed.
2026-10-28 16:40:03 +08:00
yetone 1d7ca4c6b7 gui: every scroller in every stylesheet is held to keep the wheel; Safari 15 too
碳碳双键 (ysm119, Discord): a list scrolled to its top or foot by the
wheel went on to scroll the page, "in many places". d74ef5e04 (v0.1.1839)
already marks every box that scrolls and overflows between the pointer and
its .view (`holds`, app.js) and gives it overscroll-behavior-y: contain by
one rule in app.css. This makes that a guard and closes the one engine gap:

- inner-scroll-contain.test.cjs gains a test that reads every rule in every
  stylesheet under assets (app.css, plugins.css, context.css, omarchy.css
  and plugins/*/*.css; any not linked is added) that sets overflow or
  overflow-y to auto/scroll, builds a box from each selector (each compound
  an element; body classes put on body; @media rules tried at a size they
  hold for), fills it past its height, points at it, and requires
  overscroll-behavior-y: contain. 39 scrollers hold; .view is the one left
  to chain. A failure names the file and selector.
- compat.js: Safari 15 (macOS 12's WebKit until Safari is updated, #220)
  has no overscroll-behavior, so there a wheel over a .holds box already at
  its end in the wheel's direction is cancelled. Only where
  CSS.supports("overscroll-behavior-y", "contain") is false; Chromium,
  Safari 16+ and WebKitGTK 2.52.6 (probed on the Linux VM: true) never
  register it. There the Mac's bounce at the box's end is lost.
- app.js: the six "notice or ok" status lines share saidOk, to make room
  for compat.js under TestCoreScriptBudget (core 1,526,424 of 1,526,556 at the rebased head);
  no budget raised.

Run (mote, Playwright 1.62, Chromium and WebKit):
- inner-scroll-contain: the new guard and the Safari-15 test 4/4 alone;
  in the scroll batch 7/8, the one red a Chromium launch timeout (180s).
- Scroll batch (inner-scroll-contain, routing-scroll-end, click-scroll,
  view-wheel-*, menu-scroll, context-scroll-end, provider-levels-scroll,
  heatmap-scrollbar, ledger-hscroll*, old-webkit, view-trackpad-coast):
  195/209. Reds: 9 browser-launch timeouts (mote at load 30-60 with
  ~40 other test runners), old-webkit's ":has() in app.css" from
  c490165b1 on main (#4020, not this change), view-trackpad-coast
  chromium en ("the coast must ask for more than the 250ms": 6),
  view-wheel-unheard webkit 1 subtest, menu-scroll settings de 420px
  click timeout. None of those paths registers anything new in a modern
  engine; a rerun was cut off when mote dropped off the network.
- Agent batch (agent-connect/-disconnect/-leave-magpie/-notice-lang/
  -app-restart/-connect-no-models/-connect-all-hidden/-tweak-fold,
  claude-effort, tier-effort, subagent-effort, fast-ultra,
  hidden-agent-cleared, show-unset-agent, claude-signin, i18n-keys,
  panel-routing, routing-sessions, view-middle-autoscroll): every red
  but two a browser-launch timeout; agent-connect-all-hidden webkit zh
  and ja a click timeout under the same load.
- go test -tags nogui -count=1 ./internal/gui ok (budgets); gofmt -l clean.
Broken by hand: the :where(.holds) rule and the compat.js fallback
removed: the guard red for 25 scrollers per engine, the Safari-15 test
red in both. Fallback alone removed: only the Safari-15 test red. A rule
`.sess-new-list { max-height: 300px; overflow-y: auto; overscroll-behavior:
auto }` added to sessions.css: the guard red naming it, in both engines.
Not run: the full GUI suite; the agent batch's and scroll batch's
launch-timeout reds again (mote went down mid-rerun).
Not tried: a real Safari 15.0 WKWebView (the engine's lack is faked),
WebKitGTK and WebView2 in the app, a trackpad's momentum in the app,
plugin pages in their sandboxed frames (a plugin's own scroller is
the plugin's).
2026-10-28 16:36:28 +08:00
yetoneandJoeyWu-tech 6bec526f7a gui: a key's rename saves once on Enter and never on Escape (#3944)
A provider's key name was edited in an input whose Escape drew the
editor again and whose blur saved. Chromium blurs the input as that
redraw takes it out, so Escape after typing saved the typed name, and
Enter, or Enter twice before the save answered, sent keys/rename twice.
The account rename already guarded this with a once flag. Both now go
through one helper, renameIn: Enter saves a changed name, Escape keeps
it, and whichever comes first ends it, so the blur that follows does
nothing. Taking the two copies into one makes app.js 93 bytes smaller;
no budget is raised.

From Coffemon's patch on #3944 (JoeyWu-tech, joey/fix/3944): the test
key-rename-once.test.cjs and its README entry taken as is. The app.js
change differs: the patch copied the account rename's guard into the
key rename; this shares it instead, to keep core script inside its
budget.

What was run (mote, Playwright 1.62.0, Chromium and WebKit, en and zh):
- origin/main f02d92c7b: key-rename-once 8 of 16 red (Chromium's
  Escape after typing, Enter, Enter twice; WebKit's Enter twice).
- With this change: key-rename-once 16 of 16, account-arrange 2/2,
  account-alias 20/20, api-key-usage 4/4, api-key-theme 6/6,
  key-copy 8/8.
- Broken by hand (the once guard in renameIn taken out):
  key-rename-once 8 of 16 red; account-alias hung and was stopped.
- TestCoreScriptBudget green.

Not reproduced on mote: the issue's replaceChildren page error on an
unchanged Escape and account-arrange's red; both passed on main here.
Not tried: the real desktop app's webview.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetoneandJoeyWu-tech 8c983ee7b2 gui tests: four update-* files leave WebKit's ResizeObserver notice out of page errors (#3942)
update-download-percent, update-hide, update-notes-ask and update-wait
counted every page error, and WebKit's "ResizeObserver loop completed
with undelivered notifications" (a layout that outran its observers,
no fault of the page) turned them red under load. They now leave that
one notice out, with the same filter update-release-page and eleven
other files use; any other page error still fails them.

Patch from Coffemon (JoeyWu-tech) on #3942, c5033248, reviewed line by
line and taken as is. Test only.

What was run (mote, Playwright 1.62.0, WebKit, at origin/main
f02d92c7b):
- origin/main's four files and these, each alone, twice: all green on
  both (download-percent 3, hide 9, notes-ask 6, wait 11). mote didn't
  show the notice alone, so the red wasn't reproduced here; Coffemon's
  record has it red in every WebKit run on Linux under load (Playwright
  1.58.2), the notice 18 to 20 times a run.
- A loaded try (six runs of main's four files at once, load ~115 from
  other sessions too) hung past 30 minutes and was killed, so it says
  nothing either way.

Not tried: a loaded WebKit run that finishes, on mote.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetoneandJoeyWu-tech 63aca1802e gui: PenguinHarness's logo is a tile, and the app's own icons are no logos (#3858)
icon-tile was red on main: PenguinHarness's logo (3fd7e1698) is solid
to its edges but app.css's tile rule didn't name it, so it was drawn a
size bigger than a line logo beside it. It now has its alphabetical
place in the rule. The test also measured apple-touch-icon.png and
icon-512.png, the app's own icons that manifest.json lists for a
phone's home screen, which no .ic ever draws; it now leaves
manifest.json's icons out.

Patch from Coffemon (JoeyWu-tech) on #3858, 70707eed, reviewed line by
line and taken as is.

What was run (mote, Playwright 1.62.0, at origin/main f02d92c7b):
- origin/main: icon-tile red ("apple-touch-icon is solid to its edges
  but not in app.css's tile rule").
- This change: icon-tile 3 runs, 3 of 3 each; mono-icon-redraw 5,
  models-add-and-icons 4 and agent-grip 10, all pass.
- Broken by hand: penguin-color out of the rule: red, "penguin-color is
  solid to its edges but not in app.css's tile rule"; the manifest
  filter out is main's red above.

Not tried: looked at by eye with PenguinHarness installed.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetoneandJoeyWu-tech 84ada9dc80 gui tests: phone-web's tap scrolls by code once, as view-wheel-unheard does (#3876)
phone-web's "a tap's click is no flick" scrolled by code 40px a frame
for five frames after the click. Since a6d7e02c three scrolls put back
the same way with nothing redrawn are the reader's run, given back by
design, so the last three stood and the page read 591 for 711 in both
engines. a6d7e02c moved view-wheel-unheard's case to one scroll by code
for the same reason; phone-web now does the same (200px at once).

Patch from Coffemon (JoeyWu-tech) on #3876, 916064d0, reviewed line by
line and taken as is. Test only.

What was run (mote, Playwright 1.62.0, at origin/main f02d92c7b):
- origin/main: phone-web red in Chromium and WebKit, "591 !== 711".
- This change: 3 runs each engine, 3 of 3 every run.
- Broken by hand: the click no longer ending the lifted finger's window
  (purposeUntil = flingUntil = 0 made purposeUntil = 0): red in both
  engines, "511 !== 711", so the case still guards a tap's click.

Not tried: a real phone.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetoneandJoeyWu-tech 03a8d981ea gui tests: quota-refresh-order runs again, with seven more orders (#3679)
09c0a844 (#3160) gave the quota loader and quotaRefresh three names
quota-refresh-order's VM sandbox didn't have: the top-level quotasKept,
the page's mode, and a refresh button's classList.toggle. Every case
threw "quotasKept is not defined" before testing any order, 9 of 9
red since. The sandbox now has them, and the nine cases are unchanged.

Seven cases are added for orders the loader's comments promise that
hand edits to app.js passed unseen: the tray panel keeping the merged
reading it shows (magpie.panelQuotas), Refresh now behind a read on
its way, reads serialized, a newer card's marker kept after a read
lands, a renamed reply's replaced cards kept out, a background read
taking the asked one, and one card's reply leaving another's marker.
The README lists the file among the VM tests.

Patch from Coffemon (JoeyWu-tech) on #3679, 5ac2b9f7 (five commits,
squashed here into one), reviewed line by line and taken as is; the
README hunk applied to today's README.

What was run (mote, Node 22, no browser needed; at origin/main
f02d92c7b):
- origin/main: quota-refresh-order 0 of 9, each ReferenceError.
- This change: quota-refresh-order, usage-stale-answer and
  providers-fetching-retry 38 of 38.
- Broken by hand through MAGPIE_APP_JS: keepRefreshedQuotas skipped
  (the reply taken as it came): 10 of 16 red (1, 2, 6, 8, 9, 10, 13 to
  16); the panel saving the reply from before the merge: case 10 red,
  the other 15 green.

Not run: the Go checks (no Go file), the browser suite (no browser
test reads this file).

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetone a8098a8862 gui tests: reach wheels the page over a point no inner box takes, and the routing editor is pressed once its motion has stopped (#3408, #3409)
Three Routing GUI files were red on main, bisected on mote from
b0b076421:

- routing-model-rest, 20 of 20 red since ca9b5048e (#3764). Its steps
  box now scrolls in 200px, and reader.cjs's reach sent every wheel at
  the view's centre, which sat on that box: the box scrolled, the view
  never moved, and reach gave up ("control did not come clear into
  sight", target y=1048 in a view of 826). Since d74ef5e04 an inner box
  at its end keeps the wheel too, so the pointer over any overflowing
  list stalls reach for good. wheeled now moves the pointer, before each
  wheel, to a point of the view with no box of its own that scrolls
  under it (d74ef5e04 did this by hand for routing-scroll-end alone).
- routing-intent-entry (#3408) and routing-manual (#3409), red since
  91b0be836: a group opening into its editor moves its height and parts
  for ~700ms, and the tests measured where to wheel and press while it
  moved. reader.cjs has a settled(page) now: two frames, then no running
  finite animation; both files wait on it before they measure.
  routing-pause and routing-rule-effort had the same cause (7b007e986).

Run on mote (Playwright 1.62, Chromium and WebKit), one file at a time:
- at the pushed head (rebased on dfb73a04e): routing-model-rest,
  routing-intent-entry, routing-manual, routing-scroll-end,
  inner-scroll-contain, click-scroll: 116/116.
- old code: routing-model-rest 20/20 red at f25871cdd; intent-entry
  and manual red in the bisect from 91b0be836 on.
- broken by hand: the first settled waited on the animations only,
  with no two frames first; routing-manual stayed red in WebKit
  ("element is not stable", then outside the viewport): WebKit lists an
  animation a click started a frame later.
- every GUI file that uses reach or wheelTo (89 files, before the
  rebase and before settled): 1580/1615. The 35 reds are in six files,
  and the same six are red on untouched f25871cdd run one at a time
  (118/150 there): mobile-web (#3952, it needs a .git that mote-run's
  copy hasn't, commented there), usage-ledger (#3104), routing-manual
  (#3409, fixed here), routing-rule-remove (#3094, #3096),
  routing-rules-line (#3593), segs-press-redraw (#3922). rule-remove
  and rules-line don't load reader.cjs.
- a run of the three files under load ~94 had two browsers not launch
  in 180s; routing-model-rest alone again: 20/20.

Not run: the whole GUI suite at the pushed head.
2026-10-28 16:14:28 +08:00
yetone 6af83172d3 gui: the masking demo shows no video where WebKitGTK can't play one (avk458 on X)
On Omarchy (Arch + Hyprland) without gst-plugins-good, opening Masking's
"How masking works" aborted WebKitWebProcess about 3s later: WebKitGTK
2.52.6 gives every <video>, muted ones too, an autoaudiosink, which lives
in libgstautodetect.so ("no such element factory autoaudiosink", then a
SIGABRT). The window was left frozen on its last frame ("一点就崩溃再点
magpie就卡死了").

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

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

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

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

Not tried: a Linux system with gst-plugins-good (the video path there
is unchanged); arm64 Linux. Recovering a window whose web process died
(web-process-terminated) is not handled by magpie or Wails; not in this
commit.
2026-10-28 15:25:53 +08:00
yetone d74ef5e04c gui: an inner list wheeled to its end keeps the wheel; the page stays put
碳碳双键 (ysm119, Discord): wheeling the Usage page's request list to its
top or bottom carried on into the whole page, and "this happens in many
places". It is the class: every box that scrolls inside a scrolling page.

app.js marks such a box `.holds` while it overflows vertically, on
pointerover and on each wheel (the box under the pointer and its
ancestors up to the .view), and app.css gives `:where(.holds)`
overscroll-behavior-y: contain, which keeps the Mac's bounce on the box.
Not one CSS rule for every overflow:auto box: in Chromium `contain` holds
the wheel even in a box that doesn't overflow, or is overflow:hidden, or
only scrolls sideways, so short lists and the heatmap's and ledger's
sideways scrollers would have stopped the page. The .view itself is never
marked. :where() weighs nothing, so .mchips in a short window
(@media max-height 640px, #833) still passes the wheel on.

The new test, inner-scroll-contain.test.cjs, wheels the Routing page's
requests list past each end (en and zh, 900x560 and 1300x600, under
"By session" / 未提供会话标识), and ten kinds of inner box, and asserts
the page's scrollTop didn't move. A short list, heat-scroll, led-wrap and
snip must still pass the wheel to the page. routing-scroll-end now wheels
over the page's gutter: at its view centre the pointer sat on the
requests' list, which now keeps the wheel at its end (600 of 1066).

Run (mote, Playwright 1.62, Chromium and WebKit):
- inner-scroll-contain 40/40.
- 17 files: inner-scroll-contain, click-scroll, routing-scroll-end,
  routing-sessions, view-wheel-after-click/-after-redraw/-unheard,
  heatmap-scrollbar, ledger-hscroll, ledger-hscroll-foot,
  context-scroll-end, menu-scroll, provider-levels-scroll, panel-usage,
  panel-routing, qoder-cn-tile, agent-disconnect: 268/287. Reds were
  routing-scroll-end (this change, fixed above) and panel-usage webkit zh
  (#3311, commented). Rerun of routing-scroll-end, panel-usage and
  inner-scroll-contain: 66/66.
- go test -tags nogui ./internal/gui ok (TestCoreScriptBudget passes at the rebased head:
  core under 1,526,556, app.js under 1,310,460; no budget raised).
Broken by hand: the old app.js and app.css: the requests list and every
held box red in both engines (mchips aside, it had contain already).
Only the CSS rule removed: red, "the page didn't move" x8 plus each held
box x2. Only the overflow check removed: a short rt-reqs red (Chromium),
led-wrap and snip red in both engines.
Not run: full GUI suite (mote was busy with another session's suite).
Not tried: WebKitGTK on Linux, WebView2 on Windows, a real Mac's
trackpad rubber band and momentum in the app, older macOS WKWebView,
touch; zh-TW/ja/de (no strings changed).
2026-10-28 14:54:09 +08:00
yetone f0d42fbe32 gui: one cancelAsk for a confirmation's dismiss-only buttons, one Qoder risk note
Twelve buttons in app.js (eight Cancels, three OKs and a Later) each had
their own copy of `(e) => { e.stopPropagation(); closeConfirmAsk(); }`;
they now share cancelAsk. The Qoder and Qoder CN rows carried the same
risk note twice; it is QODER_RISK now. Behaviour is unchanged. This
makes room under TestCoreScriptBudget for the next commit, without
raising the budget (core 1,526,515 of 1,526,556 before).

Run (mote): go test -tags nogui -count=1 ./internal/gui ok (budget and
asset tests). The GUI suite ran on the next commit, which holds this one.
Not tried: nothing by hand beyond the suite; the buttons' code is the
same function moved.
2026-10-28 14:53:40 +08:00
yetone a41d0d5098 redact: the demo's notebook has a square icon and its entries under the header
The owner's screenshot of the masking demo's "小鹊的小本本" box: the
notebook icon was stretched tall, and the two entries overlapped the
subtitle and each other.

- The icon carried the class "acc", which app.css already styles as an
  accounts row (flex, min-height 38px, padding), so the 22px tile came
  out 38px tall. It is xq-acc now; none of the demo's other short class
  names (on, done, hot, ok, hl, far) has an app.css rule of its own.
- The entries were placed at fixed tops (40 and 81) under a header that
  is ~41px tall in CJK fonts. They are a flowing list now, after the
  header: each entry is its placeholder pill over its value, 5px apart,
  and a highlighted entry gets a soft background instead of colliding.
  The flyers already land on the values' measured positions, so the
  animation follows.
- German's title "Notizbuch der kleinen Elster" wrapped to two lines
  in the 220px box and pushed the last entry 14px out of it (the
  existing no-clip check caught it). It is "Notizbuch der Elster".

Test: masking-demo's layout test checks every box icon is 22×22 and
that each notebook entry starts at least 4px below what is above it.

Run at this tree (a463b3ede + this change), on mote:
- masking-demo + masking-records, both engines: 110 of 110.
- gui-de, gui-ja, gui-zh-tw, i18n-keys, mask-actions, mask-emails,
  masking-demo, masking-records, redact-kinds, redact-rule-edit,
  redact-rule-row, redact-shape, redact-words-any-case,
  redact-words-whole: chromium 259 of 259; webkit 135 of 136. The red
  was mask-emails' page.goto at its 5s default on the Routing page,
  at load ~80; alone it passes 3 of 3 here and 2 of 2 on origin/main
  a463b3ede. Filed as #3995 (the class of #3525).
- Screenshots of the notebook at the demo's end in zh dark, en light,
  de light and ja dark, both engines: square icon, entries under the
  header, nothing clipped.

Rebased onto 58fb3a778 (it adds a Windows modal-backdrop rule to app.css),
then run again at the pushed tree: masking-demo, masking-records,
i18n-keys and gui-de, both engines: 117 of 117. 60520ddb3 (moejs's module path, no GUI
file) landed after; the push is rebased onto it.

Broken by hand: the old demo.js and redact.css with the new test are
red in every language (icon 22×38, gaps false); with only the class
renamed, the old fixed-top entries are still red (gaps false, false).

Not tried: the real desktop app; the change is CSS and DOM order in a
page the GUI suite loads as the app does.
2026-10-28 14:39:34 +08:00
yetone a3ee00c05c codex: its own GPT models stay in Codex's list when kept for routing groups
士奇 (Discord, 10-28): with a routing group on, the Agents page's Codex
list lost its Codex provider section and models, the model dropdown still
offered GPT, but the Codex app had none; with the group off they came back.

Cause: the codex provider's "Only through routing groups" (Provider.Unlisted,
只通过路由分组使用), or a group that lists itself alone (Group.Unlists), took
the ChatGPT account's own models out of Catalog(), so out of Codex's own
list too. With no Codex section, the own options were not magpie's, so the
own-models switch showed and the picker kept offering GPT; meanwhile #1602
(125dad5cb, CodexNativeUnlisted) dropped every one of them from the list
handed to Codex (backend /models, the model_catalog_json desk file,
spawn_agent). The picker and the app disagreed.

Why the earlier fixes missed it: aa766289b only stopped the GUI folding a
provider, and 508911e43 (TestCodexOwnModelsStayWithGroupOn) only kept
Served own options in the picker. Both covered a plain group; neither
touched Catalog's unlisting for Codex or the desk list's #1602 filter, and
neither test set Unlisted or Unlists.

Fix: Codex's lists start from catalogOf("codex"), which keeps CodexOwn
entries (ListedFor/CatalogFor, CodexNativeHidden, CodexOrder), and
CodexNativeUnlisted is removed with its filters in codexMerged,
spawnChoices and the list tag. Other agents and /v1/models still don't
see unlisted GPT models (checked for Claude Code in both tests).

Behaviour change for #1602: an unlisted codex provider no longer hides GPT
from Codex. The way to hide them from Codex is Codex's own list (its Codex
section's hide / only-picked), which CodexNativeHidden still applies; the
rewritten gateway test checks that and the ETag change.

Tests:
- gateway TestCodexModelListKeepsOwnForGroups (rewrites
  TestCodexModelListUnlistedForGroups): group Unlists and provider Unlisted
  keep gpt-6-sol/gpt-5.5 in Codex's /models and spawn_agent; Claude Code
  doesn't list them; hidden in Codex's list it goes and the ETag changes.
- gui TestCodexOwnModelsListedOnlyThroughGroups: agentModelList has the
  Codex section (Own) for every model, OwnModels is false, the picker has
  them, Claude Code doesn't list the unlisted ones.

Run (mote-run, -tags nogui): go build ./...; go vet for darwin, GOOS=linux
and GOOS=windows on provider/gateway/gui/agent; gofmt -l clean; go test
./internal/provider ./internal/gateway ./internal/gui ./internal/agent: ok.
Broken by hand: the five source files reverted to f20118304 with the new
tests in place: both tests red (gateway: gpt-5.5 and every own slug gone,
spawn offers only group/mine; gui: no Codex section, own switch shown).
Real codex 0.162.1 in a sandbox CODEX_HOME: `codex debug models` with
model_catalog_json pointed at the desk file CodexDesktopCatalog wrote with
the provider Unlisted and an Unlists group lists gpt-6-sol, gpt-5.6-sol and
group/mine (the old code dropped both GPT slugs).

Not run: full suite. Not tried: GUI Playwright files (no page changed), a
live ChatGPT sign-in or the Codex desktop app itself.
2026-10-28 14:26:18 +08:00
yetone 7323255b4e gui: the Windows app's confirmation backdrop goes without blur too (#3980)
Henry-916's change (the commit before) took the blur off the provider
editor's full-window backdrop in the Windows app, where WebView2 on an
Intel UHD D3D11 GPU stalled under it. The Remove/Sign out confirmation
(.action-confirm, a <dialog>) blurs the whole window behind it the same
way through ::backdrop, so it is scoped out by the same win/web rule.
modal-backdrop.test.cjs now shows that dialog and checks its ::backdrop.

Not changed: .pop, the panel's open profile chips and Settings' sticky
header blur too, but over a popover's or a header strip's area, not the
window's; nothing measured them as slow.

Run at this head (mote):
- node --test modal-backdrop: 24 of 24 ok. Broken by hand (the
  ::backdrop selector dropped): both Win32 desktop cases fail "nor the
  confirmation's".
- chromium: modal-backdrop, dialog-backdrop-drag, segment-press-dialog,
  gui-zh-tw, gui-ja, gui-de, i18n-keys, codex-signout,
  account-discovery: 93 ok, 0 fail. The same less modal-backdrop and
  i18n-keys with BROWSER=webkit: 37 ok, 0 fail.
- go test ./internal/gui: one red, TestMainWindowCorners/macOS_26_SDK on
  macOS 27, filed as #3949; nothing in it reads CSS.

Not tried: the real Windows app; the reporter measured the modal's
blur there (67 → 165 rAF callbacks a second).
2026-10-28 14:24:40 +08:00
Henry-916 824100f30f gui: keep Windows modal backdrops responsive without blur
Disable full-window modal backdrop filtering in Windows desktop windows
and tray panels, retaining the dimming veil. Browser pages and other
platforms keep their existing blur through the existing win/web markers.
Document the platform behavior in the GUI shell reference.

On an affected 0.1.1805 installation with WebView2 155.0.4283.62 and Intel
UHD D3D11, disabling the filter made provider tests visibly responsive.
The reporter confirmed the improvement. Scripted scrolling measured
roughly 67 to 165 rAF callbacks/s, not presented FPS.

Verification: modal-backdrop.test.cjs fails on the original CSS in both
Windows desktop Chromium cases (blur instead of none), with the other
10 cases passing. After the fix, 45 targeted tests pass across
Chromium and WebKit: modal-backdrop, dialog-backdrop-drag,
segment-press-dialog, gui-zh-tw, gui-ja and gui-de. node --check and
git diff --check pass. The full GUI suite, Go vet/build/test matrix and
native macOS/Linux tests were not run.
2026-10-28 14:24:40 +08:00
yetone 7b007e9866 gui tests: routing-pause and routing-rule-effort press once a group's editor has opened (#3410, #3411)
Both were red on main since 91b0be836 (10-23), filed as #3410 and #3411
with no owner. Bisected on mote from b0b076421 (green) to 3b10a403d:
91b0be836 is the first red. It opens a group's row into its editor in
~700ms of motion. press() read how far to wheel the page while the
editor was still growing, found it near enough, and clicked where the
target ended up after the growth: at y 3108 in a 1400px window, so
nothing. press() now waits for every finite animation to end before
it measures.

That let "a rule that pauses a model at some hours" reach its Save,
where c888ef272 (10-25) saves hours set in the browser with its zone.
The fixture never saw it, as the test stopped before. The page's zone
is pinned to Asia/Tokyo and the edited rule expects it; the untouched
rule keeps none.

Run on mote at this tree (origin/main 7b63feb90 + this):
routing-pause and routing-rule-effort --test-concurrency=1, both
engines, every language: 32/32. At 7b63feb90: 4 pass, 28 fail; the
same at 7dcc0aedc^, so not #3955.
Broken by hand: the wait moved after the measure (where the 300ms
settle was): 28 red again.
Not fixed here: routing-model-rest, -intent-entry, -manual, -row-swap,
-rule-drag are red alone on main too (16 pass / 28 fail), looked at
next.
2026-10-28 13:55:32 +08:00
yetone f201183047 tune: the compact window is Long conversations, one value for both agents
7eleven (Discord #help): the Usage page's "Tuned for you" compaction
value and the agents' sheet "Long conversations" window were two values
that could disagree. Codex's tune wrote model_auto_compact_token_limit
into config.toml beside the catalog's context_window that Long
conversations writes; Claude's read its own env.

One source of truth: settings.CompactAt / FullContext. Tune's compact
row for Codex and Claude Code now has source "long": its Current is
settings.Compact(), Use calls provider.SetCompactAt (Sync writes Codex's
catalog and Claude's CLAUDE_CODE_AUTO_COMPACT_WINDOW as before), Undo
puts back the CompactAt/Full it stashed under tune.long.compact. So a
value set on either page shows on the other and writes the same config.
writeCompact marks claude.compact_long when the env value came from
settings, so Claude's row reads it as ours, not as the user's.

Migration (Codex Sync, local place): an old tune.codex.compact stash
whose limit is still the one tune wrote moves into Long conversations.
At default or Full it takes tune's value; with a value the user set it
takes tune's only when smaller. config.toml gets the user's earlier
limit back or loses the key; the stash is forgotten. A limit the user
changed after tune wrote it, or wrote themselves, stays and reads
Locked. A provider's Compact at or the user's own Claude env stays
Locked too.

Run (mote, at this tree):
- go vet on agent, provider, gui, tune; GOOS=linux go vet -tags nogui
  ./...; GOOS=windows go vet ./...; go build ./... and -tags nogui: ok
- go test -tags nogui ./internal/agent ./internal/provider
  ./internal/tune ./internal/gui: ok (TestCoreScriptBudget within the
  budget, not raised; context.js is 33 bytes smaller)
- GUI: compact-one-value.test.cjs (new; Chromium and WebKit, en zh
  zh-TW ja de) and context-tune: 104/104 at the rebased head
Broken by hand: the Codex long branch, the Claude long env check and
the Sync migration call each turned red TestClaudeCompactAt,
TestCodexHomeEnvTakesThePick, TestTuneCodexCompact,
TestTuneCodexOwnLimit, TestTuneCodexMigrate (4 subtests),
TestTuneClaudeLong and TestTuneCodexMigrateOnSync. Old context.js and
i18n.js turn compact-one-value red ("You set 272K").
Not run: full suite, Go or GUI (shipped at once per owner; the GUI suite
is still running on mote, reds get their own issues).
Not tried: a real Codex or Claude Code session reading the written
config; the migration on Windows/WSL places (it runs for the local
place only).
2026-10-28 13:52:08 +08:00
yetone fcbbb8e479 gui: the start's warm-up and read-ahead look at each file once a second (#1665)
The warm-up after a start (sessions, usage, Codex effort) and the usage
read-ahead asked for settings.json, logins.json and the rest for each
session and row they read: a Windows sandbox's second start stat'ed
settings.json 677 times in 25s, 286 of them settings.load and
AccountDiscoveryOff under the warm-up. Both now hold what was read
(filememo.Hold), as the GUI's requests and a catalog sync's round do. A
write still reads the disk (edit.Read, settings' writes, logins.json
under loginsMu), so nothing is written from a held read; a file another
app changes is seen up to a second late while they run.

Measured on xiaomi-gpu (Windows 11), an empty sandbox HOME, magpie web
--gateway, second start, 27s, with a build counting each look at the
disk (instrumentation not committed):
  before   1113 looks, settings.json 677
  after     483 looks, settings.json 114
The catalog sync's round stays at ~100ms.

Run:
- TestWarmUpHoldsWhatItReads: red with the warm-up's Hold taken out by
  hand (the second read saw the other app's change), green with it.
- mote: gofmt -l internal/gui clean; GOOS=windows and darwin go vet
  ./internal/gui and GOOS=linux go vet -tags nogui ./internal/gui clean;
  go test -count=1 ./internal/gui ./internal/usage: usage ok, gui red
  only on TestMainWindowCorners (#3949, mote's macOS 27, red on main
  before this).
2026-10-28 13:51:37 +08:00
yetone 1a8048592e providers: a search for a model keeps the providers serving it and names the model under each (frankdeng, Neo)
frankdeng (Discord #general) wanted to type a model (opus 5.5) on the
Providers page and see who serves it; Neo had two providers serving
opus5.5 and couldn't tell which. The search already matched model ids,
but as one blob of the provider's text: "opus 5.5" kept a provider with
claude-opus-4-1 and gpt-5.5, and one with Opus 5.5 switched off, and no
row said which model matched.

Now the words a row doesn't say itself must all be one model's that is
on, separators aside ("opus 5.5", "opus5.5", "Opus-5.5" find
claude-opus-5-5 and opus-5.5), and the row gets a muted line "Serves
<ids>" (the existing .sub style, clipped with "…"). A search on the
provider's own name, host, account or key names no model. Changed: a
provider whose only match is a model it has switched off no longer shows.
"Serves {models}" is in zh, zh-TW, ja and de.

Size budgets not raised: renderProviders no longer sets the lists'
visibility and the fold's state, which findProviders (called at its end)
set again; findProviders' two branches for that are one. Core scripts
1,526,548 of 1,526,556; app.js 1,309,717 of its budget.

Run on mote, at this head (rebased on 8c5c83c9f):
- go build: ok. go test -tags nogui -run TestCoreScriptBudget
  ./internal/gui: ok. Before the rebase, go test -tags nogui
  ./internal/gui (whole package): ok.
- node --test provider-find-model, provider-find, i18n-keys: 28 pass,
  0 fail (Chromium and WebKit, en zh zh-TW ja de, 380px wide).
Broken by hand: with the model match taken out (hits always empty) the
new test fails on "opus 5.5" (actual [], expected anthropic, relay-a,
relay-off with their lines); against origin/main's app.js it fails with
relay-b and relay-c shown and no "Serves" line.
Not run: full GUI suite, full Go suite (shipped at once per owner). A
run of the 231 GUI files that reach the Providers list is still going on
mote; reds from it get their own issues.
Not tried: the real app with real providers.
2026-10-28 13:16:25 +08:00
yetone 8b95f7c3a9 usage: a subscription's windows are grids of their own, not a rows subgrid (#3955)
Each quota window was a subgrid of three rows of .quota-windows, so the
bars of two windows side by side lined up when one's name wrapped. That
is the layout that crashed Safari 16's WebKit sizing the Routing
requests (#3731). Now each window is a grid of its own. fitQuota, which
already runs a frame after the windows' ResizeObserver to stack the
counts, also gives each window's names the height of the tallest beside
them. The subgrid left 9px between a bar and its reset line, not the
4px the CSS declares, in both engines; kept, so the card looks as it
did.

quota-window-rows (new) checks that no rule of the windows says
subgrid, and at 1100, 700, 390 and 1100 again, in both engines and
every language, that the bars of each row start at one y with a long
name wrapped beside a short one, that the names sit above the bar, and
that a reset line starts 13px under its bar's top.

Run on mote at this head (on 6e331afb4):
- quota-window-rows: 11/11. At origin/main's assets 10/11, only the
  subgrid check red, so the bars and spacing are the same. Broken by
  hand (no min-height): 10 of 11 red, bars at 391 and 377.
- The 90 quota-, panel-quota-, usage-, balance-parts, plugin-plan,
  account-mask and i18n-keys files: 1146 pass, 43 fail. The red files
  are red alone on origin/main too, the same counts: quota-count-wrap
  2 (#3404), quota-refresh-order 9 (#3679), usage-agents-hide 22
  (#3414), usage-ledger 6 (#1876). usage-overview-fold is flaky on
  both: 2 and 3 red on main, 3 and 5 here (#3947).
- node --check app.js: ok. go test -run Budget|Asset|CSS ./internal/gui:
  ok; TestCoreScriptBudget held without a raise (the addition was
  compacted to fit, 1526556 bytes or under).
- After that compaction: quota-window-rows and account-mask 15/15; all
  quota-* files plus i18n-keys 163 pass, 11 fail, the same
  quota-count-wrap and quota-refresh-order reds as above.

Not tried: a real Safari 16 (no macOS 13 machine).
2026-10-28 13:05:14 +08:00
yetone 5ced5b1aa0 routing: a wallet's row says what of it lapses first, as the Usage card does (#3964)
MYCF711's SuperMagic plugin (magpie-magicrew-auth daca18e) sends a
balance window 积分余额 with runsOut, and 今日 / 限时 / 永久 as aside
rows. The Routing page already showed all four rows, in the stage row's
tooltip and the account list's .wins line, both through cardOf/winsOf
(the Usage page's own readings). The row's own text said only
"6,291 积分 left". For a wallet seat, quota() now adds the Usage card's
runsOutText for the card's window of the same balance and unit:
"6,291 积分 left · 185 积分 expire 23:59". It is client only. The
Go side (allowanceOf, Weighed) is unchanged, because the aside rows are
display only and routing weighs the total.

Run (mote, at 7b63feb90 + this):
- routing-wallet-lapse.test.cjs (new, the reporter's literal windows):
  chromium + webkit, en/zh/zh-TW/ja/de, 1100 and 420px, 22/22 ok.
- Broken by hand (quota without lapses): 11/11 red in chromium,
  expected '750 积分 left · 50 积分 expire Thu 02:06', actual
  '750 积分 left'.
- routing-wallet-balance, usage-wallet-balance, i18n-keys: ok.
- Every routing-*.test.cjs (124 files) + the two above: red only in 12
  files that are red the same way without this change at 4655e1659
  (83 fails there) and that have open issues: routing-intent-entry
  #3408, routing-manual #3409, routing-pause #3410, routing-rule-effort
  #3411, routing-steady #3412, routing-row-swap #3799, routing-model-rest
  #2115, routing-rule-drag #3789, routing-rule-remove #3094/#3096,
  routing-rules-line #3593, routing-story-shrinks #3954,
  routing-wb-restricted #1905. Mote was at load ~16-28 with another
  session's suites.
- go test -tags nogui ./internal/gui/ (budgets): ok.

Not run: the full Go suite and the whole GUI suite (another session's
were on mote; this commit touches no Go). Not tried: a real SuperMagic
account, or the Windows/Linux app.
2026-10-28 12:40:16 +08:00
yetone a68f3ee45d provider: a signed-in account keeps its price rate (PaulT, Codex)
PaulT on Discord (#help): "v0.1.1805版本codex价格倍率有bug 无法保存".

Save rebuilt a signed-in account (Codex, Copilot, Claude, a plugin's
subscription, Kiro) from a fixed list of fields, and PriceRate wasn't on
it; withPicks didn't read it back either. The editor's Save answered ok,
nothing was written, and the field came back empty. Not a v0.1.1805
regression: it has been so since the rate was added (41ed1c95b, #819).
A key provider was never affected. Both places now carry it, so the
Usage page counts an account's models at its rate too.

Tests:
- TestAccountPriceRateKept (provider): Codex and Copilot keep a rate,
  are priced at it, and clearing it gives the list price.
- TestAccountSaveKeepsPriceRate (gui): the Codex editor's save body as
  the GUI posts it, read back from /api/providers (0.8, 1.5, null).
Broken by hand: both red on the old provider.go ("saved 0.8, read back
0"); dropping only the withPicks line turns the first red too.

Run (mote-run, at this head rebased on 7b63feb90):
- go test -tags nogui -count=1 ./internal/provider/ ./internal/gui/: ok
- go build ./...: ok; gofmt -l: clean

Not run: full suite / GUI suite (mote busy with another session's full
GUI suite). app.js is unchanged; the GUI's price-rate test mocks the API.
Not tried: a real Codex account in the running app.
2026-10-28 12:39:39 +08:00
yetone 7b63feb908 gui: a browser tab's font rows show on a nogui magpie, and Text size no longer flashes
Norcleeh (Discord #general, after v0.1.1788): in magpie's web GUI the
interface-font and code-font rows "flash once and disappear" on refresh.

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

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

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

Not tried: a Windows server with the fix (old code showed the rows),
WebKit over a LAN tunnel, Brave/Safari fingerprinting modes, the full
Go suite.
2026-10-28 12:25:39 +08:00
yetone 98e23350f1 gateway: a key's limit lines are read again while the page is open
Young (Discord #feedback, v0.1.18xx) reset his gateway keys' usage
(three keys held to 2-3 models, $30 per 5 hours, $153 per 7 days and a
token cap per 30 days) and their lines read "$0.00 / $30.00" from then
on, while Usage's gateway-key section showed the same keys spending.

The cause is in the GUI: the Gateway page read /api/caller-keys, where
each key's used limits come from, only on a visit to the page (the
`open` hook). Coming back to the window and Refresh re-read providers
(`render`) but not the keys, and nothing ticked, so a page left open
after Reset usage kept the $0.00 it drew then. The app reopens on its
last page, so it could read $0 for days.

Now refreshGatewayKeys reads the keys again from `render` (the window
back, Refresh) and every 15s while the Gateway page is in sight and a
key has a limit, as Usage's own timer does (#3185). The list is drawn
again only when the keys changed, and never over a key being added,
renamed or its limit edited, nor while an action is on its way.

The gateway side was checked first and counts right: a probe test with
Young's key shape (model scope incl. a group, $ and token limits),
reset, the budget cache dropped as a restart does, and requests on
chat/completions, messages and responses, streamed and not, counted
every call into each limit's window. The probe is not committed.

Test: internal/gui/tests/gateway-key-used-live.test.cjs, Young's key
shape, chromium and webkit, en and zh: the line goes from $0.00 to
$9.93 on window focus, to $12.50 on the timer, and an open limit editor
keeps its typed value and focus through both.

Run on mote:
- the new file: 4 of 4 ok.
- every gateway-*, connect-* GUI file and i18n-keys, both engines
  (262 tests): 259 ok. The 3 reds are the same on the base without
  this change and filed: gateway-caller-keys webkit en and
  gateway-key-models chromium/webkit en at 560px (#3797), i18n-keys
  "Runs as" (#3897).
- go test -tags nogui -timeout 45m ./...: 76 packages ok, exit 0, at 5ed6669ce plus this change.
- after rebasing on 6f0e40572 (two commits, neither in the gateway
  page): go build ./..., the new file with gateway-key-limits and
  i18n-keys (28 of 28 ok), and internal/gui's Go tests 3 times at
  -count=1: 2 ok, 1 red in TestRestartHandsTheGatewayOver (a request
  reset during the handover, #3451, not from this change).

Broken by hand, each red in the new test:
- render not calling refreshGatewayKeys: red at the focus step.
- the timer at 15e6 ms: red at the timer step.
- refreshGatewayKeys drawing over an open editor: red (focus lost).

Not covered: Young also says Usage's per-key spend stays still while
the Overview's gateway tokens move. Usage reads its own data on its own
timer, so this change doesn't touch that. The Overview counts every
gateway call, keyed or not, while a key's row and limits count only
calls that carried that enabled key. A loopback call (an agent here, or
a TCP forward like frp tcp or ssh -R to the gateway's port) with a
stale or rotated key is still answered, by design, but is counted under
no key. Whether that is Young's case is not known yet.

Not tried: the real app with a real key over hours.
2026-10-28 12:17:18 +08:00
yetone 0c973cd9a4 usage: the Sessions bars are rows of their own, not a subgrid (#3955)
The Sessions overview's bars (Projects, Models, Tool use) and Top
skills were each a subgrid of their card, the same layout that crashed
Safari 16's WebKit sizing the Routing requests (#3731). Each row is now
a grid of its own. sessLineUp reads each column's width with the rows at
their natural width, once, when the card is first shown, and sets it on
the card as --sb<i>. The widths don't change with the window's, and text
size is the window's zoom, so it never measures again on a resize. The
@supports not (subgrid) fallback is gone: Safari 16 has subgrid, so it
never helped.

sessions-bar-names now checks that no rule of the bars says subgrid,
that every row's bar starts and ends at one x (wide, at 420 and wide
again), and runs in every language, not only en and zh.

Run on mote at this head:
- sessions-bar-names: 41/41 pass. At origin/main's assets
  (MAGPIE_SESS_ASSETS) 40/41: only the subgrid check fails, so the bars
  line up as they did.
- Broken by hand (sessLineUp returns at once): 20 of 21 red, bars' left
  at 527,338.
- sessions-overview, account-mask-sessions, i18n-keys: pass.
- go test -run 'Budget|Asset|CSS' ./internal/gui: ok.
- node --check page.js: ok.

Not tried: a real Safari 16 (no macOS 13 machine). Next for #3955:
.quota-windows .quota's rows subgrid.
2026-10-28 12:09:02 +08:00
JoeyWu-tech 6f0e40572c gui tests: a plugin's words are its own when said as words (#3897)
yetone (#3897): i18n-keys' "a plugin's words are its own" is red on main
since 7f827b3b0, with 'plugins/library/i18n.js "Runs as":
internal/cli/claude_code_cli.go says it too'. claude_code_cli.go doesn't
say Library's "Runs as": 7f827b3b0's comment "// fetchClaudeRuns asks
the gateway at base for its Claude Code runs" holds it, across a
function's name and the next word, and the check took a key found
anywhere in a file's text, inside a longer word too, as said there.
internal/gateway/claude_runs_test.go's "listClaudeRuns asks" holds it
as well.

The check now counts a plugin's word where it stands as words: a
letter, digit or _ just before a key that starts with one, or just
after a key that ends with one, makes it part of a longer word. A key
said in a string, a comment or markup counts as before, and goes back
to i18n.js. docs/subsystems/plugin-runtime.md says so.

What was run (tree 26d67096, on origin/main e056779a, Node 22.22.1):
- i18n-keys (Node's test runner, no browser) at e056779a, twice: "a
  plugin's words are its own" red with #3897's line, the other three
  tests ok. Here, 6 runs: 4 of 4 each.
- Broken by hand in claude_code_cli.go, a line added and then removed:
  - "// Runs as the gateway asks.", the key said as words: red, with
    'plugins/library/i18n.js "Runs as": internal/cli/claude_code_cli.go
    says it too'.
  - "// fetchClaudeRuns as the gateway asks." and "// Runs asks the
    gateway.", the key glued to a longer word before it or after it:
    4 of 4.
- No Go file is changed and no other test reads this file, so the Go
  suite was not run for it.

Taken from JoeyWu-tech's patch on #3897 (fd49dcc0f; the format-patch
sha256 matches the one posted there), cherry-picked as is onto origin/main
7dcc0aedc. Run again on mote at that head: i18n-keys 4 of 4; with
"// Runs as the gateway asks." added to claude_code_cli.go by hand, red
with #3897's line.
2026-10-28 12:01:47 +08:00
yetone 7dcc0aedc6 routing: a group's rules line up without a subgrid, as the requests do since #3731 (#3955)
Each .rt-rule was a subgrid of the rules list with a fit-content(50%)
conditions column, the shape gpboyer2's Safari 16 crash stack showed for
the request rows (#3731). Now the list is a flex column and each rule is
a grid of its own on 16px fit-content(50%) minmax(0, 1fr) auto. Its
conditions are at least --rt-condw wide: fitConds takes the property off,
reads each rule's conditions width under its own fit-content(50%), and
sets the widest, rounded up to 1/64px, on the list. It runs when the
rules are drawn, and a frame after the list or a rule's conditions
change size (ResizeObserver, disconnected on each redraw so rules drawn
before are not held) or a condition is typed into. Under 640px the
property is unused (min-width 0), as the layout there was its own before.

New test routing-rule-columns: no rule of the rules' CSS says subgrid;
in both engines and five languages, every rule's → and its conditions
start at one x at 1100, 900 and 700px; at 390px what a rule does is under
its conditions and nothing passes the editor's side; an intent typed
longer moves every rule's → right, and shorter again back left, still at
one x.

Run on mote (Playwright 1.62.0, Chromium and WebKit). At the rebased
head on origin/main 5ed6669ce: node --check client.js ok;
routing-rule-columns and routing-own-columns 16 of 16 ok, one at a
time; i18n-keys 3 ok, 1 red, "a plugin's words are its own", which is
#3897 (red on main since 7f827b3b0, not this change). Before the rebase,
at cc04ce68c: routing-rule-columns on the assets before this change
fails only its CSS check (the subgrid lines up as this does), and with
the min-width rule taken out by hand its four en/zh cases go red. The
seven routing-rule* / routing-rules-line / routing-own-columns files,
head then base back to back under another session's GUI suite (load
16 to 28): head 80 ok 33 red, base 87 ok 26 red. Of the reds only
on head, eight are routing-rule-remove; run alone one at a time it is
red 8 of 20 on base and fewer on head, the flakes filed as #3096 and
#3094. The rest (routing-rule-effort narrow #3411, routing-rules-line
under load #3593) are red on base too.

Not tried: a real Safari 16 on macOS 13 (no such machine here), so the
crash itself is not reproduced for the rules; the shape it had is gone.
2026-10-28 12:00:01 +08:00
yetone 396e0e4638 usage: a deleted provider's requests merged into another, or named, from the Requests filter
CyberCaius on Discord: a deleted provider's requests sat under its old id
("<date> 已删除"), and the only way to put them under a provider they
have was renaming that provider onto the old id. Now, with a deleted
provider picked in Usage › Requests' Provider filter, a "…" beside it
offers Merge into… (an app menu of the providers there are now) and
Rename… (the filter's button turns into a name field; Enter or leaving
it saves, Escape keeps it). With the merged-into provider picked, the
same "…" lists Separate <name> for each, the undo.

Nothing in the log is rewritten. Both live on the deletion's own record
in providers.json (Deleted.Into/MergedAt, Deleted.Label), so a provider
added later under the old id inherits neither: it is a different
provider, and its record of its own is what it has. Renaming the target
carries the merge (Rename rewrites Into); deleting the target ends it.

Renames.Both(id, time) gives the id a call is shown under and the one it
was made to (Own). Listing, filtering, the summary and vias go by the
shown id; pricing (Record.priceID, block_price's as), window holds and
the gateway's loggedAnswers go by the own one, so a merge moves no cost
or token, only whose name they sit under. The target's face lists what
was merged into it (Named.Merged). Routes: GET /api/usage/deleted/into,
POST /api/usage/deleted {id, into?, name?}; a field not sent stays.

Run (mote, at this tree on d50f84c9f):
- go test -tags nogui -timeout 45m ./... : every package ok, exit 0.
- GOOS=linux and GOOS=windows go vet -tags nogui on usage, usageapi,
  provider, gui, gateway: ok. gofmt -l clean.
- New: TestDeletedProviderMergedIntoAnother (usage: cost 306 before and
  after the merge, 3 calls under main, coster/pricer price a relay call
  at its own price, a new "relay" keeps only its own call, rename and
  delete of the target, undo), TestDeletedProviderNamedAndMerged
  (usageapi), TestUsageDeletedProviderRoutes (gui).
- GUI: usage-ledger-deleted-merge.test.cjs, chromium and webkit, en zh
  zh-TW ja de at 1400 and 760px: ok. All 63 usage-*/ledger-* files and
  i18n-keys, both engines: 923 of 954 ok. The reds are red the same on
  origin/main c3b0484a9 run alone: usage-agents-hide (#3414),
  usage-fold (#3415), usage-ledger's "newest live route needs no
  return-to-live button" (#3104), and i18n-keys' "a plugin's words are
  its own" on library's "Runs as" (#3897).

After rebasing on origin/main 3e96197da (i18n.js merged with c3b0484a9's
balance keys): go build ./..., go test of internal/usage/...,
usageapi/..., provider/..., gui/... ok; the new GUI file in both
engines and every language ok; i18n-keys only #3897's red.

Broken by hand:
- Both returning (to, to): TestDeletedProviderMergedIntoAnother red,
  "cost 900, before 306".
- renamesOf not setting into: both Go tests red (relay still listed).
- ledProviderMore returning at once: the GUI test red (timeout waiting
  for the …), 5 of 5 subtests in chromium.
- On the old code the new tests don't compile (no MergeDeleted).

Not tried: the real app on a real providers.json with a deleted
provider; Linux/Windows GUI. gateway_sessions still prices by the raw
id, and a deleted provider's per-provider price stops applying once its
id is reused (both before this change, unchanged by it).
2026-10-28 11:15:57 +08:00
yetone c3b0484a96 usage: keys of one account show its balance once (mimi)
mimi on Discord (#feedback): "同一个网站,添加多个key时,余额会重复展示" -
a site's keys 1-A031-Pro, 2-S009-Plus and 3-S010-Team-2 each showed the
account's $8.39 and its own curve.

KeyBalances still reads, keeps and charts every key on its own. What
changed is what the Usage page draws:
- balanceRead says whether the reading is the account's (balanceAccountWide),
  going by the source, not the vendor's name:
  - account-wide: a balance token (new-api /api/user/self, sub2api
    /api/v1/user/profile, AiHubMix), a known host's account query
    (DeepSeek, Moonshot, OpenRouter credits, SiliconFlow, StepFun, ...),
    and sub2api /v1/usage when its mode is "unrestricted" (wallet or the
    group's subscription, per sub2api's gateway_handler.go Usage);
  - per key: AiHubMix's /dashboard/billing/remain, new-api's
    /api/usage/token, sub2api in quota_limited mode, any other Balance
    URL the user named.
- Two such keys of one provider with the same amount are one account only
  when their balances moved together: the same latest change (from and
  to), first read within balanceHistGap. Two accounts with the same
  amount stay apart until one is spent from; keys whose amounts differ
  are never one. SharedBalance (the first key's name) says so in
  /api/usage/quotas, magpie quota --json and /v1/magpie/quotas.
- Refreshing a shared card reads every key it stands for (sharesAskedCard),
  so it stays one card. The history is read outside the cache's lock.
- The Usage page draws them as one row, one balance, one curve, with
  "+2 keys" beside the key and the keys on hover; the head's sum counts
  the account once. The code is in plugins/usage/page.js, so app.js is 9
  bytes smaller than before; no budget raised.

Run (mote-run, at the pre-rebase base d50f84c9f):
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: ok. gofmt -l: clean.
- go test -tags nogui -timeout 45m ./...: every package ok except
  internal/gui's TestCoreScriptBudget (app.js 676 bytes over; fixed by
  moving the code into the Usage plugin, then ok) and internal/update's
  TestRelaunchOpenTriedAgain (TempDir cleanup under load, #3881; 3 of 3 ok
  alone).
- go test -race on internal/provider's balance tests: ok.
- GUI, both engines, en and zh: 122 files (balance-*, usage-*, quota-*,
  tray-*, panel-*, gui-ja/de/zh-tw, i18n-keys, key-balance-card,
  routing-wallet-balance, ...): 1637 pass, 42 fail in 6 files, all the
  same at base a05b37353 run alone and all filed (#3679 quota-refresh-
  order, #3404 quota-count-wrap, #3414 usage-agents-hide, #3415
  usage-fold, #3104 usage-ledger, #3897 i18n-keys "Runs as"). After the
  move into the plugin, 17 of those files again: only #3897's red.

Broken by hand, each red:
- SharedBalance never set (the old code): "after they moved together".
- Shared on equal amount alone: "first reading" ("other" merged).
- Every query taken as account-wide: quota'd and new-api token keys
  merged.
- No sharesAskedCard: the shared card's refresh didn't read sk-plus.
- keyCards without sharedBalances: usage-shared-balance red in all four
  (chromium/webkit x en/zh).

Not tried: a real sub2api or new-api account (fake server with sub2api's
literal replies). A key's balance is shown once only after the account's
next change is seen by every key, not on the first read. Multi-currency
balances (DeepSeek "$ · ¥") and balances with parts are never shared.
2026-10-28 10:52:46 +08:00
yetone f4762e9217 sessions: a Claude conversation Claude Code copied into another file is one row
Neo (Discord #feedback): one Claude conversation was listed as ~11 rows
with the same title, message count and size, each under its own id.

Claude Code 2.1.312 copies a conversation into a new <id>.jsonl when it
forks one (--resume --fork-session, /branch) or moves it to a background
session: every message again, under the same uuids, with the new
sessionId. magpie keyed each file as a session, so each copy was a row,
and the copies' tokens were counted again in usage.

Each main Claude-format file (Claude Code, Qoder, Qoder CN) now records
the uuids of its first and last message (state Root/Leaf, cacheVersion
23, so every file is read once more and old copies fold in too). Of the
files of one agent that start with the same message, one whose last
message another holds is a copy (cc_copies.go). Only a random (v4) uuid counts, as Claude Code
writes them: files whose writer reuses ids like "u" stay apart. A copy
is not listed
(List, ListAgent, Agents), not counted in stats, and Delete trashes it
with the session that holds it (Restore brings it back). A fork that
went on with a turn of its own has a last message no other file holds
and stays its own row, as Claude Code's /resume shows it. The gateway's
session rows and the GUI's native keys know the copies' ids, so a
gateway-only row doesn't stand in for one.

Fixtures: testdata/claude-forks is Claude Code 2.1.312's own files from
a sandbox HOME with a fake API (a session, a --fork-session of it with a
third prompt, another fork with a different one), trimmed of request
records and attachment text. Pure copies are that session with its
sessionId rewritten, as /branch leaves one.

Run (mote) at 2b7ce2967 on d8c70504d: go test -tags nogui -timeout 45m
./... all 76 packages ok; gofmt -l
clean; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/sessions
./internal/gui ok; go build ./... ok.
Broken by hand, each red: ccCopies returning nil (all four row tests),
stats counting copies (110 in / 55 out, want 30 / 15), Delete not taking
copies (a copy came back as the row), MergeExternal ignoring Copies (a
gateway row came back). Without the v4 check, five tests whose
fixtures share "uuid":"u" went red (cli, gui x2, sessions, tui).
GUI: no file reaches it; the GUI tests fake the API and the JSON a page
gets is unchanged (Copies is json:"-").
Not tried: Neo's own files, and the opened view showing only "session
start" and one line in the second screenshot; that was not reproduced.
The calls ledger (FindCall) still holds a copy's calls.
2026-10-28 10:40:28 +08:00
yetone 7bdefe212f routing: the stage's pulses play again with no layout, and the list's heights keep only its rows (#3731)
gpboyer2 measured both on #3731. Each pulse on the stage (a node a
request passes, the caption, a failed try's row) took its class off, read
offsetWidth to start the animation again and put the class back: a
synchronous layout of the whole page, three or four times a request under
steady traffic. rerun() rewinds a running animation instead, and takes
the class off when it ends, so putting it on again starts it with no
layout. The heights the requests list measured were never dropped for
rows gone from the list, and every one was summed again on each draw;
now only the list's own rows are kept.

Not changed: the FLIP in the rows' reorder still reads offsetWidth once
per reorder, which is what starts its transition, and a found group's
flash (a click) still does.

Tests: routing-tick-no-layout.test.cjs (new) streams 24 trace answers in
Chromium and WebKit and counts reads of an animated node's offsetWidth:
19 on the old client.js, 0 now. With tick made a no-op by hand its other
check goes red ("the stage still pulses: 0").

Run at this stack's head 103631319 on main 0a7633136, on mote: the
routing GUI files with panel-routing, i18n-keys, old-webkit and
menu-input-scroll, both engines: 1625 tests, 91 red. The same files at
0a7633136 alone: 1618 tests, 94 red. Every red at the head is red at the
base too, apart from routing-rule-remove and rules-line subtests in one
language or the other, which flake in both (#3096, #3593); each red
already has an issue (#3409-#3412, #3799, #2115, #3789, #3402, #3403).

Rebased onto 69626580b (no routing change since 0a7633136) and run again
at the pushed head on mote: routing-own-columns, routing-tick-no-layout,
routing-day-window, routing-scroll-end and routing-live-calm, 61 of 61
ok, and go test -run 'Budget|Size' ./internal/gui ok.
2026-10-28 10:16:05 +08:00
yetone a1f0a6109a routing: the requests list lines up its rows without a subgrid, so Safari 16 stops crashing on it (#3731)
gpboyer2 found the cause: each .rt-req was a subgrid of .rt-reqs with
fit-content() tracks, and Safari 16's grid track sizing recursed on it
until the WebContent process died and the page reloaded, again and again
under steady traffic.

Now .rt-reqs is a flex column and each row is its own grid on
var(--rt-cols, var(--rt-tpl)). A hidden .rt-sizer grid at the list's
foot holds one probe per row shape (display: contents cells placed by
column), and fitCols reads its computed columns into --rt-cols: the fixed
ones rounded up to the layout's 1/64px, the flexible one minmax(0, 1fr).
A ResizeObserver on the probes' cells, deferred a frame so WebKit logs no
"ResizeObserver loop", refits when a cell's width changes. New columns
drop the rows' measured heights (listKey carries --rt-cols) but keep the
average, and metaFit measures with the columns of the layout it tests.

Found on the way and fixed here since the new key needs it: drawList
sized the gaps with the average from before it was recomputed.

The other subgrids of the same kind (.rt-rule, .sess-bar, .sess-skill,
.quota-windows .quota) are #3955.

Tests: routing-own-columns.test.cjs (new) fails on the old code (a
subgrid in routing.css) and checks, in Chromium and WebKit, en and zh,
at 1440, 1100, 940 and 700, that every route has a row and the rows'
columns line up. routing-day-window, routing-scroll-end and
routing-live-calm read the rows' own columns and skip the sizer.

Run at this stack's head 103631319 on main 0a7633136, on mote: the
routing GUI files with panel-routing, i18n-keys, old-webkit and
menu-input-scroll, both engines: 1625 tests, 91 red. The same files at
0a7633136 alone: 1618 tests, 94 red. Every red at the head is red at the
base too, apart from routing-rule-remove and rules-line subtests in one
language or the other, which flake in both (#3096, #3593); each red
already has an issue (#3409-#3412, #3799, #2115, #3789, #3402, #3403).
2026-10-28 10:13:14 +08:00
yetone 08b02cf18c providers: a pool stops at its caps and reads usage again near them (plugins#349)
What was adopted on magpie-community/plugins#349 (1939869736luosi): one
place, in the GUI and the CLI, for a subscription's account pool, and an
opt-in conservative mode.

- Stop at the caps (Provider.CapStop, off by default): once every account
  in use is held at its cap, the request is answered 429 rather than going
  on to the provider's fallbacks (plan returns restLast). Off, as before.
- Check usage again near a cap (Provider.CapCareful, off by default,
  internal/gateway/cap_careful.go): before planning, a capped account's
  usage is read again when its reading is over 15s old within 5 points of
  a cap, or over 5m old at all; the request waits at most 10s, and a
  failed account is asked again at most every 15s. An account whose usage
  was never read, whose last read failed, or whose reading is still that
  old is then held as one at its cap is (capHold "unread", traced as
  Weighed.Unread, named in the 429 with "--careful off"). Generic: it
  goes by provider.UsageRead/ReadUsageNow, so every subscription that
  reports usage windows (Codex, Claude, plugins) gets it.
- provider: usedCache records each account's read state; a failed read
  keeps the last good reading's time. ReadUsageNow no longer reports
  false when the read had already finished on the first ask.
- GUI: under the provider's account list, once an account has a cap (or
  either is on), two ticks for the above, and a note naming the accounts
  in use with no cap ("used to 100% of each window"). Accounts, order and
  caps stay where they were in that list. zh, zh-TW, ja, de added.
  app.js 1,309,658 within its 1,310,460 budget, unraised: addRow and a
  per-row forgetOf replace 3 add-button and 5 Remove-button builds.
- CLI: magpie provider pool <id> [--accounts a,b,…] [--cap percent|off]
  [--stop on|off] [--careful on|off] shows and sets the whole pool.
- docs: gateway-routing.md and providers-accounts.md.

Run (mote, before the rebase at 8bade6c5e + this change):
- go test -tags nogui -timeout 45m ./...: exit 0, 76 packages ok, no
  FAIL (log grepped).
- GOOS=linux and GOOS=windows go vet of cli, gateway, provider, gui: ok.
- pool-ends.test.cjs: 32/32, Chromium and WebKit, en zh ja de, 1100 and
  420 wide.
- The 81 GUI files whose fixtures have accounts or caps, plus i18n*,
  6 at a time at load ~130: 76 pass. i18n-keys is red on the base too
  (#3897). account-mask (#3951), account-alias (#2984),
  signin-closes-sheet and signin-again timed out under load and pass
  run again, as on the base; signin-again filed as #3960.
- Real plugin host: TestPluginCarefulPool runs the fake plugin under Bun
  as Factory with two accounts capped at 90%: a failing usage call gives
  429 with nothing sent upstream while careful is on, the last reading
  is used with it off, a good read sends to A again, and with both at
  their caps the fallback serves unless Stop is on.
- CLI binary in a sandbox HOME on mote: unknown provider, a bad --stop
  value and no id each refuse and change nothing.
At the rebased head (0a7633136 + this): gofmt -l
clean, go build ./..., the new Go tests and the budget tests, and
pool-ends.test.cjs 32/32.

Broken by hand, each seen red, then restored:
- the CapStop line in plan: TestCapStopSkipsTheFallbacks and
  TestPluginCarefulPool red;
- the careful hold in capHeld: the three careful tests and
  TestPluginCarefulPool red;
- careful always on: TestCarefulOffByDefault red;
- readCareful not called: the failed, never-read, stale and re-read
  subtests red;
- a failed read not keeping the good time, or not counted as failed,
  and ReadUsageNow's early return forced false: TestUsageReadAndReadAgain
  red;
- the ticks' onchange emptied: pool-ends.test.cjs 16 of 16 red.

Not tried: a real Factory or any real account (fake plugin only); the
whole GUI suite (932 files, ~5h at this load), only the 81 files that
reach the account list; Linux WebKitGTK and Windows; the 15s/5m/5-point
figures against a real vendor's usage endpoint latency.
2026-10-28 09:29:44 +08:00
yetoneandMYCF711 0a7633136d routing: a skipped member's story line leads with its own logo (#3953)
A story line about a member the gateway skipped before trying it
(r.left, "API key is left out: this request is longer than its 200K
context window…") got no logo, or another member's: logoed walked only
r.order. MYCF711 found it and proposed walking r.left too, skipped
members first, with r.left in the logos memo keys; this ports that
(their branch MYCF711/magpie fix/routing-left-logos, 003611a02).

Changed from their patch: list order alone can't settle two members
named alike (an order key and a skipped account both "API key"). Left
first gave a failed order key's try line the skipped one's logo; order
first gives the skipped one's line the order key's. So a line now
carries the member it is about where it has one (a skipped one's line
via leftWhy, a try's via tried()), and that member wins a tie at the
same place; otherwise order before left. The memo keys take that
member's seat and every r.order + r.left logo.

Siblings checked: say()'s caption is plain text; the rows (3650) and
the stage list (1911) already read r.left; app.js has no story logos.

Run (mote-run, at 8bade6c5e):
- routing-log-icons.test.cjs, chromium + webkit, en/zh (+ the live
  case's en/zh/zh-TW/ja/de): 14/14 ok. New case: order [glm, DeepSeek
  key "API key", gpt], left [Zen "API key", 200K window], DeepSeek tried
  and failed; the 200K line must lead with opencode, the DeepSeek try
  line with deepseek-color.
- Broken by hand, each red: r.order only (skipped line got
  deepseek-color, the reporter's symptom), the reporter's left-first
  without the about member (try line got opencode), order-first
  without it (skipped line got deepseek-color).
- Every GUI file that reaches the Routing page (184 files with
  i18n-keys, 2375 tests): 98 red; the 15 red files run again side by
  side on a clean origin/main 8bade6c5e copy and this tree: 99 red on
  main, 93 here, the same files, under load ~100 on mote. Each has an
  open issue: #3897 (i18n-keys "Runs as"), #3402, #3408, #3409,
  #2115/#2658, #3410, #3799, #3789, #3411, #3094/#3096, #3593, #3412,
  #3954, #1905, #1345/#1948.
- go test -tags nogui ./internal/gui -run 'Budget|Size|I18n|Plugin':
  ok (client.js is the routing plugin's, not a core script).

Not tried: the real app with a real skipped Zen member; Windows/Linux
webviews.

Co-authored-by: MYCF711 <323101370+MYCF711@users.noreply.github.com>
2026-10-28 09:17:18 +08:00
yetone 8bade6c5e2 provider: a plugin's usage window can be a prepaid wallet's balance (#3950)
SuperMagic's accounts (mycf_711's magicrew plugin) are prepaid wallets of
points with no total. A plugin can now send a usage window as
{name, balance: 6291, unit: "积分"} with no used or limit.

- host.js passes a finite balance on (at least 0), anything else as null.
  plugin.UsageWindow.Balance and provider.QuotaWindow.Balance are *float64.
- quotaOfPlugin keeps the figure and does not make the window Text or
  Aside, so routing knows the account with no Used invented. allowanceOf
  copies it into Limit.Balance; an empty wallet counts as used up.
  Allowance.Left(model) is the least balance of the windows that count
  the model.
- weighRouted fills routes.Seat.Left and Seat.LeftIn (the account's
  provider and unit). Smart, pace and usage (least used) put the seat
  with more left first where they would otherwise tie (byLeft), only
  when every seat with a balance shares one LeftIn: balances in two
  units or two providers are never compared. Tiers still come first.
- The Usage card, the Routing page (Weighed.Balance: the small row's
  text, no bar, a why sentence, the account list), magpie accounts and
  the status line show the figure, "6,291 积分 left", never a share.
- Docs: provider-plugins (new section), gateway-routing,
  providers-accounts, plugin-runtime, host.js typings and the site's
  plugins page (en, zh, ja).

Run, at base f13aafa87, on mote:
- go test -tags nogui -timeout 45m ./...: 72 packages ok; red were
  TestQuotaSpanCarriesEveryWindowField (this change's: its fixture now
  sets Balance, green after), and on the unchanged base too
  TestWSLColdPlaceOpensNothing (#3924), TestFetchAsksASharedBaseOnce and
  two siblings (#3854), TestTUIFetchesSubscriptionModels (#3919), all
  fixed on main since and run again after the rebase; and
  TestPluginStreamsPastTheBudgetWait (#3946), green alone on both.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/..., go
  build ./..., gofmt -l: clean.
- New tests: TestPluginWalletBalanceIsAReading, TestAllowanceLeftIsTheLeastBalance,
  TestPluginHostPassesABalanceOn (through real Bun and host.js),
  TestWalletsGoByWhatTheyHaveLeft, TestWalletLeftWithinItsTier,
  TestWalletWithMoreLeftGoesFirst, TestQuotaCell's balance cases;
  usage-wallet-balance.test.cjs and routing-wallet-balance.test.cjs,
  34 of 34 in Chromium and WebKit, en zh zh-TW ja de, 1100/900/420/390px.
- GUI: every quota*, usage*, panel*, routing*, i18n* and tray* file (220
  files, 2928 tests), concurrency 4: 130 red, in 21 files. Those 21 files
  run again on an unchanged base copy and on this change, concurrency 2:
  the same 19 files red on both (126 and 131), the differing subtests
  being routing-rule-remove / rules-line / intent-entry flaps that go
  both ways. Each is filed (#3679, #2115, #3410, #3404, #3411, #3897,
  #1905, #3096, #3593, #3408, #3409, #3799, #3789, #3412, #3947, #3415,
  #3414, #1345); routing-story-shrinks had none and is #3954.

After rebasing on origin/main 833f51adc, on mote: Linux and Windows vet,
go build, gofmt clean; go test -tags nogui of internal/routes, provider,
gateway, cli, plugin, gui (the script budgets), agent and tui: all ok;
the two wallet GUI files and i18n-keys: 37 of 38, the red being
i18n-keys' "Runs as" (#3897, not this change).

Broken by hand, each red then restored: quotaReport's Balance copy
removed (TestQuotaSpanCarriesEveryWindowField red); byLeft always nil (routes and
gateway tests red); host.js's balance line removed (host test red);
quotaOfPlugin's balance copy removed (provider tests red); app.js and
client.js at base (both GUI files 34 of 34 red, "0% used" / "已用 0%").

Not tried: a real SuperMagic account or the magicrew plugin (it isn't
in the community repo; it needs to send balance), Windows and Linux
GUI apps, and the WebKitGTK app.
2026-10-28 08:28:56 +08:00
yetone 833f51adcf gui: a browser tab has the font rows too, with its own choice
Norcleeh on Discord: magpie opened in a browser had no font setting in
Settings > General, while the app does. The rows were hidden on purpose:
/api/fonts answered 404 to a browser page and boot sent it no choice,
since the list is the fonts of the computer magpie runs on and the tab
can be on another one.

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

Run on mote at this tree (on b90e81da1), also GOOS=linux (nogui) and
GOOS=windows go vet ./internal/gui/..., go build, gofmt -l:
- fonts.test.cjs, font-cascade.test.cjs, win-fonts.test.cjs, i18n-keys
  and the 42 drag/arrange GUI files, Chromium and WebKit, en and zh (and
  ja/de where a file has them). The reds are 32 subtests in 4 files
  that fail the same on origin/main b90e81da1 run alone (and one from
  a stray path in the run command): i18n-keys "a
  plugin's words are its own" (#3897), routing-rule-drag webkit de
  (#3789), segs-press-redraw webkit (#3922), usage-agents-hide (#3414).
- go test -tags nogui ./internal/gui (TestCoreScriptBudget and
  TestFontSettingsAPIAndBoot included) ok; go test ./internal/gui -run
  Font (cgo, CoreText) ok.
- Real use: magpie built on mote, `magpie web` in a sandbox HOME, real
  /api/fonts (204 families). Chromium offered 204, WebKit 179; Georgia
  picked in each, the body drew it and kept it across a reload, and no
  settings.json was written.
Broken by hand: fontsOn = !web (rows hidden as before): the new test
red in all four engine/language cases; here() returning the list
unfiltered: red with "a family this browser doesn't draw isn't
offered".
Not tried: a browser on a different computer from magpie (the canvas
filter is what covers it, checked with a family the test machine
lacks), Firefox, the Windows and Linux apps' pages in a browser.
Budget: not raised; the previous commit's 1,097 bytes cover it.
2026-10-28 08:01:46 +08:00
yetone 7a92506353 gui: dragRows and dragCards share their scrolling box and listeners
Both carried the same scroll-box search, edge speed and seven listeners
added and taken off by hand. dragScroll and dragListen hold them once;
each drag keeps its own paint, move and finish. No behaviour change.
app.js is 1,097 bytes smaller, room the next commit (fonts in a browser
tab) uses without raising the core budget.

Run on mote with the next commit on top (no drag code in it): the 42
GUI files that drag or arrange (agents, providers, accounts, usage
cards, search units, routing groups/members/rules), Chromium and
WebKit. Their only reds are routing-rule-drag webkit de (#3789) and
usage-agents-hide (#3414), both the same on origin/main b90e81da1 run
alone. go test -tags nogui ./internal/gui ok.
Not tried: dragging by hand in the app.
2026-10-28 08:01:40 +08:00
yetone b90e81da14 gui: on Linux without gst-plugins-good the masking demo shows her poster
On stock Omarchy (Arch + Hyprland, WebKitGTK 2.52.6, GStreamer 1.28.6
with gst-plugins-base and -bad only), opening the masking demo aborted
WebKitWebProcess about three seconds in, so the app's window went blank.
WebKitGTK gives every video, a muted one too, an audio sink it makes with
autoaudiosink ("GStreamer element autoaudiosink not found", then a NULL
g_signal_connect, then SIGABRT); that element is in gst-plugins-good.
canPlayType can't tell: an Ogg Theora copy, "probably" playable there,
crashed the same way, so no other format would do.

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

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

Not tried: clicking the demo row in the real desktop app on omarchy (no
pointer tool there); the app's half was checked through the same
WebKitGTK and the detection through the real folders, separately.
2026-10-28 07:31:02 +08:00
yetone f13aafa87e redact: the masking demo card keeps 14px from the card above it
The page has no gap of its own; the request list keeps its distance from
the card with margin-top: 14px. The demo card, put between them in
cad7bbbdb, had none, so it sat flush under the card above. It gets the
same 14px, and masking-demo checks the room above and below it is 14
and 14.

Run at this head (origin/main cad7bbbdb + this change), on mote:
- node --test masking-demo, masking-records: 108 pass, 0 fail
  (Chromium and WebKit, five languages, 1100 and 640px).
- Broken by hand: without the margin, the new check is red (0 for 14,
  WebKit en 1100px).
2026-10-28 06:56:38 +08:00
yetone cad7bbbdb7 redact: Insights › Masking shows how masking works, with Little Magpie, folded until opened
A card under "What the vendor didn't see" and above the request list
plays a 27s demo: Little Magpie takes one request (a GitHub sign-in with
a password and an email), tears the real values out into her notebook,
pastes placeholders in, sends it, and swaps them back on your computer
when the tool call comes home.

- Folded by default. The video (xq_light/xq_dark.webm, 1.7MB/1.5MB) and
  the stage are built only on the first open, so a folded card fetches
  nothing but its 0:27 thumbnail.
- It plays only while open, on screen, in a visible window and not
  covered by a single record's sheet; it plays once and rests on the
  last step. Under reduced motion it shows the last step, still.
- The stage (request, notebook, browser, provider) is drawn in the page
  and translated in every language (41 keys, zh, zh-TW, ja, de); only
  Little Magpie herself is video. Light and dark takes match the card's
  colour exactly, and the take follows the theme as it changes, still
  playing (a new source starts paused, so it is woken where T is).
- The request and provider boxes keep room for taller fonts: WebKitGTK's
  Noto ran the provider's note 16px past its box. The stage is 1000x420.
- T, the frame clock, is the authority; a video that drifts (a seek
  it couldn't make) is sent back to T, never the other way.

Run at this head (origin/main 4842f69be + this change), on mote (macOS 27):
- node --test masking-demo, masking-records, i18n-keys: 111 pass, 1
  fail. The red is i18n-keys "a plugin's words are its own" on
  plugins/library "Runs as", red on main since 7f827b3b0 (#3897).
- masking-demo: Chromium and WebKit x en/zh/zh-TW/ja/de x 1100/640:
  folded fetches no webm, opening fetches one, the stage fits, no
  English left, nothing wider than the window, every box's text inside
  it (4px to spare in request and provider); plays, stops when folded
  or covered, rests at the end, restarts; dark take on the card colour;
  a theme changed mid-play goes on playing in the new take.
- go test ./internal/gui/: only TestMainWindowCorners/macOS_26_SDK red,
  the same on main (#3949); TestCoreScriptBudget ok.
- gofmt clean (no Go changed); go vet, GOOS=linux go vet -tags nogui,
  GOOS=windows go vet ./internal/gui/ clean.

Broken by hand:
- T following vid.currentTime (the first take): "plays while open" red
  in Chromium (the step 7 seek never stuck); green after.
- pickVid without wake(): the theme test red in both engines (0/2).
- The provider box at 350px: the no-clip check red ("prov -26px").

Whole GUI suite (*.test.cjs, mote, before the rebase, at dc1cfe015 +
this change): 75 files pass, 33 fail; origin/main 9e6347608 alone: 73
pass, 35 fail. Every file red with this change is red on main too:
account-mask (#3951), gateway-caller-keys (#3797), gateway-key-models
(#2648), header-centre (#3479), icon-tile (#3858), library-row-remove
(#3099), menu-input-scroll (#3402), mobile-web (#3952), old-webkit
(#3403), phone-web (#3876), quota-count-wrap (#3404),
quota-refresh-order (#3679).

Real use, magpie web from this tree:
- Windows 11 (xiaomi-gpu), Edge 156 headless = WebView2's engine:
  folded fetches no webm, VP9 "probably"; rAF 60fps, video 30fps, T
  never steps back; the step 7 seek holds; the theme switch keeps
  playing; rests at 27.5s; no page errors; every box fits in all five
  languages (8px or more to spare).
- Linux (WSL2 magpie-desktop, WebKitGTK 2.52.6 under Xvfb, compositing
  off as under Wayland): plays with T on the video's time, seeks, rests
  at the end, no errors. It found the two fixes above: the theme switch
  left the new take paused, and the provider's note ran 16px past its
  box in English and Japanese (and the request box 6px in ja and de). After: 10px or more to
  spare in all five languages.

Not tried: the packaged Linux and Windows apps themselves (magpie web
in their engines stood in); a real request through masking (the demo
is drawn, not live).
2026-10-28 06:43:31 +08:00
yetone 9e63476087 gui: on Windows only the window's frame resizes it, not the page's edges (shangyuan0818)
shangyuan0818 on Discord: the top of the page, just under Windows' title
bar, resized the window's height as the frame does. Cause: Wails' page
runtime (drag.ts, v3.0.0-beta.24) arms an edge resize SM_CYSIZEFRAME px
inside the page on every edge whenever the window is resizable on
Windows, framed or not (on Linux only when frameless, never on the Mac),
and posts wails:resize:<edge>, which Go turns into WM_NCLBUTTONDOWN
HTTOP/HTLEFT/... The main window is framed on Windows, so its top, left,
right and bottom page edges all resized it. On the main window, on
Windows only, magpie now turns that switch off once Wails' runtime is
ready (WindowRuntimeReady), wrapped so Wails' own setResizable(true)
right after, or on a reload, keeps it off. The native frame and window
resizability are untouched.

Run:
- Windows 11 box (xiaomi-gpu), sandbox HOME, GOOS=windows builds of
  origin/main dc1cfe015 and of this change, the real WebView2 page driven
  over CDP (mouse move, press, move, release via Input.dispatchMouseEvent,
  chrome.webview.postMessage recorded):
  - main: top (y=1) cursor ns-resize, posts wails:resize:n-resize; left
    posts w-resize; bottom posts s-resize.
  - this change: no resize cursor and no resize message on any of the
    three; the top drags the window as the rest of the header does
    (wails:drag). Hook present after a page reload.
  - native frame on this change, WM_NCHITTEST: frame top 12 (HTTOP),
    left 10, right 11, bottom 15, title bar 2 (HTCAPTION), page top 1
    (HTCLIENT); WM_NCLBUTTONDBLCLK on the caption maximises, restore
    restores.
- TestFrameOnlyResizeStaysOff (node, both orders, hook twice, no runtime).
  Broken by hand (wrapper removed, setResizable(false) only): red on
  "hook before Wails" and "hook twice".
- mote: go test ./internal/gui/ (gui tags), GOOS=windows go vet
  ./internal/gui/, GOOS=linux CGO_ENABLED=0 go vet -tags nogui, gofmt -l.
  Full suite -tags nogui -timeout 45m at dc1cfe015 + this change (which
  is !nogui only, so not compiled there): red TestWSLColdPlaceOpensNothing
  (#3924), TestPluginStreamsPastTheBudgetWait (#3946), internal/provider
  TestUnreadLoginsWriteErrorsKeepCredentials (#3632),
  TestTUIFetchesSubscriptionModels (#3919); all four red on dc1cfe015
  alone. internal/gui: TestMainWindowCorners/macOS_26_SDK red on macOS 27,
  same on dc1cfe015 alone, filed #3949.

macOS and Linux: the hook is registered only when GOOS is windows, and
drag.ts never arms on a framed window there.

Not tried: real mouse drags on the Windows box. A Windows Security dialog
was up over the whole screen, so synthetic clicks went to its dim layer
and the window did not move; the frame was checked by hit test instead.
2026-10-28 05:50:26 +08:00
yetone 7f32f0ec93 i18n: ja's Keep on ChatGPT line names {agent} once, as en does
c54478904 gave ja's Keep on ChatGPT sentence {agent} twice; en has it
once, so gui-ja's placeholder check was red on main since. The second is
now そのアプリ (that app).

Run (mote): node --test gui-ja, gui-zh-tw, gui-de: 9 pass, 0 fail
(gui-ja red before on origin/main e4ccf67b1).
2026-10-28 04:18:21 +08:00
yetone 73fb77e1d0 sessions: a session's title keeps its room in a narrow Sessions list
cybercaius (Discord, Windows app, zh): at a narrow window a session row's
title shrank to one character ("7") while its tokens, cost and buttons
kept their width. The page's 560px media queries look at the viewport, not
at the list beside the sidebar, so they never fired.

.sm-tree is now a size container. Under 700px the token count goes and
the row gaps tighten; under 600px the row wraps: the title takes the
first line and the cost and buttons sit right-aligned on the second.

New sessions-row-narrow.test.cjs (zh title, tokens, cost, resume,
terminal, carry, delete; widths 1100 to 360): the title keeps at least
min(140px, 35% of the row) and ellipsizes, and nothing passes the row's
edge. Red before at every width up to 720 (title 0 to 100px); green
after in chromium and webkit, en and zh, on mote.
Not tried: the real Windows app (WebView2); Chromium covers its engine.
2026-10-28 04:18:21 +08:00
yetone 3e22123c9c usage: a deleted provider's calls stay apart from a new one under its id
cybercaius (Discord): after deleting a provider and adding a new one
that took the same id, the old provider's usage showed under the new one.

Delete now records the provider in providers.json ("deleted": id, name,
icon, when, its Was and Gave). UsageRenames gives a deleted id to
<id>~<when> only once something reuses it (a live provider, a later
deleted record, or a later Was), so a deleted provider nobody replaced
keeps its raw id and the existing probe/usage tests stay as they were.
/api/usage's provider faces name a deleted id from its record and set
Named.deleted; the Usage provider picker notes "Deleted {date}" (zh, zh-TW,
ja, de translated). Old deletes, made before this, have no record and
stay merged: nothing tells their calls apart now.

Run (mote): go test -tags nogui -run 'Deleted|Rename|NotSetUp|Probe'
./internal/usage ./internal/usageapi ./internal/provider ok; gofmt -l
clean; go vet -tags nogui ok.
Broken by hand: dropping the f.Deleted append turns
TestDeletedProviderKeepsItsCallsFromOneAddedUnderItsID and
TestDeletedProviderListedApartAndMarked red; restored, green.
Not tried: a real delete-and-re-add in the GUI app.
2026-10-28 04:18:21 +08:00
yetone 8fff54dab7 routing: a group in a group left on Smart is routed as the outer one (#3847)
mycf_711 (#3847): an outer group set to Free first held a group whose
routing was left blank (Smart); the inner group's free seat was tried
after its paid one, as if Free first stopped at the inner group.

provider.Group.Within: in membersOff's walk, a nested group with no
routing of its own takes the outer group's when the outer one pools its
members (Smart, Free first, Fastest, ... ; not In order, By weight or
Manual, which try each member whole by its own order, #576). A group
that sets a routing keeps it. The gateway, the trace's Subs and the
Routing page all read membersOff, so they agree; GROUP_NEST's help
sentence says so (zh, zh-TW, ja, de).

Run (mote): go test -tags nogui -run 'FreeFirst|Group' ./internal/gateway
./internal/provider ok; GOOS=linux and GOOS=windows go vet -tags nogui
on both packages ok; go build -tags nogui ./... ok; gofmt -l clean.
Broken by hand: without the Within call
TestFreeFirstReachesAGroupInItLeftOnTheDefault is red (paid seat first),
green with it.
Not tried: the reporter's own groups in the real app.
2026-10-28 04:18:21 +08:00