Commit Graph
222 Commits
Author SHA1 Message Date
yetone a6e4cf7635 settings: what routing does sits under Models › Routing, and the Routing page opens it
The scattered settings audit after netube99 on X. Ask again after a
refusal, the Retry-After cap and the intent classifier's timeout were
under Models › Replies beside rows about a reply's content, and Busy
models last sat in Network and sharing, far from the routing it changes.
The four are now one Routing section under Models, after Replies, and the
Routing page's header has a Settings › button that opens Settings at that
section with its first row lit. The docs (reference.md, the site's
plugins page in en, zh and ja) name the new place.

Run (mote, mote-run):
- settings-places, retry-after-cap-setting, refusal-retries-setting,
  classify-timeout-setting, model-load, i18n-keys and bare-ids, both
  engines: all pass.
- mobile-web against origin/main fdabddeb4 (a git repo made in the copy
  from git archive, since mote-run carries no .git): 30 of 30. It now
  takes the new Settings › button out of the Routing page until main has
  it, as it does for other new rows.
- go test -run 'Budget|I18n|Strings' ./internal/gui: ok. gofmt clean.

Broken by hand:
- the three rows back in Replies and busyLoadRow left where it was:
  settings-places and retry-after-cap-setting 20 of 20 red (chromium);
- the Settings › button's click handler off: settings-places 10 of 10 red.

Not tried: the real app; the GUI suite beyond these files runs with the
rest of this audit's changes.
2026-11-09 22:42:58 +08:00
yetone 4064c10362 routing groups: on while Routing is off, their Built-in row says their page went with it
Routing groups have no page of their own: theirs is on Routing. With
Routing off and Routing groups on, Plugins › Built-in showed the groups
switch on and nothing anywhere to set them, and the quick start's
routing step still counted groups alone (netube99 on X, and the
scattered settings audit after it). The groups row now says "Their page
is on Routing, which is off" with Turn on Routing, which flips Routing's
own switch on the same list, and the quick start's step leaves with
either one off.

The hook lives in a new plugins/routing/settings.js, loaded after app.js,
whose featWho it extends (plugin client files load before app.js; the
first try in client.js threw "featWho is not defined" in every test).

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): builtin-places, mask-alert, settings-search:
162 pass, 0 fail, Chromium and WebKit, every language, 1100 and 420
wide; i18n-keys pass. Broken by hand: the hook returning at once,
builtin-places' groups case went red in all 20 runs.
2026-11-09 21:51:53 +08:00
yetone 88b541a25c images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2):
- go vet ./internal/gui ./internal/gateway ./internal/agent
  ./internal/provider ./internal/settingsapi: ok
- go test -run 'Image|Draw|Video|Hidden|Group|Settings' ./internal/gui
  ./internal/gateway ./internal/settingsapi: ok; ./internal/imagemcp,
  ./internal/library, ./internal/catalog: ok
- GUI: i18n-keys, i18n-en-no-cjk, image-models-hide,
  library-browser-setup: pass in Chromium and WebKit
- gofmt -l: nothing
Not tried: a real agent reading the new MCP instructions (text only).
2026-11-09 21:51:53 +08:00
yetone 7a2a05c7a3 routing: Accounts and keys keeps each provider's heading while it says the same
freefcw on X (11-09, v0.1.3373 and v0.1.3375): magpie at 32% CPU with
2,250 idle wakeups and its webviews at 80 to 223MB; lemonkillergame and
laincatx say the same of CPU and memory.

The Routing page draws Accounts and keys again each second while it is in
sight (countdown: its rests and resets count down). Each drawing made
every provider's heading anew, icon <img> included, and patch then kept
the old heading in the page. But an <img> asks for its picture as soon as
its src is set, in the page or not, and the app's icons go out no-cache
(revalidated), so every provider's icon was asked for again each second:
through the Wails asset server in the app (a read and a sha256 of the
file each time), and each a new SVG document in the webview (~0.6MB, #909).
Over `magpie web` on mote, a seeded HOME with five providers on Routing:
322 requests a minute, 155 of them icons every 30s; every other page asks
for 4 to 13 in 45s.

A heading is now kept per provider while its icon, name and routing mode
are the same, and a heading with its first row are a list of nodes, no
longer a box they were moved into: the move took a kept heading or keys
row out of the page each second, so patch never found it in place.

Measured on mote (M5 Pro, load 50 to 90 from other sessions), the
0.1.3377 build vs this one, `magpie web` in Playwright WebKit on
?view=routing, 60s, twice each:
- requests: 322 and 325 a minute -> 7 and 7 (icons: 31 each per 30s -> 0)
- magpie's CPU: 0.78% and 0.73% -> 0.32% and 0.32%
- magpie's RSS: 225-227MB both

Test: routing-acts-idle.test.cjs, in Chromium and WebKit, en, zh, zh-TW,
ja, de at 1100px and en at 420px: a resting key's countdown redraws the
list, and over 3.5s no icon is asked for again and each heading is the
node drawn before. 14/14 pass; with client.js before this change 0/14
(each heading is a new node). Its icon count alone passes on the old code
there, since page.route's replies are kept in the browser's memory cache;
the real server's requests are the numbers above.

Run on mote:
- every GUI file that opens Routing (181 files, both engines, at
  origin/main 9a00bfed1 + this): 3337 pass, 16 fail in 8 files. Run again
  alone, at this change and at origin/main ff7d84b9b: the same 11 fail in
  both (ctx-session-line, filed #5801; routing-context-fold #5586,
  routing-row-swap #3799, routing-story-shrinks #3954); provider-mask,
  routing-model-rest and usage-compact-counts pass alone in both.
- at the pushed head (on 74017e0b8): routing-acts-idle and routing-acts-calm
  36/36; at 193d171b6: routing-acts-idle, routing-acts-calm,
  routing-acts-compact pass; i18n-keys' "a plugin's words are its own" is
  red, the same at origin/main 0eac4e6aa (#5332, #5426, #5482).
- go test -tags nogui -run 'Budget|Size|Routing|Asset' ./internal/gui: ok.

Not run: the whole GUI suite (only the 181 Routing files) and the full Go
suite (no Go file changes). Not reproduced: freefcw's 32%; the heaviest
seeded HOME here idled at 0.3 to 1.7% and the live heavy-user instance on
the owner's Mac at 0.9%. In the real app on mote the Routing window idled
at 0.3% with no ticking (its window not in sight on a headless session),
so the app's own numbers before and after are not measured, only
`magpie web`'s.
2026-11-09 19:12:45 +08:00
yetone 2b8ad61468 routing: a group's header counts its members on, not who one request was held to
adorable_piglet on Discord: the group magpie found for GPT-6 Astra, In
order, three of its five members on (two on providers switched off),
read "GPT-6 Astra · routing group · 1 on" over a Codex request answered
by one member. The header counted the request's order, who that one
request was weighed among. A conversation held to one member (native
compaction, Strict, a sealed task, a key's models) has an order of one,
so the group read as having one on. It now counts the route's
group.members (GroupRef: the group's ready members as the request
came); why the request went to one alone stays the first line's to say.
Routing itself was not at fault: a gateway repro with five members, two
providers off, routed In order over all three on.

Run on origin/main 40cfae5d3 with this change (rebased onto 4da0aa027,
client.js untouched between):
- routing-group-on-count.test.cjs (new; chromium and webkit; en zh
  zh-TW ja de) on mote: 10/10. With the client.js change taken out by
  hand: 10/10 red, " · 路由组 · 启用 1 个", the reporter's text.
- No Go change: gofmt and go vet have nothing new.
Not run before this push: the 182 routing-*, panel-routing* and
i18n-keys GUI files (running on mote now, reds to be filed).

Reported-by: adorable_piglet (Discord)
2026-11-09 18:40:10 +08:00
yetone f5f68b4335 routing: with routing groups switched off, their sidebar tab goes
yyddbds (Discord) turned Routing groups off in Plugins > Built-in and
the sidebar still showed its tab. The tab was tagged with the routing
plugin only (data-feature="routing"), so only switching Routing off hid
it. It is now tagged "routing groups", like Routing's own "Routing
groups >" button and the two "Make a routing group" buttons.

The page also holds each provider's accounts and keys (pools), which
stay editable with groups off. So with groups off:
- ?view=groups, or a page open when groups are switched off, opens
  Routing (offView in app.js), not Agents;
- the groups' section moves under Routing's requests, with the "turn on
  routing groups" note and the pools; turning them on opens the groups
  page again and moves the section back.
Every other sidebar tab (sessions, library, routing, gateway, usage,
masking) was already tagged with its own plugin; only groups was wrong.

Run, on mote (macOS 27):
- routing-groups-off.test.cjs (rewritten: 1200, 900 and 420px, both
  engines, every language): 12 of 18 red on the old code, 18 of 18
  green on this one.
- routing-groups-off, builtins, sidebar at the rebased head 3930a3917:
  green in Chromium and WebKit.
- Whole GUI suite at the old base c9d253e4a: 22,447 of 22,724 pass, 277
  red in 46 files. Those 46 files rerun at the rebased head (on
  bceeabd93): 258 red, every one in an open issue filed before this
  change (#5475 umbrella; #5392 routing-intent-entry, #5332 i18n-keys,
  #5232 provider-fetch-again, #3952 mobile-web, #4541 page-width-steady,
  #4720/#4721 vertex-editor, #5262 zero-priced-free, #4388
  model-chip-steady, #4644 account-weight, #3799 routing-row-swap,
  #3954 routing-story-shrinks, #5586 routing-context-fold, #3479
  header-centre, #4787/#5425 nav-timeout, #5215 tray-cell-click, #3415
  usage-fold, #2448 s3-sync, #4624 omarchy, #5048 usage-ledger, #4320
  recovered-file). None is in a test of the nav or the groups page.
- go vet ./..., GOOS=linux/windows go vet ./internal/gui and gofmt -l
  at the old base: clean (no Go file changes).
- TestCoreScriptBudget, worked out by hand at the pushed head (on
  b8270850d): the core's scripts are 1,533,791 of 1,533,802. The 526
  bytes this adds to app.js would be 351 over, so the comments it adds
  are cut to one line. No raise. node --check app.js passes.

Not tried: the real app; the GUI files rerun after the last rebase
(b8270850d; the only change since is comments in app.js); the panel's new-group path with groups off;
the same 46 files on a clean bceeabd93 (queued behind the suite lock
for over an hour; the reds above all predate this change).

Reported-by: yyddbds (Discord)
2026-11-09 18:11:53 +08:00
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 82ca554be9 routing: a provider's accounts routed In order give a conversation back to the first
CryptoSarom on X: with a provider's accounts set to In order, a
conversation that had moved to the second account (the first was
resting) stayed on the second once the first was ready again. Only a
group's members went back to the first; a provider's own accounts never
did, because inOrder was read from the group's routing alone.

- gateway.go: inOrder comes from the provider's routing, or the group's
  when the request is to a group.
- affinity.go: backToFirst compares accounts (who()) for a provider's
  own accounts. For a provider it overrides only a cache that would have
  kept the conversation (cacheHolds: worth keeping and still warm), so a
  cold or empty cache keeps its own "cold"/"new" label.
- plugin_factory_cap_test.go: "auto, cached on B" pinned the old
  stay-on-B behaviour; it now expects A, the first account, on purpose.
- GUI: the Routing affinity line for "order" without a group says the
  provider goes in order and the first is ready again (all languages).
- docs/subsystems/gateway-routing.md: the In order bullet covers a
  provider's own accounts.

Run on mote at this tree on aa3d11d5b; rebased onto c6702f462, which changes only context.css and its own GUI test: gofmt -l clean,
GOOS=linux and GOOS=windows go vet ./internal/gateway ok, go test
./internal/gateway -count=1 -timeout 45m ok (985s).
GUI: routing-affinity-order (new accounts case) and i18n ok in both
engines. i18n-keys "a plugin's words are its own" is red from three
strings not in this change, filed as #5332, #5426, #5482.

Broken by hand: inOrder := false turns
TestOrderedAccountsGiveTheConversationToTheFirst red (k1 k1 k1 k1, why
"cache"). Without cacheHolds TestForeignSealedItemsAfterAColdSwitch went
red (why "order" for a cold switch).

Not tried: a real account pair in the live app.
2026-11-09 05:42:44 +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 eadc6cdb96 routing: a request with a named gateway key is drawn as that key
acezan (Discord) sent the Routing flow for an Antigravity group: a
script's requests showed only "Python-urllib", the caller's
User-Agent, on the left node. The request should be named by the
gateway key it came with.

The trace and history routes already carry callerKey (the key's id)
and callerKeyName, never the secret. The stage now groups callers by
agent plus key, so two keys behind one User-Agent are two nodes, each
in its own colour. A keyed node reads the key's name as Gateway keys
lists it now, else the name the route kept. A request with no key
keeps the agent's name, as before. The agent's icon stays, and the
tooltip names the key and then the agent. No new labels.

Siblings:
- The request rows' swatch, wire hue, the play dots and the replay
  marks follow the same caller, and "Sent by" names the key.
- The tray panel's stage and its .pr-who rows name the key the same
  way. The panel doesn't read /api/caller-keys, so it shows the name
  the route kept; a key renamed later shows its old name there until
  the next request.
- Usage already shows "agent · key name" on ledger rows and has its
  own key split. Unchanged.
- The By-key and By-session group heads and the story prose ("X asked
  for...") are unchanged.

Run on mote at 1aabc66fd + this commit:
- New internal/gui/tests/routing-caller-key-node.test.cjs: 11/11 in
  chromium and 11/11 in webkit. It covers en, zh, zh-TW, ja and de at
  1100 and 420, plus the tray panel.
- With routing-by-key, agents-apart, agent-hue-not-red, fifth-agent
  and panel-routing: 46/46 in each engine.
- go test: TestKeptRoutesNameTheirCallerKey (new), TestCoreScriptBudget
  and TestTraceNamesCallerKey ok. gofmt -l is clean. go vet passes on
  internal/gui and internal/gateway for darwin, linux (-tags nogui) and
  windows.
- Every routing-*, panel-routing* and click-scroll file at the previous
  base 15918265e + this change, under load (60 to 100):
  - chromium: 1546/1554.
  - webkit: 1542/1554.
  The reds are in routing-intent-entry (#5392), routing-row-swap
  (#3799), routing-context-fold (#5586) and routing-story-shrinks
  (#3954). They are red the same way when run alone at origin/main
  15918265e, without this change. ctx-sessions and many-keys went red
  only in the parallel run and passed alone.

Broken by hand:
- With client.js from origin/main, the new GUI test is 0/11 red.
- TestKeptRoutesNameTheirCallerKey passes on the old code too, because
  the Go side already carried both fields. It guards history keeping
  them: with callerKeyName's JSON tag set to "-", it goes red.

Not tried: a real request with a named key through a live gateway. The
fixtures are faked trace routes. Full suite: not run at push.

Reported-by: acezan (Discord)
2026-11-08 15:54:52 +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 00198b26e0 gateway: a session's side call goes on the account its main conversation is on (#5655)
With two Claude accounts, Claude Desktop's own Sonnet calls beside an
Opus chat (desktop-beside), and Claude Code's auto mode classifier, ran
on account B while the chat was on A. Each model's conversation is kept
under its own scope (p.ID/model), so the side call was routed as a
session of its own: leastHeld, or Smart's order once its cache was cold,
put it on the account the fewest others held, and B's 5 hours drained on
calls the user never made there.

Decided (product call delegated): one session goes on one account. The
user picked one, the vendor sees one client, and the cost is one cache
write of the side call where the session goes on reading it.

withSession (affinity.go) puts first, for a request whose session a
header names, the key or account of that session's largest conversation
under another model's scope (answered within heldFor, at least
cacheWorth kept, larger than this one's own). It acts for Why first,
gone, cold, no-cache, cache and session; never mid-turn, under Strict,
for a subagent (withLead), past a rest, reserve, credits or a fallback
routing put first, nor to an account that isn't readyForNew. The trace
says Why "lead" with LeadModel, and the Routing page says "Put on
{first}, where this session's {model} is: one session goes on one
account." in en, zh, zh-TW, ja and de. docs/subsystems/gateway-routing.md
says the same.

Not fixed here: the classifier's ~110-130K cache write per call. That one
is ours too: in Claude Code's interactive mode the bridge pastes the
classifier's transcript as one block without the client's marks
(claudetui userPieces, clientCache.pasted), so only the fixed prefix
(Claude Code's system plus the appended rules, the 68,925) is read and
the rest is written again on every call. The cause and a candidate fix
are on #5585. It changes what a real Claude Code sends and can't be
checked without a real account.

Run (mote, through mote-run), at this head (aeeeed54a's tree, origin/main
0fc3455e2 unchanged after a fresh fetch):
- go test ./internal/gateway ./internal/gui -count=1 -timeout 45m: ok (964s, 157s).
- TestSessionSide*, TestGroupAccountsHoldEveryRoute,
  TestPluginFactoryStandardOnlyCaps, TestWholeSession*, TestBusyModel*,
  TestInOrderKeeps* -count=2: ok.
- gofmt -l: clean. go vet ./internal/gateway for darwin, linux, windows: ok.
- node --test routing-affinity-lead (new), routing-affinity-order,
  routing-affinity-cache-write, i18n-keys, i18n-en-no-cjk: 67/68
  (Chromium + WebKit, 1100 and 420, en/zh/zh-TW/ja/de). The one red is
  i18n-keys "a plugin's words are its own", red on main for strings this
  change doesn't touch (#5327/#5332, #5426, #5482).
- The first package run of this change failed TestGroupAccountsHoldEveryRoute
  and TestPluginFactoryStandardOnlyCaps/auto (both green at 0fc3455e2):
  without a session header the id is the opening's hash, so two
  conversations that opened with "hi" were one session, and a main with
  nothing cached led. Both are excluded now, each with a subtest.
- The full go test ./... under the suite lock was queued behind four
  other sessions' suites and had not started when this was pushed.

Broken by hand, each red: the withSession call removed (both new tests;
"the session's m2 call went to k2 while its chat is on k1"); the named
session check removed (no session named); the cacheWorth bar removed
(main holds no cache, and TestPluginFactoryStandardOnlyCaps).

Not tried: real Claude accounts, real Claude Desktop. A session already
split before this release moves its side call at the side call's next
turn, writing its cache once on the main's account.

Reported-by: jerrychoi
Reported-by: iamnil (Discord)
2026-11-08 10:40:22 +08:00
yetone 2b08ccc838 routing: the story says why by the keys Smart sorted by (#5646)
The Routing page explained Smart's order from each window's raw reset
(Weighed.Renews), while the gateway sorts by Allowance.Renewal (a credit
pack's end when it runs out before the reset) and breaks hour ties by
Allowance.Lapse. So a WorkBuddy account whose pack ends in 3 days was said
to "renew within the same hour, so the order given stays". The trace now
carries both keys (Weighed.Soon, Weighed.Lapse); renewsBy, cmpRenews,
firstWhy and behindWhy compare them, with two new story lines (credits
expire before the other renews; same hour but its credits expire sooner)
and a row note, in en, zh, zh-TW, ja and de. "Kept in order" is said only
when every key ties. A route from before soon falls back to renews and
restarts. The other keys Smart reads (tier, unreached, learns, balance,
use first) were already in the trace.

Two accounts with one name: logoed() gave only the first its icon. Each
later occurrence of the name now gets the next same-named member's own
icon, so "louis and louis" shows WorkBuddy's and Zhipu's.

Run (mote, via mote-run):
- go test ./internal/gateway -count=1 -timeout 45m: ok (1010s), before the
  rebase onto 0b4cda048 (no gateway trace/routing change between).
- go test ./internal/gui: ok. gofmt -l: clean. GOOS=windows go vet ./...
  and GOOS=linux go vet -tags nogui ./...: ok.
- After the rebase: TestTraceCarriesSmartSortKeys, TestSmartSpends*, and
  node --test of routing-story-credits-expire (62/62, Chromium + WebKit,
  en/zh/zh-TW/ja/de, 1100 and 420), routing-behind-why and every GUI file
  that was red in the full run below.
- Full routing-*.test.cjs + i18n-*.test.cjs at concurrency 4 before the
  rebase: 2955/2978. Rerun at concurrency 1 after it, 18 stay red, and the
  same 18 are red on a plain origin/main b77400826 copy on mote: i18n-keys
  (#5332, #5426), routing-intent-entry (#5392), routing-row-swap (#3799),
  routing-story-shrinks WebKit (#3954), routing-context-fold WebKit (#5586).
  routing-many-keys, routing-order-unknown and routing-steps-cap passed in
  the rerun.

Broken by hand, each red: no Soon in weighed() (Go), no Lapse (Go),
renewsBy ignoring soon (GUI pack case), no lapse tie-break in cmpRenews
(GUI shows the reporter's "保持原顺序"), logoed with one icon only.

Not tried: a real WorkBuddy account's trace; the real Linux app. Two
same-named members of one provider still show the same icon.

Fixes #5646
Reported-by: louisgreen0726
2026-11-08 04:06:22 +08:00
yetone ee8f4de36c routing: the story's ResizeObserver waits a frame, so a wrapping Smart header isn't a loop in WebKit (#5639)
3b541a7f3's longer Smart explanation wraps to more lines at 420px. The story's
ResizeObserver called holdStory, which sets the story's min-height, inside its
own callback, and WebKit reported "ResizeObserver loop completed with
undelivered notifications" as a pageerror. routing-order-unknown went red in
webkit en and ja at 420px. The callback now does its work on the next
animation frame, the same fix #3164 made for the other observers in this file.

Run on mote:
- routing-order-unknown, both engines: 10/10 green, de included. Before this
  change, webkit en and ja at 420px were red.
- GUI rerun of routing-*, panel-routing* and gui-ja/de/zh-TW in both engines:
  2927 pass, 20 fail. Every red is filed and fails the same at 3b541a7f3~1, or
  passes alone at both heads:
  - routing-context-fold webkit (#5586, a different observer);
  - routing-intent-entry (#5392);
  - row-swap (#3799);
  - story-shrinks (#3954/#4629);
  - routing-credits zh-TW, under load (#5161, commented);
  - routing-pulse-composited webkit light, under load (#5647, new).
- internal/gui Go package: ok.

Not changed: routing-context-fold's own observer (#5586).

Refs #5639
2026-11-08 03:12:27 +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 3b541a7f36 routing: Smart ranks an account by its week once its month can't be used up before it renews (#5639)
Smart ranked a Volcengine Agent Plan (5 hours 2,000, week 7,000, month
20,000) by its month, the biggest window, so it always stood behind
accounts renewing weekly, and its month could reach a point where it
could no longer be used up before it renewed.

The rule keeps #1778's reasoning: a month holding less than its weeks add
up to is the real cap while the weeks can still carry it. Once what the
biggest window has left is more than the next window (a day or longer,
same unit, counts known) can let through between its own reset and the
biggest one's (Of x time between / Span), what the week leaves at its
reset is lost, and the week ranks the account.

- provider: Allowance.Unreached counts the biggest windows to pass over.
  Renewal and Seat.Soon are unchanged for other strategies and plugins.
- routes: Seat.Unreached; Smart compares Soon past it.
- gateway: weighRouted fills it; the trace's Weighed carries `unreached`.
- GUI Routing: renewsBy skips those windows, and a new story line says the
  shorter window decides. The Smart header and the group hint say so in
  en, zh, zh-TW, ja and de.
- docs: reference.md (How magpie picks an account) and
  subsystems/gateway-routing.md.

With the issue's numbers as reported (month 696 h away, 18,372 left),
four weeks carry 28,017, so the order is unchanged. Two weeks before the
month renews, 14,017 < 18,372, and the plan goes first, ahead of the
point where a week's leftover is lost.

Run on mote at this tree (base 2dac9b84e; origin/main bb33142ea touches
none of these files):
- go test -tags nogui ./internal/provider ./internal/routes: ok
- go test of TestMonthOutOfReachRanksByWeek,
  TestSmartSpendsAWeekTheMonthCantWait, TestSmartPassesAnUnreachedWindow
  and the Smart/Renewal/Weighed tests in provider, routes, gateway: ok
- GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: ok
- gofmt -l internal/: clean
- node --test routing-key-windows.test.cjs: 52/52 in Chromium and WebKit,
  en/zh/ja/de, the new #5639 scene included

Broken by hand:
- Unreached returning 0: TestMonthOutOfReachRanksByWeek ("two weeks to
  go", "the last week") and TestSmartSpendsAWeekTheMonthCantWait went red.
- Smart comparing a.Soon, b.Soon whole: TestSmartPassesAnUnreachedWindow
  and TestSmartSpendsAWeekTheMonthCantWait went red.
- client.js without the slice and the story line: the #5639 GUI case went
  red (Chromium en).

Still running when pushed (the owner's rule not to hold a verified commit
behind the suite): the full internal/gateway package; all routing-*,
panel-routing*, gui-zh-tw/ja/de and i18n GUI files in both engines; and
the full go test ./... -timeout 45m. Any red they show gets its own issue.

Not tried: a real Volcengine Agent Plan account. Ark replies that send
only Percent carry no counts, so the rule can't apply to them. Not
changed: Use before expiry (Pace) still ranks this plan by its month;
filed as #5641.

Reported-by: louisgreen0726
Refs #5639
2026-11-08 02:08:08 +08:00
yetoneandggbdpq 2dac9b84eb routing: a session's context line is its conversation's, not whatever asked under it
The Routing page's context window card drew every request the session id
went under into one "This session" line — the lead's turns, a subagent's
(298K against a lead holding at 96K–108K), and the agent's tool-less side
calls (a classifier, a title) — so the line rose and fell as though the
conversation kept compacting (WK-Apollo, #5561). The Usage page's Context
tab draws the same session by its turns alone (contextOfRecs, e98440ae):
the card's line draws by that attribution now — a subagent on a line of
its own, by its sub, and a side call reading its session's line without a
point of its own. The live strip of sessions read its numbers off
whatever asked last, so a subagent's 298K read as the session's; it reads
the session's own newest turn now. ctx-session-line draws the reporter's
interleaved session and the strip; it fails on the old code (8 points on
the lead's line, the strip at 298K).

Review edits: a prompt part of kind "tools" counts only with tokens > 0
(withTools, both places), so an empty tools part doesn't make a side
call read as a turn; ctx-session-line runs in Chromium and WebKit and
waits for the picked card's own Context used figure instead of 300ms,
clicking again when a click lands while the list redraws (one Chromium
timeout in that pick in 6 loaded runs before it; a card that never gets
there names what it shows).

Review run at this tree on origin/main ef81b7ad1 (mote-run, Playwright
1.62.0):
- ctx-session-line.test.cjs: 4 of 4 ok (chromium, webkit)
- routing-*, ctx-*, context-* (concurrency 4): 3419 pass, 29 fail;
  base ef81b7ad1 3423 pass, 21 fail. Every file with a new red
  (routing-ctx-sessions #4711, context-tune #5635, routing-rule-drag
  #3789, routing-wb-restricted #1905's class) run alone, patched:
  412 pass, 0 fail; base alone: rule-drag webkit en/zh/de and
  wb-restricted webkit de 1100 red. The rest are the base's (#5392,
  #4627, #3799, #4628, #3954/#4629, #5586); #5623 green this time.
- go test ./internal/gui/: ok but TestPanelHiddenByWailsMarksPageOutOfSight,
  red 1 of 3 alone at base too (#5322).
After rebasing on 83d9ee892/ea1a8ae80 (routing client.js changed), with
the pick retry: ctx-session-line alone 3 of 3 ok; ctx-session-line,
routing-ctx-*, ctx-*, context-* at concurrency 4, three runs: the new
file green in all; 690/0, 688/2, 688/2, the 2 being routing-ctx-sessions
chromium (#4711).
Broken by hand: main's client.js under the new test: 4 of 4 red, the
lead's line holding 8 points (96K, 298K, 96K, 7.2K, ...).
Not tried: the real app with WK-Apollo's session.

Reported-by: WK-Apollo
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-08 01:16:03 +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
yetone ea1a8ae809 routing: a folded fold of accounts on one plan says what they have left together
chen2652 (Discord #help): a provider with several accounts on one plan
should show, when its group is folded, one bar and what is left in all;
opened, each account's own quota as now.

A Routing account fold (3+ adjacent accounts of one provider and model),
when folded, now writes its tightest shared window before its status
("5 hours 40% used · …") and a bar under it, from quotaall.js's
mergeQuotas over the accounts' Usage cards. Its tip lists every window,
how they were put together (the mean of n accounts on one plan, added up,
or unlimited on each) and when the first of them starts again. Only when
every account has a card, all on one plan, none free; with different
plans, a card missing, the fold open, or the day view, nothing changes.
An open fold shows only each account's own row, as before. No new words:
every string is already in i18n.js in every language. routing.css is
unchanged (the account rows' bar grid). foldQuota in plugins/routing/
client.js; documented in docs/subsystems/gui-shell.md.

Run:
- routing-fold-accounts-together.test.cjs (new): 5 languages x 1100/420px
  x Chromium/WebKit, 22/22 on mote. Folded: figure, 40% fill, tip in each
  language, no email in the figure; mixed plans: no bar; open: no bar;
  nothing overflows.
- At this tree (rebased on origin/main 999ba6a00), on mote: the new test,
  routing-fold-all, routing-folder and i18n-keys: 66 tests, 65 pass. The
  one red is i18n-keys "a plugin's words are its own" (plugins/library and
  plugins/routing "No session ID"), filed as #5327/#5332/#5426/#5482, not
  a string of this change.
- Earlier, on WSL at d7b298dec vs base 56f095604: every routing GUI file
  plus i18n-keys, provider-at-once and quota-all, 2942 tests; the same
  WebKit/load reds at the base (36 there, 38 here). The one head-only red,
  provider-at-once "webkit en: accounts at once are typed and saved" (a
  Providers editor timeout), passed 60/60 with the new test on a rerun.
- Screenshots of every language at both widths (WebKit) looked at.

Broken by hand, each red in the new test:
- the old client.js;
- combining while the fold is open (no !f.open): "an open fold has no
  bar of its own";
- no one-plan check: the mixed-plan fold drew a bar.

Not tried: the whole GUI suite and the Go suite before the tag (run after
it); the real app with the reporter's real accounts on one plan.

Reported-by: chen2652
2026-11-07 22:03:32 +08:00
yetone 3441035a2e routing: a group's member maps the reasoning level asked to the one sent
A Routing group that relays one long task across vendors sent every
member the same effort word, but one vendor's high is another's xhigh
(LuckymanJC on Discord). A member that follows the group may now carry
a map from the level asked to the level sent: Group.EffortMaps, json
effortMaps, keyed by the member's id as Members spells it.

- Default: no map, or a level the map doesn't name, goes as asked, so
  every group saved before is unchanged and nothing of the user's is
  overridden. A member fixed at an effort (or with several levels) and
  a rule's UseEffort still win over the map.
- SaveGroup keeps a map only for a plain member of the group (not
  :effort, not :a+b, not group/), drops pairs that send what was
  asked, lowercases, and refuses a word that isn't a reasoning level.
- Carried by member rename (groupfast RenameMember and the all-groups
  rename), provider rename, fold (and its fingerprint), share/import
  and CanonicalRef; on a collision the map already spelled so wins.
- Gateway: the level asked is the suffix's/agent pick, then the turn's
  pick, then the request's own (askedLevel: agentEffort, plus none for
  an Anthropic request with thinking disabled); the target is sent with
  withFixedEffort, fitted to the model's catalog levels unless none, and
  the trace's try records mappedFrom. Per candidate, so fallback and
  retries send each member its own; count_tokens sends no member effort.
- The group lists a mapped member's own levels plus the map's keys to
  agents (mappedLevels in buildGroupEntries).
- GUI: the member's reasoning menu has "Map levels…" (app menus only):
  a level asked, then As asked or one of the model's levels. The chip
  reads "Mapped reasoning", its title the pairs. Follow the group or a
  fixed level drops the map. zh, zh-TW, ja and de.
- docs/subsystems/gateway-routing.md says all of it.

Run (mote, at this tree):
- gofmt -l: clean. go vet (provider, gateway, gui), GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test ./internal/provider/: ok. go test -run
  'Effort|Level|Group|Fallback|Rule|Auto|Fixed' ./internal/gateway/: ok.
- node --test group-member-effort-map (30: chromium + webkit, en zh
  zh-TW ja de, 1100 and 420px) and group-member-levels: pass;
  i18n-en-no-cjk: pass. i18n-keys' "a plugin's words are its own" is
  red only for the three words it is red for on origin/main 922cc0ccf
  (#5332, #5426, #5482); this change's words are its own (two that Go
  source said too were reworded).
- go test -run 'Group|Budget|I18n' ./internal/gui/: ok.

Broken by hand, each red, then restored:
- gateway mappedLevel(nil, in): every TestMemberEffortMap* red.
- mappedLevels left out of buildGroupEntries: both levels tests red.
- group_share's rename left out: the import case red.
- RenameMember's rename left out: its case red.
- SaveGroup's cleanEffortMaps call left out: TestSaveGroupEffortMaps red.
- the editor save without effortMaps: 30 of 30 GUI red; moveTo's map
  cleanup left out: 10 of 30 red.

Not tried: a real cross-vendor relay with real accounts (the mapping is
checked on the request bodies the gateway sends to fake upstreams). The
CLI and TUI keep the map but have no editor for it. The full Go suite
and whole GUI suite run after the push, per the loop rules.

Reported-by: LuckymanJC (Discord)
2026-11-07 20:19:50 +08:00
yetone c39d366447 cline: the Upstream tick never writes providerOptions, which Cline refuses with 403 (#5442)
Since 2026-11-06 the Cline API answers any request carrying a
client-supplied providerOptions with 403 `client-supplied
"providerOptions" model routing is not supported`. HK-bruc1 showed it
with the same key: 403 with the field, 200 without. magpie's Upstream
tick ("DeepSeek and GLM models only from their makers' own APIs")
wrote providerOptions.gateway.only (and has) into every ClinePass
DeepSeek and GLM request, usage-billed deepseek/… and zai/glm-… too,
so with the tick on every one of them failed.

This overrides a value the user set. It is done because the value
breaks every request it touches: the models Cline sends through
Vercel's AI Gateway can only be pinned with providerOptions, and that
field is refused on each request. The saved pinUpstream is left as
set, so if Cline takes the field again the pin can come back without
asking anyone to tick it again.

Changed:
- provider.ClinePin pins only the OpenRouter entry (glm-5.3-flash,
  provider.only ["z-ai"], which Cline still accepts); DeepSeek and the
  other GLM models get "". The Cline plugin's DeepSeek skip and
  ClinePassHas/clinePassDeepSeek are gone.
- gateway clinePin writes only top-level provider.only, never
  providerOptions. A body's own provider/providerOptions goes as sent.
- provider.ClinePassAsked is what magpie actually wrote (ClinePin). It
  no longer claims "deepseek" for the Cline plugin's DeepSeek models:
  opencode-cline-auth 0.1.13 pins nothing by default, and a pin it
  writes is refused, so no reply is served on it.
- GUI: the Upstream note says Cline refuses the pin since 11-06 and
  only glm-5.3-flash still asks Z.ai (en, zh, zh-TW, ja, de). The
  Routing page's "tick … to ask for the maker's own API" is gone.

Run on mote at this tree on origin/main a1774d123, HOME=$(mktemp -d):
- go test ./internal/provider -run Cline, ./internal/gateway -run
  Cline: ok. go test ./internal/gui -run 'Budget|I18n|Script': ok.
- GOOS=linux go vet provider, gateway, testenv; GOOS=windows go vet
  those and internal/gui: ok. gofmt -l: nothing.
- GUI, Chromium and WebKit, node --test (concurrency 6): every
  Cline file (clinepass-pin, routing-cline-route and 15 more naming
  Cline), all routing-* files, i18n-keys, i18n-en-no-cjk, gui-zh-tw,
  gui-ja, gui-de: 2878 tests, 20 red in 7 routing-* files. Run alone
  and serially, routing-idle-frame passed; the other 6 files had the
  same 19 reds on a fresh origin/main 325dc3ab3 copy (#5475, #5586).
- Broken by hand: origin/main's cline.go and cline_pin.go with the new
  tests, red: TestClinePassAsked, TestClinePassTryKeepsWhatWasAsked,
  TestClineTickSendsNoProviderOptions,
  TestClinePluginTickSendsNoProviderOptions.
- Rebased on 325dc3ab3, again on mote: go test provider and gateway
  -run Cline, gui -run 'Budget|I18n|Script': ok; clinepass-pin and
  routing-cline-route: ok; i18n-keys "a plugin's words are its own"
  red for three words none of this touches, red the same on a
  325dc3ab3 copy (#5332, #5426, #5482).

Not tried: a live Cline request (no Cline account here), glm-5.3-flash
actually served by Z.ai (the #819 author's checks say Cline ignores
provider.only there), GOOS=linux vet of internal/gui on mote (Wails
needs cgo).

Reported-by: kvjxhjwentnwm
2026-11-07 15:27:29 +08:00
yetone 8e350155b6 routing: a provider set to Use first goes ahead of the others Smart weighs it with
hzh_1119 on Discord: ChatGPT Pro and Business now come with monthly API
credit, and they want an OpenAI API key spent before the ChatGPT
subscription where both serve a model, the subscription taking over
after. Smart had no way to say so: an API key tells no allowance, so it
went after every account with room, in every model's found group
(auto/<model>). The only way round was a group set to In order with its
members dragged, one group at a time, which nothing pointed to.

A provider row's right-click has Use first (provider/usefirst,
provider.SetUseFirst, Provider.UseFirst, copied onto its accounts by
accountSettings, kept by the editor's Save). Its keys and accounts are
routes.Seat.Lead, and Smart (leadFirst) puts those not all but used up
ahead of every other seat, each side in Smart's own order. A resting one
is passed over as before, so a 429 insufficient_quota (out of credit) or
a failure moves the request on to the subscription. Off by default;
within one provider nothing changes. The Routing page says why the first
went first (Weighed.UseFirst, firstWhy) and doesn't call the one behind
it "renewing later" (behindWhy). The menu shows a tick when it is on.
Free quota by expiry orders its paid seats with Smart and so follows it;
other strategies don't read it. The core's script budget is met by
cutting three Providers-page comments in app.js, no raise.

Run (on mote via mote-run, at da548b454 = origin/main):
- go test ./internal/routes ./internal/provider: ok. ./internal/gui: ok
  but TestMainWindowCorners/macOS_26_SDK, red the same on a fresh
  origin/main da548b454 checkout (#3949, macOS 27).
- go test -run 'TestUseFirstLeadsTheGroup|TestRoutingGroups'
  ./internal/gateway: ok.
- node --test use-first.test.cjs (new: 40 cases, Chromium and WebKit,
  1100 and 420 wide, en zh zh-TW ja de) and provider-find.test.cjs
  (its menu now lists Use first): 52 pass.
- i18n-keys, i18n-en-no-cjk, routing-behind-why: pass but i18n-keys'
  "a plugin's words are its own", red the same on origin/main
  (#5327, #5426, #5482; none of its keys are this change's).
- GOOS=linux and GOOS=windows go vet -tags nogui ./...: ok. gofmt -l: none.

Broken by hand:
- Lead left out of weighRouted's seat: TestUseFirstLeadsTheGroup red
  (served from ksub with api set to Use first).
- Smart without leadFirst: TestSmartLeadFirst red
  ([plus pro api ...], want api first).
- firstWhy's Use first case off: use-first.test.cjs's Routing cases red
  in every language.

Not tried: a real ChatGPT account beside a real OpenAI key with API
credit; the 429 insufficient_quota fallthrough is from the fake
vendor's body (carriedQuotaBody). The full suite runs after the push.

Reported-by: hzh_1119
2026-11-07 07:15:40 +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 a10ad0ec8e routing: a Codex memory call put on its conversation's model says why (#5413)
The Routing page read every Codex memory move as codex-turn: "asked for
{model} ..., which magpie doesn't serve". The #4765 branch of
codexMemoryStandIn moves a bare Codex default that magpie does serve
(a provider has a model by the same name) when Codex's config names no
memory model, so that sentence was wrong for it. That branch now
records codex-follow, said as "{agent} asked for {model}, one of its
own default models, for its memories, and its config names no model
for them; magpie served it on {to}, the model of its conversation.",
in en, zh, zh-TW, ja and de. Models magpie doesn't serve stay
codex-turn.

Run (mote): go test ./internal/gateway -run
'TestCodexMemory|TestCodexSide|TestCodexMemories|TestCodex.*Follow'
-count=1: ok. node --test routing-moved-why (chromium + webkit, every
language, 1100 and 420px), i18n-keys, i18n-en-no-cjk: 27 of 28; the red
is i18n-keys "a plugin's words are its own", red the same at
origin/main 73324357e (#5327, #5426, and #5482 filed for its library
entry).
Broken by hand: not separately; TestCodexMemoryOnACollidingBareName-
FollowsTheSession now checks the move's why.
Not tried: the real app's Routing page.

Reported-by: MariaMatrix (GitHub)
2026-11-06 15:17:30 +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 83545a5d8f routing: two providers' keys of one name each say their provider on the stage (iamleehom on Discord)
iamleehom's chain had two providers each with keys named Key-01 and
Key-02, all serving gpt-6-astra: four rows of the same icon, key name and
model chip, so which provider a row was of couldn't be told. A key or
account whose name another provider's row on the stage has too now says
its provider after the name, in the muted words a fallback row already
uses for its provider (an account's plan after it, when it has one). A
name only one provider has says nothing more, so a chain without twins
looks as before: no label is added to every row.

Run (mote, via mote-run, Playwright chromium + webkit):
- routing-twin-keys.test.cjs (new): Relay A's and Relay B's Key-01 and
  Key-02 plus Solo's Key-09; the four twins say Relay A / Relay B, Key-09
  says nothing, no two rows read alike, nothing runs off the page; en,
  zh, zh-TW, ja, de at 1100px and 440px: 22/22 pass.
- with routing-keys-fold, routing-group-fold, routing-account-name,
  routing-free-seat, routing-agents-apart, routing-account-identity and
  routing-held-member, both engines: 164/164 pass. A first try kept the
  provider's span on the row as `sub`, which wiresTo reads as a folded
  group's heading; agents-apart (20) and keys-fold (8) went red with
  "reading 'split'", and the field is now `subEl`.
Broken by hand: client.js put back to its parent; the new test is 22/22
red (the rows say "" where the provider goes).
Not tried: the reporter's own chain (only the screenshot), the real
app's WKWebView, Windows and Linux.

Reported-by: iamleehom
2026-11-06 11:23:46 +08:00
yetone 6f0aeec180 routing: a request that tells no measured speed shows the least it wrote at, as Usage's Requests tab does (zzzkl3994 on Discord)
zzzkl3994: in Routing's request list some streamed requests showed tok/s
and some showed none, while the Usage page's Requests tab gave every one
of them a speed. The Requests tab gives a gateway call that tells no
measured speed a floor, "≥N tok/s" (usage/page.js ledFloor_): one that
reasoned with no first text recorded (a tool call after hidden
reasoning), its answer over the time after its first token unless its
content came in a burst; else, 1,000 tokens or more over a second or
more, its output over its whole time. Routing's rows had only the
measured speed. Now a row (and the side panel's row) says the floor by
the same rule, with the Requests tab's own tooltip words for it; a
measured speed is as before, and the story's per-try line still says
only a measured one. The floor's two tooltips are said by two plugins
now, so they move from plugins/usage/i18n.js to i18n.js, in every
language (i18n-keys: a plugin's words are its own). reasoning-speed,
which held that a tool call after reasoning says no speed on Routing
while Usage says ≥100, now wants ≥100 on both.

Run (mote, via mote-run, Playwright chromium + webkit):
- routing-row-floor-speed.test.cjs (new): four gateway rows, a measured
  one, hidden reasoning before a tool call, a burst, and one too small
  for either; each row's speed is compared with what usage/page.js's
  ledRowSpeed/ledFloorSpeed say for the same request, and the floor's
  tooltip with the Requests tab's words; en, zh, zh-TW, ja, de at
  1100px and 390px: 22/22 pass.
- routing-request-metrics.test.cjs (rows 6 and 7, two 8,264-token bursts,
  now say ≥339 and ≥5,509 rather than nothing) and
  routing-burst-speed.test.cjs: 8/8 pass.
- reasoning-speed (updated), panel-routing, routing-speed-first,
  usage-session-speed, usage-speed-count, usage-speed-every-row: green
  (10/10 and 48/48 for the first four).
- i18n-keys: the floor's two words no longer listed; its "a plugin's
  words are its own" is still red for "No session ID" and "View
  routing", the same at origin/main (#5332, #5426).
Broken by hand: client.js put back to its parent; the new test is 22/22
red ("waiting for .rt-metric.speed .v" on the hidden-reasoning row).
Not tried: the reporter's own requests (no trace of theirs), the real
app's WKWebView, Windows and Linux.

Reported-by: zzzkl3994
2026-11-06 11:23:46 +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
yetoneandggbdpq 7e5a54147f gateway: a routing group's intent sureness is its own, intent-sure= (#5101)
Jev's sure of an intent had to reach jevSure, a fixed 0.4, for every
group. zminds measured 39 of 237 turns in one day (16.5%) refused at sure
0.153 to 0.395, and those turns went by the group's routing as if it had
no intent rules. A group can now set its own threshold: intentSure, from
0 (take Jev's likeliest intent however unsure) to 1. Missing keeps 0.4.

readJev keeps Jev's likeliest intent, its sure and Topic (an answer of
intents rather than levels). ruleFor applies the group's own sure through
intentOf, so two groups sharing one classifier and its cached answer each
judge it at their own. "none of these" is never an intent, at 0 too.
Levels and effort are as before.

Set from a terminal: magpie group set <group> intent-sure=0.25, empty to
unset. SaveGroup and the CLI refuse a value outside 0 to 1, NaN too: the
patch's `v < 0 || v > 1` let intent-sure=NaN through the CLI, which
SaveGroup then failed on as "json: unsupported value". cloneGroups copies
the new pointer, since TestCloneGroupsSharesNothing went red on it.

Changed from ggbdpq's patch on #5101:
- The group editor's "Intent sure" row is left out. Its hints were long
  secondary text, it showed for every classifier when only Jev answers
  with a sure, and it had no GUI test. The Routing page instead carries
  intentSure through each save it makes of a group (the editor's Save,
  the routing menu, the manual pick), so a value set from the CLI isn't
  wiped by the next GUI save.
- Its i18n strings and site/public/docs/intent.html are left out. A
  site/ change waits for the maintainer (docs/contributors.md). The site
  diff was documentation text only: a paragraph id="sure", a sentence
  in "Match the rules" and one table row. It had no links or scripts.
- docs/subsystems/gateway-routing.md has a bullet for IntentSure.

Run on mote (mote-run):
- gofmt -l internal/: clean.
- go vet -tags nogui, also with GOOS=linux and GOOS=windows, on
  internal/gateway, internal/cli and internal/provider: clean.
- go test -tags nogui -run 'TestGroupIntentSure|TestJev|Rule|Classif|Decide'
  ./internal/gateway: ok.
- -run 'Group|Apply' ./internal/cli: ok.
- -run 'Group|Save|Clone' ./internal/provider: ok.
- go test -run Budget ./internal/gui: ok.
- node --test group-intent-sure (new), routing-group-strategy and
  group-first-token, in Chromium and WebKit: 42 pass, 0 fail.
- i18n-keys has one red, "a plugin's words are its own". It fails the
  same on origin/main b712adb84 and is filed as #5327, #5332 and #5426.
  i18n-en-no-cjk: ok.

Broken by hand, each red, then restored:
- sureNeeded always returns 0.4: TestGroupIntentSureThreshold,
  ZeroTakesTheArgmax and IsPerGroup FAIL.
- The patch's `< 0 || > 1` checks put back: TestGroupIntentSurePairs
  FAILs on "NaN" and "nan"; TestGroupIntentSureRange FAILs on NaN.
- The cloneGroups copy removed: TestCloneGroupsSharesNothing FAILs.
- The editor's Save sending intentSure null: group-intent-sure FAILs 4/4
  ("the editor's Save keeps it").
- The routing menu's pick sending null: it FAILs 4/4 ("a routing pick
  keeps it").

Not tried: a real Jev account with a group at 0.25; the full suite.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-06 10:44:24 +08:00
yetone 74d1cda421 gateway: a rate limit with a bracketed reset time rests the model until then, and says rate limited
taoxiaoxin on Discord (v0.1.2992, WorkBuddy China, plugin 0.2.24):
deepseek-v4.1-flash got 429

  {"error":{"code":null,"message":"WorkBuddy: 您的使用量已超出频率限制,将在
  2026-11-06 17:13:04 (UTC+8) 重置,您也可以切换其他模型继续使用。",
  "param":null,"type":"rate_limit_error"}}

with credits left, and Routing showed the account as 额度用尽.

Cause: WorkBuddy now writes the offset in brackets, "(UTC+8)".
resetsWhen read "UTC+8" only bare, so the reset time went unread, the
refusal fell to plannedWords (用量) as failQuota with no time, and the
whole account rested a quarter of an hour as quota used up. With the time
read, the existing path (resetsWhen + otherModels) rests only that model
on that account until 17:13.

- resetsWhen takes an optional ASCII or fullwidth bracket round the
  offset (zh and en forms); a body cut inside or after the bracket,
  before 重置, still reads no time.
- Rest.Rate (and provider.KeyRest.Rate): a refusal read as out of quota
  until a named time whose words say rate/frequency limit. Routing is
  unchanged (it rests as the quota it is until then); the Providers row,
  Routing's stage row, its Accounts line and the account tallies (live
  and the day's, history.go) say "rate limited" (限流, 限流, レート制限,
  Rate-Limit; strings already translated) with "back at {time}".
- workbuddy-ai gets the same: one path, tested for both ids. The plugin
  (opencode-workbuddy-auth) already reads the bracketed time; no plugin
  version or mover min.

Run (mote, at this tree):
- go test ./internal/gateway -run 'TestDayTallies|TestResetsWritten|
  TestWrittenReset|TestBracketedReset|TestMonthlyWritten|
  TestRateLimitBelieves': ok
- go test ./internal/gui ./internal/provider: provider ok; gui red only
  in TestMainWindowCorners/macOS_26_SDK, #3949 (macOS 27, untouched)
- go vet (darwin) gateway, gui, provider; GOOS=linux and GOOS=windows
  go vet gateway, provider: ok; gofmt -l clean
- node --test account-rate-rest (new; chromium + webkit, en zh zh-TW ja
  de, 1100 and 420px): 10/10
- GUI routing-*, account-*, i18n*, key-rest*, rate-limited-* (194
  files, 3127 tests): 3086 pass, 41 red. Rerun at concurrency 2 here
  and at origin/main 8fbf8e0af: the same 9 files red on both, each
  filed: i18n-keys (#5332), routing-intent-entry (#5392),
  routing-rule-drag (#3789), routing-rule-remove (#3096, #4585),
  routing-row-swap (#3799), routing-steady (#3412, #1804),
  routing-steps-cap (#4628), routing-story-shrinks (#3954),
  routing-order-unknown (#4627). account-weight, routing-levels,
  rule-models, rules-line passed on the rerun.
- TestCoreScriptBudget: app.js under 1,533,802 without a raise

Broken by hand:
- old resetsWhen: TestResetsWritten's bracket cases and
  TestBracketedResetRestsTheModelRateLimited red ("rests 14m59.99s by
  quota (quota), want 5h13m0s by resets": the whole account, 15 min)
- Rate forced false: "a frequency limit not marked a rate limit"
- history.go's count off: TestDayTalliesCountARateLimitAsOne red
  ("tallied map[quota:3]")
- app.js and routing client.js at HEAD: account-rate-rest 10/10 red

Not tried: a real WorkBuddy account answering this 429 (the body is the
reporter's literal one); the live app.
2026-11-06 04:09:30 +08:00
yetone 814a625a24 usage: the top refresh reads saved Claude accounts again (#5380)
The tray panel's Allowances refresh said "Allowances refreshed" but a
saved, non-active Claude account kept its old reading: claudeWindows runs
Claude Code's /usage for a saved account only under savedRefresh, which
only that account's own card refresh sets.

Now a refresh of every allowance by hand asks usage/quotas?asked=1&all=1
(AskEveryClaudeUsage). It marks its ask generation in claudeEveryAsked,
and for claudeEveryFor (2 minutes) each saved account not read since is
read as its card's refresh would, under the same due check, the
30-second per-account floor and the same running holds. Opening the
Usage page or the Allowances tab (?asked=1 alone), the timed refresh and
every background read are unchanged, so nothing polls more. Callers:
the panel's top refresh (refreshPage "allowances"), the Usage page's
refresh and sidebar reload (refreshUsage -> loadQuotas("all")),
Routing's Read allowances, and the TUI's r. loadQuotas no longer lets a
lesser load on its way (an opening's asked read) swallow a Refresh.

Siblings: saved Codex accounts are already read anew on every asked
whole read (loginReading over HTTP after AskUsage clears the cache), so
Codex is unaffected. PlanQuotas and KeyBalances keep their 1-minute cache
on an asked read; left as is. The core scripts' budget is not raised:
the ~140 bytes are paid for by two loadQuotas/quotasOpened comments cut.

Run (mote, at 807341cdc on origin/main 5666cb049; rebased onto
505534992 after, which touches only internal/plugin and internal/proc;
the core script budget rechecked at the pushed head, 193 bytes under):
- go test ./internal/provider/ ./internal/gui/ ./internal/tui/ ok
  (TestMainWindowCorners/macOS_26_SDK red on mote's macOS 27, #3949;
  green when run with the -run set at the pushed head)
- go vet the three packages; GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of them ok; go vet provider+tui in WSL ok; gofmt -l
  clean
- GUI, Chromium and WebKit, en+zh: refresh-page, claude-usage-asked,
  usage-refresh, routing-read-allowances, allowance-open-read,
  quota-refresh-order, usage-refresh-flight all pass. A wider set of 119
  files (quota*, panel-quota*, usage-*, allowance*, routing-read/account,
  menu-*, tray-*, i18n-keys) has reds in 6 files, identical at the parent
  commit and filed: i18n-keys #5332, menu-input-scroll #3402,
  tray-cell-click #5215, usage-agents-hide #3414, usage-fold #3415,
  usage-ledger #5048.
- New TestRefreshEveryReadsSavedClaude: an opening's ask runs nothing
  for saved accounts; a top refresh reads each anew; an unasked read and
  a plain asked read after it don't; rapid refreshes keep the floor; the
  every-ask lapses after claudeEveryFor.

Broken by hand: dropping "|| every" from claudeWindows' read turns
TestRefreshEveryReadsSavedClaude red ("top refresh read no allowance of
saved max@x.com"); the panel's refreshPage back on loadQuotas(true)
turns refresh-page's panel subtests red in both engines.

Not tried: a real saved Claude account's /usage run from the real tray
panel (the test fakes Claude Code's /usage per account directory); the
full GUI suite; the de/ja/zh-TW GUI runs (no string changed).
2026-11-06 00:35:39 +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 a9b1877cfc routing: a session's name stays when a later poll answers without it (#5365)
refreshOtherNames deleted a name the page had whenever a poll of
/api/gateway/session-titles came back without it, so a read that failed
or ran late (ZCode's database busy or slow, Flandern1211's report) put the
card back to its folder until a later poll named it again. An answer
without a name is unknown, not a session that lost its name: the page now
only takes new names in. 226fc8ea3 makes ZCode's poll fast; this is the
"names that vanish" half of #5365, which that commit leaves alone.

Co-authored-by: Flandern1211 <163982805+Flandern1211@users.noreply.github.com>

Run (mote, via mote-run):
- node --test internal/gui/tests/routing-session-name-kept.test.cjs
  (new; Chromium and WebKit, all five languages, 1100 and 420): 20 pass.
  With client.js at origin/main: red, the card reads "Claude Code ·
  work/zc" after a poll without the name.
- go test ./internal/gui (budgets, i18n guards): ok but
  TestMainWindowCorners/macOS_26_SDK, #3949.

- node --test on the 8 GUI files that fake session-titles
  (claude-subagent-tag, routing-by-key, -credits, -moved-why,
  -request-metrics, -session-folder, -session-title, -sessions) and
  i18n-keys: 185 pass, 1 fail, i18n-keys "a plugin's words are its own"
  on two words in files untouched here (#5332, #5327).

Not tried: the whole GUI suite (one routing file changed by four lines,
no new strings, no new API call).
2026-11-05 17:53:42 +08:00
yetone 97ccb90e88 routing: a group with no rule shows only the example rule's button, no paragraph under Rules (mr_coffee0083)
01a260af4 put a four-line paragraph under Rules in a group with no rule,
the whole setup for a thinking model and coding models spelled out. The
owner's UI rule: no secondary description the layout can carry. The
"Add an example rule" button stays, beside Add a rule and its ⓘ; the
rule it adds says what it is for in its own intent ("planning, design,
or a hard problem to think through"), to the group's last member.

- plugins/routing/client.js: rHint2 says only what holds the rules back
  (one model, routed by hand), as before 01a260af4.
- i18n.js: the paragraph's key out of zh, zh-TW, ja and de.
- routing-rule-example.test.cjs: the line under Rules is hidden while
  the button shows.

Run (wsl-run, magpie-desktop, Node 22, Playwright 1.62.0):
- routing-rule-example, i18n-keys, i18n-en-no-cjk: 27 of 28; the red is
  i18n-keys' "a plugin's words are its own" (#5327, the same on main).

Broken by hand: a "No rule yet" line put back under Rules for a group
with no rule: routing-rule-example 0 of 20, "no line under Rules".
Restored after.

Not tried: the real app window.
2026-11-05 16:35:38 +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 24d315fa85 routing: the request list can be grouped By key, each gateway key's calls under its name
acezan (#help on Discord) asked to see API use on the Routing page the way
it shows each agent's, live and in the history. The list's group bar gets
a third button, By key, after By request and By session. It shows once
Settings has a gateway key (/api/caller-keys). Each head is the key's
current name (else the name the route kept, else its id), with its agents
dim beside it and the usual count, tokens, in progress and cost. Calls with
no key (from this computer, or kept before 75fb76186 named the key) go
under "No gateway key". A row's tooltip names its key too. The choice is
kept in localStorage (magpie.routingGroupBy), and the old
magpie.routingBySession still works. Text added in zh, zh-TW, ja and de.

click-scroll counted two group buttons and now counts three, with By key
hidden when there is no key. purpose-filter clicked .last() for By
session and now picks [data-by="session"].
reference.md and gateway-sessions.md describe By key and Route.CallerKey.

Run (WSL magpie-desktop: mote's disk is full, ld errno=28):
- routing-by-key.test.cjs: 20/20 in chromium and webkit, in en, zh,
  zh-TW, ja and de, at 1100 and 420. Red 20/20 with client.js and
  i18n.js at the parent (waits for By key).
- 254 Routing-related GUI files at concurrency 4. Every red was rerun
  serially, with this change and at origin/main 73c98ebc2.
  - Only purpose-filter and click-scroll were this change's; both are
    fixed above and green now.
  - The rest are red at main too, or flake there: #5045 call-headers,
    #4385 click-scroll wheel, #5049, #1745, #4689, #3402, #4623, #1937,
    #3773 idle-frame (10 frames, passes on rerun), plus routing-rule-*,
    zero-priced-free and others under #4121/#4400.
- Windows: go test ./internal/gui. Reds are #4115/#1827, plus
  TestPluginAgentMissingSaysSo and TestGatewayHeldByAContainer, red at
  main too and filed now as #5324.
Not tried: the real app, the whole GUI suite, the tray panel (no By key
there). A key renamed after a row was drawn shows its old name in that
row's tooltip until the row is drawn again.
2026-11-05 14:47:18 +08:00
yetone bf60ea5968 routing: an earlier account's overload reads overloaded, not quota used up (danzi002)
danzi002 on Discord (v0.1.3005): a Codex request's row read "529 · 额度用尽"
(quota used up) while its detail said ChatGPT's 529
service_unavailable_error server_is_overloaded, on an account with its
allowance left. The account was not rested as spent: an overload is
failOther, rested a moment at most (vendorOverloaded). The words came
from the row. When the last account left is out of its allowance after
an earlier one failed otherwise, Codex is told the earlier failure
(Try.Earlier), and the route takes that one's status, but the row paired
that status with the last try's own fail, quota.

The route now records the kind of the failure the agent was told
(Route.Fail, from toldFail: overloaded for a 529 or a 5xx that says
overloaded, the prompt turned away, else failure's reading), at both
places serve tells an earlier try's failure: Try.Earlier, and every
account after it passed over by a middleware. The Routing page and the
panel's request rows (endWord) say that kind when it is there.
"servers overloaded" is a new word for the row only (en, zh, zh-TW, ja, de),
never a rest's Why.

Run (mote, through mote-run; rebased on origin/main 234903cb2, the
first three lines and the i18n/GUI line below run again there):
- go test -tags nogui -count=1 -run 'TestToldOverloadIsNotQuota|TestToldFailKinds|TestCodexCapacityNotLabelledUsageLimit' ./internal/gateway: ok
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok (764s, before the rebase on 234903cb2)
- gofmt -l internal/gateway: clean; go vet -tags nogui ./internal/gateway,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok
- node --test routing-told-overload (new; Chromium and WebKit, en zh
  zh-TW ja de, 1100 and 420px) and routing-went-on: 40 of 40
- node --test i18n-keys i18n-en-no-cjk routing-told-overload routing-went-on: 48 of 48
- node --test routing-*.test.cjs panel-routing*.test.cjs i18n-*.test.cjs:
  2673 of 2704. One red was mine: i18n-keys, the plugin word
  "overloaded" is also a Go string (affinity.go), so the word is now
  "servers overloaded". The other reds are in routing-levels, -many-keys,
  -order-unknown, -row-swap, -rule-drag, -rule-remove, -rules-line,
  -steady, -steps-cap and -story-shrinks: rerun alone, 26 of 124 red here,
  and 24 of 96 red on origin/main 0e55a7593 (mote at load ~25), already
  filed (#5088, #4932 and others)

Broken by hand:
- the two t.Fail = toldFail(other) updates removed:
  TestToldOverloadIsNotQuota red ("the route says the agent was told a
  "" failure, want "overloaded": its row reads 529 · quota")
- endWord back to last.fail: routing-told-overload red in every engine
  and language

Not tried: a real ChatGPT 529 overload (can't be caused on demand), so
the reporter's own path is inferred: several ChatGPT accounts, the last
out of its allowance. The middleware passed-over site has no test of its
own; it uses the same toldFail. The whole GUI suite and the full
go test ./... were not run before the push; the full suite runs after.
2026-11-05 11:13:43 +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 9095fd82d8 gateway: a conversation kept for its cache is asked again once on a passing 5xx before it moves (jiabubu)
jiabubu on Discord: a channel that errs once and answers a moment later
had the conversation moved off it at the first error, under every rule,
and the next one was sent it all uncached. Only the last candidate left
(or Strict's lone one) was ever asked again.

Now when the conversation is kept where it is (Affinity.Kept: Auto with
a warm cache, Session, or within a turn) and that key or account fails
in a way that passes (busy: overloaded 503/529, another 5xx that says
nothing of quota, 408), and not as a 429, quota, refusal or sign-in, it
is asked once more after retryPause (or a Retry-After up to
longestPause) without resting. Once per request; failing again it rests
and the next is asked as before. A conversation nobody answered yet, or
under Stays Off, moves at once (keptAgain in affinity.go). The trace
marks the try (Try.Kept) and the Routing page says it was asked again
for what its vendor cached, not "nobody else is left to ask", in en,
zh, zh-TW, ja and de.

TestFixedMemberEffort and TestHeldRuleFailsOverWithinItsMember had a
kept member fail with a lasting 500; they now expect it asked once more
(kq1 kq1 kq2) before it moves, the outcome unchanged.

Run on mote (mote-run):
- TestKeptConversationAskedAgainBeforeItMoves (7 cases: Auto, Use
  before expiry, Session, failing twice, 429, new conversation, Off),
  TestFixedMemberEffort, TestHeldRuleFailsOverWithinItsMember: ok.
- go test -count=1 -timeout 45m ./internal/gateway/: all ok but
  TestGroupBackupStandingInWhileTheFirstIsBackAndBehind and
  TestGroupMemberPutFirstOnItsMeritsKeepsItsCache, red with keptAgain
  switched off too: #5209.
- routing-kept-again.test.cjs: 20 of 20 (chromium + webkit, en zh zh-TW
  ja de, 1100 and 420 wide).
- GUI routing-*, group-*, i18n*, gui-* (2967 tests, concurrency 4):
  42 red, all in files this doesn't touch; 14 of those files alone:
  28 red, and the same files at origin/main 7dd2434d3 alone: 29 red,
  the same tests (mote at load 58-118). Filed: #5088, #4585, #4627,
  #4628, #3954, #1804.
- gofmt -l clean; go vet ./internal/gateway darwin, GOOS=linux -tags
  nogui, GOOS=windows: ok.

At the head rebased on 78128b510: vet (darwin, linux, windows), go test
-run 'TestKeptConversation…|TestFixedMemberEffort|TestHeldRule…|
Affinity|Strict|Patience' ./internal/gateway: ok; routing-kept-again,
i18n-keys, routing-agent-gone: 40 of 40.

Broken by hand: keptAgain's call made false: the four kept cases of the
Go test fail (b answers, a asked once); the story branch made false:
routing-kept-again 0 of 20.

Not tried: a real vendor's 503 on a real account; Linux/Windows runs of
the tests; the full ./... suite before this push (runs after the tag).
2026-11-04 19:24:12 +08:00
yetone ce21ea8566 usage, routing: counts are said short (K/M, 万/亿), the exact number on hover (skyhuang1994)
skyhuang1994 on Discord: long token and request counts on Usage and
Routing are hard to read at a glance. They now go through fmtN (K/M/B,
in Chinese 万/亿), with the exact grouped number (ledNum) as the title,
so hovering shows it. A count that fmtN already writes in full gets no
title.

- Usage (plugins/usage/page.js): the Requests table's input, output and
  cache cells (output keeps its reasoning line, cache write its TTLs
  under the exact number), the Requests block, retried, the sources
  tile and the ledger's sum line. sameRead moves here from app.js,
  beside loadSessions, its only reader.
- app.js: the Tokens and Requests blocks (blk takes a title), the
  ledger's call count, the rank's values and "{n} requests".
- Routing (plugins/routing/client.js): the day menu's note, the "more
  days" name, the day rows and the stats.
Core scripts: 22 bytes smaller than their base (1533979 at this head;
TestCoreScriptBudget stays red on #5139 as on main, not worse).

Tests: usage-compact-counts.test.cjs is new (Usage and Routing, every
language, chromium and webkit, 420 and 1100px). panel-usage's rank
value expects "900K" with title "900,000"; ledger-cache-unknown's
counted cells expect fmtN text with ledNum as the title.

Run (mote-run):
- at ded9e4a62 (on c03dee7e3): TestCoreScriptBudget 1533979 (red, #5139),
  usage-compact-counts, ledger-cache-unknown, panel-usage, i18n-keys:
  50/50.
- at c533a569d (on 69eb93e0a): 136 GUI files (usage-*, ledger-*,
  panel-usage, i18n-keys, routing day/stats files) 1868/1917. The reds,
  rest-try-now (#5035, #2564), usage-agents-hide (#2276), usage-fold
  (#3415), usage-ledger (#5048), ledger-swipe (#5223), usage-computers
  (#5224), are red the same or worse on origin/main 0a5dc40ab in a
  4-file run under the same load; c533a569d's 4-file run had a subset.
- at 56fff616a (on d5d48f4f9): 206 GUI files; besides the above,
  tray-cell-click (#5215) red the same on origin/main 009076a2a.
Broken by hand: page.js, client.js and app.js put back to main's ->
usage-compact-counts and ledger-cache-unknown 0 pass / 42 fail;
restored.
Not tried: the real app with real usage data, the Linux WebKitGTK app,
Windows.
2026-11-04 18:44:11 +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