Commit Graph
69 Commits
Author SHA1 Message Date
yetone 9edc6506e0 routing: a group's editor folds what few change under Advanced
The owner found the Add group form too long. Name, In agents' lists,
Models, Accounts, Rules and the classifier stay in the form; Patterns,
Model lists, Routing, Rate limited, Slow to start, Every member busy,
Context, Stays, Effort and Levels move into an Advanced fold
(details.more, as the provider editor's). It opens by itself when the
group sets any of them, remembers being opened or closed while the
editor is up, and Save opens it when a typed pattern is invalid so the
focus lands on it.

The fold's inner grid takes the editor's label column (--ed-lab), so
its labels line up with the ones above; without it English sat 30px
off (group-editor-fits caught it), and at 520px and in the web layout
it stacks like the rows above. edAlign now sets --ed-lab/--ed-at only
when they change, and in an open fold a later change waits a frame
(a closed fold only moves its chevron and follows at once): opening the fold
re-measured inside the ResizeObserver callback and routing-rows-fit
failed on "ResizeObserver loop completed with undelivered
notifications".

The GUI tests that edit those rows open Advanced first (openAdvanced
in group-context, -unlists, -first-token, -patience, -defaults,
-editor-align, -from-model-add); group-editor-align measures the
fold's labels too.

Run (Linux, WSL magpie-desktop, Chromium + WebKit, 5 languages):
- the 34 GUI files red in a first run plus group-editor-fits and
  group-editor-selected, at this head rebased on 8935abcf5: 528
  tests, 499 pass, 29 fail. The reds are i18n-keys (1, #5332 #5426
  #5482), routing-intent-entry (8, #5392) and zero-priced-free (20,
  #5262); the same files fail the same way at base 4f3ec591a without
  this change.
- the 112 GUI files that reach an editor's fold, the view's room or
  the group editor (details.advanced/.more, rt-gedit, --ed-lab,
  setRoom, click-scroll, i18n-keys), at this head and at base
  8935abcf5: 2246 tests, 44 fail on each, the same tests but two
  that flipped once (provider-url-each-api 440px red here, 3 of 3
  green alone; a long-text-box menu red at base only). Among them
  editor-advanced-align's chromium case (#4615) is red at base too.
- the whole GUI suite was started and stopped part way (it would take
  hours on WSL); its reds so far are in #5559's list.
- rebased on b68218f43 (a912cdc36 touched the groups page): every
  group-* file, routing-rows-fit, routing-save-blank and click-scroll
  again: 616 tests, 2 fail, both click-scroll's late wheel in WebKit
  (#4385, red at base too).
- go test -run Budget ./internal/gui on mote at the pushed head: ok.

Broken by hand: without the inner grid rule, group-editor-fits is red
(373 vs 343 in English); without the edAlign change, routing-rows-fit
is red on the ResizeObserver page error; without the previous commit,
routing-save-blank is red.

Not tried: the real app window, macOS (mote was overloaded with
launch timeouts) and Windows.
2026-11-09 12:53:37 +08:00
yetone a912cdc369 routing: the groups page's Select and New group no longer touch
The groups page's toolbar row has gap 0, so Import, Select and the
filled New group sat edge to edge: Select's hover met New group's fill
(the owner's screenshot, 11-08). The buttons right of the spacer now
stand 4px apart, New group 8px.

Run at this head (rebased on 4fac4c863): group-new-head.test.cjs,
Chromium and WebKit, en and zh, 4/4 on mote. Its fixture has two groups
now, so Select shows as in the screenshot, and it checks each button
pair's distance. Broken by hand: with the CSS taken out, 4/4 red
("rt-gimportbtn | rt-gselect touch: 0px").

The 78 GUI files that reach the groups page, at the pre-rebase head on
mote at load 60-200: 938 pass, 134 red, 124 of them TimeoutErrors. Of
the 10 assertion failures, run alone one file at a time at this change and at
origin/main 8935abcf5: group-disabled-contrast passes, and
menu-input-scroll (#3402) and routing-intent-entry (#5392) are red the
same 12 on both. group-accounts, group-arrange and filter-ime, which
timed out in the full run, pass alone.
Not tried: the real app; the whole GUI suite.
2026-11-09 09:27:37 +08:00
yetone f99ad62a9c routing: the magpies fly over the cards again, off their words
The owner, 11-09: "鸟要在卡片上面". Since 869c4d112 (v0.1.2135,
penershu on X) the sky was under the cards (z 0), so a magpie crossing
magpie's box vanished behind it. Putting it under was our choice, not the
reporter's: they asked that a bird not sit on the hub's address.

Fix:
- .rt-sky is z 2 again, over the cards.
- pose() still starts and ends each flight 6px clear of the cards, so a
  dot held at its seat or waiting at magpie, and its bird, sit beside the
  words (what penershu reported).
- via() no longer cuts across magpie's box: side to side it goes up the
  side it came in, over the top a little above the edge and down the side
  it leaves by; round a corner (the narrow stage: in at the side, out at
  the bottom) it keeps by that corner. Other cases keep the old arc.

Run (mote-run, Playwright 1.62):
- routing-sky-under (rewritten: the sky is over every card; nothing at
  rest, bird parts or dot, over a card's words; new: routing sends the
  waiting request on and every frame through magpie's box is watched, its
  dot and the bird's body off the hub's words), routing-held-dot,
  routing-smart-intent: chromium + webkit x 5 langs x 4 widths, 100/100.
- Red on origin/main's routing.css: 40/40 ("the magpies fly over the
  cards: [false,...]"). Red on origin/main's client.js (old via): dot and
  body over "magpie", "127.0.0.1:3425" and the 智能 pill.
- via() uses the hub box layout() read with the wires; a fresh
  getBoundingClientRect there looked like it raised WebKit's
  ResizeObserver-loop red in routing-context-fold, but it stayed after.
- every routing*.test.cjs file (mote, load ~200, at 480f880e2 before the
  hubBox change): 3 reds, none in the files touched here.
  routing-credits webkit zh-TW 420 ("session-titles due to access control
  checks", the #1350 class) and routing-flood webkit en ("32 magpies flew
  at once") pass on WSL magpie-desktop alone. routing-context-fold webkit
  "a request picked keeps the fold" is #5586 (ResizeObserver loop, red on
  main before this; cause in #1542): alone on WSL it was red 3 of 18 runs
  with this change and 0 of 8 on origin/main 81798f779, so this change
  may make it more frequent. Numbers on #5586.
- At the pushed head (rebased on 6b0b7a96e; 54af4357c since touches no routing file), on WSL: sky-under + held-dot + smart-intent
  100/100 (both engines).

Not fixed: the bird trails its dot by ~45px, so for a frame or two as it
leaves the box its tail brushes the end of "magpie" (or a wing the pill on
the narrow stage). The exit is on the box's edge; only moving the wires
would avoid it, and the test checks dot and body, not tail and wings.
Not tried: the real app (WKWebView, WebKitGTK).
2026-11-09 06:56:15 +08:00
yetone 50eec4994a routing: with motion reduced, a request in flight fades instead of standing still
vantiboolean (Discord, v0.1.3327, Windows app): the Routing page "lost its
animation". The screenshot: Codex, round-robin, two accounts both
"answering another request…", the wires dotted and nothing moving, no
bird.

That is the page with motion reduced. WebView2 reports
prefers-reduced-motion when Windows' "Animation effects" is off, and
Settings' Reduce motion does the same in the page. Then the flowing
wires' dashes, the held dot's fade and the bird all stood still, so a
request in flight looked the same as one that was over. This was so
before 83d9ee892 too (its CSS turned the same animations off under
reduce); the timer that commit added kept that. Without reduced motion
the page moves in Playwright Chromium on mote and on xiaomi-gpu, and in
the msedge channel (Edg/156) there, in the reporter's state (two
requests in flight, the request shown another one), after a page switch,
a blur and a focus.

Now the 15/s timer also runs with motion reduced, without moving
anything: the flows layer fades to .45 and back each 1.2s (--rt-fade,
opacity on its own composited layer) while the dashes stay put, and the
dot held at an answering account fades as it does with motion on. No
bird flies. When nothing is in flight the timer stops and both
properties go, as before.

Run:
- routing-calm-in-flight.test.cjs (new): Chromium and WebKit, the
  system's reduce and Settings' Reduce motion, 1100 and 420px, on mote:
  8 of 8 ok. On xiaomi-gpu (Windows 11, Chromium): 4 of 4 ok.
- routing-answered-still.test.cjs, both engines: ok (with the new file,
  28 of 28).
- Broken by hand: the new test on the old client.js and routing.css is
  red in all 8 ("the flowing wires fade: 1.00").
- GUI on mote, at this tree with the balance commit after it: the 293
  routing-*, usage-*, balance-*, quota-*, panel-usage, tray-usage*,
  key-balance*, key-own-balance, i18n-keys, old-webkit and click-scroll
  files, Chromium and WebKit, concurrency 4 beside other sessions'
  suites: 4846 of 4900 ok. The 54 reds are in routing-intent-entry
  (#5392), routing-context-fold WebKit (#5586), i18n-keys "a plugin's
  words are its own" (#5327), routing-row-swap (#3799),
  routing-story-shrinks WebKit (#3954), usage-agents-hide (#3414),
  usage-fold (#3415), usage-ledger (#5048) and, under load only,
  usage-computers and remote-group-served. Each of the first eight is
  red the same at origin/main b684308c6 run alone (32 files compared,
  identical lists, serial for the six usage/routing ones).
- go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) of internal/gui
  and internal/provider, gofmt -l clean, go test -tags nogui -count=1
  ./internal/provider ./internal/gui under mote's suite lock: ok.

Not tried: the whole GUI suite (1287 files; the run above covers the
files that reach Routing and Usage); WebView2 inside the real Wails app on Windows with
Animation effects off (xiaomi-gpu is shared, its system setting was left
alone); the reporter has not said which reduce is on. The tray panel's
own small stage still stands still with motion reduced (#5708).

Reported-by: vantiboolean (Discord)
2026-11-09 04:04:54 +08:00
yetone 4ab1191bc9 routing: Routing groups opened from Routing lead back to it
Since Routing groups became a page of their own, a group chip on a
request (or Routing's "Routing groups ›") switched to the groups page
with nothing leading back. Without the sidebar the only way out was the
tab bar, and the request you came from was gone from view.

The groups toolbar now starts with "‹ Routing" (gBack). It goes back to
Routing through window.show, so a dirty draft is still asked about, and
focus returns to the chip or button the page was opened from. Esc does
the same, except while an editor, Import, Select or a modal is open, or
focus is in a text field. With the sidebar the back control shows only
when the page was opened from Routing (.rt-gfrom); from the sidebar's own
Groups tab the page is top level and has none. No other drill-in page in
app.js binds Cmd-[, so neither does this. The label follows the language
on every draw. No new layout, no accent stripe.

Run (mote, playwright 1.62.0):
- routing-groups-back.test.cjs (new): 30/30, Chromium and WebKit x
  en/zh/zh-TW/ja/de x 1280 window, 640 window, 420 web. Red on
  origin/main's assets (MAGPIE_ROUTING_ASSETS): no visible .rt-gback.
- Broken by hand: Escape handler off -> red (chromium en 1280); the
  side-nav hide rule off -> red (webkit en 1280, "no back from the
  sidebar's own tab").
- Every routing*, sidebar*, group-*, i18n-keys, i18n-en-no-cjk,
  old-webkit and settings-groups file at 2d66e9f23 (main 0fc3455e2 +
  this): 3548 tests, 3526 pass, 22 red. The same files at origin/main
  cdf734757 alone: the same 18 red, all filed: i18n-keys (#5332, #5426,
  #5482), routing-intent-entry 8/8 (#5392), routing-context-fold webkit
  (#5586), routing-row-swap (#3799), routing-story-shrinks webkit
  (#3954). The other 4 (routing-busy chromium zh, routing-many-keys
  chromium en, routing-pace-expiry chromium de, routing-rule-drag webkit
  ja) passed whole, with routing-groups-back, at this commit on
  cdf734757 (70/70); filed #5665, #5664, seen in #4082, #3789.
- Whole GUI suite and ./...: queued on mote, not run at push; results to
  follow.

Reported-by: unscientific9 (Discord)
2026-11-08 11:04:43 +08:00
yetone f4179b7812 routing: Accounts & keys in columns keeps each provider's rows under its own name
The owner's screenshot (这里的布局直接崩坏了): below 1150px the accounts
list flows in columns, and a provider's accounts ran on into the next
column with no heading over them, while the line meant to part two
providers stood over a column's top. Each provider's heading and rows
are now one box (.rt-pgrp) that doesn't break; one with more than 12
rows may, but its heading stays with its first row. The parting line is
between two boxes and is dropped in columns, where the column gap parts
them.

Run (mote): at 7a2946caf, the 19 Routing accounts GUI files, 369/370;
the red is chromium zh many-keys (#5543). Rebased on 60cb1bd9e, the
routing account/columns/keys-fold/many-keys/provider-off files, 106/106.
routing-context-fold's WebKit red is the same at the base (#5586).
Broken by hand: on the old code routing-accounts-narrow's strays check
(each row's left edge under its own heading) is red 10/10.
Not tried: the real macOS app. Playwright's and WKWebView's snapshots
don't paint multicolumn rows past the first column, old code or new, so
the check is by geometry, not pixels.
2026-11-08 02:43:43 +08:00
yetone 6b7ee4a984 routing: every group follows a default for rate limits, slow starts and busy members unless it sets its own
jiezhengj on Discord asked to set the per-group policies once instead of
in each group. The Routing groups page's Settings card, under the list,
now has three rows: Rate limited (keeps its place / goes to the back),
Slow to start (wait / 30 s ... 4 min) and Every member busy (off / 1 min
... 4 min). They are saved in settings.json as groupSink, groupFirstToken
and groupPatience (settings.SetGroupDefaults, POST /api/groups/defaults).

A group follows the default for each value it leaves unset, and its own
value always wins:
- Sinks() is the group's Sink, or else the default unless NoSink, a new
  field for an explicit "Keeps its place".
- FirstTokenOr() is the group's own FirstToken (-1, FirstTokenWait, is an
  explicit Wait), or else the default. The gateway reads it where it
  reads a group's first-token time.
- Waits() reads the default when Patience is 0. 60 is an explicit 1 min.
Groups saved before have 0 and no NoSink, so they follow the default,
which starts at magpie's own (keep its place, wait, 60s). Nothing a user
set changes. The group editor's three rows gain a Default option, on for
a group that sets none, and its hint names the value it follows. Segments
only, with no native select.

Run on mote, at 06b2daeff rebased on origin/main 2dac9b84e:
- go test on the new tests TestGroupDefaultsUnlessItsOwn,
  TestGroupFirstTokenFollowsTheDefault, TestGroupSinkFollowsTheDefault
  and TestGroupDefaultsSaved, plus TestKeysAreWhatTheSaveWrites and the
  existing first-token and sink tests: ok.
- Broken by hand (Waits, FirstTokenOr and Sinks ignoring settings): the
  three provider/gateway tests went red.
- GUI: group-defaults (new), group-patience, group-first-token,
  group-found-off and rate-limited-sink, in Chromium and WebKit, in en,
  zh, zh-TW, ja and de, at 1100 and 420: 56/56 pass. With the old
  client.js and routing.css, group-defaults, group-patience and
  group-first-token fail 44 of 44.
- GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...:
  clean. gofmt -l: clean.

Still running when this was pushed (owner: never hold a verified commit
behind the suite): go test -timeout 45m on internal/provider,
internal/gateway, internal/gui, internal/settings and
internal/settingsapi, then the whole GUI suite under suite.lock. Any red
they show gets its own issue.

Not tried: the real app with real groups under real rate limits. Only
the gateway tests' fakes exercise the default sink and first-token paths.

Reported-by: jiezhengj on Discord
2026-11-08 02:08:30 +08:00
yetone 83d9ee892d routing: flowing wires and held dots move from a 15/s timer, not per-frame CSS animations
With several requests in flight (Claude Code's subagents, five at once),
magpie on Windows sat at 20-30% of a core for as long as they ran
(chenxiang, #5467). The gateway's own share is small: about 2.2 CPU-s per
56s of five streams on macOS (~4% of a core) and 4.0-5.2 on Windows
(~8%), unchanged by this commit. Most of the rest was the Routing page in
the webview, which Task Manager counts under magpie on Windows: each
flowing wire's copy in .rt-flows animated its stroke-dashoffset, and each
dot held at an account pulsed its opacity under a drop-shadow filter.
Chromium draws both on the main thread every frame, and a flowing wire
spans the whole stage.

Both now move from one setInterval at 15 Hz (slowTick) that sets
--rt-dash on the flows svg and --rt-held on the sky; the CSS reads them.
The timer runs only while a wire flows or a dot is held, the page is in
sight and motion is on, and clears both properties when it stops. Reduced
motion is as before: no dash movement, held dots at full opacity. The
dash moves the same 8px per 0.7s and the fade has the same 1.2s period
and .45 low.

Measured (zzload harness, not committed: a local fake Anthropic upstream,
five parallel /v1/messages streams from one client with tool_use turns
and tool_result histories, 15ms per event, Playwright on ?view=routing;
browser CPU-s per 5s, mean of the loaded samples, before/after runs
alternated at the same tree):
- mote (macOS 27, Chromium): 1.15/1.13 -> 0.89/0.90 (wires only);
  Claude Code subagent shape (one session id, sidechain transcripts
  growing under a sandbox HOME): 1.24 -> 0.99. Gateway 2.23 vs 2.22.
- xiaomi-gpu (Windows 11, Chromium): 1.55/1.59 -> 1.21/1.22, about 31%
  to 24% of a core. Gateway 4.2-5.2 in both.
- What's left: the fliers' rAF loop and wing flaps (~0.3 on mote), the
  composited dot pulses, and the page's own work.

Run on 578053d6a; after the rebase onto 710f0290c, go test ./internal/gui
and routing-answered-still (20 of 20) ran again at the pushed tree:
- routing-answered-still, both engines, en, 1100 and 420: ok. It now
  checks the copies have no CSS animation, their dash moves with 1-30
  style writes a second, a held dot has no animation and its opacity
  changes, and the timer stops (no property, no writes) after the answer.
- Broken by hand: put the rtflow animation back on .rt-flows path;
  routing-answered-still goes red (animated: 2 !== 0) in Chromium.
- routing-*.test.cjs: the reds are the same on 578053d6a without this
  change (#5392 intent-entry, #3799 row-swap, #5586 context-fold, #4627
  order-unknown, #5161 credits); rule-drag in WebKit fails one random
  locale a run on main too (#3789).
- go test ./internal/gui (asset budgets) on mote: ok (164s).
- Full suite (go test -timeout 45m ./...): started after the push and tag, as
  fixes ship at once; any red it finds gets its own issue.

Not tried: the reporter's provider and a real Claude Code; the claude
subscription bridge (claudetui) with real accounts; WebView2 inside the
real Wails app (Playwright Chromium on Windows stands in for it);
masking's model on Windows; TLS upstreams.

Reported-by: chenxiang (Discord)
2026-11-07 23:42:54 +08:00
yetoneandmdwsk88 8de63c8b5a gateway, usage, gui, otlp: a request its agent canceled is no failure (#2398)
An agent that cancels its request before it is answered is logged 499
"the agent canceled the request": a person stops the reply, or sends the
next message while it is coming and Claude Desktop cancels it and asks
again, or Codex takes a subagent's report (#2398). The gateway already
says nobody failed (no rest, no reroute: TestCanceledRequestRestsNobody),
but Record.Failed is a status >= 400 or an error, so every page counted
it as a failure: the Requests card's "N failed" and success share, its
Failed filter, the CSV's error column, the Routing page's "errors your
agent saw", the Context page's error rate, the failed colour in the
Requests list, Routing and Recent calls, and the OTLP export's error
status. A Claude Desktop session on 2026-10-27 had four, each a message
sent mid-reply; #2398 had 91 of a day's 92 failures.

usage.CanceledBy tells the agent's cancel (499 with AgentCanceled) from
magpie's own limit on a request it asked of itself, logged 499 too and
still a failure (#2318). The cancel is logged with an error type of its
own, agent_canceled (usage.CanceledErrType, set in failedWith), so the
record says what it was and nothing guesses it from a 499, as #2398
asked. Record.Canceled reads the type, and a record logged before it by
its status and message, so the old log reads the same with nothing
migrated. A middleware's usage rows carry the type, so a module can tell
the cancel from magpie's own limit, which its rows (no error text)
couldn't.

Record.Failed leaves the cancel out; Totals counts it apart (Canceled, in
count and plus); RetriedRequest and the first-token and speed sums ask
Answered, so a canceled request is timed nowhere, as before; Codex's
memory of the last model still skips it. Routes and Recent calls say
canceled (set as a route is done and as a day's history is read, so old
days read the same); the Routing totals and the Context page's errors
leave it out. Ledger rows say canceled, and the pages show it muted, in neither the
failed nor the answered colour: the Requests list and its detail ("499 ·
canceled"), the Requests card ("N canceled", the success share of the requests not
canceled), the overview tile, the Routing page (a "gone" outcome, no
speed) and Recent calls (muted). New strings are in zh, zh-TW, ja and de.

The OTLP export: the records the gateway gives its observers for a
request and its try carry the type too (canceledAs), and a root span's
error.type follows Record.Failed, so a canceled request's span and its
try's go with status code 499, no error and no error.type.
TestOTelWaterfallFailureAndCancellation's canceled case held two failed
spans (the try the vendor refused as the agent left is recorded canceled,
as the request is); it now holds neither failed, both 499 and no
error.type. That change to the test is the point of this one.

mdwsk88's patch (aea0027fd) ran its tests at e056779a, a3768cdd,
c86fa2a3 and fcc0daa2, broke each check by hand (each red), and sent
real Claude Desktop cancels through a nogui build with a stand-in
upstream and OTLP collector. Its full record is on aea0027fd. Since
58541e5b (#4866) Codex's own-sign-in relay logs Codex gone mid-reply as
499 through canceled() too, so it counts as canceled
(TestCodexGoneMidReplyIsNoFailure). drawing_route.go still reads a
canceled request as not served when it decides whether a picture's
next request may stay on its provider: that is routing, not a count.

Ported to origin/main 400b66ec3 on 2026-11-07, reviewed line by line.
Two siblings it left on the old rule, and a colour, now covered:
- usage.Row.Floor (the Claude Code speed floor) asked !Failed, so a
  canceled row, whose Failed is now false, told a floor: "3000 tokens
  in 4000 ms" for a reply no one waited for. It asks Answered now, as
  the speed and first-token sums do. TestAgentCanceledTellsNoFloor.
- The route-events feed (activityOf, #3387) told a canceled try and
  done route as failed. It leaves usage.CanceledBy out, and still
  counts magpie's own 499 limit. TestRouteEventsCanceledIsNoFailure.
- routing.css: a canceled Routing row ("rt-req gone") had the
  answered green dot. Its dot is muted now.
  routing-canceled-row.test.cjs checks the row, its dot and the errors
  stat in Chromium and WebKit, in en, zh, zh-TW, ja and de.

Run at this tree (mote-run, macOS):
- go test -count=1 internal/usage, usageapi, otlp, settings,
  settingsapi and cli: ok. internal/gateway: ok with -timeout 45m
  (847s; the default 10m ran out under load). internal/gui: ok but
  TestMainWindowCorners/macOS_26_SDK (#3949, mote is on macOS 27).
- Broken by hand: Floor on Failed again makes
  TestAgentCanceledTellsNoFloor fail ("a canceled row tells a speed
  floor: 3000 tokens in 4000 ms"). activityOf without CanceledBy makes
  TestRouteEventsCanceledIsNoFailure fail ("a done route its agent
  canceled is told failed"). Restored, both pass.
- GUI: node --test --test-concurrency=4 over routing-*, usage-*,
  ledger-*, panel-*, call-*, search-*, searcher-*, settings-*, i18n-*
  and gui-* (Chromium and WebKit; the files cover en, zh, zh-TW, ja
  and de), with #2398 and #5545 in one tree: 4961 of 5016 ok. The 55
  reds are in 12 files. i18n-keys' "a plugin's words are its own"
  names other files' strings (#5327, #5426, #5482). The other 11 files
  were run alone at dc49feca9 (this tree without either change) and at
  this tree: 52 and 51 reds, the same tests. The one apart is
  usage-focus-steady, which flakes (#3501). Each is filed: #5392,
  #3414, #5048, #3799, #3415, #3954, #4627, #4628, #5223, #1529.
  routing-canceled-row.test.cjs: 10 of 10. With the .rt-req.gone rule
  taken out, its dot is the answered green rgb(24, 154, 88) and it
  fails. Restored, it passes.
- Not tried: a real Claude Desktop cancel through this tree; Windows
  and Linux runs.

Co-authored-by: mdwsk88 <11055210+mdwsk88@users.noreply.github.com>
Reported-by: mdwsk88 (dawei on Discord)
2026-11-07 04:03:01 +08:00
yetone 80ae904c23 routing: routing groups get a page of their own, beside Routing
The owner asked for the groups to leave the Routing page (11-06): under
the live stage and every request they were a long scroll down, and New
group with them. The design was reviewed before this was built.

- New page, Routing groups (#view-groups), drawn by the routing plugin's
  same script (routingPage), so the editor, its dirty/discard and every
  group action are unchanged. Toolbar: filter, "N groups · M on",
  Templates, Import, Select, and New group as the filled button. The list
  is right under it, and a Settings section under the list holds Found
  groups (with Exclude providers…) and Names in agents' lists.
- No Export button: each group already has its own Copy to share.
- Routing keeps the live stage and the requests. A request's group opens
  the groups page at its row.
- The sidebar has a Routing groups tab right after Routing (from 1024
  points). The header's row has no room for one: at 860px the extra tab
  pushed the logo out (brand.test). There the tab is hidden, Routing's
  tab is lit for both pages (markNav), and Routing's head has a
  "Routing groups ›" button, hidden beside the sidebar.
- Every way in now goes to the groups page: the guide's Open routing
  groups, the panel's and the provider editor's Make a routing group
  (window/main?view=groups&newgroup=…). mainView still takes
  view=routing&newgroup from an older panel.
- Words: "Routing groups", "Open routing groups", "Once saved, make a
  group of them in Routing groups.", and the editor's names note now says
  the setting is under the list, in zh, zh-TW, ja and de. "Open Routing"
  stays for the Agents page's button.
- Docs: providers-accounts, gateway-routing, plugin-runtime, gui-shell
  and reference say "Routing groups page" where they mean the groups.
- Core budget: the core's scripts are 1,533,774 of 1,533,802, paid for
  by three show()/setGatewayMode comments cut in app.js. No raise.

Tests: routing-groups-page.test.cjs (new) covers the page in Chromium and
WebKit, en/zh/zh-TW/ja/de, at 1280, 640 (window) and 420 (web): no
groups on Routing, the tab or the head's button by width, the lit tab,
toolbar order, New group primary and in sight, list then Settings, no
sideways scroll, no native select, no left-border accent; a request's
group to its row; quotas redrawn with an open editor left alone. The
trace tests (routing-compact, -pause-folder, -rule-models, -folder) open
Routing, then show the groups; routing-editor-foot and
name-suffix-where-named scroll by wheel, as the scroll guard lets a
reader; builtins expects the groups tab beside the sidebar only.
Removed: routing-groups-jump (the head's "Routing groups ↓" that scrolled
down to them, gone with them), routing-pointer-pin and routing-steady
(the groups kept in place under requests streaming in above them: no
request is above them now). Their guarantee that what redraws leaves an
open editor and its typing alone is routing-groups-page's quotas case;
Routing's own lists keep their keepInView.

The groups page's jump: a request's group, or a pool's "Several keys"
chip, opened the groups page and scrolled the row to the centre, and the
next frame show()'s backAfterLoad put the page back where the reader
last left it, then brought the focused segment in by "nearest": in
WebKit the pool sat half under the window's foot (routing-mode-goes, 9
of its 10 WebKit cases). goRouting now jumps at once on a page it opens and
marks it arrived(). The wheel in routing-many-keys turns over the keys:
at the page's foot, now shorter, the mouse rested over the requests list
(.rt-reqs, overscroll-behavior: contain), which took every wheel up, and
the test stopped with 2 keys in sight. That is #4082's cause.
routing-days-fit's fixture has 12 requests, a day that fills the window,
since the day bar held needs room under it.

Run on mote (macOS 27, load 25 to 65), Playwright 1.62.0:
- Go: go vet, gofmt -l and go test ./... at the rebased head (650bf8412
  base) ok except TestMainWindowCorners (#3949); internal/gui again
  after the last edits: the same, TestCoreScriptBudget ok (1,533,773 of
  1,533,802, no raise).
- GUI, the 262 files a change here can reach, at the head and at the
  base: the reds at the head are the base's, with their issues:
  menu-input-scroll #3402, provider-mask #5109, context-fold and
  order-unknown (webkit) #3479, header-centre #3479, i18n-keys
  #5332/#5426/#5482, account-eye #5052/#4244, call-headers webkit de
  #5045, codex-predictions #2624, codex-auto-reset webkit de #4790,
  routing-* under load #5088, and zero-priced-free, last-page,
  reasoning-speed, routing-row-swap/-tag-whole/-story-shrinks/-steps-cap
  and routing-intent-entry, red at the base the same way.
- After the last edits: the 11 files with a way to the groups page or
  its scroll (group-*, routing-groups-page, routing-mode-goes,
  routing-groups-off, routing-provider-off, routing-many-keys,
  click-scroll), 175 of 176; the one red is routing-many-keys webkit's
  wire at the foot, red at the base in 8 of 12 (#5543). brand,
  gateway-mode-sessions, header-zoom-fit, header-centre,
  inner-scroll-contain and mobile-web: the same 11 reds at the head and
  the base (mobile-web compares with origin/main through git, which a
  mote-run copy hasn't).
- Rebased on ecc26a339, again: gofmt -l, go vet ./internal/gui and
  TestCoreScriptBudget ok; 10 GUI files (i18n-keys, routing-groups-page,
  routing-mode-goes, sidebar, brand, menu-first-second, library-bar-more,
  click-scroll, name-suffix-saved, unlisted-models) 211 of 212, the one
  red i18n-keys' "a plugin's words are its own", red the same at
  ecc26a339 (#5332/#5426/#5482).
- Broken by hand: without the groups page's CSS rule, brand and
  routing-groups-page go red (32 fails); with the old goRouting,
  routing-mode-goes is red in 9 of its 10 WebKit cases.

Not tried: the whole GUI suite on Linux (WSL magpie-desktop) at this
head; a run at an earlier head is under way and has the Linux reds
#4120/#4121 name. Not tried in the real macOS app, only Playwright's
WebKit.
2026-11-06 23:11:43 +08:00
yetone 8b4029adfe routing: a long session name is cut short inside its own block, in WebKit 17 too (tz_188 on Discord)
tz_188 on v0.1.3122: three ZCode sessions at once on Routing, each named
by a long one-line prompt ("这个commit 中的内容帮我再核对一下
51538fc170c6…", a path under /Users/lbx_16/work/b2b/b2b-platform). Every
name ran past its block and over the next blocks' names, so the three
read as one smear. 7a2b9340d had folded line breaks in the name; this is
another cause. The block (.rt-ctx-s) is a <button> laid out as a flex
column. WebKit up to Safari 17 (macOS 14) puts a flex button's children
in an anonymous box of its own, and in a column that box is as wide as
the name's whole nowrap line, so .nm's overflow: hidden clipped nothing
inside the 180px block. Today's Chromium and WebKit don't, which is why
the earlier test (and Playwright 1.62) never saw it. The block is now a
grid of one minmax(0, 1fr) column: a grid button has no such box, and
each name ends in its ellipsis; the whole title is still on hover.
Siblings: a scan of every CSS rule with flex-direction: column against
every class a <button> is made with (el("button"), <button class>,
createElement + className/classList) finds .rt-ctx-s only. Row flex,
block and grid buttons clip correctly in WebKit 17 (probed).

Run (mote, via mote-run):
- routing-ctx-sessions.test.cjs, Playwright 1.62 chromium + webkit:
  98/98. New case: three sessions with tz_188's title, a hash and a path,
  en/zh/zh-TW/ja/de at 1600/1100/700/390px; each name inside its block's
  padding box, cut short (scrollWidth > clientWidth), title on hover, no
  page overflow, and the block not a column flex button.
- the same case with Playwright 1.36's WebKit 17.0 (NODE_PATH and
  PLAYWRIGHT_BROWSERS_PATH to a separate install on mote): 20/20 pass.
- the whole routing-* GUI set (171 files): 2838 of 2870 pass. The 32 reds
  are in routing-intent-entry, many-keys, order-unknown, row-swap,
  rule-drag, rule-models, rule-remove, steady, steps-cap and
  story-shrinks, the same files 7a2b9340d listed as red on its main (with
  rule-models added); none of them reads .rt-ctx-s. Their base-vs-change
  comparison is run after this push.
Broken by hand: the old flex CSS put back, WebKit 17.0 red 20/20 ("the
name "/Users/lbx_1" stays inside its block: 44..1174 in 44..228"), and
Playwright 1.62 red 40/40 on the column-flex guard.
Not tried: the reporter's full title bytes (only the screenshot; two of
the three titles are made up from its visible words), the real app's
WKWebView on macOS 14, Windows and Linux, the whole GUI suite (only
routing-*).

Reported-by: tz_188 (Discord)
2026-11-06 17:20:48 +08:00
yetone 152c3852ff routing: a switched-off group's words stay readable, its logos go grey (jiabubu on Discord)
A group switched off had everything but its switch at opacity .5, and
one with no member ready either (.off, .6) was dimmed twice, to .3: its
name read at 1.92:1 (light) and 2.49:1 (dark). jiabubu found such
groups too faint to read.

Now a switched-off card is not dimmed. Its name is --fg-2 at weight 500
instead of --fg at 600, its handle's logos are grayscale at .6, and the
off switch and the "switched off" tag stay as they were. Its members
keep the same --muted as an on group's. .off does not dim it again. No
new colours, only existing tokens.

Measured contrast (both engines, en and zh):
- light: name 8.64:1 (on: 16.97), members 3.66 (on: 3.66), id 8.22
- dark: name 8.03:1 (on: 13.41), members 4.64 (on: 4.64), id 8.43

Tests:
- group-disabled-contrast.test.cjs (new). Composites each text's colour
  and every opacity above it over its backgrounds and checks:
  - the name and id are at least 4.5:1;
  - the members read no fainter than an on group's;
  - the name is quieter than an on group's;
  - the switch is off, the tag is there, and the logos are grey (an on
    group's are not).
  Runs in chromium and webkit, light and dark, en and zh.
- group-switch-add-many.test.cjs checked that every child but the switch
  was at .5. It now checks the new look: the handle is grey at .6 and
  the rest is not dimmed.

Run (on mote):
- At the pushed base 4c8e1cfdf: group-disabled-contrast,
  group-switch-add-many and group-select-copy, 16/16.
- At 09812e66b: the 49 group-*, routing-group*, panel-routing* and
  fallback-group* files, 521/526.
  - 4 reds were group-switch-add-many's old .5 check (updated above).
  - 1 red was group-found-skip "webkit de 390px" (#4617, red at base).
- go test -tags nogui -run 'Budget|Routing|Plugin.*Asset' ./internal/gui: ok.

Broken by hand: with routing.css reverted, group-disabled-contrast is
8/8 red ("the name reads at 1.92:1" / "2.49:1").

Looked at screenshots in chromium, light and dark.

Not tried: the real app's window, and WebKitGTK. Only CSS changed, with
no motion and no new API.

Reported-by: jiabubu (Discord)
2026-11-06 15:51:04 +08:00
yetone 09812e66bc routing: a group's patterns, models and id can be selected and copied on its card and in its editor (jiabubu on Discord)
The window is user-select: none outside text it marks as text, and a
group's card is one big click target that opens the editor. So on the
Routing page a group's 模式 (patterns) line, its members line, its quota
lines and its name could not be copied: the members and names were not
selectable at all, and a drag across a pattern's code (selectable) ended
in a click on the card that opened the editor and threw the selection
away. The editor's model and account-provider names were not
selectable either.

Now:
- routing.css: a card's name, group/<id>, and every .mem line
  (members, patterns, quota, classifier failure), and the editor's
  member, pattern and account rows' names (.fbrow > .n) are
  user-select: text, except while their list is being sorted. Controls
  (routing tag, handle, Edit, switches, Remove, Up/Down) stay none.
- client.js groupRow: a click that ends a drag-select inside the card
  does not open the editor; it compares the selection at pointerdown,
  so a plain click with an old selection still opens it.

Not changed: a double-click on a word in the card still opens the
editor on its first click (the card opens on click, as before).

Test: internal/gui/tests/group-select-copy.test.cjs, chromium + webkit,
en + zh: drags across the pattern, the members line and group/free on
the card select them and leave the editor shut, no scroll moves; a click
still opens the editor; in the editor a model's name and a pattern drag
to a selection; controls compute user-select none; nothing is posted.

Broken by hand: client.js reverted alone -> 4/4 red ('' !== 'or/*:free',
the editor opened); routing.css reverted alone -> 4/4 red (members line
not selected).

Run on mote at base 1ccad582d, then again after the rebase onto a10ad0ec8
(one routing commit, #5413): group-select-copy, group-patterns,
group-arrange 12/12. At the base: the new test 4/4; 55 GUI files
(group-*, routing-group*, routing-groups*, routing-editor-foot,
panel-routing*, click-scroll, user-select, fallback-group, i18n-keys) in
both engines: 569/572. Reds, both red without this change too:
- group-found-skip "webkit de 390px" (and chromium de 390px in the
  4-wide run): red 2/2 alone at the base with the change reverted, #4617.
- i18n-keys "a plugin's words are its own": #5327, #5426, #5482.
go test -tags nogui ./internal/gui: ok (197s).

Reported-by: jiabubu (Discord)
2026-11-06 15:34:14 +08:00
yetone 763ea9438c routing: a live dot pulses by transform and opacity, on the compositor
Routing with requests in flight kept the renderer busy (unscientific9:
"高并发路由页面" is slow). Every live dot (the answering account, the live
dot, a waiting try, probe, preview target and step) pulsed by a box-shadow
keyframe, which Chrome and WebKit run on the main thread: the page was
restyled and repainted every frame for as long as anything was under way.

Each pulse is now a ::after disk that grows and fades by transform and
opacity alone, which the compositor runs without a paint. A muted dot's
disk lies behind it (its parent isolates it, the disk at z-index -1), so
its colour isn't tinted; a filled dot's disk is its own colour. Sizes
match the old shadow (6px each side). Reduced motion and a quiet account
still show no pulse.

Measured on mote (headless Chromium 1280x820, app mode, sandbox HOME with
a 300k-row ledger, a fake upstream, Routing held 30 s, Chrome trace):
- 6 in flight: Paint 5714 / 5598 ms -> 3055 / 2804 ms; main-thread
  RunTask 7448 / 7148 -> 6851 / 6320 ms
- 64 in flight: Paint 4408 / 4217 -> 1746 / 1759 ms; RunTask 8056 / 7921
  -> 7405 / 7434 ms
Most of what is left is the wires' rtflow (stroke-dashoffset, also main
thread): with it off as well RunTask is 3415 ms at 6 in flight, and with
every animation off 2560 ms. That one changes how the wires look, so it
is filed separately, not changed here.

Test: routing-pulse-composited.test.cjs, with the real stylesheets in
Chromium and WebKit, light and dark: every endless animation of each live
dot animates only transform and opacity, each live dot pulses, a muted
dot's centre keeps its colour, and no dot moves. reduce-motion,
routing-idle-frame and routing-live-bytes read the pulse from ::after now.

Run via mote-run: routing-pulse-composited, fonts, reduce-motion,
routing-idle-frame, routing-live-bytes, routing-wait-dot and
status-dot-shape, 101 of 101 ok. Broken by hand: with the old
routing.css the new test fails in both engines.
Not run before the push: the wider run of the 359 GUI files that load
Routing or the font code; its reds, if any, get issues.
Not tried: a real Mac's window (WebKit in the app) on a display; the
numbers are headless Chromium.

Reported-by: unscientific9 (on Discord)
2026-11-06 14:10:45 +08:00
yetone 7a2b9340d6 routing: a session named by a prompt of many lines is one line in its block, with its bar shown (tz_188 on Discord)
tz_188's ZCode card on Routing had a session whose title was a long
Chinese prompt, and its text ran over the rest of the block. A session's
name comes from its first prompt as written, line breaks included; the
name's box is one line tall with an ellipsis, but a break (U+2028 in
WebKit, a newline elsewhere) still wrapped it, so the second line drew
over the context bar beneath. titleOf and sessionName now fold every run
of white space (U+0085 too) to one space, so the name is one line and
ends in its ellipsis. The bar under it (.rt-ctx-s .ctx-stack) had
flex: 1 in a column box and could be squeezed to 0px by a long name; it
is now flex: none, full width, 4px.

Run (mote, via mote-run, Playwright chromium + webkit):
- routing-ctx-sessions.test.cjs, with a new case of a long CJK prompt of
  several lines (\n and U+2028): en, zh, zh-TW, ja, de at 1100, 700 and
  390px: 56/56 pass.
- the whole routing-* GUI set at this commit: 2870 of 2910 pass. The 40
  reds are in i18n-keys (#5332, #5426), routing-intent-entry (#5392),
  many-keys, order-unknown, row-swap, rule-drag, rule-remove, steady,
  steps-cap and story-shrinks. Those nine files run again alone, here and
  at origin/main cff530079: 39 red here, 34 at main, the same files
  (filed: #5088, #4628, #4627, #4629, #3799, #3789, #3096, #1804); the
  count moves with mote's load (another session's full GUI run).
Broken by hand: titleOf/sessionName without the fold, webkit 15/15 red
("name drawn on one line: 33.59px vs 15.39px"); the CSS put back, 32 red
("bar keeps its 4px: 0").
Not tried: the reporter's own title bytes (only the screenshot; the
overlap was reproduced with a break in the name, not with their text),
the real app's WKWebView, Windows and Linux.

Reported-by: tz_188
2026-11-06 11:23:46 +08:00
yetone 326e72f4c5 routing: the "No session ID" group folds like the others, and one button folds or opens every group (zzzkl on Discord)
zzzkl: the Routing page's 未提供会话标识 group couldn't be collapsed. Its
head was a div with no click handler, no arrow and no aria-expanded,
because only a group with a key could be folded (`g.key ? "button" :
"div"`). closedSessions is keyed by the group's key, and "" is a key a Set
holds, so the no-session group now uses the same button, arrow and
handler as the rest.

Also, as asked: an icon button in the request list's existing header row
(.rt-fold-all, beside Replay) folds every group while any is open, and
opens them all otherwise. It shows only when the list is grouped (by
session or by key) into two or more groups. It has a tooltip and an
aria-label only, no text: "Collapse all" / "Expand all". Those two words
moved from plugins/library/i18n.js to the core i18n.js (zh, zh-TW, ja,
de), since Library and Routing now both say them (i18n-keys: a word used
by two plugins is the core's). The core script budget doesn't count
i18n.js or plugins/, so it isn't raised.

routing-sessions and inner-scroll-contain found group heads by
`button.rt-session` with a key; they now filter .rt-session by text, as
the no-session head is a button too.

Run (mote, node --test, Chromium + WebKit):
- routing-fold-all.test.cjs (new): 2 engines x 1100/420 x en, zh,
  zh-TW, ja, de. It covers the no-session group folding on click, the
  fold-all button folding then opening every group, its tooltip in each
  language, and it being hidden with one group.
- i18n-keys, i18n-en-no-cjk, routing-sessions, inner-scroll-contain,
  skill-fold-all, routing-row-swap, routing-rule-drag,
  routing-order-unknown, routing-many-keys, in one run at concurrency
  3 with routing-fold-all: 170 tests, 157 ok, 13 red. Every red is also
  red on a clean origin/main 8bfc551ee checkout run alone (concurrency
  1, 42 tests, 14 red), and each already has an issue:
  i18n-keys "a plugin's words are its own" ("View routing", "No session
  ID" said by Go tests, #5332), routing-many-keys "2 keys in sight"
  (#4082), routing-order-unknown webkit de 420 (#4627),
  routing-row-swap (#3799), routing-rule-drag chromium (#3789, #5088).
  routing-fold-all, routing-sessions, inner-scroll-contain,
  skill-fold-all and i18n-en-no-cjk are all ok.

Broken by hand: on the old client.js, routing-fold-all fails with "the
no-session group can't be folded" (and finds no fold-all button).

Not tried: the real app's WebKitGTK on Linux, or Windows WebView2.
2026-11-05 22:07:46 +08:00
yetone 01a260af46 routing: a group with no rule says what a rule is for, with an example rule (mr_coffee0083)
mr_coffee0083 on Discord asked how to set up a group where one model
thinks and several others write code: the group editor's rules part
had no word on it and no example to start from.

- plugins/routing/client.js: a group of two models or more, not routed
  by hand, with no rule yet, says under Rules that every turn goes by
  the routing, and how one model thinks while others write code: the
  coding models in a group of their own added first, the thinking model
  after it, routed In order, and a rule sending planning and hard
  problems to the thinking model. "Add an example rule" beside "Add a
  rule" adds that rule, its intent filled in ("planning, design, or a
  hard problem to think through"), for the editor to finish. Neither
  shows once the group has a rule, or for one model, or routed by hand.
- i18n.js: the three strings in zh, zh-TW, ja and de, with each
  language's own word for In order.
- routing.css: the button wraps and reads in the accent colour, as the
  text buttons beside it.

Run (wsl-run, magpie-desktop, Node 22, Playwright 1.62.0):
- routing-rule-example.test.cjs (new): 20 of 20, chromium and webkit,
  en zh zh-TW ja de, at 1100 and 390 wide. The hint and button show,
  nothing is past the editor's side, pressing adds one rule to opus
  with the translated intent, Save posts it with the classifier Jev;
  after a reload a group of one model, or routed by hand, shows
  neither.
- the 16 i18n-*, routing-rule*, routing-rules-*, group-editor-* and
  routing-classifier* files: 190 of 221. The 31 reds are in
  i18n-keys (#5327, #5332), routing-rule-drag, routing-rule-models,
  routing-rule-remove and routing-rules-line (#4585, #5088, #3789,
  #4112, #4560). Those five files run alone, one at a time, at clean
  origin/main 9d143eaca: 24 reds there, 27 here, the same tests with
  different subtests each run.
- at the pushed head, rebased on 5db1b07ed (which changed
  routing/client.js): routing-rule-example 20 of 20; i18n-keys red
  only by #5327, the same as main.

Broken by hand: rTry never shown (hidden = true): the new test 0 of
20, "the example's button shows". Restored after.

Not tried: the real app window; mr_coffee0083's own groups.
2026-11-05 15:16:13 +08:00
yetone 11d9d0a3a5 routing: each account one calm cell in Accounts and keys (danzi002 on Discord)
danzi002 (v0.1.2945): Accounts and keys "显示的好乱啊,没有之前一目了然".
70a98dd85 (v0.1.2929) made the cards compact for ferock4669 and iyou00,
but left each card 3-5 lines of uneven height (tally, latest answer, a
Try now on its own line) in 168px columns: names cut, the status
wrapped, red twice on every resting account and on healthy ones with
old failures, Try now links scattered. Rendered with 9 Codex, 1
WorkBuddy and 3 WorkBuddy AI accounts, zh at 1100/1440, parent
c4245c4c2 against main.

Kept the compact change (still short, long lists still fold) and made
each account one uniform cell instead of reverting:
- a dot for its state: green in use (the provider's not-resting account
  that answered last), amber resting, grey otherwise, red to act on;
- name, plan and a muted Try now on one line, then one line of what is
  left and when it renews, or when it is back, wrapped in full, never cut;
- how it fared (the tally) and when it was read ("as of") on hover;
- red only where the reader must act: sign in again, a restriction or
  verification, a key failing with nothing else to say. Those rows keep
  their tally in sight;
- columns min(240px, 40vw), the usage bar back in the flow (Chromium
  misplaced the absolute bar inside a multicol .rt-lead).
routing-account-windows and routing-wallet-lapse now find "as of" last
in the tooltip instead of on the line.

Run on mote (Chromium + WebKit, en/zh/zh-TW/ja/de, 1100/420 and the
files' own widths):
- new routing-acts-calm.test.cjs: green both engines, all 5 languages.
- every Routing file that renders .rt-act plus i18n-keys and
  panel-routing*: 679 tests, 610 pass; the reds besides mine were
  rest-try-now WebKit, rules-line, rule-drag/remove, row-swap, steady,
  steps-cap, story-shrinks, order-unknown and many-keys webkit zh, the
  same set as main f44fa2ef6 run alone (41 reds there), filed as #5035,
  #5088, #4585, #3593, #4082, #4628, #3789, #3799, #3412, #4629, #3954.
  After fixing my own reds, acts-calm, account-windows, wallet-lapse,
  many-keys, rules-line and key-windows: 135 pass, 1 red (rules-line
  webkit en 1100, #3593/#5035).
- At the pushed head (rebased on 34116ec01): acts-calm,
  account-windows, wallet-lapse and i18n-keys 70/70 pass, the Go size
  budgets pass.
- go test ./internal/gui/...: TestMainWindowCorners/macOS_26_SDK red
  only (#3949, AppKit on macOS 27); the size budgets pass.

Broken by hand, each red in routing-acts-calm (Chromium):
- the resting line red everywhere (.st.rest red): red outside ivy;
- the tally shown on calm rows: "main: its name and what it says";
- columns back to 168px: a one-line status fails;
- no rest class: expected 'rest'.

Not tried: dark mode by eye, the real app on WebKitGTK (Linux) and on
Windows, real accounts (the fixture is synthetic), and the 8-row fold
with more than 8 Codex accounts by eye.
2026-11-04 22:04:17 +08:00
yetone 43849d51c3 routing: By session heads a session by its title, its folder quieter beside it (flandern1211_58540 on Discord)
Routing's By session headed each session "Claude Code · folder · title",
and with no title only the folder and id ("路由这里的会话名只能看到目录名和
会话ID吗"). Now the head is the agent and the session's title on one
line (whitespace folded), with its folder after it in a quieter .dir; with
no title the folder stands in, and with neither the id. The tooltip keeps
the title, the folder and the id.

The title comes from what magpie already reads, no second reader:
sessions.Titles (the agent's own title, else its first prompt) and Codex's
name index, and where both find nothing, the first prompt the gateway
recorded for that session (sessions.GatewayTitler, the title the Sessions
page shows for it), looked up under the agent the page names and the one
the gateway records it under (usage.AgentOf). A Codex thread Codex never
named now goes to sessions.Titles as a codex: key, so its rollout's first
prompt names it. withGatewayTitles and codexReadableTitles in trace.go.
Nothing is read that the Sessions page doesn't show already, and nothing
leaves the local GUI.

Tests: TestSessionTitlesFallBackToFirstPrompt (new): an unnamed Codex
thread gets its first prompt, a named one keeps its name, an unknown id
stays out, a pi session known only to the gateway gets its first words.
routing-session-folder.test.cjs follows the new head: title then .dir,
the first prompt on one line, the folder said once, the id with neither,
nothing clipped (chromium and webkit, en zh zh-TW ja de, 1100 and 420px).

Run on mote via mote-run, at origin/main e7b0c398e plus this change:
- Whole Routing GUI set (routing-*, panel-routing*) + i18n-keys,
  chromium and webkit: 2583 pass, 35 fail. Every red is a known one:
  rule-remove (#3096), rule-drag (#3789), row-swap (#3799),
  order-unknown (#4627), rules-line (#3593), many-keys, steady,
  steps-cap and story-shrinks (#5088), and under the load of another
  session's whole GUI suite (load ~200) routing-credits webkit ja 420
  (#5161) and routing-flood webkit en (#2215). Run again: credits 20/20
  and flood 12/12 here; order-unknown's webkit de 420 red the same at
  e7b0c398e alone.
- routing-session-folder: 20/20 (both engines, 5 languages, 2 widths).
- go test ./internal/gui: TestSessionTitlesFallBackToFirstPrompt ok;
  red only TestCoreScriptBudget (1534001 > 1533802, the same at
  e7b0c398e, #5139: this change adds nothing to the core scripts) and
  TestMainWindowCorners (the same at e7b0c398e, #3949).
- Rebased onto origin/main 1a67ca614 (its routing client.js changes
  merged clean), at this commit: routing-session-folder 20/20,
  routing-session-title 40/40, routing-kept-again 20/20,
  usage-compact-counts 30/30, routing-live-calm 2/2, i18n-keys 4/4, and
  go test ./internal/gui -run 'TestSession|TestCoreScriptBudget' ok
  (the budget passes at this base). The whole Routing set was not run
  again here. Then onto 0f1b40bbc (routing client.js and css again,
  merged clean): routing-session-folder 20/20, routing-live-bytes
  20/20, routing-live-calm 2/2, i18n-keys 4/4.

Broken by hand:
- withGatewayTitles a no-op: TestSessionTitlesFallBackToFirstPrompt red
  ("titles = map[]").
- client.js back to the old head: routing-session-folder red in every
  engine, language and width.

Not tried: the real app with real Codex, Claude Code and gateway-only
sessions (fixtures only), the Linux WebKitGTK app, Windows.
2026-11-04 19:43:00 +08:00
yetoneandCanda15 0f1b40bbc4 gateway: a reply in flight shows on Routing how much has arrived and roughly its tokens (#4951, Canda15)
A long or reasoning reply looked stuck on the Routing page. A request still
out now shows, on its row and beside the account answering it, the bytes
the agent has had, "≈ n tokens" once a rate is learned, and how long ago
content last came; after 15s with no content the account's dot stops
pulsing. Nothing stays once the request is done.

Ported from Canda15's 7f7bdb189 (github.com/Canda15/magpie), the idea and
the per-protocol content extractors kept, the hot path and storage
reworked:
- every write to the agent passes captureResponseWriter.Write, which calls
  liveRow.observe; the row hangs on the request's inflight (an atomic
  pointer), not a context value made per request
- rates are in memory only (256 pairs); the fork wrote a JSON file under
  the estimate lock on every finished request
- a whole JSON reply is counted in bytes only: the fork held and decoded up
  to 8 MiB of it at the end; a stream is cut into lines in place, only a
  line cut by a write's end is copied, a line over 1 MiB passed over, and
  each event decoded once (the fork ran json.Valid then Unmarshal)
- the reply's kind comes from its first byte, not a header read on every
  write; the keepalive check allocates nothing (the fork split each write)
- everything a row counts is under its own lock, and inflight.tr is read
  under f.mu; the estimate is in float64 (the int64 product overflowed)
- the route's Seq is bumped on every write and traceGather batches the
  wake-ups; the fork's global throttle could drop the last update before
  a pause
- learned only from a streamed reply that did not fail and had the
  vendor's output tokens
- left out: the finished row's "Received" metric and the ended caption
  (layout restraint; an ended row has its own metrics), a duplicate
  "Received" i18n key, the receive-monitor doc (the design is in
  gateway-routing.md now), the fork's xmod and Windows CI commits
The Routing plugin and i18n.js are outside TestCoreScriptBudget.

Run on mote at this head unless named: gofmt -l; go vet (darwin),
GOOS=linux -tags nogui and GOOS=windows go vet ./...; go build ./...;
go test -race on the live tests; go test ./internal/gateway ./internal/gui
(gateway ok; gui red only on TestCoreScriptBudget, #5139, 1533907 >
1533802 before this change and untouched by it, and
TestMainWindowCorners/macOS_26_SDK, #3949); routing-live-bytes.test.cjs and i18n-keys in Chromium and
WebKit, en/zh/zh-TW/ja/de, 1100 and 420px (24/24); every routing-* and
panel-routing* GUI file with i18n-keys in WSL Linux (Chromium all green;
WebKit reds in 12 files, the same class at origin/main 7dd2434d3 run
the same way: 25 there, 28 here, the sets differing by timing samples;
routing-live-patch alone red 2 of 3 on main, 1 of 3 here; filed as
#4121, #4520, #5156, #2174).

Rebased onto 38f4f74e6 (gateway.go, trace.go and the Routing plugin
moved): build, gateway vet, the live tests, routing-live-bytes and
i18n-keys run again there, green (24/24).

Broken by hand, each red, then put back:
- no observe in capture.Write: TestLiveCountsARealStream
- commentOnly never true: TestLiveHeartbeatIsBytesNotContent,
  TestCommentOnlyTellsHeartbeatsApart
- learning from failed replies: TestRatesLearnFromRepliesTheVendorFinished
- a whole reply read as a stream: TestContentCounterLeavesAWholeReply
- no Seq bump in liveBytes: TestLiveWritesReachTheRoute
- no quiet class, no per-second repaint: routing-live-bytes 0/20

Not tried: a real vendor's stream in the running app; the ChatGPT backend
chain (codex_backend.go) writes past the capture writer and isn't counted;
the full Go and GUI suites run after the tag.

Co-authored-by: Canda15 <124772373+Canda15@users.noreply.github.com>
2026-11-04 19:39:08 +08:00
yetone 70a98dd85c routing: a long Accounts and keys shows its first rows, the rest behind Show N more (ferock4669, iyou00 on Discord)
With many keys the Routing page's Accounts and keys ran on and on: each
card held every window, the models it answered and a meter. Now a card
keeps its name, one line of what is left (or its rest) and how it fares,
with Try now or Sign in again when it needs one. The models it answered
are in its tooltip under its id, and a subscription's other windows are
on hover over its figure.

A list longer than 8 rows shows the first 8 and puts the rest behind
"Show N more" at its foot (kept across a reload in
magpie.routingActsAll). Never behind it: a row to sign in again, a
resting account or model, failures with no answer, a remote whose
allowance can't be read, rows under a fold the reader opened, and the
heading of a provider with a row shown. Two more alone aren't folded.
The button clicked stays where it is on the screen. "View usage" beside
it opens Usage's Overview, where each account's card says it all,
without making that tab the reader's own (window.openUsageOverview).

The foot writes only what changed, so an idle page writes nothing
(routing-live-calm).

Tests: routing-acts-compact.test.cjs (new; chromium and webkit, en zh
zh-TW ja de, 1300px and 420px). routing-account-windows,
routing-read-allowances, routing-wallet-lapse, routing-accounts-narrow
and routing-columns follow the card's new shape and the foot.

Run on mote via mote-run, worktree based on origin/main c7bbd3faf:
- Whole Routing GUI set (routing-*, panel-routing*) + i18n-keys,
  chromium and webkit: 2487 pass, 29 fail, every red one of those
  below (many-keys and routing-levels #3620 too)
- Same reds on clean origin/main c7bbd3faf (11 files run there): the
  routing-rule-remove (#3096), rule-drag (#3789), row-swap (#3799),
  order-unknown (#4627), rules-line (#3593), steady, steps-cap and
  story-shrinks reds of #5088, in different languages run to run.
- routing-folder went red 2 of 3 with this change (30/30 on main):
  its press() clicked Save while the group editor was still growing
  open, and the foot moved .rt-gsec 8px. press() now waits for the
  button to hold still: 3 runs x both engines 20/20, webkit alone
  10/10.
- TestCoreScriptBudget red, 1534154 > 1533802, identical on clean
  c7bbd3faf (#5139): this change adds nothing to the core scripts.
- routing-acts-compact twice, alone and beside 5 files: 22/22, 20/20.
- Rebased onto origin/main 14f6d10de (its routing client.js changes
  merged clean), at this commit, both engines: routing-remote-windows,
  week-low, free-expiring, group-strategy, acts-compact, live-calm,
  folder, account-windows, read-allowances, accounts-narrow,
  wallet-lapse, columns and i18n-keys all green.
  Pushed on c4245c4c2, which changes only internal/gateway's
  object_root and its doc after 14f6d10de; not run again on it.

Broken by hand:
- rows needing the reader no longer kept out of the collapse (m.keep
  ignored): routing-acts-compact red (Show 4 more never shown).
- a row to sign in again under a shut fold not drawn: red (Zed's fold
  row 0 !== 1).
- the foot's hidden/aria-expanded written every draw: routing-live-calm
  red in both engines (attrs: 6 !== 0), as in an earlier run of this.
- the button's hold removed: routing-acts-compact red (chromium en
  1300px, "the click moved the button: 572.9 → 592.1").

Not tried: the real app with a real long key list (fixtures only), the
Linux WebKitGTK app, Windows.
2026-11-04 18:33:07 +08:00
yetone d16dcba227 routing: the stage's agent and magpie columns grow with their words, up to 15% of the stage
refeccd on Discord (#help): on the Routing page, in a full-screen
window, the stage kept the agent and magpie in columns of 124px each, so
the agent read "Claude Desk…" (and its model auto/claude-opus… was cut)
while the group's member rows ran on across the rest of the stage.

The two columns are now fit-content(max(124px, 15%)): as wide as their
words, at least 124px (min-width on .rt-srcs/.rt-hub, dropped again in
the narrow layout), at most 15% of the stage. Where 15% is no more than
124px (a stage up to ~826px) they are exactly as before, so the member
rows lose nothing on a narrow window; the narrow layout (560px and less)
is unchanged. The stage's ResizeObserver now also watches the agents'
and magpie's cards, so the wires follow a card that changes width while
the stage keeps its size (a new agent name or gateway address).

Run, on mote:
- new routing-stage-wide.test.cjs: 60/60 (chromium + webkit, en zh
  zh-TW ja de, 2560/1920/1100/800/560/390px): name, model and address
  read whole at 1920+, columns 124px..15%, exactly 124px where 15% is
  less, wires start and end at the cards, no sideways scroll.
- broken by hand: with the old routing.css the same test is red in all
  20 cases at 2560 and 1920px ("Claude Desktop" cut, columns 124/124).
- every routing-*.test.cjs + i18n-keys at 8d7583a78 (this change on
  6c201095d): 2442 tests, 2409 ok, 33 red in 12 files. The 12 files
  rerun at 6c201095d and at 8d7583a78 side by side: 29 red at the
  base, 28 with the change, the same tests (routing-folder, rule-drag,
  rule-remove, rules-line, rule-models, many-keys, row-swap, steady,
  steps-cap, story-shrinks, order-unknown); sky-under's one red in the
  whole run passed in the rerun. Filed with both outputs as #5088.
- at this tree, rebased on 4c0c6c02b (nothing new on main touches
  routing): routing-stage-wide, routing-sky-under, routing-scroll-end,
  i18n-keys: 126/126.

Not tried: the whole GUI suite (mote was down mid-run; it runs after
the push), the real Wails/WebKitGTK app, and a test of the wires
following a card that changes width with the stage's size unchanged.
2026-11-03 21:14:09 +08:00
yetone f0e0385a0e routing: a row's model chip is whole; its status is what is cut short (yi_time)
yi_time on Discord (#feedback): on the Routing page, a group member's
row that was answering showed its model chip cut to "gpt-6.1-te…".
The status after it ("回答中… · 按意图"任务主要依靠视觉或界面…")
took up to 60% of the row (fit-content(60%)), and the head, with the
account, plan and model as one inline run, was cut at its end, which
is the model. So which model answered didn't show. The same happened
in a fold of keys, whose status column was auto, and at narrow widths,
where a long account name pushed the chip off.

The head's column is now as wide as its content (minmax(0,
max-content)). The status takes the rest and keeps at least
min(14em, 40%), cut short with an ellipsis. Inside the head, the
account name, then the plan, give up room. The chip and its
fast/fallback tags never shrink. Folds get the same columns, and their
status still wraps. A status beside the name is right-aligned, as
before. Under the name (max460/max560) it starts at the left. A status
cut short is read whole on hover: its em gets a title when the pointer
finds it overflowing. Measured on pointerenter, not each render
(#3164). Resting rows keep their rest tooltip; the intent and session
titles are as before. Sibling of 889767b7b (the failure tag cut).

Run:
- routing-model-chip-whole.test.cjs (new). Rows: answering with the
  reporter's intent text (the prefix their screenshot shows, then
  more), one gone on from (429), one failed to the agent (504), one
  resting, a plain provider row, and a fold of three keys. Models
  gpt-6.1-terra, gpt-6.1-sol:medium, gpt-6-astra:high and gpt-6-luna:low,
  plan prolite. en, zh, zh-TW, ja, de; Chromium and WebKit; 1600 and
  1280 wide (status beside the name, as the reporter had it) and 420
  (under it). Checks: every chip inside its head, at least 40px left
  for the status beside it, the intent row's status cut and titled
  whole, every cut status titled on hover, no sideways scroll.
  - On mote: 90 of 90 ok.
  - On WSL at 4a2bf73a0 (this change on bc10a6198): 90 of 90 ok.
  - Old code (origin/main with only the test added): 85 of 90 red at "the
    model's chip is whole" (gpt-6.1-terra in 53, the fold's chip in
    30), the reporter's case at 1600 among them.
- The 257 GUI files that reach the Routing page, plus i18n-keys, both
  engines, on mote at the pre-rebase head (load ~300). The run was
  stopped at ~680 results, with 12 reds in 9 files: codex-subagent-model,
  group-editor-selected, group-first-token, group-found-skip,
  group-from-model-add, group-member-weight, last-page, menu-input-scroll
  and mobile-web. None of them reads .rt-accts rows. Those 9 files on
  WSL, at this change and at origin/main bc10a6198:
  - At the change: 3 reds, group-editor-selected webkit and mobile-web
    in both engines.
  - At main: the same 3, plus codex-subagent-model chromium zh 560 and
    group-member-weight webkit en 420.
  Filed: #3952 (mobile-web), #2387 (group-member-weight), #5049
  (group-editor-selected), #5050 (codex-subagent-model).

At the pushed head (rebased on b967b1620, which touches no Routing
file):
- The new test and i18n-keys on WSL: 94 of 94 ok.
- go test ./internal/gui on mote: red only in TestMainWindowCorners,
  which is red the same way on origin/main b967b1620 (#3949, macOS 27).

Not tried: the rest of the 257 files after the stop; the real app's
WebKitGTK and WebView2; the reporter's own account and window width.
Screenshots were looked at by eye in Chromium only (zh 1600 and 420,
live and fold).
2026-11-03 16:37:33 +08:00
yetone 889767b7b3 routing: a failed try's tag over its row is whole until it fades (yuancjun)
yuancjun on Discord (#feedback, v0.1.2784, Chrome 128 on macOS): a member
row's failure tag ("504 · 迟迟未开始") showed whole for ~0.45s, then its
top half, the ~10px over the row's top edge, was cut off until it faded
at 1.8s. Their analysis was right: `.rt-accts .tag` sits at top:-10px,
`.rt-accts li:not(.hit)` has content-visibility: auto (#3164), which
always paint-contains, and rerun() takes `.hit` off on the shake's
animationend at 0.45s while `.tagged` stays 1800ms.

The row is now drawn whole by a class of its own, `lift`, put on with
`tagged` and taken off 300ms after it, once the tag's .25s fade-out is
over: with `:not(.tagged)` alone the tag's top would be cut again for
the whole fade. The CSS rule goes on `:not(.lift)`; `.hit` always came
with the tag, so it adds nothing there. A row tagged again within 1.8s
(the next try failing on it) starts the 1.8s over: the first failure's
timer used to take the second tag down early. This is the only place a
row is tagged; nothing else in .rt-accts stands over a row's edge.

Run on mote (load 70-110 from other sessions' suites):
- routing-tag-whole.test.cjs (new): Chromium and WebKit, en, zh, zh-TW,
  ja, de, 1100 and 420 wide, motion on (the shake must end for the cut
  to show): 20 of 20 ok. It plays a live request failing 504 slow,
  checks the tag's words, then at ~0.8s screenshots the band of the tag
  over the row's edge and counts the tag's red in it, checks the row's
  content-visibility while tagged and while it fades, and that rows go
  back to auto after.
- At the rebased head (on 06944e065): routing-tag-whole, i18n-keys and
  routing-held-dot, both engines: 44 of 44 ok.
- Before the rebase (on 2c214ce25), every routing-*.test.cjs and
  panel-routing*.test.cjs, i18n-keys and claude-subagent-tag, both
  engines, concurrency 6: 2301 of 2342 ok, routing-tag-whole 20 of 20.
  The 41 reds are in routing-many-keys, -order-unknown, -row-swap,
  -rule-drag, -rule-remove, -rules-line, -sign-in-again, -steady,
  -steps-cap and -story-shrinks. Those ten files again at concurrency 2:
  30 red at this change, 23 at 2c214ce25 without it, the same tests
  (row-swap, rule-drag, steady, steps-cap, story-shrinks, order-unknown
  webkit de 420 red at both; rule-remove and rules-line vary by run).
  None of them reads .rt-accts content-visibility or the tag. Filed
  already: #4585 (these files under load), #3799, #3789, #4627, #4628,
  #4629.

Broken by hand: the CSS back on `:not(.hit)`: 20 of 20 red at "a tagged
row is drawn whole"; with that check taken out, the screenshot check
alone is red in both engines with 0% of the band red (8 of 8, en and zh).

Not tried: the real app's WebKitGTK and WebView2; Chrome 128 itself
(Playwright's Chromium is newer).
2026-11-03 14:01:55 +08:00
yetone 2cfeda3d3a routing: a group editor's Cancel and Add have the scroll capsule above them, their ground to the window's edge
jiabubu on Discord: in a Routing group editor, its bar of Cancel and Add,
held at the window's foot while the editor runs on below, had the Scroll
to top and Scroll to bottom capsule over Add, and under the bar's ground a
gap above the window's bottom edge.

- The capsule (scrollends.js) rose above Providers' sticky Add bar only.
  It now rises above any page foot marked .view-foot that is under it,
  and the editor's bar is one. A foot elsewhere on the page, not under
  the capsule, leaves it where it was.
- The bar was held at bottom: 0, which stops at the view's own foot
  padding (4px, 8px in the window, max(12px, the safe area) on the phone
  page, from app.css), so that much of the page showed under it. It is
  now held that far down, its ground to the window's edge; on a phone
  page its buttons keep the safe area under them.

routing-editor-foot.test.cjs: sixteen groups, then New group, scrolled so
the page is a screen down and the editor runs on below the window: the
bar's foot at the window's edge, the capsule above the bar and over none
of its buttons, and Add's right end taking a click as Add. Desktop 1100,
700, 560; browser page 1100, 700, 440, 360; Chromium and WebKit,
en/zh/zh-TW/ja/de.

Run on mote (mote-run):
- routing-editor-foot, Chromium and WebKit, en/zh/zh-TW/ja/de: 10 of 10
  ok.
- At b3cf5641a (this change on 96acc59c4): routing-editor-foot,
  view-ends, old-webkit, group-editor-selected, group-editor-fits,
  group-editor-align, group-first-token, group-patience, group-morph,
  group-new-head, group-member-drag, routing-rows-fit, drag-rows-shift,
  click-scroll, i18n-keys and routing-rule-drag, both engines, every
  language they run, at concurrency 3: 179 of 184 ok; go test -run Budget
  ./internal/gui ok. The reds:
  - routing-rule-drag in Chromium (4), at its hover check before any
    drag, the same alone at origin/main (#3789).
  - group-first-token WebKit en 420, the editor's bar over the option a
    click scrolled to. It went red the same way before this change, under
    a larger run (#5007); alone at this tree it is 30 of 30.

Broken by hand, each 10 of 10 red in the new test:
- all three files as at origin/main: "desktop 1100px: the bar's ground
  down to the window's edge, no gap: bar 552, window 560".
- scrollends.js only: "the capsule above the bar: 489-544, bar from 511".
- routing.css only: the gap again (552 vs 560).

Not tried: the Windows app (WebView2) itself, and a phone with a home
indicator (safe area) in a real browser.
2026-11-03 12:14:06 +08:00
yetone 96acc59c4d routing: a group's tags, a provider's segments and the live stage stay inside the window
young02036 on Discord: a long line in a group's row ("WorkBuddy AI · Hy3 ·
免费") made the Routing page wider than the window, with a scrollbar under
it. v0.1.2769 held the member lines; the rest of each row could still go
past it:
- a group's tags never shrank or wrapped (flex: none, nowrap). With many
  tags (German's long words, or any language at 700px) they pushed Edit
  and the switch out past the row's edge, where the list cut them off.
  The tags now take up to half the row and go onto more lines, each one
  ellipsized; on a phone page they keep their own line as before.
- a provider's Routing and Stays segments (several accounts or keys) sat in
  an auto-wide grid column and ran out past the row in the desktop window,
  63px in Chinese and 265px in German at 560px. The column is now as wide
  as the row has room for, and the segments wrap there, as they already
  did on the browser page.
- in WebKit the live stage's "No request yet" row, out of sight
  (content-visibility), kept the width it was last drawn at in a wider
  window. In a grid column as wide as its rows, that held the stage, and
  the page, 1193px wide in an 880px view after a group's editor opened.
  The stage's list now has one column as wide as itself.

routing-rows-fit.test.cjs: three groups (smart, manual, and an order group
with every tag a row can carry) of the reporter's WorkBuddy AI members and
long model names, and a pooled provider. The list, then each group's
editor in turn on one page, at each width down to 560px (desktop) or 360px
(browser page) and back to 1440: the view and the document no wider than
the window, and every row's tags, buttons, switch and segments inside the
row. Chromium and WebKit, en/zh/zh-TW/ja/de.

Run on mote (mote-run) at the pushed head:
- routing-rows-fit and routing-accounts-narrow, Chromium and WebKit,
  en/zh/zh-TW/ja/de: 20 of 20 ok. At origin/main's routing.css (rows-fit
  copied in): red in both engines, en and de ("desktop list 700px: each
  row's tags, Edit, switch and segments inside it").
- With the next two commits and the one before, at 77eed2ea4 rebased on
  84da86ebd: 31 GUI files, both engines, every language they run
  (drag-rows-shift, account-arrange, agent-grip, gateway-key-arrange,
  group-member-drag, group-arrange, panel-arrange, provider-order,
  usage-arrange, routing-rule-drag, routing-account-order, routing-rows-fit,
  routing-accounts-narrow, routing-columns, routing-own-columns,
  routing-keys-fold, routing-key-windows, routing-many-keys,
  routing-groups-wide, routing-group-fold, routing-days-fit,
  routing-hidden-stage, routing-pool-tooltip, routing-weight-chip,
  routing-account-windows, group-editor-fits, group-first-token,
  phone-rows, view-no-sideways, click-scroll, i18n-keys): 395 of 399 ok.
  The 4 reds are routing-rule-drag in Chromium (en/zh/zh-TW/ja), at its
  hover check (line 92) before any drag; it fails the same way alone at
  origin/main 625938a2f (#3789). go test -run Budget ./internal/gui ok.
- Rebased again on 03d7927a8 (routing's client.js and i18n.js changed
  under it), at this tree: drag-rows-shift, routing-rows-fit,
  routing-accounts-narrow, i18n-keys, routing-sign-in-again and
  group-member-drag 60 of 60 ok; the budget tests ok.
- Rebased on 1d8658abc (the group model picker in client.js): at this
  tree drag-rows-shift, routing-rows-fit, routing-accounts-narrow,
  group-pick-drawers and group-member-drag 38 of 38 ok.
- group-first-token went red once in WebKit en 420 under a run of 189
  files at concurrency 4 (Cancel's bar over the 1 min option); alone it is
  10 of 10 at 317e8a5aa (this change before the last rebase) and at
  625938a2f.

Broken by hand, one at a time, each red in the new test:
- the tags' old rule: Chromium and WebKit en/de red at 700 and 1100px
  (desktop list, the tags and Edit past the row), as at origin/main.
- the pool's old auto column: Chromium zh and de red ("segs ... 63px
  past", "265px past").
- the stage list without its column: WebKit en and zh red ("desktop g2's
  editor 1100px: ... 1193,880 LI.idle 798px").

Not tried: the reporter's own window and fonts; the Windows app.
2026-11-03 12:00:35 +08:00
yetone ecdb80f7f1 routing: under the requests, providers flow in columns, each heading over its own
jiabubu on Discord, on v0.1.2774 in a narrow Windows app window: Usage &
keys still listed the providers one under the other. 51dcb6738 (v0.1.2763)
put a provider's accounts several to a line in a grid, with its heading
across the whole line, so a page of providers with one key each was still
a heading and one card to every line.

Under the requests (not min1150), the list is now laid out in columns
168px wide that the providers flow through, each provider's heading over
its own rows in the same column. WebKit has no break-after: avoid in
columns, so a heading could sit at one column's foot with its accounts at
the next one's top; client.js now puts a heading, and an open "N keys"
fold, in one block (.rt-lead) with the row after them, and no block is
broken across columns. Beside the requests (min1150) the column holds one,
as before. The rule that drew a heading's top line reads the block.

routing-accounts-narrow.test.cjs adds the reporter's case, eight providers
with one key each beside Codex's accounts and a folded key run, and checks
at 700, 560 and 420px that every heading is in the column of what it heads,
just above it; that the headings fall in two columns or more; and that the
list is shorter than its items one under the other. At 1440 the column
still holds one account to a line.

Run on mote (mote-run), with the next commit's routing.css in the tree:
- routing-accounts-narrow.test.cjs, Chromium and WebKit, en/zh/zh-TW/ja/de:
  10 of 10 ok. At origin/main 8819beeb0's client.js and routing.css: red
  in both engines ("700px: the providers in columns: 17", a heading to a
  line). With columns but no .rt-lead block, WebKit red at 700 and 420px
  ("DeepSeek heads its own", the heading a column away from its rows);
  Chromium green.
The other routing files that read the accounts list ran at the pushed
head, in the next commit's record.

Not tried: the Windows app (WebView2) itself at the reporter's width; this
is Playwright's Chromium and WebKit.
2026-11-03 11:57:57 +08:00
yetone a5c1fa4b42 routing: long routing groups no longer widen the page (noahhrreion)
noahhrreion (Discord #general): on Routing the groups at the foot made
the page wider than the window, a scrollbar under it and each row's
routing, Edit and switch far off to the right.

Cause: 173b7e274 let the editor's Save bar stick by having the groups'
list clip its overflow (overflow: clip) instead of hiding it. A box
that hides its overflow is a scroll container, whose least width as a
grid item is 0; one that clips is not, so the .rt-gsec grid, with no
columns of its own, sized its one auto column to the longest member
line, which never wraps. With twelve long members that was 7,100 to
8,200px, and #view-routing scrolled sideways. The column is now held to
the section (grid-template-columns: minmax(0, 1fr)); the list keeps
clip, so the Save bar still sticks. Member lines are cut with an
ellipsis in their row again (wrapped on a phone's web page, as before).

routing-groups-wide.test.cjs (new): three groups of twelve long
members; #view-routing and the document no wider than the window,
every row and its members, routing, Edit and switch inside the list,
the long line cut or wrapped. Chromium and WebKit, the desktop window
1440 to 560px (windowMinW) and the web page 1440 to 360px,
en/zh/zh-TW/ja/de. view-no-sideways serves no groups, so it missed this.

Broken by hand: with origin/main's routing.css the new test is red in
both engines (desktop en 1440px: scrollWidth 7120 > 1228).

Run on mote:
- At this tree on origin/main 6a6e4fefa (routing.css is the same there
  as at c86fa2a34, where the rest was run): routing-groups-wide and
  routing-affinity-order 22 of 22 ok; routing-affinity-order alone with
  origin/main's routing.css 20 of 20.
- At c86fa2a34 with this change: go test -run 'Budget|CSS|Asset'
  ./internal/gui ok. The routing-*, group-*, view-no-sideways,
  click-scroll and old-webkit files (both engines, concurrency 4) were
  cut short when mote rebooted at load ~94: 416 ok, 3 red, all a 5s
  wait timing out in WebKit (routing-affinity-cache-write, #3772;
  routing-affinity-order, #4976, filed now). Both pass alone. The rest
  of that run was not run again.

Not tried: the real app window, WebKitGTK on Linux, a real account's
groups. Not changed: in German at 420px the page head's Hide accounts
and New group run ~50px over, with or without groups; the desktop
window can't be that narrow (560px least).
2026-11-03 09:29:06 +08:00
yetone cb7d7f9aa6 routing, usage: a request names who answered with the provider's logo (Jiabubu)
Jiabubu on Discord asked for the provider's icon before the answering
provider or account in the request lists. Routing's Requests rows now draw
icon(logoOf(member)) for the try's member (tried(r, tr)), the same logo the
request's story uses, between the dot and the name, at 14px. A request
nobody answered has no try and no logo. In Usage → Requests, the "Provider ·
account" cell holds the ledger's provider icon (l.providers) before
.where-name, inside a new .where-line. A row read from a session file
(source "log") names no provider for sure and gets none. .where-name's text
is unchanged. No new strings, no new icons.

Test: request-provider-icon.test.cjs. Routing has codex-color and
deepseek-color, none on the failed row, a 14px logo before and level with
the name. Usage has openai and zhipu-color, none on the log row, the name
alone in .where-name, the logo inside the cell. Chromium and WebKit, en zh
zh-TW ja de, at 1100 and 420px.

Run at the pushed head on mote: see the head run below. Also
routing-log-icons, routing-row-reuse, routing-live-patch, usage-ledger,
usage-ledger-search, usage-ledger-fit, usage-ledger-agent-middle,
session-identity, i18n-keys, phone-rows. Budget tests ok: app.js is
untouched, and the plugin files are outside the script budget.
Broken by hand: dropping the Routing logo makes 22 of 22 red; dropping the
Usage logo makes the Usage checks red in every case.
Not tried: the whole GUI suite (mote was busy with two other whole suites);
the real Windows app.

Head run (mote, 1e6a29337 on 173b7e274): Budget ok. The 16 files above plus
the two new ones: 242 ok, 6 red, all in usage-ledger's "newest live route
needs no return-to-live button", which is red the same way on 173b7e274 alone
(2 of 2; #3104, #4078). routing-row-swap, routing-steady, routing-steps-cap,
routing-story-shrinks, routing-order-unknown and routing-rule-* were red in
the wider run. Run at 173b7e274 and at this head together, they gave 26 and
25 reds in the same tests (#4932, #4628).
2026-11-03 06:25:07 +08:00
yetone 51dcb67383 routing: in a narrow window the accounts and keys sit several to a line (Jiabubu)
Jiabubu on Discord (Windows, 0.1.2738): with the window narrow, Requests and
Accounts and keys go one under the other, and every account or key then took
a whole line, so a page of many accounts ran far down. The cause is
routing.css: under 1150px .rt-acts stays a one-column block list. Now, when
the columns stack (not .min1150, or .solo), .rt-acts is a grid of
auto-fill columns of at least 168px. Each provider's heading and an open
"N accounts" summary row span the whole line. Beside the requests (1150px
and wider) the column holds one to a line, as before. No collapse arrows
and no other change to the page: once the list is compact the page is no
longer long.

Test: routing-accounts-narrow.test.cjs. At 700, 560 and 420px, four
accounts with two of them sharing a line, side by side; headings and the
summary row across the list; no sideways scroll; names inside their box;
one to a line at 1440. Chromium and WebKit, en zh zh-TW ja de.

Run at the pushed head on mote: that file 10/10. Also routing-columns,
routing-keys-fold, routing-group-fold, routing-compact and the rest of the
head run in the next commit's body; TestCoreScriptBudget and other
Budget tests ok (no script grew). Earlier, at dcc84dbc0, every routing-*,
panel-routing*, usage-ledger*, session-identity, i18n-keys and phone-rows
file: 1051 ok, 5 red. Four were load (a browser launch timing out at 180s)
and passed when run again alone. The fifth, routing-many-keys, is red on
origin/main 173b7e274 too (#4082, numbers added).
Broken by hand: routing.css at its base makes all 10 red (700px, one
account per line).
Not tried: the whole GUI suite (mote had two other sessions' whole suites
running at load ~200); the real Windows app at a narrow width.
2026-11-03 06:25:07 +08:00
yetone 173b7e2742 routing: the group being edited reads as selected, its Save in reach (Jiabubu)
Jiabubu (Discord, #feedback): on Routing, the group being edited
looked like the groups above it, and Save was a small text button at
the editor's foot, a long scroll down.

The editor in the groups list now reads as the selected row: a soft
accent tint (4% over the card) and a 1.5px accent ring all round, its
corners following the list's when it is first or last. No stripe down
one side. Its bar (Remove, Cancel, Save) is sticky at the bottom of
the view while the editor's rows scroll by, on the editor's own tint,
and sits where it always was once its foot is reached. Cancel and Save
are 28px tall at 13px (were 23px at 12px); the web's 44px touch size
still wins on a phone. The list clips its overflow instead of hiding
it (overflow: clip, with hidden as the fallback), so the bar can
stick. Nothing else on the page moves (#1354).

Measured, editing the third of four groups (a ten-member group) with
its head near the top of a 760px window: Save was at y 1845 (1000
wide) and 3013 (420 wide), out of sight; now at 714 and 694, in sight,
in Chromium and WebKit.

group-editor-selected.test.cjs, in Chromium and WebKit, desktop and
web, 1100/770/420 wide, en/zh/zh-TW/ja/de (and dark in zh): the editor
is tinted apart from the other rows and has a ring, both sides alike;
scrolled by the reader to its head, Save and Cancel are in the window,
uncovered, 28px and 13px or more; scrolled to its foot, the bar
follows the last row inside the editor.

Broken by hand: with origin/main's routing.css it fails at "light
desktop 1100 en: the editor is tinted apart from the other groups";
with only the list's overflow: clip taken out, at "Save is in the
window (1353-1381)".

Run on mote at this tree (on origin/main 8abdf53a8), with mote at load
164-191 from other sessions: the new test 2 of 2 ok; the GUI files this
can reach (360 files, every one naming a usage card, the panel card, the
routing page, app.css, i18n or a budget; both engines, every language,
narrow widths), 5573 of 5668 ok. The 22 red files were run again alone at
this head and at 8abdf53a8: three were this change (routing-save-blank
and routing-save-keeps-the-row wheeled until Save was in sight, which it
now is at once, so they wheel to the editor's foot; quota-holds took a
faded "not enough data" as muted, now the reset line's caption colour),
fixed here and green at concurrency 2. The rest are red at 8abdf53a8 too
(account-eye #4244, routing-rule-* #4585, tray-cell-click and usage-fold
#4790, numbers on #4932). The whole suite was started once and stopped at
316 tests after an hour at that load; it was not run to the end.

Rebased on origin/main 1851ead1a (app.css and the usage page changed),
then run again at the pushed head: go test -run 'Budget|CSS' ./internal/gui
ok, and quota-caption-contrast, group-editor-selected, quota-holds,
routing-save-blank, routing-save-keeps-the-row, plan-credits and
balance-fix, 154 of 154 ok in both engines.

Not tried: the real app's window, and WebKitGTK on Linux.

Reported by Jiabubu on Discord (#feedback).
2026-11-03 05:50:10 +08:00
yetone e44ad72cfd gui: a failed status dot is an x, not a red dot alone
coolmantou on Discord (#feedback), who is red-green colour-weak, could
barely tell the green status dot from the red one. Under a deuteranopia
or protanopia simulation the two are one olive colour, in light and dark.
Making the green lighter would not help a greyscale or protan reader, so
the failed state now says it by shape (Apple HIG: never colour alone).

What changed
- app.css: a --x-mark token (an SVG x, used as a mask). Each failed dot
  keeps its red and its 6-7px box, is drawn through the mask and scaled
  1.5 so it reads as heavy as the round dot. Layout is unchanged.
  Dots: Test models (.tdot.bad), an agent's status (.ag-st.bad .ag-dot),
  the check-in (.ci-dot.bad), the request ledger (.led tr.bad .st .dot).
- routing.css: a try or probe (.rt-req/.rt-probe.bad .to i), a step
  (.rt-steps li.bad::before), the preview (.ps-dst.bad > i).
- library.css: a server that failed (.lib-health.err::before). A ring
  was not used because "not checked" is already a ring there (#2308).
- Not changed: green-only dots with no red pair (gateway, keys, tiles,
  live), chart markers, routing's animated packets, redact's categorical
  facet dots. The tray has no status dots of its own.
- docs/subsystems/gui-shell.md says it beside "State is shown with a dot".

Tests
- status-dot-shape.test.cjs (new): for all 9 pairs with the real
  stylesheets, in chromium and webkit, light and dark, 980 and 420 wide:
  the good dot has no mask, the failed one has the x mask and the good
  one's box, and its pixels have ink on the arms and centre and none
  above the centre.
- library-mcp-health.test.cjs: its "a dot, not a stripe" check now
  expects the x for a failed server and a round dot for the rest.

Run at the pushed head (mote, via mote-run)
- status-dot-shape + library-mcp-health: 16 pass, 0 fail (chromium and
  webkit).
- go test -run 'Asset|CSS|Budget|Compress|Revalidate' ./internal/gui: ok.
- At 377e3ca6e + this change (rebase since added only site/ files):
  the 232 GUI files that touch these dots, Test models, Routing, Library,
  check-in or the ledger, in both engines and every language they run:
  3588 tests, 3526 pass, 62 fail. library-mcp-health (2) was this
  change's and is fixed above. The other reds (import-row, models-works-only,
  provider-typed, rest-try-now, routing-order-unknown, routing-row-swap,
  routing-steady) fail the same on a clean origin/main 377e3ca6e copy and
  are filed: #4619, #4391, #4673, #2564/#4127, #4627, #3799/#4585, #3412.
- go test ./internal/gui: TestMainWindowCorners/macOS_26_SDK red on mote's
  macOS 27, #3949; nothing else.

Broken by hand
- The three stylesheets put back to main's: status-dot-shape 10 of 10 red
  ("the failed dot is drawn through the x").
- The x token swapped for a filled circle: red ("the failed dot isn't a
  round dot").

Checked by eye: screenshots of every pair and of the real Usage ledger,
before and after, normal, deuteranopia, protanopia and greyscale
(Machado 2009 feColorMatrix), light and dark. Before, the pair is one
colour in both simulations; after, dot vs x in all of them.

Not tried: the real app in Linux WebKitGTK, Windows WebView2 and
Omarchy's square-corner theme (the mask doesn't depend on border-radius,
so it should hold there); the Playwright engines only.
2026-11-02 07:41:23 +08:00
yetone 85e37162e9 routing: a route group can be held to chosen accounts (duanckham on X)
duanckham has a personal and a company GPT account, one tool and one
gateway, and wants a group's GPT models to spend only the company
account (or only his own). A second gateway key doesn't fit: his tool
talks to one gateway, and a local agent needs no key at all.

Group.Accounts holds a group to some accounts or keys of the providers
it names, in a gateway key's form and by the key's rule (#905,
Identity.AllowsAccount). The asked group narrows the request's
identity (access.Identity.HeldToGroup: the strict intersection with
the key's own list; "<provider>/\x00" when they share none), so every
gate a key's accounts go through holds the group's too: chat,
responses, messages, count_tokens, embeddings, images and video,
streamed or not. A group reached inside another, as a member or a
fallback, is held in planLevel (hold, Member.Via): its candidates on
an excluded account are Held rows with Weighed.HeldBy, which the
Routing trace tells. Fallback stays within the group's entries; with
every allowed account resting or out the group's usual error comes
back, and a key and a group that share no account get a 403 naming
the group, nothing asked upstream. SaveGroup resolves each entry
(ResolveAccount, shared with the key's CleanAccounts); share and
import drop them. A group without accounts is as before.

GUI: the group editor's Accounts section, a row per member provider
with two or more accounts, "Any of its accounts" until some are ticked
in the app menu (openPicker multi). Every save sends accounts, since a
save replaces the group. Strings in all five languages.

Gateway keys stay as they are: Gateway › "Gateway keys are for other
computers … added here once Share on local network is on" already says
where, and this case needs none.

Run (mote, through mote-run), at cafed0067 on origin/main 9d08993c8:
- gofmt -l internal/: clean. go vet of access, gateway, provider,
  gui; GOOS=linux -tags nogui and GOOS=windows go vet ./internal/...:
  ok.
- go test -count=1 ./internal/access ./internal/provider
  ./internal/gateway ./internal/gui: access, provider, gateway ok; gui
  red only on TestMainWindowCorners/macOS_26_SDK, red on main too
  (#3949, mote's macOS 27).
- node --test group-*.test.cjs routing-group-*.test.cjs
  routing-save*.test.cjs i18n-keys.test.cjs: 433/434. The one red is
  group-found-skip "webkit de 390px: a provider left out of found
  groups" (the clicks moved the page), filed as #4617 from main; the
  file alone passes 20/20 here and on main 94f6f6092.
  group-accounts.test.cjs is 30/30 (Chromium and WebKit; en, zh,
  zh-TW, ja, de; 1100 and 420px; no scroll on the clicks, no sideways
  scroll, the save carries accounts).
- Earlier, at base 5a0c79ed9: go test -timeout 45m ./... all ok but
  TestVisionBridgePassesLines and TestSettingsSaveKeepsWhatItDoesNot-
  Send (fixed on main by 0b783b1dd and b646a9127; both pass after the
  rebase) and TestMainWindowCorners (#3949).
- The whole GUI suite was cut short twice (a wiped scratchpad, then a
  mote reboot). Its runs at load ~140-220 had about 35 reds, none in a
  file this change touches (account-mask, balance-fix, lan-*, the
  #4617 test among them); not chased here.
- Sandbox HOME on mote, the built binary (`magpie serve`, MAGPIE_ADDR
  on a free port) with a fake upstream answering with the key it got:
  group/work and Work -> sk-work (3 of 3), group/mine and relay/m ->
  sk-mine.

- Rebased again onto 8826a15ea (no file in common): go vet of gui,
  provider, gateway; go test -run 'TestGroupAccounts|TestHeldToGroup|
  TestCleanAccounts|Budget|TestGroup' of gateway, access, provider,
  gui: ok; group-accounts and i18n-keys GUI files: 34/34.

- Rebased onto ec104b862 (trace.go and gateway-routing.md in common,
  merged clean): gofmt clean; go vet of gateway for darwin, windows,
  linux nogui; go test -count=1 ./internal/gateway: ok (640s).

- Rebased onto 2b52302dc, then da275848b (no file in common): go vet ./internal/...,
  the TestGroupAccounts/TestHeldToGroup/Budget tests, group-accounts
  and i18n-keys GUI files: ok, 34/34.

Broken by hand, each red, then restored:
- serve's heldByGroup: three TestGroupAccounts* tests red (sk-mine spent).
- count_tokens' heldByGroupAt: the count_tokens route red.
- planLevel's hold: the nested "outer" group red.
- the editor save without accounts: group-accounts.test.cjs red.

Not tried: a real Codex or OpenAI account (the fake upstream stands
in); a CLI `magpie group set accounts=` (no CLI for it yet); a
provider's own fallback naming a held group has no test of its own
(planFallbackGroup passes the group as hold, the same path as nested).
2026-11-01 21:36:32 +08:00
yetone 3f2faef620 gui: the Providers page has its own Hide accounts switch
Routing's Hide accounts (账号打码) also masked the Providers page,
where nothing showed it was on or let you turn it off (Discord
#feedback, 1566189346665799752). The Providers page now has its own
switch beside its search box, placed and drawn like Routing's
(.rt-mask moved from routing.css to app.css), and each page follows
its own switch: Routing, Usage and the tray panel follow
magpie.maskEmails, Providers follows magpie.maskProviders.

The user's own choice is kept: when maskProviders was never stored,
it is seeded from maskEmails and written at once, so someone who had
masking on stays masked on both pages after the update, and someone
who turned it off stays unmasked. A switch with a stored choice is not
changed by Mask personal data's follow(); turning Mask personal data
on still masks both (hideAccounts.set(true, true), in app.js and
plugins/redact/page.js). show() asks hideAccounts.page() to re-mask
when the page in sight follows the other switch. No new strings: the
button reuses Routing's translated label and title. app.js
1,310,438, core under its budget, no raise.

Run:
- New internal/gui/tests/provider-mask.test.cjs, both engines, all
  5 languages, at 1000 and 420 wide, plus the touched window-mask,
  account-eye, privacy-hides-accounts, mask-emails,
  plugin-name-unmasked, masking-demo-unblurred: 134/134 on mote. At
  the rebased head (origin/main 573b21f4b) with gui-zh, gui-ja and
  i18n-keys: 140/141, the red is gui-ja's ja string from a7b47d57e
  (#4580), red on main.
- provider-mask on origin/main's assets: 60/60 red (no #pvMask).
- Broken by hand (chromium en), each red: cur() always Routing's
  switch ("Providers shows the account while its own switch is
  off"); the seed taken out (the upgrade on/off cases); show()'s
  page() call taken out.
- gofmt -l clean; go vet, GOOS=linux -tags nogui and GOOS=windows vet
  ok; the three builds ok; go test -tags nogui -timeout 45m ./... on
  mote at base 6712e367e: every package ok but internal/gui's
  TestSettingsSaveKeepsWhatItDoesNotSend, red on main too (#4514).
  At the rebased head: internal/gui's budget tests ok.
- Whole GUI suite on Linux (WSL magpie-desktop, concurrency 6, host at
  100% CPU), files a to l so far, the rest on mote: each red file was
  run alone at this head and at origin/main 6712e367e. Red alone at
  both, already filed: agent-panel-name-width (#4203), context-map
  webkit 420 (#3488), gateway-caller-keys (#3797), gateway-key-models
  (#4081), header-centre webkit ResizeObserver (#3479), key-replace
  webkit 420 (#4126), gui-ja (#4580). Red only under the whole run,
  green alone at this head: agent-plugin-agents (#4481), agent-prefs
  (#4552), allow-ips (#3699), api-key-theme (#3307), click-scroll,
  codex-predictions, currency (#3101), editor-advanced-align, fonts,
  gateway-key-limit, group-from-model-add, group-member-fast,
  group-member-off, group-morph, icon-url, inner-scroll-contain,
  keep-awake, lan-docker, ledger-hscroll, library-chip-fan,
  library-items, library-mcp-hub, library-mcp-tools, list-sort (the
  load class, #4400,
  #4471).

Not tried: the real desktop app's webview (Wails), and the GUI suite
on macOS beyond the files above.
2026-11-01 06:30:17 +08:00
yetone e1aec53895 routing: each session sending at once has its own context window, named by its title (tjhhhh on Discord)
tjhhhh runs several agent sessions at once. The Routing page's context
window card followed whichever request came last, so it jumped from one
session's prompt to another's. The card still tells of the request it
picked. Under it, while two or more sessions are live, a strip now
shows one small block per session (renderCtxSessions):
- keyed as the card's line of prompts is (sessionKey, else the
  conversation);
- named by the agent's title for the session (sessionName), else its
  folder's last level, never a bare id;
- holding that session's newest reading through context.js's stack bar,
  exported as window.ctxStack.

A session is live while a request of it is under way, or while its
newest request is within 15 minutes of the newest overall. At most six
blocks show, newest session first. A block keeps its place while the
sessions take turns, because blocks are ordered by each session's first
request. The block the card tells of is lit (aria-pressed), and a click
on a block picks that session's newest request. The card's footer names
the session by its title too. New words are in every locale in
plugins/routing/i18n.js. The strip reuses the card's tokens: no select,
no coloured border, no gradient.

The strip sits under the card, not over it. Over it, the strip's first
appearance moved the card, and routing-ctx-still ("the cache kept its
place") went red in both engines. It is green at base ccc791231, and
green again with the strip under.

What was run (mote, through mote-run):
- New routing-ctx-sessions.test.cjs: two engines, en/zh/zh-TW/ja/de at
  1100 and 390px, plus one session alone and one with no title. Red on
  origin/main, since there is no strip there. Broken by hand: ordering
  blocks by newest request instead of first request turns the
  "keeps its place" check red. Green, 4 of 4 tests, at the final tree.
- routing-ctx-still: red with the strip over the card, green with it
  under (tests 391/392, both engines).
- Whole GUI suite, at the first version (strip over the card), under
  load 25 to 30 from other sessions: 16892 tests, 16595 pass, 297 fail
  in 49 files. That version's own red was routing-ctx-still (fixed
  above). Every other red file has an issue:
  - Filed before: agent-panel-name-width #4203, context-map #3488,
    gui-ja #4580, i18n-keys "Unmarked" #4524, header-centre #3479,
    key-replace #4126, menu-input-scroll #3402, mobile-web #3952,
    model-chip-steady #4388, models-works-only #4391, page-width-steady
    #4541, phone-connect-menu #3524, plugin-card-update #3079,
    plugin-move-unserved #4392, provider-fetch-again #3292,
    provider-levels-scroll #4394, provider-models-rest #4396,
    provider-picks-stay #4397, provider-typed #4461, recovered-file
    #4320, remote-magpie #4398, rest-try-now #2564, routing-row-swap
    #3799, routing-steady #3412, the routing rule-drag, rule-remove,
    rules-line and upstream files #4585 and #4494, s3-sync #3413,
    searcher-pick #4274, segs-press-redraw #4189 and #4566,
    usage-agents-hide #3414, warm-now #4322.
  - Filed with this commit: editor-advanced-align #4615,
    gateway-key-models #4616, group-found-skip #4617, images-codex-one
    #4618, import-row #4619, market-have #4620, model-copy-id #4621,
    nav-timeout #4622, number-units #4623, omarchy #4624, tencent-cloud
    #4625, usage-ledger #4626, routing-order-unknown #4627,
    routing-steps-cap #4628, routing-story-shrinks #4629.
- The files this change can reach (routing-*, context-*, i18n-keys,
  gui-ja), alone at concurrency 2 on the first version against base
  ccc791231: 54 fail on the head and 34 at the base. The only red that
  was on the head and not the base was routing-ctx-still. The rest were
  routing reds under load that show on both.
- The same files rerun with the strip under the card: 2331 tests,
  35 fail. routing-ctx-sessions and routing-ctx-still are green. Each
  red has an issue: context-map webkit 420px "two tiles overlap"
  (#3488, the same at base), gui-ja (#4580), i18n-keys "Unmarked"
  (#4524), routing-many-keys (#4082), routing-row-swap (#3799),
  routing-steady (#3412), routing-order-unknown (#4627),
  routing-steps-cap (#4628), routing-story-shrinks (#4629), and
  rule-drag, rule-remove, rules-line and upstream (#4585).
- TestCoreScriptBudget went red after the rebase: the core was over by
  266 bytes, which is the new stackBar helper in context.js. The budget
  was not raised. stackBar was written tighter and the comments around
  it cut, and context.js is now 1 byte under its size at origin/main.
- Rebased on origin/main 2e9df9b1b, on mote:
  - `go test ./internal/gui`: TestCoreScriptBudget passes. Two reds are
    already filed: TestSettingsSaveKeepsWhatItDoesNotSend (#4514, red
    on main) and TestMainWindowCorners (#3949, macOS 27).
  - routing-ctx-*, context-*, i18n-keys and gui-ja: 337 tests, 8 fail.
    routing-ctx-sessions is 4/4, routing-ctx-still 2/2, and every
    context-* other than context-map is green. The reds are context-map
    "two tiles overlap" (webkit 420px in every language and chromium
    zh 420px, #3488), gui-ja (#4580) and i18n-keys "Unmarked" (#4524).
- Rebased again on origin/main e8347401f, which changes the core
  budget and fixes #4524. This is the pushed tree. TestCoreScriptBudget
  is ok, and routing-ctx-sessions, routing-ctx-still and i18n-keys pass
  44/44.

Not tried: a real gateway with several live agent sessions sending at
once (only the page's fixture feed was used), the Linux WebKitGTK app,
and the whole GUI suite at the final tree (only the files above,
which the change can reach).
2026-11-01 02:44:37 +08:00
yetone b52c39b65e routing: an account's row names the session it answers
connor_yang (Discord #help) asked that the Routing stage say which
session an account is serving next to its "answering…" / "answered this
request" status. The row now ends "· <title>", one line cut short with
the full title on hover, and only when the agent itself named that
session:

- Claude, Gemini and the other agents: sessions.Titles by agent:id, the
  same source the By session list heads use.
- Codex: its own name index (session_index.jsonl) by thread id.
- A Codex request whose parent the server inferred from prompt and
  reply fingerprints (parentMatched) shows nothing, since that parent
  is a guess. An untitled session shows nothing too.

Cost: no new server path. The titles come from the existing
/api/gateway/session-titles calls that refreshSessionNames already makes
every 15s and on focus. A session id the page hasn't seen is asked for
once (marked asked before the fetch, 300ms debounce, never two calls at
once), and the ask is skipped when a read since then already covered it
(namesDue). The per-second render only reads two maps. The title sits in
its own nowrap span, because the narrow stage (.max560/.max460) wraps
the status.

A Codex names reply silent on a session no longer clears the title
the trace brought. CodexTitles leaves unknown ids out, and returns {}
when the index can't be read, so the old loop turned a failed read into
"no title". With the earlier ask it also raced the trace: routing-sessions'
"title helpers belong to the named parent" went red 3 of 6 runs under
--test-concurrency=4 until this change, then 6 of 6 green.

Run:
- routing-session-title.test.cjs (new): engines x claude/codex x en, zh,
  zh-TW, ja, de x 1100/420px = 40 tests. Chromium 20/20 on mote.
  WebKit 20/20 on the Linux box (wsl-run, magpie-desktop). On mote even
  a bare webkit.launch() timed out at 60s under other sessions' load (21,
  67 pw_run processes), so WebKit there tested nothing.
- 16 nearby routing GUI files (answered-still, row-reuse, row-two-lines,
  stage-routes, sessions, reroute-title, tick-no-layout, live-patch,
  busy, served, js, steady, steady-garbage, session-folder, live-calm,
  request-model) in Chromium and WebKit on the Linux box, before the
  rebase onto 82b45888a. The reds that came back were compared with
  origin/main in a detached worktree:
  - routing-steady "requests coming in leave the routing groups" is red
    in both engines at main 03f609e3f (#3412).
  - routing-request-model's 5 WebKit cases are red at main 82b45888a,
    run alone (#4120 lists them).
  - routing-sessions "background memory groups" WebKit en is red at
    82b45888a, overflowing at 560px (filed #4538).
  - routing-sessions "title helpers" was mine; fixed above.
- After the rebase and the last edits, routing-session-title,
  routing-sessions, routing-session-folder and routing-rest-error
  (82b45888a's test, whose lines in client.js this change meets), three
  times per engine at --test-concurrency=4: Chromium 59/59 each time;
  WebKit 59/59 once, then 58/59 twice, the one red being #4538.

Broken by hand:
- titleOf without the parentMatched check (and the Codex name loop
  without it): the Codex cases go red, "a matched session's title is
  not shown".
- askUnnamed asking again on every pass: red, "asked 4 more times in 3s"
  (again on the final code).
- The silent-reply guard was not broken by hand on its own. What shows
  it is the title-helpers race above (3 of 6 red without it, 6 of 6
  green with it), not a deterministic test.

Not tried: a real app with a real agent's sessions, WebKitGTK in the
Linux app, and the whole GUI suite (it runs after the push).
2026-10-31 15:43:31 +08:00
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