Commit Graph
3479 Commits
Author SHA1 Message Date
yetone d628a1c803 settings: Automatic updates' hover card says why an update can be trusted
ArcticLampyrid on X asked for Settings to say why automatic updates are
safe. Two lines now join the Automatic updates row's explanation. Like
every Settings line, they show only in the row's hover card (or on focus,
or inline where there is no hover), and a small info mark goes on the
row's name where there is hover. There is no new section or row.
- Every update is signed: its SHA-256 checksums carry an ed25519
  signature, checked against a key built into magpie
  (internal/update/signed.go).
- Its SLSA build attestation, signed through Sigstore, is checked too:
  it shows magpie's release workflow on GitHub built those exact files.
  An update that fails a check is not installed
  (internal/update/attest.go).

The lines are added by updatetrust.js, a module settingshints.js loads
on demand. It watches #about and adds them each time About is drawn.
They live there and not in app.js because the core scripts' budget
(TestCoreScriptBudget) has no room. old-webkit's list of on-demand
scripts names it. Translated in zh, zh-TW, ja and de.

update-auto.test.cjs: at rest the two lines are out of sight; hovering
the name shows the card with the row's line, "ed25519" and "Sigstore";
the mark is there; and the card goes once the pointer leaves. The
existing check of the switch's own line now reads the first line only.

Run (mote-run, at this commit rebased on 414517ccf):
  node --test old-webkit phone-no-sideways settings-hints
    settings-lines-wrap settings-search update-auto (Chromium + WebKit)
  66 pass, 26 fail. The 26 are the same tests, failing the same way, on
  plain 414517ccf: #6467 (appearance.js), #5919 (:has), #5869 (de 375),
  #6107 (settings-hints ja/de 420px), #6353 and #6133 (settings-search
  /api/update/using, settings-lines-wrap de 440px). update-auto passes
  in both engines.
  The first run, at e5b8f381d, covered 38 update-*, settings-*, about-*,
  i18n-keys, i18n-en-no-cjk, remote-update, whats-new and
  uninstall-settings files: 720 of 746 passed, and the 26 reds are the
  ones above.
  go test ./internal/gui/... (TestCoreScriptBudget included): ok.
Broken by hand: without the import in settingshints.js, update-auto
goes red (no .update-trust lines within 5s).
Not tried: the real app window; only the faked API in Playwright.
2026-11-13 19:31:37 +08:00
yetone b05a525a33 update: Restart to update goes into the download waiting when downloads are automatic
canlee886 on X: auto-download had a version ready, but magpie releases
many times a day, so by the time they pressed Restart to update a newer
one was out. The click asked the feed (coeo91's "take the newest") and
downloaded the newer one whole while they waited, which made the
download done ahead of time useless ("这个自动下载在如此频繁的更新之下
简直就是摆设了").

Two ways to fix it: keep the staged copy current (check more often,
download each newer one), or restart into the staged copy and let the
next check fetch anything newer. This takes the second:
- the restart is at once, which is what the download ahead of time is for;
- no more bytes from R2 than before: one download per update. Keeping
  the copy current would download 40 to 95 MB per release, several times
  a day, which iiiiiimone's fix (the clock leaves the one waiting) took
  out;
- the new version's first clock check, 5s after it starts, fetches
  anything newer in the background, and the next restart goes into that.

So with downloads automatic (the default), recheck leaves a ready
download alone and doesn't ask the feed (keepsStaged). That covers the
page's Restart to update, the tray's restart, and Restart when idle.
The notes dialog's freshen (#910) still asks the feed for late notes
(#649), but with `keep` set it leaves the staged copy as the clock's
check does, so the dialog names the version the restart goes into.
With "Download updates automatically" off, nothing changes: a click asks
the feed and downloads the newest (coeo91).

Tests: TestRestartTakesTheDownloadWaiting (new) covers the page's click,
the tray's restartAsked, AutoRestart's waitIdle and a stale freshen. Each
keeps 0.1.11 with one download while the feed has 0.1.12, and a later
check takes 0.1.12. The coeo91 and #910 tests now set NoAutoDownload
(downloadsOnClick), the behaviour they guard.
TestUpdateClockLeavesWaitingDownload and TestUpdateNotesAskTheFeedAgain
expect the staged copy kept under auto-download.

Run (mote-run, at this change rebased on 414517ccf, with the next commit):
  go test -count=1 -timeout 45m ./internal/gui/... .
  internal/gui ok (129s); the root package's TestNoEagerPackageRegexps is
  red the same on plain 414517ccf (internal/davsync/setuptext.go:73,
  filed as #6534), nothing else.
  go vet ./internal/gui/, GOOS=linux go vet -tags nogui ./internal/gui/,
  GOOS=windows go vet ./internal/gui/: ok. gofmt -l clean.
Broken by hand: keepsStaged returning false makes
TestRestartTakesTheDownloadWaiting ("the page's click: Latest 0.1.12")
and TestUpdateClockLeavesWaitingDownload ("2 downloads") red.
Not tried: a real restart of the packaged app across two releases.
2026-11-13 19:31:37 +08:00
yetone f9ad4122bb providers: Compact at's size chips set several models at once (Yanzhongixuy on X)
A Compact at chip (128K, 200K, 272K, 500K, 1M) opens a menu of All
models and each served model, with the ones at that size ticked.
Ticking one gives it that size, unticking takes it back; the menu stays
open, so several models get one size in a few clicks. Context window
and Max output chips keep setting every model at once, as before.

The three fields' chip rows are now one helper, sizePicks, which keeps
app.js and the core script inside their budgets without a raise. Menu
strings (All models, Compact at {n}, Search models) already exist in
every language.

Run at 414517ccf + this change, on mica:
- compact-at, context-picks, provider-output-picks,
  provider-advanced-fold, model-limits, i18n-keys, i18n-en-no-cjk:
  130/130 in Chromium and WebKit; compact-at's new test runs en, zh,
  zh-TW, ja, de at 900 and 400px.
- go test -tags nogui ./internal/gui -run Budget: ok.
- Broken by hand (a chip always sets every model): the 20 new tests
  went red.
- 94 provider/model GUI files at 24cdfb546: 80 reds, identical by name
  with and without this change (#6209, #6196, #6532).

Not tried: the real app; Linux WebKitGTK (no motion added).
2026-11-13 19:25:01 +08:00
yetone ea3edd4b13 routing: an account's share names its window when more than one counts the model (Wing8Aqua on X)
On the Routing page, under In turn, each account showed its week's share
("41% used") while its five hours were at 0%, and read as the five-hour
window. The row's share is Allowance.For's, the fullest window's, and
that is the one routing goes by: In turn rotates without weighing usage,
and sets an account aside only when a window reaches 98%, so the week at
98% stops it with the five hours empty. The number was right; it didn't
say which window it was.

Allowance.FullestName gives the name of the window the share is of when
two or more windows count the model (empty for one, as before). The
gateway puts it in Weighed.usedWindow, and the Routing row puts its short
form in front: "7d 41% used" (zh "7d 已用 41%").

Run (mica, -tags nogui): go test -run 'Fullest|UsedWindow|UsedRenews|Weigh'
./internal/provider ./internal/gateway ok; go vet darwin, linux, windows
on provider and gateway ok; gofmt clean. GUI (mote): the new
routing-used-window.test.cjs, 22 of 22 in chromium and webkit, en, zh,
zh-TW, ja and de, at 1100px and 420px; routing-*, i18n-keys, gui-zh-tw, gui-ja and
gui-de: 3234 of 3253; the reds are gui-de/gui-ja (fixed in this push's
sessions commit) and routing-context-fold, pin-away, row-swap, signin and
story-shrinks, red the same on a clean origin/main e4ea31321 run on mica
(#5586, #6512, #3799, #6520, #3954).
Broken by hand: w.UsedWindow not set in trace.go: TestUsedWindowNamesTheWeekInTurn
and TestUsedRenewsWithItsOwnWindow red; the prefix taken out of client.js:
routing-used-window 22 of 22 red. Both restored.
Not tried: a real Claude account with a full week, and the full suite
(both test machines had a long suite.lock queue).
2026-11-13 18:50:25 +08:00
yetone ba60e2e7f4 sessions: de and ja name the uninstalled agent once, as the English does
fe20e4dbd's "{agent} isn't installed here…" has {agent} once; its German
and Japanese said it twice, so gui-de and gui-ja's placeholder check was
red on main. The second mention is now "seine eigenen Dateien" and
"そのファイル自体".

Run (mica): node --test gui-de, gui-ja, i18n-keys, sessions-forget: 20 of
20 pass. Before: gui-de and gui-ja "de/ja has every zh string" red on a
mote run of this branch.
2026-11-13 18:50:25 +08:00
yetone dc1f17c1c8 library: RTK's chart says its top number is the busiest day, not a total (jasonchia58 on X)
jasonchia58 on X (macOS, v0.1.3119): the number at the top right of
Library → RTK's chart (1.6M) stopped changing, while the total under the
chart kept growing. That number is the bars' scale: the busiest day's
(or week's) input in the range, shown bare since 5b43bdd61. It changes
only when a day passes the old busiest, so it read as a stuck total.
Nothing on main changed it since 3119.

It now says "peak day 1.2M" / "peak week 1.2M" (zh 单日最高, zh-TW 單日最高,
ja 1日の最大, de Stärkster Tag), in the library plugin's own words, and
a range with nothing in it shows none. The total stays under the chart.

The Usage page's charts have the same bare peak (plugins/usage/page.js
875 and 4315); filed as #6517, not changed here.

Tests:
- internal/library/testdata/rtk-gain-daily.json is real rtk 1.0.1
  `rtk gain --daily --format json` output from a sandbox HOME;
  TestRTKGainRealDaily parses it and checks the days add up to the
  summary.
- library-rtk-chart.test.cjs feeds those days (moved to end yesterday)
  through a faked /api/library/rtk, chromium and webkit, en/zh/zh-TW/ja/de
  at 980 and 420px: the head says the peak, the busiest bar is the one
  at full height, the foot is the total; an empty 30-day range has no
  peak.

Run on mica (base 5b25d7e9e, then again after the rebase onto
49d7adef7: gofmt, the provider and library tests, library-rtk-chart,
library-rtk-gain, i18n-keys, i18n-en-no-cjk all pass): gofmt -l clean; go test
./internal/library ok; GOOS=darwin/windows go vet and GOOS=linux go vet
-tags nogui of internal/{provider,library,gui} ok; GUI files
library-rtk-chart, library-rtk-gain, library-rtk-admin,
library-rtk-nohook, i18n-keys, i18n-en-no-cjk all pass (both engines).
Broken by hand: the old head (bare tokens(peak)) makes all 12
library-rtk-chart subtests red.
Also run: go test -tags nogui ./internal/gui ./internal/provider: red
only on TestCoreScriptBudget (1,268,751 > 1,268,645, the same number
#6518 records at base 5b25d7e9e; this change adds no core script) and
TestHostBuildsNoList (#6479); editor-hints webkit red as in #6156.
Not run: the full Go suite and the whole GUI suite.
2026-11-13 18:41:28 +08:00
yetone d21cb563e9 sync: Copy setup gives the sync setup as text, sealed with the passphrase (WJaunita45604 on X)
Setting sync up on a second computer meant typing the server, user,
password (or S3 keys, or GitHub token) and every tick again. Settings ›
Sync's form, with sync on, now has Copy setup. It copies one line,
`magpie-sync:…`, to paste into the same form on the other computer.

- The line is not base64 of the settings. It is the setup (server,
  password or token, endpoint, region, path style, branch, the ticks)
  sealed with the sync passphrase by backup.SealData, the AES-GCM and
  PBKDF2 envelope the server's file already uses. The passphrase is never
  in it. Whoever has the line and not the passphrase has nothing. The
  copied note says what it holds and that the same passphrase opens it.
- Pasted into any field of the form, the line is not typed in; the form
  asks for the passphrase, opens it (POST /api/davsync/setup-open), picks
  WebDAV, S3 or GitHub from its address and fills every field and tick.
  Nothing is saved until Turn on, and Turn on opens a pasted line first. A
  wrong passphrase, or text that isn't a setup, is said in the reader's
  language. A line a chat wrapped, or text around it, still opens.
- Not built: GitLab or MySQL sync backends.

Run (mica):
- At the pushed tree (run as 8fadc2ef8, the same tree before these bodies): go test ./internal/gui ./internal/davsync
  ok; sync-setup-text, i18n-keys and i18n-en-no-cjk in the 110 of 110 the
  commit before names. At the base 5b25d7e9e: ./internal/backup ok too.
  New TestSetupTextOpensWithItsPassphrase (WebDAV, S3, GitHub; no secret
  readable in the text or its decoded bytes; wrapped line; wrong
  passphrase), TestSetupTextNeedsSyncAndItsOwnText and
  TestDavsyncSetupTextRoutes (through the page's routes: off, copy, open on
  a computer with sync off, wrong passphrase, nothing saved).
- New sync-setup-text.test.cjs, Chromium and WebKit, en, zh, zh-TW, ja, de
  at 900px and en, zh at 440px: 42 of 42. The sync GUI files and
  i18n-keys / i18n-en-no-cjk: green but s3-sync webkit en, red the same
  alone on origin/main e4ea31321 (#3413).
- GOOS=linux go vet -tags nogui, GOOS=windows go vet: clean. gofmt clean.
- Broken by hand: SetupText unsealed (base64 of the JSON) made
  TestSetupTextOpensWithItsPassphrase red ("dav-app-password-9z is
  readable"); Turn on without opening the pasted line made all seven
  "pasted setup fills" GUI tests red. Both restored green.

Not tried: a real WebDAV, S3 or GitHub server between two computers, a
paste in the real app, WebKitGTK.
2026-11-13 18:39:28 +08:00
yetone a44da380b9 providers: a vendor's setup pasted in any form fills the custom provider (WJaunita45604 on X)
2bb201162 (v0.1.3788) opened a custom provider from pasted env lines, but
only for ANTHROPIC_, OPENAI_ and GEMINI_ names. A vendor's page that writes
`export XXX_BASE_URL=…` / `XXX_AUTH_TOKEN=…`, a bare BASE_URL, a JSON
snippet in snake_case, or a plain "Base URL: … / API Key: …" (also 地址 /
密钥) fell through to the search box as text.

- envOf takes any prefix before BASE_URL, API_BASE, ENDPOINT, HOST, … and
  AUTH_TOKEN, API_KEY, TOKEN, SECRET_KEY, …. An unknown prefix needs an
  http(s) value, and its API comes from the path (/anthropic or /claude is
  Anthropic, else OpenAI compatible). *_PROXY and GITHUB_, GH_, NPM_, AWS_,
  HF_, SLACK_, DISCORD_ names are left alone, so a pasted .env of other
  things opens nothing. Named vendors come first when both are there.
- plainOf reads text that is not variables: it needs an http(s) address and
  a key (labelled, or shaped like one), cuts /chat/completions, /messages
  and /responses off the address, and leaves curl to curlOf.
- The search placeholder says it: "Find a vendor, or paste a URL and key…"
  in en, zh, zh-TW, ja and de.
- The key still goes only into the draft. The logo is the site's icon
  fetched by icons/favicon with the address alone, as before.
- The favicon callback is packed to one line, so the core scripts are 12
  bytes smaller than at its base despite the longer placeholder.

Run (mica, mote over its 18 cores), at the base 5b25d7e9e unless said:
- provider-env-paste and sync-setup-text, Chromium and WebKit: 60 of 60.
- add-sheet*, provider-add-*, provider-curl-paste, provider-env-paste,
  custom-systemone-url, the sync GUI files, i18n-keys, i18n-en-no-cjk: 349
  of 350. The red is s3-sync webkit en ("picking S3 must not scroll the
  page"), red 3 of 3 alone on untouched origin/main e4ea31321: #3413.
- go test ./internal/gui ./internal/davsync at the pushed tree (run as 8fadc2ef8, the same tree before these bodies)
  (rebased on e4ea31321): ok, TestCoreScriptBudget included (1,268,622 of
  1,268,645). At the base 5b25d7e9e the budget was red as on that main,
  fixed by e4ea31321.
- At the pushed head: provider-env-paste, provider-curl-paste,
  add-sheet-custom, sync-setup-text, i18n-keys, i18n-en-no-cjk: 110 of 110.
- GOOS=linux go vet -tags nogui, GOOS=windows go vet: clean. gofmt -l clean.
- Broken by hand: envOf named-only and no plainOf; provider-env-paste's
  new cases went red in Chromium, restored green.

Not tried: a paste into the real app's Add sheet (only the GUI suite's page),
and WebKitGTK.
2026-11-13 18:39:28 +08:00
yetone e4ea313215 context: the last-cache fix fits the core script budget again
5b25d7e9e (shenggxhz on X) added 106 bytes of code to context.js while
the core scripts sat exactly at their budget (1,268,645 at its parent),
so TestCoreScriptBudget has been red on main since (1,268,751). The
budget is not raised; the change is packed instead:

- Routing passes the session key whole (sk, the conversation, or the
  line's first request), so ctxCard keys on opts.session alone. Routing
  is ctxCard's only caller.
- cacheOf takes a missing route, so the seed is `lastCache ||=
  cacheOf(opts.prev)`, and the cache shows when lastCache is set: it is
  set only by a shown cache (cacheShown) or by prev, which Routing passes
  only for a request under way, so `live &&` added nothing.
- Three nearby lines in the same card packed to one statement each
  (the health word, the big figure, the cache's class), same output.

core scripts now 1,268,634 of 1,268,645 (117 bytes less than 5b25d7e9e).

Run (mica-run, at this tree on 5b25d7e9e): go test ./internal/gui -run
'TestCoreScriptBudget|TestAppScriptBudget' ok; node --test routing-ctx-cache-long,
-still, -sessions, -fold, i18n-keys, context-cap, ctx-session-line: 150 of
154. The 4 reds are context-cap chromium en/zh (#6514) and ctx-session-line's
session-line test in both engines (#5801), red the same on main before this.
Broken by hand: without `|| lastCache` in the cache's condition, and
separately without the prev seed, routing-ctx-cache-long goes 12 of 22 red
in both engines.
Not tried: the real app; the change has no new behaviour, and the
Routing ctx GUI files cover the card's cache states in both engines.
2026-11-13 18:20:09 +08:00
yetone 2f22cc7e80 redact: Settings › Privacy's masking rules are imported in bulk and copied out (hgk0x on X)
hgk0x on X had many fields to mask, and adding custom rules one at a
time was slow. The Masking rules row now has Import… and Copy beside its
words, as the word lists have:

- Import… opens a box under the row's fields. One rule a line: a name,
  then a tab, =, : or comma, then the pattern; a bare pattern is CUSTOM.
  The box's Regex/Prefix choice says how a pattern is read. A JSON list
  (what Copy writes) is taken as it is, prefix and regex rules alike.
  What was read is listed (the first eight, then "and N more"); a rule
  the list has, or one pasted twice, is passed over. Import saves once,
  after the rules there are. Escape and Cancel save nothing; a redraw
  keeps the box, its text and its choice; a list the gateway refuses is
  said in the box and the paste is kept.
- Copy writes the rules as JSON.

MaxRules stays 32. Measured on this machine: 32 rules took 83ms on a
190KB body, 100 took 343ms, and that cost is on every request. One
rule's regex with alternation (a|b|c) covers many fields, which the
reply says. There is no CLI for masking rules, so none was added.

Run (GUI, mote/mica, both engines):
- new redact-rules-import.test.cjs: 5 languages x chromium/webkit at
  400px, 10/10 ok.
- the 56 GUI files that reach the privacy page, masking or i18n
  (i18n-keys, i18n-en-no-cjk, plugin-own-words, redact-*, mask-*,
  privacy-*, settings-*): 1333 tests, 27 red on loaded mica. The reds,
  run again on mote at base 5d54a990d and at this change: the same 20
  in settings-hints, settings-search and settings-lines-wrap de 440px
  on both (#6353, #6156, #6133). provider-mask's 6 reds were mica's
  load (load 60-85); it passed in both mote runs.
Broken by hand: reading every line as unnamed (named = false) turns
the new test red in every language and engine.
Not tried: the whole GUI suite, and the real app.
2026-11-13 18:17:36 +08:00
yetone f9678cebe2 gui: Routing's quota bars are Usage's, and every account in a Usage card has a line over it
normalcoder_ on X: Routing's remaining/total bars were grey and black
while the Usage overview's are blue, and in a Usage card with several
accounts two accounts ran together with no divider.

Routing's bars were never Usage's: af5889085 drew them grey (--muted),
black (--fg) for the account that answered, on --card-2, from the start.
It was not a regression. Now the stage's rows, a fold's row and each
account's row under the requests carry Usage's .quota-track, so the track
and fill come from that one rule (--pill, --accent) in light and dark.
routing.css keeps only their size and place. The account that answered
still shows by its frame and dot.

The Usage dividers came from six rules spread over app.css, each naming
one kind of row that could end an account (windows, error, balance, read
time, credit days, curve, resets, key line, auto-reset, credits). A
brief account's check-in row (Trae, WorkBuddy, MiniMax Code) and
magpie's own requests line (quota-own) were never named, so the account
after one had no line. One rule now draws the hairline over every
account that follows anything but the card's head or its "All accounts"
box.

Tested: new quota-bars-alike.test.cjs, in Chromium and WebKit, en zh
zh-TW ja de, light and dark, 1100 and 420px. It checks that every
account after the first in a card has a 1px solid --line border, the
first has none, and every visible Routing bar (stage and account list)
has the same track and fill colours as Usage's .quota-track: 10/10.
Broken by hand: the old app.css fails it, the old routing.css fails
it, and the old client.js (no quota-track class) fails it.
Screenshots before and after in both engines, both themes, 1100 and
420px: Routing's bars are accent on the pill track, and the Trae card's
t2/t3 have the line that was missing.
The GUI files that reach Routing, Usage, quota cards and accounts (354
files, every routing-*, usage-*, panel-usage*, quota-*, plus the
subscription-account/rt-acct users, i18n-keys and old-webkit) on mica:
5854 pass, 141 fail. The failures are in 23 files. Rerun at
concurrency 2 on origin/main 51b98b1a8 and on this tree, they fail the
same (130 at base, 133 here, the same files). The extra ones are
tray-cell-click, which fails 2 of 4 on base when run alone, and a
rest-try-now case. old-webkit's red is app.css:~422 :has(), not this
change. go test -tags nogui ./internal/gui -run Budget: ok.
At the pushed head 4176025f4 (rebased): quota-bars-alike, routing-quota-left,
usage-accounts-fold and i18n-keys pass, 30/30.
Not tried: the real app on Linux WebKitGTK (colours only, no motion).
2026-11-13 18:11:09 +08:00
yetone 5b25d7e9e8 context: a request under way in a long session shows the last cache, not "—" (shenggxhz on X)
shenggxhz's Codex session (T3 Code) on Routing showed "— 命中 · 供应商回答后可见" while a request was under way, and read it as the cache missing. The cache was there: Codex's rows record cache_read at about 32K of 34K. The card was dropping it for two reasons.

- The card forgot the last cache whenever the first request in its session line changed (its key was opts.series[0].id). Routing keeps only the latest 60 requests. In a session longer than that, the first request moves on with every new request, so every request under way showed the dash. The key is now the caller's session key (opts.session: the Routing session key, else the conversation).
- A card opened while a request was under way had no last cache to show, even when the session's answered requests were in the list. Routing now passes the session's last answered request with usage (opts.prev). Its cache is shown, dimmed and labelled "the last request's", until this request's own cache is read.

Run (mote):
- At the pushed head (rebased on 80c22eecb): routing-ctx-cache-long, routing-ctx-still, routing-ctx-sessions, routing-ctx-fold and i18n-keys pass 146 of 146.
- At the pre-rebase base 5d54a990d:
- New routing-ctx-cache-long.test.cjs: 22 of 22, in Chromium and WebKit, in en, zh, zh-TW, ja and de. It covers 60 answered requests followed by three more that stream start, then read, then done, with the figure dimmed and right at each step. It also covers a page opened mid-request.
- The 24 context-*, ctx-*, routing-ctx*, routing-context*, sessions-context*, group-context and i18n-* files: 800 of 806. The 6 reds are red the same way alone on origin/main 80c22eecb:
  - context-cap chromium: filed as #6514.
  - ctx-session-line, both engines: #5801.
  - routing-context-fold webkit, ResizeObserver: #5586.

Broken by hand:
- Without prev: the opened-mid-request cases are red, 10 of 22 (5 languages x 2 engines).
- Without prev and with the old series[0] key: all 20 subtests are red.
- With the old key alone, the test stays green, because prev seeds the cache again after each reset. The key is still the cause and is fixed here. prev alone would not cover a request whose prior answer is no longer listed.

Not tried: the real app with a live Codex session past 60 requests; Usage's and Sessions' cards (they pass no session or prev and behave as before); a Windows or Linux run.
2026-11-13 17:46:44 +08:00
yetone f4a73672ef routing: a ChatGPT API account is weighed by its Codex twin's reading, and its story lines wear its own logo
tmr11235 on X (v0.1.3924): a routing group of two ChatGPT accounts, each
added both as Codex and as ChatGPT API (chatgpt-api). The Codex rows read
their week and reset; the story below said "剩余额度未知,排在已知的之后"
next to the Codex logo, so it read as the Codex rows being unknown.

Two causes, both still on main:

- The story's lines were about the ChatGPT API accounts, but a line
  named only an account's name, and logoed() put the logo of the first
  member of that name in the order: the Codex twin. asides() now says
  which member each line is about (by its place, as two lines may say
  the same words), and renderSteps hands it to logoed(), as it did for
  a skipped member's line only.
- OpenAI tells a ChatGPT API account's plan usage nowhere magpie can
  ask, so Smart weighed it as unknown and put it after every known
  account, though it spends the same plan as its Codex twin.
  Allowances("chatgpt-api") now gives such an account the Codex
  account's allowance (samePlanAllowances), matched as
  SamePlanAccounts matches them: both tokens' chatgpt_account_id and
  chatgpt_user_id, never the name, so two Team seats of one email stay
  apart. One with no Codex twin stays unknown. The Routing card reads
  the same figure, as it reads the gateway's.

What was run (GUI on the Linux box through wsl-run, mote over its load
then; Go on mote):
- go test ./internal/provider -run 'TestChatGPTAPIAllowanceIsTheSameAccountsCodexReading|TestRenewedAccountForgetsItsAllowance|SamePlan': ok
- node --test routing-twin-logo (new; chromium and webkit; en, zh,
  zh-TW, ja, de; 1100 and 420): 20 of 20 ok.
- Every GUI file that opens the Routing page (199) plus i18n-keys and
  i18n-en-no-cjk: 3533 ok, 61 red in 13 files (click-scroll,
  ctx-head-narrow, ctx-route-align, ctx-session-line,
  inner-scroll-contain, mobile-web, routing-ctx-sessions,
  routing-many-keys, routing-pin-away, routing-pulse-composited,
  routing-row-swap, routing-sky-under, routing-story-shrinks). The same
  13 files at origin/main daaa11cb5 on the same Linux box: 57 red in
  the same tests; on mote the 13 files give 23 red at both
  origin/main and this change, test for test (ctx-session-line,
  mobile-web, routing-pin-away, routing-row-swap,
  routing-story-shrinks).
- go vet ./internal/provider ./internal/gateway (darwin), GOOS=linux
  and GOOS=windows go vet ./internal/provider: ok; gofmt -l: none.

Broken by hand:
- samePlanAllowances not applied: the new provider test is red ("the
  chatgpt-api account reads [] (known false)").
- asides' member dropped (about[i] -> undefined): routing-twin-logo is
  red in all 20 cases, the unknown lines lead with codex-color.

Not tried: a real ChatGPT API + Codex pair in a sandbox HOME (the
match is SamePlanAccounts', run for real since 2df5d40ee); the full
suite before the push (started after it).
2026-11-13 17:36:40 +08:00
yetone 5d54a990d4 usage: switched-off providers' accounts can be checked in, and Check in all (wxkwxk666 on X)
wxkwxk666 asked for two things on the Usage page. First, a provider
switched off should still show its accounts, at the bottom and folded,
so they can still be checked in each day. Second, one button should check
in every account at once.

- provider.OffCheckins (off_checkins.go) lists every account a
  checkiner reaches whose provider is switched off (Off, not Hidden).
  Each is a card with no windows. Nothing is read or asked for it. Its
  check-in result is matched by its own key, not by its name, since two
  sign-ins can share a name (plugins#254).
  GET /api/usage/checkins/off serves the list.
- The Usage page (plugins/usage) adds a "Switched off · n" line after
  the cards and the hidden line. It is folded until clicked. Each
  account shows today's check-in, and a Check in button when it isn't
  checked in yet. The button uses checkinnow.js's ciNowSend, which
  POSTs /api/usage/checkin-account.
- Check in all, at the head of the allowances, presses every account
  not checked in today, from the cards and from the switched-off line.
  It sends one checkin-account request per account, three at a time,
  shows "Checking in i/n…", then gives the counts (checkinPressSaid).
  When no account is due, it says so and sends nothing.
- Nothing switches a provider back on. The new strings are in zh,
  zh-TW, ja and de. Plugin files only: app.js is unchanged.
- docs/subsystems/provider-plugins.md says all of this.

Run, on mote:
- TestOffCheckinsListsSwitchedOffAccounts, in the fakeco plugin
  sandbox:
  - nothing is listed before the switch-off;
  - after it, two cards with distinct keys;
  - a press on one checks in exactly that account;
  - the provider stays off;
  - only the pressed card carries a result;
  - nothing is listed once the provider is switched on.
- go test ./internal/provider ./internal/gui, at this commit on
  origin/main 0fda3a1c1: gui ok; provider ok but for
  TestHostBuildsNoList, red on main already (#6479)
- gofmt
- go vet for darwin, linux (-tags nogui, ./...) and windows
- usage-checkin-all.test.cjs, in Chromium and WebKit, at 900 and
  420px, in en, zh, zh-TW, ja and de (20 of 20). It covers:
  - the line is folded, at the end, with its count;
  - opening it doesn't scroll;
  - a row's own press asks for that account only;
  - Check in all shows 0/2 while held, presses only the two due
    accounts, and POSTs nothing else (no provider switched on);
  - a second press asks nothing and says every account is in.
- 187 GUI files (the Usage page, panel, tray, settings and their
  neighbours), at the rebased head on mote: 3080 cases, 104 red in 16
  files. Those 16 run again on mote at origin/main 5a2d0ff47 and at
  this commit, under the same load: the same 12 files are red on both
  (checkin-now-account #6029, codex-auto-reset #4790, key-balance-card
  #6414, menu-scroll #5982, mobile-web #3952, old-webkit #6030,
  quota-refresh-order #6180, tray-cell-click #5215, usage-cards-hide
  #6294, usage-fold #4790, usage-hidden-way-back #6295,
  usage-range-times #6499, filed now). account-eye, i18n-keys,
  last-page and quota-warm pass on both in that rerun.
- That wide run found account-alias and account-eye red on an earlier
  draft: a fixture answering {} for the new endpoint made the page
  spread a non-array. The page now takes only an array.

Broken by hand:
- Without checkinAll's not-due skip, all 20 GUI cases go red.
- Without OffCheckins' check-in result (q.Checkin), the Go test goes
  red at off_checkins_test.go:56.
- Matching results by name (WithCheckins), as an earlier draft did,
  also went red.

Not tried: checking in a real switched-off vendor account through the
real app. The press is the existing CheckInAccount path, the same one
Settings' per-account Check in now already uses.
2026-11-13 16:56:19 +08:00
yetone a95a7a1cd8 providers: each API key can bill at a price rate of its own (tnt12231 on X)
A relay sells keys in groups that bill at different rates against the
official price (0.5x on one, 1.2x on another) under one endpoint, and
magpie had only the provider's price rate. Now a key can have its own:

- provider.KeyPriceRates, keyed by key id like KeySpendCaps: cloned,
  normalized on save, carried when a key is replaced. A key without one
  bills at the provider's PriceRate. A price the user set for a model
  stands as set, as it does under the provider's rate.
- Usage prices each call at its key's rate (usage.Pricer memoizes per
  key id, BaseKeyPriceIn), so the Usage page, a key's spend cap and its
  typed balance follow it. PriceAt, used to route by price, takes the
  rate of the key the provider holds.
- GUI: the provider editor's Advanced has "Price rate per key" under
  Price rate, shown only with two or more keys, folded past 8 keys like
  the per-key proxies. An empty line shows the provider's rate as its
  placeholder. Save sends keyPriceRates ({} clears, left out keeps).
  The lines, the check and the placeholder live in keyrates.js,
  imported when a provider with two or more keys opens. The core's
  budget goes up 397 for what is left in app.js (the import, the
  draft's copy, Advanced opening for it, the save's line, proxyLines
  drawing another kind of line); app.js stays under its own.
- CLI: magpie provider key-rate <id> [key [rate|default]].
- docs/subsystems/providers-accounts.md: a Key price rates row.

Run, at this head (rebased on 287a1ffa2) through mote-run:
- go test ./internal/usage ./internal/cli ./internal/gui: ok.
  ./internal/provider: ok but TestHostBuildsNoList, red the same on
  origin/main 51b98b1a8 (3 of 3), filed as #6479 (likely 16b8c300f).
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build: ok.
- GUI: key-price-rate.test.cjs (chromium and webkit x en, zh, zh-TW,
  ja, de: own rates saved, provider rate as placeholder, bad values
  refused, comma decimals, {} on clear, a folded key keeps its rate,
  one key shows no lines and posts none), i18n-keys and
  provider-many-keys-proxy (it shares proxyLines): ok. old-webkit:
  keyrates.js added to its on-demand list; its two reds (compat.js
  first, Safari 15.0 styles) fail the same on origin/main 51b98b1a8
  (#5919 and the on-demand list's #6467 family).
- Earlier, at 92bce5c72: the GUI files that reach the provider editor
  (134 tests). The 6 provider-many-keys reds fail the same on that base
  (#6209); proxy-login-fields' chromium zh timeout passes 12/12 alone on
  base and branch (#6374).

Broken by hand: atKeyRate leaving PriceRate as the provider's made
TestKeyPriceRatePrices and TestPricerKeyPriceRates red; the save not
sending keyPriceRates made 20 of 30 key-price-rate GUI tests red, and
keyrates.js dropping each parsed rate made them red again after the
move.

Not tried: a real relay with several keys at different rates; the real
Linux WebKitGTK app. The budget estimate and the Sessions page's costs
still use the provider's rate.
2026-11-13 16:31:24 +08:00
yetone 287a1ffa26 gui: Hermes's other profiles are picked on the one Hermes row again (Norethcy on X)
Norethcy on X, v0.1.4022: "Hermes 其他 profile 的配置消失了,只有默认的
Hermes Agent". 1d60b165c (v0.1.3743) took the connected row's Other profiles
lines out because each profile had a row of its own (hermes#<name>, from
7050da0a4, Norethcy). c96f33d65 (v0.1.3912, geekbb on X) then took those rows
out of the Agents list (Agent.Nested) to keep Hermes one entry, but left the
section out, so from v0.1.3912 a profile's model could be picked nowhere and
the profiles looked gone. The profile:<name> fields were in /api/state all
along (hermesProfileFields, TestHermesProfileModels), the Library still gives
each profile its skills and MCP servers (hermes#<name> through agent.All),
and nothing in any profile's config.yaml was touched.

The opened Hermes row has its Other profiles section again: one line per
profile, its name (a Chinese one as its name), its model picker (the app's
model picker, Default noted as putting back what it had before magpie) and
`hermes -p <id>`. Hermes stays one row, as geekbb asked. The picker note's
hermes# branch is gone: no hermes# row is drawn since c96f33d65.
The "Other profiles" key is back in zh, zh-TW, ja and de.
docs/subsystems/agent-wiring.md says so.

Core script budget +225 (TestCoreScriptBudget): the section was in the core
before 1d60b165c took it out; the Agents rows draw it, so there is no lazy
page to move it to, and it is packed to the shortest form.

Run on mote (the GUI files at the tree before the rebase onto
origin/main 51b98b1a8; at the pushed head again where named):
- hermes-profiles.test.cjs (restored from before 1d60b165c, plus a profile
  named in Chinese whose hint is its id): chromium + webkit, en/zh/zh-TW/ja/
  de, 1100 and 560px, 20 of 20 green.
- Broken by hand: origin/main's app.js with this test: 20 of 20 red.
- go test ./internal/gui at the pushed head: ok (TestCoreScriptBudget was
  red before the pack and the raise). hermes-profiles, hermes-profile-row
  and i18n-keys at the pushed head: green. go test ./internal/agent -run Hermes: ok.
- GUI files hermes-*, agent-*, i18n-*, click-scroll in both engines
  (64 files, 1082 cases): 1027 pass, 55 red, all in agent-details-ready
  (#6373, #6369), agent-switch-accounts (#5925) and agent-menu-label
  (#6371); the same 55 are red on origin/main 51b98b1a8 run alone.
Not tried: a real Hermes install with several profiles in the real app;
Linux WebKitGTK; Windows. No Go code changed outside the budget constant.
2026-11-13 16:22:51 +08:00
yetone 5a2d0ff478 claude-desktop: Use Claude Magpie, a twin on magpie in one click (xMopf7RF on X)
xMopf7RF asked for the Separate app to be reached like a phone's app
twin: one button that makes a second Claude Desktop on magpie and leaves
their own Claude Desktop as it is. Claude Desktop's row, while it isn't
on magpie and Desktop can run so (macOS), now has "Use Claude Magpie":
it turns the Separate app on (settings/desktop-isolated) and then
connects Desktop, so only Claude-Magpie-3p is wired, and says to open
Claude Magpie from Applications. The order matters: connecting first
would wire the user's own Desktop.

The button is drawn by claudemagpie.js with the fold; app.js keeps the
one line that places it, so the core budget goes up by 81.

Run, at this commit:
- TestCoreScriptBudget; gofmt clean.
- GUI on mote, Chromium and WebKit: desktop-twin (five languages, 1100
  and 640px: the posts in order, the status, the button gone after, no
  scroll, no native select; no button without the Separate app),
  desktop-isolated-claude, desktop-isolated, i18n-keys, i18n-en-no-cjk,
  old-webkit (its two reds are on origin/main, #6467, #5919), and every
  agent*/desktop*/claude* GUI file; its reds are all on origin/main
  (#6467, #5919, #6373, #5925, #6179, #6371, #6475).

Broken by hand: connecting before turning the Separate app on turns
desktop-twin red (the post order).

Not tried: clicking the button in a real Desktop; the two calls it makes
are the ones the commit before ran for real (launcher add, then claude-
desktop magpie, in a sandbox HOME on mote).
2026-11-13 16:02:12 +08:00
yetone 6bc0d1e203 claude-desktop: Claude Magpie's Code tab on a Claude Code folder of its own (#6459)
The Separate app (Claude Magpie.app, #5671) kept its own Desktop
userData, but its Code tab's bundled Claude Code still read and wrote
the user's ~/.claude: their CLAUDE.md, skills, plugins and history went
into the twin, and the twin's sessions into theirs (xMopf7RF on X).

An opt-in, macOS-only switch under the Separate app's Advanced fold
(settings.DesktopIsolatedClaude, POST /api/settings/desktop-isolated-
claude, `magpie claude-desktop launcher claude-dir on|off`) gives it
~/.claude-magpie-desktop:

- desktopiso.Script exports CLAUDE_CONFIG_DIR in the app's launch
  script; turning the option on or off remakes the app, and the hint
  says to quit and reopen Claude Magpie, since a running one keeps its
  environment.
- desktopOn writes Desktop's model windows, caps and explore entries
  into that folder's settings.json instead of ~/.claude's while it is on
  (desktopCodeDir, desktopClaudeSync); off moves them back. The folder
  is kept when it is turned off, and shows as the claude# row "Claude
  Code · Claude Magpie".
- The fold is drawn by claudemagpie.js, imported the first time it
  shows; what stays in app.js is the import (isoLazy) and the fold's
  place, 216 bytes, so the core budget goes up by 180 (the 36 of room
  there was taken first).

Run:
- gofmt -l clean; go vet ./internal/... on darwin, GOOS=windows and
  GOOS=linux -tags nogui vet of agent, cli, desktopiso, gui, settings,
  settingsapi (mote).
- go test agent, cli, desktopiso, desktopdir, settings, settingsapi,
  gui, library on mote: all ok except cli's three healthcheck/update
  tests, which ask the gateway mote's own magpie serves on :3425
  (#6223, the same with or without this change).
- TestCoreScriptBudget and TestSettingsSaveKeepsWhatItDoesNotSend at
  this commit and the next.
- GUI on mote, Chromium and WebKit: desktop-isolated-claude (five
  languages, 1100 and 640px), desktop-isolated, i18n-keys,
  i18n-en-no-cjk, old-webkit, and every agent*/desktop*/claude* file
  (98 files, 1,595 of 1,662 pass). Every red is the same on origin/main
  92bce5c72 run alone: old-webkit (#6467, #5919), agent-details-ready
  (#6373), agent-switch-accounts (#5925), claude-quota-onboarding
  (#6179), agent-menu-label (#6371), desktop-tiers Chromium (#6475).
- A real Claude Desktop on mote in a sandbox HOME (~/sb6459, removed
  after): `claude-desktop magpie`, `launcher add`, `launcher claude-dir
  on`. The window and caps moved into .claude-magpie-desktop/
  settings.json, ~/.claude kept only its theme, the script exported
  CLAUDE_CONFIG_DIR, and the launched Desktop's main process and
  children had it in their environment. `claude-dir off` moved them
  back and dropped the export; `launcher remove` removed the app.
  mote's real ~/.claude was listed before and after: unchanged.

Broken by hand:
- desktopOn without the clone-folder branch: TestClaudeDesktopIsolated
  ClaudeDir red (the window stays in ~/.claude).
- The fold without its ontoggle: desktop-isolated-claude red ("shut by
  the redraw").
- settingsapi not keeping the field: TestSettingsSaveKeepsWhatItDoes
  NotSend red.

Not tried: a Code-tab session driven in the real Desktop's UI, so
bundled Claude Code writing into the folder was not seen in this run
(an earlier look at #6459 saw it). Library has no targets for the
clone's folder yet (#6469). The whole GUI suite (1,484 files) was not
run; the files on the Agents page and every i18n file were.
2026-11-13 16:02:12 +08:00
yetone daaa11cb53 update: the clock's check leaves a waiting download alone (iiiiiimone on X)
"With magpie my proxy's traffic is far higher than usual." An idle
`magpie web` (a released v0.1.4000 build, sandbox HOME, no accounts, every
request through a counting proxy, 25 minutes in WSL) sent 89.4 MB: 88.6 MB
of it the update download from usemagpie.ai, 0.7 MB models.dev's catalog
(daily), ~80 KB the update feed and notes. Nothing else.

The download is the waste. With a version downloaded and waiting for a
restart, every check by the clock (every 6 hours by default, 30 minutes
at the shortest) found a newer one, as magpie releases 100 to 160 times a
day, and downloaded it whole (37 to 95 MB by platform) in place of the
one waiting: up to ~380 MB a day by default on Windows and ~4.5 GB at 30
minutes, for an app left running, all over the user's proxy.

Now the clock's check keeps the version waiting, as Settings'
NoAutoDownload already did. Nothing is lost: every restart into it asks
the feed first (recheck, the autorestart's waitRecheck) and fetches the
newest then, quitting puts in the one waiting, and a check asked for
(Settings' Check, Download update) still downloads the newest. With
nothing waiting the clock's check downloads as before.

Run:
- TestUpdateClockLeavesWaitingDownload (new): three clock checks with
  newer versions out keep 0.1.11 and one download; recheck and a check
  asked for each fetch the newest.
- go test ./internal/gui (nogui, CGO off) in WSL magpie-desktop at
  b883bd44e (rebased on 92bce5c72): ok.
- go test -run TestUpdate ./internal/gui on Windows (xiaomi-gpu): all
  pass but TestUpdateThatWontStart, which is red the same at origin/main
  5a48a4251 and is #6059.
- Broken by hand: without `|| u.byClock` the new test is red ("0.1.12
  out: ... Latest:0.1.12 ..., 2 downloads").

Not tried: the macOS run (mote was over its load the whole time, mica's
disk is full); the full suite follows on mote. Traffic of a signed-in
magpie (usage reads per account) was not measured: the sandbox had no
accounts.
2026-11-13 16:01:55 +08:00
yetone db9a5ec7c4 gateway: Claude Code's advisor runs in magpie for a model whose upstream can't (Awad_Yoo on X)
Claude Code 2.1.316 sends its advisor (/advisor, settings.json's
advisorModel) for any model when CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL
is set: an advisor_20260301 server tool, which only Anthropic's server
runs. Until now magpie left it out for every other upstream (b6fae8efd).

Now, when the advisor model is one magpie serves and the upstream can't
run it (not a Claude model on Anthropic's API with a same-provider Claude
advisor, which keeps the native passthrough), magpie runs it:
- the model is offered an "advisor" function tool with no parameters;
- a call is answered by asking the advisor model, through magpie's own
  routing, with the conversation so far and a short ask after it (up to 3
  calls a reply, then max_uses_exceeded, as Anthropic answers);
- the client gets the server_tool_use and advisor_tool_result blocks
  Anthropic writes (advisor_tool_result_error with its error_code on a
  failure), and the history Claude Code echoes back is read as a call and
  its result.
Claude Code's system prompt, identity text and its own advisor
instructions go upstream as it wrote them; nothing about the advisor is
added to the prompt beside the tool's neutral description.

Claude Code's agent row gets an Advisor line under Tiers, after Auto
mode, default Off: picking a model writes advisorModel and the env switch
(only when the user hasn't set it themselves); Off removes both, and so
does disconnecting. CLI: magpie claude advisor <model|default>.

Run (on the Linux box, xiaomi-gpu magpie-desktop, at this head; mote was
over its load the whole time and mica's disk is full):
- go vet ./internal/gateway ./internal/agent, and with GOOS
  linux/windows/darwin (CGO_ENABLED=0); gofmt -l clean
- go test ./internal/gateway -run 'Advisor|Advised|Search|Anthropic': ok
- go test ./internal/agent -run Claude: ok
- node --test claude-advisor, claude-auto-mode, i18n-keys,
  i18n-en-no-cjk (Chromium + WebKit, en and zh, 1100 and 560px): 24/24
- TestCoreScriptBudget measured by its own rule: app.js 1,084,341 of
  1,086,267, core 1,267,726 of 1,267,762 (no raise)
- Real Claude Code 2.1.316 in a sandbox HOME/CLAUDE_CONFIG_DIR against a
  sandbox `magpie serve` (darwin nogui build of this tree) with only the
  DeepSeek provider: `magpie claude advisor deepseek/deepseek-v4-pro`
  wrote advisorModel + the env; `claude -p --model deepseek/deepseek-flash`
  asked to consult the advisor got text, server_tool_use (srvtoolu_…),
  advisor_tool_result with deepseek-v4-pro's advice (usage row: v4-pro
  11,205 in / 221 out), then its answer quoting it. A --resume turn sent
  that history back and completed.

Broken by hand:
- advisedHere returning false: TestAdvisorServedForAVendorModel,
  TestAdvisorHistoryGoesBackAsACall, TestAdvisorFailureIsAnErrorCode,
  TestAdvisedHere and TestAdvisorModelAsTheUpstreamNamesIt red.
- the env write left out of the advisor field's Set:
  TestClaudeAdvisorModel red.

Not tried: the interactive TUI's /advisor picker (only -p and the
settings.json route); an advisor on a Chat-only or Responses upstream
with a real account (the fake upstream in the tests is Chat); an advisor
call in the same round as a client tool call, which is dropped as a
search call is. Seen on the way, not changed: in the fresh sandbox,
Claude Code's own "sonnet[1m]" default resolved to sonnet-4-5-20250929
rather than ANTHROPIC_DEFAULT_SONNET_MODEL without --model.
2026-11-13 15:31:06 +08:00
yetone 507d612340 mcpauth: an MCP server's sign-in page is opened only when it is a web page
A sign-in to an MCP server opens the authorization_endpoint its metadata
names, and the GUI handed that URL to the system (open / xdg-open /
rundll32 url.dll,FileProtocolHandler) without looking at its scheme. A
server the user added in the Library could name file:///…/Some.app, a
file://\\host\share\x.exe UNC path, smb:// or an app's scheme, and
pressing Sign in would launch, mount or hand off what the server chose.
/api/open already kept to http(s); this path skipped it.

- mcpauth.WebURL: http or https with a host. start refuses any other
  authorization endpoint before a flow (and its callback listener) exists.
- gui.openMCPSignIn checks it again before OpenURL, so a State that
  didn't come through start is still not opened.

Test: TestAuthorizeEndpointIsAWebPage (file:, UNC file:, smb:, vscode:,
javascript:, https with no host) — red with the check turned off by hand
(the sign-in started at file:///System/Applications/Calculator.app?…),
green with it.

Run (mote; mica's disk is full, mote at load ~33, small run only):
go test -count=1 ./internal/mcpauth/... ok; go test -run
'MCP|SignIn|Library' ./internal/gui ok; go vet darwin ./internal/mcpauth
./internal/gui, GOOS=windows, GOOS=linux -tags nogui ok; gofmt -l clean.
Not run: the full suite.
2026-11-13 15:22:32 +08:00
yetone f3ad175fb2 library: an MCP server's sign-in keeps to its link when Settings say so (hkxhkxhkx on X)
hkxhkxhkx asked for magpie never to open OAuth pages in the browser on
its own. Settings › Privacy › Sign-in pages › "Open sign-in pages in the
browser" (signInLinkOnly, since a45a0f1c5) already does that for every
account's sign-in, built-in and plugin, in the window, a web tab and the
command line (`magpie accounts add`, a plugin's login; `magpie settings
set signInLinkOnly true` sets it there). Audit of every route that opens a
sign-in page: the one it missed is an MCP server's OAuth sign-in from the
Library, which /api/library/mcp-signin opened in the default browser
whatever the setting. The TUI starts no sign-in; `magpie web` opens
magpie's own page (it has --no-open), not a vendor's.

Now /api/library/mcp-signin goes through openMCPSignIn: with the setting
on it opens nothing and answers linkOnly. The Library opens no tab of its
own on linkOnly (web), opens the server's editor from a row's sign-in, and
shows the same words as an account's link-only sign-in, the link with Copy,
and Open in browser. No new strings.

Still opened whatever the setting: a plugin whose own sign-in opens the
page or a Chrome window (Grok Build's CLI on macOS and Windows; agnes,
inkstone, astudio, mclaw, sensenova drive Chrome to sign in).

Run (Linux, magpie-desktop via wsl-run; mote was over its load the whole
time with eight full suites queued, mica's disk full):
- TestMCPSignInLinkOnlyOpensNothing (new), TestSignInLinkOnlyOpensNothing,
  TestMCPSignInSaysTheBrowserDidntOpen, TestOpenSignInLinkOnlyAsked,
  TestCoreScriptBudget, TestI18n* (-tags nogui): ok.
- mcp-signin-link-only.test.cjs (new; en, zh, zh-TW, ja, de; desktop and
  web; 1100 and 420px; Chromium and WebKit) with signin-browser-down,
  mcp-signin, mcp-signin-click, mcp-accounts, signin-link-only and
  i18n-keys: 146/146.
Broken by hand: the route back on openError, the new Go test red ("its
page was opened 1 times"); client.js back to main's, the new GUI test red
(no link-only note).
Not tried: a real MCP server's sign-in in the app; the whole GUI suite;
the full Go suite before the push (started after it).
2026-11-13 15:13:13 +08:00
yetone d06d2383a4 gui: connect addresses' save and the typed certificate move into tlscerts.js, within the core script budget (quantum_lsfc on X)
The Connect to row put TestCoreScriptBudget 180 bytes over (1265892 >
1265712). The typed-certificate copy in asTyped and the resolve line in
Save now live in tlscerts.js, which the editor imports, so the core
carries no new code. A save before tlscerts.js has loaded sends no
resolve, and the server keeps what was saved (a left-out resolve keeps
it), as it already did for the server pin.

Run on mote at the head rebased on origin/main b942a872b: go test
-count=1 -timeout 45m ./internal/netproxy ./internal/provider
./internal/gateway ./internal/gui, all ok; gofmt -l clean; go vet ./...
for darwin, linux (-tags nogui) and windows ok; provider-resolve.test.cjs
(chromium and webkit; en zh zh-TW ja de; 1100 and 420) 60 of 60 ok.
Rebased again on origin/main dea131174 and run on mote:
netproxy, provider and gui (TestCoreScriptBudget) ok, gofmt and the
three vets ok, provider-resolve 60 of 60 and i18n-keys ok; internal/gateway was
not run again at that head (no new main commit touches the offline
check or the dial).
The 94 GUI files the editor's Save, Test and certificate rows reach,
run at origin/main 436d507f0: 88 reds in 15 files, the same tests red
on that main run alone (filed: #6424, and #6010 #6156 #5838 #4621
#4391 #5147 #6030 #6209 #4397 #4673 #6099).
Not tried: a real managed network with an L4 SNI gateway (the
reporter's), and the rule's dial on Windows or Linux beyond go vet.
2026-11-13 14:30:19 +08:00
yetone 40d0ab62ce gui: Advanced › Connect to, a provider's connect addresses (quantum_lsfc on X)
A provider of the user's own has a "Connect to" box under Advanced, one
line per host: host = place, place. It is drawn by tlscerts.js, which
the editor imports, beside the certificate rows; strings in every
language.

Broken by hand: Save without the resolve line turns
provider-resolve.test.cjs's "saved as a map" and "keeps them, and
clears them" red, 40 of 60, in both engines.

Run on mote at the head rebased on origin/main b942a872b: go test
-count=1 -timeout 45m ./internal/netproxy ./internal/provider
./internal/gateway ./internal/gui, all ok; gofmt -l clean; go vet ./...
for darwin, linux (-tags nogui) and windows ok; provider-resolve.test.cjs
(chromium and webkit; en zh zh-TW ja de; 1100 and 420) 60 of 60 ok.
Rebased again on origin/main dea131174 and run on mote:
netproxy, provider and gui (TestCoreScriptBudget) ok, gofmt and the
three vets ok, provider-resolve 60 of 60 and i18n-keys ok; internal/gateway was
not run again at that head (no new main commit touches the offline
check or the dial).
The 94 GUI files the editor's Save, Test and certificate rows reach,
run at origin/main 436d507f0: 88 reds in 15 files, the same tests red
on that main run alone (filed: #6424, and #6010 #6156 #5838 #4621
#4391 #5147 #6030 #6209 #4397 #4673 #6099).
Not tried: a real managed network with an L4 SNI gateway (the
reporter's), and the rule's dial on Windows or Linux beyond go vet.
2026-11-13 14:30:19 +08:00
yetone 4b93d391ca gui: the provider editor's connect addresses are saved and shown (quantum_lsfc on X)
/api/providers carries resolve and takesResolve; Save, Test, Fetch
models and peekcert take resolve (left out keeps what was saved, {}
clears it); provider.Save refuses a rule CheckResolve refuses or one on a
provider that takes none (TestResolveSaved, TestProviderSaveResolve).

Run on mote at the head rebased on origin/main b942a872b: go test
-count=1 -timeout 45m ./internal/netproxy ./internal/provider
./internal/gateway ./internal/gui, all ok; gofmt -l clean; go vet ./...
for darwin, linux (-tags nogui) and windows ok; provider-resolve.test.cjs
(chromium and webkit; en zh zh-TW ja de; 1100 and 420) 60 of 60 ok.
Rebased again on origin/main dea131174 and run on mote:
netproxy, provider and gui (TestCoreScriptBudget) ok, gofmt and the
three vets ok, provider-resolve 60 of 60 and i18n-keys ok; internal/gateway was
not run again at that head (no new main commit touches the offline
check or the dial).
The 94 GUI files the editor's Save, Test and certificate rows reach,
run at origin/main 436d507f0: 88 reds in 15 files, the same tests red
on that main run alone (filed: #6424, and #6010 #6156 #5838 #4621
#4391 #5147 #6030 #6209 #4397 #4673 #6099).
Not tried: a real managed network with an L4 SNI gateway (the
reporter's), and the rule's dial on Windows or Linux beyond go vet.
2026-11-13 14:30:19 +08:00
yetone d370bef982 usage: Failed lists the requests a fallback answered, as Routing shows their tries failed (maohy915 on X)
maohy915 runs magpie on a NAS and uses it from another computer's magpie
through Remote magpie. The NAS's Routing page showed failed calls, but
Usage → Requests → Failed found none. Reproduced with two sandbox
instances on mote (B → remote-magpie → A, where A's provider `bad`
answers 429 and falls back to `good`). A's trace had 2 requests and 1
rerouted. Usage had 2 rows, Failed had 0 and Retried had 1. A try that
fails and is handed on writes no row when nothing is billed, and its
request's row is an answer on the second try. Failed kept only
LostRequest, the requests whose agent got the error, so the failed try
was nowhere under Failed. Plain failures, remote or not, were already
listed; only rerouted ones were missing.

Failed now keeps every request a try failed on (Record.FailedTry): the
requests the agent got an error for, the tries handed on, and the
requests a later try answered. Retried still keeps only the answered
ones. The counts are unchanged: each request is counted once, by how it
ended (小一's rule), so a Failed list reads "1 failed · 2 answered on a
retry". The Failed option and the card's "N failed" button now say so in
their tooltip, in every language. Filtered page cells are cached on disk
under the filter, so settledCountVersion goes to 4; the first start after
the upgrade pairs the history again once.

Run (mote):
- go test ./internal/usage ./internal/usageapi ./internal/gui: ok.
- New test TestFailedKeepsRequestsAFallbackAnswered; updated
  TestRequestsCountedOnceWithTheirRetries.
- GUI, both engines: ledger-retried (5 languages, 420/1100), i18n-keys,
  i18n-en-no-cjk, usage-ledger, api-key-usage, purpose-filter,
  usage-ledger-content, usage-phone-head, usage-loops, usage-request-page.
  All pass except known reds: i18n-keys "a plugin's words are its own"
  (#6422/#6423) and usage-ledger "newest live route needs no
  return-to-live button" (#4078/#3104/#4626).
- gofmt; go vet for darwin, linux -tags nogui, and windows.
- Real repro with a binary built from this tree: A's Failed went from 0
  rows to the rerouted request, both in the API and in the real page
  (Chromium).

Broken by hand:
- Filter back to LostRequest: both Go tests red.
- The Failed option's title dropped: ledger-retried red.

Not tried:
- Restoring settledCountVersion to 3 doesn't turn
  TestSettledCountedAsVersioned red: it counts only Filter{}. The bump is
  by reading.
- Not tried on a real NAS or in the desktop app's remote window; the
  page is the NAS's own web page.
2026-11-13 14:17:49 +08:00
yetone 93906ba755 gui: a second launch on Windows hands over at once, not after 30s (shangyuan0818 on X)
On Windows, opening magpie from the Start menu while it already ran took
over 10s to show the window, longer than a cold start. fb6b4de0a made
every start wait, up to 30s, for the WebView2 profile folder's lockfile
before the app is made. A second launch hands over to the running magpie
only as the app is made (Wails' single instance, in application.New), and
the running magpie's WebView2 holds that folder for as long as it runs,
so every second launch waited the whole 30s, then handed over.

Now the wait is skipped when Wails' single instance mutex for this config
(wails-app-<id>-sim) is held: a magpie runs, and the launch goes straight
on to hand over. A restart after an update or a failed WebView2 start
still waits: the magpie before has ended by then (AwaitPredecessor), so
the mutex is free and only its msedgewebview2 can still hold the folder.

Run:
- Reproduced on xiaomi-gpu (Windows 11) with builds of 406ad72f1 and of
  this commit, sandbox USERPROFILE/APPDATA/LOCALAPPDATA, MAGPIE_ADDR
  :3461, HKCU magpie/ccswitch/App Paths/Uninstall keys exported and put
  back. ssh has no desktop (the real app crashes in uxtheme there, and no
  one was signed in for an interactive task), so a stand-in held what a
  running magpie holds: the single instance mutex for the sandbox's
  config and EBWebView\lockfile without sharing. Launching magpie.exe
  with no arguments, as the Start menu does, three times each: before,
  the launch quit after 30240, 30232, 30234 ms ("still held by another
  process after 30s"); after, 189, 161, 166 ms. That Wails took the
  launch for a second one also shows the mutex name matches Wails'.
- TestWebView2ReadyDoesNotWaitOnTheRunningMagpie (Windows): red with the
  held check turned off by hand (waited 20.06s), green with it.
- go test -count=1 ./internal/gui on mote: ok (150s). On xiaomi-gpu: 9
  reds, the same 9 at origin/main 633ab58e9 and all filed (#6068, #5324,
  #5928, #6059).
- gofmt -l; go vet ./internal/gui on darwin, windows, linux -tags nogui
  and windows -tags nogui (on mote: mica is out of disk).
Not tried: the real tray app with a desktop session and a Start menu
click, for the reason above.
2026-11-13 14:01:50 +08:00
yetone 633ab58e9b gui: every page says it draws a dark theme, so browsers don't repaint it (xjp on X)
Chrome's Auto Dark Theme and Safari's Adaptive Dark Mode (Safari 27.3
beta) repaint pages that don't declare dark support. magpie's GUI draws
both themes itself but never said so, so a browser's light magpie was
repainted. WebKit's post (webkit.org/blog/18541) and Chrome's
(developer.chrome.com/blog/auto-dark-theme) say: `color-scheme: light
dark` (CSS on :root or the meta) is skipped; `light only` opts an element
out (Safari 27.3 beta 1 doesn't honour `only` yet).

- index.html: <meta name="color-scheme" content="light dark">.
- app.css: :root takes `light dark` always (the signal browsers read);
  body takes the theme shown: Settings' Light is `light only`, Dark is
  `dark`, System follows the root. Native controls, scrollbars and a
  plugin's frame follow the theme shown.
- pagebridge.js: a plugin page's light frame is `light only`.
- The other pages magpie serves (magpie web's sign-in, a sign-in's end
  page, an MCP sign-in's end page, a plugin service's "starting" page)
  declare `light dark`; the MCP page drops its fixed #222 text so it
  reads on a dark canvas. keypage.html and the extension popup already
  did; site/ pages already do.

Tests: color-scheme.test.cjs (chromium + webkit; system/light/dark on a
dark OS: meta, root and body schemes), TestPagesDeclareBothColorSchemes,
TestSignInPageDeclaresBothColorSchemes, TestPageDeclaresBothColorSchemes.

Run (mote, before the rebase on origin/main 6bcdc6468): the new GUI
file 6/6 in chromium + webkit; checkbox-look 8/8, plugin-page,
plugin-panels and plugin-page-idle 14/14; go test of the new tests and
-run "PluginPage|Page|Bridge|SignIn" in internal/gui, internal/provider,
internal/mcpauth ok; go vet darwin, linux (nogui), windows ok; gofmt
clean. api-key-theme is red 6/6 here and on origin/main 2f2a0afa5 alone
(#6444, a #lanList selector matches nothing).

At the pushed head (after the rebase): color-scheme.test.cjs 6/6 and
-run "ColorScheme|Budget" in the three packages ok.

Broken by hand: the four new tests on origin/main's code (2f2a0afa5)
are all red (GUI 0/6, three Go tests FAIL).

Not tried: Safari 27.3 beta's Adaptive Dark Mode and Chrome's Auto Dark
Theme themselves (no beta device here); the real app's windows (Wails
WebKit, WebView2, WebKitGTK) with the root's new color-scheme; the full
GUI suite.
2026-11-13 13:58:00 +08:00
yetone a65dade2e3 gui: an accent colour of your own and a picture behind the pages (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS asked for colours beyond the three themes and for a
local picture. Settings › General gains two rows under Appearance:

- Accent color: magpie's own, six quiet presets (Blue, Teal, Green,
  Orange, Pink, Graphite) and a swatch that opens the system's colour
  picker. Saved as settings.accent (#rrggbb only, checked in saveOwn;
  `magpie settings set accent "#0d9488"` works through settingsapi.Keys).
  The server draws it (appearance.go accentVars): darkened on the light
  theme and lightened on the dark one until it reads as text at 4.5:1
  on the background and cards, with white or near-black text on it,
  whichever reads better. Never under Omarchy, whose theme is the look.
- Background image: Choose… takes a PNG, JPEG, GIF or WebP of 16 MB at
  most, sent as base64 JSON to POST /api/appearance/wallpaper, saved as
  `wallpaper` in magpie's folder (edit.WriteAtomic); settings.Wallpaper
  is its stamp. A thumbnail, Change and Remove show; Remove deletes the
  file. It is drawn behind the window's pages (never the tray panel)
  under a veil of the theme's background at 84%, so text reads as on
  the plain page; the cards stay opaque, and body's colour stays the
  theme's, which Windows' title bar tint reads.

boot.js puts the look's stylesheet in before the first paint and says
which look it drew (bootPrefs.look); applyPrefs asks /api/appearance/css
only when the settings' look differs. The rows, with the Colorblind,
Reduce motion and Loading bird rows, are drawn by appearance.js,
imported when Settings draws, so the core scripts stay under their
budgets with no raise (app.js 2,393 under, the core 503 under).
A save of Settings that doesn't send accent keeps it (Merge guard),
and the wallpaper stamp is kept by every Settings save.

fonts.test.cjs: the two new rows push the font row to the foot of its
560×620 window, where Playwright's click scrolled it in by a pixel and
the test read that as the page moving; the reader now scrolls it in
first with the wheel. settings_keep_test sets Wallpaper; the three
/api/appearance routes are named in the CLI parity test's notYet.

Run (mote, at this change on origin/main 406ad72f1; after the rebase
on fa3ee5a7e, which touched only the Library plugin and the site here,
the core budget, TestEveryRoute*, TestSettings*, TestAccent*,
TestWallpaper*, appearance-look and i18n-keys again, the same result):
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  internal/gui, settings, settingsapi: clean.
- go test -count=1 ./internal/gui/... ./internal/settings/...
  ./internal/settingsapi/... ./internal/cli/...: ok.
  (go vet ./internal/cli too.)
- GUI, chromium and webkit: appearance-look (picking a preset, the
  reader's own and back; boot.js's look not fetched again; choosing
  and removing a picture; the rows keep their height while
  appearance.js loads; en, zh, zh-TW, ja, de at 420 and 1000px: rows
  fit, words translated), fonts, settings-general, settings-sections,
  settings-groups, reduce-motion, skeleton-bird, i18n-en-no-cjk: green.
  Red the same at origin/main 7693cf263 without this change, all
  filed: api-key-theme (#6444, filed now), i18n-keys "No folder"
  (#6422), settings-search and settings-lines-wrap de 440px (#6353).

Broken by hand, each red, then restored:
- Merge guard removed: TestAccentSetting red ("a save without the
  accent changed it").
- accentInk = 1.0: TestAccentReadable red.
- applyPrefs' lookPaint call removed: appearance-look's accent and
  picture tests red in chromium.
- the thumbnail made 66px tall: the row-height test red.

Not tried: the real app on Windows, Linux or Omarchy (title bar tint
with a picture, WebKitGTK drawing the layers), the system's real colour
picker dialog (the test sets the input's value), a 16 MB picture in the
real web views, and the whole GUI suite (queued on mote's suite lock
after the tag).
2026-11-13 13:52:41 +08:00
yetone 741d502d2a library: a synced MCP server can run its own command on this computer (jinpwng on X, #6426)
jinpwng runs one MCP server on a Mac and in WSL. Each needs its own
program path, and the only ways around it were two servers with two
names or keeping the server to one computer, which loses the sync of its
agents and note (#3836).

A command server now has an optional `shared` start. When it is set,
command, args and env are this computer's, and every reader (the agents'
files, projects, the router, the check) runs them with no change of its
own. Collect carries the shared start in their place and never the field,
so the other computers get exactly what they had. Put keeps this
computer's start, and what comes in for the server becomes the shared
start, so a note, agents or the other computer's own command change still
comes in. A server that comes in as a URL, one kept to this computer,
and the editor sending no shared start each end it.

- GUI: a saved synced command server's editor has "Use another command
  on this computer" under Command. With it on, the hint names what the
  other computers run, and "Use the synced command" goes back. Nothing
  else on the page moves; a new server and a local one have no button.
- CLI: `magpie library mcp here <name> <command args…>` and
  `… here <name> off`; the listing names a server that has one.
- TUI: an edit keeps the shared start.
- Docs: docs/subsystems/library.md, site docs (en, zh, ja).

Run (mote, at the tree pushed but before the rebase):
- go test ./internal/library/... ./internal/cli/... ./internal/tui/...
  ./internal/backup/... ./internal/gui/: ok
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: clean
- GUI, chromium and webkit: mcp-server-here (new: en, zh, zh-TW, ja, de at
  1100 and 390, the payload, no button on a local server, no sideways
  scroll), library-mcp-json, library-mcp-spaced-path, library-mcp-win-line,
  market-address, mcp-home-health, mcp-startup-timeout, market-have,
  mcp-editor-cancel, mcp-local-server, i18n-en-no-cjk, i18n-keys and the
  other library MCP files: 235 of 238. The reds:
  - i18n-keys "a plugin's words are its own": the same at origin/main
    3f6b1b0c9 (#6422, #6423, memory's "No folder").
  - market-have chromium "a server added by hand is marked added": a flake,
    red 1 of 3 at origin/main 3f6b1b0c9 and 1 of 3 here (#4620).

At the rebased head (on 04776ec6c, which touched library/client.js):
go test ./internal/gui/ ./internal/cli/ ok; GUI mcp-server-here,
mcp-local-server, library-group-steady, i18n-keys: 69 of 70, the red is
i18n-keys' #6422 above.

Broken by hand:
- keepStart doing nothing: TestServerHereThroughSync red (a sync took
  this computer's own command away).
- Collect carrying the server as is: red (carried /opt and "shared").

Not tried: the CLI's here command by hand (vet only; it calls the
tested ServerHere); the real app on a Mac with a real WSL computer syncing over
WebDAV; the test does the Mac-to-WSL round trip through Collect and Put.
A backup restored into an empty library gets the synced command only,
since a backup carries what sync carries.
2026-11-13 13:42:48 +08:00
yetone 406ad72f1a gui: a gateway's provider editor keeps its warm-up and check-ins (wolfing88, magpie-community/plugins#1065)
wolfing88 runs magpie in Docker, so magpie web is in gateway mode. Their
WorkBuddy, Trae CN, 商汤小浣熊, MiniMax Code and Qoder CN plugins check in,
and Settings' search sends each "每日自动签到" to that provider's editor,
but the editor had no check-in field. bceeabd93 (11-08) moved the warm-up,
check-in and reset lists from Settings into the provider's editor and left
them out in gateway mode, only Claude Code's run list kept (bc8b01d60).
Before that move Settings showed them in gateway mode too, and they run on
the gateway's own accounts, so provPrefsField and provPrefsOf now keep them.

Run (wsl-run, magpie-desktop; mote and mica were over their load):
- plugin-checkin.test.cjs, new case "a plugin's check-in in its provider's
  editor in gateway mode", 5 languages x 2 engines: red 5/5 in chromium on
  the old app.js, green on this one; the whole file 42/42.
- one at a time: checkin-at, checkin-account, checkin-reason(-once),
  claude-tui-setting, claude-lean-prompt-setting, codex-auto-reset-settings,
  codex-reset-lead, provider-prefs(-layout), providers-reset-use,
  segs-press-redraw, settings-groups, usage-checkin, warm-now,
  warm-at-times, warm-at-own, gateway-mode, gateway-mode-sessions,
  editor-checkin-account, quota-warm: all ok.
- red the same on 1cc7b7267 without this change, already filed:
  checkin-now-account (#6029), settings-search (#6133), i18n-keys
  "a plugin's words are its own" (#6422).
- TestCoreScriptBudget at this head, rebased on 04776ec6c: ok (win-run;
  mica was out of disk).

Not tried: a real Docker image; the field is drawn from /api/settings'
checkinPlugins, which the server fills the same in gateway mode.
2026-11-13 13:37:22 +08:00
yetone 04776ec6cb providers: a plugin subscription imports accounts from a file through its own auth.import, WorkBuddy's from 0.2.32 (marchen_cc on X)
marchen_cc on X: 「从文件导入账号」 took no WorkBuddy sign-in file. The cause
was not WorkBuddy's: magpie's import reached only built-ins (Codex,
Claude, Antigravity, Factory), and a plugin had no way to say it could
read a file. This adds that for every plugin subscription:

- A plugin's auth may have import(texts, {signal}), returning sign-in
  results, with importFrom (and importFroms by language) saying which
  file to choose. The host's importFiles op keeps each one as a sign-in
  is kept (keptAs, saved under signInKey, settled), so an account
  already there comes back "updated"; it is cancellable (signInSteps)
  and takes at most 100.
- /api/signin/import and `magpie accounts import <plugin> <files>` go
  to provider.ImportPluginFiles when PluginImportable(id); the editor's
  「从文件导入账号…」 row and the import sheet show for such a plugin, in
  its own words (importSay), moved subscriptions included (subOf).
- docs/subsystems/provider-plugins.md: "Accounts from a file".
- WorkBuddy's mover min goes to 0.2.32, which reads the desktop app's
  .info sign-in or a JSON credential, and sends a cloud-hosted
  enterprise account (*.sso.copilot.tencent.com, *.copilot.qq.com,
  *.sso.codebuddy.cn, iOA apart) to its enterprise's address (emilochen
  on X), published and checked with npm view --prefer-online.
- TestCoreScriptBudget +468 for the import branch, packed to one
  statement. importSay is read as the Providers rows draw, so it has
  no lazy page; nothing else was moved out (#2710). The budget's
  arithmetic was checked over this tree: 1,267,762, at the new cap.

Run on mote (mica's disk is full; mote over its cores) at this change
on 3f6b1b0c9; ac1702c33 (the library plugin and its GUI test, no core
script) landed after, and the core budget's arithmetic was redone at
this head:
gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
internal/{gui,plugin,provider,cli}; go test -count=1 of those four:
all ok. GUI (chromium + webkit, en and zh): plugin-import,
login-import, factory-key, plugin-moved-signin, i18n-keys: 23 pass, 1 fail: i18n-keys "a plugin's words are its own",
memory_mcp.go's "No folder", red on main since 72facf72e (#6422).
Plugins repo: workbuddy import.test.mjs 6 of 6, bun scripts/check.mjs
ok, root bun test 8534 pass / 1 fail (agy-cli smoke under load, green on a rerun: 8535 pass, 0 fail;
unrelated, plugins #1070).

Broken by hand: without the host's importFiles handler,
TestPluginImportFiles goes red; without importable in pluginSubs,
plugin-import.test.cjs goes red ("WorkBuddy lists no import").

Not tried: a real WorkBuddy desktop .info file or a real enterprise
account on a cloud-hosted domain; the fixtures follow WorkBuddy's own
client source. Not tried on Windows or Linux beyond vet.
2026-11-13 13:32:32 +08:00
yetone ac1702c330 library: the first part of a skill group opens below its heading, not over it (jinpwng on X)
jinpwng on X (macOS, Chinese UI): in Library > Skills, opening the first
group made the page jump, and what was clicked went off the screen; the
others opened downwards. The group was the first part of a big group (a
repository split by folder, drawn in the group's windowed list). A click
on a part's heading draws it anew, and the first part's only neighbour
above it is the list's zero-height pad, which the click's hold passes
over. So the page held the next part's heading, the rows opened pushed it
down, and the view scrolled by the whole part: the clicked heading went
from 152 to -920. A part's heading is now data-unrolls, so the hold keeps
its list, whose top doesn't move. Top-level groups, projects and the
Instructions agents already held still; the new test guards them too.

library-group-steady.test.cjs opens and folds, at the top and scrolled:
the Skills groups and the big group's parts (first and second, and the
first with the second open), the projects in Skills, MCP and Subagents
(first and third), and two Instructions agents. Each heading must stay
within 1.5px of where it was clicked. Clicks and scrolls go through
page.mouse, since Playwright's own scroll before a click reads as the
reader's.

Run (mica, mica-run), at base 436d507f0 unless said:
- library-group-steady in chromium and webkit, en zh zh-TW ja de, at 980
  and 420: 22 of 22 pass.
- Broken by hand (data-unrolls line removed): 20 of 20 cases red in both
  engines, "the first part opened: the heading moved from 152 to -920"
  (420: 242 to -830).
- With click-scroll, every-skill, found-fold, library-groups,
  library-instr-busy, library-instr-sets, nav-sub-unroll,
  project-skills-groups, project-skills-pick, skill-fold-all,
  skill-group-shared, skill-groups, skill-parts and i18n-keys, in both
  engines: 90 pass, 12 fail. The 12 are i18n-keys' "a plugin's words are
  its own" (#6422/#6423) and skill-fold-all's strict POST list seeing
  /api/update/using (#5982), red the same on origin/main 4545790de.
- Rebased on origin/main 4545790de (no Library or hold change between):
  library-group-steady again in both engines, 5 languages, 980 and 420:
  22 of 22 pass.
- mote: node --check client.js, gofmt -l, go vet ./internal/gui for
  darwin, linux nogui and windows: ok.

Not tried: the real app on macOS (the GUI files only), and a filter
showing a part (it takes the same partHead).
2026-11-13 13:23:41 +08:00
yetone 3f6b1b0c94 agent: omp's advisor turns on with its model, and its review, wait and call-back are set in magpie (#6408, Awad_Yoo on X)
Awad_Yoo wants omp's advisor gated: one model executes, another reviews
only at key points. omp's advisor (src/advisor, advisor/settings.ts) runs
only while advisor.enabled is true, and omp leaves it off, so a model
picked for the advisor role in magpie reviewed nothing.

- A model picked for the advisor role writes advisor.enabled: true when
  the user hasn't set it. The role's reset takes back only what that pick
  wrote (a stash mark); the user's own on or off stays.
- Three Quiet fields write the rest of config.yml's advisor block, as omp
  reads it (omp_advisor.go):
  - advisor_review: off, turn, agent-end (enabled + reviewMode; off keeps
    the mode);
  - advisor_wait: syncBacklog off, "1", "3", "5", strict, written as
    strings, since omp's enum settings take only strings;
  - advisor_wake: continueSeverity nit, concern, blocker.
- GUI: omp's opened row and its panel sheet get three rows (Advisor; Waits
  for its review; Calls a finished agent back on). The last two show only
  while it reviews, and the rows redraw in place. They live in
  ompadvisor.js, imported the first time. The roles square's advisor line
  says " · off" when the advisor is off. Strings in zh, zh-TW, ja and de.
- Core script budget: +717 for what is left in app.js, after the rows
  moved out.
- docs/subsystems/agent-wiring.md has an "omp's advisor" row.

Not magpie's: taking over from the executor after repeated failures of
the same kind. omp has no such setting; "escalate" in its source is only a
note's severity. An omp extension can do it (pi.on("tool_result") with
pi.setModel), and that keeps the session's trace and completed tool
results. Said on the issue.

Run:
- mica-run go test -count=1 ./internal/agent/: ok.
- go vet ./internal/agent/ ./internal/gui/ for darwin, linux (nogui) and
  windows: clean. gofmt -l: nothing.
- internal/gui Go tests: on mote (below).
- GUI, on mote and mica: omp-advisor.test.cjs (new: chromium + webkit;
  1100 and 390px; en, zh, zh-TW, ja, de; panel sheet at 360) passes, as do
  agent-prefs, old-webkit's own check, i18n-en-no-cjk,
  omp-profile-connect and agent-row-disclose.
- Reds that fail the same on a clean worktree at origin/main 743001128
  (45 of 45, the same tests):
  - agent-details-ready: #6373;
  - i18n-keys "a plugin's words are its own": #6422;
  - old-webkit headerpresets.js: #6030;
  - old-webkit :has(): #5919;
  - omp-roles in Chromium, "no roles square": filed as #6432.
- The real omp 18.9.1, in a sandbox HOME (omp config get), reads
  enabled=true, reviewMode=agent-end and syncBacklog=1 as written.

Broken by hand:
- No auto-enable on the pick: TestOmpAdvisorPickTurnsItOn went red.
- No in-place redraw: the panel sheet cases went red, 3 of 3.

Not tried:
- A real omp session with the advisor reviewing.
- continueSeverity needs omp 18.12.1 or later; 18.9.1 doesn't know it.
- A WATCHDOG.yml roster's per-advisor settings aren't shown; omp uses them
  over these.
2026-11-13 13:18:35 +08:00
yetone 870a9e0fe1 gui: the Windows tray panel stays where it opened, no jump left (jiangshangmuyun on X)
On Windows the panel opened flush against the right edge and, a moment
later, moved a fair way left. The tray placed it as it opened
(ToggleWindow -> PositionWindow), and every refit after that placed it by
the icon again: fitPanel, each glidePanel step (stepGlide in
glide_other.go) and zoomWindows all called tray.PositionWindow. Wails
centres the panel on the icon only when Shell_NotifyIconGetRect's rect is
inside the taskbar, and flush right otherwise. An icon clicked in
Windows 11's overflow flyout isn't in the taskbar as the panel opens, so
it went flush right; the page's first fit, once the flyout had closed,
read the flyout's arrow and centred the panel over that.

Now every refit of the open panel goes through sizeOpenPanel. On Windows
it keeps the place the tray gave it as it opened: the centre and the
edge by the taskbar held, kept inside the work area (panelRefit, one
SetBounds). The Mac and Linux keep SetSize then PositionWindow, as
before, in the same order.

Run:
- gofmt -l; go vet ./internal/gui ./internal/agent on darwin, linux
  (-tags nogui) and windows, on mote.
- go test -count=1 ./internal/gui ./internal/agent on mote: ok
  (145s, 250s).
- win-run on xiaomi-gpu: TestPanel*, TestOpenPanel*: ok.

Broken by hand (win-run, ../tray-jump-scratch/break.log):
- panelRefit holding the top edge in place of the taskbar's:
  TestPanelRefitKeepsItsPlace red in 4 cases.
- sizeOpenPanel taking the old path on Windows too, and app.go at its
  base (PositionWindow in fitPanel and zoomWindows):
  TestOpenPanelRefitsInPlaceOnWindows red each time.

Not tried: the real tray click on xiaomi-gpu. Nobody is signed in there
(query user: no users, LogonUI up, no explorer), so no tray exists to
click and the panel's moves couldn't be watched; the cause above is read
from Wails beta.24's systemtray_windows.go positionWindow. No GUI
(Playwright) file reaches this: the change is in Go, not the page.
2026-11-13 13:04:03 +08:00
yetone b942a872ba caps: a lone capped Codex account says its turns go to the fallbacks (not_4O4 on X)
not_4O4 asked for a way to switch to non-official models once a set share
of the ChatGPT quota is used. magpie already does this: a usage cap on the
Codex account (or a cap on the 5-hour / weekly window alone) plus the
provider's Fallback. When Codex is connected to magpie beside its ChatGPT
sign-in, or fails over through it, codexAccounts sends a capped lone
account's own-model turn through serve, so the fallbacks answer it.

The GUI said otherwise. The account row of a lone Codex account said
"Codex still uses it" past the cap even when Codex was connected, and the
cap note said requests are refused when the provider has fallbacks. Now:
- the direct-use note shows for Codex only when it isn't connected or
  failing over (an agent row with wired or failover);
- the held note says the requests go to this provider's fallbacks when it
  has some and Stop at the caps is off, in en, zh, zh-TW, ja, de.
- TestCoreScriptBudget: +236 bytes for this, packed to its shortest form
  with no page to move it to (the account rows are core).
The 11-04 grey Send default and the takeover are untouched: a cap never
takes Codex off ChatGPT.

New tests:
- internal/gateway TestCappedLoneCodexAccountGoesToItsFallback: a lone
  account capped at 80% with usage at 85 is not tried and the fallback
  answers (stream and not); at 50 the account is tried.
- account-cap.test.cjs: Codex connected, the lone capped row's note ends
  with the fallback line and has no direct note; not connected, the
  direct note stays. Chromium and WebKit, every language.

Run (mica, mote was over its load), at the rebased head
(origin/main c2a1d80fc):
- GUI before the rebase: account-cap, i18n-keys, i18n-en-no-cjk,
  window-cap, window-cap-pool, key-usage-cap, account-row-line,
  codex-app-menu-cap, routing-steps-cap: 235 of 236 ok. At the rebased
  head: account-cap, i18n-keys, i18n-en-no-cjk, window-cap,
  account-row-line again: 165 of 166 ok, the same #6422 red; go test -run Budget ./internal/gui ok. The red is i18n-keys "a plugin's
  words are its own" ("No folder" in memory_mcp.go, from 72facf72e),
  filed as #6422; this change touches neither file.
- go test -run 'Cap|Codex.*Fallback|Fallback' ./internal/gateway: ok.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows for
  internal/gateway and internal/gui: clean.

Broken by hand:
- `if false &&` before the HoldCaps check in codexAccounts: the Go test
  went red (acct-1 tried, fallback 0).
- the old `direct` and the fallback flag forced false: the 10 connected GUI
  cases went red in both engines; the not-connected ones stayed green.

Not tried: a real ChatGPT account reaching its cap with the real Codex
CLI or app; the full suite runs after the tag.
2026-11-13 13:02:05 +08:00
yetone c2a1d80fc2 routing: In turn says each message you send goes round, and draws it (Wing8Aqua on X)
"Each turn of a conversation goes to the next one" read as every message
of a session moving to another account, when a reader expects a new
session to be the unit, and the line was long. What the gateway does
(affinity.go affine): under In turn with Stays on Auto or Within a turn,
each message the user sends ("new-turn") goes to the next account, round
the list; the agent's tool calls for that message stay ("turn"); a new
conversation goes to the one holding fewest. Session and Strict keep a
whole conversation on one, so In turn goes round per conversation; Off
moves every request. Routing is unchanged.

The words now name the unit and the cost: each message you send goes to
the next one, round the list; its tool calls stay; a move costs some
prompt cache; Stays on Session keeps a whole conversation on one. Same
in the provider editor, a group's editor, the Routing plugin's mode
line, the CLI's groups help and the docs (en, zh, ja; llms-full.txt
rebuilt), in en, zh, zh-TW, ja and de.

Under the words, while In turn is picked, a small figure: two
conversations of three messages, a pill naming the account (A, B, C)
each message went to and dots for its tool calls in that account's
shade, drawn as Stays has it now (Auto moves each message, Session one
account a conversation, Off every request). Theme tokens only (--fg-2,
--muted, --faint, --card-2, --line), no colour. The figure lives in
rotfig.js, imported when In turn is first shown; the core keeps a
one-line hook, and its budget goes up 333 for that and the words.

Run (mote, at this tree): rotate-figure.test.cjs, new, provider editor
and group editor, en zh zh-TW ja de, 900px light and 420px dark,
chromium and webkit, 40/40; stays-strict, routing-group-strategy,
routing-save, routing-advanced, rate-limited-sink, group-template,
group-editor-fits, group-editor-align, routing-affinity-order,
routing-affinity-lead, routing-affinity-cache-write,
routing-pool-tooltip, routing-rows-fit, routing-weight-chip,
group-patience, group-defaults, builtins, search-keys, i18n-keys,
i18n-en-no-cjk, text-size, routing-editor-foot, gateway-key-own-rotate,
routing-accounts-narrow all ok; site worker.test.mjs 41/41;
TestCoreScriptBudget ok; go test ./internal/cli ok; gofmt clean; go vet
./internal/cli ./internal/gui darwin, linux -tags nogui, windows ok.
Red, the same on origin/main 5eac086ae (run there on mica):
account-arrange 53 !== 52 (#6010), old-webkit headerpresets.js (#6030)
and :has() in app.css (#5919).
After the rebase onto d6a6865b1, again at this head: TestCoreScriptBudget
ok, rotate-figure 40/40, site node --test 120/120; i18n-keys red only
on main's "No folder" in memory_mcp.go (72facf72e, #6422). Rebased
again onto 1cc7b7267 (a Gateway list label in app.css and i18n.js):
the core budget measured again there, 1,266,252 of 1,266,341; the full
suite runs after the tag.

Broken by hand: the new test against origin/main's assets is red (old
words, no figure); Session drawn like Auto is red (AAABBB expected,
ABCBCA drawn); the hook never drawing the figure is red.

Not tried: the real app (Wails WebKit, WebKitGTK); the figure is a
static SVG, no motion.
2026-11-13 12:55:57 +08:00
yetone 1cc7b7267d gui: the Gateway list says a model takes video or audio (pingqipai3 on X)
The Gateway page's model list showed each model's reasoning levels,
images and context, but not video or audio input, which the catalog often
knows (a model list's input_modalities, a plugin's capabilities,
models.dev).

/api/providers now carries `inputs` (video, audio, in that order) on each
model, from catalog.Model.InputModalities, and on each routing group,
from its entry's Inputs (any one of its models'). gatewayModels passes it
on, and the gateway plugin's mediaInfo adds a video and an audio glyph
chip after modelInfo's image one, with "Accepts video" / "Accepts audio"
in the tooltip ("(one of its models does)" for a group). The chips live
in the plugin, not in app.js's modelInfo, so the core scripts stay under
TestCoreScriptBudget (they were 553 bytes over in app.js). Strings in
zh, zh-TW, ja and de.

Run: at origin/main 54b6d4d39 + these three commits (c63a6d674, mica):
gofmt -l clean; go vet ./internal/{codexcat,gui,agent,gateway,provider,
catalog,usage} on darwin, GOOS=linux -tags nogui and GOOS=windows ok;
go test -count=1 of those seven packages: all ok (gui's
TestCoreScriptBudget included).
Rebased onto origin/main 21ed46106 after that run (main's gateway,
provider and i18n.js changes): provider, gui, codexcat and
gateway-model-info, i18n-keys, gui-zh-tw run again there (mica): Go all ok, GUI 8 of 9; i18n-keys is red on
"No folder" from 72facf72e on main (#6423), not this change.
The full suite runs after the tag.
GUI: gateway-model-info, gateway-model-chip-height, gateway-decide-info,
gateway-model-reasonless, group-member-info, gateway-models-open-steady,
i18n-keys, i18n-en-no-cjk, gui-de, gui-ja, gui-zh-tw, dates-gui-lang in
chromium and webkit (mote): 83 pass, 2 red, gui-de and gui-ja on the
"{agent} isn't installed here" string from fe20e4dbd, which this change
doesn't touch (#6234, already filed).
Broken by hand: mediaInputs returning nil turns TestMediaInputs and
TestGatewayListSaysVideoAndAudio red; mediaInfo returning modelInfo's box
alone turns gateway-model-info red in chromium and webkit.
Not tried: the real app with a provider whose list names video or audio.
model-chip-steady (the provider editor's chips, not this list) is red
40 of 60 here and the same 40 at origin/main 54b6d4d39 alone (#4388).
2026-11-13 12:53:04 +08:00
yetone 436d507f0e usage: a ChatGPT card's image row tells the window its replies' headers say, not a 15-minute guess (#6412, Green14964 on X)
ChatGPT's images API answers every drawing, a 200 too, with the image
allowance it counted: x-codex-active-limit: imagegen_premium and the
window in x-codex-primary-* (window-minutes 1440, reset-at), as the
reporter captured on a Pro account; Codex 0.160.1 also reads it from a
family named for the limit (x-imagegen-premium-primary-*,
parse_all_rate_limits). magpie read none of it on the image path: the
row said "Unknown" until a refusal, and a refusal whose body names no
resets_at rested the image model for quotaRest's 15 minutes, so the
card said "2 minutes" of a 24-hour window.

- gateway/codex_image_limits.go: codexImageHeaderLimit reads the image
  window from the limit's own family or, when x-codex-active-limit names
  an image limit, from x-codex-*; heardCodexImage keeps it per account
  (in memory), handed to provider.ImageHeard.
- Both drawing routes hear it: magpie's own (sendWith in draw.go) and
  Codex's relayed /images/generations and /images/edits
  (codex_backend.go).
- codexHeaderLimits tells no chat window when the active limit is an
  image one, so the 1440-minute window never lands on the 5-hour or
  weekly row.
- restDrawer: a 429 with the heard window at 100% counts as the quota
  (ChatGPT's "image limit reached" read as a rate limit), and with no
  resets_at in the body it rests until the heard reset, capped at
  longestQuota.
- provider.WithImageLane: the row says Available (or Used up at 100%)
  with that reset; a rest still says Used up. "Available" translated
  (zh, zh-TW, ja, de).
- docs/subsystems/providers-accounts.md updated.

Run (mote): at base 610ae1f54, go test -count=1 -timeout 45m
./internal/gateway ./internal/provider: provider ok; gateway red only
in TestRefusalAfterShownThinkingGoesToTheNext/chat_content_filter_to_
responses (#5761, refusal handover, load 61). At the pushed head's
tree (rebased on 54b6d4d39): gofmt -l clean; go vet darwin,
GOOS=windows, GOOS=linux -tags nogui ok; -count=3 of that test, the
TestCodexImage*/TestCodexRelayed*/TestCodexLimits*/TestCodexDraw*/
TestWithImageLane tests ok. GUI, chromium and webkit: codex-image-row,
i18n-keys, i18n-en-no-cjk ok; 57 of the 118 quota-*/usage-* files run
before the run was stopped, 51 ok, reds all filed on main:
quota-refresh-order (#6180), usage-agents-hide (#3414, #6003),
usage-cards-hide (#6294), usage-computers (#5224), usage-focus-steady
(#3501), usage-fold (#3415, #6003). app.js is unchanged.

Broken by hand, each red: without the sendWith hook,
TestCodexImageRowFromA200sHeaders and TestCodexImageRefusalRests-
UntilItsWindow; without the relay hook, TestCodexRelayedImageWindowHeard;
without the active-limit guard in codexHeaderLimits, TestCodexImage-
Headers; without the heard-reset branch, the refusal test rests 15
minutes (the reporter's symptom); without the 429 gating, it doesn't
rest at all.

Not tried: a real ChatGPT account's drawing (the fixtures are the
reporter's captured headers); Plus and other plans' limit names beyond
imagegen*/image_gen; the heard window doesn't survive a restart (the
row is Unknown until the next drawing); no share or count is shown.
2026-11-13 12:38:22 +08:00
yetone 54b6d4d397 gui tests: editor-thumbs-batched checks the thumbs shown, then Advanced opened (#5886)
editor-thumbs-batched went red on main from b03a37476 on (found by
bisecting 117f56c70..2abfe2b64 with the chromium half of the test):
three controls, off|on and off|week|all, with a thumb of width 0 two
pixels left of the option. b03a37476 moved Claude's warm-up and lean
lists into the provider editor's Advanced, which is closed when the
editor opens. Chromium answers offsetWidth inside a closed <details>
(its content is content-visibility: hidden and the read lays it out),
so the test's `on.offsetWidth` took those controls for shown ones,
while their ResizeObserver, rightly, had nothing to report yet.

Nothing is wrong in the page: the thumbs are put when Advanced opens.
The test now checks the thumbs whose option checkVisibility() says is
shown, then opens every closed <details> in the editor, waits two
frames, and checks every thumb again. That second check is what a user
opening Advanced sees.

WebKit's slow-read count was red too, on main as well (origin/main
70f4593e6: 208 at 40 accounts, 244 at 160; this branch 188/213). The
reads that differ were all holdModal's few a frame and the frames' own:
the open at 40 sometimes ends ~5 frames sooner. That is frame jitter,
not a read an account (+120 here), so the room for slow reads is 60,
not 24; the forced-layout room stays 24.

Run (mote, at the pushed base): editor-thumbs-batched, Chromium and
WebKit, en/zh/zh-TW/ja/de, 10/10 green three times in a row.

Broken by hand: thumbFit's callback made a no-op (the thumbs put only
when drawn) is red 5/5 in Chromium, on "opened off|on: option
655.8+38.0, thumb 653.8+0.0" and "opened off|week|all", the controls
in Advanced; the "shown" check stays green there, as it should.

Broken by hand: an offsetTop read for every account a frame after the
list is drawn is red in WebKit en and zh (278 at 40, 538 at 160).

Not tried: the WebKit half of the broken-by-hand run.
2026-11-13 12:20:29 +08:00
yetone 6bba0572d6 gui: an open editor's readings redraw its accounts list, not the page (#5310)
When a provider editor opens, its accounts' readings load after it
(loginUsageOf), and their arrival called renderProviders(true): every
Providers row and the whole editor drawn again. With 600 accounts that
was a second full draw of the editor. redrawAccounts now draws only the
editor's accounts list again and puts it where the old one was. A full
draw is kept for the cases it was there for: another provider being
edited, a rename or a focused field (left alone, as before), and an
arrangement in progress or no open list (drawn in full).

What a full draw did, the in-place redraw does too:
- the list's inputs are named and described as field() names them;
  that part of field() is now fieldInputs(label, control), shared;
- the focus goes back to the same control of the same account, matched
  by tag and first class (a pressed refresh is "busy", so the whole
  className is not the same after), not its index in the list, which
  the readings' new controls move;
- that focus is given back, not pressed (modalRefocus), so the dialog
  keeps holding the pressed element where it was;
- the body's scroll is put back after the swap: the focused element
  taken out moved it by scroll anchoring (120 to 124 in
  editor-quota-quiet).

The full draw also hid a gap it no longer covers: the provider editor's
folds learn the labels' column from their own size (edAlign's
ResizeObserver), and the prefs fields (Resets, Warm up, Check in,
Claude Code) shown after the prefs load widen that column without
changing a fold's size. The readings' full draw made new folds that
measured it again. mountProvPrefs now aligns the editor's folds after
showing its fields (edAlignAt, the observer's body made a function).

Measured before (mote, 600 Claude accounts): the in-place redraw saves
~45ms in WebKit and ~30ms in Chromium of the editor's open. The rest
of the ~1s is the first layout of 600 rows.

Tests:
- editor-readings-in-place (new): 12 accounts, readings held until the
  editor is open and the 3rd account's first button focused. After
  they arrive the Providers row and the editor's head are the nodes
  drawn before, the focus is that same button, and the list's labels
  match a full renderProviders(true). Chromium and WebKit,
  en/zh/zh-TW/ja/de: 10/10 green.
- editor-quota-quiet's "redrawn" watch also counts the accounts list
  replaced alone; before, it waited for a new .ebody and failed
  "never came, so this tested nothing".

Broken by hand:
- the readings back to renderProviders(true): editor-readings-in-place
  10/10 red on "the provider's row is the one drawn before".
- the focus matched by the whole className: account-refresh-holds
  red in Chromium, "the focus stays on the pressed refresh" (null).
- the refocus without modalRefocus: account-refresh-holds red, "the
  pressed refresh moved 186.875px".
- without the scroll put back: editor-quota-quiet red 8/8, "the body
  keeps its scroll" (124, 120).
- without mountProvPrefs' edAlignAt: editor-advanced-align red in
  Chromium, "en 1000: Advanced starts at 284.765625, its fields at
  349.265625".

Run (mote, load 25-45, other sessions' runs beside):
- account-refresh-holds, claude-quota-onboarding, editor-advanced-align,
  editor-hints, editor-quota-quiet, editor-thumbs-batched, one at a
  time, on this change and on origin/main 2abfe2b64: the same reds on
  both but those this commit fixes, and editor-thumbs-batched (red on
  main, #5886, the next commit). The shared reds are filed:
  account-refresh-holds' rising sheet (#5814), account-arrange (#6010),
  claude-quota-onboarding (#6179), editor-hints in WebKit (#6156).
- the 149 GUI files this reaches, on mote: 2601 pass, 124 fail of 2725.
  Every red is in 16 files, and the same 16 run alone at origin/main
  2abfe2b64 on mote fail the same tests (126 there, the two more being
  signin-proxy at 380px, #5866). Filed: provider-many-keys and
  provider-max-output #6209, key-switch #5835, plugin-signin-no-url #5938,
  plugin-signed-out-account #5998, reset-providers #6196, old-webkit
  #6030/#5919, mobile-web #3952, plugin-move-unserved #4392, key-import
  #6416, account-refresh-holds #5814, account-arrange #6010,
  claude-quota-onboarding #6179, editor-hints #6156. restart-app's
  chromium 420 zh was 1px off once in the full run and green alone on
  both trees (#6417).
- go test ./internal/gui -run 'Budget|I18n|Keys|Words' on mica: ok
  (TestCoreScriptBudget with the previous commit: -89 code bytes over
  both).

At origin/main 70f4593e6 (rebased over 27 commits,
several in app.js): go test ./internal/gui -run
'Budget|I18n|Keys|Words' ok on mote; editor-readings-in-place,
editor-quota-quiet, editor-thumbs-batched, editor-advanced-align,
account-refresh-holds, claude-quota-onboarding, i18n-keys,
signin-proxy, reset-providers and key-import: every red one that is
red on origin/main too, but editor-thumbs-batched's WebKit read
count, which the next commit gives room (red on main as well).
editor-advanced-align was red once in both engines in that set at
--test-concurrency=2 under load, then green alone on this head and on
main, and 58/58 green in the same set again (#6421).

Not tried: the real app with 600 real accounts; Linux WebKitGTK.
2026-11-13 12:20:29 +08:00
yetone 468102b721 gui: a move's done line, a sign-in page's open and the other-ways row each written once
Three pieces of app.js were written out more than once, word for word:

- movedSay(p): "{name} now runs on its plugin — {accounts}, {models}."
  and the state read after it, in unmovedLine and renderMove.
- signInPage(url, id): open the sign-in page, and on a failure keep its
  message on the sign-in still shown, in startSignIn, followSignIn and
  startPluginSignIn.
- acts(): the sign-in's row of other ways, made when the first goes in,
  five times in one function.

No behaviour changes. This pays TestCoreScriptBudget for the next
commit, the readings redrawing an open editor's accounts in place
(#5310); main was at the budget to the byte. Code bytes, as the budget
counts them: -1043.

Run: see the next commit, whose runs include this one.
2026-11-13 12:20:29 +08:00
yetone c2fd48782b Put back what 1f05c311d took out of main by mistake
1f05c311d was committed with its worktree's older tree on top of a
fresh origin/main (git reset --soft), so beside the memory fix it
undid every file 610ae1f54..c1312ac15 changed (45 files: key balance,
import links, project subagents, uninstall, site, LESSONS.md and
more). This commit restores each of them to c1312ac15 byte for byte;
the tree is now c1312ac15 plus the memory fix alone
(git diff --stat c1312ac15 HEAD: the 4 files of the fix).
2026-11-13 12:18:23 +08:00
yetone 1f05c311d9 library: an open memory holds still while the Memory tab polls (Nietzsche_Li on X)
"资源库-记忆中,被展开的记忆的表单会定时抖动". While search by meaning
still has memories to read (read < of, which can last up to a minute
between memembed.Keep's reads) or a learn-from-conversations run goes,
the Memory tab reads its row again every 2s, and each read drew the
whole page anew. The open editor was a new .lib-detail each time and
played its content-in entrance (opacity .5, 2px slide) every 2s.

- semWatch/distWatch draw nothing when the read changed nothing, and
  redraw only their own row (redrawRow) when it did; the whole tab only
  when the memories changed.
- render() marks a .lib-detail open before it (same data-detail) as kept,
  so it doesn't replay its entrance. This covers every render of an
  open editor in the Library: memories, instruction sets and agents'
  files (the siblings; no other Library tab polls into render()).
- A new memory's text no longer takes the focus back on every render.

Run (mote): library-memory-steady.test.cjs, all 5 languages, 980/420,
chromium + webkit: green 4 of 4 whole-file runs after the last change
(webkit alone 2 of 2 before it). Broken by hand: the same test against
origin/main's client.js and library.css: 22 of 22 red ("the editor
played its entrance again"). One webkit de 420 red was the test's own
first row click intercepted by the header at 420px while the page
settled; the test now opens rows with a DOM click.
Also run, both engines, every language, 980/420: library-memory, library-memory-select, library-memory-suggest, memory-icon, library-instr-busy, library-instr-sets, library-linked-set, library-follow-server: all green. No Go code changed, so no go test or vet.
Not tried: the real app on a real memory store mid-read.
2026-11-13 12:17:43 +08:00
yetone 70f4593e62 provider: a key's typed balance can refill each day (Kelen_Yc on X)
A key's balance typed by hand refilled each month or each week. A relay
key with a daily allowance had no way to say so. Now it can refill each
day, at local midnight, like the others:

- provider: Refill{Every: "day", Day: 0} (RefillDay). Last is today's
  midnight in now's location, Next tomorrow's. check takes it with day 0
  only; ParseRefill reads daily/day/d (daily:1 refused); String is
  "daily". A magpie before this drops such a refill on read, as one
  written by hand that isn't one, and counts from when it was typed.
- CLI: `magpie provider key-balance <id> <key> --refill daily`; usage
  lines updated.
- GUI: the pill's menu has "Refills each day" after "Refills each
  week…", posting {every: day, day: 0} at once (no day to pick, so no
  ellipsis), with its toast; en, zh, zh-TW, ja, de.
- docs/subsystems/providers-accounts.md names it.

Tests: TestRefillDays gains daily rows (midday, exactly midnight, a
month's and a year's end, Asia/Shanghai). New
TestTypedBalanceRefillsDaily holds the clock in Pacific/Kiritimati
(UTC+14), Pacific/Pago_Pago (UTC-11) and UTC: a minute before local
midnight the spend counts from when it was typed, a minute after it
counts from local midnight and the next refill is the following one.
TestOwnBalanceParsedInYuanAndRefill and TestTypedBalanceRefills cover
parsing, the bad {day, 1}, and read-back; TestKeyBalanceCmd sets
--refill daily. key-own-balance.test.cjs picks Refills each day in
every language, both engines, 900 and 400px, checks the post and that
the menu then shows it picked.

Run on mica at 889758605 + this: go test -count=1
./internal/provider ./internal/cli ./internal/gui ok; go vet darwin,
GOOS=linux -tags nogui, GOOS=windows ok; gofmt clean; GUI
key-own-balance, i18n-keys, i18n-en-no-cjk, key-balance-expiring in
chromium and webkit ok (48/48). Rebased on c5adcbaab (library, site;
nothing of this change's files), then at the pushed head: go test
./internal/gui, ./internal/provider -run Refill|TypedBalance|OwnBalance|
KeyOwnBalance|Budget ok, i18n-keys and i18n-en-no-cjk ok. key-balance-card is red in de at 560px
(view-usage 635>560) in both engines on the clean base 889758605 too:
#6414.

Broken by hand: daily Last taken from UTC's midnight instead of local:
TestRefillDays and TestTypedBalanceRefillsDaily (Kiritimati) red.

Not tried: the real app with a real relay key; the full suite (started
after the tag).
2026-11-13 11:59:54 +08:00
yetone 4431e31f7c library: a project gets subagents of its own, per agent (jinpwng on X)
The Subagents tab now lists the projects as Skills and MCP do. Opening
a project shows each library subagent with chips for the agents that
read a project's own subagent folder: Claude Code (.claude/agents),
Codex (.codex/agents, TOML), OpenCode, Gemini CLI, Qwen Code, Droid
(.factory/droids), Cursor and Copilot (.github/agents/*.agent.md). A
tick writes the subagent into that project only, in the agent's own
format; the agent's global folder and other projects are untouched.

Each file is recorded by its hash and rewritten or removed only while
it is exactly as magpie wrote it, so a same-name file of the user's is
left alone. A rename in the library follows into each project. The
files are kept out of git by the project's info/exclude block, and
follow the repository's other worktrees (syncTrees now copies
Subagents, and clears it for a worktree let go).

POST /api/library/projects/subagents {dir, name|names, agents}. No CLI
yet, like project servers. Hooks, instructions and Claude plugins have
no project scope yet (filed separately).

Run (mica / mote via mica-run, mote-run):
- go test -count=1 ./internal/library ./internal/gui: ok
- node --test, chromium + webkit: project-subagents, project-scope,
  project-servers, project-skills-pick, project-skills-groups,
  project-remove-keep, library-subagents, library-all, library-items,
  i18n-keys, i18n-en-no-cjk, claude-subagents-pick,
  codex-subagents-lead, subagent-effort: 150/150 pass
- gofmt -l clean; go vet darwin, linux -tags nogui, windows on
  internal/library and internal/gui: ok

Broken by hand: dropping Subagents from syncTrees' copy made
TestProjectSubagentsFollowWorktrees red ("the worktree hasn't the
project's subagent"); the earlier session broke the fix by hand and
saw the new library tests go red.

Not tried: a real Claude Code/Codex session picking up the project
subagent; the full go suite (started after the tag); Windows/Linux
runs of the GUI.
2026-11-13 11:51:50 +08:00
yetone 889758605f import: open CC Switch's ccswitch:// provider links (coder_shaun on X)
A relay's one-click ccswitch://v1/import?resource=provider&app=…&name=…
&endpoint=…&apiKey=… link now opens magpie's own import confirmation. The
format is read from CC Switch's source (src-tauri/src/deeplink/parser.rs and
provider.rs at 3c76d3b): host v1, path /import, resource=provider only,
app, name, endpoint, apiKey, apiFormat, model/haiku/sonnet/opusModel,
homepage, iconUrl, and the base64 config (claude env, codex auth + config.toml
provider table, gemini env) filling what the URL leaves out. The link is
translated into a magpie://import's parameters and goes through the same
checks (https only, key shape, id rules, balance host) and the same
confirmation; usage scripts, configUrl, enabled and notes are never taken, a
codex env_key is refused.

Registration, so as not to take CC Switch's links: Linux writes a separate
magpie-ccswitch.desktop and sets the default only when `xdg-mime query
default` is empty or already it; Windows writes HKCU ccswitch only when
HKCR has no live handler of another program; uninstall and install.sh remove
them only while they are ours. macOS declares the scheme in Info.plist
(static), so with CC Switch installed too the system picks.

Run: provider, gui (macOS mote; Linux gtk3 on WSL for the scheme tests),
uninstall, cli, update packages; vet darwin, windows, linux nogui. The test
parses CC Switch's own 11 provider examples (testdata/ccswitch_links.txt,
copied from its repo) and refuses the other resources. Broken by hand: claude's
default endpoint kind (4 reds) and the Linux "another app has it" check
(TestRegisterSchemeLeavesCCSwitchItsLinks red).
Not tried: Windows registry (vet only), a real CC Switch installed beside
magpie, a browser click on a real relay's button.

Rebased on 610ae1f54 and run again there (mica): provider, gui, uninstall,
cli, update ok; GUI import-link-balance, import-link-gemini,
import-collision, import-opencode 80/80 in chromium and webkit; vet darwin,
linux nogui, windows ok; gofmt clean. Reviewed against CC Switch db7a0e7
(no deeplink change since 3c76d3b). Broken by hand again: the config's key
no longer filling an empty apiKey (TestCCSwitchOwnExamples, 3 reds).
Pushed on 48afb27b0, which adds only the library plugins GUI files
(client.js, library.css, library-plugins.test.cjs) to that base.
Not tried either: macOS with CC Switch installed too, where Launch Services
picks which app opens ccswitch:// links.
2026-11-13 11:46:50 +08:00
yetone 48afb27b0f library: Claude plugin rows show counts, the dialog keeps its width and folds the parts (jinpwng on X, #6309)
The plugin dialog's description, part lists and source line sat in the
editor grid's 132px label column, so even Plannotator (3 hooks) read as a
narrow column: the Hooks heading landed in the right column, the names
under it on the left and the GitHub line in the middle. Description, parts
and hints now span the grid. The list row showed every skill name (PStack
lists a hundred); it shows "Skills 12 · Hooks 3", and the dialog lists each
part's names in a fold, closed by default.

Run at this head (rebased on 610ae1f54), on mica, Chromium and WebKit, en,
zh, zh-TW, ja, de, 420 and 1100: library-plugins, library-subagents,
library-all, library-row-open-scroll, library-open-again, i18n-keys,
i18n-en-no-cjk: 82 of 82 pass. gui-zh-tw passes; gui-de and gui-ja's
"has every zh string" are red on main already ({agent} placeholder, #6234).

Broken by hand: with the span rule cut back to the <p> only, the test fails
with "a part or the source is squeezed" (parts 116/433 of 600px, source
116px), the reporter's alternating layout. With the old CSS it fails "the
description is squeezed: {p:132,d:600}".

No Go files changed, so no gofmt/vet. Not tried: the real app with a real
PStack or Plannotator.
2026-11-13 11:43:59 +08:00
yetone 610ae1f541 library: handing skills over turns off the all-in-~/.agents/skills setting and takes magpie's links out (ConatusMoon2222 on X)
Put skills in "~/.agents/skills" (SharedSkills) gives every agent that reads
that folder every skill, so it cannot go with choosing agents per skill,
which is what "Manage in magpie" (HandOverSkills) is for. With the setting
on, a handed-over skill's entry was taken away and the next sync linked it
back there, so the link stayed (reproduced in a sandbox HOME). Handing over
now turns the setting off in the same write; the sync then removes magpie's
own links there (sweepShared: only ours, never the user's entries). The
confirm sheet says so, only while the setting is on. The Put skills in note
says the skill router lists nothing while every skill is in
~/.agents/skills (the "none" the reporter met), only when both are on.
Strings in zh, zh-TW, ja, de.

Run (on mote, at this tree):
- TestHandOverWithSharedSetting: red with the l.SharedSkills = false line
  commented out ("a link is left in ~/.agents/skills"), green with it.
- go test ./internal/library ok; go vet darwin, GOOS=windows, linux nogui
  on internal/library ok; gofmt -l clean.
- GUI: skill-handover, shared-skills, i18n-keys, i18n-en-no-cjk in chromium
  and webkit, 23/23 each.
Not run: the full GUI suite and go test ./... before the tag; a real
account's Library; WebKitGTK.
2026-11-13 11:28:51 +08:00
yetone dd9b2bcef5 gui: the new sign-in row and sentences within the core script budget, +296 (Wing8Aqua on X)
No page left to move them to; the row is packed to its shortest form.
Budget raised by exactly the 296 bytes over.

Record for this stack (Wing8Aqua's three reports: cap toggle wording,
Smart is not load balancing, Sign in on another computer), run on mica at
this head's content (rebased on 861a0442c):
- go test ./internal/gui: ok; gofmt clean; go vet darwin, windows,
  linux nogui: clean.
- GUI: pool-ends, signin-another-computer (new), signin-link-only,
  i18n-keys, routing-save: 122 pass, 0 fail, chromium and webkit, en zh
  zh-TW ja de where the file has them. Earlier wider run (signin-*,
  i18n, routing-save/advanced/smart-intent/manual/mode-goes, account-cap):
  418 of 425; the 7 reds were the Japanese 420px cap label wrapping a
  line (fixed, shorter label), one load timeout each in signin-again and
  signin-codex-device (green on rerun) and signin-proxy 380px, which is
  red on origin/main too (#5866).
- Broke by hand: without the linkOnly post the new test is 0 of 16.
Not tried: a real Claude sign-in from another machine; Windows and Linux
webviews; plugin sign-ins and the Routing page's own Smart tooltip
(plugins/routing/client.js) keep their old text.
2026-11-13 11:07:02 +08:00