Commit Graph
1766 Commits
Author SHA1 Message Date
yetone 01ccbd40a0 library: an MCP router says which computer it is, so an agent can pick between two (packinggoodsllc_07668 on Discord)
Two magpies, one in China and one in Los Angeles, each serve the same
tools through their MCP router (/mcp/magpie/hub). An agent connected to
both saw two identical web fetches and couldn't pick the one in Los
Angeles to reach Google.

Each router now says where it is:
- initialize's instructions end "This router: <name>. Each of its
  tools' descriptions starts with [<name>]; ...", and serverInfo.title
  is "Magpie MCP hub · <name>";
- each tool's description in tools/list starts "[<name>] " (once: a
  description that starts so already, another magpie's router behind
  this one, isn't given it twice).
<name> is the user's words (settings.RouterNote, one line, 80
characters at most) to every caller. With none it is this computer's
name, to callers on other computers only: an agent on this computer
has one router at hand, and its prompts stay as they were.

RouterNote is this computer's own (KeepOwn): library.json is synced,
settings.json isn't, so a sync never brings the other machine's name.
It is set in the Library's MCP tab, in a Router name row under the
router's address (shown while the router is on): a plain field with the
computer's name as placeholder, saved on Enter or leaving it, Escape
puts the saved words back, an input method's Enter is its own. POST
/api/settings keeps it. Translated in zh, zh-TW, ja, de.
docs/subsystems/mcp-router.md has the rule.

Run (mote, at a5a9cdf7b + this change): go vet ./... for darwin, linux
and windows ok; go test -tags nogui ./... -timeout 45m: every package
ok except internal/gui's TestSettingsSaveKeepsWhatItDoesNotSend on
BusyLoad, red on main since 8d8df0639 (#4739, fixed in the next
commit). After rebasing on 9feb1024c: internal/gui, settings, library
and gateway again, and node --test library-mcp-router-note (new),
library-mcp-hub, mcp-hub-direct and i18n-keys, chromium and webkit,
en/zh/zh-TW/ja/de, at 1100 and 420 wide.

Broken by hand: hubWhere returning "" turns TestHubMCPSaysWhere red;
dropping RouterNote from KeepOwn turns TestRouterNote red; dropping it
from POST /api/settings' carry list turns TestHubNoteSaved and
TestSettingsSaveKeepsWhatItDoesNotSend red. i18n-keys caught a test
comment saying "Router name", reworded.

Not tried: two real magpies on two computers with a real Claude Code
or Codex connected to both, and whether a model actually picks by the
prefix; the Linux and Windows apps' Library tab.
2026-11-01 15:23:15 +08:00
yetone c903c3a411 usage: Use on Codex's window lands over 7 and 30 days, a model's own Compact at named apart (hoobnn on Discord)
hoobnn on Discord (11-01): "观测-用量-上下文里,在7天或者30天的选项里,点击
应用codex的上下文,没生效。" Over 7 or 30 days the range held calls on a
model whose provider has a Compact at of its own (430K); today's didn't.
Tuned for you's "Now" was the largest compaction point over every model
in the range, so it came from that model. Use put the advice in Long
conversations, which did move Codex's other models (Codex's list had
them at the advice), but the card still read 430K and then turned held
("compacts at its own 430K, which comes first"), so nothing seemed to
happen. And with Long conversations at magpie's default, a range of
only such models offered a Use that could move nothing.

codexWindow (internal/gui/tune.go) now reads "Now" from the models Long
conversations moves, and lists each model with its own Compact at as
Apart (largest first). Only a range whose every model has its own is
held (Own), whatever Long conversations says. The card names each
model kept apart under the row: "{model} compacts at its own {value},
which this doesn't move", in en, zh, zh-TW, ja and de.
provider.CompactSetIn is CompactSet with the caller's settings and
group finder, as CompactFor takes them.

Siblings: Claude Code's knob is per model (no max over models), so it
has no such mix. 1, 7 and 30 days go through the same codexWindow;
the GUI test covers 7 and 30 and the Go test the 1-day sample.

Run on mote at d614f2172 plus this change, then at this head (on
7b6b7492a) again: TestCoreScriptBudget, TestTune*, context-tune and
i18n-keys, all ok.
- go test -tags nogui ./internal/provider ./internal/agent
  ./internal/codexcat: ok. ./internal/gui: ok but two tests red the same
  on a clean origin/main 9097687a3 (3 of 3 and 1 of 3), both filed:
  TestSettingsSaveKeepsWhatItDoesNotSend (BusyLoad, #4739) and
  TestColdTurnsTaken (#4510). TestTuneCodexUseLandsInEveryRange (new) puts
  two providers in a sandbox HOME, one with its own 430K, reads the
  advice for 1 model and for both, applies through agent.TuneApply as
  /api/tune/apply does, and checks the card and Codex's model list
  (codexcat): the other model at the advice, the own one at 430K.
- go vet (darwin), GOOS=linux go vet -tags nogui, GOOS=windows go vet
  for internal/gui and internal/provider; gofmt -l clean.
- node --test context-tune (178 pass, both engines, en/zh/zh-TW/ja/de,
  360 and 1100 wide), i18n-keys, gui-zh-tw, gui-de: pass. gui-ja: one
  red, "ja has every zh string", the #4532 string, filed as #4580 and
  fixed in its own commit next.
- TestCoreScriptBudget passes with no raise (two comments in
  context.js cut to fit: 1,533,023 of 1,533,105).

Broken by hand: with tune.go's Apart taken out, the new Go test is red
("only the model with its own 430K: own <nil>, now 430000" and "after
Use 120000: now 430000, own own/gpt-own-1m"); with the old context.js
the new GUI test is red, 42 of 42 (40 cases, both engines).

Not tried: hoobnn's own config on a real Codex; a profile-level
model_auto_compact_token_limit in config.toml (TuneRead reads the
top-level key as Locked, not a profile's); the whole Go suite and the
whole GUI suite (run after the push).
2026-11-01 15:19:32 +08:00
yetone 7b6b7492a9 claude: an account on overages is read with its windows and switched off (#4532)
Claude Code's /usage line "You are currently using your overages to
power your Claude Code usage…" was in claudeUsageDenied, so the whole
reading became an error: the card lost its windows, and NextLogin, which
stays on an account it can't read, left Claude Code billing overages
while other accounts had room (StringKe's audit, item 3).

Now the line is no error. The windows under it are read as usual, and a
Text row "Extra usage" with Used 100 is added (claudeOveragesWindow), so
usedPast/roomLeft count the account spent and the switch moves off it.
The row ends when the last used-up window renews (the time Claude Code
says it switches back), else at the next reading. Routing skips Text
rows, so the gateway's own account choice is unchanged. The GUI says the
row "In use" in the reader's language (quotaText; a plugin's text row
keeps its display as it came). The overages case is out of
TestClaudeUsageFailureDoesNotHideAccountErrors: it was the bug.

Run (mote):
- TestClaudeUsageOverages, TestClaudeSwitchOffOverages: red on the old
  claude_usage_cli.go (an error; switched to ""), red with the row's Used
  set to 0 by hand, green now.
- go test -tags nogui ./internal/provider -run
  'Claude|Usage|NextLogin|Next|Switch' ok.
- GUI: claude-overages (new, 5 languages, chromium + webkit) red 8 of 10
  on the old app.js (en passes there), green now; with quota-text-row,
  quota-name-translated, i18n-keys, usage-no-reading: 40 pass.
- go vet darwin/linux/windows; gofmt clean.

Not tried: a real account on overages; the text is Claude Code
2.1.316's string table, and the windows under it are what StringKe
describes.
2026-11-01 15:16:00 +08:00
9097687a31 gui: Hide accounts leaves the user's own account names and plans in sight (#3656)
With Hide accounts (账号打码) on, the name a user gave an account
(#1515) was blurred like the account, so faketrader's several
Antigravity accounts couldn't be told apart; and an Antigravity
account whose value is "Google" blurred "Google" of its plan
"Google AI Pro" on Usage and on the Providers row. The name the user
gave an account is shown text, not an identity. The account is.

- provider: a card's Alias says whether it is the user's own name
  (SubscriptionQuota.Named, set by withAccountNames from
  AccountNameOf), since Alias is also a plugin's name for an account
  (PluginUserOf, a masked phone, #4416) or a seat's key plan, and the
  Usage page and tray panel may have no /api/providers to tell them
  apart. labelProvider is AccountLabelOf's "plugin:" lookup, shared.
- app.js names(): the user's own names (accountNames) and named
  aliases are no longer accounts to hide; accountUsers, an unnamed
  alias and a seat still are (noteAccounts keeps an alias without
  named).
- app.js mask(): labels are scoped by element, never by value
  (LESSONS: scope an exemption by where the value sits). In
  .own-name, .plan, .acct-plan (the Providers row's plan pill, new
  class), .model-value and .subscription-head > b only an address is
  hidden; a plan's and a model's tooltip too (TIPS). The own name's
  tooltip ("name · account") is masked in full.
- .own-name is set only where the text is the user's own: the
  editor's rename span when it has one (else it shows the raw
  account and stays hidden), Usage's quota-alias and the panel's
  pq-user when q.named.

From skygunner's patch (95c0511 on 19253f67), changed:
- Its .acct-who .rename exemption showed a raw non-email account
  (the rename span shows the account when it has no name of the
  user's). Now only an own-name span is exempt.
- Its [title]:not(LABELS) skipped those elements' tooltips
  altogether, so the address in "alias · user" (quota-alias, rename)
  went unmasked. Tooltips are masked; only a plan's or model's hides
  just an address.
- Dropping every alias from names() would have shown a plugin's name
  for an account (#4416 came after the patch's base). Named tells
  the user's own apart.
- The n.data.length < 2 skip the patch removed is kept.
- Its test is rewritten on the new fixtures: an unnamed plugin
  alias, an address in a plan, the editor with and without an own
  name, the panel, a model value, tooltips.

account-alias.test.cjs and account-eye.test.cjs said Hide accounts
hides the user's own name; they now say it stays in sight, the
accounts still hidden. account-alias brings the window's page to the
front before clicking #usageMask, and the panel's before waiting on
it: behind the panel's page it gets no
frames and the click waited for one, red 5 times in 2 runs at
fb3942ee6 (#2984's account-alias half), 0 in 100 after.

Not changed: the tray panel card's tooltip is one string of account
and plan, so a plan word that equals an account's value is still
hidden there (#4677). OpenCode Zen's "Signed in as <account>"
in the issue's screenshot is the raw account, hidden as before.

Core scripts: app.js's own comments in the masking module are cut, so
the core is 742 bytes under its budget at the pushed head (no raise).

What was run:
- At this on 4c815ac2a, on mote (then rebased onto 39bade71d, whose 8
  commits change only i18n.js and plugins/gateway/settings.js; the
  budget measured again, 742 under): gofmt -l; go vet
  of provider, gui, usageapi; go test -tags nogui ./internal/provider
  ./internal/usageapi ok; TestCoreScriptBudget ok; the 19 masking GUI
  files (account-*, mask-*, masking-records, privacy-*, provider-mask,
  provider-unmasked, routing-masking, window-mask, click-scroll,
  i18n-keys), both engines: 539/540. The red was account-alias's
  panel wait behind the window's page, fixed by the panel bringToFront
  above. account-alias + account-mask-alias-plan after it: 4 runs,
  159/160 (one red in "renamed in place", whose body this change doesn't
  touch, #4749). account-alias 6 more runs: 120/120 here, 117/120 on
  origin/main 90c02326b (#2984).
- account-mask-alias-plan: 20/20 on the fix (Chromium, WebKit; en, zh,
  zh-TW, ja, de; 1100 and 420), 20/20 red at fb3942ee6 (the alias is
  masked); red with the plan selectors taken out of LABELS by hand.
  account_plugin_user_test red with Named always false by hand.
- At 4eeba1ca6 (this on 90c02326b): go vet ./..., GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./..., go build for darwin,
  linux (nogui) and windows: ok. go test -tags nogui ./... on the
  Linux box: every package ok except internal/agent (8 install tests
  red the same on origin/main there, #4033, #3548) and internal/gui
  (TestSettingsSaveKeepsWhatItDoesNotSend, red on main, #4514;
  TestColdTurnsTaken on mote once, #4510). The whole GUI suite on the
  Linux box, 6 wide: 16857 pass, 491 fail in 100 files, none of them
  the masking files but account-every-reset; being run against
  origin/main to sort.

Co-authored-by: skygunner <84759+skygunner@users.noreply.github.com>
Co-authored-by: vincent <vincent@users.noreply.github.com>
Co-authored-by: Fake Trader <9635792+faketrader@users.noreply.github.com>
2026-11-01 15:15:08 +08:00
yetone 66c0ddc19a gui: Busy models last takes a custom threshold, 1 to 9999 (axelburks)
axelburks on Discord: a vendor that queues reports loads past 100%, and
the only way to a threshold such as 150 was settings.json. Settings ›
Network and sharing › Busy models last now ends in Custom…, one more
choice in the same in-app switch (no <select>). It opens a small field
in the row whose sub says what the number means: a load in percent as
the plugin reports it, 100 is all the vendor serves at once, past 100
requests queue (200 is twice that), 1 to 9999. Enter or Apply saves it
through settings/busy-load, Escape or Cancel closes it untouched. A
value that is not a whole number from 1 to 9999 is said in red in the
sub and nothing is posted; the field keeps it to correct. The number
saved shows as its own choice ("Over 150%"), and Custom… opens with it
filled in. The site docs (en, zh, ja) and gateway-routing.md say
Custom… instead of settings.json. Code in plugins/gateway/settings.js
and i18n.js only, so the core budget is untouched.

Run on mote at this tree:
- node --test model-load, i18n-keys, bare-ids, gateway-port: all pass.
  model-load's new test runs in Chromium and WebKit, at 420 and 900, in
  en, zh, zh-TW, ja and de: Custom… focuses the field, says what the
  number means, refuses abc, 0, 10000, 1.5 and -3 with nothing posted,
  Escape closes, 150 posts {at:150} and shows Over 150% picked, 2000 by
  Enter replaces it, the row and settings don't run sideways, and no
  press moves the page more than the row changed height.
- go test ./internal/gui -run Budget: ok. gofmt -l: clean.

Broken by hand: validation turned off (if (false)) went red in every
language; the Custom… entry taken out went red in the old and new
tests; the field without flex:none was squeezed to ~20px and the width
check went red.

Not tried: the real app window (only Playwright's engines), and the
full GUI and Go suites, which run after the push (one suite on mote at
a time).
2026-11-01 15:01:24 +08:00
yetone 4c815ac2a5 search: searchers picked to follow the one named, tried in their order when it fails (axelburks on Discord)
axelburks asked for more than one searcher, so that when one fails
another provider searches. A searcher named in Settings gave way to no
other provider before, only to the Search APIs. Automatic already fell
back to up to three.

- settings: SearcherThen, the searchers after the one named. Entries
  are trimmed. Blanks, "off", the named one and repeats are dropped.
- gateway: when the named searcher fails (the context still live),
  modelSearch asks each of SearcherThen in order and skips one that
  can't search now or is the same model. The first that searches
  answers, and the call is marked searchingInstead, so the Routing row
  says why the named one didn't search. If all of them fail, their
  errors go back together, saying "the searchers picked ..., in their
  order", and webSearch goes on to the Search APIs as before.
  SearchFailure.Instead names the one that searched in its place.
- gui api: searchFailed.instead. A save takes only searchers that
  Searchers() offers. A save without searcherThen keeps the list, since
  the page's prefsKeep doesn't send it, and [] clears it.
- Settings › Web search (plugins/search/settings.js, outside app.js's
  budget): an "If it fails" row under a named searcher, with numbered
  chips and Add. A chip's picker changes the chip or removes it. The
  row is hidden for Automatic and Off. The failure line names who
  searched instead, or says the ones after it failed too. The help
  text says the same in en, zh, zh-TW, ja and de.
- docs: gateway-routing's failing searcher, and gui-shell.

Tests:
- TestPickedSearchersInTheirOrder (gateway): one test where the named
  searcher answers without searching and one where it fails. A gone
  entry and one that can't search are skipped, and the third searches
  once. With no working entry, the error says so and Instead is empty.
- TestSearcherThenSaved (settings) and TestSearcherThenFromSettings
  (gui): what is saved, kept and cleared; refusing an entry that can't
  search. settings_keep_test sets SearcherThen.
- searcher-then.test.cjs: chromium and webkit, en, zh, zh-TW, ja, de,
  at 560 and 1000 wide. Checks the row's place and words, what Add
  offers, the posted lists, that the chips fit with no horizontal
  scroll, that no click moves the page, and both failure lines.
Broken by hand: running no fallback turned TestPickedSearchersInTheirOrder
red (both subtests: "ds2 searched []"). Not keeping the list on save
turned TestSearcherThenFromSettings and the keep test red.

Run on mote (mote-run):
- At the pre-rebase tree (base 21882a68d): go test of settings, and
  -run 'Searcher|Search' of gateway and gui: ok.
- searcher-then, searcher-pick and i18n-keys in both engines: 46 of 46.
- gofmt clean. go vet: darwin gateway, gui, settings; windows the same;
  linux gateway and settings on mote, gui with -tags gtk3 on the Linux
  box (wsl-run): ok.
- Rebased onto origin/main 1e6a27d4f, this tree: -run
  'Search|Searcher|CoreScriptBudget|SettingsSave' of gateway, gui and
  settings: gateway and settings ok; gui ok but for
  TestSettingsSaveKeepsWhatItDoesNotSend on BusyLoad, red on main
  since 8d8df0639 (#4739, not this change; SearcherThen passes its
  check). The three GUI files above: 46 of 46.
  Pushed on origin/main e62a1bc51. Its 6 commits since touch routing,
  sessions and rex files only, none of these, and weren't run here.
Not run before the tag: the whole GUI suite and the full go test of
gateway, gui and settings. They are queued behind other sessions'
suites on mote and run after the push; any red they find gets its own
commit.
Not tried: a real relay or a real searcher failing in the GUI app.
2026-11-01 14:43:18 +08:00
yetone ed0ad52821 gui tests: a picker's item is pressed once the list is drawn for good (#4274)
A model picker draws its list again when its first read of
/api/model-speeds answers (readSpeeds, once a minute and after every
load). searcher-pick's click found the Automatic item after a reload,
the list was drawn again under it, and Playwright gave a null box for
the detached item: "Cannot read properties of null (reading 'x')" at
line 319. reader.cjs's pickItem finds the item again each frame until
its box is the same twice, and presses it there; searcher-pick's click
uses it.

Run on mote (mote-run), chromium, searcher-pick "the provider that
searches..." en and zh:
- origin/main f2f75ee4a: zh red 2 of 3 runs, run alone, the null box
  at line 319 (a diagnostic showed the item there, 32px tall, right
  after).
- this change: en and zh green 5 of 5 each; searcher-pick,
  searcher-then (next commits) and i18n-keys in chromium and webkit:
  46 of 46.
Not tried: webkit 5x alone; the whole GUI suite runs with the next
commits.
2026-11-01 14:43:07 +08:00
yetone e62a1bc515 routing: a trail is drawn in its own agent's colour, and agents on screen don't share one (Pkh)
Pkh (Discord, 0.1.2509, Linux) saw trails in another agent's colour,
and different agents drawn alike, on the Routing page.

Causes, read in routing/client.js:
- Wrong colour: render() coloured a lit row by row.rid, the latest
  staged request that weighed the seat, not by the request actually on
  it. With Codex answering and ZCode's request staged later, Codex's
  trail was drawn in ZCode's colour, and the fold, group and flows
  layers copied it.
- Stale colour: --agent was set when a row lit and never cleared, so a
  reused row or fold wire kept the last agent's colour. The panel's
  ps-out wires did the same.
- Collisions: hueOf gave 15 makers their own colour and hashed the
  rest into 8 spares. 49 of 59 agent ids fell into those 8. QwenPaw,
  ZCode, Qwen Code and AstrBot were all #65a30d.

Change:
- A row's colour is the agent it answers now (trying), else the agent
  whose request is on its wire (flying), else the request it answered.
  It is cleared when the row is off. Folds and groups copy it through
  tint(), which clears too. A ps-out wire clears when its trip ends.
- One PALETTE of 12 quiet colours, same lightness and chroma around
  the wheel, none near --red. HUES is a maker's place in it. hueOf
  gives each agent the first colour from its place that no other
  agent has had, and keeps it while the page is open. hues() keeps
  the agents shown together apart once more than 12 have come.

Tests (red on the old client.js):
- routing-reused-row-hue: Codex then ZCode on reused rows. Lit and
  flows colours are each agent's own, and off wires carry no colour.
- routing-agents-apart: four agents on screen at least 20 degrees
  apart in OKLCH hue, and the same colours after a fifth request.
- Both run in Chromium and WebKit, in every language, at 1100 and
  420/390 widths.
- routing-agent-hue-not-red now reads PALETTE.

Broken by hand:
- Without the removeProperty, routing-reused-row-hue is red.
- With by = r.agent, it is red.

Run (all on mote, macOS 27):
- The whole GUI suite, Chromium and WebKit, at concurrency 6, at base
  b2145eac1: 17298 tests, 336 red in 57 files. No red is in a hue
  test.
- The 57 red files run again at a6217e83d, with A (plus every
  routing-* file) and without it. Each red file is red on main too,
  with three exceptions:
  - gateway-key-models webkit en (#4616) was green 3 of 3 alone on A.
  - routing-rules-line webkit 1100 was red on main as well, run
    alone (#4560, #4585).
  - group-found-skip and images-codex-one were red on main only.
- balance-fix (#4682, #4683) and agent-panel-name-width (#4203) are
  red on macOS too, in both engines. Noted on those issues.
- At the pushed tree, every routing-* GUI file, both engines: 2105
  ok, 29 red. All 29 are in files filed red on main: rule-remove,
  rule-drag, rules-line, row-swap, steady (#4585), many-keys
  (#4082), order-unknown (#4627), steps-cap (#4628), story-shrinks
  (#4629). The three hue tests are green.
- go test -timeout 45m ./internal/gui at the pushed tree: two reds,
  both red on origin/main too.
  - TestSettingsSaveKeepsWhatItDoesNotSend: BusyLoad (#4739).
  - TestMainWindowCorners/macOS_26_SDK (#3949).

Not tried:
- The real Linux app (WebKitGTK); only Playwright's WebKit.
- The hues() pass with more than 12 agents; no test covers it, and
  removing it leaves the tests green.
2026-11-01 14:40:57 +08:00
yetone 1e6a27d4f8 gui: an icon's image URL typed and saved is fetched, kept and shown again (hoobnn)
hoobnn on Discord #general: a custom provider's icon given by an image
URL was neither fetched nor applied, and on editing it again the URL
was gone.

Cause: the Image URL… box (1dc22a37c) sent its address with Enter only.
An address typed and then saved, or left by clicking elsewhere, was
never fetched, so Save sent the old icon ("generic"). And nothing kept
the address: the box went away after a fetch that worked, and the
provider had no field for it, so a reopened editor showed none.

Now:
- The box has a Use button (an existing string, in every language), and
  leaving it fetches too. Save fetches an address typed and not fetched
  yet, then saves with the picture; one that can't be used keeps the
  editor open with the note why, and saves nothing.
- Provider.IconFrom (iconFrom) records the address the uploaded picture
  came from. /api/providers gives it back, the editor opens with it in
  its box, a save that doesn't name the icon (CLI, TUI) keeps both, and
  provider.Save drops it when Icon isn't an uploaded picture (a built-in,
  Default, the letters, a chosen file or the site's icon clear it in the
  editor too). It is a record only, never fetched again.
- The fetch itself is unchanged: POST /api/icons/url through
  guardClient (public addresses only), https only, MaxIcon 1 MB, type
  sniffed. Remote images are never loaded by the page itself.
Siblings: iconPicker is the only editor with an icon address; the
import link's iconUrl is fetched on confirm (fetchImportIcon) and stays
import-only.

Core script budget: this adds ~1KB to app.js; it fits the unchanged
1,533,105 (now 1,532,840) by cutting four long comments in app.js
(text-cut tooltips, rowOwnRect, modalHold, modalDepth) to two lines
each. No raise.

Run at this tree (based on origin/main 0516c18ca), on mote:
- GUI: icon-url-saved.test.cjs (new) and icon-url.test.cjs, Chromium and
  WebKit, 420 and 1100 wide, en/zh/zh-TW/ja/de: 40 of 40 ok (the
  existing test now expects the box to stay with the working address).
- Broken by hand: Save's flush removed -> icon-url-saved red in
  Chromium ("Save didn't send the fetched picture", actual 'generic',
  hoobnn's case); draftOf without iconFrom -> red in WebKit (the box
  with the address never shows on reopening).
- go test ./internal/gui ./internal/provider: provider ok; gui ok but
  for three reds that fail the same on a fresh origin/main 586b59fe7
  copy, each already filed: TestSettingsSaveKeepsWhatItDoesNotSend
  (BusyLoad, #4739), TestMainWindowCorners/macOS_26_SDK (#3949) and
  TestColdTurnsTaken in the full package run (#4510; it passes alone
  on main). TestCoreScriptBudget ok.
  TestProviderSaveKeepsIconFrom (new) red with the save merge's IconFrom
  keep removed ("a save without the icon lost it"), green restored.
- gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./...; go build, linux nogui and windows
  builds: ok.
Not yet at push (the owner's ship-at-once rule): the whole GUI suite
(mote was busy with another session's full GUI run) and the full Go
suite (running on the Linux box); both run after the push, and any red
they show is fixed or filed in its own commit.
Not tried: a real image URL against the real backend in the app; the
fetch path is unchanged from 1dc22a37c, which was.
2026-11-01 14:33:24 +08:00
yetone 7503beee72 plugin, settings: a model's load goes past 100% for a vendor that queues (axelburks on Discord)
axelburks, on v0.1.2547: their vendor queues, so a model's load can be
past 100%, even 200%. magpie clamped every load to 100, and Busy models
last allowed 1-99 only.

- host.js reportLoad and plugin.noteLoads keep a load from 0 up. The
  floor is still 0, null still clears it, and a sanity cap of 10000
  (LOAD_MOST, plugin.LoadMost) keeps an absurd value from reaching the
  UI or the trace.
- settings.BusyLoad takes 1 to 9999 (BusyLoadMost-1). The segment
  choices stay Off/50/70/80/90, and a value set in settings.json (150)
  shows as its own choice, as before.
- The editor's badge reads "180%". It is a badge, not a bar, so nothing
  assumed 100 wide; the test checks it stays on one line.
- Docs: site plugins page (en, zh, ja) Values and Routing bullets, and
  provider-plugins.md and gateway-routing.md.

Run on mote via mote-run, on origin/main 8d8df0639+ rebased:
- go test ./internal/plugin ./internal/gateway ./internal/settings -run
  'ModelLoad|TestBusy' -v: all pass. TestPluginReportsModelLoad has
  over:250 kept and huge:1e9 at 10000. TestBusyModelGoesBehind has 180
  behind 120 at a threshold of 150, and 10000 refused.
- Broken by hand in a copy, with the old 100 clamps and the 99 limit:
  TestPluginReportsModelLoad red ("ModelLoad(over) = 100; want 250"),
  TestBusyModelGoesBehind red (150 refused).
- node --test model-load (with Queued 180% in every language, Chromium
  and WebKit, 420 and 900, plus Over 150% picked at 420) and i18n-keys:
  46/46 pass. go test ./internal/gui -run Budget: ok.
- gofmt -l: empty. GOOS=linux go vet -tags nogui and GOOS=windows go
  vet on plugin, settings and gateway: ok.

Not run before the push (owner: push and tag first): go test ./... and
the whole GUI suite. They are queued on mote behind another session's
suite.
2026-11-01 14:28:25 +08:00
yetone 788057340b library: Magpie Image Recognition in Discover beside Magpie Image and Web Search (matrix0487 on Discord, #4653)
matrix0487 asked on Discord (#feedback) for all three of magpie's own MCP
servers, image recognition, image generation and search, in the Library's
Discover. Image generation and search were there; image recognition was
an address to copy in Settings only (#4653).

- `magpie mcp vision` (browsermcp.RunVision) relays stdio to the
  gateway's /mcp/magpie/vision, as `mcp search` does. analyze_image's
  relative image path is made one in the agent's folder on the way
  (imageFrom), since the gateway can't know where the agent runs; an
  absolute path, ~, a URL or a drive goes as written.
- library: magpie-vision is a featured, opt-in server (no agents until
  picked), any binary's `mcp vision` is one server (serverKey), and it
  gets the 120s tool timeout (selfTimeout).
- Settings › Models › Images: the Image recognition row has Give agents
  Magpie Image Recognition… / Turn on the Library, none with recognition
  off or in gateway mode. The three links are one helper, libWay, used by
  Image generation and Web search too (no budget raised: core 1,533,011
  of 1,533,105).
- Never a dead tool: Discover lists all three whatever is set up, and one
  that can't answer yet says why (gateway.OwnUnready, set by
  /api/library/market/servers as `unready`): a "Not set up yet" badge on
  its card with the reason as its title, and the reason in its sheet
  (nothing set up, or turned off in Settings / Plugins). It can still be
  added; its tools already answer with the same reason until then.
- Strings in en, zh, zh-TW, ja, de; docs/subsystems/library.md.

Run, all on mote (macOS 27) through mote-run, at this head's tree
(rebased on 21882a68d):
- gofmt -l internal/: clean. go vet darwin; GOOS=linux -tags nogui;
  GOOS=windows: browsermcp, cli, library, gateway, gui, imagemcp ok.
- go test -timeout 45m: internal/library, browsermcp, cli, imagemcp ok;
  internal/gateway ok (whole package, 556s, before the rebase; OwnMCP,
  OwnUnready, VisionMCP, SearchMCP after it). internal/gui: three reds,
  none from this change, each red on origin/main 21882a68d too:
  TestSettingsSaveKeepsWhatItDoesNotSend (BusyLoad, from 8d8df0639,
  filed #4739), TestMainWindowCorners/macOS_26_SDK (#3949),
  TestColdTurnsTaken (#4510). Budget tests ok.
- New: TestMagpieImageRecognitionIsOptIn, TestVisionBridgePassesLines,
  TestImageFromLeavesTheRest, TestOwnUnreadyWhileNotListed.
- New GUI test vision-mcp-library.test.cjs: chromium + webkit, en, zh,
  zh-TW, ja, de, 1100 and 420px (link opens the sheet with its hint and
  unready line; Library off → Turn on the Library; one added opens
  Discover with all three, only the unready one badged, inside its card;
  gateway mode and recognition off show no link; no horizontal overflow,
  no page errors): 206/206 with search-mcp-library and
  images-library-way. On e84870f17 (old code), chromium: every link and
  Discover case red.
- i18n-keys, gui-de, gui-zh-tw ok; gui-ja's one red is #4580, the same
  on origin/main 21882a68d.
- Broken by hand: serverKey without "vision" → TestMagpieImageRecognitionIsOptIn
  red; imageFrom not joining the folder → both browsermcp tests red.
- Real use, sandbox HOME on mote, nogui build, `magpie serve` on
  127.0.0.1:3591: `magpie mcp vision` initialize / tools/list answered;
  analyze_image of shots/a.png says "magpie has no model that sees
  images…"; missing/b.png names /…/work/missing/b.png (relative path
  resolved); an extra argument exits 1; gateway down answers id 9 with
  "magpie isn't running, so Magpie Image Recognition can't be reached".

Not tried: analyze_image against a real seeing model through the relay
(the sandbox had no provider; the gateway path is the one /mcp/magpie/vision
already serves); a real agent adding it from Discover; WSL (unchanged,
the MCP router serves it there); the whole GUI suite, queued after
mote's running one.

Reported-by: matrix0487 (Discord)
Closes #4653
2026-11-01 14:12:42 +08:00
yetone 8d8df06399 plugin, gateway: a plugin reports its models' load, and busy models can go last (axelburks on Discord)
axelburks (Discord #feedback): an in-house vendor queues requests to
its busy models, and the plugin could only put the load in the model's
name, which changed only when magpie re-read the list.

- A provider plugin calls input.magpie.load(provider, {"<model id>":
  0-100 | null}) whenever it likes, from its own timer. host.js
  (reportLoad) clamps each number to 0-100, null clears a model, every
  other value is dropped, at most 1000 a call, and it returns the count
  taken. A provider that isn't a string or loads that isn't an object
  throws a TypeError. It goes to Go as an unasked {event:"load"}.
- internal/plugin/load.go keeps each by provider and lowercased model
  id. ModelLoad answers unknown once a load is older than LoadFresh
  (5 minutes), never idle. model@size falls back to its model.
- The provider editor shows it by the model as a grey ctx badge
  ("87%", titled "87% busy now, as its plugin says").
- Settings > Network and sharing > Busy models last (settings.BusyLoad,
  POST /api/settings/busy-load, Off by default, over 50/70/80/90% or
  1-99 by hand): restLast puts a model reported over it behind the
  ready candidates, ahead of the resting. The trace row has busy:<load>.
  At a new turn affine moves a conversation off it (Why "busy",
  busyBehind); within a turn it stays. after, readyForNew and leastHeld
  skip it. Unknown load, a lone candidate, or all busy: nothing moves.
- Docs: site plugins page (en, zh, ja) "Model load" section and input
  table; docs/subsystems provider-plugins.md and gateway-routing.md.

Run, all on mote via mote-run at a42736807's tree rebased on
origin/main b683f1c0e:
- go test ./internal/plugin ./internal/gateway -run
  'ModelLoad|TestBusy' -v: TestPluginReportsModelLoad,
  TestModelLoadGoesStale, TestBusyModelGoesBehind,
  TestBusyModelNotKeptAtNewTurn pass.
- Broken by hand, each red: host.js not sending the event
  (TestPluginReportsModelLoad "the plugin's loads never arrived"), the
  busy case off in restLast (TestBusyModelGoesBehind order), the affine
  "busy" case off (TestBusyModelNotKeptAtNewTurn "kept true, why
  session").
- go test ./internal/gui -run Budget: ok. No budget raised. app.js
  +86 bytes, two comments trimmed to fit. The settings row lives in
  plugins/gateway/settings.js.
- node --test model-load, i18n-keys, bare-ids, model-rate: 69/69 pass.
  model-load is Chromium and WebKit, 420 and 900 wide, en zh zh-TW ja
  de.
- gofmt -l: empty. go vet ./... (darwin), GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go build: ok.

Not run before the push (owner: push and tag first): go test ./...
-timeout 45m and the whole GUI suite. mote and the WSL box were each
running another session's full suite. Both run next, and any red gets
its own commit.
Not tried: a real plugin and vendor reporting load. The plugin side is
tested through the real Bun host with a plugin written in the test.
2026-11-01 13:45:40 +08:00
yetone e84870f173 plugins: an option's words in the window's language, and a filtered model list says so (plugins#590)
anewuser6937 (Discord, plugins#590) saw one model in WorkBuddy's editor
and took the plugin for broken. They had turned on "Free models only"
themselves, but its label and description read in English in the Chinese
window, and nothing by the models said the list was filtered.

A plugin option (auth.options, magpie's own field; OpenCode's AuthHook is
provider/loader/methods and never reads it) may now give `labels`,
`descriptions` and `confirms`, each keyed by the window's language
("zh", "zh-TW", "ja", "de"), beside the plain strings, as a page's
`titles` do. The host keeps only non-empty strings under language names
of 16 or less, 16 languages at most, each capped as the plain one is
(60/300/300). The editor shows the exact language, then its first part
(zh-TW reads zh), else the plain words, in the row, the hint, and the
confirm dialog and its title. `filtersModels: true` says the plugin's
model list leaves models out while the switch is on; while one is on, as
saved, the Models field says under the chips "Only some models are
listed: the plugin option “…” is on." (zh 只列出部分模型:插件选项「…」已开启。,
zh-TW, ja, de too). An older plugin shows what it showed before, and an
older magpie shows a new plugin's plain words with no note.

WorkBuddy 0.2.10 gives "Free models only" in all four languages with
filtersModels (magpie-community/plugins aec58ae, on npm: `npm view
@magpie-community/opencode-workbuddy-auth@0.2.10 --prefer-online` on mote
says 0.2.10, latest), and the mover's min is raised to it so every moved
user gets it. The CLI's `magpie plugin options` stays English, as the CLI is.

The core scripts would have gone 608 bytes over their budget; three of the
provider editor's comments in app.js are cut down instead, no raise
(1,532,865 of 1,533,105).

Run, on mote (mote-run), at this tree:
- node --test plugin-option-words.test.cjs (new): Chromium and WebKit,
  1100 and 420 wide, en/zh/zh-TW/ja/de, switch on and off: each
  language's label and description, zh-TW falling back to zh and ja/de to
  the plain words for a zh-only option, the note exactly once under the
  chips in a .hint inside the editor with no sideways scroll, none while
  off, the confirm in the language. With app.js put back: 19 of 21 red
  in Chromium (only "en off" passes, both widths).
- With plugin-options.test.cjs and i18n-keys.test.cjs, both engines:
  68 pass, 0 fail.
- go test ./internal/plugin ./internal/provider ./internal/cli: ok.
  TestPluginOptions with host.js put back: red (empty maps, FiltersModels
  false). The real WorkBuddy 0.2.10 index.mjs loaded into this host
  (a temporary test, not kept): plugin.Providers lists free_only for
  workbuddy and workbuddy-ai with all four languages and filtersModels true.
- go test ./internal/gui: TestCoreScriptBudget ok after the cut. Red,
  and red the same at origin/main ed5872d18 (run there too):
  TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestMainWindowCorners
  /macOS_26_SDK on macOS 27 (#3949); TestColdTurnsTaken red once in the
  package run and passed at origin/main (#4510, the same 0.00s red).
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.
- plugins: HOME=$(mktemp -d) bun test packages/workbuddy 303 pass 0
  fail; the new freeonly test red 2 of 2 with index.mjs put back.

Not run: the whole GUI suite. mote and the WSL box were each running
another session's full GUI suite (hours left on both), and one runs per
machine; it runs on mote once that one ends. Not tried: a real WorkBuddy
account in the real app window. go test ./... was not run.
2026-11-01 13:24:50 +08:00
yetone 32bedd44f7 gui tests: usage-range picks its days from the phone's menu, where the strip is hidden
At 390px the head hides #period behind #usageRangeMenu (the phone head commit before this). The test opens the menu and picks the range opt (its last item) or a preset (its first), and checks the menu names the days picked.

Run: usage-range on mote, both engines, en and zh: 4 of 4 pass.
2026-11-01 12:53:13 +08:00
yetone b791973354 gui tests: credit-days reads Today from the phone's days menu, where the strip is hidden
The phone head commit (usage: a phone's head is the tabs over one line
of days, sum and refresh) put a phone's days behind a menu over a hidden #period, so the
360px test's click on Today waited 5s on a hidden button in every engine
and language (10 of 10 red in the whole suite). It now checks that the menu
says Today there; a wide window still clicks the strip. On mote: 10 of 10
green.
2026-11-01 12:53:13 +08:00
yetone 6c29beba1e gui: on a phone a picker is drawn as tall as the choice beside it, and search shares a line with Export CSV
Requests' "All models" picker was 44px beside a 26px status strip, aligned
at the top, and Export CSV sat alone on its own line. A .sess-pick on a
phone is now drawn 32px and taken at 44 by its own ::after, like .segs;
the strip in the sess-tools row is 32px (28px options) and centred, and
the search field and Export CSV share the last line.

Run (mote, at this branch's head after the rebase onto 8ac1c7a56, beside
8ac1c7a56 itself): go test ./internal/gui/, and 116 GUI files (every
usage-*, view-*, *scroll*, phone-* and thumb file, Routing's rules and
the sign-in files) in both engines, concurrency 4. 1903 tests, 64 red on
the head; 1891, 64 red on main. The branch's own tests pass:
usage-phone-head in all 5 languages and both engines, usage-range,
credit-days, routing-held-dot, routing-rule-columns, segs-glide.
Red on both, each with an issue: TestSettingsSaveKeepsWhatItDoesNotSend
(#4514), TestMainWindowCorners/macOS_26_SDK (#3949), provider-typed
(#4673, filed now), tencent-cloud (#4321), usage-agents-hide (#3414),
usage-ledger Requests (#3104), mobile-web (#3952), phone-connect-menu
(#3524), menu-input-scroll (#3402), provider-levels-scroll (#4395),
view-open-wheel in WebKit under load (#4132).
Before the last three commits and the rebase, the whole GUI suite ran on
this branch: 17076 tests; the reds it alone had were routing-held-dot and
routing-rule-columns (fixed by the thumb commit), credit-days and
usage-range (the two test commits).
Not tried: a real phone; Playwright at 390 and 420px stands in for one.
2026-11-01 12:53:13 +08:00
yetone 457cfd7c63 usage: a phone's head is the tabs over one line of days, sum and refresh
The owner's pick of three phone designs (B): Usage's tabs run across the
head, and under them one line holds the days as a menu ("7 days ⌄", the
app's own menu, never a <select>), the sum, and the refresh as a dot and
its figure ("● 5s", green while live). The days strips (#period,
#sessRange, #ctxRange) are hidden behind the menu. It follows whichever
the open tab shows, and a pick clicks that strip's option, so each choice
keeps its one handler; Custom opens the range menu from the head. Each
control is drawn about 30px and tapped at 44. A desktop window keeps its
strips. The refresh keeps its own menu and
its reload icon, unlike the mock-up, which had neither.
usage-phone-head.test.cjs checks the layout, the menu and the taps in
every language and both engines at 390 and 320px, and a desktop
window at 1100px.

Run (mote, at this branch's head after the rebase onto 8ac1c7a56, beside
8ac1c7a56 itself): go test ./internal/gui/, and 116 GUI files (every
usage-*, view-*, *scroll*, phone-* and thumb file, Routing's rules and
the sign-in files) in both engines, concurrency 4. 1903 tests, 64 red on
the head; 1891, 64 red on main. The branch's own tests pass:
usage-phone-head in all 5 languages and both engines, usage-range,
credit-days, routing-held-dot, routing-rule-columns, segs-glide.
Red on both, each with an issue: TestSettingsSaveKeepsWhatItDoesNotSend
(#4514), TestMainWindowCorners/macOS_26_SDK (#3949), provider-typed
(#4673, filed now), tencent-cloud (#4321), usage-agents-hide (#3414),
usage-ledger Requests (#3104), mobile-web (#3952), phone-connect-menu
(#3524), menu-input-scroll (#3402), provider-levels-scroll (#4395),
view-open-wheel in WebKit under load (#4132).
Before the last three commits and the rebase, the whole GUI suite ran on
this branch: 17076 tests; the reds it alone had were routing-held-dot and
routing-rule-columns (fixed by the thumb commit), credit-days and
usage-range (the two test commits).
Not tried: a real phone; Playwright at 390 and 420px stands in for one.
2026-11-01 12:53:13 +08:00
yetone b1fc435407 library: Magpie Web Search, magpie's search MCP server in Library › MCP (lutra_fs)
lutra_fs on Discord: magpie's search MCP shows in Settings › Models but
not in Library › MCP servers. They were right. The gateway's web search
MCP (/mcp/magpie/web-search) was only an address to copy in Settings ›
Models › Web search. It was never a Library server, so no agent could be
given it from the Library, and the Library didn't list it.

Change:
- `magpie mcp search`: a stdio relay to the gateway's search MCP, made by
  widening browsermcp's Magpie Browser relay into a bridge with its own
  path, title and an optional session (search sends none, and has a 5
  minute client). It takes no arguments. When magpie isn't running, it
  says "Magpie Web Search can't be reached: start magpie".
- library: Magpie Web Search (magpie-web-search) is a featured,
  opt-in server beside Magpie Image and Magpie Browser. It is installed
  with no agents, so the user picks them in its sheet, and it switches
  per agent like any other row. Its command is the full binary path, and
  serverKey treats any binary's `mcp search` as the same server. Each
  agent's tool timeout is at least 120s.
- Settings › Models › Web search › MCP server: under the address there is
  a "Give agents Magpie Web Search…" link that opens its Library sheet,
  or "Turn on the Library" while the Library is off, as Images does for
  Magpie Image. Gateway mode has no link.
- The sheet's hint says where each search goes and what it costs. All
  strings are in en, zh, zh-TW, ja and de.
- docs/subsystems/library.md names magpie's own servers and the new one.
- An agent in WSL gets it through the MCP router, as Magpie Browser
  does. The image-only WSL side() is unchanged.
- The sibling, Image recognition's MCP server, is still in Settings only.
  That is filed as #4653.

Run, at this head (rebased on origin/main a6217e83d), on mote: gofmt -l
is empty. go vet passes for darwin, linux (nogui) and windows.
internal/library, browsermcp, cli and imagemcp pass. The internal/gui Go
package and the GUI files search-mcp-library, search-mcp,
images-library-way, i18n-keys, gui-ja/de/zh-tw, searcher-pick and
search-keys: 197 passed, 2 failed. The 2 reds are both known. gui-ja is
the {agent} ja string, #4580. searcher-pick's chromium en case reads a
null box: red 1 of 3 here and 2 of 3 at a6217e83d, filed as #4274.
internal/gui's three reds are red at base and filed:
TestSettingsSaveKeepsWhatItDoesNotSend #4514,
TestMainWindowCorners/macOS_26_SDK #3949 and TestColdTurnsTaken #4510.

New test: search-mcp-library.test.cjs covers Chromium and WebKit, 5
languages, at 1100 and 420px. On the old code it is red, 52 failed and
10 passed; the passes are its gateway-mode cases, which expect no link.
TestMagpieWebSearchIsOptIn and TestSearchBridgePassesLines are new too.

Broken by hand: with "search" taken out of serverKey,
TestMagpieWebSearchIsOptIn goes red (Have empty).

Real use: on mote, in a sandbox HOME, with a nogui build and the
gateway on 127.0.0.1:3611. `magpie mcp search` answered initialize with
serverInfo magpie-web-search and listed web_search in tools/list.
web_fetch https://example.com returned "Example Domain". With the
gateway killed it gave -32603 "magpie isn't running, so Magpie Web
Search can't be reached…". With an extra argument it exited 1 with
"takes no arguments".

Whole GUI suite on WSL magpie-desktop (load 120 to 180), at the
pre-rebase tree 73595f737: 17260 tests, 16684 passed, 574 failed. The
base, origin/main da0005df8, ran on the same machine: 516 failed, and
324 top-level tests were red. Each of the 161 files with a red was then
run alone on mote at head:
- At head, 118 of them pass alone. They aren't caused by this change.
- 43 fail alone at head, and every one of those also fails alone at
  base. Two pass at base once: login-import is flaky at both (#1307),
  and usage-curve-zoom-back went red once of two at base and passed 2 of
  2 at head.
  view-open-wheel was red 1 of 2 at both, filed as #4723.
- segs-press-redraw ("searchAllRow option 1") fails the same way at
  base, filed as #4566. gui-ja's {agent} string is #4580, and
  usage-ledger is #4078.
- Reds with no issue are now filed one per test: #4680 to #4728.
  Already filed: #4638 claude-mode, #4650 routing-request-model, #4176
  skeleton-bird and #1937 name-suffix-no-names.
Not tried: web_search with a real search API key (mote has none). An
agent in WSL using it directly. A run on the Windows box.
2026-11-01 12:38:01 +08:00
yetone a6217e83d3 plugins: a plugin npm said nothing of offers Install, not Coming soon (zhudabao8433 on Discord)
zhudabao8433 on Discord (#general, 11-01): PowerContext
(@magpie-community/gateway-powercontext) could be installed yesterday and
today reads 即将上线 again.

Cause: PowerContext was never pulled. It is in registry.json since
plugins 1e4c8a2 (10-29) and on the dist branch (0.2.0, every dist commit
since), and not on npm (E404), so magpie learns its version from the
dist branch's ~1.7MB index.json. Coming soon is drawn whenever a listing
has an npm answer with no version, and three paths gave one without
anything confirming the package is missing:
- builds before v0.1.2413 kept a dist read cut off at npmEach (6s) as
  "not on npm" in plugin-npm.json (ferock, e0eb74987). After an update,
  InfoCached (the listings) and Info ("what it said last") still served
  that empty answer while a new ask couldn't read the branch;
- the page turned every listing /api/plugins/npm said nothing of
  (unknown: npm or the branch not read in time) into { weekly: 0 }, i.e.
  Coming soon, and never asked again;
- /api/plugins/market gave every listing &NPM{} even when Info had no
  answer for it.

Fix:
- market.go: a cached "not on npm" over an hour old is unknown
  (npmEntry.missingStale): left out of InfoCached and of Info's seed.
  One said within the hour stands, as before.
- plugins.js: a listing npm said nothing of is marked unknown ({ u: 1 }), which
  offers Install (installDist waits for the branch with its own read);
  the page asks again up to 4 times, 15s apart, and the answer replaces
  it. A listing npm answered with no version still reads Coming soon.
- plugins.go: pluginMarketState leaves NPM nil when Info has no answer.

Old data: an old "not on npm" is unknown once an hour old, for every
user, with nothing to do on their side.

Tests:
- TestStaleMissingIsUnknownWhileDistUnread (internal/plugin): an
  hours-old "not on npm" with the dist branch 503 is in neither
  InfoCached nor Info; a minute-old one stands; once the branch answers,
  Info has 0.2.0.
- plugin-npm-unknown.test.cjs: PowerContext with no npm answer shows
  Install (enabled), Qoder answered without a version shows Coming soon,
  and after the 15s re-ask (page.clock) PowerContext shows v0.2.0. en,
  zh, zh-TW, ja, de; 980 and 420px; Chromium and WebKit.

Run (mote, at this commit rebased on origin/main 36af588e2):
- gofmt -l clean; go vet darwin, GOOS=windows, GOOS=linux -tags nogui on
  ./internal/plugin/... ./internal/gui/...: ok.
- go test -count=1 -timeout 45m ./internal/plugin/...: ok.
  ./internal/gui/...: TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  TestMainWindowCorners/macOS_26_SDK (#3949) red, the same on an
  origin/main 36af588e2 copy; TestCoreScriptBudget green (plugins.js is
  1 byte under main's, a comment cut, no raise).
- node --test plugin-npm-unknown (22/22), plugin-market, i18n-keys: ok.
  plugin-market webkit "the Plugins tab" was red once in the run after
  the Go suite, its output lost; 3 of 3 green after, alone.
- Broken by hand: the Go test is red on origin/main's market.go (an
  hours-old "not on npm" served; want it unknown); plugin-npm-unknown is
  red (waits for Install) on origin/main's plugins.js.
- Earlier GUI batch (70 files: plugin*, market*, i18n*,
  deprecation-notice, list-sort), before the rebase: 968/974; the reds
  are plugin-move-unserved (#4410, #4392, red the same on main) and
  plugin-github-filter chromium en 420px, batch only (#4679).

Not tried: a real slow network from China; zhudabao8433's version is not
known.
2026-11-01 12:12:05 +08:00
yetone 445891cf74 gui: Insights › Masking keeps to the window's page width, centred, like every other page
refeccd on Discord (#feedback, 11-01): with the window maximised every
page sits in the middle at a fixed width, but Masking (脱敏) runs edge to
edge. The width cap is one rule in app.css that lists the pages by id
(body.window :is(#view-agents, …) { padding: max(16px, 50% - 600px) }).
Masking became a page of the redact plugin (#view-masking, kernel.js)
after that list was written and never joined it. Now it does. The cap
itself is unchanged.

Siblings: every page the sidebar opens (agents, sessions, library,
providers, routing, gateway, usage, masking, plugins) and Settings was
checked against the list; Masking was the only one missing. A community
plugin's page (.view.plugin-page) is a frame the plugin draws and is
left as it is.

The test: page-width.test.cjs no longer keeps its own list of pages. It
reads every page from the sidebar (#nav button[data-view], not a
community plugin's), plus Settings, and requires Masking among them, so
a page added later is held to the same width without the test knowing
it. It now also runs every language at 420px besides en/zh-TW/de at
1920, zh/ja at 2560 and en at 900.

Run (mote, macOS 27, Playwright 1.62.0, Chromium and WebKit):
- page-width.test.cjs on origin/main 6f3dfc282's CSS: red, "masking:
  1676 wide at 1920" and "masking: 2316 wide at 2560" in every language,
  both engines (12 pass, 12 fail). With the fix: 24 of 24 pass.
- Together, with the fix: page-width, page-width-steady, i18n-keys,
  click-scroll and every mask*/masking*/redact*/window-mask/
  routing-masking/provider-mask/provider-unmasked/account-mask/
  plugin-name-unmasked file: 602 tests, 591 pass, 11 fail. The 11 are
  page-width-steady's "opening an agent's details past the window moves
  nothing sideways", which fail the same 11 with the file run alone on a
  clean origin/main 6f3dfc282 copy on mote (#4541, filed for Linux; a
  comment now says it is red on macOS too, in both engines).

Not run: the whole GUI suite and go test ./... (a CSS rule for one
page's padding; no Go, no JS, no shared class or breakpoint changed),
the real app on a maximised screen.
2026-11-01 11:57:54 +08:00
yetone 90c02326bb gui: an app takes the gateway over from its older copy once idle, and says any other version serving it (matrix0487)
matrix0487 on Discord: after an update, pi said 404 'magpie knows no
model "kimi/k3.1-pro" ... add a provider in magpie first'. The app had
written pi a model its older gateway didn't know, and updating the
gateway fixed it. A magpie that finds another one serving the gateway
used to log it and wait for that one to quit (watchGateway took the
port only once nothing answered). Only the Gateway page said so.

Now (otherServes, gateway_older.go):
- An older released copy of the app (it says serves app or tray, and a
  pid) is this app's predecessor. Once its /v1/magpie/concurrency says
  nothing is in flight (gateway.ServedBusy; unknown is never idle),
  the app quits it the way the Gateway page's button does
  (quitMagpieOnPort: a magpie only, by its program) and serves the
  gateway. A stream through it runs to its end first. watchGateway
  looks again every 15s while another serves. At most three times a
  run; a quit that fails is left to the button.
- Any other one (magpie serve or the service, magpie web, a TUI, a
  newer magpie, a build of its own) is left running. /api/state
  carries it as gatewayOther, and the Agents page says it above the
  list with what to do, plus the take-over button for an older one
  (gatewaySkewLine, in plugins/gateway/client.js so app.js stays under
  its budget). A dev build of this magpie says nothing. New strings in
  zh, zh-TW, ja and de.

How the reporter's older gateway outlived the update isn't known: they
never said whether one ran separately. A failed handover leaves the
old app serving for up to 15m, and a magpie serve left running is
another source. Both are covered now: the first is replaced, and the
second is said.

Known gap: a request that starts between the idle read and the quit
gets the older app's short drain. A socket handover between two
running apps (no gap) is not built.

Run on mote at 0f8ea30bb (this change on 2b067434d):
- go vet for internal/gui and internal/gateway, also GOOS=linux
  -tags nogui and GOOS=windows; gofmt -l clean.
- go test -count=1 -timeout 45m ./internal/gui ./internal/gateway:
  gateway ok. gui has two reds, the same on origin/main 0c3163804:
  TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  TestMainWindowCorners/macOS_26_SDK (#3949).
- GUI subset, Chromium and WebKit: gateway-*, agent-layout, agents-*,
  getting-started, i18n-keys, gui-ja/de/zh, panel-arrange, panel-fold:
  411 pass. Two reds, the same on origin/main 0c3163804:
  gateway-caller-keys chromium en (#3797) and gui-ja (#4580). Passing: the new gateway-skew.test.cjs (en and zh at 380px, the
  button POSTs take-over and the line goes).
- Real app on mote, sandbox HOMEs, port 3591, update feed pointed
  nowhere:
  - origin/main built as 0.1.2400 ran `magpie app`, and this head
    built as 0.1.2500 ran `magpie app` beside it. The new one logged
    "an older copy of this app ... with nothing in flight; quitting
    it" and served 0.1.2500 on the port 2s later. The old process was
    gone.
  - The same with the old one as `magpie serve`: it was left running,
    and the new one logged that it serves, older.

Red on origin/main: TestAppReplacesItsOlderGatewayOnceIdle ("the
older copy of the app still serves the gateway", 17s).

Again at the pushed head (this change on 6f3dfc282, mote): vet darwin, linux
nogui and windows; TestCoreScriptBudget (the core is 1,533,104 of
1,533,105: main's #4652 took the room, so app.js's hook line lost its
comment, no raise), TestAppReplacesItsOlderGatewayOnceIdle,
TestGatewaySkew*, TestGatewayFixQuitsOnlyAMagpie,
TestGatewayServedByAnOlderMagpie: ok. gateway-skew, i18n-keys, gui-zh,
gui-de: 11 of 11 pass.

Broken by hand, each red:
- quit without waiting for idle: "quit with a request in flight"
- replaceable() false: "still serves the gateway"
- any serves replaceable: TestGatewaySkewOfAnotherIsSaidNotQuit, the
  serve holder quit
- the Agents hook removed: gateway-skew.test.cjs red in both langs

Not tried: the whole GUI suite (mote was running another session's
full suite), a real app with a real agent stream in flight during the
take-over (the Go test holds a stream through a fake), Windows and
Linux apps (the replace path needs handoverHost, set by the app's Run
on every OS, but it was tried on macOS only).
2026-11-01 11:43:56 +08:00
yetone 4794767846 routing: back on Routing from another page, the page isn't laid out and drawn again whole (#4652)
xisdumpling (dumplings04605 on Discord), Windows, 0.1.2507: with a
history day of 180 to 298 requests picked, coming back to Routing
stalls the page and the sidebar's highlight. Measured first, with
routing-return-cost.test.cjs (250 rows, a picked day, a request's story
open), which counts what the return does, not how long it takes.

Causes found, each fixed and each red by hand when put back:
- The request list was windowed only from 300 rows, so a day of 180 to
  298 had every row in the page. Now from 100 (WIN_MIN); the live list
  keeps 60, so it is never windowed.
- Out of sight a view is 0 wide. The ResizeObservers in the routing
  client (byWidth, the meta width) and context.js's card sizes took that
  as narrow, flipped the narrow layouts while away and flipped them back
  on return. A 0 width now keeps the layout it had.
- A hidden list re-windowed itself for a 0-high view, so the return
  placed rows and ran metaFit again. It keeps its window while hidden.
- resume rebuilt the whole stage on return. sync("back") rebuilds only
  when what the stage was built from (route, pin, day, purpose, lang,
  the requests and their accounts) changed, and records it after the
  rebuild.
- The visibility observer's group reload was not quiet and redrew the
  groups. It is quiet now.
- A providers refresh while on Routing redrew the hidden Providers page.
  It is read and drawn when Providers opens (providersBehind).
Not a cause: the nav highlight's rAF reading offsetTop only waited on
the busy main thread; it is one small layout now.

Before and after, the "back on Routing" step (Chromium layout metrics
from CDP; class flips and redraws from MutationObservers, both engines):
- mote, macOS: 25 layouts / 34.9ms of layout, 24 class flips, Providers
  redrawn 13 nodes, groups 4, stage kept 0 of 3, 250 rows, 7818 nodes
  -> 9 layouts / 3.2ms, 0 flips, 0, 0, 3 of 3, 11 rows, 1367 nodes.
- Windows (xiaomi-gpu, win-run): 25 layouts / 146.4ms, 24 flips
  -> 9 layouts / 7.1ms, every check passes. WebKit's counts match.
The test asserts no flips, no redraws, the stage kept, under half the
rows in the page and at most 12 layouts; wall time is logged, not
judged. The page looks the same: no CSS or markup change.

Run:
- routing-return-cost: red on origin/main 8ac1c7a56 in both engines,
  green with this on mote and on Windows (win-run), both engines.
- Broken by hand, each red: the byWidth 0 guard, the meta width guard,
  the hidden drawList return, sync("back"), the quiet group reload, the
  Providers deferral, WIN_MIN back at 300, and context.js's cardSizes
  guard (seen through the ctx-card).
- go test ./internal/gui -run Budget on mote: ok, no budget raised.
  Rebased on 2b067434d the core was 278 bytes over its 1,533,105; this
  change's comments and renderProviders' scroll comment were cut to
  1,533,072, app.js 1,311,935 of 1,316,874.
- All 142 routing*.test.cjs files on mote, both engines, every
  language, concurrency 3, at load 40 to 70 from other sessions: 2052
  tests, 29 red in 9 files. Each of those files run serially at origin/main
  and with this shows the same reds (rule-drag, rule-remove, row-swap,
  order-unknown: #3789, #3096, #3094, #3799, #4585, #4494), and so do
  steady, steps-cap and story-shrinks (#3412, #4585); rules-line's
  webkit de 1100 went red once with this only (#4585, #4560).
- purpose-filter (108 rows, windowed now): 14 of 14.
Not run: the whole GUI suite. mote had another session's full suite and
several more runs at load 60 to 75 the whole time; it runs after the
push and its result goes on #4652.
Not tried: the real Windows app; only Playwright on the Windows box.
2026-11-01 11:24:02 +08:00
yetone 784b66366f gui: Settings opens after Codex's row on the Agents page was opened and shut (ysm119)
ysm119 on Discord (v0.1.2519, macOS): opening Settings showed
"null is not an object (evaluating '$(row + ".who").title = t(en)')".

Cause: an opened agent row borrows its settings rows (AGENT_PREFS,
f1e4516da) from #agentPrefRows. Shutting the row, or any redraw that
leaves no row open, drew the list again with replaceChildren(), and
the borrowed rows went out of the page with the old row. Nothing put
them back until something called homeAgentPrefRows, so renderSettings'
tooltip loop found no #codexTitlesRow, and translateStatic (a language
change) missed their text too.

Fix: renderAgents and renderAgentsLoading put the rows home right after
clearing the list, so they are never out of the page; a row opened
again takes them as before. Codex's rows' tooltips are set in
renderAgentPrefs, which homes them first and owns them; Settings sets
only Open at login's. Siblings checked: every other reader of these
rows (renderAgentPrefs, renderAgentPrefLinks, renderCodexMemories,
renderCodexSubagentModel, agentPrefsButton, connectPanel,
openAgentPrefs and its MutationObserver) already homes first.

Test: agent-prefs.test.cjs "Settings opens after Codex's row was opened
and shut", Chromium and WebKit, en/zh/zh-TW/ja/de, 1100 and 440: open
Codex's row, shut it, the rows are in the page, Settings opens from its
button with no error and the titles row's tooltip in the language.

Run (mote):
- On origin/main da0005df8 without the fix: 20/20 red, "codexAgentsV1Row
  in the page once shut"; with that check off, WebKit fails with the
  reporter's exact text and Chromium with "Cannot set properties of
  null (setting 'title')".
- Broken by hand (renderAgents' homing taken out): red again, same
  message, both engines.
- Before rebase, 89 files (agent-*, codex-*, settings-*, i18n-keys,
  gui-de/ja/zh-tw, menu-scroll, text-size), concurrency 4: 1465 tests,
  1432 pass, 33 fail: agent-panel-name-width's 32 (red on pristine
  origin/main f435aadbf too, 0/32; #4203, commented) and gui-ja's
  ja-has-every-zh-string (red on main, #4580).
- At the pushed head (rebased on fb3942ee6): agent-prefs, codex-titles,
  codex-memories-settings, settings-general, settings-search,
  i18n-keys, gui-zh-tw/de/ja: 125 tests, 124 pass, 1 fail (#4580).
  go test -run TestCoreScriptBudget ./internal/gui: ok (app.js
  1,311,806, core 1,532,895, no budget raised; comments kept short).

Not run: the whole GUI suite and go test ./... (JS-only change;
another session's full GUI suite was on mote); the real app.
2026-11-01 11:14:22 +08:00
yetone 9162277b91 routing: Until used up stays on the next account once the first is used up (dzxx0496)
dzxx0496 on Discord: with free accounts one after another, the first used
up, requests went to the second; when the first renewed they went back to
it ("如果第一个恢复了,它又优先用第一个了"). No routing did what they asked:
In order and Smart both put the first back first.

A new routing, Until used up (drain, 用完再换): requests stay on one seat
until its quota is used up, then go on to the next in the list and stay
there. A seat counts as used up when its known allowance is at 100% or
it was refused for quota or credit (failQuota / failCredit, routes.Drained
called where the rest is recorded, so a failover inside one request moves
the pool too). A rate limit or other failure only passes it over while
it rests, as In order does. Each pool (a provider, a group/<id>) keeps its
own place; routes.Forget clears it.

Offered wherever a routing is picked: the provider editor, a group's row
menu and editor (app menu, no native select), the TUI, `magpie group set
<id> routing=drain` and a provider's routing=drain. Nothing defaults to
it, so no saved setting changes. SpentShareOf is 100 for it, as for In
order. Words in en, zh, zh-TW, ja and de (i18n.js and the routing
plugin's own), docs/subsystems and the site's start page (en, zh, ja).

Tests:
- internal/routes/drain_test.go: stays on the next when the first renews,
  through a rate limit, all used up, a seat gone, per pool, Forget,
  Drained after a renewal.
- internal/gateway/drain_test.go: a real request path with a fake upstream;
  k1 refused for quota, k2 takes over, k1 renews: drain stays on k2,
  In order goes back to k1. Red without the Drained hook (request 3 went
  to k1). A rate limit comes back to k1; drain is saved on a provider and
  a group.
- routing-drain.test.cjs: the Routing page's why and mode line in 5
  languages, 1100px and 420px, Chromium and WebKit; red on the old assets
  (20 of 20).
- routing-group-strategy, routing-save, builtins: the menu has 11 routings.

Run on mote (macOS) at origin/main 699ddf152 with this commit and its
two neighbours (nb5p chip, dzxx0496 renewal, dzxx0496 Until used up).
Pushed on b2145eac1, whose five commits since change app.css and app.js
only for a key row's chips; at the pushed tree gofmt, the gui, routes
and gateway vets (Linux nogui, Windows), TestCoreScriptBudget (core
1,532,891), the Drain Go tests and 11 GUI files (gateway-model-chip-
height, routing-drain, routing-renews-stay, routing-behind-why,
routing-group-strategy, routing-save, builtins, i18n-keys, gui-de,
gui-zh-tw, key-row-chips-fit) were run again: 190 of 190 ok.
- gofmt -l clean; GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./... and go vet ok.
- go test internal/routes, internal/gateway, internal/provider,
  internal/cli, internal/tui, plugins/rotation: ok; internal/gui's
  TestCoreScriptBudget ok (core 1,532,816 of 1,533,105).
- GUI: routing-*, builtins, gateway-model*, model-chip*, i18n-keys,
  gui-* and codex-credits-last in both engines: 2211 tests, 68 red,
  none new: model-chip-steady 20 (#4388), gui-ja's {agent} string
  (#4580), and 11 routing-* files under load (#4585, #3789, #3799).
  The same 11 files run alone at cdfdb62c6 were 32 of 116 red, and 26
  with the stack, the same tests but rule-remove, whose red languages
  vary run to run (9 cases, then 5). model-chip-steady was 20 of 20 red
  at cdfdb62c6 alone.
Earlier, at f811bf291 with the stack: go test -timeout 45m ./... had 82
packages ok, internal/gui red only on
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949). The whole GUI suite had 301
of 16930 red in 52 files. Those 52 files rerun had 272 red with the
stack and 276 at f811bf291 alone, the same tests.
2026-11-01 09:53:50 +08:00
yetone 72114566bf routing: an account's row says when it renews whatever it is doing (dzxx0496)
dzxx0496 on Discord asked for the reset time to stay on ("额度恢复时间能不能
常驻"). On the Routing page's stage a known allowance's row said when it
renews only while idle; answering, answered, kept for last or passed
over, the row's status took its place and the time was gone. It now
follows every such status ("· renews in 5 h 5 min"), once. A resting
row still says when it is back instead, a free model has nothing to
renew, and a status that already says it is not told twice.

routing-renews-stay.test.cjs: a request in flight over three known
accounts, one answering, two passed over; each row says its own renewal
once, in en, zh, zh-TW, ja and de, at 1100px and 420px, in Chromium and
WebKit, with no overflow. routing-behind-why.test.cjs's expectations
now carry the renewal on its answered and kept rows.

routing-renews-stay.test.cjs is 2 of 2 red on the old assets. Its
first row and routing-behind-why's answered row renew in 12 h 5 min:
under 10 h the time shows minutes, and a slow run turned 9 h into
8 h 59 min. With the fixtures' clock held back 2 minutes the old
values were 40 of 64 red, these 64 of 64 green.

Run on mote (macOS) at origin/main 699ddf152 with this commit and its
two neighbours (nb5p chip, dzxx0496 renewal, dzxx0496 Until used up).
Pushed on b2145eac1, whose five commits since change app.css and app.js
only for a key row's chips; at the pushed tree gofmt, the gui, routes
and gateway vets (Linux nogui, Windows), TestCoreScriptBudget (core
1,532,891), the Drain Go tests and 11 GUI files (gateway-model-chip-
height, routing-drain, routing-renews-stay, routing-behind-why,
routing-group-strategy, routing-save, builtins, i18n-keys, gui-de,
gui-zh-tw, key-row-chips-fit) were run again: 190 of 190 ok.
- gofmt -l clean; GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./... and go vet ok.
- go test internal/routes, internal/gateway, internal/provider,
  internal/cli, internal/tui, plugins/rotation: ok; internal/gui's
  TestCoreScriptBudget ok (core 1,532,816 of 1,533,105).
- GUI: routing-*, builtins, gateway-model*, model-chip*, i18n-keys,
  gui-* and codex-credits-last in both engines: 2211 tests, 68 red,
  none new: model-chip-steady 20 (#4388), gui-ja's {agent} string
  (#4580), and 11 routing-* files under load (#4585, #3789, #3799).
  The same 11 files run alone at cdfdb62c6 were 32 of 116 red, and 26
  with the stack, the same tests but rule-remove, whose red languages
  vary run to run (9 cases, then 5). model-chip-steady was 20 of 20 red
  at cdfdb62c6 alone.
Earlier, at f811bf291 with the stack: go test -timeout 45m ./... had 82
packages ok, internal/gui red only on
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949). The whole GUI suite had 301
of 16930 red in 52 files. Those 52 files rerun had 272 red with the
stack and 276 at f811bf291 alone, the same tests.
2026-11-01 09:53:50 +08:00
yetone 4464a304fd gui: a model row's image chip is as tall as its other chips (nb5p)
nb5p on Discord: on the Gateway page's model list the image chip at a
row's end stood shorter than the reasoning chip ("低–ultra") and the
context chip ("272K"). The text chips are inline-flex with a 16px line;
the image chip holds only the 11px glyph (display:block), so it was 11px
tall. It now takes the text chips' 16px as its height.

modelInfo() is the one renderer of these chips. Its two callers, the
Gateway's model list and the routing group editor's member rows, share
the selector the fix is on. The provider editor shows images as a
checkbox and the Agents page and pickers show no such chip.

gateway-model-chip-height.test.cjs measures every chip of every row in
en and zh, light and dark, at 900px and 420px, in Chromium and WebKit:
same height, same centre line.

gateway-model-chip-height.test.cjs is red on the old CSS (the image
chip 11px against 16px) and green with it.

Run on mote (macOS) at origin/main 699ddf152 with this commit and its
two neighbours (nb5p chip, dzxx0496 renewal, dzxx0496 Until used up).
Pushed on b2145eac1, whose five commits since change app.css and app.js
only for a key row's chips; at the pushed tree gofmt, the gui, routes
and gateway vets (Linux nogui, Windows), TestCoreScriptBudget (core
1,532,891), the Drain Go tests and 11 GUI files (gateway-model-chip-
height, routing-drain, routing-renews-stay, routing-behind-why,
routing-group-strategy, routing-save, builtins, i18n-keys, gui-de,
gui-zh-tw, key-row-chips-fit) were run again: 190 of 190 ok.
- gofmt -l clean; GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./... and go vet ok.
- go test internal/routes, internal/gateway, internal/provider,
  internal/cli, internal/tui, plugins/rotation: ok; internal/gui's
  TestCoreScriptBudget ok (core 1,532,816 of 1,533,105).
- GUI: routing-*, builtins, gateway-model*, model-chip*, i18n-keys,
  gui-* and codex-credits-last in both engines: 2211 tests, 68 red,
  none new: model-chip-steady 20 (#4388), gui-ja's {agent} string
  (#4580), and 11 routing-* files under load (#4585, #3789, #3799).
  The same 11 files run alone at cdfdb62c6 were 32 of 116 red, and 26
  with the stack, the same tests but rule-remove, whose red languages
  vary run to run (9 cases, then 5). model-chip-steady was 20 of 20 red
  at cdfdb62c6 alone.
Earlier, at f811bf291 with the stack: go test -timeout 45m ./... had 82
packages ok, internal/gui red only on
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949). The whole GUI suite had 301
of 16930 red in 52 files. Those 52 files rerun had 272 red with the
stack and 276 at f811bf291 alone, the same tests.
2026-11-01 09:53:49 +08:00
yetone 54087aa43d providers: a key's chips keep their whole text; what ends its row goes under it when it doesn't fit (young02036)
young02036 (Discord #feedback, zh, Windows) had a Remote magpie key row whose
models chip「全部模型」was squeezed to「全」. The row also showed the protocol
pick and the actions (停用 移除 设为首选). Now only the name and the masked key
shrink. Every chip and button keeps its whole text. Switch off/on, Remove and
First/Make first are held together in one .key-acts group at the row's right.
When they don't fit, the group goes onto its own line, still at the right.

A press there now keeps its row open (`held`) through the redraw the press
brings, until the pointer moves off the row. Without that, a wrapped row
drawn again after a click goes back to one line, slips out from under the
pointer, and hides the button that was pressed. key-switch.test caught this
at en/ja/de 900px. WebKit gets plain `:hover`/`.held` selectors, not
`:is()`/`:not()` lists.

Trade-off: in a narrow card, a hovered key row grows by one line.
Not changed: account rows, which use the .acc-line/⋯ layout, and the
gateway's caller-key rows, which ellipsize on purpose.

New test: tests/key-row-chips-fit.test.cjs, 60 cases (2 engines x zh, en,
ja, de, zh-TW x 6 widths down to 390px). It checks that no chip or button
of a key row is cut, and that the actions stay on one line at the right.

Run:
- key-row-chips-fit + key-switch, Chromium and WebKit on Linux (WSL
  magpie-desktop): 40/40 each. key-row-chips-fit on mote: 60/60; on
  Windows (xiaomi-gpu): 30/30.
- Whole GUI suite, WebKit, on mote at this commit (another session's suite
  ran there too, load 55 to 160): 8663 tests, 8489 pass, 174 fail, in 50
  files. Each red file was then run alone at origin/main 20482d71f and at
  this commit, back to back, one at a time: base 570/419 pass/151 fail,
  head 570/414/156. 41 files are red on both sides, and 2 more
  (menu-input-scroll, routing-upstream) only at head. The 4 files whose
  tests differed (context-map, menu-input-scroll, routing-rule-remove,
  routing-upstream) were run twice more on each side: base 15/15 fail,
  head 13/15 fail. None of the reds is in a key row.
- Whole GUI suite, Chromium, on mote at this commit: 5092 top-level
  results before mote went down mid-run (load ~200, "Connection to mote
  closed by remote host"; from sessions-convert on, every test read
  "browser has been closed"). After mote came back, the 30 files red
  before the drop, plus every file from sessions-* on (273 files), were
  run again: 2320 tests, 2194 pass, 126 fail, in 30 files. Those 30 were
  run alone at 20482d71f and at this commit: base 251/123/128, head
  251/126/125, the same files with the same counts, give or take one
  flake. The one red only at head, searcher-pick, went red 2 of 3 times
  alone at base and 0 of 3 at head (#4274).
- Rebased on origin/main fa4704f06 (126 commits later). At this commit:
  TestCoreScriptBudget ok, under 1,539,856 (two comments in
  renderKeyAccounts trimmed, no budget raised). key-row-chips-fit,
  key-switch, key-weight-fit and i18n-keys: 52/52 in Chromium and 52/52
  in WebKit.

Reds at both base and head (WebKit, Chromium), with their issues:
model-chip-steady #4388,
agent-panel-name-width #4203, usage-agents-hide #3414, segs-press-redraw
#4566, provider-fetch-again #3292, routing-rule-remove/rules-line/
story-shrinks/steps-cap/steady/row-swap/order-unknown/upstream #4585
#3954 #4628 #3412 #3799 #4627, page-width-steady #4541, rest-try-now #4127,
recovered-file #4320, mobile-web #3952, key-replace #4126, models-works-only
#4391, warm-now #4322, usage-ledger #1948, remote-magpie #4398, omarchy
#4624, tencent-cloud #1579, s3-sync #3413, provider-typed #4461,
provider-picks-stay #4397, provider-models-rest #4396, plugin-move-unserved
#4392, plugin-card-update #3079, phone-connect-menu #3524, models-fold #4071,
model-copy-id #4621, context-map #3488, provider-levels-scroll #4395,
nav-timeout #4622, header-centre #3479, gui-ja #4580, gateway-key-models
#4616, gateway-caller-keys #3797, i18n-keys #4524 (green at fa4704f06),
menu-input-scroll #3402, models-select-all-api #4389, routing-rule-drag
#3789, routing-many-keys #4082, searcher-pick #4274, account-weight #4644
(filed with this change). The whole-suite umbrellas are #4471 (WSL)
and #4431 (WebKit on Windows).

Broken by hand:
- With the old app.css/app.js, key-row-chips-fit is 50/60 red: "amodels
 「全部模型」is cut (14 of 58px)". The 10 passes are the 420px phone
  tab cases, where the old row already wrapped.
- With `if (keyHeld === k.id) row.classList.add("held"), ` replaced by
  `if (0) `, key-switch en/ja/de 900px go red ("Switch off" hidden).

Not tried: the real Windows app with a real Remote magpie, Linux WebKitGTK
in the real app, and the account and gateway-key sibling rows, which are
not changed.
2026-11-01 09:42:05 +08:00
yetone 699ddf1524 gateway: a Codex account can spend its credits only after every other account, key and fallback (gokoshiki on Discord)
gokoshiki wants a Codex subscription first, then an OpenAI API key, then
the subscription's credits. Until now an account at 100% that holds
credits either kept its place and spent them there (on) or was held
(off). This adds a third way per account, "last":

- settings: CodexCreditsLast []string, empty by default, so a setting
  saved before it keeps its order. provider.CodexCreditsLast,
  CodexCreditsMode and SetCodexCreditsMode(user, on|last|off);
  SetCodexCredits(on) still means "in its place" and clears last.
- gateway: candidate.creditsLast is true for such an account once a
  window for the model is used up and it is going on its credits (a
  call ChatGPT counts in no window stays in its place). restLast orders
  ready, then resting, then those, and marks Weighed.CreditsLast.
  restLast runs over the asides too, so such an account goes behind a
  provider's reserves (Accounts at once, 2c6b7c063) as well.
  lastBehind keeps In turn's next turn (after), a new conversation's
  spread (leastHeld) and a subagent's lead (readyForNew) from bringing
  it forward, and a kept conversation moves off it to one not on its
  credits (Affinity.Why "credits").
- CLI: magpie quota credits <account> [on|last|off]; alone it lists
  accounts set off and last.
- API: POST /api/settings/codex-credits takes {user, on, last?}.
- GUI: under a Codex account's Use credits, while on, a second switch
  "Only after every other account, key and fallback", in the Usage
  page's card and the tray panel's (both wrap it to its own line at 360
  to 900px), and the panel's folded brief says "On, after everything
  else". The Routing page's trace says why such an account is behind
  (aside, the kept conversation's why, the row tag). zh, zh-TW, ja, de.
  creditsButton and the new switch share creditsSwitch, and the Codex
  options' comments in app.js were cut, so the core budget holds with
  no raise (1,532,664 of 1,533,105).
- docs: reference.md (quota credits) and gateway-routing.md.

Tests:
- gateway: TestCodexCreditsLastAfterTheOthers (two accounts, In order:
  the one at 100% on its credits goes behind, the trace says so, and
  back in place when turned on), TestCodexCreditsLastAfterTheFallback
  (both accounts at 100% and set last: the API key the provider falls
  back to answers before either one's credits; with the credits in
  their place an account answers on them, as before),
  TestCodexCreditsLastNotKept (a kept conversation moves off it).
  All three red with creditsLast and lastBehind forced false.
- provider: TestCodexCreditsLastMode.
- gui: settings_keep_test carries CodexCreditsLast;
  tests/codex-credits-last.test.cjs (Chromium and WebKit, en zh zh-TW
  ja de; Usage at 900 and 440, the panel at 440 and 360, the folded
  brief, the Routing page's aside and why, every key in I18N). Red on
  the old assets (no .ar-credits-last).

Run at this change on origin/main c76bcaea7, on mote (pushed on fd70def82, whose
one commit since, fd70def82, changes only the Providers poll's Go
files in internal/gui):
gofmt clean; go vet of gateway, provider, gui, cli and settings ok;
their tests ok but internal/gui's #4514 and #3949, both on main. The
8 commits between d6aa9cdf6 and c76bcaea7 touch none of this
change's files.

Run at this change on origin/main d6aa9cdf6, Go 1.26.8:
- mote: gofmt -l clean; go vet ./..., and GOOS=linux and GOOS=windows
  go vet -tags nogui ./...: ok. go test -count=1 -timeout 45m ./...:
  85 packages ok; internal/gui red only on TestSettingsSaveKeepsWhatIt
  DoesNotSend's SearchAll (#4514), TestMainWindowCorners (#3949) and
  TestColdTurnsTaken (#4510), all three on main. TestCoreScriptBudget
  passes.
- WSL magpie-desktop, Playwright 1.62.0, both engines: codex-credits*,
  i18n-keys, gui-ja, gui-zh-tw, panel-options-fold, provider-at-once and
  every routing-* file: 2127 tests, 2064 pass. Every codex-credits and
  codex-credits-last test passed (26). The red files (gui-ja, 19 routing
  files) run again at this tree and at d6aa9cdf6, alike: 200 tests, 61
  and 57 red. gui-ja is #4580; the routing reds are timeouts and
  waits, on both. The one file red at this tree only,
  routing-request-model (WebKit 420px "the model is cut"), is 5 of 5
  green alone at both, and with six copies at once red at both (29 and
  27 of 30 here, 28 and 27 of 30 at d6aa9cdf6): a fixed 150ms wait
  after a resize, filed as #4650. Nothing this change adds to Routing
  draws unless an account is set last (fixtures don't).
- Earlier, at 3564eb04b (this change on 7428f3229), WSL: the whole GUI
  suite beside two other sessions' suites, 16944 tests, 16496 pass;
  its 102 red files again at that head and at 7428f3229, 444 and 425
  red. The files red at the head only, run alone: view-open-wheel,
  usage-accounts, add-button, usage-ledger-open-settled 0 red;
  view-wheel-after-click, view-wheel-unheard and context-map (#3488)
  red alone at 7428f3229 too. mote, the credits and i18n files: 172 of
  174, the two #4580 and a click timeout in quota-curve at load 148
  (alone 30 of 30).

Not tried: a real ChatGPT account at 100% with credits beside a real
OpenAI key; the order is shown with the gateway's fake Codex backend.
2026-11-01 09:08:07 +08:00
yetone b9ad353dbe gui tests: editor-advanced-align measures the editor drawn last, once its observer has seen it
Red in a whole GUI suite run on Linux and alone on mote, about 1 run in
8 at the accounts-at-once head (4 of 33), 0 of 31 at main 41b5c0f19:
"ja 1000: Advanced starts at 292, its fields at 364", "zh web 390:
Advanced starts at 106, its fields at 20". Each miss is the 86px
fallback of --ed-at: the editor was drawn again between two frames,
and the test measured the new details before edAlign's ResizeObserver
had run for it. The user never sees that state, since the observer runs
before the frame is painted. The test now waits until the current
details has --ed-at, then two frames, then measures.

Run on mote: head with this change, 20 runs alone, 0 red. Broken by
hand (--ed-at 30px too far): red in both engines at en 1000.
Not tried: why the accounts-at-once change makes the redraw land
between frames more often; the extra field is inside the folded
Advanced.
2026-11-01 07:39:08 +08:00
yetone 2c6b7c0632 gateway, provider, gui: Accounts at once keeps the first N accounts taking requests, the others in reserve
01huadalang on Discord (#feedback 1566170404542742740): three ZCode
accounts used at once from one address got the address refused with a
405; two were served. They asked for one account to be used until it
runs out, then the next. Even under "In order", ZCode's maxConcurrency 3
spilled a full lane onto the next account (laneMate) and rests spread
the load, so every account was in use at once.

A provider's MaxAccounts (the editor's Advanced → "Accounts at once",
beside Concurrency; `magpie provider at-once <id> [n|off|default]`) is
how many of its accounts or keys take requests at the same time.
provider.AtOnce() is the user's own value, else what its plugin
declares (maxAccounts on the auth hook or package.json magpie, read by
host.js atOnceOf), else no limit; the user's 0 is no limit over the
plugin's. perKeyBarred keeps the first N in the user's own order
(rank), preferring ones not resting, and keepAtOnce puts the rest after
everything as asides with candidate.reserve (Weighed.Reserve). So in any
routing mode a reserve is asked only once the kept ones failed or rest,
and a kept one that rests gives its seat to the first reserve next time.
Guards: laneMate never spills onto a reserve; a full queue (laneErr)
drops the provider's reserves (dropReserves) and turns the request away
with the 429; session affinity moves a conversation off a reserve once
the kept ones can take it (affine "reserve"; Strict still holds).
Routing says "in reserve · {n} at once" on the row and why in the
request's story. zcode 0.1.40 (plugins 26864ec, on npm) declares 2, and
its mover min is raised to 0.1.40 two commits on.

Known leak, in docs/subsystems/gateway-routing.md: a failure that rests
nobody (a 5xx on one try) still passes that one request to the reserve,
as it does to any next candidate.

Tests: TestAtOnceKeepsFirstInUserOrder (every routing mode, a dragged
order, a resting key handing over its seat), TestAtOnceFullLaneWaitsForTheKept,
TestAtOnceReserveTakesOverAndGivesBack, provider TestAtOnce, plugin
host maxAccounts (hook and package.json), gui TestAtOnceSave, cli
TestAtOnceCmd, provider-at-once.test.cjs (both engines, five languages,
900 and 360px).

Broken by hand, each red then restored: laneMate's reserve guard
removed (FullLane times out); affine's reserve case removed
(ReserveTakesOver answers on k3); keepAtOnce disabled (all three red);
dropReserves disabled (FullLane gets no reply); the Routing row's
reserve branch removed (provider-at-once's Routing test red in all 10
engine/language runs).

Core budget: the field adds ~530 bytes to app.js; the neighbouring
editor comments are cut to fit, so TestCoreScriptBudget passes with no
raise.

Run on mote, Go 1.26.8:
- full suite, -timeout 45m, at a7d4c662d (on origin/main e4384fc3c):
  gofmt and vet clean; every package ok but internal/gui, whose reds are
  TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestMainWindowCorners
  (#3949) and TestColdTurnsTaken (#4510), each red on that main too, and
  TestCoreScriptBudget, fixed by the comment cut above.
- at this tree on bbdd9eb55 (the pushed head less 51f2f22ce and
  73b957069, gateway and provider): gofmt, go vet (darwin, and
  linux and windows with -tags nogui), and internal/gateway, provider,
  gui, cli, plugin and settings: all ok but internal/gui's
  TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners
  (#3949), both red on main; TestCoreScriptBudget passes
- at the pushed head (on 51f2f22ce): go vet of gateway and provider,
  and -run AtOnce|Nameless|ModelAPI|Reserve|FullLane over gateway,
  provider, gui and cli: ok
GUI, Playwright 1.62.0, both engines:
- the whole suite on Linux (WSL) at an earlier head; every red file run
  again at head and at main on mote, the same reds on both (filed:
  #4641 is new, the rest open already, e.g. #4600, #4461, #4082, #4210).
- at a7d4c662d on WSL: every editor-*, provider-* file, i18n-keys,
  gui-ja and seven routing files, 1185 pass, 34 red; all but four red
  on main e4384fc3c too (#4580, #3292, #4394 to #4397, #4600). The four:
  routing-many-keys (#4082) is red on main in two of three reruns as
  well; provider-gemini webkit ja's thumb (#4210) was red in 2 of 3 runs at head beside
  other files (318px off), 0 of 3 at main; alone, 4 of 4 green at both.
  The test reads the thumb 350ms after a click, a fixed wait (#4210,
  numbers added there).
- provider-at-once.test.cjs: green in both engines, five languages, at
  900 and 360px; editor-advanced-align 20 of 20 alone with the next
  commit.

Not tried: real ZCode accounts (none used, per the task) and a real 405,
so whether two at once always stays under ZCode's limit is the
reporter's finding; the user can set 1.
2026-11-01 07:39:08 +08:00
yetone 3f2faef620 gui: the Providers page has its own Hide accounts switch
Routing's Hide accounts (账号打码) also masked the Providers page,
where nothing showed it was on or let you turn it off (Discord
#feedback, 1566189346665799752). The Providers page now has its own
switch beside its search box, placed and drawn like Routing's
(.rt-mask moved from routing.css to app.css), and each page follows
its own switch: Routing, Usage and the tray panel follow
magpie.maskEmails, Providers follows magpie.maskProviders.

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

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

Not tried: the real desktop app's webview (Wails), and the GUI suite
on macOS beyond the files above.
2026-11-01 06:30:17 +08:00
yetone 3cfba2e376 test(gui): deprecated-subscriptions times the page's boot as its navigation (#3484)
Follow-up to ggbdpq's change before this one. Looking for an app-side
cause behind the WebKit zh red found none. With ?view=providers the
view comes before lastView, and renderProviders draws #movable
synchronously once /api/providers is read. Run alone, the notice is up
20 to 40ms after the load event. What the 5s wait covered is the boot
that follows goto's load event: /api/state, then /api/providers, then
the rows. Under the whole suite's load that boot ran past a limit meant
for one action on a loaded page.

ggbdpq's 15s had no basis beyond being longer. The boot is the second
half of the navigation, so it gets the navigation's minute, which #4470
gave every page.goto. The waits inside a loaded page keep 5s. The
pageerror filter matched "due to access control checks" anywhere, in
either engine. It is now anchored to WebKit and to "Fetch API cannot
load …", as title-bar-tools and usage-fold have it (#1350).

Broken by hand on mote: with /api/providers held 6s in the test's
serve, webkit zh is red at a 5s wait ("locator.waitFor: Timeout 5000ms
exceeded … #movable .deprecation") and green at this 60s.

Run at the pushed head on mote (load ~115):
- deprecated-subscriptions.test.cjs, chromium and webkit, en and zh:
  4/4 (13 files, 189 cases, 187 pass. The 2 reds are signin-proxy's webkit zh and zh-TW at 380px, red alone at origin/main 41b5c0f19 (#4643). internal/gui/assets is the same at 573b21f4b).
- go test ./... -timeout 45m on mote with this branch on 41b5c0f19: 83 packages ok. internal/gui is red on TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), both red alone at 41b5c0f19 too, and on TestColdTurnsTaken (#4510). internal/update is red on TestRelaunchOpenTriedAgain (#3881). The last two pass alone at 41b5c0f19 and here. Rebased on f856d381a: agent, gateway, plugin, provider and sessions ok, gui red on #4514 and #3949 only, gofmt -l clean, go vet ok for linux (nogui), windows and darwin. Rebased on bb478f0e5: agent and gateway ok, gui the same. The last rebase, onto 573b21f4b, brings in only internal/gui/providers*.go and internal/provider/models.go, which this branch doesn't touch

Not tried: the whole GUI suite. Nothing here makes the app's boot
faster; under load it is as slow as before.
2026-11-01 06:21:40 +08:00
ggbdpq f802fc3301 test(gui): the deprecated-subscriptions waits after a page load get 15s
Under the whole suite's load, webkit zh once waited past the 5s default
for the deprecation notice after the reload of Providers (#3484): a page
load serves the files one by one, then /api/state is read before
/api/providers before the rows, and the red passed alone right after.
The notice and badge waits after a load get 15s; a load itself now has
the 60s navigation timeout (#4470), and the waits inside a loaded page
keep the quick 5s.

The injected 6s /api/providers read that reproduces the red also showed
a second snag on the same path: a reload kills the page's own
background reads (the web update poll, What's new), and webkit reports
each killed fetch as a page error on the page it leaves, which the
errors assertion would have tripped on in just such a slow run. With
every response faked here, that wording only ever means a killed read,
so it is not counted as a page error.

Landed (yetone): the next commit times the boot as the navigation and
anchors the filter to WebKit's wording.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-01 06:21:40 +08:00
ggbdpqandyetone 9c8636a351 gui: a proxy typed outside Settings takes its login in fields (#3382)
Settings' proxy row keeps a proxy's login in fields of its own, so a
password with @ : / % # or a space survives. The three places that ask
for a proxy of their own still took one line, and the same login had
to be percent-encoded by hand. Those places are the provider editor's
row, each account's and key's line, and the sign-in box's typed proxy.
Each now splits a pasted URL the way Settings' proxyFields does: the
login lands in the fields and the box keeps the address. What the
fields hold is joined back as it is typed, so the value saved (or sent
to a sign-in) is the address Settings would save for the same login:
userinfo in the address, the saved format unchanged. A field left as it
was split keeps its escapes, so a saved login with non-UTF-8 bytes
opens decoded, still works, and saves again byte for byte. A pasted URL
keeps working.

The layout question the issue leaves open ("an account line with two
more fields is wide"): the fields stack under the row, 140px each, so
an account line is no wider. A mode pick that doesn't ask for an
address dims them with the row's own "off", keeping their room, as the
address box always did. proxyLoginRow is the one helper, drawn by all
three places. Settings' own row is untouched. signin-proxy.test.cjs
pins the form's address as its first input, with the two new fields
beside it.

Changed in landing (yetone):
- The fields show for every scheme, as Settings' do. As first written
  they showed only for a SOCKS address, but the split ran on any
  pasted URL, and join skipped hidden fields. So a pasted
  http://name:pw@host lost its login on save. With this change's first
  app.js the new HTTP case is red: it saves "http://proxy.example:8080".
- The core budget is not raised. Comments were trimmed to bring the
  core to 1,532,444 of 1,533,105.
- The test sets the navigation's minute, as the #4470 guard asks.
  Save and the sign-in wait on the post itself, with 30s of room, not
  a fixed 2.5s or 2s cap. The sign-in no longer clicks "Sign in
  anyway": on main a sign-in again goes straight to the browser.

Broken by hand on mote, chromium en and zh: with app.js and app.css at
origin/main, proxy-login-fields is red 6/6; with this change's first
app.js, its provider case is red 2/2 on the HTTP login.

Run at the pushed head on mote (load ~115):
- proxy-login-fields.test.cjs, chromium and webkit, en and zh: 12/12.
- The same run took signin-proxy, account-proxy, provider-proxy,
  provider-many-keys-proxy, provider-advanced-fold, nav-timeout and
  i18n-keys in both engines (13 files, 189 cases, 187 pass. The 2 reds are signin-proxy's webkit zh and zh-TW at 380px, red alone at origin/main 41b5c0f19 (#4643). internal/gui/assets is the same at 573b21f4b). signin-proxy's webkit zh and
  zh-TW 380 are red the same way at origin/main 41b5c0f19, run alone:
  the editor's switch-only line takes the click meant for "Sign in
  again" (#4643).
- go test ./internal/gui -run 'Budget|I18n|Asset': ok.
- go test ./... -timeout 45m on mote with this branch on 41b5c0f19: 83 packages ok. internal/gui is red on TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), both red alone at 41b5c0f19 too, and on TestColdTurnsTaken (#4510). internal/update is red on TestRelaunchOpenTriedAgain (#3881). The last two pass alone at 41b5c0f19 and here. Rebased on f856d381a: agent, gateway, plugin, provider and sessions ok, gui red on #4514 and #3949 only, gofmt -l clean, go vet ok for linux (nogui), windows and darwin. Rebased on bb478f0e5: agent and gateway ok, gui the same. The last rebase, onto 573b21f4b, brings in only internal/gui/providers*.go and internal/provider/models.go, which this branch doesn't touch

Not tried: the whole GUI suite; a real SOCKS or HTTP proxy.

Generated-by: GLM-5.3-Flash (ZCode)
Co-authored-by: yetone <yetoneful@gmail.com>
2026-11-01 06:21:40 +08:00
yetone fcf87a7853 test(gui): four pages with a 5s default get the navigation's minute (#4622)
nav-timeout.test.cjs, the #4470 guard, is red on origin/main 41b5c0f19
on any machine, an idle one too. It is a scan of the test files, not
something that varies with load, which is how #4622 filed it. Four
files added since set setDefaultTimeout(5000) without the
setDefaultNavigationTimeout(60000) the guard asks for:
editor-quota-quiet (a9154b170), routing-moved-why (6b8261029),
sync-note-show (225b494be) and sync-own-fields (a511b11d8). Each gets
that one line, and nothing else changes.

Run at the pushed head on mote (load ~115):
- nav-timeout.test.cjs: red alone at 41b5c0f19, listing the four files;
  green with this.
- The four files, chromium and webkit, every language and width they
  draw: green, in one node --test run with the #3382 and #3484 files
  (13 files, 189 cases, 187 pass. The 2 reds are signin-proxy's webkit zh and zh-TW at 380px, red alone at origin/main 41b5c0f19 (#4643). internal/gui/assets is the same at 573b21f4b).
- go test ./... -timeout 45m on mote with this branch on 41b5c0f19: 83 packages ok. internal/gui is red on TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), both red alone at 41b5c0f19 too, and on TestColdTurnsTaken (#4510). internal/update is red on TestRelaunchOpenTriedAgain (#3881). The last two pass alone at 41b5c0f19 and here. Rebased on f856d381a: agent, gateway, plugin, provider and sessions ok, gui red on #4514 and #3949 only, gofmt -l clean, go vet ok for linux (nogui), windows and darwin. Rebased on bb478f0e5: agent and gateway ok, gui the same. The last rebase, onto 573b21f4b, brings in only internal/gui/providers*.go and internal/provider/models.go, which this branch doesn't touch

Not tried: the whole GUI suite.
2026-11-01 06:21:39 +08:00
yetone 5bfa9f0762 gateway: a group's backup gives the conversation back once the member listed ahead of it is ready again (01huadalang on Discord)
01huadalang on Discord, after 76e4494db: Codex on several accounts in a
group with mimo2.6pro as the backup, Stays on Auto. Once Codex had quota
again, requests kept going to mimo.

The cause: when Codex couldn't answer, the turn fell over to mimo and the
session was stuck to mimo. On the next turns affine kept it there by
"cache", because only In order had a way back (backToFirst, Why "order").
A Smart group (and the other routings) never gave the conversation back to
the member ahead, however long Codex had been ready.

The fix: at the answer, the gateway records whether the member that
answered stood in for one listed ahead of it in the group: one that was
resting, or known all but used up (Used >= SpentShareOf). planGroup now
gives each candidate its member and its place in the group (placed), and
standsInFor reads the plan made before the tries. The flag is the stick's
stoodIn, inherited while the same who and model keep answering, and saved
in affinity.json (stoodIn). With Stays on Auto, a stick that stood in goes
back to the group's first member once that one is ready and not set aside
(backFromStandIn), with the new Why "back" and its Routing page line in
all five languages. A member put first on its merits (not a stand-in)
keeps its cache as before; Off, Session, Strict, Turn and In order keep
their own rules.

Not changed, by design: Smart and Least used count a key with unknown
usage (mimo) as unused, so with every Codex account at 90% or more of a
window a new session can go to mimo first. In order keeps a backup last;
the routing doc says so.

Tests (internal/gateway/group_stand_in_test.go, new):
- TestGroupBackupGivesTheConversationBack: smart auto with usage known
  and unknown go back ("back"); in order auto "order"; in turn and smart
  turn "new-turn"; smart off "off"; smart session, smart strict and in
  order session stay on mimo.
- TestGroupBackupStandingInWhileTheFirstIsBackAndBehind,
  TestGroupMemberPutFirstOnItsMeritsKeepsItsCache,
  TestGroupStandInStaysWithinATurn, TestGroupStandInSurvivesARestart.
- affinity_fallback_test's TestGroupMemberKeepsTheConversationOnceAnother
  IsBack pinned the old behaviour; it is now
  TestGroupMemberGivesTheConversationBackOnceTheOneAheadIsBack.
- routing-affinity-order.test.cjs gains the "back" line.

Run, all on mote:
- With the non-test changes stashed (old code): both smart auto cases,
  StandingInWhileTheFirstIsBackAndBehind, SurvivesARestart and
  GivesTheConversationBackOnceTheOneAheadIsBack are red. Green with the fix.
- Broken by hand, each red: the "back" case off (smart cases,
  StandingInWhileBehind); no inherit (StandingInWhileBehind); rest/spent
  check off (usage-known case, StandingInWhileBehind); stoodIn check
  dropped from the back case (PutFirstOnItsMerits); StoodIn not loaded
  (SurvivesARestart). A check of failed tries stayed green when turned
  off, since a failed try rests what failed, so it was removed.
- go test -tags nogui -count=1 -timeout 45m ./... at 80bcef18f + this:
  every package ok except internal/gui, whose two reds are red on
  origin/main d714c4216 too: TestSettingsSaveKeepsWhatItDoesNotSend
  (#4514) and TestColdTurnsTaken (#4510).
- Rebased on 5a56bc7d7: internal/gateway, internal/provider and
  internal/catalog ok; internal/gui has only the same two reds (#4514,
  #4510). Main then moved three provider-only commits; at the pushed
  parent f856d381a, internal/provider ok and internal/gateway -run
  'Group|Affinity|Fallback|Ordered|Strict|Rotating|Stick' ok.
- gofmt -l clean; go vet, GOOS=linux and GOOS=windows go vet -tags nogui
  ./internal/gateway ok.
- GUI (Chromium and WebKit): routing-affinity-order, routing-js,
  i18n-keys, gui-zh-tw and gui-de pass; gui-ja's one red is #4580
  (a7b47d57e's string, not this one).
- Every routing-*.test.cjs file on mote (2050 tests, both engines, five
  languages) at load 140 to 200 from other sessions' suites: 35 red in 10
  files, all timeouts or moves under load. The same 10 files run alone,
  serially, at this head and at origin/main 41b5c0f19 are red in the same
  tests (27 and 30, differing only in which language flaked). All filed:
  #4585, #3789, #3096, #3094, #3799, #3412, #1804, #4560, #3593, #4082,
  #4627, #4628, #3954, #4629.

Not tried: no real Codex or MiMo account; the case was reproduced with a
fake upstream only. A stick saved before this change has no stoodIn, so a
conversation already stuck to the backup stays there until it goes cold
(5 minutes idle) or a new session starts.
2026-11-01 05:59:05 +08:00
yetone 41b5c0f19a accounts: Claude Code stays on the account it moved to till that is spent too (hxy920830 on X)
hxy920830 on X wants Claude Code to use one account to 98%, move to the
next and use that one to 98%, not jump back the moment the first resets.
No setting gave that. NextLogin (#408) signed the agent back in to the
first account as soon as it was under 90% again, under every routing.
KeepLogin pins one account, In order goes back too, and switch only
went back as well.

Where the sign-in is what spends the accounts (Claude Code, whose own
requests never pass the gateway, and Codex under switch only), the
sign-in now stays on the account it moved to until that one is spent
or fails, then moves on to the next ticked account with room. It goes
back to the first only where the user said the first comes first:
routing In order, or KeepLogin. Codex through the gateway keeps going
back, because Smart routing sends its requests to the first account
(#209) and the sign-in follows it. This is returnsToFirst in
codex_switch.go. The return record is still written, so turning In
order on later goes back as before. An old record is ignored otherwise,
and its "First again" label (logins.go) is hidden. No user setting is
overridden: In order and KeepLogin keep their meaning.

GUI: the Routing note for Claude Code (and Codex under switch only) now
says it stays on the account till that one is 98% used too. The two
switch-only tooltips no longer promise going back. New and changed
strings are in zh, zh-TW, ja and de. app.js lost a 3-line comment so
the core script budget holds without a raise (core 1,531,108 of
1,533,105).

Run on mote at 94cd5edde (base d307aa648):
- go test -tags nogui -count=1 ./internal/provider/: ok. New test
  TestSignInStaysOnTheAccountMovedTo (claude, claude switch only, codex
  switch only stay; claude in order goes back).
- TestCoreScriptBudget and the gui package's budget tests: ok.
- go vet -tags nogui ./internal/provider/ ./internal/gui/ with GOOS
  darwin, linux and windows: clean. gofmt -l: clean.
- GUI, Chromium and WebKit: account-return, switch-only,
  claude-switch-only, i18n-keys, keep-login, routing-signin, gui-zh-tw,
  gui-de, gui-ja. 116/117 and 64/65 passed. The one red is gui-ja's
  "{agent} three times" string, red on origin/main dd7442f28 too (#4580).
- Full suite at the earlier base 76c130b29, -timeout 45m: provider ok.
  Reds, all already filed: TestSettingsSaveKeepsWhatItDoesNotSend
  (#4514), TestCodexListTagNotKeptOverAFreshFile (#4216),
  TestUnroutedRequestShownThenAnswered (#4200). TestCoreScriptBudget
  failed by 41 bytes, fixed above. internal/gui hit its 45m timeout in
  TestUpdateInATerminalRestartsTheAppWithoutCuttingIt.

Broken by hand: with returnsToFirst forced to true,
TestSignInStaysOnTheAccountMovedTo (all three staying cases) and
TestCodexSwitchOnlyStillSwitchesTheSignIn went red. With the note forced
back to the "back to the first" text, the new account-return GUI test
went red in Chromium en and zh.

Not tried: a real Claude account moving and its first renewing (needs
two real windows to run out), runs on the Windows and Linux boxes, and
the full GUI suite at this head.
2026-11-01 05:23:58 +08:00
yetone 323159f1cc usage: a Codex reset's confirmation picks which of the account's resets is used (01huadalang)
01huadalang on Discord: resets were used only automatically, or by hand
the one that runs out first. Which account was already the user's to pick
(each account's card has its own Use); which of its resets was not.

- Usage card's "Use a reset" and the menu bar panel's "Use one...": when
  the account holds two or more resets listed with their ids, the
  confirmation has a "Reset to use" pop-up (the app's menu, not <select>),
  soonest first and picked unless another is. Once another is picked it
  names the account and that reset ("The one used is me@'s reset that
  runs out ..."), and says the sooner one is kept and lost if unused.
  Escape closes the open menu first, not the confirmation.
- POST /api/usage/codex-reset takes an optional credit. The server reads
  the account's resets again and spends that credit only if it is still
  held; a gone one is refused and no other is spent in its place. With no
  credit it is as before (the soonest). Auto-use is unchanged.
- ResetCard carries the credit id; `magpie quota reset --card n` is the
  CLI's sibling, its prompt naming the reset.
- askReset's dialog moved out to resetask.js, imported when Use is
  pressed (like signsheets.js), so the core's scripts are 1,530,733 bytes,
  under the 1,533,105 budget with no raise (the pick alone took it 2,068
  over). Five keys in zh, zh-TW, ja, de.

Run on mote (mote-run), at the base 2597c9636:
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... ok.
- go test -tags nogui ./internal/provider ./internal/cli ok;
  ./internal/gui: only TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  TestColdTurnsTaken (#4510) red, both filed and the same on main;
  TestCoreScriptBudget ok after the move.
- GUI, Chromium and WebKit, 78/78 each: reset-pick-card (new: en, zh,
  zh-TW, ja, de; Usage at 900 and 390px, panel at 440px), codex-resets-used,
  account-every-reset, codex-reset-lead, reset-each-title, reset-providers,
  reset-reminder, panel-usage, old-webkit, i18n-keys, codex-auto-reset,
  codex-auto-reset-settings, warm-reset-asleep, quota-credits,
  usage-accounts.
- Red on the old code: reset-pick-card against origin/main's assets fails
  at "an account with three resets offers the pick"; TestUseCodexResetCard
  and TestCodexResetsCounted fail without the change.
- Broken by hand, each red then restored: the chosen credit ignored
  (spent [soon]); the held check skipped (a used credit spent); ids dropped
  from each; the credit left out of the POST; the Escape guard removed.

Again at the pushed head (rebased on 88372a39d): go vet ./... ok;
provider, cli ok; gui only #4514 red (TestColdTurnsTaken passed this
time); reset-pick-card, old-webkit, i18n-keys in Chromium 15/15.

Not run: the full go test ./... and the whole GUI suite. mote had two to
three other full Go suites and several whole GUI suites running the whole
time (load 120 to 250), and the WSL box too; one suite per machine.
Not tried: a real account's reset spent (none was, by design: fakes only),
so that Codex's consume takes a credit_id other than the soonest is
inferred from it being the same field the soonest is sent in.
2026-11-01 04:51:55 +08:00
yetone e6b595e1ab claude: Interactive only, a setting under which a model request never runs as claude -p (_yuchanns_ on X)
_yuchanns_ on X, on the interactive mode falling back to -p: for people
who stayed off magpie's Claude subscriptions because of -p, a fallback
is a time bomb. Settings › Models › Replies › Claude Code's interactive
mode now has three choices: Off (always -p), On (the default, falling
back to -p as before) and Interactive only.

With Interactive only (settings.ClaudeTUIOnly; ClaudePrintMode set too
wins):
- a run claudeTUI would make -p is not started; the request fails with
  the reason and the setting (claudeOnlyErr, claudeNotTUIWhy);
- the helper is handed MAGPIE_CLAUDE_TUI_ONLY=1 (claudetui.OnlyEnv,
  claudeCLI.tuiEnv). Where it would exec -p (no start, sign-in, first-run
  notes, untrusted folder, 45s timeout) it exits with the reason
  (fallBack in Run), and it ignores the broken mark;
- a helper that never answers initialize ends the turn with an error,
  not a -p retry, and `broken` isn't counted (claudeMachineWhy), so the
  next run tries the interactive mode again;
- the model test's and warm-up's "hi" (askClaude) runs through the
  helper (askClaudeTUI) in stream-json, its stdin closed at the first
  result. The helper command and env are built in one place now
  (tuiCommand, tuiEnv) for both.
Reading the plan's allowance (/usage) asks no model and stays -p; the
setting's text says so. Docs: claude-subscription-bridge.md.

Provider editor, on e8347401f's "Claude Code runs as" pill
(ClaudeMode.Only): with the interactive mode in use and no last
request, it says a request it can't take fails, and the card's foot says
nothing runs as -p. Where the interactive mode can't run, the pill names
Interactive only, never claude -p, the line says "Claude requests fail:
<why>", and Change in Settings goes to the row. A request refused this
way never ran, so it isn't noted as the last request (noteClaudeRun
comes after the refusal).

app.js: the Replies rows share one helper (segRow, which waitRow uses
too), so app.js is 530 bytes under main's with the third choice; no
budget raise.

Tests: TestClaudeTUIOnlyRefusesPrint, TestClaudeTUIOnlyHungHelperNoPrint,
TestClaudeTUIOnlyTellsHelper, TestAskClaudeTUIOnly (gateway);
TestShimOnlyNeverPrints (claudetui: fake fail/trust/login/notes each
exit with an error and no -p, a marked-broken run still interactive);
claude-tui-setting.test.cjs (three choices, Only saves claudeTUIOnly with
claudePrintMode false) and claude-mode.test.cjs (Only in use, and Only where it can't run).

Broken by hand, each red, then put back: the startRun gate off
(RefusesPrint 200); start()'s Only check off (HungHelper 502 without the
Only reason); tuiEnv's OnlyEnv off (TellsHelper); askClaude's branch off
(AskClaudeTUIOnly); the helper's fallBack ignoring only (4 subtests);
BrokenSince's `&& !only` gone ("marked broken"); the save without
claudeTUIOnly (16 of 16 setting tests) and claudemode.js's m.only
branches gone, rebuilt on e8347401f's file (10 of 10 Only tests,
Chromium).

Run on mote at e8347401f + this commit:
- at f1d6f4137 (main, after #4571's claude_cache.go) + this commit: go
  vet of gateway and gui ok, CoreScriptBudget|I18n ok, the gateway's
  TUI|Warm|Claude|AskClaude|Cache tests ok; the rest below at e8347401f
- gofmt -l clean; go vet and GOOS=windows go vet of claudetui, gateway,
  settings and gui ok; Linux vet (wsl-run, -tags nogui) ok
- go test ./internal/claudetui ./internal/settings ok; the gateway's
  TUI|Warm|Claude|AskClaude tests ok
- internal/gui CoreScriptBudget|I18n|Settings: ok but
  TestSettingsSaveKeepsWhatItDoesNotSend, SearchAll, red on main since
  b09349d17 (#4514)
- GUI (Chromium + WebKit, every language): claude-mode, claude-tui-setting
  and i18n-keys 94 of 94 at e8347401f; with the other Replies rows'
  files (claude-lean-prompt, member-model, loop-guard, refusal-retries,
  classify-timeout, image-timeout) 180 of 180 at 2e9df9b1b. Earlier
  segs-press-redraw's searchAllRow red is #4566, not this change.
Not tried: a real account under Interactive only (the fallback paths
are forced by the fake Claude Code); the full GUI suite (mote had
another session's full GUI suite and an agent+gateway suite going).
2026-11-01 02:53:08 +08:00
yetone e1aec53895 routing: each session sending at once has its own context window, named by its title (tjhhhh on Discord)
tjhhhh runs several agent sessions at once. The Routing page's context
window card followed whichever request came last, so it jumped from one
session's prompt to another's. The card still tells of the request it
picked. Under it, while two or more sessions are live, a strip now
shows one small block per session (renderCtxSessions):
- keyed as the card's line of prompts is (sessionKey, else the
  conversation);
- named by the agent's title for the session (sessionName), else its
  folder's last level, never a bare id;
- holding that session's newest reading through context.js's stack bar,
  exported as window.ctxStack.

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

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

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

Not tried: a real gateway with several live agent sessions sending at
once (only the page's fixture feed was used), the Linux WebKitGTK app,
and the whole GUI suite at the final tree (only the files above,
which the change can reach).
2026-11-01 02:44:37 +08:00
yetone e8347401fe providers: Claude Code runs as is a pill above the accounts, its hover card saying what TUI and -p each are and are good for
The owner asked for this design, and for it to replace the row 535371c8f
added ("这个页面已经有一个重复的解释 claude code 运行方式的了,那个其实
可以用你这个代替掉"). The provider editor's Claude subscription now has
one "Claude Code runs as" row, above Accounts. It has:
- a pill, green when the interactive mode (TUI) is in use, else "claude -p";
- a line beside it with why -p, or how the last request went ("Last request
  3 min ago: interactive mode", "… ran as -p: the request asked for a JSON
  schema");
- on hover or focus of the pill, a card with both modes, the one in use
  marked, each with what it is, its advantage and (for -p) its cost, and
  where it is switched;
- when it is off in Settings, Change in Settings, which opens Settings ›
  Models at #claudeTuiRow.

Gateway: GET /api/claude/mode gains last {tui, why, at}, the last
request's mode. claudeTUI returns the code why a request is -p (the
machine's: off, broken, os, wsl-home, missing; or the request's:
safeguards, cache, schema, image, big; wslread), and a TUI start that
fell back to -p records "start". main's row and its 9 strings per
language are gone; the 2 kept ones are reused.

openSettingsAt looked a selector up before Settings had drawn from its
read, so a row Settings draws anew (#claudeTuiRow) was found stale and
the lit row was gone; it now looks it up once show()'s read is in
(settingsLoad).

Budget: the core is 1,533,105 (147 over), with the comment cut; raised
to it with no room added.

Run at 2e9df9b1b (rebased on origin/main just fetched), on mote:
- gofmt -l: clean; go vet darwin, GOOS=windows, GOOS=linux -tags nogui
  for internal/gateway and internal/gui: ok
- go test ./internal/gateway -run Claude: ok (TestClaudeModeLast,
  TestClaudeTUICodes new)
- go test ./internal/gui: TestCoreScriptBudget ok after the raise; red
  TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestMainWindowCorners
  (#3949), TestColdTurnsTaken (#4510), each known on main
- GUI: claude-mode.test.cjs 54/54 (Chromium and WebKit; en, zh, zh-TW,
  ja, de; 900 and 420 wide; Codex and Only switch read nothing),
  old-webkit ok, i18n-keys red only on "Unmarked" (#4524)

Again at 0565c0bba (main moved before the push): the budgets and
go test ./internal/gateway -run Claude ok; claude-mode, old-webkit and
i18n-keys 64/64, i18n-keys green now that #4524 is fixed.

v0.1.2443 was first pushed at 3525a6542, this commit before that
rebase, while main's push was refused; it was moved here at once.

Broken by hand, each red: the pill's mouseenter (hover test, both
engines), the settingsLoad lookup (Change in Settings' lit row, both
engines), noteClaudeRun("start") (TestClaudeModeLast).

Not tried: the real app with a real Claude subscription; the pill and
card are drawn from the faked /api/claude/mode.
2026-11-01 02:37:39 +08:00
yetone 0e90572274 browser: Magpie Browser, agents use the user's own browser and its sign-ins
The owner asked for a browser-use MCP of magpie's own, so an agent's
browser keeps working when Claude Code switches accounts, and asked that
it act in the browser the user uses every day: a fresh Playwright
profile is signed in to nothing.

Magpie Browser is an MV3 extension (internal/browserext, ID
dmlhojidlfnkgamkekjhacgkpanbkeko, pinned by its key) that the user loads
once in Chrome, Edge, Arc, Brave or another Chromium browser. It holds a
WebSocket to the gateway's /v1/magpie/browser/extension and carries out
each tool call with chrome.debugger (the DevTools protocol) in the user's
own tabs. The socket is taken only from this computer, with a loopback
Host (no DNS rebinding) and the extension's own Origin; a page or another
extension that connected in its place would be handed every call.

Agents reach it at /mcp/magpie/browser (Streamable HTTP) or through
`magpie mcp browser` (stdio), and the Library's MCP market lists it as
Magpie Browser, opt-in. Like the image server it is magpie's own, but it
is never served to another computer, shared and with a key or not, and
never to a web page, since it acts as the user wherever they are signed
in. 17 tools: navigate (url, back, forward, reload), snapshot (an
accessibility tree with refs, interactive-only on ask), click, type,
press, select, hover, drag, upload, scroll, wait (text, gone, seconds),
dialog, evaluate, text, screenshot (page, full page, element; JPEG or
PNG), console and tabs (list, new, select, close). Each agent session
goes on in its own tab; a link that opens a tab is followed, and a
dialog a click opens is said in the reply.

The Library's sheet for it has Set up the extension…, which writes the
extension to ~/.config/magpie/browser-extension pointed at this gateway
and shows the folder, the three steps to load it, and whether the
browser is connected, polled while the sheet is open.

Run:
- TestBrowserToolsInARealBrowser: the extension magpie writes, loaded in
  a real Chrome for Testing 141 (Playwright's chromium-1234, headless=new)
  with --load-extension, connects, and all 17 tools act in a real tab of
  a fixture site. Green on mote (macOS 27), on xiaomi-gpu (Windows 11,
  win-run) and in magpie-desktop (Ubuntu 24.04, wsl-run). Under a test
  HOME Chrome needs --use-mock-keychain / --password-store=basic, or the
  extension's storage waits on a keychain and it never connects.
- go test ./internal/gateway -run 'Browser|ReadOnly|Image', ./internal/
  browserext, ./internal/browsermcp, ./internal/library, ./internal/gui
  -run 'Library|Browser', ./internal/cli on mote.
- GUI: library-browser-setup.test.cjs (new) in Chromium and WebKit, en,
  zh, zh-TW, ja, de, at 1100 and 420 wide: 22/22. With i18n-keys and
  every library*.test.cjs: 915 pass, 1 fail, i18n-keys' "Unmarked",
  red on main since 5787d758a (#4524, fixed in the next commit).
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
  go vet ./... on mote.
- Again at this commit, rebased on 2e9df9b1b: gofmt -l, the vet trio,
  ./internal/gui -run 'Budget|Size', ./internal/proc (exec guard),
  ./internal/usage, ./internal/browserext, ./internal/browsermcp, and
  i18n-keys (0 fail with the next commit). The full go test ./... runs
  in magpie-desktop (Linux) as this is pushed; mote had another
  session's suite running.

Broken by hand, each red, then restored:
- browser_click's dispatch in background.js turned into a no-op: the
  E2E test is red at "clicked Ada".
- the extension socket's Origin check, its loopback-Host check and
  local(): TestBrowserExtensionOnlyFromItsOrigin red for each.
- browserMCP's local()/fromBrowser() guard: TestBrowserMCPGuarded red.
- a tool dropped from background.js: TestBrowserToolsAreTheExtensions red.
- the sheet's steps left shown once connected: the GUI test is red.

Not tried: loading it by hand (Load unpacked) in the owner's own daily
Chrome or Edge and driving a site they are signed in to; Arc, Brave and
Edge themselves (only Chrome for Testing); Firefox and Safari, which
have no chrome.debugger and are not supported. Chrome shows its "is
debugging this browser" bar while a tab is being driven; that is
Chrome's and cannot be hidden.
2026-11-01 02:29:55 +08:00
yetone 80af3b86a4 context: the card's head names the agent and the model's lab
The owner asked for the agent's name and the model's icon on the
context window card, and picked design A from a mock-up: in the head,
right of the title and before the state pill,

  [agent icon] Claude Code › [lab icon] anthropic/claude-sonnet-5-5

- context.js: the head's model is now a route (.ctx-route): the agent's
  icon and name (agentIcon, agentLabel, as the Usage page names it), a ›,
  then the model's lab icon before its id. labIcon picks the lab from
  the id after its provider prefix (Claude, OpenAI's gpt/o-series/codex,
  Gemma, Gemini, DeepSeek, Qwen, Kimi, GLM, Grok, MiniMax, Doubao,
  Mistral, Llama, MiMo, Step, Hunyuan); an id it doesn't know gets no
  icon, so a wrong logo never stands for a model.
- context.css: the name in --fg-2 at 500, the › in --faint, the agent's
  icon 14px and the lab's 12px; the model id keeps its ellipsis. In a
  card 420px or narrower the agent's name and the › go and its icon
  stays; folded and that narrow, the model goes as it did before.
- core_budget_test.go: lowered to 1,532,958, the core after this and the
  text viewer's move to ctxtext.js (the commit before), on origin/main
  0fe9f97c1.

Tests: ctx-route.test.cjs, Chromium and WebKit, en/zh/zh-TW/ja/de: the
agent's name and icon, the lab icon for Claude, an OpenRouter-prefixed
GPT, DeepSeek and GLM, none for an unknown model, the route still on
the folded head's one line, the name gone and the icon kept at 400px,
nothing past the head, no page error.

Run at this head:
- the full GUI suite on mote (6 wide) before the last rebase: 16,938
  tests, 283 red in 50 files. Those 50 files again at 2 wide: 292 red,
  and at origin/main 2cca11176: the same files red (model chips, rule ⋯,
  Settings redraw, fetched editor; #4600), context-map's 420px "two
  tiles overlap" among them (#3488).
- after the rebase on origin/main 0fe9f97c1, on mote: go test
  ./internal/gui: only TestSettingsSaveKeepsWhatItDoesNotSend (#4514)
  and TestMainWindowCorners (#3949) red, as on main; Budget ok. The
  ctx*/context* GUI files, old-webkit and i18n-keys: 346 tests, 6 red:
  context-map 420px (#3488) and i18n-keys "Unmarked" (#4524).
- rebased again on origin/main 20482d71f (two commits, 21 lines of
  GUI assets): TestCoreScriptBudget ok there.

Broken by hand, each red, then put back:
- labIcon returning nothing: 42 of 52 red ("the model's lab icon");
- the narrow rule removed: 12 red ("a narrow card leaves the name out");
- the route hidden when folded: the folded case red in every language.

routing-ctx-still.test.cjs is red on Windows 16 of 16 ("used held
still", the big figure's width 60.97 to 61.5), the same frames at
origin/main a4151142a alone (#4494).

Not tried: the real app on Windows (WebView2) and Linux (WebKitGTK).
2026-11-01 02:07:59 +08:00
yetone 9a9967ac28 context: a part's text viewer is loaded when a part is first opened
The context window card opens a part to the text the request sent there
(readText, longText, picture, pieceView, openCtxText). That viewer is a
dialog the user opens by a click, yet its 7KB were in context.js, which
index.html loads on every page as part of the core. It moves as it is to
ctxtext.js, which context.js imports on the first open, as signsheets.js
and navlamp.js are imported; the card hands it the helpers it shares
(fmtK, partName, itemName, itemLabel, tagOf). A failed import says so in
the status line. The core is 7,005 bytes lighter, which makes room for
the next commit (the card's head naming the agent and the model's lab);
the budget is lowered there, to the total after both.

old-webkit.test.cjs lists ctxtext.js among the scripts loaded later.

Run at this tree (1e15a7a3b plus this), on xiaomi-gpu (Windows), both
engines: context-text, context-map, old-webkit 55/55; i18n-keys red on
"Unmarked" (plugins/routing vs internal/usage), the same at origin/main
a511b11d8, #4524. go test -tags nogui -run "Budget|Asset|Embed"
./internal/gui on mote: ok.

Broken by hand: the import pointed at a file that isn't there, and
context-text went 10 of 10 red in Chromium; put back.
2026-11-01 02:07:00 +08:00
yetone 20482d71ff library: a skill by a name the library has from elsewhere goes in beside it
mora1n on Discord: anthropics/skills' skill-creator and openai/skills'
are two skills by one name, and only the first could be added; the
second was skipped as "another skill called skill-creator, left as it
is". The library keyed being had by name in every place that asked.

Now being had is decided by source (hadSkill): the same source under any
name here, or a skill with no source (taken in from an agent's folder)
by that name with the very same files. Another skill from GitHub or a
git repository whose name is taken goes in beside it as
<name>-<owner> (skill-creator-openai), then owner-repo, repo, a number,
at most 64 bytes (freeSkillName in skill_beside.go). The library's copy
of its SKILL.md gets that name in the front matter's top-level name:
line (nameSkill), so no agent sees two skills by one name; Skill.Called
keeps the name it came with, and the carried bundle carries it. Its hash
is of the renamed copy, and checks (GitHub and git) and updates compare
what they fetch renamed the same way (fetchedHash), so it doesn't read
as edited and an update keeps the name.

The class: probe (Candidate.Have now means this skill; Candidate.As is
the name it has or would get), installFrom (listed and unlisted folder
by that name), the new-skills check (no longer drops a skill because
its name is taken), the market's had check (by name only for a skill
with no repository: none or a folder), carry, the TUI's probe list and
the GUI's probe list ("adds as {name}" with why in its title, "In the
library as {name}"; zh, zh-TW, ja, de; the tag is cut short in its row).

Old data: nothing is renamed. A skill already in the library keeps its
name, folder, SKILL.md and agent links; library.json without "called"
reads as before. Only a skill added from now on can get another name.
Not changed: a folder of the user's own is linked as it is and its
SKILL.md can't be named apart, so one by a taken name is still skipped,
now saying to rename it in its SKILL.md; and an agent's own skills
folder still holds one skill per name (an agent's own skill by the
library's name is settled by Use library / Keep agent's as before).

Run (mote, at c6fd4b37c on origin/main 6a900e0d0, then rebased on
0fe9f97c1, which touches only claudetui, gui and provider):
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build ./..., go build -tags nogui:
  clean.
- go test -tags nogui -count=1 -timeout 45m ./...: 82 packages ok,
  internal/gui red only in TestSettingsSaveKeepsWhatItDoesNotSend
  (SearchAll, #4514, open on main, not this change).
- After the rebase: internal/library and internal/tui ok.
- GUI, both engines: skill-install-beside (new), every skill-*,
  library-*, found-skill-*, remove-found-*, mcp-*, i18n-keys, gui-ja,
  gui-de, gui-zh-tw, font-cascade, inner-scroll-contain, win-fonts:
  1427 tests, 1423 pass. The 4 reds fail the same at origin/main
  3baf3b6df run alone: gui-ja (#4580), i18n-keys "Unmarked" (#4524),
  library-row-remove chromium (#3099).

Red on the old code: the anthropics-then-openai install against
origin/main code fails with "the library already has another skill
called skill-creator, left as it is". Broken by hand: fetchedHash made
to hash the fetched files unrenamed turns
TestSameNameFromAnotherSourceGoesInBeside red (hash mismatch); the
.lib-pick > .lib-tag rule removed turns skill-install-beside red ("the
tag stays in its row") in both widths.

Not tried: real anthropics/skills and openai/skills installs in a
sandbox HOME (the tests serve both repositories' layouts as tarballs;
the fixtures put both at skills/skill-creator. The real openai/skills
keeps it under skills/.system, which a probe of the repository's top
doesn't walk into; that is how probing has been and isn't changed
here); Windows and Linux runs of the GUI.
2026-11-01 02:02:24 +08:00
yetone 76e4494dbd gateway: In turn passes over a provider's fallback while the provider is ready (01huadalang)
01huadalang on Discord (#feedback, 10-31): once the main provider has
quota again, requests keep going to the fallback model, which is only
meant for emergencies.

Cause: a provider routed In turn treated its fallback rows as more of
its own keys. A new turn went to the row after the last answerer
(after), which past the provider's last key is the fallback, and a new
conversation went to the row the fewest conversations held (leastHeld),
which is the fallback nobody is on. Both happened while every key of the
provider was ready. The session spread already skipped fallbacks
(readyForNew); rotate's after and leastHeld(ready=false) did not.

Fix: standsIn(order, i) marks a fallback row when the plan's first row
is the provider's own. after, leastHeld and readyForNew all skip it, so
a fallback takes a new turn or conversation only when nothing ahead of
it can. Within one turn (tool results) a conversation still stays on
whoever answered, because of sealed reasoning.

Stays: Strict is the user's own choice and is not changed. A
conversation it keeps on the fallback stays there. The trace now names
the provider's ready first row (Affinity.Main), and the Routing page
says why: the provider is ready again, Strict never moves a
conversation, and new conversations go to the provider (en, zh, zh-TW,
ja, de).

Tests (internal/gateway/affinity_fallback_paths_test.go):
- TestRotatingProviderKeepsItsFallbackForEmergencies (1 and 2 keys)
- TestFallbackGivesBackAcrossRoutings: auto, in turn, in turn+session,
  least used+session, stays turn, and a group fallback with auto, in
  turn and session
- TestStrictKeepsTheFallbackAndSaysTheMainIsReady
On the old code, the rotate provider's new turn went to spare-key (Why
new-turn), and in turn+session's new conversation went to the fallback
(Why first). Broken by hand: with after's standsIn removed and Strict's
Main dropped, the rotate test, the in-turn cases and the Strict test go
red. session_spread_test's fallback case pinned the old In turn pick;
it now expects k2.
GUI: routing-affinity-order has a "strict" case.

Run (via mote-run unless noted):
- go test -tags nogui -count=1 -timeout 45m ./... at b08f35fcc (this
  change on 7428f3229): every package ok except two reds, both filed
  and the same on main: internal/gui TestSettingsSaveKeepsWhatItDoesNotSend
  (SearchAll, #4514) and internal/usage TestRequestChunksFromDisk
  (TempDir cleanup, #4390).
- Rebased onto 0fe9f97c1, at this head: go test ./internal/gateway -run
  'Affinity|Rotat|Fallback|Strict|Spread|Turn|Stick|Lead|Order': ok;
  go vet -tags nogui ./internal/gateway: ok
- go vet ./internal/gateway; GOOS=linux and GOOS=windows go vet -tags
  nogui ./internal/gateway ./internal/gui: ok
- gofmt -l: clean
- GUI in WSL (wsl-run), routing-affinity-order, routing-affinity-cache-
  write and i18n-keys in chromium and webkit: 43 of 44. The red is
  i18n-keys' "Unmarked", the same on main (#4524).

Not tried: a real account. This was reproduced with fake upstreams only.
2026-11-01 01:59:59 +08:00
yetone 535371c8f3 providers: a Claude subscription says whether it runs as Claude Code's interactive mode or claude -p, and why
The owner: the Claude Code provider page should say whether its runs go
through the TUI or the CLI, and what tells them apart and what each gains.

Under a Claude subscription's accounts a row now says "Running as
Claude Code's interactive mode (TUI)" (a green dot) or "Running as
claude -p (CLI)" with why: turned off in Settings, failed to start lately, Claude
Code in WSL whose home wasn't found, not installed, or a system with no
interactive mode. Under the TUI it says which requests still run as -p
(safeguards, a JSON schema, an image by URL, a first message over
400KB). "TUI or -p?" opens what each is: entrypoint cli, the plan
counting a request at about half; entrypoint sdk-cli, about twice.
"Change in Settings" opens Settings › Models at the interactive mode's
row. Only switch, which serves nothing, shows no row.

The mode comes from GET /api/claude/mode (gateway.ClaudeModeNow), read
as the editor opens and kept 30s, never in /api/providers' polls. Its
machine-wide reasons are claudeMachineWhy, which claudePrintWhy now
calls first, so the row and the gateway's own choice can't disagree.
The row is drawn by claudemode.js, which app.js loads with that first
read, so it weighs nothing on the core: after a rebase on origin/main
29d0ab39f the core was 1,541,482 bytes, over its 1,539,856, and the
budget isn't raised. "Runs as" became "Running as" so its keys don't
clash with a plugin's "Runs as" in i18n-keys.
A per-account WSL folder the probe can't read is still found only at
run time; the doc says so.

Run:
- go vet ./internal/gateway ./internal/gui (darwin), GOOS=windows, and
  GOOS=linux -tags nogui: 0.
- go test -run 'ClaudeTUI|ClaudeMachine|ClaudeSub' ./internal/gateway:
  ok (TestClaudeMachineWhy is new).
- After the rebase on 29d0ab39f, on mote: go test -run
  'CoreScriptBudget|I18n|Claude' ./internal/gui ok, the budget not
  raised; old-webkit.test.cjs lists claudemode.js with the other
  scripts app.js imports. Before the rebase, go test ./internal/gui: three reds that fail the
  same on origin/main ccc791231: TestSettingsSaveKeepsWhatItDoesNotSend
  (#4514), TestMainWindowCorners (#3949), and i18n-keys' "Unmarked"
  (#4524).
- claude-mode.test.cjs in WSL (Chromium and WebKit, 1100 and 420, en,
  zh, ja, de): 48 of 48.
- The full GUI suite on mote (load ~30) had 301 reds in 49 files; each
  of those files was run again in WSL at this head (743 tests, 259 red)
  and at origin/main ccc791231 (259 red, the same tests; #4600). The
  one that held apart was account-weight at de web 390: the row puts
  the accounts a screen above By weight on a phone, and Playwright's
  click scrolled the chip back into view. The test now brings the chip
  into view before it measures, so it judges the click's own scrolling;
  account-weight and claude-mode, both engines: 50 of 50.
- After moving the row into claudemode.js: the 142 GUI files with a
  Claude Code agent, in WSL (Chromium and WebKit): 1392 tests, 8 WebKit
  reds in 7 files. Each of those files was run again alone at this head
  and at 29d0ab39f: the same kind of WebKit reds on both, which
  subtests changing from run to run (library-items, number-units,
  routing-rule-models, usage-heatmap, usage-ledger-chart). phone-rows'
  Routing click on .rt-day failed 1 of 4 runs at each (WebKit zh, ja,
  de); the Routing page draws no such row. Filed under #4600, #4471,
  #4112.
- Real use on xiaomi-gpu (Windows 11, sandbox HOME, Claude Code in WSL
  magpie-desktop): /api/claude/mode said {"tui":true,"wsl":true}; with
  the setting turned off through POST /api/settings,
  {"tui":false,"why":"off","wsl":true}; set back, TUI again.
- Rebased on origin/main 02ff0e908 (no file in common): on mote, vet
  for darwin, windows and linux nogui 0; go test ./internal/claudetui
  ok; -run 'CoreScriptBudget|I18n|Claude|Budget' ./internal/gui ok;
  -run Claude ./internal/gateway ok. In WSL claude-mode, account-weight,
  old-webkit and i18n-keys: 59 of 60, the one red i18n-keys' "Unmarked"
  (#4524).

Broken by hand: the editor draws twice before the read returns, and the
test's one-read check went red with two reads until the read in flight
was shared (claudeModeRead).
account-weight's check went red ("en 1000: a click scrolled") with the
chip's click made to scroll the editor 120px.

Not tried: the window on macOS with a real account (the row is the
same code as the web GUI's), and the "broken" reason with a real
failed start.
2026-11-01 00:37:29 +08:00
yetone c30d3b7b63 plugin pages: a page the reader left is told, and let go after 10 minutes unless it keeps itself
A plugin's page kept its frame, with its scripts, timers and
connections, for as long as the window was open once it had been
looked at: show() only hid its view, and a frame in a hidden view isn't
hidden to itself (its visibilityState doesn't change), so a page
couldn't even pause on its own. Asked by the owner: is that by design?
Only the lazy first load was.

- The kernel's leave hook now reaches the page part: the page is told
  {event: "visibility", data: {visible}} as the reader leaves and comes
  back. The bridge has magpie.visible and magpie.onVisibility(fn); hello
  carries visible, for a page left before it said hello.
- A page left 10 minutes (IDLE_MS) has its frame removed and loads again
  when next opened. Back sooner, it is the same frame. Its hello timer is
  cleared, so nothing says it broke.
- magpie.page.keepAlive: true (plugin.PageSpec.KeepAlive, keepAlive in
  /api/plugin-pages) keeps a page however long, for one that works while
  no one looks at it. Anything but true is false, read as raw JSON so a
  wrong type never drops the package's page.
- plugin-runtime.md's page row says so.

Run on mote. The Go suite and most GUI files ran at this change on
557f51dbf. After rebasing onto 30cd39f19 (none of these files changed
upstream), the budgets, TestWindow* and the page GUI files ran again
at this tree:
- plugin-page-idle (new), plugin-page and plugin-panels, chromium and
  webkit: 14/14 at 557f51dbf. At the rebased tree, the first run was
  13/14: plugin-page's chromium "draws in its frame, shut in" was red
  once, and its assertion wasn't kept (#4589). After that: 42/42 over
  3 runs, then 16/16 chromium over 4.
- i18n-keys, plugin-actions, plugin-kinds-discover, plugin-kernel,
  plugin-replaced, plugin-proxy-page: 51/52. The red is i18n-keys'
  "Unmarked", the same on origin/main e0eb74987 (#4524).
- go test -timeout 45m ./...: every package ok except three reds, none in
  code touched here:
  - TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
    TestMainWindowCorners (#3949) fail the same on origin/main e0eb74987.
  - TestUnroutedHeldReportSaved (#4300) failed in the full run only.
    Alone, -count=5, it passes.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., go build ./..., gofmt -l: clean.

Broken by hand: with the leave hook taken out of the page part, the new
test is red in both engines.

Not tried: a real plugin page in the desktop app or WebKitGTK. The
IDLE_MS length (10 minutes) is a judgement, not measured.
2026-10-31 22:39:37 +08:00
yetone b75fa328ce gui: the ban warning is said once, not again beside accounts signed in
The owner, on Claude Code's editor with four Claude accounts in it and
"Claude 账号可能被封禁" shown on Add another: "这里就不要显示可能被封禁了".
A subscription that warns before a sign-in (Claude, Antigravity and the
plugin-served ones with risk) now warns only while it has no account
signed in, and never to sign one of its accounts in again. startSignIn
asks hasLogins(agent), and its o.user, before the risk step. The import
box keeps its note.

What goes with it: Factory's warning offered "Use an API key instead…".
Factory is retired and the Add sheet leaves it out with no account, so
that warning was reachable only beside an account, and no longer is.
Its accounts list's "Add an account by API key…" row still offers the
key; factory-key.test.cjs now starts there. signin-close and
signin-proxy no longer click "Sign in anyway" in editors with accounts.

claude-risk.test.cjs: a new case opens a Claude editor with an account,
clicks Add another, and wants the sign-in asked at once with no warning
(chromium and webkit, en and zh). The first-account case is unchanged.

Run, on the Linux box (magpie-desktop):
- Broken by hand: the old app.js with the new test: red in both engines,
  nothing asked.
- All 46 GUI files that reach a sign-in or the warning, plus i18n-keys:
  739 ok, 2 red. login-import chromium en timed out waiting on its
  import box, then passed 4 of 4 alone. i18n-keys' "a plugin's words are
  its own" is red the same at origin/main fb29cd30f: #4524.
- An earlier run of the same files had claude-setup-token chromium zh
  and deprecated-subscriptions webkit zh red once each; both passed in
  the six-file rerun at this head (74 of 74).

At the pushed head (rebased on fb29cd30f): the four changed GUI files,
60 of 60 ok. go test ./internal/gui on mote: red only in
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949), both red the same at
origin/main fb29cd30f.

Not tried: the real app, and macOS WebKit (mote's WebKit launches hang).
2026-10-31 22:39:21 +08:00
yetone 59ea5dc8f8 gateway: a failure with this computer off the network rests nobody (usrname1833)
usrname1833 on Discord: with the computer offline, a routing group's
members failed to connect one after another, each rested, and the first
stayed behind the others once the network was back.

A 502 whose error says no connection was made (dial, lookup, refused, no
route, TLS handshake timeout, and Bun's ConnectionRefused / ENOTFOUND
for a plugin's fetch) now asks whether this computer has a network,
unless any upstream answered in the last 15s: no interface up with a
global address means none; otherwise up to three hosts of the user's
other providers (not p's own, not proxied ones, not localhost / LAN) are
dialled at once (2s), and none taking the connection means offline. The
verdict is kept 5s and asked by one request at a time. Offline, the
member is passed over as a down proxy is (failProxy): no rest, no count,
the trace says Fail "offline". One provider that can't connect while
another's host takes a connection, or while replies came lately, still
rests as before.

Covered where every rest passes: restAfterMarked (so decide_group's and
count_tokens' rests too), the serve loop's next-member path, and the last
member's label. Routing page: "network down" tag and a story for the
next-member and last-member cases, in zh, zh-TW, ja and de.

Run (mote, at this tree):
- gofmt -l clean; go vet ./internal/gateway on darwin, GOOS=linux,
  GOOS=windows: ok
- go test -run 'TestOfflineRestsNobody|TestProxyDownDoesNotRest' -v
  ./internal/gateway: ok; go test -timeout 45m ./internal/gateway:
  ok (708s)
- GUI: routing-offline.test.cjs (new) 10/10 and routing-proxy 4/4,
  Chromium + WebKit, en zh zh-TW ja de. Every routing-*.test.cjs at once
  (load 30-44 on mote): 1997 pass, 29 fail. The untouched base 3d063e34f
  gives 1987 pass, 29 fail in the same files, with the subtests shuffled
  (#4585). i18n-keys: only "Unmarked" is red (#4524), as on the base.
Broken by hand: offlineFailure returning false -> TestOfflineRestsNobody
red ("nothing reachable" and "no interface up": Fail other, Rest set);
client.js at HEAD -> routing-offline 0/5 in Chromium.

Not tried: a real machine taken off the network; a plugin (Bun) fetch's
real offline error text (matched from Bun's error names only); providers
behind a proxy (left to failProxy and not dialled); a group whose
members all sit on the local network (near hosts aren't dialled, so
with an interface up their failures still rest); the full ./... suite.
2026-10-31 22:23:18 +08:00