Commit Graph
2771 Commits
Author SHA1 Message Date
yetone 92d2ed74f9 providers: an Ark key's Seedance models are under Video models in its editor, each to tick
axelburks on Discord: "供应商里方舟的配置页,有图像模型选项能勾选模型,但是没
有视频模型选项不能勾选视频模型". A Volcengine Ark key's editor listed its
Seedream models under Image models, to tick, and had its Seedance models
among the chat models or nowhere.

Cause, two parts:
- The editor had no video section at all: video models had no list and no
  hidden set (gateway-routing.md said "Video models aren't listed in the
  editor, so there is nothing to hide there").
- catalog's live parse read only "kind" and modalities.input/output. Ark's
  /api/v3/models marks no kind: it says domain "VideoGeneration" /
  "ImageGeneration" and modalities.input_modalities/output_modalities. So
  Seedance came back as a chat model, and 3D models (output 3d, no text)
  as chat models too.

Change:
- catalog: a live row with no kind is a video model when its domain is
  VideoGeneration or it outputs video without text, an image model for
  ImageGeneration or image without text; Ark's input_modalities /
  output_modalities are read when input/output aren't there, so a model
  that gives no text (Ark's 3D) is left out of the chat list.
  TestFetchArkMarksVideoModels runs on a captured Ark list
  (testdata/volcengine-ark-models-2026-11-03.json, fetched read-only
  with GET /api/v3/models, no key in it).
- provider: HiddenVideomakers beside HiddenDrawers, VideomakerHidden.
- gateway: VideomakersOf (Videomakers on a given list, for the editor),
  OfferedVideomakers = Videomakers less the unticked ones, read by
  AutoVideomaker, videomakerObjects (another magpie's list) and
  mediaModels(true) (generate_video). A hidden one still makes its video
  when named: bareVideomaker, videosCreate and arkFilms read Videomakers.
- gui: the editor's Video models section (renderVideomakers), filmIds and
  hiddenVideomakers on /api/providers, kept on save as hiddenDrawers is;
  i18n for every language. app.js comments cut to stay under
  TestCoreScriptBudget, which this change reached; no raise.
- docs: gateway-routing.md's Hidden image models section.

Old data: an Ark list fetched before keeps Seedance among its chat models
until its list is fetched again;
customVideomakers already counts any Seedance id an Ark key lists or picks
as a video model, so it makes videos and shows under Video models now.

Run on mote, this change and the next (/v1/models ?kind=, gateway and
docs only) rebased on f4c664a09; this commit's own tree, on 17f2387e1,
gave the same Go results with Linux and Windows vet of ./internal/...
clean:
- go test -count=1 -timeout 45m ./internal/catalog ./internal/provider
  ./internal/gateway ./internal/gui: catalog, provider and gateway ok;
  gui red only in TestMainWindowCorners/macOS_26_SDK (#3949, red on main).
- GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. gofmt -l: nothing.
- GUI (at the next commit's tree, which adds no GUI file or script): the 51 provider-*, drawers, image-models, i18n and
  video-models-hide files, both engines, every language, wide and narrow:
  1161 of 1188 ok. The 27 reds are 5 files that are red the same 27 at
  origin/main d1cdce130 run alone: provider-fetch-again (#3292/#5057),
  provider-models-rest (#4396), provider-picks-stay (#4397),
  provider-levels-scroll (#4395), provider-typed (#4673).
  video-models-hide: 22 of 22 ok.
- The whole GUI suite (all files) ran earlier at this change on 8af751987,
  347 of 19153 red at load 100 to 200; the 66 files with a red, run again
  alone, are red in the same tests at origin/main 17f2387e1 (all filed:
  #4388, #4391, #4398, #4320, #4541/#5013, #2564, #4244, #4304 and the
  above).
Rebased again onto d1cdce130 (sessions, Cursor mover, library and routing
plugins, group-unlists; nothing this change touches but gateway.go,
which merged clean) and run there: TestCoreScriptBudget and internal/gui's
new tests, the gateway's ?kind= and video tests, internal/provider and
internal/catalog, video-models-hide 22 of 22: ok.

Broken by hand, each red, then put back:
- the domain/output check in catalog's live parse:
  TestFetchArkMarksVideoModels red
- OfferedVideomakers returning Videomakers whole:
  TestHiddenVideomakerLeavesListsButStillFilms red
- the editor's filmIds left empty: TestVideoModelsHidden red
- a save without hiddenVideomakers dropping the old ones:
  TestVideoModelsHidden red
- renderVideomakers' call in the editor left out: video-models-hide
  22 of 22 red
- a chip's click not changing the draft: video-models-hide 22 of 22 red

Not tried: no real Ark video was made (no money spent); the list parse was
checked on a real Ark list fetched read-only. The editor was not opened in
the real app, only in the GUI tests' fake API.

Credit: axelburks on Discord.
2026-11-03 18:34:19 +08:00
yetone d1cdce1302 provider: the group alone keeps subscription models out of agents' lists (shaoyang.)
shaoyang. on Discord (#general, 11-03): with a routing group's Model
lists set to the group alone (its card's 成员模型不单独列出), the model
list fetched still had every model of the group.

Cause: 88e6fb9cf (v0.1.2176, 10-30) had catalogOf keep a signed-in
subscription's models (SubscriptionKept: a ChatGPT, Claude, Copilot or
plugin account's) for every agent, leaving the group alone only for a
client that is no agent (""). Over HTTP no client is "": agentOf falls
back to usage.AgentOf(User-Agent), which is "other" or the UA's name, so
every /v1/models fetch, every agent's written list and every picker
listed a subscription member beside the group. For a group made of
subscription models, as most are, the option changed nothing.

Fix: catalogOf gives every agent but Codex Catalog(), as before
88e6fb9cf; Codex keeps its ChatGPT sign-in's own models (CodexOwn,
a3ee00c05), which its app reaches on that sign-in. SubscriptionKept is
gone; Unlisted() and GroupKept() name subscription members again, so the
picker's "kept for routing groups" note and the provider editor's
"listed alone" line (3d063e34f) say where they went. The routing editor's
hint says Codex keeps its own, in en, zh, zh-TW, ja and de. Docs:
reference.md, gateway-routing.md.

Behaviour change for 士奇's case (88e6fb9cf): with "The group alone" on,
Hermes, WorkBuddy and the rest lose the group's subscription models
again; that is what the option says. Listing its models too keeps them beside
the group, which the new test checks.

Tests:
- gui TestGroupAloneKeepsSubscriptionModelsOutOfEveryAgentsList (replaces
  TestSubscriptionModelsStayInEveryAgentsListWithGroupOn): a sandbox
  ChatGPT sign-in's 5 models in a group listing alone. For every agent
  but Codex that lists the group, its Agents-page list, CatalogFor and
  model pickers leave them out; Unlisted names them; with "Its models
  too" hermes, workbuddy, claude and codex list them.
- gateway TestGroupAloneKeepsSubscriptionModelsOffAgentsModelList:
  GET /v1/models with no key, "magpie" and magpie-hermes/-claude/-opencode
  lists group/mine and not its members; /v1/models/{id} doesn't find one
  for Hermes; Codex's key lists and finds them; listed again with
  listed too.
- TestCodexOwnModelsListedOnlyThroughGroups again expects Claude Code not
  to list a group-alone member.

Run on mote at 3da80330a (rebased on origin/main c3593dc49): gofmt -l
clean; go vet (darwin -tags nogui, GOOS=linux -tags nogui at the base,
GOOS=windows) on provider, gateway, gui ok; go test -timeout 45m
internal/provider ok, internal/gui ok, internal/gateway -run
"TestGroup|TestCodex|TestUnlisted|TestModels|TestDesktop" ok. At the
base 40a287b21: internal/provider, gateway, gui and agent whole ok;
internal/cli red only in TestEveryRouteHasACommandOrIsNamed (GET
/api/context/reply, #5026, red on main since 0872bc2a0). GUI:
group-unlists (en/zh/zh-TW/ja/de, 1100 and 420px), unlisted-group-kept,
unlisted-models, agent-models-group-on, i18n-keys in chromium and webkit,
56 of 56.

Broken by hand: catalogOf back to SubscriptionKept with the new tests in
place; the gui test failed with 484 "the group alone" errors (codex/gpt-5.5
in claude's, claude-desktop's, claude-science's lists and pickers among
them) and the gateway test for every key, no key and "magpie" included.

Not tried: a real ChatGPT/Claude sign-in or the running app, and the
reporter's Docker deployment (same /v1/models path, no OS branch); which
agent fetched the list isn't known.
2026-11-03 18:23:13 +08:00
yetone 00098f12bf library: Magpie Browser's "which agents may use it" is a line of its own under its row
tao0194 on Discord (v0.1.2828, zh, panel-width window): in Library > MCP
servers the magpie-browser row showed the connected ask (green dot, the
question, a button per agent) inside the name's column, wrapped into a
narrow strip between the command and the row's Scope and agent chips,
three lines tall beside every other server's two.

browserAsk's element was appended to the row's .who. It is now the row's
own child: the row gets lib-asking while it shows, wraps, and the ask
takes a line under the name, command and chips, from the name's left
edge (the picture plus the row's gap, 37px, 38px in the window's rows)
to the row's right edge. The first line keeps the name, command and
chips as the other rows have them (.who flex-basis 0 above 560px). At
560px and under, where rows already wrap, a long command now ellipsizes
beside the row's picture instead of taking the name to a line of its
own under it; that was so for any server with a long command, and the
ask's left edge follows the name. docs/subsystems/library.md says where
the ask sits.

library-browser-ask.test.cjs now has three agents (Codex, Zed among
them) and a context7 row beside it, runs at 1100, 600, the panel's 440
and 360, and checks the ask starts under the first line, at the name's
left edge, reaches the chips' right edge, that the first line is as
tall as another server's, and that the name sits beside the picture.

Run (mote, Playwright 1.62.0, Chromium and WebKit, en/zh/zh-TW/ja/de):
- library-browser-ask.test.cjs on the old client.js/library.css: 42 of
  44 red (every layout subtest; the two not-connected/given ones pass).
  With the change: 44 of 44 green.
- The 84 GUI files that open the Library, name lib-row/lib-server or
  library.css, or check budgets and i18n keys: 1480 of 1480 ok, before
  the rebase onto c3593dc49 (no upstream change touches these files);
  library-browser-ask, i18n-keys and builtins again after it: 52 of 52
  ok. go test ./internal/gui at the rebased head: TestMainWindowCorners
  red only (an AppKit window test, the same on origin/main 78cd4e6dd,
  #3949); everything else ok.
Not tried: the real app's panel (WKWebView) with a connected extension;
the full GUI suite.
2026-11-03 18:21:58 +08:00
yetone f4c664a09c plugin, gui: magpie web ends its plugin hosts, waited for, before it runs the new version (#3285)
The second way acezan's 57 <defunct> magpie-bun (v0.1.2819, a Linux
systemd service, 47 hours) pile up: magpie web's restart to update
(AutoRestart) runs the new version with syscall.Exec in the same pid.
The running plugin host was the old image's child, and the old image's
host.read held the only Wait for it. After the exec nothing waits for
it, so it ends on stdin EOF and stays <defunct> under that pid, one per
restart to update. skygunner reproduced it and AAEE86 counted 22 zombies
for 23 images under one pid (#3285). With about a hundred releases a
day, an AutoRestart service makes about one a hour, as acezan's did.

- plugin.EndHosts (host.go) stops every host started and not yet
  reaped, including the retiring ones, waits until each one has been
  waited for, and refuses to start another (errHostsEnded). startOn
  starts the host and records it under one lock (live), so a host that
  starts during EndHosts isn't missed.
- Web.Wait calls it right before update.Reexec.

Run at 72bc741ef (on origin/main 40a287b21, after the previous commit):
- mote (macOS): gofmt -l clean; go vet ./internal/gui ./internal/plugin,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok.
  go test -count=1 -timeout 45m ./internal/plugin: ok; -run Web
  ./internal/gui: ok.
- WSL magpie-desktop (Linux): ./internal/plugin ok, including
  TestEndHostsLeavesNoChild and TestHostReapedWhileItsChildHoldsStdout
  with a real Bun host; -race -count=3 of both: ok; go vet -tags nogui
  and -run Web of ./internal/gui: ok.

Both commits were then rebased onto 0acba61a3, which changes only
app.js and plugin-checkin.test.cjs; no Go file these runs built moved,
and they were not run again there.

Broken by hand: EndHosts returning at once makes
TestEndHostsLeavesNoChild fail on Linux ("children left once EndHosts
returned: [16459 S bun]").

Not tried: a real magpie web restart to update (a downloaded update
exec'd in the same pid) on Linux. The test covers EndHosts, not the
exec. Not changed: anything else alive at the exec (pii's helper,
awake's caffeinate, #4188) still outlives it the same way.

Reported by acezan on Discord. Diagnosed in #3285 by skygunner and
AAEE86.
2026-11-03 17:58:31 +08:00
yetone 0acba61a35 gui: a lone plugin's check-in tab is named for it, not "Plugins"
ljq906416 and justrun_way on X couldn't find WorkBuddy's daily check-in
after it moved to its plugin. The WorkBuddy plugin (0.2.0 on) checks in
itself, so magpie hides its own WorkBuddy tab under Settings › Usage's
check-in tabs and the switch sits under a tab labelled "Plugins" (插件),
which nobody looking for WorkBuddy reads. With one plugin checking in,
the tab now carries that plugin's name (WorkBuddy), as a built-in's tab
does; two or more still share "Plugins". The label is set through
data-en, so a language change keeps it.

Run (wsl-run, Linux, Chromium + WebKit, en/zh/zh-TW/ja/de):
plugin-checkin, checkin-reason, checkin-reason-once and i18n-keys:
64 pass, 0 fail. The new two-plugin test checks the shared tab's
translated name and both rows; the 440px test checks the lone tab reads
"FakeCo".
Broken by hand: with the old app.js the 440px test fails in chromium en
and zh (expected FakeCo, read "Plugins"); the two-plugin test passes
there, as it guards the shared case.
Size budgets summed by hand the way TestCoreScriptBudget does (the Go
package needs cgo, which wsl lacks): app.js 1,308,499 of 1,316,874,
core 1,529,963 of 1,533,802, no raise.
Not tried: the real app with a signed-in WorkBuddy plugin.
2026-11-03 17:58:06 +08:00
yetone 9019ca88d6 gui: Scroll to top and Scroll to bottom move when the page under them changes, not only on a scroll (Jiabubu)
Jiabubu on Discord: with the capsule in sight, a click that opened a
Routing group left it over the editor's member rows (Remove beside Up
and Down) and its held Cancel and Add, and it moved off them only once
the page was scrolled.

scrollends.js placed the capsule on a scroll, a resize, focus or the
pointer leaving it, and a hidden attribute set anywhere. Opening a group
in place sets none, unless something else on the page happened to be
hidden again in the same draw (an empty pool list is, on every draw,
which is why the earlier tests saw it move). It now also watches the
open page and each of its own children with a ResizeObserver, and the
page's child list, so any change of size under it (a group opened or
closed, rows added or taken out) places it again on the next frame: it
rises above a held foot, steps aside at the page's foot, or comes back.
One file serves every page with the capsule (Agents, Providers, Routing,
Library, Settings, plugin pages), so they all take it. No core script
changed; scrollends.js loads lazily and has no budget.

view-ends-relayout.test.cjs: with no scroll after the change, the capsule
must be where the reader's next scroll puts it, and over nothing of the
editor's:
- Routing, 16 groups of the reporter's rows ("低-ultra", 922K), a pool in
  the list: a screen down, a click on the card lowest in sight opens its
  editor; then Cancel closes it.
- Agents, 40 rows: a little above the foot, a block at the list's end
  taken out so the foot comes up under the capsule.
Desktop 1100, 700, 560; browser page 1100, 440, 360; Chromium and WebKit,
en/zh/zh-TW/ja/de.

Run on mote (mote-run) at this tree:
- view-ends-relayout, both engines, every language: 10 of 10 ok.
- On 5ee5274bd (origin/main just fetched) plus this change:
  view-ends-relayout, view-ends, routing-editor-foot, old-webkit and
  i18n-keys: 62 of 62 ok.
- Before the rebase (on c0d4f17a3), with group-editor-selected,
  group-editor-fits, group-member-drag, drag-rows-shift, routing-rows-fit,
  click-scroll, add-button, library-discover-jump and account-eye beside
  those: 214 of 214 ok.

Broken by hand: scrollends.js as at origin/main, 20 of 20 red (both
engines, every language), each part on its own:
- Routing: "desktop 1100px: opened, the capsule above the held Cancel
  and Add, with no scroll: 569-624, bar from 591".
- Agents only: "desktop 1100px agents shorter: the capsule stepped aside
  as a scroll has it, with no scroll: [[true,569,624,1739],[false,...]]".

Not tried: the whole GUI suite. Both machines already had full suites of
other sessions running (WSL: four, at load ~140; mote: one, 49 minutes
in), and one full suite runs on a machine at a time. The capsule's
behaviour is the only change, no layout and no new API call. Also not
tried: the Windows app (WebView2) and the Linux app (WebKitGTK) themselves,
and the reporter's own groups.
2026-11-03 17:26:53 +08:00
yetone 900ae0fa51 backup, sync: sign-ins go too when picked, sealed, never over a later renewal
qianxunji (#feedback) and curtinp118 on Discord: a VPS restored from a
backup, or a new computer joining sync, had to sign in to every
subscription again. Sign-ins (subscription accounts in logins.json,
Codex's auth.json, plugins' sign-ins in plugin-auth.json) can now go too,
in each place only when picked; all are off by default, so an upgrade
carries nothing new.

- Sync (WebDAV, S3, GitHub): a "Sign-ins" tick in the form, with a line
  saying anyone with the passphrase and the server's file can use the
  accounts, and that an account on two computers can be signed out on one
  when the other renews it. CLI: `magpie webdav|s3|github set sign-ins=yes`.
- Export: "With the sign-ins", off; ticked, the passphrase hint says the
  file holds them. CLI: `magpie backup --sign-ins`.
- Import: "Bring in the sign-ins too, when the file has them", on. CLI:
  `magpie restore --no-sign-ins` leaves them out.
- Back up by itself: "Sign-ins in backups", Off/On. On asks for a
  passphrase (twice) that seals the sign-ins alone (the rest of an
  automatic backup stays unsealed, as before); it is kept in
  autobackup.json (0600), never sent in the view. A backup whose sign-ins
  another passphrase sealed restores without them and says so.

What goes (provider.CollectSignIns, plugin.CarriedAuth): magpie's own
copies only, not an agent's own account, an agent-home row, a hidden or
plugin: row, or a retired built-in. Each record is keyed by agent +
email + org (or the account key); ids two rows share go on neither side.

Restore/import (RestoreSignIns) adds what is missing and updates only
when the incoming copy was renewed later; nothing here is removed.
Before writing over a row it counts every row that could be the same
account (same login, same refresh token, same id): none adds, several
keeps all, one is kept when it isn't magpie's own copy, is held, or is
the agent's live account. Codex's auth.json is written temp-and-rename,
0600, only where Codex is signed out.

Sync merges per record against the last sync's hashes (MergeSignIns):
the later renewal wins; a removal crosses only when the other side still
had it as of the last sync; ApplySignIns re-checks each row's hash
before writing so a renewal in between is kept. A computer with the tick
off sends none, so others remove nothing for it; turning it off, a
Restore, or a replaced server file clears the last-sync record.

Export's and Import's forms moved out of app.js into syncfiles.js,
imported when one opens (as autobackup.js is), so the core is 3.2KB
under its budget with no raise (app.js 3.2KB smaller than before).

docs/subsystems/sync-backup.md has a "Sign-ins, when picked" section;
subscription_signin_test.go's header now says it pins the default.

Run at the pushed head (678d28cba on origin/main bc10a6198):
- wsl-run go test -tags nogui -timeout 45m: backup, davsync, plugin, gui
  ok (TestCoreScriptBudget in it). provider: one red,
  TestCancelledPluginSignInSavesNothing, the late sign-in saved after
  Cancel. It is green 20 of 20 alone, at this head and at origin/main
  alike, and this change adds only new files there whose tests run after
  it; filed as #5047. cli there hung in proc.lookStamp's os.Stat on WSL
  at load 100, so it ran again on mote: one red,
  TestEveryRouteHasACommandOrIsNamed (GET /api/context/reply, #5026),
  the same at origin/main. gateway -run TestCompactionOverByteCapEveryTime
  ok (#4862 on mote's full run). TestMainWindowCorners on mote: red the
  same at origin/main (#3949).
- GUI, on mote: the 16 files that open Sync, plus i18n-keys and
  old-webkit, Chromium and WebKit, every language: 255 of 294 pass. The 39
  reds are segs-press-redraw's searchAllRow (#4566), s3-sync in WebKit
  (#2448) and usage-agents-hide (#3414). The same files at origin/main
  bc10a6198 give the same 39 pass and 39 fail. sync-signins, auto-backup,
  sync-sign-in, i18n-keys and old-webkit alone on WSL: 92/92.
- The whole GUI suite on WSL, stopped at 737 of its tests (1162 files,
  load ~100 there): 9 reds, all WebKit, none in a Sync file:
  account-eye (#4244, #5052), add-button (#4792), account-plugin-user
  and agent-expand-steady. The last two pass at this head and at
  origin/main on mote. The rest of the suite was not run.
- gofmt -l: clean. go vet: darwin (internal/gui, internal/cli),
  GOOS=linux and GOOS=windows -tags nogui for backup, davsync, provider,
  plugin, cli, gui: ok.
- win-run and wsl-run: go test -tags nogui -run
  'SignIns|Carries|AutoBackupSignIns' ./internal/provider
  ./internal/backup ./internal/davsync: ok on Windows 11 and Ubuntu 24.04.
- sync-signins.test.cjs: 20/20, Chromium and WebKit, 1100 and 420px,
  en/zh/zh-TW/ja/de, no horizontal overflow, no page errors.

Then rebased on origin/main 5ee5274bd (12 commits; davsync.go, app.js and
i18n.js merged with no conflict) and run again at the pushed head on mote:
gofmt clean; go test -run 'TestCoreScriptBudget|SignIns|Carries|
AutoBackup|Sync' for gui, davsync, backup and provider: ok; sync-signins,
auto-backup, sync-sign-in, i18n-keys, old-webkit: 92/92.

Broken by hand, each red, then restored:
- RestoreSignIns writing an older token over a newer one:
  TestRestoreSignInsNeverWritesAnOlderTokenOver red.
- The ambiguous-account guard has two layers (more than one match, and
  a single match with another record id); with only the first removed
  the test stayed green, with both removed
  TestRestoreSignInsLeavesAnAmbiguousAccount went red.
- MergeSignIns removing a row renewed here: TestMergeSignInsRemovedOnlyWhenTheOtherSideRemovedIt
  red.
- Codex auth.json written over a signed-in Codex:
  TestRestoreSignInsSignsCodexInOnlyWhereSignedOut red.
- ApplySignIns not re-checking the hash: TestApplySignInsKeepsWhatChangedSinceTheMerge
  red.
- davsync forgetting the last-sync record (st.SignIns = nil):
  TestSyncSignIns red.
- GUI: Export's tick on by default, and auto backup's On posting with
  no passphrase: sync-signins.test.cjs red for each.

Not tried: real accounts carried to a real VPS or second computer (all
Go tests use testenv homes, fake DAV and fake tokens; the Keychain is
never reached); a real vendor's refresh after a carried sign-in, and how
each vendor treats one refresh token used from two machines; the CLI
flags against a sandbox HOME (covered by the cli package's tests only);
auto backup's sign-ins have no CLI switch.
2026-11-03 17:24:19 +08:00
yetone 5ee5274bd9 quotas: a remote magpie's Codex reset is used from its card here (#3850)
prgrmrwy runs magpie on a home server and uses it from work through a
remote magpie (and DSH). The remote Codex card said "1 reset", but the
reset could only be used from the GUI of the computer that holds the
sign-in.

What changed:
- Gateway: POST /v1/magpie/quotas/codex-reset?user=<email>[&credit=<id>]
  (Server.codexReset) spends one of that account's resets with
  provider.SpendCodexReset. That is the Usage page's own code
  (UseCodexResetCard, then AwaitAllowance), moved out of
  internal/gui/usage.go so both use it. A reset can't be undone, so the
  route needs an enabled gateway key with full access, from loopback too.
  No key gets 401, and that covers every corsGuard exemption that has no
  key: Origin null, app schemes, *.localhost and a missing Origin. A
  read-only key gets 403 gateway_key_read_only (readOnlyGuard, which
  readOnlyRefused now lists, and again in the handler). A held key gets
  403 gateway_key_held, even one told quotas. The account must be named
  (400 otherwise). One ask runs per account at a time (409). When the
  reset is used, that card is read again.
- Remote client: UseRemoteCodexReset (remote_quotas.go) asks the remote
  with the provider's key. remoteJSON's status mapping is shared through
  remoteBody. A read-only key there is told as such, and a 404 as a
  remote too old. With no answer in time it says the reset may have been
  used, and it never asks again by itself. A remote Codex card now keeps
  its Resets; a GLM team's (byWindow) and every check-in are still
  dropped.
- GUI: "Use a reset" / "Use one..." show on a remote Codex card
  (codexResetCard). They open the same in-app confirmation sheet, with a
  line saying which computer's magpie uses it, and send the card's
  provider to /api/usage/codex-reset. The remote's errors are put in the
  user's words. New strings are in all 5 languages.
- DSH: no code here. Its provider plugin reads /v1/magpie/quotas/cards
  and can call the new route with a full key.
- resetOutcome (a reset's result in words) moved from app.js into
  resetask.js, the only place that says it, so the core's scripts stay
  in TestCoreScriptBudget's 1,533,802 with no raise (1,533,003 after;
  origin/main b967b1620 is 1,533,756).
- Docs: reference.md (remote quotas, gateway keys), gateway-routing.md
  (read-only list, the route's admission), providers-accounts.md.

What was run (rebased on origin/main b967b1620, then on 2e4735f8f):
- mote, at the head before the rebase and the resetOutcome move:
  go test -count=1 -timeout 45m ./internal/provider ./internal/gateway
  ./internal/gui at load ~300-450. provider ok. gateway: only
  TestCompactionOverByteCapEveryTime (#4862). gui: TestCoreScriptBudget
  (this change, 158 bytes over; fixed by the move), TestMainWindowCorners
  (#3949) and TestGatewaySkewOfAnotherIsSaidNotQuit/own_build (#5053,
  passes alone here and at b967b1620).
- mote, same run: 155 GUI files (reset|quota|usage-|panel-|i18n|budget|
  remote|gui-|old-webkit|core-script|script-size), 1856 of 1904 pass.
- WSL (magpie-desktop), the 9 red files alone, at this change and at
  origin/main b967b1620: this change 147 pass / 43 fail, main 146 / 44;
  every test red here is red on main too: codex-auto-reset webkit de
  (#4790), remote-magpie (#4398), usage-agents-hide (#3414), usage-fold
  (#3415, #4790), usage-heatmap (#4718), usage-ledger (#5048).
  codex-reset-lead (#5054) and panel-routing-providers (#5055) were red
  only under mote's load and pass alone on both.
- mote, at this head: TestCoreScriptBudget and
  TestGatewaySkewOfAnotherIsSaidNotQuit ok.
- WSL, at this head: account-every-reset, codex-resets-used, i18n-keys,
  providers-reset-use, remote-codex-reset, reset-each-title,
  reset-pick-card, reset-providers, quota-used-no-reset: 99 of 102 pass.
  The 3 reds are providers-reset-use's 420px Windows cases ("a click
  moved the page", #4873); that file alone is red on origin/main
  b967b1620 too (3 of 40 there, 2 of 40 here).
- WSL, rebased on 2e4735f8f (main had changed internal/gateway): the new
  tests and the read-only, CORS, LAN-guard, held-key, remote-magpie and
  UseCodexResetCard tests in ./internal/gateway ./internal/provider ok;
  core scripts 1,532,960 under 1,533,802; gofmt clean.
- Earlier on mote: TestCodexResetNeedsAFullKey,
  TestRemoteCodexResetThroughTheGateway, TestRemoteCodexResetAnswers, the
  read-only, CORS, LAN-guard, held-key and remote-magpie tests ok;
  remote-codex-reset and reset-pick-card 20 of 20 (chromium and webkit,
  5 languages, 900/390/440px). gofmt clean; go vet darwin, windows ok,
  linux for provider and gateway.

Broken by hand:
- With the handler's key check turned off, TestCodexResetNeedsAFullKey
  went red: "this computer, no key: 200 {code: reset}" and a reset was
  spent.
- With codexResetCard put back to provider === "codex",
  remote-codex-reset.test.cjs went red ("one Use, on the remote Codex
  card"). On the old code the route doesn't exist, so the full-key case
  gets 404.

Not tried:
- A real Codex reset spent between two real magpies: none was spent, to
  keep the owner's resets. The ChatGPT backend is the fake from
  codex_autoreset_test.
- DSH's plugin calling the route.
- GOOS=linux vet of internal/gui: it needs gtk4/webkitgtk, which neither
  mote nor magpie-desktop has. Its change is usage.go only, and that was
  vetted on darwin and windows.

Thanks to prgrmrwy for the report and the proposal.
2026-11-03 17:12:25 +08:00
yetone 69167bc299 usage: a reply let go under a second after a wait four times longer tells no speed
pluviophile714 on Discord: a gpt-6.1-sol row on Routing read 1,539
tok/s (input 21,617, output 392, first token 8.2 s, total 8.3 s), where
another monitor measures ~70. The reply came whole about 255 ms after an
8.2 s wait. Its content was spread over that short window (flow 230 ms),
so the HeldShare flow check passed, and so did the 100 ms floor, and
392/0.255 s read as 1,539 tok/s.

New rule, usage.HeldWindowMs: a window under 1,000 ms whose start
(first token, first text or first reasoning) is more than HeldShare (4)
times the window tells no speed. One rule in every place that computes
one:
- usage.DecodeOf: the Usage page's speed and totals, the CLI, the GUI's
  model speeds, and the gateway's Speed first pacing (noteTrySpeed);
- routing/client.js decodeOf: the Routing row's speed and its story line;
- usage/page.js ledDecode, plus a ledNoSpeed_ reason for the dash's
  tooltip, in en, zh, zh-TW, ja and de.
docs/reference.md and docs/subsystems/gateway-sessions.md say so.

On the owner's usage.jsonl (read only), 103 of the 106 rows over 600
tok/s were such windows (e.g. 448 tokens in 107 ms after 8.1 s) and are
dropped. The 3 that stay have windows of 2 to 5 s. The overall speed
goes from 103.8 to 97.9 tok/s.

What it costs: a short reply that really streamed after a long wait
tells no speed either. The live visible-reasoning fixture (76 tokens
over 731 ms after 6.8 s, ~104 tok/s) and #2637's grok record (307 tokens
403 ms after a 4.6 s first token, 531 tok/s) now read "—". Their tests
keep their guarantees with the same timings after a short wait, and also
check the long-wait case.

Tests:
- New: internal/usage TestShortWindowAfterLongWaitTellsNoSpeed (the
  reporter's numbers, a reasoned row from the ledger, the boundary, a
  second after a long wait, Totals) and internal/gateway
  TestShortWindowAfterLongWaitNotesNoPace.
- GUI: usage-speed-every-row has the reporter's row (dash, and the
  tooltip in all five languages); routing-burst-speed has it (first
  token 8.2 s, no tok/s).
- Updated to the new rule: TestVisibleReasoningSpeed's decode-minimum
  and max-speed cases (short wait now), TestCodexTurnMeasured...'s
  gateway/Claude rows, TestLiveVisibleReasoningFixture and
  TestUsageIngestTellsSpeed.

Run on mote at this tree (rebased on e41ef6288):
- go test -timeout 45m: internal/usage ok, internal/tui ok.
- internal/gateway: red only in TestCompactionOverByteCapEveryTime
  (#4862, full package run; passes 3 of 3 alone).
- internal/gui: red only in TestMainWindowCorners (#3949, macOS 27).
- internal/cli: red only in TestEveryRouteHasACommandOrIsNamed (#5026,
  red on main since 0872bc2a0).
- The two speed fixtures that failed in the gateway run pass on rerun.
- GUI, chromium and webkit: 36 files (every speed, ledger, i18n,
  routing-request and burst file), 609 tests, 603 pass. The 6 reds are
  usage-ledger's "newest live route needs no return-to-live button"
  (#5048, #4078, #3104 on main).
- Rebased on 1af868a15 (f0e0385a0 changed routing/client.js), then
  run again at the pushed head: internal/usage ok; the gateway speed
  tests (-run ...Speed|Pace|Decode|TTFT...) ok; 8 GUI files (both
  speed files, routing-request-metrics/-model, routing-speed-first,
  i18n-keys, reasoning-speed, usage-speed-tip) 94 of 94 in both engines.
- gofmt -l clean. GOOS=windows go vet of usage, gateway, gui and cli ok.
  GOOS=linux go vet of usage and gateway ok; gui and cli need cgo/GTK
  for Linux, the same on main.

Broken by hand: with the check off in usage.go, client.js and page.js,
the new Go tests, TestCodexTurnMeasured..., TestLiveVisibleReasoningFixture,
TestUsageIngestTellsSpeed and both GUI files (1537 tok/s shown) go red.

Not tried:
- the reporter's own request;
- a real GPT stream, to confirm that a 255 ms window after 8.2 s is a
  held reply from this vendor;
- the whole GUI suite (no new API call or layout change);
- the Linux and Windows app.
2026-11-03 17:01:51 +08:00
yetone d10f377657 providers: Names & levels is Names, prices & levels, where a model's own price at one provider is set (ferock4669)
ferock4669 asked on Discord whether magpie has a screen to price each
model, since one model can cost differently on each provider. It has:
each row in a provider's per-model list has a price box (input, output,
cache read, cache write, 1h cache write, long-context tier, $ / 1M
tokens), saved in settings' ModelPrices under pid/model. It wins over
the list price in Usage (usage.Pricer through provider.BasePriceIn) and
in a key's spend cap (usage.KeySpent through NewCoster). Nothing has to
be built; the button opening it said only "Names & levels", so nobody
finds a price there.

What changed:
- The button, its panel's heading and fold, and every note that sends
  the user there say "Names, prices & levels" (zh 名称、价格与推理档位,
  zh-TW 名稱、價格與推理檔位, ja 名前・価格・推論レベル, de "Namen,
  Preise & Stufen"); the gateway's vision and compaction notes, the
  provider package's text, the subsystem pages and the site's start
  docs (en, zh, ja) follow.
- The button's tooltip says it sets what each model costs at this
  provider; Usage's "estimated" tooltip says where a provider's own
  price is set and that it counts over the list price. Both in en, zh,
  zh-TW, ja and de.
- Not changed: the Codex model description text in internal/codexcat
  (it goes to Codex, so a vendor sees it) and core_budget_test's
  history comment.
- app.js: a comment above the price box is shortened so the core
  script stays under its budget, not raised (app.js 116 bytes under
  origin/main).

Run at the pushed head (rebased on origin/main 1af868a15), on mote:
- go test -run 'Budget|ModelPrice|ModelPref|Vision|Compaction'
  ./internal/gui ./internal/provider ./internal/gateway: ok.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows:
  ok (before the rebase, which touched no Go of this change).
- GUI, both engines, every language each file runs: the 149 files that
  name the label or open a provider's editor (before the rebase): 1191
  ok, 30 red in 7 files. Each of the 7 is red the same way alone at
  origin/main without this change: provider-fetch-again (#5057),
  provider-typed (#4673), provider-levels-scroll webkit (#4395),
  provider-picks-stay (#4397), usage-agents-hide (#3414), usage-ledger
  Requests (#5048), mobile-web (#3952, no .git in mote-run's copy).
  name-suffix-remote "chromium de" (ERR_NAME_NOT_RESOLVED once) passed
  alone at the head. After the rebase: model-price-edit, i18n-keys,
  name-suffix-remote, usage-ledger, usage-agents-hide again: go tests above ok; model-price-edit, i18n-keys and
  name-suffix-remote (all 10 cases) ok; usage-ledger Requests and
  usage-agents-hide red as at origin/main 1af868a15.
Broken by hand: model-price-edit.test.cjs at origin/main's label is red
in all 4 cases (the button "Names, prices & levels" is not found).
Not tried: the whole GUI suite (another session's full suite was on
mote, WSL at load ~100 with 31 test runners); the real app.
2026-11-03 17:00:38 +08:00
yetone 1af868a153 provider: a Codex app left on a used-up account restarts with Restart the app off too (atom0964)
v0.1.2826 (1dead5dc7) added Restart the Codex app when magpie switches
its account, off by default, so that atom0964's ChatGPT app stopped
relaunching at every switch magpie made between two Plus accounts. Its
guard in codexAppStep left the app-server running for every change
magpie made by itself, and that covered too much:

- the takeover in, where magpie becomes Codex's provider for its used-up
  account;
- the first look on a used-up account;
- magpie's switch off an account at 98% (SwitchWhenSpent).

The Codex app greys Send for every model while its signed-in account's
rate limit says not allowed, and reads the account only as its
app-server starts (ChatGPT.app 26.1013, 8b0132b3d). Left running, the
app stayed on the used-up account with Send grey, so neither magpie's
fallback nor the next account could serve it until the user restarted
it by hand. With the default off, that broke the takeover for every
user with a fallback.

Now those three restart the app-server tick or not (`needed` in
codexAppStep: `into || c.switched && c.spent`). The tick covers only
what the app works without: the switch back once the first account has
room, and Codex given its account back at the reset. The label, tooltip
and toasts say "switches its account back" in en, zh, zh-TW, ja and de.
The tooltip adds that a used-up account restarts the app anyway.
SwitchWhenSpent's stale-app log, RestartApp's comment and
agent-wiring.md say the same.

atom0964 will still see one restart when an account runs out. Send
needs it. The restarts at the switch back and at the reset are gone.

Run at the pushed head (on mote, rebased on c0d4f17a3):
- gofmt -l clean; GOOS=linux (-tags nogui) and GOOS=windows go vet of
  provider and gui clean.
- go test -count=1 -timeout 45m ./internal/provider ./internal/davsync
  ./internal/backup: ok. ./internal/gui -run "Budget|I18n|Restart": ok
  (the core script budget holds with the longer strings, no raise).
- GUI (chromium + webkit, narrow and wide, en/zh/ja/de): restart-app,
  switch-only, i18n-keys, codex-accounts-via: 76/76.

Broken by hand: codexAppStep's guard without `!needed`:
TestCodexAppLeftRunningForMagpiesOwnChanges ("magpie switched off the
used-up account: ended [], want [60]") and
TestCodexAppFirstLookOnAUsedUpAccountRestarts go red.

Not tried: a real ChatGPT desktop app on a real used-up account (the
app-server end is stubbed); Windows, where an end is followed by
CodexAppReopen.
2026-11-03 16:55:23 +08:00
yetone 219b60f494 accounts: the first account of a gateway-served subscription ticks off (Rime_Nan on X)
Rime_Nan on X: in WorkBuddy's account list the first account (First) couldn't be ticked off; it took dragging another account above it first. For a subscription the gateway serves itself (plugins, Copilot, ChatGPT API, Gemini, Antigravity), First is only the order the gateway tries accounts in; no agent is signed in to it. setSideLoginOn still refused it ("put another account first"), and the GUI drew its tick fixed.

Now, unticking the first account hands First to the next ticked account that hasn't lapsed and turns this one off. If no other account is ticked, it is still refused, with "tick another to stop using it", and the GUI's fixed tick says the same. An account the user left off is never ticked on. Claude and Codex (pausable) are unchanged.

To keep the core scripts in their budget without raising it, the bytes were paid for by cutting renderAccounts' comment to one line: app.js is +20 bytes, under 1,533,802.

TestCopilotAccounts asserted the old refusal; it now checks the handover and that the only account in use still can't be ticked off.

Run (mote, macOS 27, at f9dda0d3e on origin/main f0e0385a0):
- go test ./internal/provider: ok.
- internal/gui: TestCoreScriptBudget and TestI18n ok.
- gofmt clean; GOOS=windows go vet ./internal/provider ok; at the earlier base, GOOS=linux go vet ./internal/provider and GOOS=windows go vet ./internal/gui ok.
- GUI first-untick.test.cjs (both engines, en/zh/zh-TW/ja/de) and i18n-keys: 24/24.
- Earlier base 694f4a6d6: the whole internal/gui package on mote, red only in TestMainWindowCorners (#3949, macOS 27) and the budget, since fixed. internal/provider passed on Linux (WSL); internal/gui doesn't build there (no gtk4/webkitgtk-6.0 dev packages).
- GUI keep-login, settings-tabs-stick, view-no-sideways, *account*, *plugin*, *copilot* at the earlier base: 1773/1783. The reds, run alone, are red on origin/main 694f4a6d6 as well: plugin-move-unserved's Try again (#4410) and account-eye's Usage card subtest (filed #5052).

Broken by hand: with the old setSideLoginOn, TestFirstTickedOffHandsFirstOn and TestOwnFirstCopilotTickedOff fail ("magpie uses a@x.com first; put another account first"). With the old app.js, first-untick.test.cjs fails 10/10 in Chromium.

Not tried: unticking with a real WorkBuddy plugin account in the app; the tests use Antigravity and Copilot saved logins, and the GUI test uses a stubbed Copilot provider.
2026-11-03 16:43:12 +08:00
yetone f0e0385a0e routing: a row's model chip is whole; its status is what is cut short (yi_time)
yi_time on Discord (#feedback): on the Routing page, a group member's
row that was answering showed its model chip cut to "gpt-6.1-te…".
The status after it ("回答中… · 按意图"任务主要依靠视觉或界面…")
took up to 60% of the row (fit-content(60%)), and the head, with the
account, plan and model as one inline run, was cut at its end, which
is the model. So which model answered didn't show. The same happened
in a fold of keys, whose status column was auto, and at narrow widths,
where a long account name pushed the chip off.

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

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

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

Not tried: the rest of the 257 files after the stop; the real app's
WebKitGTK and WebView2; the reporter's own account and window width.
Screenshots were looked at by eye in Chromium only (zh 1600 and 420,
live and fold).
2026-11-03 16:37:33 +08:00
yetone 1dead5dc7b provider: magpie's own Codex account switches leave the Codex app running unless Restart the app is ticked (atom0964)
atom0964 on Discord (#help) has two ChatGPT Plus accounts in magpie, with
Codex always signed in to the first and Only switch Codex's sign-in both
off, on Smart routing. The Codex desktop app kept restarting by itself.
They tried several combinations of the ticks and it still did.

Why: with both off, SwitchWhenSpent signs Codex in to the next account at
98% and back to the first below 90%. Each switch was noted for the Codex
app (codexAppSpentSwitch), and KeepCodexAppOnItsProvider ended its
app-server once no turn ran; the ChatGPT app shows that as an error and
relaunches (#4550). With Codex kept on the first account there is no
switch, but the used-up takeover (magpie made Codex's provider for a
used-up account and given back once it has room; f37742e14 only limits
it to when another account can serve, which two accounts always can)
changed Codex's route, and that ended it too. So every combination
restarted the app.

What changed:
- Provider.RestartApp (restartApp), off by default, set by
  provider/restartapp (SetRestartApp, Codex only). This computer's own,
  like KeepLogin: Mirror keeps it and davsync's hash leaves it out.
- switchLoginBy(agent, user, byMagpie): SwitchWhenSpent marks its
  switch magpie's own (codexApp.auto). In codexAppStep, a change that is
  magpie's own (its switch, the takeover in or out, the first look at an
  app on a used-up account) ends nothing unless RestartApp is on; it
  logs why and the app follows once restarted. The switch notice's
  Restart, the Agents row's Restart, and uninstall are unchanged.
- Still restarted: a switch the user makes (Switch, the Agents row, the
  CLI), a Connect or Disconnect, failover written or taken out (any
  route change while the takeover state is unchanged), and a user's
  switch pending when magpie's comes.
- GUI: under Codex's accounts, with more than one on (or the tick set),
  "Restart the Codex app when magpie switches its account", with a tip
  and toasts in en, zh, zh-TW, ja and de. app.js paid for it with five
  account-row comments cut; TestCoreScriptBudget is not raised.
- docs/subsystems/agent-wiring.md says which changes restart the app.

Known edge: a takeover flip in the same 3s tick as a Connect is taken
as the Connect's (restarted), since the route changed by the user.

Run at the pushed head (on mote, rebased on b967b1620; then rebased on 2a19043af, a Library change touching none of these files, with the core budget checked again: 160 bytes under):
- gofmt -l clean; GOOS=linux (-tags nogui) and GOOS=windows go vet of
  provider, gui, davsync clean.
- go test -count=1 -timeout 45m ./internal/provider ./internal/davsync
  ./internal/backup: ok. ./internal/gui: ok except
  TestMainWindowCorners/macOS_26_SDK, red alone on origin/main 694f4a6d6
  too (#3949). ./internal/cli: ok except TestEveryRouteHasACommandOrIsNamed
  on GET /api/context/reply (#5026).
- GUI (chromium + webkit, 1100 and 420 wide, en/zh/ja/de):
  restart-app (new), switch-only, claude-switch-only, keep-login,
  codex-accounts-via, account-arrange, i18n-keys: 110/110 and 94/94.
  account-arrange's webkit case went red once in a 5-file run on an
  aborted /api/lanes request; it passes alone on origin/main and at
  this head.

Broken by hand:
- codexAppStep's guard turned off: TestCodexAppLeftRunningForMagpiesOwnChanges
  and TestCodexAppFirstLookLeftRunning go red (ended [60]).
- SwitchWhenSpent marking its switch as the user's: TestCodexSwitchedWhenUsedUp
  goes red ("magpie's own switch is counted the user's").

Not tried: a real ChatGPT desktop app on a real used-up account (the
app-server end is stubbed as before); Windows, where the app is quit and
reopened (CodexAppReopen runs only after an end, so leaving it running
skips it too); no CLI command for the tick (switch-only has none either).
2026-11-03 16:34:30 +08:00
yetone 2a19043afc library: a skill's files are read as Markdown and edited in the page (refeccd)
refeccd on Discord kept skills in ~/.agents/skills, handed them over to
magpie ("let magpie manage"), and then had nowhere to edit them: the
Library's skill view showed SKILL.md as raw text with no way to change
it. There never was an edit path; this adds one.

- GET /api/library/skill takes `file` and answers library.ReadSkillFile:
  the file (SKILL.md by default), its text, the skill's folder and its
  text files (UTF-8, no NUL, up to 1 MB each, 200 listed, SKILL.md first;
  links, hidden folders and what installing writes left out).
- POST /api/library/skills/save {name, file, text, was} is
  library.SaveSkillFile, through change(): it writes only a regular
  file already in the skill's library folder (no .., no absolute path,
  no link, no folder that is a link out of the skill, nothing under
  node_modules/.venv/…), refuses when the file no longer holds `was`
  (the text the page opened), keeps CRLF line ends, and writes with
  edit.WriteAtomic. The sync after it reaches every agent: a linked
  one reads the library's folder, a copy is made again. A copy edited in
  an agent before the save is older, so takeEdits sets it aside in the
  backups. A GitHub skill saved here reads as Changed here, so an update
  asks first.
- The page (viewSkill in plugins/library/client.js) draws a Markdown
  file with the Plugins page's own renderer (plugins.js exports it as
  window.mdRender, 27 bytes of core script) and its front matter as
  rows; other files as text. Edit swaps in a text box; Save or ⌘S/Ctrl+S
  sends it; Cancel asks when there are changes. Other files are the
  app's menu under the name (no native select). New code is in the
  library plugin, so the core script budget is not raised.
- SkillText is gone (its only caller was the route). One new string, in
  all five languages. docs/subsystems/library.md says all this.

Run on mote at the change rebased on 9335e23d3:
- go test -count=1 -timeout 45m ./internal/library ./internal/gui
  ./internal/cli: library ok. gui: TestCoreScriptBudget passes; the only
  red is TestMainWindowCorners/macOS_26_SDK (#3949, mote's macOS 27).
  cli: the only red is TestEveryRouteHasACommandOrIsNamed on GET
  /api/context/reply (#5026, from 0872bc2a0). Both are red on main and
  filed.
- GOOS=linux and GOOS=windows go vet -tags nogui on the three packages;
  gofmt -l clean.
- skill-edit.test.cjs: 22/22 (chromium and webkit; en, zh, zh-TW, ja,
  de; 860px and 400px). It checks the drawn Markdown and front matter,
  no sideways scroll, ⌘S posting the exact body with `was`, the status,
  the file menu, Cancel sending nothing, Save on a second file, no click
  scrolling the page, no left-border stripe or gradient. i18n-keys ok.
- Whole GUI suite (a new API call), on the Linux box (wsl-run; mote had
  two other full suites): ~4460 of its results in at the push, not
  finished. Its reds are all WebKit and none is in a file this touches.
  The ones near it, run alone at this change and at origin/main
  bc10a6198: click-scroll, found-skill-pick-remove and account-eye fail
  the same on both (#4385, #4097/#5013, #4244).

Again at the pushed head (rebased on b967b1620; its commits change
app.js and the core budget), on the Linux box: TestCoreScriptBudget ok,
go test ./internal/library ok, gofmt -l clean, skill-edit.test.cjs and
i18n-keys 26/26.

Broken by hand: without the `was` check, without the linked-folder check
and without the CRLF handling, TestSkillFileSaveRefusesAChangedFile,
TestSkillFileStaysInTheSkill and TestSkillFileKeepsLineEnds each went red.
skill-edit.test.cjs on the old assets: 0/11 in chromium (.lib-mdview
never appears).

Not tried: refeccd's own skills (the fixture is a made-up handover from
~/.agents/skills, with a copy agent and a link agent); the real app
window (the GUI tests fake the API); the TUI and CLI, which have no
editor; making, renaming or removing a file from the page; Windows.
2026-11-03 16:33:03 +08:00
yetone b967b16208 usage: a Zhipu pay-as-you-go key's balance card; SiliconFlow's says its query is gone
nam.haid on Discord: the Usage page showed no balance for a Zhipu key,
and SiliconFlow's card always said only "暂时无法获取额度".

Zhipu / Z.ai: nothing read a pay-as-you-go key's balance. BigModel has no
documented balance API; its console asks
/api/biz/account/query-customer-account-report with the key as a Bearer,
and it answered a real key (the owner's, 2026-11-03) the same at
open.bigmodel.cn, www.bigmodel.cn and api.z.ai:
{"code":200,...,"data":{"balance":0E-9,...,"availableBalance":0E-9,
"frozenBalance":0E-9,...},"success":true}; a bad key gets code 1000 at
HTTP 200. zhipuBalanceSource reads availableBalance at the key's own host
(¥ on bigmodel.cn, $ on api.z.ai). A refused key says so in the words the
Coding Plan card already uses (zhipuRefused), another code says its code
and msg, a reply without availableBalance is an error, never a balance. A
GLM Coding Plan key (a base under /api/coding/, or a key on the "coding"
plan) isn't asked: its plan windows are its card. A key seen only at the
shared /api/anthropic endpoint gets a card only once the account was ever
paid in. KeyBalances now skips a key whose own plan has no balance
source, so a mixed provider's Coding Plan key gets no stray card.

SiliconFlow: /v1/user/info answers 410 (code 20092) since 2026-08-14 and
its release notes list no replacement through 2026-10-21. The reason was
already read but shown as the generic line, with the last balance kept.
It is now a typed error (siliconFlowRetired): no kept balance, the card
says the API is gone in the user's language (en, zh, zh-TW, ja, de) and
its "Open the console" button opens cloud.siliconflow.cn (or .com).

Run at this head, rebased on origin/main bc10a6198: on mote, go test
./internal/provider (ok, full package), ./internal/tui (ok), the
budget tests in ./internal/gui (ok); ./internal/gui and ./internal/cli
are red only in TestMainWindowCorners (#3949) and
TestEveryRouteHasACommandOrIsNamed (#5026), the same on main. go vet:
GOOS=windows provider and gui, GOOS=linux provider (ok); gui for linux
needs cgo, not run. gofmt -l clean. GUI on mote at 9335e23d3: the 126
files matching balance|quota|usage|i18n|glm, 1819 of 1856; the reds are
the Usage page's (usage-agents-hide #3414, usage-fold #3415,
usage-ledger #5048), and in WSL the six of them plus
siliconflow-balance and i18n-keys, chromium and webkit, give 32 red at
this head and 35 at bc10a6198 itself, the same tests. siliconflow-balance
20 of 20 (en, zh, zh-TW, ja, de; 900 and 420 wide).

Broken by hand, each red then green: no Zhipu source (TestZhipuBalance,
TestZhipuAndSiliconFlowBalanceCards), no SiliconFlow SeeAt (the cards
test), no per-key plan check (the cards test), the never-paid-in rule
("anthropic, never paid in: <nil>"), the GUI mapping
(siliconflow-balance.test.cjs 0 of 20).

Not tried: a funded Zhipu account (only a never-paid-in one answered, so
the funded fixture is that reply with amounts filled in); a real
SiliconFlow key (the 410 shape is the one TestSiliconFlowRetiredBalanceQuery already held); the credit
line (creditBalance) isn't read; a provider whose own plan is the Coding
Plan with a pay-as-you-go key beside it still gets no balance for that
key. The account report is undocumented and may change.
2026-11-03 16:26:17 +08:00
yetone bc10a61985 agents: Claude Code's status line, the 5h and 7d use, is a switch on its row (steven_4422)
steven_4422 on Discord asked for the 5h and 7d account use in Claude
Code. magpie has had `magpie statusline` since #1997 (kensenzhao), but
it was found only in docs/reference.md and needed a hand-written
settings.json entry naming a `magpie` the app doesn't put on PATH.

Claude Code's row now has a "status line" square beside ultracode (the
same toggle, now a table, TOGGLES in app.js), and `magpie claude
statusline on|off` in the CLI. On writes settings.json's statusLine as
{type: command, command: "<this magpie's full path> statusline"},
quoted for a POSIX shell (Git Bash on Windows, forward slashes).
The command reads the gateway's kept windows with a 1s timeout and
prints nothing when it can't, as before.

- A status line of the user's own is never written over: the square
  isn't offered while one is there, on is refused, and off and
  Disconnect leave it byte for byte. Ours is a single plain command
  whose program is magpie/magpie-* and first argument statusline, so a
  hand-written one from the reference counts and a compound (&&, |, ;,
  $(...)) is the user's.
- An unreadable settings.json is not written over.
- Disconnect takes magpie's status line out with the rest.
- Quiet: Claude Code reruns a changed statusLine command in its open
  sessions, so no restart notice.
- Not offered for a WSL distro, and a distro's settings.json isn't read
  for the options (a stopped one would start, #3896). A stopped
  distro's fields fall back to magpie's models as options, so without a
  case in wsl.go its square would have listed models
  (TestWSLClaudeNoStatusLine).

Run on mote (go1.26.8, load ~400):
- at f33e6d112 (rebased on 3088872e6): go test -count=1
  ./internal/agent ./internal/cli ./internal/gui. Red:
  TestWSLColdPlaceOpensNothing (mine: Options read a distro's
  settings.json; fixed), TestCoreScriptBudget (5 bytes over after the
  rebase; a comment trimmed, no raise), TestEveryRouteHasACommandOrIsNamed
  (#5026, from 0872bc2a0 on main), TestMainWindowCorners/macOS_26_SDK
  (#3949, macOS 27). go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.
- GUI at f33e6d112: every agent-*, claude-*, i18n*, field* and tweak*
  file, both engines: 1294 of 1296. agent-stale-copies (webkit ja 980,
  #1949) and claude-subagent-tag (webkit ja 1100, filed #5040) timed out
  under load; at d85b4e49b both files and claude-statusline.test.cjs
  (en, zh, zh-TW, ja, de at 900 and 400 wide) alone: 130 of 130.
- at d85b4e49b (the fixes above): go test ./internal/agent ok;
  TestCoreScriptBudget ok.
- rebased on f37742e14 (a key's spend cap took the core to 21 bytes
  under its budget; this change's 207 bytes are paid for by foldSame's
  comment cut, no raise), at the pushed head: go test ./internal/agent
  ok (318s); TestCoreScriptBudget ok (1,533,597 of 1,533,802);
  claude-statusline, i18n-keys and claude-effort GUI files, both
  engines: 46 of 46.
- gofmt -l clean.

Broken by hand, each red then restored:
- the user's-own guard off: TestClaudeStatusLineLeavesTheUsers
- the Unwire call taken out: TestClaudeStatusLineGoesOnDisconnect
- the file wiped before the write: TestClaudeStatusLineUnreadable
- the compound check off: TestClaudeStatusCommand
- the WSL asleep case off: TestWSLClaudeNoStatusLine
- the here check after the read: TestWSLColdPlaceOpensNothing
- the statusline entry out of TOGGLES: claude-statusline 15/15 red

Not tried: a real Claude Code session showing it (and its hot
reload); Windows Git Bash and PowerShell with a real path; the Linux
AppImage path; WSL is not offered at all.
2026-11-03 16:03:14 +08:00
yetone 01de489de1 search: a ChatGPT account searches for another model by the backend's own search (lucy_85908)
A third-party model in Codex (DeepSeek, MiniMax, ...) had its web
searches made by asking gpt-6-luna on the Codex account to search
through /responses. A ChatGPT account now searches by the ChatGPT
backend's /alpha/search, the request Codex's web.run sends by itself
with no model turn (codex-rs ext/web-search): one search_query, the
account's small model in "model", allowed_callers ["direct"], and
external_web_access from the client's web_search tool (#5018: Codex's
"cached" sends false; live by default). The output's pages are read by
their 80-dash rule and ref_id; the private-use citation marks are dropped.

Measured on a real Plus account (2026-11-03, token not refreshed): 151
alpha/search calls left the 5h window at the same percent, ~1.5-2.2s
each; 51 searches by gpt-6-luna took 0% -> 1% of it, 7-15s each,
~9-17k tokens in (40 of them: 414,585 in, 10,313 out). The backend
answered the same for any "model" (deepseek-v4 too) and any
max_output_tokens.

- Automatic (and searchInTurn) picks the backend's search for a ChatGPT
  account; Settings > Web search offers "<id>/@search" as "its web
  search". "<id>" and "<id>/<model>" saved before still search by that
  model, so a user's pick is unchanged.
- When the backend's search fails, the account's small model searches
  (codexSearchBy).
- Codex web.run's own search for a non-ChatGPT model (alphaSearchHere)
  and a Responses request's web_search tool pass their mode on.

Run at this head (rebased on origin/main), on mote:
- go test ./internal/gateway/... ./internal/gui/ ./internal/agent/
  -timeout 45m: gateway and agent ok; gui red only on
  TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27 on mote).
  After the rebase: the gateway's search tests again ok.
- searcher-pick.test.cjs: 22/22, chromium + webkit, en/zh (+ the label
  is in zh, zh-TW, ja, de).
- gofmt -l clean; GOOS=linux go vet gateway, provider; GOOS=windows go
  vet gateway, gui.
- Whole GUI suite on the Linux box (wsl-run): not finished when pushed;
  its reds so far are WebKit pages this doesn't touch (add-provider,
  API key palette, Routing headers, click-scroll, Codex resets).

Broken by hand, each red: the Automatic switch (TestCodexSearchesWith
ItsCheapModel, TestChatGPTAccountSearchesByItsWebSearch), the
responses.go mode (TestResponsesWebSearchModeKept), the body's mode,
the fallback, and the picker option (searcher-pick).

Not tried: a real search through magpie in a sandbox (the request shape
was tried by hand against the backend); an account out of its
allowance (does alpha/search still answer?); the model fallback still
searches live when Codex asked cached.

Suggested by lucy_85908 on Discord.
2026-11-03 15:59:14 +08:00
yetone e41ef6288c providers: a spend cap on an API key, per day, month or in all (sparkling_lemur_62868)
sparkling_lemur_62868 on Discord: a team's OpenAI key holds granted
credits that other docker services spend from too, and they want magpie
to stop at a share of it. Their workaround was two magpies behind a
gateway-key limit.

What changed
- provider: KeySpendCaps on a provider, keyed by the key's fingerprint
  (key_spend.go): USD over a local calendar day, a local calendar month,
  or in all since it was set. Since is kept while the cap stays one in
  all. SetKeySpendCap and ParseSpendCap refuse an amount outside
  0 < usd <= 1,000,000 and an unknown period, and leave the saved cap
  as it was. Subscriptions are refused, since an account has its own
  usage-window cap.
- usage: KeySpent(keyID, start) is what magpie's own calls on the key
  cost at the Usage page's prices. Turned-away calls and app-reported
  ones are left out. It reads usage.jsonl once per key and start, keeps
  the sum for 5 minutes, and Append counts each new call into it
  (spentNew). A read that a write races is read again.
- gateway: perKeyEvery bars a key at its cap (spendHeld) as a usage cap
  holds an account. The next key serves, then the fallbacks. With none,
  the reply is 429 "spend cap reached: ..." naming each key, what it
  spent of which cap, and how to go on. Retry-After is when the soonest
  period renews; a cap in all gives none. A spend hold is not a usage
  cap: Stop at the caps and strictKeep don't end at it (capHeldOnly).
  The trace's barred row carries the cap, the spend and the period.
- GUI: a pill on each key's row in the provider editor, for example
  "$7.50 of $20.00 today". It opens the app's menu (No spend cap,
  Per day..., Per month..., In all...) and then takes the amount in
  place, as the lane-limit pill does. A key at its cap gets a line
  under its row: "At its spend cap · back in ...". Every string is in
  all five languages. The pill and the line are in keyspend.js, which
  app.js imports when it draws a key's row, so the core's script
  budget is not raised. /api/providers' keyList carries spend, and
  POST provider/keyspendcap sets it.
- CLI: magpie provider spend-cap <id> [key [usd [day|month|total]|off]]
  lists each key's spend and sets or removes a cap.
- docs: providers-accounts.md and gateway-routing.md.

Caveats, also in the tooltips:
- What counts is magpie's priced usage, not OpenAI's bill.
- A model with no known price counts $0.
- Requests already under way when the cap is reached still finish, so
  a key can go a little past it.

Run on mote at the pre-rebase head (3e3196222 + this change):
- go test -count=1 -timeout 45m for internal/provider, usage, cli, gui
  and gateway: provider, usage and gateway ok. Three reds, none from
  this change:
  - cli TestEveryRouteHasACommandOrIsNamed: GET /api/context/reply,
    red on main, #5026.
  - gui TestMainWindowCorners/macOS_26_SDK: macOS 27, #3949.
  - gui TestCoreScriptBudget: from this change. Fixed by moving the
    pill into keyspend.js, then ok on a rerun.
- go vet: plain, GOOS=linux -tags nogui and GOOS=windows -tags nogui,
  all clean. gofmt -l is clean.
- GUI, both engines: key-spend-cap.test.cjs passed 20 of 20 before
  the keyspend.js move, and all of its tests passed again after it.
  It covers en, zh, zh-TW, ja and de at 900 and 400px, a refused
  amount, the set, change and remove posts, and checks for no native
  select, no border stripe and no sideways scroll.
- Also run in both engines: i18n-keys, old-webkit, lane-limit,
  account-cap, key-row-chips-fit, key-weight-fit, key-nourl,
  provider-many-keys, key-switch, key-plan and key-rest-date.
  - key-replace's webkit 420px is red at base 3e3196222 too
    (#4126; base failed 2 of 3 en runs, this change 3 of 3).
  - key-rest-date's webkit zh-TW, ja and de tests time out at
    --test-concurrency=4 with three other files beside it, at base
    too (base 5 reds, this change 7). Run alone at concurrency 2, it
    passes 10 of 10 at base and with this change (#4691).

After the rebase onto 9c51f7fdb, at the pushed head:
- go build ./... and go vet on the five packages: clean.
- go test of the spend tests, TestCoreScriptBudget and the gui
  package's word tests: ok.
- i18n-keys and key-spend-cap in both engines: 24 of 24.

Broken by hand, each red and then restored:
- spentNew taken out of Append: TestKeySpentCountsTheKeysCalls red
  ("after a new call key a spent 3, want 7").
- spendHeld never barring: TestKeySpendCapPassesTheKeyOver red (the
  capped key reached the upstream).
- capHeldOnly keeping spend holds: TestKeySpendCapPassesTheKeyOver red
  (Stop at the caps answered 429 instead of using the fallback).

Not tried:
- a real OpenAI key or real spend;
- the real app window;
- Windows and Linux test runs (vet only);
- the whole GUI suite: mote was running two other sessions' full GUI
  suites at load 250 to 400.
2026-11-03 15:30:44 +08:00
yetone 9c51f7fdbc gui: "deepseek-v4.1-flash tokens (est.)" is said in every language
WorkBuddy 0.2.19 (plugins #663) names the China build's token window
"deepseek-v4.1-flash tokens (est.)". The GUI shows a window's name through
t(), so zh, zh-TW, ja and de read it in English. Added beside "Free model
tokens" in i18n.js, and to TestPluginWindowWordsSaidInEveryLanguage's
workbuddy words, so a missing translation is red.

Run on mote at this tree: go test ./internal/gui (ok except #3949's
TestMainWindowCorners/macOS_26_SDK, unrelated, red alone on macOS 27);
node --test internal/gui/tests/i18n-keys.test.cjs 4/4.

Not tried: the card's look in the GUI with a real China account.
2026-11-03 15:21:17 +08:00
yetone 3e31962225 provider: Request headers to pass, the agent's own values to its provider
A provider's fixed Headers can't say a value that changes from request
to request or from client to client. 3jRzfF52Qx on X asked for the
agent's own header values to reach the vendor. Each provider now has a
comma-separated list of request headers, saved as `passHeaders`. When the
agent's request carries one of them, its value goes to that provider as
the agent sent it.

- Where it is: the editor's "Request headers to pass" (zh 透传请求头),
  under Advanced, right after Reply headers.
- The agent's value stands over a fixed Headers value of the same name.
  When the agent sends none, the fixed one goes.
- Never passed on, listed or not (provider.RequestHeaderPassable):
  - magpie's key: Authorization, X-Api-Key, X-Goog-Api-Key, Api-Key;
  - cookies and sign-ins: Cookie, Set-Cookie(2), WWW-Authenticate,
    Authentication-Info, Proxy-*;
  - the connection's own fields: Host, Connection, Keep-Alive, TE,
    Trailer, Transfer-Encoding, Upgrade, Expect;
  - what magpie writes for the body: Content-*, Accept,
    Accept-Encoding;
  - Origin, Sec-* and X-Magpie-*.
  Save refuses such a name with a reason (RequestHeadersOK), and so does
  the editor, before the save. The editor's list is held to Go's by
  TestReplyHeadersNeverAsTheProvidersAre. A name written into
  providers.json by hand is dropped on read.
- Only that provider gets them. forwardOnce, which every chat,
  responses, messages, count_tokens, group-member, fallback and plugin
  try goes through, puts the agent's headers in the try's context under
  the try's provider id (WithClientHeaders). Provider.Sign passes only
  what that id lists, before an account signs, so a signed-in account's
  own signing still wins. A plugin's fetch gets them in req.Header.
- Wire headers are still masked when read (5ec237568), so a passed
  token header shows masked in a call's log.

Run on mote at the tree rebased on origin/main 06944e065:
- gofmt -l: clean.
- go vet: darwin (provider, gateway, gui), GOOS=linux -tags nogui
  ./..., and GOOS=windows ./...: ok.
- go test -timeout 45m ./internal/provider ./internal/gateway
  ./internal/gui: provider and gateway ok. In gui, TestCoreScriptBudget
  and the i18n tests are ok and only TestMainWindowCorners/macOS_26_SDK
  is red, as on main on macOS 27 (#3949).
- The core budget is not raised. This change's words, and the comments
  on extra body and the never lists, were cut first. After the rebase
  onto 63dc359fb it was 438 bytes over again, so three provider-editor
  comments (User-Agent, balance token, plan access keys) were cut to a
  line each. The core is 1,533,554 bytes, 248 under 1,533,802.
- At this head (rebased on origin/main 63dc359fb): go test -run
  Budget|I18n|ReplyHeaders ./internal/gui is ok. The new provider and
  gateway tests are ok. node --test pass-headers, reply-headers,
  i18n-keys, header-session-hint, balance-fix and extra-body: 162 of
  162 ok.
- node --test, Chromium and WebKit: pass-headers (en/zh/zh-TW/ja/de),
  reply-headers, i18n-keys, provider-detect-models, header-session-hint
  and extra-body: 46 of 46 ok.
- Before the budget cut, against the same base: every GUI file that
  opens the provider editor and saves (45 files plus i18n-keys) had 739
  of 758 ok. These were red, and red the same on a fresh origin/main
  06944e065 copy: models-works-only (#4391), provider-picks-stay
  (#4397) and remote-magpie (#4398). Also red: one WebKit sub-pixel
  miss in provider-detect-models (#4964), which passed on main and at
  this head.

New tests:
- TestRequestHeadersList: cleaning and refusals.
- TestSignPassesClientHeaders: the agent's value over the fixed one,
  never magpie's key even when listed by hand, nothing for another id,
  and the fixed value when nothing was sent.
- TestPassHeadersReachTheProvider: messages relayed and translated,
  chat, a chat stream, responses and count_tokens.
- TestPassHeadersOnlyToTheirProvider: a fallback that lists nothing gets
  nothing, the log shows the passed headers masked, and in a group the
  member that lists them gets them while the one before it, which lists
  nothing, doesn't.

Broken by hand, each red, then put back:
- forwardOnce without WithClientHeaders: both gateway tests red.
- RequestHeaderPassable ignoring the never list: TestRequestHeadersList
  red, and TestSignPassesClientHeaders red on X-Api-Key=magpie-key
  passed on.
- Sign not skipping a fixed header the agent sent: the provider test,
  and the gateway test on every route, red on X-Route=route-fixed.

Not covered: embeddings, images, video and the Codex backend relay,
which don't go through forwardOnce.

Not tried:
- a real vendor or a real plugin provider with the setting;
- Windows and Linux test runs (vet only);
- a gateway test with Authorization listed by hand, which normalize
  drops on read. Sign's own check is covered by
  TestSignPassesClientHeaders.

Requested by 3jRzfF52Qx on X.
2026-11-03 14:16:20 +08:00
yetone 63dc359fb4 providers: a subscription account's rest, or its model's, shows on its row (maxleebeta)
maxleebeta on Discord (#feedback): WorkBuddy answered 429
{"type":"rate_limit_error","message":"WorkBuddy: 您的使用量已超出频率限制,将在
2026-11-03 23:57:19 UTC+8 重置,您也可以切换其他模型继续使用。"} while the
provider's card said 1,934/2,350 credits left (82%), and nothing on the
Providers page said the account was held back.

Routing already handled the refusal: resetsWhen reads the time (UTC+8, the
space before 重置 included), failure() gives failQuota, and since it says
切换其他模型 the rest is that model's alone (restID), by "resets", till
15:57:19 UTC; the account's other models are still asked (#1669). What
was missing was the page: a key's rest showed on its row, an account's
never did.

- gateway.RestsUnder(prefix) lists the rests in force under a key prefix
  (provider@ for a subscription's accounts, provider@user/model for a
  model's), with Key and the rest's note (Model, By, Error).
- providerJSON.accountRests gives them by user in lower case, the model
  filled in from the key when the note has none; provider.KeyRest gains
  By, Model and Error.
- app.js: the account row in the provider editor gets a line per rest
  (accountRestLines): "<model> resting · 429 quota used up · back at
  <time>" or "Resting · …" for the whole account, the vendor's words
  beside it (shown whole when it names a time magpie couldn't read, so
  an unknown format still says why), and Try now (gateway/unrest by the
  rest's key). The key row's rest line is now the same helper
  (restLineOf), so app.js grows ~800 bytes, under the core budget.
- New strings in zh, zh-TW, ja and de. docs/subsystems/gateway-routing.md
  says where the Providers page reads them.

Not changed: the "-sg" maxleebeta saw in pi is WorkBuddy AI's own model
id (deepseek-v4.1-flash-sg, the paid Singapore id beside the free
deepseek-v4.1-flash); pi's footer and model picker show ids by design,
and the name magpie writes for it is the vendor's ("Deepseek-V4.1-Flash",
"(SG)" added by the plugin only where two ids share a name). Neither
magpie nor the plugin appends "-sg"; the CN build has no -sg ids.

Run (mote, through mote-run):
- go test ./internal/gateway ./internal/gui ./internal/provider at f0df4bb2b
  (base 06944e065): gateway ok (737s), provider ok, gui ok except
  TestMainWindowCorners/macOS_26_SDK, red on macOS 27 as on main (#3949).
- Rebased on 889767b7b: TestCoreScriptBudget, TestI18n*,
  TestAccountRestsInProviderState and the written-reset tests ok;
  gofmt -l clean. GOOS=linux and GOOS=windows go vet -tags nogui ok at
  f0df4bb2b, before the rebase. Then rebased once more onto 8ee172ca0,
  which changes only gateway search files; not re-run there.
- internal/gui/tests/account-rest.test.cjs: chromium and webkit, en, zh,
  zh-TW, ja, de, at 900 and 360px, ok. rest-try-now.test.cjs's 15 webkit
  reds fail the same on origin/main 06944e065 (#2564, #4127).
- Broken by hand: TestRateLimitedModelListedUnderAccount red with
  RestsUnder returning nothing, TestAccountRestsInProviderState red
  without accountRests, account-rest.test.cjs red without
  accountRestLines.

Not tried: a real WorkBuddy account hitting this 429, so the line has
not been seen on a live gateway; the whole GUI suite (mote under another
session's suite). The line shows in the provider editor's account rows,
not on the collapsed provider row.
2026-11-03 14:09:42 +08:00
yetone 889767b7b3 routing: a failed try's tag over its row is whole until it fades (yuancjun)
yuancjun on Discord (#feedback, v0.1.2784, Chrome 128 on macOS): a member
row's failure tag ("504 · 迟迟未开始") showed whole for ~0.45s, then its
top half, the ~10px over the row's top edge, was cut off until it faded
at 1.8s. Their analysis was right: `.rt-accts .tag` sits at top:-10px,
`.rt-accts li:not(.hit)` has content-visibility: auto (#3164), which
always paint-contains, and rerun() takes `.hit` off on the shake's
animationend at 0.45s while `.tagged` stays 1800ms.

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

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

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

Not tried: the real app's WebKitGTK and WebView2; Chrome 128 itself
(Playwright's Chromium is newer).
2026-11-03 14:01:55 +08:00
yetone 0872bc2a0e context: a request's text and reply from the request archive (wangbinyq)
wangbinyq on Discord: with the request archive on, clicking a block of
the context window card still said "只保留最近 10 个请求的原文", since the
card read only the last 10 bodies magpie keeps in memory.

What changed:
- /api/context/text tries memory first, then the request archive's copy
  when the route names one (Route.Archive, the route found in the trace
  or in the history file of the card's ?day=, HistoryRoute looks a day
  either side). gateway.ArchivedPromptText parses it as PromptText does
  and masks it through maskedCopy, as the body in memory is; it is
  marked from "archive" and the card says so.
- New /api/context/reply: the reply to the request, from the Recent
  calls (Server.ReplyBody) or the archive's Response. gateway.ReplyPieces
  reads it into thinking/assistant/call pieces (conversationOutput, split
  out of conversationTurn) after redact.ScrubJSON, and masks every piece
  through maskedCopy. The card's text view has a Reply button beside
  Close that shows it and goes back to the part.
- What is shown is what the archive stores, masked as the memory copy
  would be, nothing more. A body or reply that can't be masked shows
  nothing (404 "unread"); one the archive cut short isn't parsed ("cut");
  one it names and doesn't have says so ("missing"), and one with no
  archive copy keeps the old "only the last 10" line ("off"). A failed
  bucket read is an error, not "gone".
- The archive read is capped at archiveReadMost and the last copy read is
  kept 5 minutes, so the items opened one by one read it once.
- ctxtext.js takes the route (id and time) instead of the id; context.js
  passes it (its one-line change paid for by a comment cut, core budget
  not raised). New strings in zh, zh-TW, ja and de.
- docs/subsystems/gateway-routing.md (Prompt) and gui-shell.md.

Run on f3335dd1b (main has since d73f2254d, textcalls_anthropic.go and
its test only, none of these files), on mote (macOS 27):
- go test -run 'TestArchivedPromptText|TestReplyPieces|TestPromptText|
  TestConversation|TestContext|TestCoreScriptBudget' ./internal/gateway
  ./internal/gui: ok.
- Whole ./internal/gui and ./internal/gateway (before the last rebase,
  same change): ok except TestMainWindowCorners/macOS_26_SDK (#3949) and
  TestCodexPoolSaysTheClientsVersion (#4807, fixed on main by 17f2387e1
  since).
- GOOS=linux go vet -tags nogui and GOOS=windows go vet of both: ok;
  gofmt -l clean.
- GUI, both engines, every language, 1100 and 420 wide: every file that
  reaches the context card (context-text, context-map, context-window,
  context-map-live, context-scroll-end, context-scripts, context-tune,
  ctx-route, compact-one-value, routing-ctx-*, routing-context-fold,
  routing-live-patch, routing-return-cost) plus i18n-keys: 514 of 518.
  The 4 reds are context-map's webkit 420px "two tiles overlap", red the
  same on origin/main f3335dd1b run alone (5 of 10 webkit there), #3488.
- The whole GUI suite is running on the Linux box (wsl-run) as this is
  pushed; mote had another session's full suite on it.

Broken by hand (each went red):
- maskReplyPieces skipped: TestReplyPiecesAreMasked (phone unmasked).
- ArchivedPromptText's masking skipped: TestArchivedPromptTextIsMasked
  and TestContextTextFromTheArchive (phone in the 200 body).
- ctxtext.js's "missing" reason dropped: context-text.test.cjs, 10 of 10
  chromium.

Not tried: a real archived request in the running app, the bucket
(WebDAV) archive with a real server, and a reply cut short by the
archive's size in a real call.
2026-11-03 13:34:35 +08:00
yetone 2c214ce252 agents: Air's row says which of Air's own agents go through magpie (jumy_18634)
jumy_18634 on Discord picked a model on the Air (JetBrains IDEs) row and
found Air's Codex in IDEA 2026.3 still on another model. The model on an
Air row is the Magpie ACP agent's alone, and the row never said so.

What Air's own agents run, read from the jars (air-plugin
262.8665.521, Air app 262.1037.14):
- The IDE plugin's Codex runs this computer's codex (the terminal's
  PATH, else the @openai/codex it installs) as `codex app-server` with
  the user's CODEX_HOME or ~/.codex, and sets no model_provider
  (CodexAppServerProcessKt, CodexCliUtils). Its menu is model/list, its
  default config/read's model, and a task's model goes in thread/start.
  Its Claude Agent runs claude with only Air's hooks in --settings.
  So both are on magpie while Codex / Claude Code are connected here.
- The Air app's Codex runs with a CODEX_HOME of its own and JetBrains'
  gateway ([model_providers.air-gateway]), and never is.

Changed: an Air row, opened, says to pick Magpie in Air's agent menu and
that the model there is Magpie's. The IDE plugin's row says whether
Codex and Claude Code are connected here, and so whether Air's Codex and
Claude Agent go through magpie; the app's says its own agents don't
(airSaid in app.js, words in zh, zh-TW, ja, de). air.go's comment and
docs/subsystems/agent-wiring.md say what the jars showed, in place of
"not tried in an IDE". Six Agents-page comments in app.js are cut to one
line each to keep the core under its budget, no raise.

Run at the pushed head, on mote:
- Codex 0.166.0 `codex -c check_for_update_on_startup=false app-server`,
  as Air starts it, in a sandbox HOME with a magpie-style config.toml
  (model_catalog_json, model_provider magpie on a fake gateway at
  127.0.0.1:3599): model/list gave the catalog's two models, config/read
  the config's model; after config.toml changed under the running
  server, config/read gave the new model; a thread/start with model
  kimi/kimi-k3 (as Air's CodexThreadStartParams sends it) and a turn
  sent /v1/responses with model kimi/kimi-k3 to the gateway.
- GUI: agent-air-own.test.cjs (new), chromium and webkit, en zh zh-TW ja
  de, 1100 and 640px: 20 of 20.
  The 166 GUI files that reach the Agents page or i18n, both engines:
  red only in page-width-steady, found-skill-pick-remove, mobile-web and
  remote-magpie, which fail the same way alone on origin/main affa979d5
  (#5013), and nav-timeout, which fails at the old base and passes after
  the rebase.
- go test -tags nogui ./internal/agent -run 'Air|Notice', ./internal/gui
  -run 'Budget|I18n|Air|Notice': ok. GOOS=linux and GOOS=windows go vet
  -tags nogui ./internal/agent ./internal/gui: ok. gofmt -l: clean.

Broken by hand: without the Air branch in connectPanel,
agent-air-own.test.cjs is red, 10 of 10 in chromium.

Not tried: Air itself (no JetBrains IDE on this Mac or mote); a real
Codex or Claude Code connected through Air; Air on Windows or in WSL.
Air's bundled codex isn't among the running copies the Codex row names
as on an old list.
2026-11-03 13:02:15 +08:00
yetone e189542dfb providers: a new-api relay's user id is its own field beside the balance token (zxc56823)
zxc56823 (Discord #general) added a new-api site with a key and an access
token. The balance card said 请在供应商的「请求头」中添加 New-Api-User = 你的
用户 ID, so they typed 272298 as a header's *name* and left its value
empty. The editor drops a header with no value, so New-Api-User never
reached /api/user/self. new-api v0.9's authHelper still answered 401
"未提供 New-Api-User", and the balance stayed unread. CC Switch asks for
"User ID" in a field of its own and sends it as New-Api-User beside
"Authorization: Bearer <access token>". magpie sends the same request
apart from Bearer, which new-api strips. The id can't be worked out from
the token or the key, so the field can't be zero-config.

- Provider editor, Account balance: when the Balance URL is
  /api/user/self, a "User ID" field sits beside the token, with the line
  that says where the id is shown. The field keeps the id in the
  New-Api-User header row and redraws Headers. It keeps its focus while
  typing, and turns amber when what's typed isn't digits.
- A header named by digits alone with an empty value is the user id.
  headersOf in app.js and userIDHeader in provider.go (cleanHeaders on
  save, and the balance read for an unsaved check) both send it as
  New-Api-User=<digits>. A New-Api-User with a value of its own wins, and
  the digits header is dropped. So the reporter's saved form now works
  without being retyped.
- The 401's hint and the card's text name the User ID field, not Headers
  (en, zh, zh-TW, ja, de).
- The core script budget is unchanged. The ~1.6KB is paid for by four
  comments cut in app.js.

Run at this tree (on origin/main 3d7b1233d, on mote):
- go test -count=1 -timeout 45m ./internal/provider/ ./internal/gui/:
  provider ok. In gui, the one red is TestMainWindowCorners/macOS_26_SDK,
  which is red on mote's macOS 27 (#3949). Nothing here touches AppKit.
  Before the comment cuts, TestCoreScriptBudget was red at +2,373 bytes.
  Now app.js is 9 bytes under its base.
- GOOS=windows go vet ./... ok. gofmt -l is clean. For Linux vet,
  go vet -tags gtk3 ./... in WSL magpie-desktop was ok at the previous
  base 6b8134430; the change is the same.
- GUI, both engines: balance-fix (en, zh, zh-TW, ja, de at 1100 and
  420px), i18n-keys, header-session-hint, balance-method and
  balance-field-default: 178 pass, 0 fail. Earlier, at 6b8134430, the 45
  GUI files that draw the provider editor, its headers, its balance or
  Advanced ran: 1010 tests, 992 pass. The 18 reds are in four files
  (editor-advanced-align, provider-typed, vertex-editor, zhipu-team), and
  the same 18 are red on a clean origin/main 3d7b1233d. Filed as #4615,
  #4673, #4720/#4721 and #4728. The macOS reds are noted on #4673.

Broken by hand:
- Both userIDHeader calls taken out: TestNewAPIUserIDTypedAsHeaderName
  goes red with the fake new-api's 401 未提供 New-Api-User.
- headersOf's digits mapping taken out: balance-fix's first test and the
  User ID tests go red.

Not tried: a real new-api site and account (the fake serves v0.9's
authHelper and quota/500000 from new-api's source). Also not tried:
Linux WebKitGTK and the Windows app.
2026-11-03 13:00:55 +08:00
yetone c9824bb364 usage: each request's row says the credits its reply said
jiabubu (Discord, #feedback) saw a WorkBuddy request's credits shown
before, and now nowhere. The gateway still keeps them: usage.Record.Credits
from the chat usage's `credit` (#2512) reaches the ledger through the
WorkBuddy plugin on every endpoint shape. The ranking, Overview, tiles and
Sessions show them too. The Requests list's rows never did: a plan's model
there reads "—" for a price, and its detail had no line for credits.

Now the cost cell of a row whose reply said credits shows "N credits"
(the same ledCredits words as the ranking) in place of the dash, or under
the API price reference when the model also has a price. The expanded row
has a Credits line. A reply that said none still shows "—". This applies
to every credit-priced provider, since it reads the record's credits and not
the provider.

Tests:
- internal/gateway/plugin_plan_credits_test.go: a moved workbuddy-ai plugin
  replies with WorkBuddy's credit usage. Chat, Messages and Responses, each
  streamed and whole, each land 0.01 credits in the ledger.
- internal/gui/tests/plan-credits.test.cjs: a new test checks the row's
  cell, its title, a row with no credits, a priced row with credits and
  the detail, at 1400px and 420px.

Run at this head (mote, via mote-run):
- plan-credits.test.cjs: 36/36 in Chromium and WebKit, en, zh, zh-TW, ja,
  de, 1400px and 420px.
- go test -run 'PlanCredits|TestCoreScriptBudget|I18n|Lang' over
  internal/gateway, gui, usage and usageapi: ok.
- gofmt -l is clean. GOOS=linux and GOOS=windows go vet for gateway, gui
  and usage: ok.
- The other Usage page files the change reaches, alone, fail the same on
  the base as with it:
  - usage-agents-hide: 22 (#3414, #2276).
  - usage-fold: 4 (#3415).
  - usage-ledger: 6, "newest live route needs no return-to-live button"
    (#4078, #3104).
  usage-curve-zoom-back passes alone.
- Rebased from f49f6ba68 onto origin/main 6b8134430. plan-credits
  (36/36) and the Budget|PlanCredits Go tests ran again at the rebased
  tree: ok. vet and the other GUI files ran on f49f6ba68.

Broken by hand:
- With the old page.js, plan-credits goes 12 red (the new test in each
  engine and language).
- With chat.go's `out.Credits = c` dropped, all six cases of
  TestPluginPlanCreditsReachTheLedger go red.

Not tried: WorkBuddy China's Claude models, which the plugin sends to
/v1/messages. No real bytes were captured (the account answers 401), and
the gateway reads credit from chat usage only (#5011). There was no real
WorkBuddy request through the GUI; the fixture's usage follows #2512's.
2026-11-03 12:37:37 +08:00
yetone 6b81344301 library: the keep-here switch says sync, and is on while it syncs (bin.90)
bin.90 on Discord read the Library editor's 「只在这台电脑」 switch as a
LAN-sharing switch: "this computer only" says nothing about what it keeps
from where. It is about sync, so it now says so.

- Library editor (MCP servers, skills): the switch is "Sync to your other
  computers" (同步到其他电脑 / 同步到其他電腦 / ほかのコンピュータと同期 /
  Mit deinen anderen Computern synchronisieren), on while the server or
  skill syncs. Its note says off keeps it here, and a sync from the
  others neither removes it nor replaces it.
- The stored value keeps its meaning: `local` true is still kept here.
  The switch shows !local and saves !on, so every saved library.json,
  sync payload and CLI flag (`magpie library mcp local NAME on|off`)
  means what it meant.
- Row tag: "Not synced" (不同步 / 同步しない / Nicht synchronisiert) where
  it said "This computer only", in the Library, the TUI ("not synced ·")
  and `magpie library` output.
- Agents page sibling (the same words for an agent's picks): its menu
  item is "Don't sync picks to your other computers", its tag "Not
  synced". The agentsHere setting is unchanged.
- docs/subsystems/library.md and sync-backup.md name the new labels.

app.js stays in its budget: origin/main 8af751987 was already 31 bytes
over coreScriptBudget (1,533,833 > 1,533,802), so a comment in
setAgentHidden was cut to one line (core 1,533,756 now), no raise.

Run on mote, rebased on 8af751987, budget again at 2cfeda3d3:
- GUI: mcp-local-server, agent-here, i18n-keys, skill-off-here: 78/78
  before the rebase, in Chromium and WebKit, every language, at 390, 640
  and 1100 wide and in the panel; after it agent-here, i18n-keys and
  mcp-local-server 56/56, agent-here again 30/30 after the trim.
- go test ./internal/tui ./internal/cli ok; ./internal/gui ok except
  TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949, open,
  the same without this change); TestCoreScriptBudget ok after the trim.
- go vet ./internal/tui ./internal/cli ./internal/gui; GOOS=linux go vet
  -tags nogui and GOOS=windows go vet of tui and cli; gofmt -l clean.

Broken by hand: saving `d.local = on` (no negation) turns
mcp-local-server red (expected 'false', got 'true').

Not tried: a real sync between two computers with the switch flipped;
the stored value's meaning is checked through the saved request only.
2026-11-03 12:21:49 +08:00
yetone 2cfeda3d3a routing: a group editor's Cancel and Add have the scroll capsule above them, their ground to the window's edge
jiabubu on Discord: in a Routing group editor, its bar of Cancel and Add,
held at the window's foot while the editor runs on below, had the Scroll
to top and Scroll to bottom capsule over Add, and under the bar's ground a
gap above the window's bottom edge.

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

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

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

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

Not tried: the Windows app (WebView2) itself, and a phone with a home
indicator (safe area) in a real browser.
2026-11-03 12:14:06 +08:00
yetone 8af751987c providers: the id beside a model's name in Names & levels is its own, not the one it is Listed as
axelburks on Discord: once a model is Listed as another id in its
provider's Names & levels, the read-only id after its name showed the
listed id, and the id the provider is asked for was gone from the
editor. The row drew m.id, which for a listed model is the id it is
listed by; the provider's own id is in m.vendor (modelJSON sets it when
the two differ). The box now shows m.vendor || m.id. The Listed as field
still holds the listed id, and every agent still sees the listed one.

Run at this head (mote, Playwright 1.62.0): the 21 GUI files that draw
or read a Names & levels row (provider-listed-as, provider-same-as,
provider-levels-save, provider-levels-scroll, names-fold, name-suffix-*,
model-price-*, model-api-*, provider-detect*, vision-not-marked,
readable-focus, ux-safety, inner-scroll-contain, models-select-all-api,
model-reasonless), each in Chromium and WebKit and in every language the
file covers: 309 of 310 pass. The one red is provider-levels-scroll in
WebKit (760 !== 644), red 3 of 3 alone at origin/main 96acc59c4 without
this change too; it is #4395 (filed for WSL, now seen on macOS).

Broken by hand: with m.id back, provider-listed-as's new check that the
row shows grok-4.6@500k (listed as grok-4.6) fails in every engine and
language.

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

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

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

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

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

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

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

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

Not tried: the Windows app (WebView2) itself at the reporter's width; this
is Playwright's Chromium and WebKit.
2026-11-03 11:57:57 +08:00
yetone a2bba792d5 gui: a dragged row lands where it is let go when what is above its list moves
yuancjun on Discord: dragging a group member's handle on the Routing page
jittered, and the member landed two or more places from where it was let
go, so the group's priority changed to an order nobody chose. dragRows
measured every row once, at the press, and moved the held row by the
pointer's travel. The Routing page's live stage above the groups grows and
shrinks as requests come in, so mid-drag the rows moved under the
pointer while the slots were reckoned from where they had been.

dragRows (app.js, shared by the agents, providers, accounts, groups,
members and rules) now places the rows each frame from the list's own
top and the rows' offsetTop, the held row at the pointer less where it
was grabbed, and keeps drawing frames while the drag lasts. A row taken
out from under a drag cancels it. Routing's member and rule drags join
the group drag's guard: a redraw of the groups waits until the drag is
let go (the shared `arranged` idle in client.js), and a second press
during one is ignored.

drag-rows-shift.test.cjs: a group's members dragged in its editor while
a 90px block is put in above the groups (and, the other way, taken
out) mid-drag. The held row stays under the pointer (within 2px) and
the saved order is the slot it was let go in. Chromium and WebKit,
1100 and 560px, en/zh/zh-TW/ja/de.

Run on mote (mote-run):
- drag-rows-shift.test.cjs: 10 of 10 ok; on the old app.js and
  client.js 0 of 10 (the row 90px off the pointer, the order a slot off).
- every GUI file that presses the mouse (grep mouse.down), plus
  grip-inset, fold-show-grip, click-scroll, agent-disconnect and
  plugin-actions: 620 tests, 600 ok. The 20 reds are
  routing-rule-drag (chromium en/zh/zh-TW/de, its hover check before any
  drag; #3789, #4585) and segs-press-redraw (16, searchAllRow; #4566).
  Both files run alone at origin/main 8819beeb0 are red the same way
  (21: rule-drag chromium all 5, segs-press-redraw 16).

Not tried: a real Routing page with live traffic moving the stage, on
the Windows app the reporter uses; the drag was driven by Playwright
with the shift made by hand.
2026-11-03 11:57:57 +08:00
yetone 1d8658abca routing: a group's model picker offers the providers' image models, and a group of them draws (jzw690 on X)
jzw690 on X: the Routing page's group editor ("Add a model") listed no
image models, so a group of image models, to draw at
/v1/images/generations and to pick in Settings > Images, couldn't be
made.

What changed:
- /api/groups gains `drawers`: each provider's image models
  (gateway.Drawers, less ones unticked in its editor unless a group
  names them), apart from the chat `models`. The picker offers them
  after the chat models, noted "<provider> · Image model" (an existing,
  translated key); a member row says so and offers no reasoning level.
  Decision-model groups don't offer them. Image models stay out of the
  chat catalog, so agents are not offered them.
- An image member drew only when its provider had no picks: picks are
  of chat models, so membersFound dropped it as unpicked, and GroupDraws,
  resolveDrawing, the group's turns and DrawerMissing all failed.
  provider.FindDrawingGroup keeps such a member when drawsModel holds;
  the image path uses it (drawingMembers), video keeps FindGroup.
  DrawerMissing for a group ref asks GroupDraws.
- Routing card: such a member reads ready (groupsState), and Settings >
  Images lists every group that draws, not only those reached through
  Served.
- docs/subsystems/gateway-routing.md says so.

Tests:
- TestImageGroupOfUnpickedImageModelsDraws (gateway), from the
  reporter's case: two key providers whose live lists hold gpt-5.5 and
  gpt-image-2, one with gpt-5.5 picked. group/<id> draws at
  /v1/images/generations (the first member's 502 moves on to the next),
  as the Settings pick a request naming no model draws, and the model
  gone from the list makes it missing.
- TestGroupEditorOffersImageModels (gui): drawers listed, an unticked
  one not offered unless a group names it, none among chat models, the
  group's members ready, Settings offers the group.
- group-pick-drawers.test.cjs: the picker offers it with its note, adds
  it, no reasoning button, Save posts it; en and zh, Chromium and
  WebKit.

Broken by hand: drawingMembers passing nil instead of drawsModel made
the gateway test red ("group/pix-images doesn't draw"); turning off the
groups.go drawer branch made the gui test red ("group not ready").

Run at b295d1196 plus this change (mote unless said):
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.
- go test -count=1 -timeout 45m ./internal/provider ./internal/gateway
  ./internal/gui: provider ok. Two reds, neither on this path:
  TestCodexPoolSaysTheClientsVersion (full run only, passes alone 3/3;
  #4807) and TestMainWindowCorners (red on origin/main f49f6ba68 too,
  macOS 27; #3949). Both commented.
- GUI on the Linux VM (Playwright 1.62.0, both engines), 62 files:
  group-*, routing-group*, settings-groups, fallback-group,
  agent-model-groups, image*/images*, panel-routing*, routing-manual,
  routing-levels, i18n-keys. 698/710. i18n-keys was red on a comment of
  this change saying ", with an image" (reworded; 4/4 after). The
  WebKit reds under concurrency 4 passed on a serial run except
  group-member-info webkit zh, red 2/2 on origin/main f49f6ba68 too
  (#1745, commented).

Rebased on origin/main 809801f1f (its 8 commits change client.js and
gateway-routing.md), then again on mote: gofmt clean, go test -run
of the budgets, TestImageGroup*, TestDrawing*, TestGroupMember* and
TestGroupEditorOffersImageModels in gateway, gui and provider: ok; on
the Linux VM, both engines, group-pick-drawers, group-pick-filter,
group-decide-members, group-editor-fits, group-member-off,
routing-levels, settings-groups, image-models-hide, i18n-keys: 96/96.
Rebased last onto 03d7927a8 (search strings, i18n.js values only;
none of this change's files), not run again.

Not tried: a real provider's image model drawn through a group in the
running app; Windows and the real Linux app (WebKitGTK).
2026-11-03 11:57:11 +08:00
yetone 03d7927a8f search: Settings' search help says a picked provider that can't search gives way (plugins#635)
625938a2f made a searcher picked in Settings that can't serve (out of
quota, credit or rate-limited) give way to the other providers that can
search, after the ones the user added after it. Settings' help still said
a picked provider "is replaced only by the ones you add after it, then by
your Search APIs". It now says it gives way to those, then, when it can't
search at all, to other available sources, then to the Search APIs. The
text is changed in en, zh, zh-TW, ja and de, and in searcher-pick's
expected text (en, zh, ja, de).

Run on mote (macOS 27), at this tree on origin/main 625938a2f:
- node --test searcher-pick, searcher-then, search-instead, search-order,
  provider-search, settings-search, search-all (chromium + webkit, their
  narrow widths and languages) and i18n-keys: all pass (22, 20, 10, 16,
  16, 14, 40, 4).
- go test -run 'Budget|Script|I18n|Search' ./internal/gui: ok.

- Rebased onto 37cc86b3b (f49f6ba68 changed i18n.js): searcher-pick
  (22), i18n-keys (4) and go test -run 'Budget|Script|I18n'
  ./internal/gui: pass again.

Broken by hand: nothing; it is text only, and searcher-pick checks the
whole help in each language it covers.

Not tried: zh-TW is not in searcher-pick's languages; read by eye only.
2026-11-03 11:53:08 +08:00
yetone 809801f1fb gui tests: every short default timeout gets a minute to load the page (#4787)
nav-timeout was red on main: five page and panel setDefaultTimeout calls
had no setDefaultNavigationTimeout beside them, so on a busy machine their
first page.goto had only 5s or 8s:
- account-rows-fit (834c6c7df)
- profile-rename (1cb4d4301)
- quota-caption-contrast, page and panel (95a61a5d1)
- window-visibility (dfe868a1e)
Each now also gets setDefaultNavigationTimeout(60000), as the other files
already do. Only the time a page gets to load changes. Clicks and waits
keep their short limit.

Run on mote at 37cc86b3b plus this change: nav-timeout, account-rows-fit,
profile-rename, quota-caption-contrast and window-visibility at
--test-concurrency=2, chromium and webkit: 48 of 48 pass.
Red on the old code: nav-timeout listed these five calls at origin/main
84da86ebd (comment on #4787).

Not tried: the whole GUI suite. Nothing outside these test files changes.
2026-11-03 11:52:10 +08:00
yetone 37cc86b3b9 routing: an account refused for its sign-in has Sign in again on its card
adorable_piglet_80622 on Discord: the Routing page's Codex card said
"尝试 14 应答 8 / 2 需要重新登录, 4 失败 / 最近应答 10:41" for a ChatGPT
Plus account the editor showed in use, its usage read fine, and there
was nowhere to sign it in again ("我也没有重新登入的地方").

"sign-in required" on the card is the day's count of tries refused for
the sign-in (failAuth: a 401 with a revoked/invalidated token). The card
gave no way to act on it, and kept saying it after the account answered
again, so a past refusal read as the account's state now.

- The day's tally (DayTallies) says when the account's latest refusal
  for its sign-in was (authAt), beside when it last answered (last); the
  kept requests on the page update it too.
- Refused and not answered since: the card has Sign in again, which
  opens the provider on the Providers page and starts the same sign-in
  as the editor's own Sign in again (startSignIn with the account).
  Codex's own sign-in (relayed as Codex sent it) signs Codex in.
- Answered since: the count reads "sign-in refused (answered since)"
  (zh, zh-TW, ja, de), with no button.

Routing itself was not changed: a sign-in refusal rests nothing, and a
revoked mark is cleared by a 2xx or a good usage read (ServedSignIn),
so an account the editor shows signed in is tried again. With one
Codex account, Codex's turns go out as Codex sent them and are shown on
the "OpenAI · Codex's own sign-in" card, not the account's own card;
that may be the "no longer routed" the reporter saw, and is not changed
here.

Run at the pushed head (on mote):
- internal/gui/tests/routing-sign-in-again.test.cjs (new): chromium and
  webkit, 1100px and 420px, en/zh/zh-TW/ja/de, plus i18n-keys: 26/26 ok.
- every internal/gui/tests/routing-*.test.cjs (150 files), both engines:
  no failure in the first 822 subtests (at the pre-rebase base); the
  run was still going at push.
- after the rebase on f49f6ba68: the new GUI test, routing-day-tallies
  and i18n-keys 38/38 ok; go test -run 'Budget|TestDayTallies'
  ./internal/gui ./internal/gateway ok.
- go test ./internal/gui at the pushed head: every test ok but
  TestMainWindowCorners/macOS_26_SDK, an AppKit title-bar test red on
  mote's macOS 27 (#3949, open), which this change doesn't reach. The
  whole internal/gateway package was not finished at push.
- GOOS=linux and GOOS=windows go vet ./internal/gateway; gofmt -l clean.

Broken by hand: with the old client.js the new GUI test is red in every
case (no button, no "answered since"); with foldTally not setting AuthAt,
TestDayTalliesSayWhenSignInWasRefused is red ("refused at 0").

Not tried: the reporter's own logs, so which request was refused for the
sign-in (a stale token of the first account around the switch, or a
token the Codex app refreshed) is not known; a real sign-in from the
card's button (tested against a fake /api/signin); Windows or Linux GUI.
2026-11-03 11:45:33 +08:00
yetone f49f6ba686 tray: a usage window's name and unit read as its card says them (yi_time)
yi_time on Discord (Windows, v0.1.2777, magpie in Chinese): the tray
icon's tooltip said "WorkBuddy / Credits 0 / 500 credits · 已用 0% · 27 天
13 小时 后重置". The window's name and unit come from the WorkBuddy plugin
in English. The Usage page's card says both with t() (t(w.name),
t(w.unit)), so it read 积分 there, but trayCardText wrote them as given.

The fix is for every window, not WorkBuddy only:
- traywords.go reads the page's own table (embedded assets/i18n.js, once)
  and trayCardText says each window's name, and each " · " part of a
  pool's or family's name, and its count's unit, from it. The tray now
  reads as the card does in zh, zh-TW, ja and de; English is unchanged.
- i18n.js gains the window names and units plugins report that it lacked
  in every language, so the card had them in English too: Extra credits,
  Prepaid credits, Free model tokens (workbuddy); Add-on, Dedicated,
  Shared, Total credits (qoder); Monthly credits, Purchased credits,
  5-hour window (agnes); Promotional Credits (gcp-ai); Free models
  (devin); Free usage, Monthly, Included (cursor); Free trial (kiro);
  Dollar Usage (trae); Neurons/day (free allowance) (cloudflare-workers-ai);
  AI Q&A and the unit "questions" (orcaterm). Collected from
  magpie-community/plugins origin/main usage() results. No plugin change
  is needed: the plugins send English words, and magpie translates them.

Tests:
- TestTrayTooltipSaysWindowWordsAsTheCard: yi_time's card (Credits,
  0 / 500 credits, 27d 13h) gives the exact tooltip in all five languages,
  and a pool's window ("Gemini · 5 hours") is said in its parts.
- TestPluginWindowWordsSaidInEveryLanguage: each word above is in every
  language's table. TestParsePageWords: two pairs to a line, escapes, a
  comment and NOTICES left out.
- quota-window-words.test.cjs: the Usage card says WorkBuddy's and
  Qoder's window names and unit in en, zh, zh-TW, ja, de, chromium and
  webkit, 1100px and 420px.

Run at the pushed head 3886c2cc0's tree (on origin/main 84da86ebd), on mote:
- go test -run 'Tray|PageWords|PluginWindow|Translated|Budget'
  ./internal/gui: ok. GOOS=linux go vet -tags nogui ./internal/gui,
  GOOS=windows go vet ./internal/gui: ok. gofmt -l: clean.
- node --test quota-window-words, i18n-keys, quota-credits,
  quota-name-translated: 52 pass, 0 fail.
Before the rebase (on 05aba5ca4): go test ./internal/gui whole: all ok but
TestMainWindowCorners/macOS_26_SDK, which is #3949 (mote's macOS 27). The
GUI files that name any new key (credit-days, fold-show-grip,
plugin-namesake, plugin-option-words, quota-curve, usage-fold,
usage-merge, quota-pools, quota-pool-order, quota-warm, warm-reset-asleep,
warm-at-times, gateway-systemone): 250 pass, 6 fail, all in usage-fold,
en included; usage-fold fails 4 of 10 on an untouched 05aba5ca4 too
(#3415).

Broken by hand: with trayusage.go as it was, the tray test is red with
the reporter's line ("Credits 0 / 500 credits · 已用 0%"); with i18n.js as
it was, the words test and quota-window-words are red in zh, zh-TW, ja, de.

Not tried: the tooltip in a real tray on Windows; the whole GUI suite (no
layout change or API call). A window name a plugin adds later, and the
Chinese names some Chinese plugins send (积分, 限时积分), still read as sent
until i18n.js has them. A balance window's display text ("120 credits")
is the plugin's text and stays as sent, on the card too.
2026-11-03 11:38:09 +08:00
yetone 84da86ebd5 gui: Hide accounts is one switch for every page, window and the panel (paultian)
paultian on Discord (#feedback): Routing, Usage and Providers each kept
their own "Hide accounts" state, so turning it on in one page left the
others showing emails. Now window.hideAccounts is one switch, one
localStorage value (magpie.maskEmails), behind #rtMask, #usageMask and
#pvMask alike. Flipping it in any page applies to every page at once,
and a storage event carries it to other windows and the tray panel.
The old magpie.maskProviders value is folded in on first load (hidden
if either value was on) and then removed, so nobody who hid accounts
on one page sees them shown after updating. The tooltip and the
Settings line now say "on every page" instead of "on this page", in
every language.

Tests: provider-mask.test.cjs checks that one switch hides accounts on
every page and in a second window, that the state survives a reload,
and that an old maskProviders=1 comes through as hidden.
account-mask's expected tooltip text is updated.

Run on mote (GUI files at base 05aba5ca4; the Go asset/budget tests again
at this head after rebasing on a92cc3f33):
- go test -run 'Budget|I18n|Asset|Script|Strings|Lang' ./internal/gui: ok
- The masking/privacy GUI files at --test-concurrency=2, chromium and
  webkit, every language (account-mask-alias-plan, account-eye,
  window-mask, usage-fold, masking-demo-unblurred, account-alias,
  provider-mask, account-eye-provider, account-mask,
  privacy-hides-accounts, account-mask-sessions, mask-emails,
  plugin-name-unmasked, i18n-keys, masking-records): 403 of 408 pass.
  The 5 reds:
  - provider-mask "chromium en 420" (a click timed out). Rerun with
    usage-fold at concurrency 1: provider-mask is all green, and that
    run is 146 of 150.
  - usage-fold, 4 subtests: "17 subscriptions and 29 accounts" in
    chromium and webkit, and "several accounts" in webkit en and zh.
    They fail the same 4 at origin/main 625938a2f at concurrency 1
    (6 of 10 pass). That is #3415 / #4790, not this change.
- Not touched: Go code, so no go vet.

Broken by hand: with the old assets, provider-mask's one-switch tests
go red; with the maskProviders migration taken out, the
old-value-comes-through test goes red.

Not tried: the whole GUI suite (the owner's rule is to ship each
verified fix right away), and the real tray panel on Windows/Linux
following a switch flipped in the main window. Only the browser
storage event is tested.
2026-11-03 11:32:47 +08:00
yetone b295d11965 serve, update: one magpie works the gateway; the service waits, the copy an update left stops (#4938)
ox01024's #4938, Bug 2. Two magpies did the gateway's work at once on a
Mac:

- launchd's com.yetone.magpie.serve ran `magpie serve` beside the app.
  It ran startUp (plugin Settle/Refresh, FoldCopies, Hold, the agent
  moves), the plugin host and every account's model fetch, then failed
  to bind, exited 1 and was started again 5s later: 6,035 times in two
  days, a 279MB serve.log, and logins.json.lock held against the app's
  requests until they went 504.
- The copy an update left (.magpie-update/old) handed the socket over,
  hid, and lived on ~3h, its loops writing beside the new one.

What changed:

- cli: `magpie serve` (no --web) checks codexrelay.Leave,
  gateway.ServedBy and gateway.Taken before startUp, as the app's
  serveGatewayLocked does. While the port is held it prints one line
  and looks again every 15s, doing nothing else. Once the port is free
  it serves (serve_wait.go). It waits rather than exiting 0: under
  KeepAlive SuccessfulExit:false a clean exit would leave no service
  after the app quits.
- gui: after a handover the old magpie's loops end with backendCtx:
  - library.KeepLinked (now takes a ctx),
  - provider.WatchQuotas,
  - the menu bar usage loop,
  - the updater's check/auto-restart loop.
  lighten lets its hidden webviews go as lightweight mode does, so
  their polls stop. quitBy exits it at handedOffDrain + 3m whatever
  holds its quit up (gateway.HandedOffDrain getter; exitNow stubbable).
- docs/subsystems/gui-shell.md says both.

Run at the pushed head on mote (mote-run):
- gofmt -l internal/: nothing. go vet ./internal/{cli,gui,library,gateway};
  GOOS=linux go vet -tags nogui and GOOS=windows go vet of the same: ok.
- go test -count=1 -timeout 45m ./internal/cli ./internal/library
  ./internal/gui ./internal/gateway at bf05291e2 + this: cli and
  library ok. Two reds, both already filed:
  - gui TestMainWindowCorners/macOS_26_SDK (#3949). It is red the same
    on origin/main 443e53d6b, run alone.
  - gateway TestCodexPoolSaysTheClientsVersion (#4807). It is red only
    in the full package run, and passes alone 5 of 5 at this head.
- After rebasing on 8819beeb0, on that head: the vets above; cli and
  library in full, ok; gui and gateway with -run for handover, handoff
  and lightweight, ok.
- Sandbox HOME on mote, a fake app answering / as magpie 0.1.2770 on a
  private port (3593), `magpie serve` built from this tree beside it:
  alive after 8s at 0% CPU, nothing written under HOME, one standby
  line. 20s after the fake quit it served the port. The same with the
  old wait call removed: "magpie: listen tcp 127.0.0.1:3593: bind:
  address already in use", exit, and plugins.yml and lock files written
  first.

Broken by hand, each red:
- No wait before startUp: TestServeWaitsForTheGatewayBeforeStartingUp
  ("ran the start-up moves while another magpie served the gateway").
- KeepLinked ignoring its ctx: TestKeepLinkedEndsWithItsContext
  ("went on after its context ended").
- No quitBy in handover.run: TestRestartHandsTheGatewayOver ("has no
  deadline to quit by").

Not tried:
- A real launchd service beside the real app, and a real update
  handover on a Mac. Neither was run: no live app or launchd.
- The lighten change (needs Wails webviews) has no test.
- Not done here: serve.log rotation, `magpie daemon install` beside a
  running app (#4887), the old copy's appPage port, and Bug 1 and
  Bug 3 (ggbdpq has Bug 1).

cdredfox on Discord reports ~270% CPU after v0.1.2770. That fits this,
but it is not confirmed as their cause.
2026-11-03 11:16:02 +08:00
yetone 443e53d6b2 search: an AI Studio key that searches by googleSearch searches for other providers' models
cocoasoda on Discord: a Gemini AI Studio key provider searches natively
(googleSearch grounding, geminiKeySearches), but it never showed in the
search-for-other-providers (代搜索) list. searchRank knew only a Google
sign-in (googleAccount) at rank 5, so namedSearcherRank gave such a key
-1 and Searchers() left it out; autoSearcher never chose it.

searchRank now gives geminiKeySearches(p) rank 5 too: a saved key
provider, not a plugin, not Vertex, whose Gemini searches itself. That is
the same rank and the same googleSearch route as a Google sign-in, and
Searchers() marks it Own (it searches by its own tool, not a relay or a
search key).

Run on mote (macOS 27), at the rebased head e76db5515's tree:
- go test -count=1 ./internal/gateway -run
  'AIStudio|GeminiKey|Searcher|WebSearch': ok; ./internal/gui -run
  'Budget|Script|Search': ok; gofmt -l: clean.
- GUI: searcher-pick, searcher-then, search-instead, search-order,
  provider-search (chromium + webkit): 84/84.
- Before the rebase, at eb779ce92 + this: GOOS=linux and GOOS=windows
  go vet -tags nogui ./internal/gateway ./internal/gui: ok.
- TestAIStudioKeySearchesForOthers: a fake AI Studio endpoint
  (httptest, no network) answers the googleSearch call; the test checks
  rank 5, Own, the small model gemini-2.5-flash, autoSearcher's pick,
  and that another provider's model's web search goes there once, with
  tools [{"googleSearch":{}}] and x-goog-api-key.

Broken by hand: the new case taken out of searchRank, the test is red
("rank -1, by hand only false").

Not tried: a real AI Studio key; the whole ./internal/gateway and
./internal/gui packages at this head (a run at the old base is still
going).
2026-11-03 10:57:36 +08:00
yetone ffc4aa6844 providers: an Antigravity pool's meters and a family's set their own caps
pluviophile714 on Discord: an Antigravity (Google AI Pro) account row's
"上限 90%" pill says 每个窗口可单独设上限:点击下方它的用量条, and a click on
its "剩余 97.8% · 7d" meter did nothing. The class: a meter is a cap
button only when its window has a capId. Two kinds of meter never had one:

- A pool's own windows (Gemini · 5 hours / · 7 days, Claude & GPT · …),
  set Aside for routing, got no Capped/CapID from WithCapped, and
  routing's allowanceOf skipped them, so a cap there could not hold.
  Now WithCapped marks a pool window that has members capped (CapsSome),
  with CapID = its LineName ("gemini · 7 days", as both pools have a
  "7 days"). allowanceOf hangs each pool window on its members' own
  windows (Limit.pool), and CapHeld and NearCap count them through
  capLimits, so a cap on it holds that pool's models only. Routing's
  used-up and For still read the models' own windows, as before.
- A family's meter (windowCapMeter skipped `tiers`): several models'
  windows shown as one (Gemini 3.1 Pro High/Low, a pool read without its
  summary). It now posts every tier's capId in a new `windows` field;
  provider.SetWindowCaps sets them in one save (SetWindowCap, the CLI's,
  is it with one).

Changed for users: an account cap (the reporter's 90%) now also counts
an Antigravity pool's 5h and 7d windows, as the pill already says it
does ("each usage window"). Other Aside windows (on-demand spending,
Ollama's bought credits, MCP · Month) and windows past the first two
(tooltip only) stay unsettable: routing doesn't hold on them.

app.js shrinks 305 bytes (comments trimmed); no budget raised.

Run on mote (macOS 27), at the rebased head a2c1e8df1's tree:
- go test ./internal/gui -run 'Budget|Script', ./internal/provider -run
  'Cap|Pool|Allowance': ok. GUI: window-cap-pool (new), window-cap,
  quota-pools, quota-families, i18n-keys, chromium + webkit: 112/112.
- Before the rebase, at eb779ce92 + this: go test -count=1 -timeout 45m
  ./internal/provider ./internal/cli ok; ./internal/gui red only in
  TestMainWindowCorners (#3949, macOS 27); ./internal/gateway red in
  TestCodexPoolSaysTheClientsVersion (#4807) and
  TestUnroutedBodyRoomWaitNot408's TempDir cleanup (filed #4989); both
  pass alone, -count=5. GOOS=linux and GOOS=windows go vet -tags nogui
  of provider, gui, gateway, cli: ok. gofmt -l: clean.
- window-cap-pool.test.cjs: chromium + webkit, 420 and 1100 wide, en,
  zh, zh-TW, ja, de: 40/40; window-cap 60/60.

Broken by hand:
- capLimits without the pool windows: TestPoolWindowCapHeld red ("the
  Gemini week at 60% of 50%: <nil>").
- Old app.js: window-cap-pool's 20 family cases red. Its pool cases pass
  on the old JS once a capId is sent; the Go test is what's red for the
  pool on the old code.

Not tried: a real Antigravity Google AI Pro account (the fixture is the
quota-pools tests' shape with the reporter's 2.2% used); the whole GUI
suite (running after the push).
2026-11-03 10:51:52 +08:00
yetone c28220a5e7 sessions: a Codex thread saved on another provider resumes from Sessions
mrten_95615 on Discord: opening a Codex session from Sessions ran
`codex resume <id>` and Codex 0.166 stopped at "This chat uses custom,
but your current provider is magpie. Switch to custom to continue."
(modelProviderMismatch). Codex 0.166's app-server resumes a thread only
on the provider it was saved with (its state-database row, else its
session_meta), checked against the one config.toml (with -c) selects
(codex-rs app-server config_manager.rs load_for_resume); no flag lets a
resume go on another provider, and a provider config.toml no longer has
fails as modelProviderNotConfigured. Codex 0.165 resumed it on its own
provider without asking.

sessions.ResumeNow is the line that runs when the user opens a session
(GUI Terminal, TUI enter); the listed line is unchanged and nothing more
is read on a listing. For a Codex thread saved on a provider other than
the one Codex is on:
- config.toml still has that provider's table, or it is a Codex
  built-in (openai, amazon-bedrock(-runtime), gcp, ollama, lmstudio):
  `codex resume -c model_provider=<it> <id>`. Codex runs that embedded
  (no shared daemon) on the thread's own provider.
- the provider is gone: MoveCodexProvider moves the thread to the
  provider Codex is on (files copied to magpie's trash first, the state
  row too) and it resumes there, the only way Codex resumes it at all. A
  thread written to in the last minute or open in a Codex is left
  (ErrActive) and the plain line runs.
A WSL distro's Codex session and every other agent are as listed.

Run at this head (mote):
- go test -count=1 -run 'TestCodexResume|TestMoveCodexProvider|TestCodexProviderIn' ./internal/sessions: ok
- go vet ./internal/{sessions,gui,tui}, GOOS=linux -tags nogui and GOOS=windows vet of them: ok; gofmt -l: clean
- At this head (rebased on origin/main bf05291e2): go test -count=1
  ./internal/sessions ./internal/tui: ok; ./internal/gui: ok but
  TestMainWindowCorners/macOS_26_SDK (#3949, mote is macOS 27; this
  change touches only gui/sessions.go's terminal route); go vet darwin,
  GOOS=linux -tags nogui, GOOS=windows of the three: ok; gofmt -l clean.
- Full suite before the rebase (go test -tags nogui -timeout 45m ./...
  on mote, at eb779ce92 + this change): 86 packages ok; internal/gateway
  red on TestCodexPoolSaysTheClientsVersion alone (#4807, open, a full
  package run's known red). Not re-run after the rebase.
Broken by hand: ResumeNow returning the listed line, TestCodexResumeOnItsProvider
fails "resume ... && codex resume 01a0bdc9-..., want ... codex resume -c
model_provider=custom 01a0bdc9-..."; with the move dropped it fails
"the thread's rollout wasn't moved to magpie".
Real Codex: codex-cli 0.166.0 (npm darwin-arm64) in a sandbox
CODEX_HOME with two fake Responses servers: a thread made on "custom",
config.toml switched to magpie. Plain `codex exec resume` failed with
the reporter's modelProviderMismatch; ResumeNow's line resumed it and the
turn reached custom's server. With custom's table removed, plain resume
failed with modelProviderNotConfigured; ResumeNow moved it and the turn
reached magpie's server. The TUI `codex resume -c model_provider=custom`
was also driven in tmux (resumed, turn on custom, "Running without the
shared background server" warning). Codex 0.165.0 resumes it plainly.
Not tried: a Codex profile that names its own model_provider (a -c
override may lose to it); the Codex desktop app's resume; Windows'
PowerShell line (same flag, not run there).
2026-11-03 10:50:30 +08:00
yetone eb779ce92a gui: the tray icon's tooltip is in magpie's language (yi_time)
yi_time in #feedback: magpie set to Chinese on Windows, and the tray
icon's hover tooltip said "Today: 121K tokens (2.9K in · 180 out ·
118K cached)" and "3 requests" in English. The tray menu already
followed magpie's language (trayLang, #301); the tooltip's words were
hard-coded English in trayusage.go.

Now every tooltip is in trayLang(settings.Lang, systemLang), on
Windows, macOS and Linux alike. That covers trayIdleTip, magpie's
totals (trayTotalCard), and each subscription card (trayCardText: its
use or what is left, the pace, when it resets, until's d/h/m, "as of
…"). The words are in trayWords beside the menu's, for zh, zh-TW, ja
and de; English stays the key and the fallback. A window's name and an
error are still the card's own. A change of language in Settings now
also refreshes the tooltip (onTrayUsage); before, only the menu was
relabelled. The test-only trayUsageText and trayUsageView stay in
English, so the existing tests keep their strings.

Test: TestTrayTooltipFollowsMagpiesLanguage.
- yi_time's own numbers in zh: "magpie\n今天:121K token(输入 2.9K ·
  输出 180 · 缓存 118K)\n3 个请求".
- The same numbers in en are unchanged.
- Covers the total card and a card's used, left, reset and as-of.
- For zh, zh-TW, ja and de, no English word in the idle, totals, card
  (with pace) or combined tooltips.

Run at this head (rebased on 5573f7923):
- mote: gofmt -l clean; CGO_ENABLED=0 GOOS=linux go vet -tags nogui
  and GOOS=windows go vet of ./internal/gui ok.
- mote: go test ./internal/gui. Everything passes except
  TestMainWindowCorners/macOS_26_SDK, which is #3949 (red on mote's
  macOS 27, not touched here).
- Windows (xiaomi-gpu, win-run): go test -run Tray ./internal/gui ok.

Broken by hand: with the tooltip words taken out of trayWords, the
test goes red. Its zh output is then exactly the old English tooltip.

Not tried:
- The real tray on Windows, hovering the icon.
- The watch loop's choice of language has no test of its own. Passing
  "en" there would not go red.
2026-11-03 10:14:23 +08:00
yetone 5573f79231 agent: an agent's own models say they go direct, and a pick of one asks before 接入 goes off (maxleebeta)
maxleebeta in #feedback: Pi 1.5.0 connected to magpie; picking one of
Pi's own OpenCode Go models (opencode-go/<model>) turned 「接入」 off at
once, with nothing said, while magpie's models kept it on.

The cause: the pick writes defaultProvider opencode-go, so Pi asks
OpenCode Go itself and magpie is no longer in its config, and Wired()
is rightly false. What was missing is that the model said so. Options
from ownProvider (every ownOptions agent: Pi, OpenCode, Crush, Goose,
Cline, Hermes, Morph, OpenChamber, Qoder, StepCode, plugged agents, the
WSL twins) and ompOwnOptions carried no Direct, unlike Claude Code's
and Codex's own models. So the picker neither tagged them "direct, not
via magpie" nor asked before a pick took the agent off magpie. Each
now carries Direct = its vendor's name. The GUI already does the rest
(pathTag, the leave-ask, direct options listed after magpie's).

Tests:
- internal/agent TestOwnModelsSayTheyGoDirect: Pi, OpenCode, Crush and
  omp, signed in to OpenCode Go, each give every opencode-go/ option
  Direct "OpenCode Go"; magpie's options have none. Picking one writes
  defaultProvider opencode-go.
- internal/gui/tests/agent-own-direct.test.cjs: the tags, magpie's
  first, the ask (Cancel keeps 接入 on, nothing written), magpie's other
  model not asked, confirmed → written and off. Run in chromium and
  webkit × en/zh/zh-TW/ja/de × 980/420.

Run at this head (rebased on 2c2d2a5e5, mote):
- gofmt -l clean
- CGO_ENABLED=0 GOOS=linux go vet -tags nogui and GOOS=windows go vet
  of ./internal/agent ./internal/gui: ok
- go test ./internal/agent (TestOwnModelsSayTheyGoDirect, Codex
  Own/Pi/Omp/Crush/OpenCode runs): ok
- GUI agent-own-direct, agent-leave-magpie, agent-own-path,
  agent-own-providers, claude-default-off, pi-default-note: 56/56
  pass, both engines

Before the rebase (base 4cd01c964), go test of ./internal/agent and its
importers (backup, cli, davsync, gui, library, profile, stats, tui,
uninstall): all ok except internal/gui's
TestMainWindowCorners/macOS_26_SDK, which is #3949 (red on mote's
macOS 27). This change doesn't touch it.

Broken by hand:
- Without Direct in agents.go/omp.go, the Go test goes red for all
  four agents.
- With `direct` stripped from the GUI fixture, the GUI test goes red.

Not tried: a real Pi 1.5.0 signed in to OpenCode Go.
2026-11-03 10:08:44 +08:00
yetoneandcduyzh 2c2d2a5e51 gui: Test models says which key a test goes out with, when several are ticked (water5433)
water5433 (cduyzh) on Discord asked for Test models to say which
account a test uses. Their patch added "Tests use the preferred
account/key by default." to the button's tooltip for every provider,
in en, zh and zh-TW. Taken reworded, because it didn't say what the
code does:
- There is no "preferred" key and no other choice of one: TestModels
  (keySeeing in internal/provider/test.go) sends each model with the
  first ticked key that serves it, made for its endpoint first, so a
  key that doesn't see the model is skipped. "By default" promised a
  choice the editor doesn't have.
- A subscription account is a provider of its own, so "account" only
  confused it; and with one key, or none, there is nothing to say.
So the line, "Each model is tested with the first ticked key that can
serve it", shows only when more than one key is ticked, in en, zh,
zh-TW, ja and de (theirs had no ja or de, and zh-TW said 默認 where
zh-TW says 預設; it now follows the key list's own 勾選/金鑰 words).

app.js stays in the core budget without a raise: the line's comment
and two comments beside it (modelTestWhy, modelTests, testOne) were
cut down.

Test: test-models-key-hint.test.cjs, every language, Chromium and
WebKit, 900 and 390 wide: with two keys ticked the tooltip has the
line, and still has it after a test run puts the title back; with one
of two ticked, and with no key list, it doesn't.

Run (mote-run, at this commit on origin/main 12599e9cd):
- test-models-key-hint: 20/20; with status-long, model-test-one,
  account-models, key-plan and i18n-keys: 114/114 in both engines.
- go test -tags nogui ./internal/gui: ok (TestCoreScriptBudget: core 1,533,793 of 1,533,802).
- Broken by hand in Chromium: no line 0/10; the line on whatever keys
  are ticked red ("One on: no key to choose, no hint").
Not tried: the real app with a real multi-key provider.

Co-authored-by: cduyzh <cduyzh@users.noreply.github.com>
2026-11-03 10:05:30 +08:00
yetoneandcduyzh bf47eb46c4 gui: a long status line goes after 15s at most, not 80ms a character (water5433)
water5433 (cduyzh) on Discord: an error toast stayed on screen far too
long. Since d4c05ca11 (littleHong) status() kept a line for
max(ms, length * 80ms) so a long one could be read, with no upper
bound: a 1,150-character error floated over the window for 92s, and a
longer one for minutes, while it took clicks under it.

The reading time now stops at 15s: max(ms, min(length * 80, 15000)).
Their patch capped the whole thing at 10s, min(10000, max(...)); two
changes from it:
- 15s, not 10s: Test models' failure as littleHong read it (the OfficeAce
  line, 141 characters in English) takes 11.3s, and 10s cut it short.
- The cap is on the length part only, so a time the caller gives is kept
  whole: the damaged-file warning asks for 20s, and the 10s cap cut it to
  half.
The pointer still holds the pill however long, and it goes 2s after it
leaves. The text stays in the pill's title while it shows.

Test: status-long.test.cjs "a long line goes after its reading time, 15s
at most", page.clock driven, en and zh, light 900 and dark 390: a
1,150-character error is there at 14.5s and gone at 15.2s; the reporter's
Test models line is kept for all of its reading time and goes after; a
20s warning is kept to 19.5s; hover holds it past 30s and it goes 2.2s
after the pointer leaves.

Run (mote-run, at this commit and the next on origin/main 12599e9cd):
- status-long.test.cjs: 40/40 in Chromium and WebKit.
- go test -tags nogui ./internal/gui: ok; the core stays in its budget
  with this line's comment cut to one line (1,533,752 of 1,533,802).
- Broken by hand in Chromium: old code 0/4 ("gone at 15s, not after its
  80ms a character"); their 10s cap 0/4 ("still there before 15s").
- No other GUI test both drives the clock and reads #status.
Not tried: the real app; their own failing error, whose text I don't have.

Co-authored-by: cduyzh <cduyzh@users.noreply.github.com>
2026-11-03 10:05:30 +08:00
yetone 12599e9cd0 signin: ChatGPT signs in by device code, the first way from another computer
curtinp118 on Discord runs magpie on a VPS and opens its web UI from home.
ChatGPT's browser sign-in comes back to localhost:1455, which is the
viewer's own computer. The page there won't load, and the box's main line
said "The account shows up here as soon as you're done", so the sign-in
looked broken. The fix until now was to copy the dead page's address back
by hand.

ChatGPT now also signs in by device code, as `codex login --device-auth`
does (codex-rs login/src/device_code_auth.rs). This is
startCodexDeviceSignIn, with StartSignInWith site "device":
- magpie asks auth.openai.com/api/accounts/deviceauth/usercode for a code
  with Codex's client id and headers;
- the box shows the code and https://auth.openai.com/codex/device;
- magpie polls deviceauth/token, where 403/404 means not entered yet, for
  up to 15 minutes;
- it then trades the authorization code at the token endpoint with the
  returned verifier and the /deviceauth/callback redirect.
Nothing listens on this computer.

The window starts this way when magpie web is opened from a host other
than localhost or loopback (remotePage in app.js). Either way, the box has
a link to the other way: "Sign in with a code instead" or "Sign in in the
browser instead". A device code that ChatGPT turns away (404) fails, and
that box links to the browser's way. Strings are in zh, zh-TW, ja and de.
providers-accounts.md describes the flow.

This went over TestCoreScriptBudget. It now fits with no raise
(1,533,700 of 1,533,802, on main's 1,533,789). The two way-switch
buttons share one helper (codexWay), and eight comments on the sign-in
code are cut down: openSignInPage, signingKept, startPluginSignIn, the
sign-in proxy, signInProxyChoices, Copilot's GHE.com, dropSigningIn and
renderStepPlan.

Run on mote (the pushed head is rebased on ae060550b):
- go test ./internal/provider: the new TestCodexSignInByDeviceCode,
  TestCodexDeviceSignInCanceled and TestCodexDeviceSignInOff, against a
  fake auth server that answers with the bytes auth.openai.com gave on
  11-03;
- go test -tags nogui ./internal/provider ./internal/backup (before the
  comment trim, which touched app.js only): ok; ./internal/gui
  ./internal/cli after it: ok;
- GUI at this head: signin-codex-device.test.cjs (new; Chromium and
  WebKit, en and zh, 420px wide), signin-paste-codex, signin-callback,
  signin-port-blocked, signin-paste-plugin, signin-paste-import, the
  sign-in proxy files and i18n-keys, 40 files: 591 pass, 0 fail;
- the whole GUI suite one commit earlier (base c86fa2a34; the rebase onto
  6a6e4fefa only brought in internal/sessions): two runs, each cut short
  when mote rebooted or by the owner's call not to wait. They got through
  1075 and 1395 cases, with 0 not ok;
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., the Linux nogui and Windows builds, and gofmt -l (base
  c86fa2a34).
Rebased on 4cd01c964 at last: go test -tags nogui ./internal/gui ok and
signin-codex-device, signin-paste-codex, signin-callback and i18n-keys
21 of 21. Before that, rebased on ae060550b with the comments cut: go test
-tags nogui ./internal/gui ok, ./internal/provider ok, and 40 sign-in,
proxy, i18n-keys and desktop-tiers GUI files: 594 pass, 1 fail. The red
was signin-proxy's chromium ja 380 proxy test. That file alone then
passed 3 runs, 120 of 120. It is #1814, open since 10-12 for this test
under load, and noted there. The step that failed wasn't kept.
The full go test ./... was not run, by the owner's rule.

On Linux (WSL magpie-desktop, sandbox HOME), magpie web listened on
0.0.0.0:3561 and was reached at the WSL IP. POST /api/signin
{"agent":"codex","site":"device"} got a real code from auth.openai.com
with url https://auth.openai.com/codex/device. The sign-in stayed waiting
across real polls for 12s, nothing listened on 1455, and cancel ended it.

Broken by hand:
- Taking the device branch out of begin() turned
  TestCodexSignInByDeviceCode and TestCodexDeviceSignInOff red.
- Taking the remotePage default out of startSignIn turned 8 of the 12
  signin-codex-device cases red.

Not tried:
- Entering the code with a real ChatGPT account, so a real token trade
  through the device callback hasn't been seen.
- Business/Enterprise workspaces that turn device codes off.

Also not changed: WorkBuddy's plugin sign-in already finishes by itself
from a remote browser (server-side poll; checked on the same WSL setup).
A backup still carries no sign-ins.

Reported by curtinp118 on Discord.
2026-11-03 09:54:05 +08:00
yetone 8e9b048b65 settings: a row's explanation shows on hover, not under every name
The owner (11-02, a screenshot of Settings › 模型): hide the lines that
explain a setting and show them on hover, so the page reads quiet and
open ("很简洁,很有呼吸感"). Settings' rows now rest as a name and a
control. The pointer resting on a row (450ms, so passing over rows shows
nothing), or a key reaching its control, shows its explanation whole in a
card under the row's name, or over the row where the window ends; the
card takes no pointer and no row moves. It goes when the pointer or focus
leaves, a key is pressed, or the page scrolls (focus's card follows its
row instead, as Tab scrolls it into sight).

- app.css: in #view-settings, under (hover: hover), a .row.pref's plain
  .sub lines are clipped out of sight, not removed, so a screen reader
  and the search still read them; each carries --hint: 1, which the card
  reads. A search shows them in place again, as before. A touch screen
  keeps them all.
- Stays in sight: errors (.err, .bad), states (.say, [role=status],
  .proxy-check), warnings (.image-gen-hidden, .sync-sign-in,
  .vision-not-marked), .no-names, .pv-hits, .feat-why, .font-note, the
  proxy in use (#proxySub), and any line with a button, link, input,
  code or a search provider's failure note in it (.acts, which
  settingshints.js sets on each such line as it is drawn, through a
  MutationObserver, so before it is painted: Safari before 15.4 has no
  :has(), and old-webkit holds the styles to 15.0). Disclosures stay too: what tracing sends (otel's
  sessions row) and the allow list's addresses, as do a disabled
  pattern's matches. .say is new, on the lines that are a state, not an
  explanation: the version row's update state, a sync's last sync, the
  sync notice, the web page's "Served" line, the local masking model's
  state (downloading, on, failed; its two explaining lines, before it is
  on, are hidden) and what Check in now came to.
- One-line rows are one height: a row left with its name alone was 48
  to 51px by its control (the owner, 10-22: one-line rows of one
  height), so under (hover: hover) every Settings .row.pref has a 27px
  content-box min-height, 51px with its padding, its line above outside
  it. Check in now's row aligns to its top, so its result line grows the
  row down and the button stays where it was pressed.
- app.js stays in the core budget (1,533,799 of 1,533,802 at this
  head, on main's 1,533,789) with three comments shortened, no raise.
- settingshints.js: the card and the .acts marks, a module app.js
  imports at start, not in index.html (one line in app.js; old-webkit's
  list of such modules names it). Its :focus-visible check is in a try,
  as Safari before 15.4 throws on it.

Tests, run on mote (macOS) at this tree:
- settings-hints.test.cjs (new): Chromium and WebKit, 1100 and 420px,
  en/zh/zh-TW/ja/de, Settings › Models. At rest the Image recognition MCP
  server's line is out of sight and still in the page; a gone model's
  error and an unticked image model's warning stay in sight; hover shows
  the whole line in a card off the row's name, inside the window, no row
  box moved, pointer-events none; the pointer leaving hides it; Tab (or
  Option-Tab in WebKit) to the row's copy button shows it; a search shows
  it in place; a line given a link shows at once and rests again when
  the link goes. 20/20 green.
- Broken by hand: with the clipping rule's body gone, 20/20 red on "the
  explanation shows at rest"; with app.js's import line gone, 20/20 red
  waiting for the card; with the .acts observer gone, Chromium 10/10 red
  on the link line. Before the kept lines and the row height were
  in, checkin-now-account was 20 red (the result line hidden, then the
  button moved 7px) and settings-general 10 red at 1000px (one-line rows
  48, 50 and 51px); both green with them.
- settings-lines-wrap.test.cjs: a hidden explanation is skipped by its
  "cut short" measure and checked whole in its card instead (#visionMcpRow
  and the searcher row). 20/20 green.
- 22 more GUI files checked a Settings explanation's text, width or
  wrapping in place; each now checks the text and that it is hinted, and
  skips its geometry (redact-*, privacy-model, settings-general,
  searcher-pick, disabled-models, the *-setting rows, images-codex-one,
  and reply-model-setting, new on main since: red 20 of 22 on ".sub
  fits" until it got the same check, then 22/22).
  These 24 files: 536 pass, 2 fail, both images-codex-one's #pop picker
  race, red the same on untouched origin/main 173b7e274 alone (13/18;
  #4618, commented).
- At this tree, on mote: those 25 files, old-webkit and i18n-keys, all
  green but images-codex-one's #4618 race (3 red). After the last
  rebase (ae060550b, 1a92a97ca) and the comments cut: privacy-model,
  settings-hints, old-webkit, desktop-tiers, i18n-keys green, and
  -run 'Budget|Core' ./internal/gui ok. old-webkit was red before .acts (":has()
  (Safari 15.4)" and settingshints.js unlisted). go test -count=1
  ./internal/gui: ok but TestMainWindowCorners (#3949, macOS 27).
- The whole GUI suite on mote (concurrency 3), one commit before .acts:
  cut short when mote went down mid-run (it rebooted). 25 files had
  reds by then. The 4 that open Settings are main's filed reds
  (gateway-caller-keys #3797, omarchy #4624, mobile-web #3952,
  images-codex-one #4618); the other 21 don't open Settings. Run on
  Linux (wsl-run, magpie-desktop), those 21: 269 pass, 98 fail here;
  270 pass, 97 fail on untouched origin/main 173b7e274, the same files
  red. The one difference was old-webkit, fixed above.
  The whole suite was not run again after .acts.

Not tried: the real app's WebKitGTK (Linux) and WebView2 (Windows), and
a real touch screen; the (hover: none) path is only by the media query.
2026-11-03 09:47:25 +08:00
yetone ae060550b9 claude-desktop: a tier's pick runs with its tier's Claude prompt (behavesAs)
moer2831 on Discord: a model picked for one of Claude Desktop's tiers ran
in the Code tab on Claude Code's generic prompt, not the one of the
Claude model of that tier ("通用提示词和对应模型提示词差距挺大的,感觉直接
蠢了一个度"). Desktop 4.29 and later hand Claude Code behavesAs only from
a profile's inferenceModels (z3t in 4.4212's app.asar: modelPicker
options with each entry's behavesAs).

What changed:
- gateway.DesktopInferenceModels: while a model is picked for a tier,
  the list is every row /v1/models gives Desktop, by its id and in its
  order (a non-empty list replaces discovery, pzn), with supports1m,
  prefer1m and labelOverride as Desktop read them off the row, and a
  pick's anthropicFamilyTier/isFamilyDefault. A pick that isn't a Claude
  model gets behavesAs = its tier's newest Claude id (claude-opus-5-5,
  claude-sonnet-5-5, claude-haiku-5-5, claude-fable-5-1). Nothing picked
  (or a pick no longer listed): no list. Unreadable picks are unknown.
- agent: desktopSyncModels writes it into magpie's Desktop profile on a
  tier's Set, as Desktop comes on magpie and on Sync; temp+rename, only
  when it changed; taken away when nothing is picked. The list is
  magpie's only while its hash is one magpie recorded (stash mark
  claude-desktop.models); any other list (the user's) is never written
  over or removed.
- Claude Code's modelSettings gets the pick's own window even when it
  matches the default (claudeBudget.behaves), since behavesAs would
  otherwise give it the Claude model's.
- GUI: the tiers menu ends with one line, "Claude Desktop reads the
  tiers as it starts: restart it after a change." (en, zh, zh-TW, ja,
  de). The Agents row's Restart already lights from the profile hash.
- docs/subsystems/agent-wiring.md and gateway-routing.md.

Run on mote at this tree (base c86fa2a34): gofmt -l clean; GOOS=linux
(-tags nogui) and GOOS=windows go vet ./internal/agent ./internal/gateway;
go test -count=1 -timeout 45m ./internal/agent ./internal/gateway
./internal/gui ./internal/cli ./internal/tui ./internal/backup
./internal/davsync ./internal/library ./internal/profile ./internal/stats
./internal/uninstall: ok but internal/gateway's
TestCodexPoolSaysTheClientsVersion (passes alone here and at main; #4807)
and internal/gui's TestMainWindowCorners (red the same at origin/main
6a6e4fefa; #3949). GUI (chromium + webkit, every
language they cover): desktop-tiers, i18n-keys, and every file named for
tiers, picks, roles, Desktop, i18n or a language (887 tests,
871 pass; the 16 reds are 4 files red the same at origin/main 6a6e4fefa:
found-skill-pick-remove #4097, menu-input-scroll #3402,
phone-connect-menu #4706/#4707, provider-picks-stay #4397). Not the
whole GUI suite.

Rebased on origin/main a5c1fa4b4 (nothing there touches agent, gateway or
GUI assets but routing.css), then again at the pushed head: go vet
./internal/agent ./internal/gateway; the size budgets,
TestDesktopInferenceModels, TestClaudeDesktop*, TestClaudePlan;
desktop-tiers and i18n-keys in both engines: ok.

Broken by hand, each red: behavesAs left out (TestDesktopInferenceModels);
the window write's behaves check dropped (TestClaudePlan); the sync on a
tier's Set dropped (TestClaudeDesktopModelsList); the user-list guard
off (TestClaudeDesktopModelsList); the menu's line not shown
(desktop-tiers 0 of 4).

Not tried: a real Claude Desktop 4.29 or later (none on mote; this
Mac's is 2.7032 and live). Builds before 4.29 ignore behavesAs and take
the names. Desktop 1.x gets the mythos ids. A user's own gateway profile
applied in Desktop makes magpie's list do nothing.

Thanks moer2831 for the report.
2026-11-03 09:33:25 +08:00