Commit Graph
33 Commits
Author SHA1 Message Date
yetone 0621e70fb9 routing: leave a provider out of the groups magpie finds
chenxiang0010 on Discord asked to keep a provider or a model out of the
auto-created routing groups. A model could already be kept out (remove
its found group; magpie keeps it removed), but a provider could only be
turned off per group or everywhere. Now Routing -> Groups, under "Find
groups on their own", has "Leave out a provider..." (app menu, saved
when it closes) and `magpie group auto skip <provider>...|none`. The
providers chosen (providers.json autoGroupSkip) join no found group; a
group the user made or changed keeps them, a found group left with one
provider goes away, and a request for it is served by AutoStandIn from
a provider still in, and agents on it are reseated (agent.Reseat). A
rename carries the id along. en, zh, zh-TW, ja, de.

Run at 383947fce (this change on origin/main 2ff75161d):
- go test -timeout 45m ./... on mote: 80 packages ok; internal/gui red
  only in its real-window AppKit tests (TestDockJoinLeadsCommandTab,
  TestPanelCloseHidesIt, TestMainWindowCorners, ...), which fail the same
  on fresh origin/main 2f65a33aa on mote (#4125, #2645).
- gofmt -l clean; go vet ./... on Windows (win-run) clean; on Linux
  (wsl-run) clean with -tags nogui (the WSL distro has no gtk4).
- GUI: group-found-skip (new) and group-found-off, all five languages,
  1100px and 390px, Chromium and WebKit on Linux (wsl-run): 24/24. On
  mote every WebKit launch times out (#4125), Chromium 12/12 there.
- The routing files the full run flagged (concurrency 6) rerun alone on
  wsl-run, here and at fresh origin/main 380032cda: click-scroll's
  WebKit case and group-morph's WebKit 420px cases fail the same on
  origin/main. group-duplicate's de case was mine: the found groups'
  new "Anbieter ausnehmen..." line made German taller than the test's
  420x1200 window, which it assumes needs no scroll; it now uses 1400
  and passes 10/10 in both engines.
- Whole GUI suite on wsl-run, concurrency 6: still running at push time
  (5092 ok, 170 not ok so far, mostly in files this change doesn't load:
  account-*, agent-*, connect-*, gui-de/gui-ja's "{agent}" placeholder
  string). They are compared against origin/main after the push.

Broken by hand: foundGroups without unskipped -> TestAutoGroupSkip and
TestGroupsSkip red. Test calls before the fix to groupCmd's args ->
TestGroupAutoSkip red.

Not tried: the real app with real providers; a model-level skip (a
model is kept out by removing its found group, as before).
2026-10-31 00:57:21 +08:00
yetone 869c4d112d routing: the magpies fly under the cards, and a long intent is cut short on its row (penershu on X)
penershu on X (v0.1.2123): with two agents sending at once through
jd-auto-balanced, one magpie sat on the hub's "127.0.0.1:3425" with its
dot beside it, another on the group's split dot, and the row smart
routing picked ran "回答中… · 按意图“Design architecture…”" off the
right edge.

Cause:
- .rt-sky (birds and dots) was z-index 2, over the cards (z 1). Flights
  cross the hub's box (via(), 520a2425f), so a bird crossed its words.
- Every wire ends at a card edge, so a held or waiting dot sat half on
  the card.
- .rt-accts li's last column was auto with a nowrap em. The intent text
  ec8fe29b8 added has any length, so it squeezed the name to 0 and pushed
  the row past the stage card.

Fix: the sky goes under the cards (z 0); pose() starts and ends each
flight 6px clear of the cards at either end; the em column is
fit-content(60%) with ellipsis, and the full intent goes in the em's
title. The panel's small stage has no birds and was already under.

Run (mote-run, Playwright 1.62):
- new routing-sky-under.test.cjs: 3 agents at once (one waiting at
  magpie), chromium + webkit x en/zh/zh-TW/ja/de x 1600/1100/560/390 =
  40 tests. Checks nothing in the sky is drawn over a card's words
  (elementFromPoint with a probe), every dot is whole beside its card,
  the intent row stays inside its row and the stage card, keeps the
  name >= 60px, is cut short, and has the whole intent in its title.
  Together with routing-held-dot and routing-smart-intent: green.
- Red on origin/main's client.js + routing.css: 50/50 (sky over the
  words, held dot on the card edge).
- Broken by hand: new JS with old CSS minus the em rule -> 1600 red
  ("name":0, the reporter's squeeze); old JS with new CSS -> dot test
  red (dots over the rows and the hub).
- Screenshots looked at, old and new, both engines, zh 1600/560.
- Whole GUI suite: mote was held at load ~120 by three other sessions'
  full suites for 2h, so it ran on WSL magpie-desktop instead
  (node --test --test-concurrency=8 internal/gui/tests/*.test.cjs). At
  push time, 4438 results were in with 95 not ok, none of them in a
  routing file. They are in untouched pages (account limits, gateway
  keys, Codex settings, agent-panel-name-width, click-scroll and
  others), which reads as WSL load. The whole suite on mote was not run.

Not tried: the real app (WKWebView, WebKitGTK); a real decision model
and real concurrent requests; the full GUI suite on mote.
2026-10-30 11:40:02 +08:00
yetone 8701eb35ea routing: with several routes on the stage, each route's rows hang under its own heading (hoobnn on Discord)
hoobnn: "路由这里,会莫名出现两个没有使用的路由,并且鼠标悬浮,显示错误的
供应商". The screenshot's header read "DeepSeek-V4.1-Flash · 路由组 · 启用
3 个 · 3 个 Agent 同时在发" over five rows: the group's three (Volcengine
Ark, a DF Model account, Qwen China) and, between and below them, Pi's
zcode account and OpenCode's Kimi Code (China) key.

Cause: the stage shows up to four agents at once (520a2425f), and
rebuild() drew every staged route's seats in one column. The header names
the latest request's route alone, and nothing marked which rows were
another agent's route, so Pi's and OpenCode's direct providers read as two
unused members of the DeepSeek group.

Fix: when more than one route is on the stage, each route's rows hang
under a heading of its own, the same heading a group in the group has
(subNode), keyed by a route key no group id can spell. A group's heading
names the group, its ref and its routing; a provider's names the provider,
with its logo, and the model asked for, and no routing when it has one
key. The heading's tooltip says which agents send to it ("Sent by
{agents}"). It starts open and folds like a group heading, remembered
under route/<group or provider>. Fold runs, wires and depths follow the
row's path (route, then the groups in the group). One route alone looks
as it did. New words in zh, zh-TW, ja and de.

The hover: in code, each row's title is its own id (render() sets
[w.id, ...]), and the new test hovers Kimi Code's row and finds
"kimi-code-cn". I couldn't make a row show another's id. The likely
reading of "qwen-cn" over the Kimi row is a native tooltip that stayed
while rows moved under a still pointer, as routes came onto the stage and
left. That is inferred, not reproduced. With headings, rows move less
between routes, but a route coming or going still moves the rows below it.

Sibling: the panel's mini stage (pSeat/pDraw) draws each provider a try
went to, with no union of group members, so it has no such mix. Not
changed.

Test: internal/gui/tests/routing-stage-routes.test.cjs, with the report's
shape. DeepSeek Harness on the group (three members, in order), Pi on a
zcode account, OpenCode on Kimi Code's one key, all live. It checks one
route alone has no heading; three headings in order, each with its own
rows only, "Sent by" its agent, the group's "In order" and the lone key's
empty routing; wires; the hovered Kimi row's id; no spills; no page
errors. Chromium and WebKit, en zh zh-TW ja de, 1100 and 420px.

What was run (WSL magpie-desktop via wsl-run, mote via mote-run):
- the new test on the old code (client.js, routing.css and i18n.js put
  back): Chromium 0 of 10, every case times out waiting for 3 headings.
- the new test on the fix: 20 of 20, twice.
- the new test on the old code (origin/main 9b538a3f3 with only the new
  test file): WebKit 0 of 10, the same timeout.
- at the pushed head (d4866daf5 on origin/main 9b538a3f3): the new test and
  i18n-keys, 24 of 24, both engines.
- mote: go test -tags nogui ./internal/gui (budgets, compress,
  revalidate): ok.
- the whole GUI suite, Chromium and then WebKit (wsl-run, concurrency 4),
  was started on the pre-rebase head and is still running at push. Reds
  so far, none in routing: account-eye (ja), agent-panel-name-width,
  api-key-theme. Each is to be checked against origin/main alone and
  filed if it is new.
- No Go code changed; no full Go suite.

Broken by hand: the old code, above. While writing the test, its hover
check went red at 420px when the pointer landed while the view was still
scrolling to the row; the test now hovers in a viewport tall enough that
nothing scrolls.

Not tried: the real app with three agents sending at once (a fake
trace feed only); the reporter's own setup.
2026-10-29 15:34:16 +08:00
yetone e1721d6404 routing: a weighted group's editor sorts its members by weight once (Norcleeh)
Norcleeh (Discord #general) asked for a way to order a By weight
group's members by weight. The order matters there: it is the
fallback's when a model fails.

Now the group editor has a "Sort by weight" text button beside Add
another model. It shows while the group routes By weight and the order
would change. A press puts the named members heaviest first (no weight
counts as 1, equal weights keep their order, one switched off is
sorted too; a pattern's members stay after them) and draw()s. The
button then goes. It is a one-off reorder of the draft, saved with the
group's Save; no mode is stored. Its title says the order is the
fallback's. Strings in zh, zh-TW, ja and de. The routing plugin's
client.js isn't a core script; no budget changed.

Run (mote-run, at this head on a1f06bd78):
- group-member-weight.test.cjs, Chromium and WebKit, en/zh 1100px and
  en/de 420px: In order offers no sort. By weight it does and fits.
  The press orders glm-5 (6), gpt (3), kimi (2, off), o4-mini (1),
  each keeps its weight, the button goes, and Save sends that member
  order. Every new string has its four translations. 8/8.
- Red on origin/main's client.js: 8/8 fail (no button). Broken by hand,
  the button kept while sorted: 4/4 Chromium red at "sorted, it has
  nothing to do".
- The routing GUI files (group-*, routing-*, panel-routing*), i18n-keys and
  gui-de/ja/zh-tw, both engines, at load ~230: 1879 of 1913 passed.
  Adding the button into .rt-gadds made routing-intent-entry count 3
  buttons, so the row has its own class, rt-madds; that file passes.
  The reds left are in routing-flood, -levels, -row-swap, -rule-drag,
  -rule-remove, -rules-line, -steady and -story-shrinks. The same 27
  fail at a1f06bd78 without this change, and rule-drag, row-swap and
  steady fail 7/7 at 7fcf642ee. Each has an open issue: #2215, #3620,
  #3799, #3789, #3096/#3094, #3593, #3412/#1804 and #3954.
- go test -tags nogui ./internal/gui: ok. gofmt -l: clean.
- Again after the rebase onto 7fe98c2af: go build ./..., go test
  ./internal/gui ok; group-member-weight 8/8, routing-intent-entry 8/8,
  group-context 4/4. i18n-keys is 3/4: its "a plugin's words are its
  own" is red on main, from a masking.go comment that quotes "masking…"
  (e296211b8), not from these strings. Filed as #4053.

Not tried: the real desktop app, and a group with members by pattern
(those aren't sorted, by the code).
2026-10-28 18:33:46 +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 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 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
jayswu ca9b5048e3 routing: a request tried on many keys keeps its steps in a box of 200px, so the list below stays where it was (#3764)
A trace tried on 40 keys says a line or two a key, so .rt-steps grew
to ~2500px and pushed the request list a screen down; clicking between
it and a one-key request moved the list by that much each time
(hheei's analysis in #3764). The list now holds at most 200px (eight
or so steps) and scrolls in itself; short stories start at its top as
before.

jayswu's patch (their branch gui/cap-routing-steps-height, ported here
since the repo takes no outside PRs). One change to it: a different
request's story starts scrolled to the top, and that reset now runs
before renderSteps' "nothing changed" return. In the patch it ran
after, so two requests whose stories read alike (the same keys
refused the same way) kept the first one's scroll.

Run at base 479de8900 plus this change, then rebased on 865df2472
(nothing under routing/ or app.js changed between them):
- new tests/routing-steps-cap.test.cjs, chromium and webkit: 2 of 2
  ok, again at the pushed head. Broken by hand: without the CSS cap, red ("the story's box grew
  to 2518px"); with the reset where the patch had it, red ("another
  request's story opened scrolled down", 400 !== 0).
- go test -tags nogui ./internal/gui/: ok (71s).
- every routing-*.test.cjs plus i18n-keys, --test-concurrency=4 at
  load ~100: 531 ok and 5 red when this was written (the run goes on).
  Of the reds, routing-intent-entry is #3408; routing-affinity-cache-
  write, routing-idle-frame and routing-js each pass whole when run
  alone and are filed as #3772, #3773 and #3774.

Not tried: the real app with a real 40-key provider; the steps box is
CSS only and the test draws the real page.
2026-10-27 00:46:24 +08:00
yetone 77f860105c routing: a flowing wire is drawn in a layer of its own, so WebView2 doesn't redraw every wire each frame (#3164)
On Windows the Routing page with an 800-key group open ran at 31 fps.
A flowing wire (stroke-dashoffset animated) sat in the one svg of every
wire, 993x36215 px with 803 paths, and Chromium re-rasterized that whole
svg on the GPU each frame: CrGpuMain was busy 5s in 5s, 3.6s of it in
RasterDecoderImpl::DoRasterCHROMIUM. Hiding the wires svg gave 118 fps,
taking the dash animation off the wires 102 fps; WebKit (macOS) was
never slow here.

Now flowNear draws each flowing wire by a copy in .rt-flows, an svg over
the wires with will-change: transform, with the wire's d, --agent and
the dashes it worked out, and hides the wire itself (.flown: hidden,
no animation). The look is the same; the svg of every wire no longer
changes while a request flows. Reduced motion stops the copies too.

Real WebView2 (Edg/155, Windows 11, Radeon 8060S), the magpie window at
1281x1128 CSS px, dpr 1.1, a sandbox HOME with two providers of 499 and
299 keys in one group, both folds open, a request every 0.3s through a
fake upstream; v0.1.1587's release exe against this commit built with
GOOS=windows:
  steady 15s x3   31 fps, 89-94 frames >40ms  ->  114 fps, 4-9 >40ms
  scroll 12s      58 fps                       ->  88 fps
  fold+unfold 4s  41 fps                       ->  103 fps
The same injected by hand into the old page first: 38 -> 48 fps with
the copies in a plain svg, 94 fps with will-change, so the layer is
what does it.

Test: routing-answered-still checks that each flowing wire has a copy
with its d, animated, in a will-change layer, the wire itself hidden
and still, and that nothing is left once the request is done. Without
this change .rt-flows doesn't exist and it times out.

Run at this commit (rebased on origin/main 5a94eec3a, which touches
nothing under routing): routing-answered-still 20 of 20 alone in
chromium and webkit. Eleven routing GUI files at concurrency 3 against
the base 44a626bed under load ~74: 127 pass / 45 fail here, 123 / 49 on
the base; the reds are rule-editor files that fail the same on the base
(#3408). routing-keys-fold had 2 reds here under that load (its "3
resting" wait, not a wire) and is 32 of 32 alone 3 of 3. go test
./internal/gui ok; GOOS=linux and GOOS=windows go vet -tags nogui ok.
Not tried: WebKitGTK.
2026-10-26 19:31:27 +08:00
yetone 098ac9696d routing: with 200 keys or more only those near sight are in the list (#3164)
With both groups open (800 keys) every update laid out, read and moved
every key, longer than a frame in WebKit. From 200 keys on, a run of
keys far from sight is now one gap li as tall as they are (place), and
a key in it is given the box it would have there, so its wire is drawn
as before. Scrolled half a screen on, or when layout finds the view
moved, the list is made again around where it is, keeping what is in
sight where it was. put() moves only the nodes out of order, so a fold
held where it was clicked doesn't move with a re-place. A gap is a new
li each time, never one used again for other keys, so app.js's click
hold can't keep a gap that now stands for other rows (app.js unchanged).

The stage's ResizeObserver lays out in the next frame: layout() reads
the rows, and rows coming into sight change #rt's height by a fraction
of a pixel, which WebKit reported as a ResizeObserver loop.

Run at c158b0439 (origin/main, just fetched) + this change:
- routing-many-keys.test.cjs (now also scrolls to the foot, checks a
  wire ends at each key in sight, and clicks the second fold mid-list
  shut and open, checking it stays where it was clicked): 6/6 in both
  engines in six runs, the last three with the fold check (the last two
  at this exact tree). Before the rAF it was red in WebKit 3 of 3. The
  fold check also passes with gaps used again; the jump that made me
  keep gaps out of the hold isn't reproduced by any test.
- TestCoreScriptBudget ok; click-scroll, i18n-keys, quota-holds,
  view-middle-autoscroll 34/34.
- routing-*.test.cjs together: 55 reds, under load. Each red file run
  alone here and at c158b0439: no file redder here. intent-entry 3/4,
  live-patch 6/6, manual 2/2, pause 14/14, rule-effort 14/14,
  rule-remove 4/7, steady 2/2 (here/main), all filed (#3408-#3412,
  #3637, #3094, #3096); busy-frames, groups-jump, keys-fold, levels,
  mode-goes, row-two-lines, rules-line 0/0.
- Bench, 800 keys both groups open, WebKit, 15s of scrolling: 901/901/901
  frames vs 896/890/891 before; worst jank 457/440/362ms vs 833/930/835ms.

Not tried: the real Linux app (WebKitGTK).
2026-10-26 13:20:58 +08:00
yetone 9fc382e66d routing: a key off screen is not laid out or painted, so hundreds of open keys keep WebKit's frames (#3164)
With a group's 500 and 300 keys both open, WebKit drew ~40 frames a
second on the Routing page: hiding the keys below row 60 alone gave
back ~100 frames in 10s, so it painted every row again on each frame a
magpie flew. Chromium was at 60 already.

A key row now has content-visibility: auto, so one out of sight is
skipped. Its height while skipped is contain-intrinsic-size: auto
var(--rt-row): the last height it was drawn at, or, never drawn, the
content height of a key drawn now, which layout() reads with the boxes
it reads already and sets a frame later (set in the stage's own
ResizeObserver, WebKit reported a loop). Rows keep their heights, so
the wires to them and the list's scroll height are as before. A row a
429 hit (.hit) is drawn whole: its tag stands over its top edge, which
the paint containment would cut. A WebKit without content-visibility
or checkVisibility draws every row as before.

Run at this head (rebased on origin/main 5214d5114):
- routing-many-keys.test.cjs, new checks: a key in sight is drawn, the
  last of 800 is not, and every key is one height. Chromium and WebKit,
  en/zh/de: 6/6. On the old routing.css and client.js: 0/6 (the last
  key drawn); with this routing.css but the old client.js: 0/6 (keys
  61 or 62px drawn, 58px not).
- every routing*.test.cjs and panel-routing*.test.cjs (112 files,
  --test-concurrency=6, load ~27): 1418 tests, 1362 pass, 56 fail. Run
  alone at origin/main 5214d5114 and at this head: routing-kind 4/0,
  routing-keys-fold 32/0 and routing-rule-drag 10/0 on both (their reds
  were the full run's); routing-steady 0/2 on both (#3412);
  routing-rule-remove 9/11 at main, 12/8 here (#3094, #3096). The rest
  are the files 3173440ca compared on main: routing-intent-entry
  (#3408), -manual (#3409), -pause (#3410), -rule-effort (#3411),
  -live-patch (#3637).
- go test ./internal/gui/ (budgets included): ok.
- Sandbox (sbh-paint: providers of 500 and 300 keys on a fake upstream,
  a request every 0.3s, both groups open, Playwright WebKit 1280x900,
  10s, the served client.js and routing.css swapped four times):
  frames 367/391/410/412 -> 444/469/472/533, frames over 50ms
  3/4/3/4 -> 2/1/2/0. Off-screen row heights at 1280 and 700px wide
  measured the same as uncontained (38 and 61).

Tried and left out: the flowing wire's dashes on an SVG layer of its own
(no change past the noise, ~±30 frames); will-change on the wires and
the sky (none). Stopping the live wire's dash animation gives ~+40
frames more, but it is what says a request is with that key (#2386).

Not tried: the macOS app's own WKWebView window, WebKitGTK, a real
upstream.

Rebased on origin/main 385ce789e (a sidebar change only) and run again
there: routing-many-keys and routing-row-swap 8 pass, 0 fail.
2026-10-26 02:51:05 +08:00
yetone c888ef2725 routing: a rule's hours are kept in the zone they were set in (gaubeebangeel on X)
magpie on a cloud server in UTC read a routing group's rule hours on the
server's clock, so a Beijing user's 09:00-18:00 held at 17:00-02:00
Beijing time, with nothing saying so.

- provider.TimeWindow carries the IANA zone its hours were set in
  ("zone": "Asia/Shanghai", omitempty). Holds reads From, To and Days in
  that zone (time.LoadLocation, cached; Go's embedded tzdata, so Windows
  knows them too). A window with no zone, every one saved before this,
  stays on magpie's own clock (time.Local) as before. A zone magpie
  doesn't know is refused on save (clean); one in a file edited by hand
  makes the window never hold, so the rule is as if absent, never always
  on and never hours off. Text() adds " (Zone)"; Line() writes tz=.
- GUI: changing a rule's hours or days in the editor saves the browser's
  zone (Intl resolvedOptions().timeZone); hours left alone keep theirs.
  /api/groups gives magpie's clock (clock: zone, offset in seconds), and
  when its offset differs from the hours' zone the Routing page tells the
  zone beside them, on the group's rules and in the editor: "Asia/Shanghai
  time" (zh "Asia/Shanghai 时间"), or "server time, UTC+0" (zh "服务器时间
  UTC+0") for hours with no zone. Nothing is added when the clocks agree.
  zh, zh-TW, ja, de.
- CLI and TUI: time=09:00-18:00@Asia/Shanghai or tz=Asia/Shanghai; with
  none, this computer's zone ($TZ, time.Local, the /etc/localtime link)
  when it has an IANA name, otherwise none (magpie's clock). An unknown
  zone is refused with what one looks like; tz= alone needs time= or
  days=. Usage text updated.
- docs/subsystems/gateway-routing.md: the zone rules.

Older magpie reading a shared or synced group ignores zone and reads the
hours on its own clock, as before.

Run in a sandbox HOME with pinned Go caches, first at base 9277c2567,
then again after the rebase onto origin/main d58053720 (vet, builds, the five packages,
routing-time-zone and i18n-keys all ok again there; then rebased onto
11907448e, which changes migrate_side.go and sessions only, and
internal/provider ok again, 139s):
- gofmt -l on the changed files: nothing. go vet ./..., GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./...: clean. go build, GOOS=linux
  go build -tags nogui, GOOS=windows go build: ok.
- go test -timeout 45m -count=1 ./internal/provider ./internal/cli
  ./internal/tui ./internal/gui ./internal/gateway: all ok (provider 170s,
  cli 64s, tui 30s, gui 192s, gateway 513s; after the rebase 180s, 62s,
  25s, 181s, 568s); logs kept whole and grepped, no FAIL.
- New tests: TestRuleTimeWindowInItsZone (window, past midnight and days
  in a zone, instants in UTC), TestRuleTimeWindowWithoutZoneIsLocal,
  TestRuleTimeWindowUnknownZone, TestParseRuleTimeZone, TestRuleInZoneHere,
  TestGroupRuleTimeZoneCmd, TestRuleTimeWindowInItsZoneAtTurnStart
  (gateway, ruleClock in UTC). Run under TZ=UTC, TZ=Asia/Shanghai and
  TZ=America/Los_Angeles: ok. The zone used is Asia/Shanghai, or
  America/New_York on a computer on Beijing's clock, so they are red on
  any machine.
- GUI (playwright 1.62.0, chromium and webkit): routing-time-zone (new:
  en, zh, zh-TW, ja, de, 420px wide, browser in Asia/Shanghai, server in
  UTC and in Asia/Shanghai) 14 of 14; routing-time with the browser in
  Asia/Shanghai, the typed rule saved with its zone; routing-time-went,
  routing-day-window, routing-save, routing-rules-line, i18n-keys: ok;
  TestCoreScriptBudget ok.

Broken by hand: Holds reading at.Local() instead of the zone made
TestRuleTimeWindowInItsZone red under TZ=UTC (Shanghai's 10:00 not held,
18:00 held) and under TZ=Asia/Shanghai (with New York), and
TestRuleTimeWindowInItsZoneAtTurnStart red (10:00 Beijing went to the
group's order). routing-time-zone.test.cjs run against origin/main's
client is red (no zone told beside the hours).

Reds not from this change, the same on an untouched origin/main 99de8e1ad
worktree: routing-pause chromium 7 of 7 (#3410); routing-time webkit "Add
a rule" outside the viewport, 1 of 3 runs on main too (#3465);
routing-rules-line webkit zh 1100 once under load, passes alone on both
(#3593, filed now).

Not tried: a real cloud server in UTC with a browser in Beijing (the GUI
test sets the browser's zone and the server's clock instead); the Windows
box; the whole GUI suite.
2026-10-25 18:18:02 +08:00
yetone b5a78fd8b5 routing: a group's rules are dragged into order
monkeyin_92 on X: "希望可以上下拖动规则". Rules are checked top first, so
their order matters, and it could only be changed a place at a time from
each rule's ⋯ menu (Move up / Move down).

A rule's number is now its handle, as a model's number is in the same
editor (memberHandle): drag it up or down (the shared dragRows, which
the members, groups and agents use), or focus it and press Alt+↑/↓. The
rules are renumbered at once and the keyboard stays on the moved rule's
handle. The grip beside the number shows only on hover, while dragging,
or from the keyboard; the dragged rule is lifted with a card background
and shadow, no coloured border. Move up and Move down stay under ⋯ and
now go through the same moveRule. Saved as the group's rules in their
new order. "Move rule {n}" in zh, zh-TW, ja and de; the title reuses
"Drag to reorder · Alt+↑/↓ to move".

Run at this head:
- routing-rule-drag.test.cjs (new), chromium and webkit, en, zh, zh-TW,
  ja, de: 10 of 10. It checks the handles and their names, the grip hidden
  away from the row and shown on hover, a drag of rule 3 above rule 1
  with nothing opened by the drag's click, Alt+↓/↑ (past the end too)
  with focus kept, ⋯ Move down, the page not moved, and the saved rules'
  order with their conditions. Red on the parent (no .rt-rhandle): 10 of
  10 in the parent's full run.
- GUI: every routing-*.test.cjs plus i18n-keys, click-scroll and
  group-member-drag, both engines: 1321 pass, 55 red, all in files red the
  same on origin/main 42976f9a0 (routing-pause #3410, routing-intent-entry
  #3408, routing-rule-effort #3411, routing-rule-remove #3096/#3094,
  routing-manual #3409, routing-steady #3412/#1804, routing-live-patch
  #2174, routing-time #3465), but one routing-bodies case and one
  routing-intent-entry 440 case, which pass run alone (load ~40).
- Real run: built binary, sandbox HOME, magpie web on 127.0.0.1:3486;
  group Mix with rules "tokens >= 1 -> one/m, two/m" and
  "agent codex -> three/m". In headless Chromium dragged rule 2's number
  above rule 1, Save, reload: the editor and `magpie group rule mix` both
  list "agent codex -> three/m" first, the two-model rule second and
  whole.

Not tried: a real mouse or trackpad; touch; the WebKitGTK app on Linux;
Windows.

Rebased onto 5b2b3d3f5 (10 commits, gateway, gui and routing's
client.js among them) and run again at the rebased pair's head
68701dfe4: gofmt -l clean; GOOS=linux and windows vet -tags nogui of
provider, gateway, cli, tui clean; go test -tags nogui -timeout 45m
internal/provider (171s), cli, tui, gateway (422s), gui (budgets): all
ok; GUI routing-rule-drag, routing-rule-models, routing-compact,
i18n-keys, click-scroll, group-member-drag in both engines all pass;
routing-rule-remove red as on main (#3096, #3094).
2026-10-25 13:32:12 +08:00
yetone f99d27abc2 routing: a rule names several models, tried in order
monkeyin_92 on X: "can a rule take several models? Otherwise one rule
with several models is several rules." A rule now takes more than one
model (Rule.More after Rule.Use; `more` in the group's JSON, use=a,b
typed). They go first in that order: when the first fails or rests the
rule's next takes the request, ahead of the models the later matching
rules name and the group's others.

Every reader of Rule.Use goes through Uses/SetUses/MapUses/Without/Names
in grouprule.go:
- cleanRules: each must be the group's, each named once; a pause names one.
- gateway: ruleFor's turn hold, tool rounds and outgrown turns, compaction
  (the rule's first that takes the summary, the others in Small),
  ruleMembers/ruleOver/applyRule, nestedRules and ruleLed (the one a
  nested group's turn stays on), modelRuled, ruleEffort (useEffort asked
  of each), ThenUses (leaves out all of the rule's own). RuleHit.More is
  in the trace; Instead from More has Unready false, one from a later
  rule Unready true, as before.
- ruledEntry: what the group takes is what every one of them takes.
- provider rename, auto/ refs, groupfast, a member's removal (a rule
  goes with its last), ShareGroup and its import (one this magpie hasn't
  is left out of the rule).
- CLI `group rule add use=a,b` and its listing; `group models-=` keeps a
  rule's other models. The TUI shows them joined and keeps the rule when
  one is deleted.
- GUI (plugins/routing): a chip per model, a + for the next one, an ×
  on each while there is more than one, a chip picks another in its place
  (app menu, no native select); the card's tooltip and the trace's why
  ("…so c/mini, which the rule names after it, goes first"), nested too;
  en, zh, zh-TW, ja, de.

Old data: a rule of one model writes no `more`, so groups saved before
read and save unchanged (TestRuleMoreOnDisk). An older magpie reads `use`
alone: its requests go to the first model, the others are plain group
members in group order; if it saves the group, `more` is dropped.

Tests: TestRuleSeveralModelsInOrder, TestRuleEffortReachesTheRulesNextModel,
TestRuleCompactPassesOverTheRulesSmallModel (gateway); TestCleanRulesSeveralModels,
TestRuleMoreOnDisk, TestRuleWithout, TestParseRuleSeveralModels,
TestThenUsesLeavesOutTheRulesOwn, TestRuledEntrySeveralModels,
TestSharedGroupRuleSeveralModels, TestRuleMoreRenamedAndKept (provider);
TestGroupRuleSeveralModelsCmd (cli); TestGroupTakeOutKeepsARulesOtherModels
(tui); routing-rule-models.test.cjs. Broken by hand: ruleMembers on Use
alone turns the first two gateway tests red.

Run at this head:
- gofmt -l clean; go vet -tags nogui clean with GOOS=linux and GOOS=windows
  for provider, gateway, cli, tui.
- go test -tags nogui -timeout 45m: internal/provider, internal/cli,
  internal/tui ok; internal/gateway ok (384s); the new gateway tests
  again after; internal/gui budgets ok.
- GUI: every routing-*.test.cjs plus i18n-keys, click-scroll and
  group-member-drag, chromium and webkit (en, zh, zh-TW, ja, de where the
  file has them): 1319 pass, 57 red. routing-rule-models passes in both.
  The reds are in files that are red the same on origin/main 42976f9a0,
  run there just now: routing-pause (#3410), routing-intent-entry
  (#3408), routing-rule-effort (#3411), routing-rule-remove (#3096,
  #3094), routing-manual (#3409), routing-steady (#3412, #1804),
  routing-live-patch (#2174), routing-time (#3465). The other 10 reds are
  routing-rule-drag.test.cjs, which is the next commit's and not in this one.
- Real run, sandbox HOME, built binary: three fake OpenAI vendors, group
  Mix = three/m, one/m, two/m, rule `use=one/m,two/m tokens=1`. one/m
  answers 429: the request went one -> two (not three, the group's
  first); the next went straight to two, the trace saying
  instead=two/m with more=[two/m].

Not tried: a real vendor account; the TUI by hand; Windows and Linux
runs (vet only).

Rebased onto 5b2b3d3f5 (10 commits, gateway, gui and routing's
client.js among them) and run again at the rebased pair's head
68701dfe4: gofmt -l clean; GOOS=linux and windows vet -tags nogui of
provider, gateway, cli, tui clean; go test -tags nogui -timeout 45m
internal/provider (171s), cli, tui, gateway (422s), gui (budgets): all
ok; GUI routing-rule-drag, routing-rule-models, routing-compact,
i18n-keys, click-scroll, group-member-drag in both engines all pass;
routing-rule-remove red as on main (#3096, #3094).
2026-10-25 13:32:12 +08:00
yetone 2a8a177466 gui: the tray panel fits its tallest tab whole, and Routing's first open holds its height
CyberCaius (Discord, Windows): the tray panel jitters or shows a
scrollbar, and today's call count is slow on the first open.

- fit() measured the sections alone, so the view's padding, the gap
  under the tabs and what sits around a section were left out: 10px
  short on Routing, 31px with 8 agents. It now lays out every section
  at once (no data-ptab for the measure), sums each tab's sections by
  their margin box, skips what is display:none, and adds what lies
  outside the view. It never shows one tab after another: hiding the
  open tab ends its running transitions (panel-fold's unroll,
  tray-cell-click's refresh).
- Routing's placeholder was three short bars, and the panel grew when
  the trace landed. It is now a hidden copy of the stage and six
  request rows, so it is as tall as what comes.
- Today's line (usage?period=today) is asked for when the page is
  built, not after the first trace.

Test: internal/gui/tests/panel-fit-tabs.test.cjs, chromium and webkit
x en, zh, zh-TW, ja, de. 8 and 2 agents: no tab overflows the fitted
panel. Trace held: today's 42 shows before it, the fit is the same
after it, Routing doesn't overflow. Scrolled by wheel in a 220px
panel: fit(40); fit() leaves scrollTop where it was, with no scroll
events.

Run at tree 53ae48f72 (on origin/main 3b5a2f612): go test -tags nogui
-timeout 45m ./internal/usage ./internal/gui ok (TestCoreScriptBudget
included, no budget raised; app.js 1,317,465 of 1,317,486). GUI files
panel*, tray*, i18n-keys, routing-sessions (27 files, chromium and
webkit): 336 pass, 0 fail. gofmt clean. Earlier, at 7571ebc93: full
GUI suite 1095 pass; the 4 reds are two tests red on main too (#3497,
removed by hand gives "changed height 630 !== 561".
2026-10-24 23:49:08 +08:00
yetone b995095637 gui: a routing group's strategy is switched from its row (MoChou, #3450)
MoChou (#3450): changing a routing group's strategy took opening the
editor, finding the routing control, picking and saving. The routing
tag on each group row is now a pop-up button: it opens the app's own
menu (openProtoMenu, no native select) with the routings the editor
offers (GROUP_ROUTE_OPTS plus JS plugin routings), the current one
checked. Picking one saves the group through /api/groups/save with
every other field as it was, as the editor's Save would. Manual keeps
the pick the group had; with none the gateway takes the first member
(provider.cleanGroup), as with the editor. "Rate limited to the back"
is dropped when the new routing can't sink, as the editor does.
Re-picking the checked routing saves nothing; an editor with unsaved
changes asks first (confirmDiscard). The row's Edit button and switch
are unchanged; clicking the tag doesn't open the editor and doesn't
scroll. Keyboard: Enter/Space opens, arrows move, Escape closes back to
the tag, and focus returns to the same group's tag after the save
redraws the list. At <=560px in the window the row keeps only its
routing tag (the other tags stay hidden as before). New string "How
{name} routes: click to change it" in zh, zh-TW, ja, de.

Run (worktree; the new test, i18n-keys and internal/gui budget/i18n tests again at this head after rebasing on e698a688f, 22/22 ok):
- internal/gui/tests/routing-group-strategy.test.cjs (new): 18/18 ok,
  chromium + webkit; en/zh x light/dark, 520px window and 390px web,
  zh-TW/ja/de strings.
- Not the whole GUI suite: the machine sat at load 130-540 behind
  other sessions' suites for 2.5h. Ran every routing-*, i18n-*,
  plugin-* and gui-* file, both engines (1031 cases before I stopped
  it at load 500): reds only in routing-groups-jump (1 case, filed
  #3478; 3/3 alone), routing-intent-entry, routing-keys-fold,
  routing-levels, routing-manual, routing-mode-goes, routing-pause,
  routing-rule-effort, routing-rule-remove, all 5s timeouts or
  counts read early. routing-manual passed 4/4 rerun alone;
  routing-pause and routing-rule-remove fail the same way on an
  origin/main c819e00c4 copy at the same load (filed: #3410, #3411,
  #3408, #3096, #3094, #1612).
- go test -tags nogui ./internal/gui (core script budget): ok.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./..., gofmt -l, the three builds: clean.

Broken by hand, each red in the new test, then restored:
- origin/main's assets (MAGPIE_ROUTING_ASSETS): 18/18 fail ("the row's
  routing is a button", 0).
- keeping sink for Manual; dropping stopPropagation (the editor
  opened); dropping the focus restore; hiding every tag at narrow
  width.

Screenshots of the row and open menu, light and dark, en and zh, both
engines, checked by eye.

Not tried: the real app (WKWebView/WebKitGTK/WebView2) with real
groups; Windows; a JS plugin routing in the menu (only its code path
through withJS, which the editor shares).
2026-10-24 19:54:30 +08:00
yetone 91b0be8363 routing: a group's row opens into its editor and folds back in motion, and Save shows it
The owner asked (10-23) for iOS-like motion when a routing group opens and
folds, and for a save animation. drawGroups now measures each slot (a
group's row or its editor, data-gslot) before replaceKeeping and, where a
slot changed between row and editor, animates its height from the old one
to the new: opening on SPRING (570ms) with the editor's parts coming in
staggered from 6px above, folding on IOS_EASE (420ms) with the row's
content fading in. A new group's editor grows from nothing. Save shows a
spinner while the gateway saves; the saved row folds from the editor's
height and lights up, with a check that pops in by its name and goes
after ~1.5s. With reduced motion asked for nothing moves.

Folding from the editor's foot (where Save and Cancel are) would let the
browser clamp the shorter page and leave the row above the window
(WebKit showed it). foldInSight moves the page up with the fold, step
for step with the slot's height, as the reader's scroll; groupAction's
own keep-the-saved-row-in-sight check is skipped when the fold did it.

Run at this head (rebased on origin/main), Chromium and WebKit:
- group-morph.test.cjs (new): en, zh, zh-TW, ja, de at 1100 and 420px;
  the editor grows from the row's height, the row folds from the
  editor's, Save spins, the saved row folds from the editor's height
  with its check, the row is in sight after each fold; reduced motion
  has no height animation.
- routing-save, group-fold, routing-group-fold, routing-save-blank,
  routing-save-keeps-the-row, group-editor-align, group-editor-fits,
  i18n-keys.
- go test ./internal/gui -run 'Budget|Plugin|Asset': ok.
Broken by hand: without morphSlots the new test is red ("the editor grows from the row's 57px, not null", Chromium); without foldInSight it is red in WebKit ("the folded row is in sight").
Not tried: the real Linux (WebKitGTK) app.
2026-10-23 22:13:00 +08:00
yetone d3f3df746e routing: the page's head has Routing groups, which brings the groups at the page's foot into view (shihh on Discord)
The routing groups sit below the stage, the story and every request; with
many models (shihh on Discord) they are a long scroll down. The Routing
page's head now has Routing groups (#rtGoGroups) beside New group: a down
arrow, its name, and a tooltip saying where they are. Its click goes
through scrollOnPurpose, brings .rt-gsec to the top of the view and moves
the focus into it. The page's layout is unchanged (no #1354-style move):
the groups stay last in #rtMore. fitGo gives the button only the head's
spare room (the .grow spacer): named, its arrow alone (still named to a
screen reader), or left out, so nothing else in the head moves or wraps.
Strings in zh, zh-TW, ja and de. app.js untouched (plugin files only).

Test: routing-groups-jump.test.cjs, Chromium and WebKit x en/zh/zh-TW/ja/de
x 1000px web, 480px web, 640px window: 30/30. It is red on main's assets (no
button), red with the scrollOnPurpose check removed (the app's guard pulls
the view back), red without the focus move, and red with fitGo removed
(de at 480px web: Hide accounts moves).

Run at this change on 50f52b540 (de281760e, rebased under it, touches only internal/gateway):
- go test -tags nogui -timeout 45m ./...: 69 packages ok, no FAIL
- gofmt -l: clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: ok
- TestCoreScriptBudget and the other budget tests: ok
- GUI files the change can reach (routing*, group*, i18n-keys,
  click-scroll, title-bar-tools; 125 files, both engines): 1495/1495

Not run: the whole GUI suite. Another session's full GUI run held the
machine for 2h45m+, and this touches only the routing plugin's files.
Not changed: on a phone the web head already shrinks to its 40px
min-height on main, so wrapped buttons slide under the first card (Hide
accounts at 360px in German). Where the head has no spare room, the button
is left out rather than wrapped.
2026-10-23 21:37:16 +08:00
yetone 3a213e1dc1 routing: a waiting row's dot keeps its whole glow (#2553, dumplings)
The Routing request row's target cell (.rt-req .to) clips with
overflow:hidden, and the waiting dot's 6px glow sat flush against its
left edge, so the glow was cut on the left (and a pixel above and
below). The cell now has 6px of padding on its left and 1px above and
below, given back with a negative margin, so the glow fits inside the
clip and nothing in the row moves.

Run at 226551d0d (worktree base), GUI only (CSS change):
- New routing-wait-dot.test.cjs (chromium + webkit, en + zh, 1100 and
  420 wide): the dot has at least 6px of room left, above and below
  inside .to's padding box, and moves < 0.5px when the row starts
  waiting. Red on the old CSS ("left room 0"), green with the fix.
- wait-dot + routing-columns: 12/12 pass. A first attempt with only
  left padding broke routing-columns' alignment; this version doesn't.
- Every routing-*.test.cjs plus phone-rows and click-scroll: 262 pass,
  2 red under load ~240: routing-day-window.test.cjs:106 (chromium ja
  420, filed #3278) and routing-flood.test.cjs:97 (chromium en, #2215).
  Those two files alone pass 42/42 twice on the fix and twice on the
  old CSS, so neither is this change.

Not tried: the real Linux app (WebKitGTK); no motion or new API here.
2026-10-22 21:30:04 +08:00
yetone b3f5953495 routing: an open group's heading looks as every editor's does, not as the Models fold chip
The owner, 10-21: on an opened routing group the heading's space above
differed from below, and its line curved at the ends. The heading had
the class .fold to fold back into its row, and .fold is the Models
head's chip: padding 3px 6px 3px 4px, a 6px radius, the faint colour and
a pill background on hover. On the heading that gave 3px above against
8px below, rounded ends on its bottom line, a dimmed name and a box over
it on hover. It now has its own class (folds), which keeps the pointer
and adds a focus ring; the layout is .editor .ehead's, as on every
other editor.

Run on origin/main 4042aa4d1 + this commit, macOS, playwright 1.62.0:
- group-fold.test.cjs: 4/4, chromium and webkit, en and zh. Its new
  check (no padding above, square corners on the line, the name in the
  page's colour, no box on hover) is red with the old class (top 3px).
- Looked at in dark theme (chromium zh): the heading and the editor.
- Every routing-*, group-*, gateway-key-groups, names-fold and
  models-fold file (124): 1422 pass, 2 red under the run's load, both
  14/14 alone in webkit and both filed on main already:
  group-member-weight webkit de 420 (#2387), routing-rule-remove webkit
  en 390 (#3094, #3096).
- go test ./internal/gui/ -run Budget ok.
Not run: the rest of the GUI suite (the change is the routing plugin's
heading only).
2026-10-22 00:00:54 +08:00
yetone f21dd99f5a privacy: every masking is recorded, and Settings › Privacy shows it
What was masked is now kept, so the user can see it. Settings › Privacy
opens on a summary card: how many values were kept from vendors over 1,
7 or 30 days, by kind, by finder (rules, your words, the local model,
known values) and by where they went, with a day strip. The page is
grouped into What to mask, How it's found (rules and the local model are
layers, not a toggle: the model adds names and addresses rules can't
see) and Sharing. A records view lists each masked request: its kinds,
finders, placeholders and, while magpie runs, the line around each
value. Gateway › Recent calls and the Routing log carry a masked-N badge
that opens the record.

Originals never go to disk. internal/maskrec writes day files under
~/.config/magpie/masking (0600, 30 days, 100MB at most) holding kinds,
finders, placeholders, a first character or key prefix and a length.
The lines around values are kept in memory for the last 400 records
only, and /api/masking/value answers only while the masker remembers a
placeholder. Nothing is written under MAGPIE_TEST_SANDBOX.

A masker says what it masked through gwmw.Teller (JSONHits, TextHits,
Value); a plugin masker that doesn't is counted only, so older redact
plugins keep working. Every route that masks notes it: chat, Responses,
Codex backend and search, embeddings, images, video, transcription,
decide and the search MCP query. Masking still fails closed: a masker
that panics on any path refuses the request (TestMaskingOnAndOff's fake
now panics on JSONHits and TextHits too, since the gateway asks a Teller
through those).

app.js grows to 1,314,432 bytes, so its budget rises to 1,335,000 and
the core's to 1,528,800 (+1.5%): Settings is the core's own page.

Run at this head (rebased on origin/main a3ebed202):
- go vet clean on macOS, GOOS=linux -tags nogui and GOOS=windows;
  go test ./internal/gateway ok (561s).
- On origin/main c922225f1 (one commit back, the packages either side
  touches): agent, gateway, gui, gwmw, maskrec, provider, redact ok.
- On origin/main 592899467: go test ./... -timeout 45m, 65 packages ok;
  agent and gateway hit the 45m timeout under load ~26 (each mid-way
  through a short test, not a hang) and pass alone with -timeout 100m
  (1133s, 890s).
- GUI, on 592899467, the 42 files this change or main's new commits reach (privacy-*,
  redact-*, masking-records, settings-*, gateway-*, routing-bodies,
  routing-request-metrics, routing-log-icons, account-discovery,
  click-scroll, i18n-keys, old-webkit), both engines, every language:
  475 tests, 475 pass. routing-bodies is green here since 2543fb2c1.

Run on the previous base, origin/main c84864ffc (the whole suites):
- go test ./... -timeout 45m: every package ok (66), exit 0. An earlier
  run found TestMaskingOnAndOff/panics (its fake, above) and
  TestCoreScriptBudget (the budget, above); both fixed.
- gofmt -l clean; go vet on macOS, GOOS=linux -tags nogui and
  GOOS=windows clean; node --check on the changed scripts.
- GUI suite, both engines, every language, --test-concurrency=6:
  11533 tests, 11483 pass, 50 fail. Each failing file rerun alone here
  and on origin/main:
  - red the same on main, filed: codex-predictions (#2624),
    usage-checkin (#2549), usage-agents-hide (#2276), usage-fold
    (#2163), s3-sync (#2448), quota-count-wrap and
    quota-name-translated (#2228), routing-request-metrics (#2571),
    routing-bodies (#2559: red at its "second request pressed" step;
    this change's badge checks before and after it pass),
    routing-rule-remove (#3096, filed now: 0 2 1 alone here, 0 0 2 on
    c84864ffc).
  - load, pass alone: group-member-weight (#2387), routing-model-rest,
    context-tune (Chromium didn't launch in 180s at load average ~45;
    0 0 0 alone on both). An earlier whole run's library-chip-fan red is
    #3072 (filed), plugin-card-update #3079, lightweight #2638,
    segs-glide #2683.
  - mine, fixed: old-webkit, three ":hover, :focus-visible" lists
    Safari before 15.4 drops; split, 6/6.
- Broken by hand, each went red: masked values kept on disk
  (TestNoValueOnDisk), a snip that runs past an escaped quote
  (TestSnipStaysInItsString), the shared-line dedup in the records view
  (masking-records, 10 of 12).
- Real app in a sandbox HOME with the local model on: the summary card,
  flow, chips and records view in light and dark; persons and
  addresses, Chinese names among them, recorded by=model; a grep of the
  masking folder and the sandbox config for the masked values found
  none.
2026-10-21 06:12:37 +08:00
yetone a8224019af routing: a day of thousands of requests draws only the rows in sight, and its numbers are measured again on a new width only (#2524)
UNscientific-9 (#2524): picking a day on Routing's request list froze the
page for seconds with thousands of rows. renderLog built a row for every
request of the day (~20 elements each, up to 2,000 a day) and put the new
ones in among the old row by row, so both days' rows were in at once.
Beside that, metaFit was run by a ResizeObserver on the column's every
change of size; the meta-under mark it sets changes the column's height,
which measured every row's numbers again (the reporter saw 8 runs in 8s,
~200ms each).

Now:
- A list of 300 or more items is windowed: only the rows in and near
  sight are drawn, between two aria-hidden gaps as tall as the rows above
  and below. A drawn row's height is measured and kept; one never drawn
  counts as the average. Scrolling or a resize draws the rows then in
  sight, once a frame, and the first row in sight stays where it was.
- The columns stay as wide as before: for each shape of row not drawn
  (its time's digits, model and kind, its numbers), one unseen, inert
  zero-height probe row stays in the grid, so the auto columns size by
  it. The digits are tabular, so a probe stands for its shape.
- A list made mostly anew (another day) is put in with one
  replaceChildren, not row by row among the old ones.
- metaFit runs on a change of the column's width only. When it moves the
  numbers under or back, the list is drawn again for the new heights.
- A row's clock uses one cached Intl.DateTimeFormat.
Under 300 items the list is drawn whole, as before.

Not done here, from the reporter's list: drawAll still runs renderHist on
a static day at each poll. Measured with a live request arriving every
250ms while a 2,000-row day was shown (scratchpad dayidle.cjs, chromium,
4s): frame callbacks 330 / 211 ms total / 9 ms longest before, 90 / 52 ms
/ 4 ms after. A guard there would have to know every input of renderHist
(now(), lifted rests, names), so it was left out. Trimming prompt.parts
from the payload is on the server, not here. The renderer crash on
repeated switches was not reproduced.

Measured (scratchpad dswitch.cjs, 2,000 rows a day, 1280x900, five day
switches each, wall ms / longest block ms, load average ~220-290):
- chromium before: 379/304 454/374 452/374 474/389 427/376, rows=2000,
  ~39,740 elements
- chromium after: 56/22 61/20 56/19 74/21 410/17, rows 17-21, ~1,520-
  1,600 elements (the 410 is wall time under load; its longest block 17)
- webkit before: 565/461 624/493 639/526 625/516 616/516, rows=2000
- webkit after: 117/37 95/25 93/30 128/26 138/25, rows 17-21
- same grid columns and list height after as before, in both engines:
  chromium "89.4375px 94.1875px 661.078px 181.297px", scrollHeight 61602;
  webkit "89.4375px 94.1875px 641.078125px 181.296875px", 61602

Run:
- tests/routing-day-window.test.cjs (new), chromium and webkit, en zh
  zh-TW ja de, 1280px and 420px: 30 tests, 30 pass. It picks a 2,000-row
  day, checks the rows drawn are bounded and the list is as tall as all
  of them, scrolls to a wide model far down (columns unchanged, not cut),
  holds a row still across frames mid-list, reaches the last row and picks
  it, switches day, and goes By session to the list's foot. The second
  test grows the column taller three times and counts reads of the
  numbers' boxes: 0, and >0 on a new width.
- Same test on the old assets (MAGPIE_ROUTING_ASSETS, the routing
  client.js/css before this change), chromium en: 3 fail, "a day of 2000 put 2000 rows in
  the list" (both widths) and the measure test (12000 reads, not 0).
- Broken by hand: WIN_MIN 300 -> 300000 fails "a day of 2000 put 2000
  rows in the list"; the width guard taken out fails "156 !== 0" in both
  engines. Both restored.
- tests/routing-sessions.test.cjs: its 2,001-request history test now
  scrolls to a session's group instead of expecting all 2,001 rows in the
  DOM. 8 pass, 0 fail (chromium and webkit, en and zh).
- routing-*.test.cjs, panel-routing*.test.cjs and every other GUI file
  that reads the request list (claude-auth-status, claude-subagent-tag,
  dates-gui-lang, click-scroll, codex-subagent-model, codex-credits,
  desktop-subagent-model, key-nourl, phone-rows, reasoning-speed,
  remote-group-served, purpose-filter, search-instead, rest-try-now,
  search-mcp, vision-mcp), both engines, every language, concurrency 4:
  1412 tests, 1390 pass, 22 fail. 18 of those are routing-bodies,
  routing-keys-fold, routing-model-rest, routing-request-metrics and
  routing-wb-restricted, which fail the same way on the old assets
  (#2658, #2559). The other 4 (rest-try-now chromium en 1100 and ja 420,
  routing-log-icons webkit zh, routing-time-went chromium de) pass when
  their files run alone: 64 tests, 64 pass.

Not tried: WebKitGTK and the Windows WebView2 app (where the reporter's
seconds-long freeze was on Windows); the numbers above are Playwright's
Chromium and WebKit on macOS.
2026-10-20 20:23:53 +08:00
yetone ac3a2a3df5 routing: the page asks for frames only while its stage moves, and the live dot pulses only while a request is under way (#2827)
zhang-4411 (#2827): under xrdp/X11 with no GPU the Routing page's web
process took 459%-830% CPU. Beside compositing (27353a952), the page
itself drew on every frame while nothing moved: its frame loop asked for
the next frame forever once Routing was shown, and the live dot's rtlive
pulse ran with no request under way. On llvmpipe each of those frames is
rasterised on the CPU.

Now the loop stops once nothing on the stage moves and is kicked again
by what makes something move (a request arriving, a replay, the page
shown again). The dot pulses (.rt-livedot.on) only while a request is
live. With no request, the page asks for no frames.

Measured in the GUI harness (scratchpad measure.cjs, 4s windows,
Playwright on macOS, load average ~200):
- chromium, Routing idle: before 70 ms CPU/s, 60.3 rAF/s, 1 running
  animation (rtlive); after 4 ms CPU/s, 0 rAF/s, 0 animations
- webkit, Routing idle: before 62 rAF/s, 1 animation; after 0 rAF/s,
  0 animations (WebKit's per-process CPU reading was negative under
  this load, so only frames are given)
- Routing busy (requests moving) is unchanged: chromium 176 -> 186 ms
  CPU/s, ~64 rAF/s both

Run:
- tests/routing-idle-frame.test.cjs (webkit, en and zh, as the file
  runs): 9 pass 0 fail. It now also counts the frames asked for with
  nothing moving and checks the dot's animation; MAGPIE_ROUTING_ASSETS
  points it at an older asset tree.
- Same test on the old assets (9fd80b212's, MAGPIE_ROUTING_ASSETS):
  FAIL "the Routing loop kept asking for frames with nothing on its stage
  moving (26 frames in 400ms)".
- Broken by hand (animation back on .rt-livedot): FAIL "the live dot
  pulsed with no request under way". Restored.
- Routing GUI files, chromium and webkit, every language: 1104 tests,
  1086 pass, 18 fail. Every one of those 18 fails the same way on the
  old assets in the same run (base 22 fail, new 20 fail on the reruns):
  routing-bodies "opens to its request and response", and under load
  routing-model-rest, routing-keys-fold, routing-request-metrics and
  routing-wb-restricted. All are in #2658 (and #2559). The one red only
  on the new side, routing-wb-restricted zh-TW 420px, passes rerun alone
  in both engines.

Not tried: WebKitGTK, xrdp or llvmpipe. Playwright's WebKit is not
WebKitGTK, so the CPU the reporter sees is not measured here.
2026-10-20 20:23:53 +08:00
yetone b0b0764210 gui: a routing rule's ⋯ is always shown, and a rule Save refuses for having no condition says so under it, with how to add one or remove it (ppBruce on Discord)
ppBruce (v0.1.1290): in a routing group's editor "once a rule is added
there is no delete button, and a rule with empty conditions can't be
saved". Two causes:

- The rule's ⋯, the only way to Remove rule (and move a rule), was
  opacity 0 unless the row was hovered or focused (538753a7a, chosen "as
  the usage rows'", not an owner call). Nobody found it, and on touch
  there is no hover. It is now always drawn, in the icons' quiet grey.
- A rule whose only condition was toggled off (the reporter's 带图片)
  is refused on Save; provider.cleanRules refuses it too ("it needs a
  condition"), so refusing stays. But the refusal was a footer pill that
  cleared in 3.5s and named no way out. Save now marks every bare rule:
  a line under it (.rt-rneed, until it has a condition again) and the
  status line say "Rule {n} has no condition. Add one with its +, or
  remove the rule from its ⋯ menu", the first bare rule's + takes the
  keyboard (no scroll), and nothing is posted. A pause rule says the same
  for hours, days, agents or folders. zh/zh-TW/ja/de in i18n.js; the
  two old strings are gone, and routing-pause(-folder) expect the new
  wording.

Test: routing-rule-remove.test.cjs, Chromium and WebKit, en zh zh-TW ja
de, 1100 and 390px, with the reporter's group (one "has an image" rule to
Deepseek-V4.1-Flash, WorkBuddy AI): the ⋯ is opaque, visible, inside the
editor and topmost with the pointer elsewhere; mouse and keyboard (Tab,
Option-Tab in WebKit, Enter, ArrowUp, Enter) remove the rule and Save
posts rules: []; the bare rule's line and status, focus on its +, no
post, nothing past the editor, no sideways scroll; its condition back on,
the line goes and Save posts the rule. 20/20, three repeat runs 20/20.
On the old assets (ASSETS=) 0/20: "the rule's ⋯ is there without
hovering", opacity '0'.

Run:
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok;
  builds ok.
- go test -timeout 45m ./...: 63 ok, internal/agent timed out at 45m
  under load (~400, the GUI suite beside it; the running test 5s in);
  alone: ok 1878s.
- GUI suite, both engines: run under load ~400. My change's files
  pass alone: routing-rule-remove 20/20,
  routing-pause 14/14, routing-pause-folder 20/20, routing-rules-line
  20/20, routing-intent-entry 8/8, i18n-keys, gui-zh-tw, gui-ja, gui-de
  3/3 each. The full run: 11064 pass, 111 fail, none in the routing
  editor's files.
  Reds outside routing's editor, each red the same alone on origin/main
  c3b2e6109 and already filed: codex-predictions #2624, lightweight
  #2638, name-suffix-no-names #1937, routing-bodies and
  routing-keys-fold #2658, routing-model-rest #2115, quota-count-wrap and
  quota-name-translated #2228, provider-advanced-fold #2552, segs-glide
  #2683. routing-request-metrics' Cost item
  (#2571) fails the same on main alone. The rest of the 111 were not
  rerun one by one at that load.
2026-10-19 22:23:50 +08:00
yetone 78827954fb routing: with routing groups off, the Routing page says so and turns them on (bigbenniu on X)
bigbenniu on X: on a new install the Routing page had nothing past its
requests, no New group and no word of where it had gone. A new install's
Essentials preset leaves the "groups" built-in off, and everything marked
data-feature="groups" was hidden without a trace.

Now an element can be marked data-feature-off="<id>", the other way
round: featureStyle shows it only while that feature is off. Where the
routing groups were, the Routing page shows such a note: routing groups
are off in Plugins › Built-in, the groups magpie finds still route, your
own can't be made or changed here; and a "Turn on routing groups" button
that posts plugins/builtin {id:"groups",on:true}, applies the answer and
reloads the groups. It sits after the groups' own rows, so their order
(group-found-off's check) is as it was. Strings in zh, zh-TW, ja and de.

Run:
- internal/gui/tests/routing-groups-off.test.cjs (new), Chromium and
  WebKit, en and zh, 900 and 420px: groups off shows the note and its
  button, New group and the groups hidden, the note fits the window;
  the click posts {id:"groups",on:true}, the note goes, the groups and
  New group come back, the status says so; groups on shows no note;
  every new string in zh, zh-TW, ja and de. 18/18 with group-found-off.
  Red by hand two ways: without the note's data-feature-off (6 of 7
  red in Chromium), and without featureStyle's data-feature-off rule
  (6 of 7 red). Screenshots looked at, zh 900 and 420.
- 119 GUI files (routing*, group*, panel-routing*, builtins, *-off*):
  all pass but routing-bodies (10) and routing-keys-fold (5), which
  fail the same 15 on a fresh origin/main ea3dee96a run alone: #2559
  and #1612.
- go test -tags nogui ./internal/gui ok. No Go file changed.
Not tried in the real Wails window.
2026-10-16 20:42:04 +08:00
yetone fa5295d011 panel: a Manual routing group's model is switched from the tray panel (#2489)
Jerell.OvO asked on Discord (#general) to change a Manual group's model
from the tray's dropdown. Until now that worked only on the group's card
on the Routing page or with `magpie group pick <id> <model>`.

- provider.PickGroup(id, pick) sets a Manual group's Pick and nothing
  else. It refuses a group that doesn't route by hand, a model not in
  the group, and an unknown or hidden group.
- POST /api/groups/pick {id, pick} calls it and answers with the groups'
  state. The panel doesn't send the whole group back the way the card's
  save does, so a stale panel copy can't overwrite an edit made on the
  Routing page in the meantime.
- Tray panel, Routing tab: under today's totals, one row per Manual group
  of two or more members that is on. The row has the group's name and its
  picked member as a sess-pick button. The button opens the app's menu
  (openProtoMenu, no native select), headed "Model every request goes
  to". It lists the members with the card's notes ("fast", the provider,
  and "no provider serves it now" for one not ready), and the picked
  member is ticked. Picking the ticked one posts nothing. No new layout,
  no left border.
- The tab reads the groups again when it is shown, and loadGroups redraws
  the panel. A pick made on the Routing page or from the CLI shows here.
- New string in zh, zh-TW, ja, de.

Tests:
- TestPickGroup (provider): switches and routes to the new member, keeps
  the rest of the group, refuses the three cases and changes nothing
  then. Red with the `g.Pick = pick` line removed.
- TestGroupsPick (gui): /api/groups/pick answers with picked = the new
  member and refuses a non-member.
- panel-routing-pick.test.cjs: a 440px panel in Chromium and WebKit, in
  en, zh, zh-TW, ja and de. 10/10 pass. Red with the row left out of
  renderPanel. Screenshots were checked in de (web) and zh-TW and en
  (app).
- gofmt -l clean; go vet -tags nogui for darwin, linux and windows: clean.
- GUI subset (panel-*, routing-*, i18n-*, header-relang,
  agent-notice-lang; 1199 cases) on 63be47717+this: 1175 pass. Each red
  was rerun file by file on this head and on a clean 63be47717 worktree.
  routing-bodies (10, also red alone on main): #2559. routing-keys-fold:
  #1612. routing-model-rest: #2115. routing-request-metrics (webkit):
  #2571. Those three are red the same on 63be47717. routing-effort-change,
  routing-flood and routing-wb-restricted pass alone on both. None of
  these open the tray panel, and the new code runs only there.

Full suite: `go test -timeout 45m ./...` under set -o pipefail with a
sandbox HOME, on 63be47717+this, load 250-300: 63 packages ok. Red:
internal/agent past 45m (#2544), internal/gateway past 45m (#2108),
TestAgentGoneInTheRetryPause/group_replan (#2543), TestIntentClassifierGroup
(#1813), TestMainWindowCorners (#1936). Each named test passes alone on
this head. A rerun of agent, gateway and gui timed out again in agent and
gateway, with TestMainWindowCorners again the only gui red. The earlier
TestPanelJoinsFullScreenSpaces red is gone after 63be47717. Rebased onto
b2764f7f9, which has six later commits that touch none of these files.
The targeted tests above were rerun there.

Rebased again onto ba132d68b (seven later commits, none touching these
files; one changes app.js). Rerun there: TestPickGroup, TestGroupsPick,
panel-routing-pick.test.cjs 10/10, gofmt -l clean.
2026-10-16 20:03:29 +08:00
yetone af601541ef routing: a request opens to its request and response (Fate on Discord)
Fate asked on Discord to see what a single request on the Routing page sent
and got back, such as a Codex prediction. The bodies were captured already,
in the Gateway page's 40 recent calls and the opt-in request archive, but
nothing led there from a Routing request.

- gateway: a Call carries the Routing request it was (Call.Route = the
  trace's Route.ID), set where serve, the Codex backend and a refused title
  record it. Server.RouteCall finds it in the ring. A route id is not a
  call id. A route names its archive copy (Route.Archive =
  call.archiveName()), set only when the archive was on, so it reaches the
  saved history too.
- gui: GET /api/gateway/call takes ?route= besides ?id=. It is the same
  handler, the same no-store, the same key guard and the same 404 once the
  ring has let the call go.
- Routing page: the story's head has "Request and response". It fetches
  only when pressed, and shows the masked bodies through callBodyPanel (an
  SSE reply reads as its events). A request the ring no longer has shows
  the archive's copy through archivePanel when the route names one.
  Otherwise it says the last 40 are kept until magpie quits and how to turn
  the archive on. Nothing more is captured or kept than before.
- The head now wraps. At narrow widths its buttons ran past the story
  ("Back to live" was cut off at 440px).
- The two button words live in i18n.js: i18n-keys' "a plugin's words are
  its own" found them inside core strings.
- docs/subsystems/gui-shell.md says how a route reaches its bodies.

Tests:
- TestRoutingRequestOpensItsBodies (new): each of two routes gets its own
  bodies; route 0 and an unknown route get 404. Red without
  `call.Route = tr.ID` ("route …: 404").
- TestArchiveWholeBodies now checks that the route names the archive. Red
  without the t.Archive line (`route names archive ""`).
- routing-bodies.test.cjs (new), chromium and webkit at 440px, en, zh,
  zh-TW, ja and de, 10/10. It covers the ring's copy read only when asked,
  hiding, another request closing it, the archive's copy, the
  how-to-keep note, nothing past the story and no left border.
  - Red with the client asking ?id= and with the head's wrap removed.
- routing-request-metrics.test.cjs: with the head wrapped, its 480px
  picker clicks in WebKit landed on the footer. Playwright's WebKit places
  elements in the scrolled view hundreds of px lower than
  getBoundingClientRect, which elementFromPoint agrees with. The test now
  clicks where the page shows them. 5 runs of both engines, 20/20.

Run in a sandbox HOME at f1c91a99c plus this change:
- gofmt -l: clean. go vet -tags nogui: darwin, linux and windows ok.
- GUI: routing-*, panel-routing*, recent-call*, i18n-keys and
  header-relang in both engines: 1079 tests, 1079 pass (a first run had
  2 reds, both fixed above).
- go test ./internal/gui after the i18n move (TestPanelJoinsFullScreenSpaces
  skipped): ok.

Full suite: `go test -timeout 45m ./...` gave 65 ok, 1 FAIL. The FAIL is
internal/gui TestPanelJoinsFullScreenSpaces ("the panel shown doesn't take
the keyboard"), red 3/3 alone here and red the same on origin/main
1d227a7eb just fetched. It is filed as #2450.
2026-10-16 07:23:55 +08:00
yetone 6f92815335 routing: each try says where its time went: magpie, the network, the vendor (Discord, Magic_zero)
A user read a slow turn as the gateway being slow. The try loop's
httptrace now also records DNS, connect, TLS, GotConn (reused or not)
and the first response byte. Each Try keeps a TryNet ("net"): magpie's
own time, requests made before it, the wait for a pooled connection,
DNS, connect, TLS, sending, the vendor's wait for its first byte, and
Head (from the try's start to that byte). A Route also carries the usage
record's Sent/Own/Retried/Queued split. Usage records are unchanged.

The Routing page's story shows "Where the time went" under each finished
try. It is one stacked bar plus named values, in three groups (magpie,
network, vendor): Waiting for a slot (tr.queued, which was never shown
before), In magpie, DNS, Connecting, TLS, Sending, Vendor (first byte),
First token, Streaming. Parts that took no time are left out. The
strings are in every language. "Waiting for a slot" moves from the
Usage plugin's i18n into i18n.js, since Routing uses it too.

Not covered: plugin providers (and any other request sent by something
other than Go's client). Their request goes out through the Bun host's
fetch, so no httptrace fires. Such a try has no net and shows no
breakdown, only the time it took, as before (and so does a trace from
before this change).

Run (worktree at origin/main b03031738):
- gofmt -l: clean. go vet -tags nogui ./... for GOOS darwin, linux and
  windows: ok.
- TestTryTellsWhereItsTimeWent uses a TLS fake whose headers are held
  300 ms. Wait must land in [hold-1, hold+5000]. On a new connection
  TLS is > 0. The steps sum to no more than Head, and Head is no more
  than TTFT. A reused connection has no DNS, connect or TLS.
  -race -count=3: ok.
- Broken by hand: with the old two-hook trace back in gateway.go, the
  test fails ("no timing").
- routing-time-went.test.cjs: chromium and webkit × en, zh, zh-TW, ja,
  de at 440px: 10/10. It checks that the bar is to scale, that nothing
  spills out of the story, that there is no left border, and that the
  plugin try shows no breakdown. i18n-keys: ok. Rerun on the committed
  tree: 13/13 with i18n-keys.
- routing-*, usage-ledger*, lane-limit at --test-concurrency=4:
  4 reds, all webkit click timeouts in routing-busy ("trace updates
  keep the rows…", en and zh) and routing-idle-frame ("hiding a running
  replay…", 2). Both files run alone: 13/13, twice. Recorded on #2211 (the same files go red under load on main cf21b71ff).
- Real use: magpie serve --web on 3571/3572 in a sandbox HOME, against
  a fake vendor (900 ms before its headers, 300 ms to its first token,
  then 1 s of chunks). New connection: In magpie 1.3 ms, DNS 0.3,
  Connecting 0.4, Sending 0.1, Vendor (first byte) 912 ms, First token
  294 ms, Streaming 1.0 s. A reused connection had no DNS or connect.
  Both were seen in the page, in headless Chromium.
- Not tried: a real vendor over TLS through the app; the Linux
  WebKitGTK app; Windows.

Full suite: go test -tags nogui -count=1 -timeout 45m ./... ok
(66 packages; gateway 811s, agent 728s, provider 359s).
2026-10-16 01:55:47 +08:00
yetone 0e8fcd7926 routing: an account that answered is lit but still; only a request in flight pulses and flows, and a panicked request's routes end (#2386)
Since af5889085 the account that answered the last request kept a
pulsing dot and a flowing wire after the request was done, which reads
as 正在调用 on every reload, local and remote alike. lightRow now tells
answered (filled dot, solid wire in the agent's colour, nothing moving)
from in flight (pulse and flow), for single rows, key folds and nested
groups. Separately, a request whose handler panicked left its routes and
tries open for good ("answering…", counted in progress, never trimmed):
every route begun is recorded and `counted` ends any still open as 500
before the panic goes on to net/http.

Run: gofmt; go vet -tags nogui ./internal/gateway for darwin, linux,
windows; go test -race -count=5 of TestAgentGoneMidRequestLeavesNothingInFlight
and TestPanicEndsTheRequestsRoutes ok; with endBroken removed by hand
the panic test is red. GUI: routing-answered-still (new; red on the old
client.js/css with flowing 1, moving 1), routing-keys-fold (updated:
expects a lit still wire after the request), group-fold, held-dot,
agent-hue-not-red, mode-goes, busy, agent-gone, live-patch: 203 pass,
0 fail in chromium and webkit. Not tried against a real remote magpie.

Full suite: SUITE_LINE
2026-10-15 23:08:05 +08:00
yetone 431e2941bb gui: a Routing request whose numbers don't fit one line keeps where it went whole and its numbers on one line under it (#2288, xishuchkui-code)
On a laptop's screen (about 1300px wide at 150%) the request list beside
the accounts is ~800px: wider than 760px, where a row goes onto three
lines, but too narrow for one. A row there cut where it went to
"Op… · deepseek-v4.1-fla…" and broke its metrics over two lines of their
own, at a different place on each row.

Now, where a row's metrics would wrap in their column on one line, the
list's column gets a meta-under mark and every row keeps its time, the
model asked and where it went on its first line and its metrics on one
line under them. metaFit decides it on the next frame after a resize or a
render: it takes the mark off, measures whether any row's metrics wrap,
and puts it back if so, before the frame is drawn, keeping what scrolls in
place (rows are shorter on one line). Measuring under the mark instead let
it flip: metrics within their 40% share can still wrap beside a wide model.
Where they fit, the row stays on one line as before (#860's
routing-columns); 760px and narrower is unchanged.

A fixed max1100 width mark was tried first and dropped: it put #860's
fixtures, which fit one line at a 900–1056px list, onto two lines.

Run: new routing-row-two-lines.test.cjs (Chromium and WebKit; en, zh,
zh-TW, ja, de; viewport 1500 = list ~845px beside the accounts, the
reporter's, plus 1300, 1100 and 420) and routing-columns pass, 14/14;
with the meta-under toggle removed by hand the new test fails in every
language ("where it went is cut"). Related GUI tests (172 files: routing-*
and every test that opens view=routing or the header), both engines, at
concurrency 4: 2449/2463; the 14 reds are routing-held-member WebKit 420
(#2252), routing-model-rest (#2115) and routing-wb-restricted (#1905),
each red alone on origin/main d0ccbbebc too (1-2 per run of these files on
both, across 3 runs), and routing-weight-chip, 16/16 alone. After the
switch to measuring on one line: routing-row-two-lines, routing-columns,
routing-scroll-end, routing-pointer-pin, routing-failed-open, click-scroll,
routing-request-model, routing-weight-chip 98/98. A probe at viewports
1500/1300/1240/1100/900 in both engines saw the mark settle (no
frame-by-frame flipping) and every reporter row whole on two lines.

Full suite: SUITE_LINE
2026-10-15 23:08:02 +08:00
yetone dcf292cc8e routing: a group editor's labels are level with their controls, and every hint 4px under it (the owner)
Models' and Patterns' lists, empty in a new group, still took a grid row,
so the add button and the pattern input began 6-10px under their labels
(Models 7.5px, Patterns 11px off). Slow to start's and Context's hints sat
12px under their choices (an 8px wrap gap plus the hint's 4px margin) where
every other row's sit 4px.

- app.css: `.fallback .fbl:empty` takes no row. This was already so for the
  rules list (.rt-rules); it now holds for every .fallback, the provider
  editor's Fallback list among them, and the rt-rules copy goes.
- routing.css: the pattern input's 4px margin only follows a list with
  patterns in it; ctx-wrap's row gap is 4px and its hint has no margin.

Run at dd25997a4 + this change:
- new internal/gui/tests/group-editor-align.test.cjs: chromium and webkit,
  en/zh/zh-TW/ja/de, a new group and one with members and a pattern; each
  label's first line within 2px of its control's, each hint <=4px under.
  20/20 pass; 10/10 chromium fail with the CSS change stashed.
- measured by hand: every row now within 1.5px (chromium) / 1.7px (webkit),
  in web and app mode.
- full GUI suite (741 files, --test-concurrency=6): 15 reds in 11 files.
  Rerun alone, with and without this change, the same 4 fail both ways and
  are filed: quota-count-wrap and quota-name-translated in webkit
  (#2228, #2399), refusal-retries-setting ja 420 (#2258). The other 8 files
  (context-picks, copilot-signed-out-account, images-library-way,
  library-env-refs, library-gone-agents, login-import, routing-model-rest,
  routing-wb-restricted) pass alone both ways; they failed only under the
  6-way parallel run.
- not tried: the real desktop window; Linux WebKitGTK (no motion or new API
  here, only grid rows and gaps).
2026-10-15 21:10:59 +08:00
yetone f255a3e3b7 gui: a routing group's editor keeps its member rows and pattern row inside it, a long model's name ellipsized, not the chips cut off (碳碳双键 on Discord)
碳碳双键's screenshot (zh, ~770px): in a group's editor the 模型 rows ran
past the editor's right edge, 跟随分组推理 / 标准速度 cut off, and the 模式
row didn't line up with them. .fallback and its .fbl are grids with an
auto track, which grows to the widest row's min-content: one long model
id (nvidia/nemotron-3-super-120b-a12b:free) widened the whole column.

The track is minmax(0, 1fr) now, so the column is the editor's width. A
member row's name and its provider shrink and ellipsize (the provider
first), with the whole name as a title on hover; when the chips still
don't fit they wrap to a second line, right-aligned. The rules group
(.rt-rules) and the phone's own row layout (body.web, which wraps and
starts at the left) are left as they were; the new rules sit in :where()
so the phone's still win.

New test group-editor-fits.test.cjs: Chromium and WebKit, the desktop
window and the web page, 1100, 770 and 420 wide, en, zh, zh-TW, ja, de.
It checks that nothing in the members or patterns box passes the
editor's edges, no chip is cut, the page doesn't scroll sideways, the
pattern row's edges are the members box's, and the long name is a title.
It fails on origin/main 00501401a in both engines (desktop 1100 en
already: past the editor's edge) and passes here. Screenshots at zh 770
and de 770 desktop and zh 420 web compared with origin's by eye.

Run: the group-* and routing rules/weight/columns/shape files, 258 of 258;
the full GUI suite (node --test, concurrency 6, 9679 tests): 34 red,
in quota-count-wrap, quota-name-translated, refusal-retries-setting,
routing-held-member, usage-agents-hide, usage-fold (red alone the same
on the unchanged base 8e8316ed2; filed as #2228, #2163, #2252, #2211 and
the new #2258) and four that pass alone (deprecation-notice,
login-import, name-suffix-no-names, remote-magpie).
2026-10-15 04:20:09 +08:00
yetone eb7199e120 gui: Routing is a plugin's page, its script, style and words in plugins/routing (P2)
P2 of docs/subsystems/plugin-runtime.md, the third page after Sessions
and Library.

- routing.js and routing.css move to assets/plugins/routing/ (client.js,
  routing.css). Its part's html is the page's head and boxes that were
  index.html's <main id="view-routing">; the rest is drawn by
  routingPage, run at mount since it builds on app.js. It keeps itself
  after that as it did (its own hidden, the language, focus), so its
  hooks are dirty and discard, a routing group being edited, which
  show() and the window's close ask through magpie.call:
  window.routingDirty and discardRouting are gone.
- plugins/routing: Essential, Requires window and gateway, in use while
  the user has a routing group (not Auto, not Hidden), since the page is
  where it is edited. The gateway routes the same with it off.
- With it off, what leads to the page goes too: the nav and panel tabs
  and the panel's section (data-feature="routing"), the guide's Open
  Routing, Providers' "Make a routing group of …", the Usage list's
  View routing and its time as a link, the context card's Latest
  request. A panel left on its Routing tab shows Agents.
- What other pages use of it stays on window: openRoute (context.js),
  kindName, swapWhy, routedWhy (Usage's Requests), newGroupWith
  (Providers), panelRoutingShown (the panel).
- The 505 strings only Routing says move from i18n.js to
  plugins/routing/i18n.js (4 languages); i18n.js 17048 → 15032 lines.
  The plugin's own name and line stay in i18n.js: the Plugins page
  says them with the plugin off (TestBuiltinsTranslated).
- Tests and comments that named routing.js name the new path (gateway's
  antigravity_rest and loop_guard, codeassist.go, usage.go,
  web_compress, group_member_info, assets_revalidate, font-cascade,
  win-fonts, three routing-*.test.cjs). builtins.test.cjs and
  builtins_test.go count seven built-ins and switch Routing off: its
  tabs go, the page shown stays.
- docs: plugin-runtime.md, gui-shell.md, gateway-routing.md.

Run, first on origin/main 3ec45e715, then after rebasing onto af27b70b4
(main's routing.js, css, app.js and i18n.js changes since were carried
into the moved files; its new Routing words, as the rules' conditions,
are in the plugin's i18n.js):
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- go test -count=1 ./internal/gui ./internal/gateway ./internal/usage
  ./internal/pluginrt ./plugins/...: ok (gateway 1800s under load,
  -timeout 45m; gui with -skip TestMainWindowCorners, #1936).
- All 193 GUI test files, 3 at a time at load ~250, Chromium and WebKit,
  at the Usage commit on 743fcc035: 185 and 186 green. Every red run
  alone here and on a just-fetched origin/main c524bc018:
  - the same on main: routing-model-rest (#2115), routing-wb-restricted
    (#1905), usage-agents-hide (11 of 16 in both, #2211), usage-fold
    (#2163: 12 of 14 here, 9 of 14 on main over 7 runs, the same 4px),
    quota-count-wrap and quota-name-translated in WebKit (#2228);
  - red only under load, green alone on both: routing-flood (#2215),
    routing-log-icons, usage-ledger (#2211), and three plugin-* files
    whose tree was rebased under them mid-run.
- days-fit, failed-open, side-calls and burst-speed, red on main after
  cf455ebd5, are fixed before this commit (#2134, d692b2548).
2026-10-15 01:32:12 +08:00