Commit Graph
8449 Commits
Author SHA1 Message Date
yetone 35face90f3 gateway: thinking.display goes to a Claude only (StudyingPython on X)
pi-ai, DeepSeek Harness's client, sends thinking {type, budget_tokens,
display: "summarized"} for every model it lets reason (and adaptive with
display for some). magpie passed display through to non-Claude models on
an Anthropic route, and Alibaba Cloud's Anthropic endpoint (Bailian and
its Coding Plan) answered a Qwen request with 400. The reporter saw it
around compaction, which dsh can move to another model.

withoutForeignDisplay drops thinking.display when the body's model is
not a Claude (claudeVersionOf, or "claude" in the name). It runs in
forwardOnce's Anthropic block after adaptiveThinking, so Anthropic's API,
the Claude subscription and relays serving Claude models keep display
"summarized" (#1485). The provider's own fields go on afterwards, so a
display the user forces there ("!thinking") is still sent.

Run (mote, at this commit on 28236ad2d):
- TestDisplayGoesToClaudeOnly: red on the old code (the call taken out):
  Qwen, GLM and Kimi each got the fake vendor's 400. Green with the fix;
  the Claude cases (sonnet-4-5 enabled, opus-4-7 adaptive, Responses
  summary auto to opus-5-5) keep display "summarized".
- gofmt -l: clean. go vet ./internal/gateway on darwin, linux, windows: ok.
- go test -timeout 45m ./...: every package ok (101), EXIT=0
  (gateway 964s, agent 359s, provider 230s).

Not tried: a real Alibaba Cloud account; Aliyun's real error wording is
unknown, so the fake's 400 text is a stand-in and refuseShapes was not
taught it. The reporter's dsh and magpie versions are unknown. A relay
serving Claude under a name with no "claude" and no Claude line match
loses display; it can force it back in the provider's own fields.
2026-11-16 08:58:28 +08:00
yetone 28236ad2d5 LESSONS: a red only CI's OS shows is probed there with the suspect toggled
EBADF on macOS CI (#6368, #6785) sat four days; local macOS 27 never
showed it, and one probe run on CI's runners named WatchRoot (0522bf84f).
Docs only; nothing run.
2026-11-16 08:24:24 +08:00
yetone d46af794b1 dirent: a folder renamed in whole under a watched one's name is read again
A listing was taken as current unless its own folder or its root's was
heard to change. A folder replaced whole (renamed away, another renamed
in under its name) is heard only in the folder that holds it, so a
Sessions read kept the old folder's listing until listedFor ran out.
Found while dropping WatchRoot (the commit before), which never covered
this: it reports the root alone. Every folder from the listing's parent
up to its root is now checked.

Run (mote, at this tree):
- go test -race -count=5 ./internal/dirent: ok
- go test ./internal/sessions: ok
- go vet ./internal/dirent for linux, windows; gofmt -l: clean
- red on the old code: the same rename as TestFolderReplacedWholeIsReadAgain,
  3 of 3 "new file not seen" at 0522bf84f.
Not tried: the full suite (CI runs it).
2026-11-16 08:23:32 +08:00
yetone 0522bf84f8 dirent: watch without FSEvents' WatchRoot, which left files EBADF (#6368, #6785)
macOS CI's internal/sessions runs failed on ordinary file reads, writes,
closes and TempDir cleanup with "bad file descriptor" since 11-13, the
day after 6f3e76626 created the FSEvents stream with
kFSEventStreamCreateFlagWatchRoot. A probe (draft #6795, run
43778622224) ran 8 goroutines of plain file I/O beside a loop that
watches and removes temp roots, 45s per phase, flag on, off, on, off:

  macOS 15.8.2: on 0 + 554 EBADF, off 0 + 0 (~740k ops)
  macOS 26.7.2: on 0 + 362 EBADF, off 0 + 0 (~650k ops)

mote (macOS 27.2) saw none either way, so it was CI-only.

The stream is made without the flag. What it gave, word of a root
renamed, removed or put back, WatchSince now checks itself: each Watch
stats the root, and when it is not the folder the watch began on
(os.SameFile), that root's watch is dropped, everything is listed again,
and the watch begins anew on what is there.

Run (mote, at this tree):
- go test -race -count=5 ./internal/dirent: ok
- go test ./internal/dirent ./internal/sessions: ok
- go vet ./internal/dirent for darwin, linux, windows; gofmt -l: clean
- broken by hand: with the rootMoved check skipped,
  TestRootReplacedWholeIsReadAgain is red 3 of 3 ("the new tree's file
  wasn't seen").
Not tried: the full suite (CI runs it); EBADF's absence on main's CI
over time is the real proof, watched on #6368.
2026-11-16 08:21:22 +08:00
yetone 421d5ce000 proc: a context that ends a running command says so off macOS too (#5967)
CombinedOutputOwn off macOS (and without cgo) was plain
cmd.CombinedOutput(). When the context killed a command that had
started, exec.Cmd's Wait said "signal: killed", while the macOS path
returns ctx.Err() whenever the context ended. TestCombinedOutputOwnContext
cancelled right away, so it passed when the cancel beat the start and
went red on ubuntu CI (run 43771048472 at 103eff4d4) when it didn't.
Now the run returns the context's error whenever it ended, as on macOS,
and the test cancels once before the start and once after the command
has written its mark, so the started case is no longer left to timing.

The only caller, restartCodexDaemon, puts err.Error() into its message
when the command printed nothing: a timed-out restart now says
"context deadline exceeded", not "signal: killed".

yinwu01 took #5967 on 11-10 with a patch described in the issue; none
landed in six days, so this is that change.

Run:
- wsl-run (Linux) go test -count=3 -run TestCombinedOutputOwn
  ./internal/proc: ok. Whole package -count=1: ok.
- mote-run (macOS 27, cgo) go test -count=1 ./internal/proc: ok.
- mote-run CGO_ENABLED=0 go test -run TestCombinedOutputOwn
  ./internal/proc (the non-macOS path on macOS): ok.
- mote-run GOOS=windows go vet ./internal/proc: ok. gofmt -l: clean.

Broken by hand: the old disclaim_other.go with the new test on Linux:
"started true: err signal: killed, want canceled", red every time.

Not tried: a full suite; a real codex daemon restart timing out.
2026-11-16 08:16:32 +08:00
yetone 881497507c lessons: the one-suite-per-machine lesson is listed as moved
ff5a7dfc0 added the code-standards row; this takes the lesson out of
Verification and lists it under Moved to the code standards, which
that commit's script failed to do.

Docs only; nothing run.
2026-11-16 07:31:12 +08:00
yetone ff5a7dfc03 lessons: one full suite per machine moves into the code standards
Seen a third day: 64c426158 (11-16) ran the whole GUI suite on mica
beside another session's full suite, was pushed with it still running,
and named its 90 reds by page (accounts, Details, keys, plugins,
providers) with no issue. The rule now has a row in the Tests table,
and LESSONS.md lists it under Moved to the code standards.

Docs only; nothing run.
2026-11-16 07:30:55 +08:00
yetone ada0125303 providers: Antigravity's accounts move to agy-cli in one click (@tongzhenbao on X)
@tongzhenbao asked whether accounts signed in on the old Antigravity
plugin (opencode-antigravity-auth, withdrawn since 256910f17: it
keeps serving its users, with Google's suspension risk said) can move to the
agy-cli plugin in one click. They can: both hold refresh tokens from the
same Google OAuth client (agy's own, 1071006060591-...), so the token goes
to agy, the client that issued it, and to no new place.

What the user sees: on Providers, while the old plugin still holds
accounts agy-cli doesn't have, a line over the list says Antigravity's
accounts can move to Antigravity (local agy CLI), with Move and Not now.
Move installs agy-cli (>= 0.1.68, from the plugins repo's dist branch,
as npm doesn't have it) and the agy CLI when missing, then hands the
sign-ins to agy-cli's auth.import (plugins 9907c187), which gives each
account its own agy home and keeps it only once `agy models` works with
it. Accounts that fail are named with agy's reason, Try again retries
them, and the old plugin's sign-ins are never removed. While this line
shows it stands in for the withdrawn plugin's own line (256910f17's
"can get your account suspended ... Use Antigravity (local agy CLI)"):
it opens with the same risk and carries the Move itself; after the move,
or Not now, that line is back. The "antigravity" retired-move line steps
aside too. Plugins > agy-cli > Import accounts from a file stays the
manual route.

- internal/provider/agy_move.go: AgyMoveUsers (deduped by refresh token
  and email, skipping emails agy-cli has) and MoveToAgy.
- internal/gui: /api/provider/toagy, agyMove/agyMoved in the payload.
- app.js: the agy line is the lazy agymove.js, so app.js's core bytes are
  below its base and the budget is unchanged.
- i18n in zh, zh-TW, ja, de; docs/subsystems/providers-accounts.md row.

Run at 281d6ebb6 (before the rebase onto 8f3f7a46a), on mote:
gofmt -l clean; go vet ./... (only the existing proc cgo deprecation
warning); GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet
./... clean; go build ok; go test -count=1 -timeout 45m ./... exit 0,
101 packages ok, no FAIL.
Run at a5289963f (rebased onto Qianfan), on mote: go test -count=1
-timeout 45m ./internal/gui/ ./internal/provider/ ./internal/cli/ ok.
Full GUI suite at f3e826b98 (base 52e83f7b5), both engines, every
language: 1,035 of 28,152 failed in 123 files; those 123 files rerun at
head and at base 52e83f7b5 alone: 1,038 and 1,029 failed, every red test
also red at base or flipping on both sides (key-replace, signin-proxy,
name-suffix-remote 1 of 3 at each, tray-cell-click, images-codex-one,
models-fold, rest-try-now). Filed: old-webkit #6030 and #5919,
plugin-move-unserved #4392 and #4410 (4 reds at both), video-gen-pick
#6792 (filed now); every other red file has its open gui issue.
Run at this head (ea4d55d72, rebased onto 103eff4d4, which brought
256910f17's withdrawn line and depLine), on mote: gofmt -l
clean; go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet of
internal/gui, internal/provider, internal/plugin ok; go test -count=1
-timeout 45m of internal/gui, provider, plugin and cli ok; node --test
agy-move, providers-withdrawn, retired-move, deprecation-notice,
plugin-move, providers-discovery-off, i18n-keys, i18n-en-no-cjk,
old-webkit and plugin-move-unserved: 92 of 98 ok; the 6 reds are
old-webkit's compat.js-first and Safari 15 styles (#6030, #5919) and
plugin-move-unserved's Try again (#4410), all red at base too.

Red by hand: dropping the email/refresh-token dedupe fails
TestAgyMoveUsersAreTheOldPluginsNotInAgyCLI (offers a2@x.com too);
dropping st.AgyMoved fails TestToAgyMovesAndSaysEachAccount;
drawing the withdrawn line beside the agy one fails agy-move.test.cjs
10 of 12 ("two lines for the same accounts"); clearing the
kept failures on a failed move turns agy-move.test.cjs not ok.

End to end, sandbox HOME on mote, no real credential: the real MoveToAgy
with a fake antigravity sign-in downloaded Bun, installed agy-cli 0.1.68
from dist, ran auth.import, and reported the account failed by name
("agy couldn't sign in with it: `agy models` says: Please sign in ...");
agy-cli kept 0 accounts and the old plugin still had its 1.

The plugins side's run had one red under load, agy-cli's
test/usage.mjs version deadline, filed as magpie-community/plugins#1191.

Not tried: a real Antigravity account moved through a running magpie,
and agy homes on Windows and Linux.
2026-11-16 07:22:47 +08:00
yetone 64c4261582 sessions: search what was said in every agent's sessions, from the page and an MCP server
cryingLiu on X asked to search the chat history of every agent magpie
reads sessions from: prompts and replies, from one place.

What the user gets:
- The Sessions page's search also lists, under the agent's own list,
  the other agents' sessions whose conversation says the words, each
  with a snippet. A hit opens the conversation in the sheet at the
  message that said it (transcript?find=), with "N earlier messages
  not shown"; the page itself never scrolls. While the index is still
  being built the head says "Indexing sessions…" or "Indexing N of M
  sessions…", and the page asks again every 3s until it is done.
- Magpie Sessions, a built-in MCP server in Library → MCP (Discover),
  opt in per agent like the other magpie servers. Its tools are
  search_sessions(query, agent?, limit) and read_session(id, around?),
  both returning text. It runs as `magpie mcp sessions` over stdio and
  reaches the gateway's /mcp/magpie/sessions, which serves only local
  callers that are not browsers.

How it works:
- internal/sessions/said_index.go keeps said-v1.db beside sessions.json:
  a contentless SQLite FTS5 index (detail=none) of the words each
  session says. It is built from the sessions list sessions already
  caches and refreshed at most every 10s: a new or rewritten file is
  read once, a grown Claude Code or Codex file only from where it ended,
  and a gone one is forgotten. A query asks the index which sessions
  have every word, then reads only those files for the snippet, for at
  most 6s. A search waits up to 2s for a refresh. While the first
  listing is still running the answer says `listing`, so an empty first
  answer is not read as "no session says it".
- Privacy: only agents sessions.Reads allows are indexed or searched;
  nothing is read until the user has answered the sessions question,
  and in gateway mode no agent's own files are read (the page doesn't
  ask). Reset forgets the index.
- /api/sessions/said for the page; the CLI parity list names it.

Run, at this tree (rebased on origin/main 256910f17):
- gofmt -l clean; go vet on mote for darwin, GOOS=linux -tags nogui
  and GOOS=windows: ok.
- go test -tags nogui ./... -timeout 45m on the WSL Linux box:
  every package ok at c8e445c4b (the tree before the one-hit wording,
  whose gateway tests ran again on mote: ok).
- GUI: the whole suite on mica at this head was still running when
  this was pushed (owner: never hold a verified change behind a full
  suite). Under mica's load, beside another session's full suite, 90
  tests had failed so far, all in files this change doesn't touch
  (accounts, Details, keys, plugins, providers); none in sessions,
  library or i18n. The files this change reaches passed on their own
  (below).
- Focused, green: internal/sessions (Said*, TranscriptAt),
  internal/gateway (SessionsMCP*, own MCP, read-only, key slots),
  internal/library (market, opt in), internal/gui (Said, Sessions,
  gateway mode); GUI sessions-said, sessions-search, library-sessions-mcp,
  vision-mcp-library, library-browser-setup and i18n-keys in chromium
  and webkit, every language, wide and narrow.
- Broken by hand, one at a time, each red and green restored: the
  index's Listing left out (TestSearchSaidWhileTheSessionsAreFound red
  in 2.5s); the page ignoring `listing` (sessions-said 6 of 7 red); the
  MCP's local/browser guard (TestSessionsMCPOnlyForAgentsHere red); the
  server's opt in (TestSessionsServerInDiscover red); every Reads check
  on the search path, the index's and SearchSession's together
  (TestSearchSaidLeavesOutAgentsNotRead red). With those gone the
  gateway-mode GUI test stays green, because the sessions listing
  leaves an unread agent out before the index sees it.
- Real use, in a sandbox HOME with GOPATH, GOMODCACHE and GOCACHE
  pinned, over the real history through symlinks (29 GB Claude Code,
  60 GB Codex, 14,102 sessions), sessions reads set to all in the
  sandbox: first listing ~60s cold (answers say still being found),
  whole index built in 9m50s while queries answered in ~6s each, index
  38 MB, a common word 4.9s and a rare word 1.0s warm, read_session at
  the words of a huge session 1.8s, peak footprint 442 MB for the whole
  process with the sessions cache. Nothing was written under the real
  ~/.claude or ~/.codex.
- The real binary end to end on mote, in a sandbox HOME: `magpie serve`
  on a free port and `magpie mcp sessions` over stdio with
  MAGPIE_GATEWAY, against a Claude Code session written there:
  initialize, tools/list, search_sessions found it with its snippet,
  read_session at the words started 3 messages before them, a word
  nowhere said "No session says", and a POST with a web page's Origin
  was refused 403. That run is how "1 sessions say" was found and
  made "1 session says" (TestSessionsMCPSearch red before, green after).

Not tried: a real agent (Claude Code, Codex) calling the server it was
given from the Library, and the page against a real backend (the GUI
tests fake the API). The index on Windows and Linux ran only through
the Go suite.
2026-11-16 07:19:18 +08:00
yetone 103eff4d44 routing: a group's model is dragged by its row, not only by its number (NovaStudiosss on X)
NovaStudiosss on X: "the models added to a routing group should be
draggable with the mouse; I move them often and Up/Down each time is
not handy enough". A member could already be dragged since 4dab45e3f,
but only by its number, whose grip shows on hover; the number reads as
a label, so the reporter only found Up and Down.

Now the whole row picks the model up too: its logo, the room around
its words and the row's own background, through the same dragRows the
number uses (one commit to moveMember, the same order saved as before,
so the gateway routes in it: members/placed in /api/groups/save as
group-member-drag already checks). The row shows a grab cursor. A press
on the model's name still selects its words, as the accounts' rows do
(the editor keeps them selectable, jiabubu), and its switch, number,
effort, weight, Up/Down and remove stay controls. The row has
touch-action pan-y, so a finger on it still scrolls the page; the
number keeps touch-action none for a finger's drag. The grip still
shows on hover only. No new strings, no new motion (the drag's lift
and shifts are dragRows', reduced motion as before).

Run (pushed tree's assets = this commit on 65e3dfa95):
- group-member-row-drag.test.cjs (new): Chromium and WebKit, en, zh,
  zh-TW, ja, de, at 1100px and 420px, 20 of 20 on mote. With
  origin/main's assets (MAGPIE_ASSETS) it is red: the cursor check,
  and with that check taken out the logo drag moves nothing
  (["one","two","three"] for ["three","one","two"]), both engines.
- group-*, routing-*, rt-*, route*, i18n*, strings*, click-scroll and
  core-* GUI files (250 files, 4008 tests) on mica under load: 18 red
  in 6 files. Rerun alone at concurrency 1, here and on an origin/main
  65e3dfa95 worktree: the same 17 red in 5 files on both, all filed:
  group-editor-selected (#5049), routing-pin-away (#6512),
  routing-row-swap (#3799), routing-signin (#6520),
  routing-story-shrinks (#3954). group-member-weight's webkit de 420
  1px red (#2387) passed alone.
- go test -tags nogui ./internal/gui/ on mote: ok.

Not tried: a real touch screen (the touch-action values are checked,
not a finger), and the Linux WebKitGTK app.
2026-11-16 06:44:38 +08:00
yetone 65e3dfa957 LESSONS: a byte-for-byte stream check allows SSE comments, and its message counts against what it compared
From fff0755b5. TestPassthroughResponsesBigLastEvent's macOS red was a
held stream's keepalive. Its message counted the extra bytes against the
raw reply instead of the expected one, and named 17 where there were 12.
Docs only; nothing run.
2026-11-16 06:02:05 +08:00
yetone fff0755b58 gateway: TestPassthroughResponsesBigLastEvent leaves a held stream's keepalive out of its comparison
On macOS CI at 2d106b5c1 (job 132940460364) the test failed with "200, 17
bytes added" after taking 5.83s. That is past keepHeldEvery (5s), so the
held stream's agent got one ": keepalive\n" comment. A comment at the start
of a line is no change to the reply, and every SSE client skips it.

The "17" was itself wrong. The message counted against the raw reply, not
the expected one, which has "m1" renamed to "fake/m1" (5 more bytes). The
real difference was 12 bytes, exactly one keepalive line. The test now
drops only keepalive comments at a line's start, then compares byte for
byte. When it fails, it names the byte where the bodies part and what is
there on each side.

Run (mote, at origin/main e34228669):
- Probe that sets keepaliveEvery and keepHeldEvery to 1ms and
  keepHeldAfter to 0, then calls the test. The old test was red 3 of 3
  with CI's exact message ("17 bytes added"). The new test was green 3 of
  3. A slowly streamed variant counted 1 keepalive and 12 bytes extra,
  and its body equals the expected one once the keepalive is dropped. The
  probe is not committed.
- go vet ./internal/gateway: ok.
- go test ./internal/gateway -run 'Passthrough|Severed|CutMidLine|CutAfter': ok.

Not run: the whole gateway package or the full suite. This is a change to
one test's comparison, with no product code touched.
2026-11-16 06:01:50 +08:00
yetone e34228669c library: agy's GEMINI.md is no longer emptied by Antigravity's app switched off
vizmoe42 on X (v0.1.4271): Library -> Instructions had agy CLI's
GEMINI.md switched on, but ~/.gemini/config/GEMINI.md held nothing.

agy and Antigravity's app share that file (and its folder). With the
built-in agy the targets run agy first, then Antigravity; agy wrote its
part and the unticked Antigravity row, wanting nothing, took it out
again, leaving the file empty or gone. The unticked row also showed
"edited". With agy on its plugin the order is reversed, so it worked by
luck there.

syncInstructions now takes every target. A file another target reads
too belongs to the one switched on (instrOwner): the others leave it
and drop their own record. The Edited check compares against that
owner's text (wantedIn). The path itself is right: agy 1.5.9 reads
~/.gemini/GEMINI.md, ~/.gemini/AGENTS.md and their config/ copies
(binary strings and `agy changelog`, sandbox HOME). MCP and skills in
the shared folder already behaved; probed, unchanged.

Existing users: agy's record says written but the file has no block,
so the next start-up Sync writes it, without switching anything again
(covered by the test).

Run:
- TestAntigravitySharedInstructionsFile (agy and antigravity subtests),
  red on the old code (file empty after the switch; agy row Edited),
  green with the fix, on mica.
- go vet ./internal/library; go test -count=1 ./internal/library
  ./internal/gui ./internal/tui ./internal/cli: all ok on mica.
- At the pushed head (rebased on e47abdf46, no library change upstream):
  GOOS=linux and GOOS=windows go vet ./internal/library and the
  library's Antigravity and Instruction tests, ok on mote.
- gofmt -l clean.

Not tried: a real agy session reading the written file; Windows or
WSL; the GUI clicked by hand (no GUI file changed).
2026-11-16 04:50:30 +08:00
yetone e47abdf468 usage: the allowances' trend takes any last N days; a curve's hover reads the exact numbers
shangyuan0818 on X asked for exact numbers on the Overview's quota
curves when hovered, and for the trend to take any "last N days".

- Usage → Overview, the allowances' "Trends: …" button: the menu now
  has 7 days and 30 days beside Off, 2 days and Cycle, and "Other number
  of days…", which turns the button into a field for 1 to 45 (the days
  of history magpie keeps). Enter or leaving the field keeps it; Escape
  leaves the range as it was; a number out of range says so and keeps
  the old one. A custom N stays in the menu, and is kept across a reload
  (magpie.quotaRange).
- Hovering a quota curve shows a small tip at the reading nearest the
  pointer: when it was read, then each window's left to two decimals
  (70.46%), with a hairline at that time. A balance curve shows the
  balance in the card's currency. The curve's own tooltip (what the
  dashes mean) waits while the tip shows. A touch still zooms, as before.
- The trend menu, the days field and the hover live in the usage
  plugin's page.js, so app.js stays inside its budget.
- No animation: the tip follows the pointer, which a movement would lag.

Run, at d597b4d01 + this change, on mote and mica:
- quota-trend-days.test.cjs (new), 5 languages x 2 engines: red on
  2d106b5c1 ("7 and 30 days are offered"), green 10/10.
- The 18 GUI files that draw or pick the allowances' curves, i18n-keys
  and i18n-en-no-cjk, plus usage-exact-cost and quota-holds: 201 pass. The 6 reds are red alike on origin/main 2d106b5c1, each filed:
  quota-curve's "quota cards draw what was left over time" (#6789) and
  usage-fold's "17 subscriptions and 29 accounts" (#3415, #6003).
- go test ./internal/gui: ok (app.js 228 bytes inside appScriptBudget)

Not tried: Windows (WebView2) and the panel's Allowances tab by hand, a
real account's history, a touch screen.
2026-11-16 04:45:45 +08:00
yetone d597b4d010 usage: a priced cost without "≈", at least two decimals; cache hit rate to two
shangyuan0818 on X: Usage → Requests showed every cost as "≈$…", and
the cache hit rate with one decimal.

- A cost from known prices is what magpie counted, so "≈" is gone from
  every priced cost: Requests' Cost card and tiles, the agent, model and
  account rows, the quick panel's Usage, Routing's live rows. An estimate
  keeps it (a window's whole on an account card, a session file's times).
- fmtCost gives at least two decimals ($1.00, $100.00, $2500.50), three
  under $1 as before, and a sub-mill amount to its first two digits
  ($0.00040, $0.000012) instead of $0.000.
- Requests' Cache hit rate card has two decimals (93.97%); hitPct still
  never rounds up to 100% or down to 0%.
- A whole-window estimate from $100 up stays whole ($1235): its cents
  would claim a precision it hasn't (wholeCost, moved to page.js to keep
  app.js inside its budget).

Run, at 2d106b5c1 + this change, on mote (rebased onto fc41381d6,
whose three commits touch nothing under internal/gui):
- usage-exact-cost.test.cjs (new): red on 2d106b5c1, green 12/12.
- The 91 GUI files that read a cost or a hit rate, both engines, every
  language. Reds beside this change's own (fixed: mobile-web,
  panel-currency-provider, ledger-cache-unknown, usage-ledger-chart) are
  red alike on a 2d106b5c1 checkout, each filed: grip-inset #6293,
  key-balance-card de #6414, usage-cards-hide #6294,
  usage-hidden-way-back #6295, quota-curve #6789, old-webkit #6030,
  tray-cell-click #5215, usage-ledger return-to-live #4078, usage-upload
  #6743, zero-priced-free #5262.
- After the test fixes: mobile-web, panel-currency-provider,
  ledger-cache-unknown, usage-ledger-chart, usage-exact-cost, quota-holds,
  usage-unpriced-sum, currency, i18n-keys: 112 pass. The 14 reds are red
  alike on a 2d106b5c1 checkout: usage-ledger-chart's "metric is
  remembered" (filed in #6790) and mobile-web's "desktop matches
  origin/main", which needs git in the copy (mote-run has none; #5013).
- go test -run Budget ./internal/gui: ok (app.js inside appScriptBudget)

Not tried: Windows (WebView2), the reporter's own data, a real account.
2026-11-16 04:38:36 +08:00
yetone fc41381d60 LESSONS: a docs page change left llms-full.txt stale a second time (256910f17)
Under the 11-13 entry for 459d668b3. Docs only; nothing run.
2026-11-16 04:33:57 +08:00
yetone 25ad34f425 site: llms-full.txt carries 256910f17's Antigravity line
256910f17 changed the Antigravity entry in the site's subscriptions docs
and left public/llms-full.txt as it was. That push's own CI run was
cancelled by the next one, so the stale file first showed at 2d106b5c1:
cli (linux/amd64, nogui), "seo: llms-full.txt is current", red. This is
`node llms-full.mjs` run in site/; the only change is that one line.

Run on mote at this head (origin/main d6ca7d822):
- node llms-full.mjs in site/, the output copied back.
- node --test site/*.test.mjs from the repo root, as test.yml runs it:
  132 tests, 132 pass.
2026-11-16 04:33:31 +08:00
ggbdpq d6ca7d8225 edit: the big-TOML ratio test gives both sizes the same CPU (#4109)
99299c7b1 keeps the fastest of five parses per size, and on a runner at
load ~200 that still went red: 8 MB read 32.8× the 1 MB one's time, past
the bound of 24. The two minima come from different scheduling weather —
the short 1 MB parse dodges preemption while the 8 MB one is descheduled
— so a linear parse can read near the quadratic 64×.

parseTOMLRatio now spends the same CPU on both sides of each round:
eight 1 MB parses (the sizes differ 8×, so that costs about what one 8 MB
parse does) against one 8 MB parse, three rounds, the smallest ratio
kept. A loaded runner slows both sides alike and the ratio stays near the
linear 1×; a parse growing with size squared would cost 8× the small
budget, so the bound of 3 leaves about 3× on both sides.

Run on darwin/arm64, at this tree:
- Injected contention (busy goroutines sharing one P, 4× and 8× over-
  subscribed): the old fastest-of-five shape read 30.9 and 58.8 (red past
  24); parseTOMLRatio read 0.74–0.98 across 4 runs, green.
- Tooth: tomlShaper reverted to counting every key's line from the top of
  the file (the quadratic pass 2a4042a9 removed): red, "an 8 MB file cost
  8.1× the eight 1 MB parses (1m31.2s against 11.3s): near the 8× of size
  squared, not the 1× of size". Reverted: green.
- go test -tags nogui -run TestTOMLBigFileParsesInLinearTime -count=3
  ./internal/edit: ok.

Generated-by: GLM-5.3-Flash (ZCode)

Reviewed and run again by the maintainer on mote at 2d106b5c1 with this
commit on top (500f39886's CI run went red on the old shape: 31.9× on
macos-latest):
- -run TestTOMLBigFileParsesInLinearTime -count=5: 5 of 5 ok.
- go test -tags nogui ./internal/edit: ok.
- 72 `yes` processes on 18 cores, -count=5: new shape 5 of 5 ok. The old
  shape was also 5 of 5 ok under the same burners, so this load did not
  reproduce CI's red; the injected-contention numbers above are the
  contributor's.
- Tooth: tomlShaper's sort.Search replaced by a linear scan from the top:
  red, "an 8 MB file cost 6.8× the eight 1 MB parses (1m0.9s against
  8.9s)". Restored: green.
- gofmt -l internal/edit: clean.
Not run: the full suite (a test-only change in one package), Windows/Linux.
2026-11-16 04:30:48 +08:00
yetone 2d106b5c1a LESSONS: a gone check that looks past made-up text moves into the code standards
Seen a third day: on 11-15 TestMoreKinds' "ops" was in the made-up
user name zpxopsat (ubuntu CI at 500f39886, #4345), after 10-10's
placeholder suffix and 11-10's port and route_id. The rule is now a row
in docs/code-standards.md's Tests table, and LESSONS.md lists it under
"Moved to the code standards". Docs only; nothing run.
2026-11-16 03:38:48 +08:00
yetone 8765ca1758 redact: TestMoreKinds' gone check looks past the made-up user name (#4345)
TestMoreKinds checks that each masked value is no longer in what is
sent, after taking out the {{KIND_…}} placeholders. A user name goes as
a made-up name instead, eight lowercase letters from a key that is new
each run, and that name can spell a short user name: on ubuntu CI at
500f39886, "ops" was still in "scp a.txt zpxopsat@{{HOSTNAME_…}}". The
check now takes out the made-up name for the value first; the test
still checks separately that the made-up name is what was sent.

The other tests that check a user name is gone use names of eight or
more letters (developer, rinakato), which eight random letters spell
with odds around 26^-8, so they are left as they are.

Run on mote at this head (origin/main 256910f17):
- A probe test searched for a key whose made-up name for "ops"
  contains "ops" (key 2207: dopsubnz), set it, and ran TestMoreKinds:
  red with the old check ("ops" still in "dopsubnz@…", CI's red), ok
  with this one. The probe is not committed.
- go test -count=1 ./internal/redact: ok. gofmt -l clean.

Fixes #4345.
2026-11-16 03:38:48 +08:00
yetone dd77094ca2 gui: on Windows the header is the window's title bar (258a14 on X)
With a wallpaper, Windows' main window had a white native title bar over
the page, cut off from it ("内容区域和标题栏有割裂感"). On Windows the main
window is now frameless (mainFrameless), as the Mac's header already is
the title bar: the page and its wallpaper run to the top edge. Wails v3's
frameless window keeps WS_OVERLAPPEDWINDOW, so the shadow, Windows 11's
rounded corners, snap (Win+arrows, drag to an edge) and Wails' resize
edges stay. The header draws minimise, maximise/restore and close at its
right (#wincap, wincap.js, imported in that window alone), Windows-sized
with Segoe Fluent Icons, in the theme's colour, Close red on hover
(.1s ease); the header's refresh and pin sit left of them and stay
no-drag. A double click on what drags the window maximises or restores
it. The app tells the page when the window is (un)maximised (captionJS),
which swaps the glyph and its tooltip and keeps Wails' resize edges off
while maximised so the corner pixel is Close's. The buttons stay over a
dialog's scrim (wincap.js undoes modalBackground's inert on them). The
Mac, Linux, the tray panel and the web page are unchanged.

TestCoreScriptBudget: +27 on both budgets for the one import line in
app.js, past the 29 bytes of room there were; the rest lives in
wincap.js and app.css.

Run (mote, at this tree on origin/main 256910f17):
- gofmt -l clean; go vet ./internal/gui, GOOS=windows go vet
  ./internal/gui, go test -count=1 ./internal/gui: ok.
- Linux: go vet -tags gtk3 ./internal/gui on WSL magpie-desktop: ok
  (at the tree before the rebase).
- GUI: win-caption (new), brand, header-centre, header-zoom-fit,
  i18n-keys, modal-backdrop, providers-withdrawn, text-size,
  sidebar-overlay-scrollbar, both engines, every language: 125 ok,
  7 red, all red on origin/main too: header-centre webkit (#3479),
  modal-backdrop Linux window/panel (#6663), text-size webkit (#6561).
- A 47-file run of every GUI file the header, modal or Windows path
  reaches (mica, before the rebase): the same reds plus mobile-web
  (no .git in a run copy, #5013) and sidebar-overlay-scrollbar de
  webkit once (#1863, commented).
- Whole GUI suite (mica, load ~99): started at the pre-rebase tree and
  synced to the rebased one mid-run, so it isn't a clean record. Its
  reds in 28+ files match main's: 10 of those files alone on mote give
  the same 121 of 218 red at origin/main 256910f17 and at this tree
  (#6709, commented).
- Windows 11 on xiaomi-gpu, built from this tree, sandbox USERPROFILE,
  port 3461: screenshots light/dark with and without a wallpaper, and
  maximised; double click on the bar maximises and restores, max/restore
  and min buttons work (IsIconic true after min), Win+Left snapped to
  half the screen, Win+Up/Down maximise and restore.

Broken by hand: win-caption is red on the old assets (5 of 5 cases);
without wincap.js's MutationObserver it is red 10 of 10 ("the caption
buttons aren't" inert); #457's +0.5 in fitTop turns header-zoom-fit red.

Not tried: Windows 11's snap-layouts flyout over maximise (it needs
Wails' composition hosting, not shown); dragging the window and its
resize edges with a real mouse (a firewall prompt of another session's
magpie dims the desktop and swallows input; buttons and double click
were driven through CDP instead).
2026-11-16 03:37:02 +08:00
yetone 256910f174 plugin: Antigravity's plugin keeps serving whoever has it, and is given to nobody new
The owner (11-15): "正在使用的继续正常,加个提示,新用户不让下载". Google
suspends accounts it sees on Code Assist through Antigravity's own client,
so 9cd5f3652 retired the plugin outright (0.2.0 answered every request with
a 410). Now its users keep it working and are told the risk; nobody new
gets it.

- internal/plugin/withdrawn.go: a list of withdrawn packages (Antigravity's,
  pointing to agy-cli). plugin.Add, the one place the CLI, the GUI,
  Discover and import links install through, turns a withdrawn package
  away unless this magpie has it listed already (on or off), and says
  what to use instead. Upgrade and AddExact (backup, sync) are not gated:
  they act on a plugin the user has.
- The mover installs it for the user's own accounts (move,
  keepMovedCurrent) under plugin.KeepWithdrawn; Adopt, which brings no
  accounts, is a new user and is turned away. Antigravity's min is 0.2.1,
  plugins c0c625ac: the 0.1.18 plugin restored, out of the registry.
- /api/providers lists the withdrawn plugins kept in `withdrawn`, and the
  Providers page draws a line over the list: the risk, why, and "Use
  Antigravity (local agy CLI)", which opens Plugins on "agy". New strings
  in zh, zh-TW, ja and de. depLine() now draws all three kinds of
  Providers line (discovery off, unmoved, this one), which keeps app.js
  inside its budget without a raise.
- AGENTS.md, provider-plugins.md and the site's subscriptions docs (en,
  zh, ja, search index) say the plugin keeps working for its users and
  is withdrawn for anyone new.

Run on mote at this tree (base 52e83f7b5). After the rebase onto
500f39886 (testenv, qianfan, LESSONS upstream), again at this head: go vet
and go test -count=1 of internal/plugin, internal/provider, internal/gui,
internal/testenv and the root package, all ok. Before it:
- go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet of
  internal/plugin, internal/provider and internal/gui: ok. gofmt -l clean.
- go test -count=1 ./internal/plugin ./internal/provider ./internal/gui
  (whole packages, TestCoreScriptBudget and the i18n guards in them): ok.
- node --test providers-withdrawn (new; chromium and webkit, en zh
  zh-TW ja de, 1100 and 420), deprecation-notice, plugin-move,
  plugin-move-overflow, retired-move, deprecated-subscriptions, i18n-keys,
  providers-discovery-off, plugin-movable-review, providers-off-fold: ok.
  plugin-move-unserved's 'Try again takes the models unticked' is red 4 of
  4, the same at origin/main 500f39886 alone: #4410.
- Broken by hand: without RefuseWithdrawn in Add,
  TestWithdrawnGivenToNobodyNew goes red (Add goes on to install); without
  KeepWithdrawn in move, TestWithdrawnPluginKeptForItsUsers goes red (the
  user's own move is turned away).
- Plugins: bun scripts/check.mjs all and bun test packages/antigravity
  packages/agy-cli scripts, 195 pass; dist index.json has 0.2.1.

Not tried: a real Antigravity account through 0.2.1 (it is 0.1.18's code,
which served until 11-15), and the CLI/TUI show no notice beyond Add's
refusal.
2026-11-16 03:00:18 +08:00
yetone ff6f6337f1 sessions: the kept parses are written binary, not JSON
The Sessions and Usage index (sessions.json, ~18k files on a long
history) was JSON. Every start decoded all of it through reflection,
and every save, which happens at most once a minute while a session is
live, marshalled it whole again. It is now a compact binary form
(cache_binary.go):
- A magic and a version header.
- Then length-prefixed records, varints for the numbers.
- Interned names, as the JSON path interned them.
- The rare nested parts (Claude Code's window, a Codex identity,
  StateMore) as JSON blobs.
Records are decoded in parallel.

A JSON index from an older magpie is still read. loadCache saves it
again at once, so it turns binary on the first start even when no
session changed; before, a save came only after a file changed.

A binary file is refused whole, never half read: when it is cut
anywhere, has a byte added, or is of another zone or version. That
means one full read again, as a refused JSON file meant before.
TestCacheBinaryKnowsEveryField fails when state, day or Tokens gains a
field that the binary form doesn't carry.

On the real acctp history, on mote (18,346 files):
- The file is 14.8 MB, down from 23.3 MB.
- Decoding takes 19 ms, down from 69 ms, and allocates 28 MB, down
  from 58 MB.
- Encoding takes 10 ms, down from 98 ms, and allocates 3.1 MB, down
  from 32.5 MB.
- The heap kept after decoding is the same: 24 MB.
- /api/sessions from a w94 build on the binary index and from a w92
  build (before) on the JSON index answer the same bytes (5000
  sessions). Neither rewrote the index.
- The page-open footprint peak was 152 to 214 MB on both builds at
  load 60 to 80. It is too noisy to claim a change.

Run:
- mica-run go test -count=1 -timeout 45m ./internal/sessions
  ./internal/usage ./internal/gui: all ok.
- GOOS=linux and GOOS=windows go vet ./internal/sessions
  ./internal/usage: ok. go vet ./internal/sessions: ok.
- gofmt -l: clean.
- TestCacheBinaryRefusesBadFiles cuts the file at every length, adds a
  byte, changes the zone and the version, and flips every byte; it
  checks that a bad file is never accepted and never panics.

Broken by hand:
- The decoder skipped Provider: TestCacheBinaryIsJSON went red.
- loadCache stopped re-saving a JSON index:
  TestCacheJSONRewrittenOnStart went red, the file still JSON.

At the pushed head (rebased on 500f39886): go test ./internal/sessions
./internal/testenv ok.

Not tried: Windows and Linux runs of the package; the mapping read is
shared code and unchanged there.
2026-11-16 02:58:09 +08:00
yetone 500f39886e testenv: a package's own run fails on a package-level regexp it compiles at launch
TestNoEagerPackageRegexps lives in the root package, and a change runs
its own packages, so the guard went red on main on six days: #6020,
#6145, 4847a087f, 10e783080, 7869a454c and today 8f3f7a46a (fixed in
022ffd09e). LESSONS.md asked on 11-12 for the check to run where the
work already runs; writing the rule again hadn't held.

testenv.RunIn (every testenv.Main/Run TestMain, 65 packages, provider,
gui, update, library and catalog among them) now checks the package's
own non-test files after its tests and exits 1 naming each pattern. It
runs on a `-run` of one test too. The parsing moved into
testenv.EagerRegexps, which the root guard now calls, so both read the
same rule. A child test binary (Marker set) doesn't check again.

Run on mote at this tree (origin/main 022ffd09e + this):
- go test -count=1 ./internal/testenv .: ok (TestEagerRegexps new:
  lines 5 and 8 listed; a func's, a func literal's and lazyre.New not)
- Broken by hand: zz_probe.go with `var eagerProbe =
  regexp.MustCompile("x")` in internal/update; `go test -run
  TestNothingMatchesThis ./internal/update` FAIL with "testenv: a
  package-level regexp is compiled at launch; use lazyre.New:
  zz_probe.go:5:18"; removed, ok.
- GOOS=windows go vet and GOOS=linux go vet -tags nogui of
  ./internal/testenv and .: clean
- gofmt -l: clean
Not run: every testenv package; the root guard passing at this tree
says none of them has such a pattern, so none fails on the new check.
2026-11-16 02:42:56 +08:00
yetone 022ffd09ec provider: Qianfan's cURL cookie patterns compile when first used (TestNoEagerPackageRegexps)
8f3f7a46a added two package-level regexp.MustCompile in
qianfan_plan.go, so the root package's TestNoEagerPackageRegexps went
red on ubuntu CI (run 43743744465): "a package-level regexp is compiled
at launch; use lazyre.New". Its run record named internal/provider,
internal/gui and internal/cli, not the root package, where the guard
lives. Both are lazyre.New now, as every other package-level pattern is.

Run on mote at this tree (origin/main 52e83f7b5 + this):
- go test -count=1 -run TestNoEagerPackageRegexps .: ok (red at
  8f3f7a46a on CI, the two lines above)
- go test -count=1 -run Qianfan ./internal/provider ./internal/gui: ok
- gofmt -l: clean
Not run: the whole suite; the change is the regexps' type only.
2026-11-16 02:39:59 +08:00
yetone 52e83f7b58 provider: Devin's plugin is at least 0.1.44, for long conversations
a1pha1nthefog on X: a long session through Devin answered "There is an
issue with this request, please try a different model" on every turn.
Devin's plugin 0.1.44 (magpie-community/plugins 1260b2ba, on npm) sends
a picture as the type its bytes are, drops a white-space user prompt,
sends turned-away signed thinking again unsigned, and past half the
window answers the refusal as "input is too long", which the gateway
already turns into a compaction. Raising the mover's min brings every
moved user onto it (keepMovedCurrent).

Run on mote at 91d309f7a (rebased on 8f3f7a46a): go test -count=1
./internal/provider ok (144.3s), gofmt -l clean. The plugin's own record is in its commit.
Not tried: the full magpie gateway end to end with the new plugin.
2026-11-16 02:08:40 +08:00
yetone 8f3f7a46af provider: Baidu Qianfan's Token Plan Personal shows its month through a console sign-in (yuushabu_buyinn on X, #5860)
A Qianfan Token Plan key tells nothing of the plan's usage: Qianfan's
OpenAPI has no read for it, and the console's own page asks
console.bce.baidu.com/api/qianfan/charge/tokenPlanPersonal/resource with
the signed-in cookie. So the plan is read as StepFun's Step Plan is: the
editor of a provider at qianfan.baidubce.com/v2/tokenplan/personal has a
"Token Plan usage" field, drawn by the same renderStepPlan (now told
whose sign-in it brings) from qianfanplan.js, imported when such an
editor opens. The bookmarklet, run on the console, checks the session
with that same request and copies the console cookie; a raw Cookie
header or a copied cURL is taken too, since document.cookie leaves out
HttpOnly cookies. The paste is checked with a real read before it is
kept, by provider id, in qianfan-auth.json (0600, lastgood-guarded,
moved and dropped with the provider). POST /api/qianfan/{id}/session and
/signout serve it.

The Usage page's card (qianfanPlanQuotas in PlanQuotas) is the running
plan's credits (billingMode credit) or tokens as one Month window up to
expiresAt, the plan's tier as its name and auto-renew beside it;
released and past plans are skipped, and routing reads the same windows
(accountPlanWindows). A redirect, 401, 403, an HTML page or a refusal
naming the login is a signed-out session: an error card saying so, never
0 left; any other failure is an error card too, the last reading kept
only on a passing network error. The per-plan apiKey in the console's
reply is never kept, logged or shown.

Not done: the Enterprise (team) plan has no card. The console has no
tokenPlanTeam/resource; it reads team plans through seat and admin APIs.

Not tried with a real account: no one here is signed in to Baidu Cloud's
console, and #5860 has no reply bytes posted. The fixtures follow the
field names in the console's own script bundle and in the
dsh-qianfan-token-plan reader (planType, resourceStatus, billingMode,
usedCredits/totalCredits, usedTokens/totalTokens as numbers or strings,
expiresAt, autoRenew), not a captured reply.

core budget +35 (app.js and core): the field moved to qianfanplan.js;
what is left in the core is the import and two quotaError lines.

Run (at the pushed tree, rebased on origin/main 8df7885d4):
- mote: go test -count=1 -timeout 45m ./internal/provider ./internal/gui
  ./internal/cli: ok (provider 279s, gui 209s, cli 113s)
- mote: GOOS=linux and GOOS=windows go vet of the three (linux with -tags nogui): clean
- gofmt -l internal/: empty
- mica: node --test qianfan-plan, stepfun-per-provider, qianwen-plan,
  i18n-keys, i18n-en-no-cjk, old-webkit (Chromium and WebKit, en and zh;
  i18n-keys over zh, zh-TW, ja, de): 40 of 42 pass. The two reds are
  old-webkit's headerpresets.js (#6030) and app.css :has() (#5919), the
  same on origin/main 8df7885d4, run there.
- Red before: qianfan-plan.test.cjs on origin/main 8df7885d4, 4 of 4 red
  (no field). Broken by hand on mica: with a
  redirect not read as signed out and Released not skipped,
  TestReadQianfanPlan, TestSaveQianfanPaste and TestQianfanPlanCard go red.
- Not run: the whole Go suite and the whole GUI suite.
2026-11-16 01:54:28 +08:00
yetone 8df7885d48 gui: an agent's current model, lifted to the top of its picker, says whose it is when another provider lists a model by the same name
ADNANYURTSEVER3 on X (Mac, macOS 27.2.1): with WorkBuddy and WorkBuddy AI
both serving Hy4 and DeepSeek-V4.1-Flash (WorkBuddy AI spells it
Deepseek-V4.1-Flash), the Agents page's picker showed WorkBuddy AI's
section with Hy4 alone, while dsh listed and ticked "Deepseek-V4.1-Flash ·
WorkBuddy AI".

Cause: not case handling. buildVia and the catalog keep both spellings
apart (checked with a probe test in internal/agent, not kept). openPicker
lifts the agent's current model out of its section to the top of the list
(#1229). There its note named only the account. With WorkBuddy's
DeepSeek-V4.1-Flash, a model of the same name, under the same icon, the
row on top could not be told apart, and WorkBuddy AI's section read as if
magpie had dropped the model.

Fix: when another provider lists a model by the same name, in any case,
the lifted row's note now starts with its provider ("WorkBuddy AI ·
b@…"). The rail's own provider view leaves the name out, since its
section already says it. Pickers with no such clash are unchanged.

A first try listed the current model both at the top and in its section.
It broke the "each model once" and "current first" contracts of
claude-picker-fold, claude-picker-magpie-first and others, so it was
dropped.

Siblings:
- The tray panel uses the same openPicker.
- The Routing member picker and modelfind do not lift the current model.
- The TUI's withCurrent lists the current row by its full value
  (magpie/workbuddy-ai/…), which names the provider.
- dsh already names the provider on every row.

Run (on mica via mica-run):
- New internal/gui/tests/picker-current-in-section.test.cjs: chromium and
  webkit, en/zh/zh-TW/ja/de, 1000 and 440px.
  - Red on origin/main, 20 of 20 ("it says whose it is: b@example.com").
  - Green with the fix, 20 of 20.
- Picker files at the change: picker-rail-current, claude-picker-fold,
  claude-picker-magpie-first, agent-path-same, codex-accounts-via,
  searcher-pick, images-codex-one, video-gen-pick.
  - 150 of 156 pass.
  - The 6 reds (images-codex-one and video-gen-pick, "reading 'x'") fail
    the same on origin/main f9807c5e8 and are in #6709.
- codex-memories-settings, desktop-tiers, fast-pick, fast-ultra,
  menu-scroll, mobile-web, omp-roles and zero-priced-free: no test went
  red that was not red on origin/main f9807c5e8 too (#6709, #6201, #5262,
  #6432).
- At the pushed head (rebased on 9e627c507): go test ./internal/gui, plus
  picker-current-in-section, picker-rail-current, claude-picker-fold,
  claude-picker-magpie-first and i18n-keys: go ok (135s), GUI 76 of 76 pass

Not tried: the real app with the reporter's two WorkBuddy accounts, the
Linux WebKitGTK app, and a whole GUI suite.
2026-11-16 01:42:40 +08:00
yetone 9e627c5079 claudetui tests: a deadline case cut off before its screen was drawn runs again (#5429)
The retry ported from Fldicoahkiin's 165e33d89 (the commit before this)
reran a case only when the helper said "showed no prompt". The "banner,
no /usage panel" case, added after that fix was written, can be cut off
one step later on a loaded machine: Claude Code is up, "/usage" is
typed, and the deadline comes before the banner is drawn again. The
helper then says "hadn't drawn /usage's panel in the 6s …: ❯ /usage",
the right words with none of the case's screen, and the case failed.
With FAKE_SLOW_START=3500ms it was red 2 runs of 2 at the ported commit.

A case with a screen of its own now runs again, with twice the time up
to 12s, whenever that screen isn't in what the helper said; a case with
none (no prompt, no /usage panel) as before, on "showed no prompt". One
whose screen is there with the wrong words still fails at once.

Ran at this head (origin/main 3173c4f41 + 165e33d89 + this), on mote:
- go test -count=1 ./internal/claudetui: ok (195s)
- FAKE_SLOW_START=3500ms go test -count=3 -run
  TestShimEndsAtItsCallersDeadline: ok (203s)
- wsl-run: the test, and again with FAKE_SLOW_START=3500ms: ok
- gofmt -l internal/claudetui: clean
The full go test ./... at 30de93e9e had this test red (no_/usage_panel,
"nothing on its screen (0 bytes read)"), the shape #5429 names.

Broken by hand: the retry capped at 3s, with FAKE_SLOW_START=3500ms:
all 7 cases red; restored, green.

Not tried: Windows (the test needs a pty).
2026-11-16 01:36:46 +08:00
Flacier f3a758b734 claudetui tests: a deadline case run before Claude Code was up runs again with twice the time
TestShimEndsAtItsCallersDeadline gave each case a deadline 3s after it
started the helper. Every case but "no prompt" is about what Claude
Code draws once it is up (the trust question, the Bypass Permissions
disclaimer, /usage's panel), and "no prompt" wants "Starting up" drawn.
On a loaded machine the helper and the fake Claude Code, two starts of
the test binary, can take longer than that; the helper then says,
rightly, "showed no prompt in the …s its caller waits for it", and the
case failed. Seen in a full run here ("showed no prompt in the 2.8s",
no_/usage_panel, load 13-20), in #3831 (trust_unanswered) and #5079,
and as "red in the full run, green alone" in the run records of #2398,
#2845, #3430, #3435 and #3475.

- A run that ended at its deadline with no prompt shown, whose screen
  lacks what the case expects (any screen, for /usage's panel), says
  nothing of the case: it runs again with 6s, then 12s. A run at 12s is
  told as it is.
- A run whose screen has what the case expects while the helper says
  "showed no prompt" fails at once: the helper misread it.
- The duration bound follows the deadline: from 500ms before it to 12s
  after. The helper's own waits (20s, 45s) are still told apart by their
  words: "in 20s", never "in the …s its caller waits for it" (c.why).
- FAKE_SLOW_START (new): the fake draws nothing for that long, as a
  loaded machine starts it. A case with 3.5s keeps the retry tested
  ("trust unanswered, slow to start", 9s).

Timing assumptions left in the test:
- the helper and the fake are up within 12s;
- a run ends between 500ms before its deadline and 12s after it;
- runEndsTold's 30s for a run to end at all, which 12s + 12s fits.

Run (darwin/arm64, Go 1.26.8, sandbox HOME, Go caches pinned), at
8b70b7d97 with this change. claudetui's commits since the first base,
5666cb049 (77031d581, b7631300e), are /usage's panel and the tap, not
the deadline path.
- Red before: the test as on main, with FAKE_SLOW_START=3500ms in the
  environment: all 5 cases red, each "showed no prompt in the 3s its
  caller waits for it", the full runs' shape.
- With this change: no slow start ok (24s; only the slow-to-start case
  ran again); FAKE_SLOW_START=3500ms ok, each case again at 6s (54s).
- go test -race -count=3 -run TestShimEndsAtItsCallersDeadline: ok;
  go test -count=1 ./internal/claudetui: ok; gofmt -l internal/claudetui
  clean; go vet -tags nogui ./internal/claudetui with GOOS darwin, linux
  and windows clean.

At 5666cb049, before the rebase:
- Red before the same way; FAKE_SLOW_START=8s ok, the five cases on it
  again at 6s and 12s (114s; the slow-to-start case keeps its own 3.5s).
- Broken by hand: the helper never naming the trust question turns
  trust_unanswered red at 3s, its screen in the message ("Do you trust
  this folder? ❯ No, exit Yes, I trust this folder"); the retry capped
  at 3s turns trust_unanswered,_slow_to_start red.

Not tried: the test on Linux and Windows (go vet only); a real loaded
run (the slow start was injected, not met again at load 13-20).

Not changed: TestShimPastesImages and TestShimStreamsThroughTap, which
#5079 names red in the same full run. They wait on runShim's 30s, not
on a caller's deadline, and #5079 gives no output for them; not
reproduced here.
2026-11-16 01:23:02 +08:00
yetone 3173c4f41e gui test: a route the CLI's list doesn't name fails internal/gui too
TestEveryRouteHasACommandOrIsNamed (internal/cli) went red on main for a new GUI route six times in a week (#5946, #6162, #6677, #6724, #6786): GUI changes run internal/gui, not internal/cli. TestEveryRouteIsNamedForTheCLI reads the same HandleFunc routes and fails when one isn't a key in internal/cli/settings_parity_test.go, so the run a GUI change already does catches it. The CLI test still checks which command each route has. LESSONS: the 11-15 case and the rule that a check repeatedly missed goes where the work runs.

Run at origin/main ec5b96c44 plus this, on mica: go test -count=1 ./internal/gui ok (185s); TestEveryRouteIsNamedForTheCLI red with the quit/disconnect line taken out of notYet ("POST /api/quit/disconnect (api.go) isn't named ..."), green with it. gofmt -l clean. Not run: Linux and Windows vet (test-only file, os/filepath/regexp only).
2026-11-16 01:18:18 +08:00
yetone ec5b96c44f cli test: POST /api/quit/disconnect is the window's own (#6786)
261f48226 added the Quit question's Disconnect and quit route without naming it in the CLI parity list, and TestEveryRouteHasACommandOrIsNamed has been red on main since (CI at 0ffb21f83, ubuntu and macOS). It quits the app, so it is the window's own, beside GET /api/quit.

Run at origin/main f9807c5e8 plus this: go test -tags nogui -count=1 -run TestEveryRouteHasACommandOrIsNamed ./internal/cli on mote ok (red at 0ffb21f83 on CI); the whole internal/cli package on mica ok (44s). gofmt -l clean.
2026-11-16 01:12:39 +08:00
yetone f9807c5e84 LESSONS: a red claimed and left a month (#2903) is unowned
#2903 was claimed on 10-19 and came back at 139a6be2b in a second test with nothing done on it. #6368 went from "still mine" to "not taking it". Docs only; nothing was run.
2026-11-16 00:44:30 +08:00
yetone b26f16ee24 agent: Alma has one magpie provider, whichever side turned it on
realLemonawa on X: Alma has its own Magpie preset, and magpie's Alma
agent adds a provider of its own, so turning on both left two.

Alma's preset card claims the provider whose id is "magpie" (Alma
origin/main: forPredef / getProviderForPredefined, provPredefBody in
desktop-native settings_providers_detail.go). magpie's provider is now
made under that id (with the preset's icon), so Alma's card shows it set
up and offers no second one. When a provider has that id already (a
user's own elsewhere), magpie makes one as before and leaves it alone.

almaMagpie already took a Magpie set up in Alma first (same gateway
host) as magpie's, so the row showed connected and nothing was added.
What was wrong was switching off: almaSet("") DELETEd whichever
provider it had matched, the user's own preset included. Now a provider
magpie didn't make (name not "magpie") is kept: only the default model
and image refs that point at it are taken back, as before, and it is
turned off again only if it was off when magpie turned it on
(alma.wasoff in the stash). Sync no longer rewrites its model list after
the switch-off.

Tests: TestAlmaOneMagpie (internal/agent/alma_test.go), against the
fake Alma, whose POST now honours an id and answers a taken id with
Alma's 500 "UNIQUE constraint failed":
- set up in Alma first: connected, no second provider, switch-off sends
  no DELETE, the preset stays on, sync after off writes nothing
- turned off in Alma: enabled on connect, disabled again on switch-off
- none in Alma: created under id "magpie", removed on switch-off
- preset id taken by another host: left alone, a new one made

Red on the old alma.go: "the user's own Magpie was removed:
[PUT /api/settings DELETE /api/providers/magpie]". Broken by hand:
without the id, "none in Alma" fails ("not under the preset's id");
without the Sync skip, "sync after off wrote [PUT
/api/providers/magpie/models]".

Real Alma (alma-server from /Applications/Alma.app, sandbox HOME and
ALMA_DATA_DIR, port 23917, never the live one): the preset's own POST
body creates id "magpie"; a second POST with that id is refused
500 UNIQUE constraint failed; PUT {"enabled":false} turns it off; DELETE
204; magpie's POST body with id "magpie" and type openai is kept as
sent.

Run at this tree (rebased on origin/main 0ffb21f83), on mica:
go test -tags nogui -count=1 ./internal/agent ok (199s); go vet -tags
nogui ./internal/agent for darwin, linux and windows ok; gofmt -l clean.
The full suite is queued on mote behind another session's run and was
not waited for; a red there gets its own issue.

Not tried: magpie's agent end to end against a running Alma (the calls
were replayed with curl). A user who already has both (magpie's old
random-id provider and Alma's preset) keeps both: threads name
"<id>:<model>", so neither is merged or removed for them, and magpie's
old provider keeps its id.
2026-11-16 00:23:37 +08:00
yetone 0ffb21f833 lessons: a request the page sends on its own is looked for in every GUI test that counts requests (#6709) 2026-11-16 00:13:24 +08:00
yetone 38e60d7449 gui tests: a page's page-away beacon is left out of the writes they count, as update/using is (#6709)
80a315a70 (11-14) sends POST /api/page-away when the page is hidden.
WebKit's page fires visibilitychange hidden in agent-bulk-visibility,
so its write count read 6 for 5, red in every language in WebKit
alone since then (git bisect run from e430e2750, red alone every
time in 2.7s). The seven files that leave the window's update/using
ping out of their counts now leave page-away out too; it writes
nothing either.

Run (rebased on 47ce008da, mote): agent-bulk-visibility,
agent-disconnect-preview, library-bar-more, provider-find,
sessions-folder-delete, settings-search, signin-close: pass 74 fail 0.
Without the change: pass 69 fail 5 (the five WebKit subtests of
agent-bulk-visibility).

Not done: a shared helper for "the page's writes", which would carry
the next such ping to every counting test at once; each file still
has its own route.
2026-11-16 00:12:45 +08:00
yetone 47ce008da8 gui: Settings asks for HTTPS only while its rows can show (#6709)
renderHTTPS sent GET /api/settings/https on every renderSettings,
and renderSettings has 35 callers, so each Settings draw cost a
request, LAN or not. GUI tests count a request under /api/settings/
as a write, so checkin-now-account and panel-shortcut have been red
in both engines and every language since 4623f5419 (11-10): that
commit's record ran chosen GUI files and called the reds the same at
base. Now it asks while the rows can show (sharing on the local
network, magpie answering other computers, or HTTPS saved on), and
again once the saved switch differs from what the last answer said.
Its own writes still update the rows from their answers.

Run (origin/main 139a6be2b plus this, GUI files on mote; at the pushed
head, rebased on 261f48226, checkin-now-account + panel-shortcut +
https-settings: pass 54 fail 0):
- checkin-now-account + panel-shortcut: pass 42 fail 0. Without the
  change: pass 2 fail 40 ('write', '/api/settings/https' counted).
- https-settings, browser-access, cors-origins, side-gateway-lan,
  settings-search, i18n-keys: all pass. allow-ips, lan-join and
  remote-magpie: 14 reds, the same 14 subtests without the change
  (on #6709's list).
- go test -tags nogui -run 'Budget|Size|Asset|Plugin.*Page'
  ./internal/gui: ok.

Not changed: renderWebPage and renderRemote ask /api/web-page and
/api/remote on every draw the same way. They aren't under
/api/settings/, so no test counts them; filed as their own issue.
Not tried: the real app's Settings with LAN on (the GUI fixtures
cover the rows).
2026-11-16 00:09:14 +08:00
yetone 261f482260 gui: Disconnect and quit puts the agents back for the next start, which connects them again (jtbbtnt54249 on X)
jtbbtnt54249, on LolingVerse's agy thread: "很多都这样,退出有时候又要重新开启".
Several agents' switches were off after quitting magpie and had to be
turned on again by hand.

Looked for a shared path that flips agents off. The row's switch is
Wired() alone, and nothing automatic disconnects an agent except a
removed plugin, the gateway pause (which reconnects on resume) and
Put agents back when quitting (which reconnects at start). The quit
question's Disconnect and quit, though, ran each row's Disconnect,
which leaves the disconnectedKey mark: every agent it listed stayed off
at every start after, and RewireOnStart skips a marked agent. Users
choose it so their agents work while magpie is closed, not to leave
magpie for good.

Now Disconnect and quit posts quit/disconnect (quitDisconnect), which
runs agent.RestoreOnQuit on the agents the question lists: their own
files back, no mark, recorded in quit.restored, so the next start's
RewireOnStart connects them again, the setting on or off. This covers
every agent the question lists: every detected agent wired to magpie,
built-in, plugin and WSL ones alike. A failure answers an error naming
the agent and magpie stays open. Its tooltip says magpie connects them
again when it opens (en, zh, zh-TW, ja, de).

Run at this tree (parent 99a54fa87, origin/main just fetched):
- TestQuitDisconnectComesBackOnStart red on the old api.go and
  restoreonquit.go (404 on POST /api/quit/disconnect), green after.
- mote: go test -count=1 ./internal/gui ok (145s).
- mica: node --test quit-ask, quit-ask-setting, restore-on-quit,
  i18n-keys, i18n-en-no-cjk: 178 of 178 pass, chromium and webkit,
  every language.
- gofmt -l clean; go vet ./internal/gui on darwin and GOOS=windows ok.
  Linux vet of internal/gui needs GTK/WebKitGTK headers, which neither
  mote nor magpie-desktop has; not run.

Not tried: a real quit of the app with real agents; the agent-level
RestoreOnQuit then RewireOnStart path is covered by
TestRestoreOnQuitAndRewireOnStart. Agents disconnected this way by an
older magpie keep their mark and stay off until switched on once.
2026-11-15 23:30:05 +08:00
yetone 99a54fa874 agent: agy's own /model pick no longer costs settings.json its model, and each thinking level is a model in agy (LolingVerse on X)
agy's /model writes its pick into settings.json ("model": "magpie/…")
even when started with --settings magpie-settings.json. The next Sync's
migrate took that for an older magpie's wiring and put back the old
stash: a stale model and "modelProvider": "gemini", or nothing, which
took the user's own model and provider out. That is the wrong restore
point the reporter saw. While magpie-settings.json is already on one of
magpie's models, such a pick is now moved into magpie's file (what agy
starts on next), and settings.json's model goes back to the one
connect.was kept when magpie was switched on, or out. The old stash is
no longer read for it.

agy 1.5.9 turns /effort away for every custom model, one with a
thinkingLevel too. A custom model's thinkingLevel takes low, medium or
high, and agy sends it as generationConfig.thinkingConfig.thinkingLevel,
which the gateway already asks over the row's effort (agyLevelAsked). A
model with two or more of those levels now has a custom model per
level, magpie/<ref>:<level>. The row's model field shows such a pick as
its model, so the switch stays on (agyLevelOf).

Run:
- TestAgyOwnPickKeepsSettings is red on the old agy.go. The levels part
  fails with "level low:". The pick part, with the levels cut out,
  fails with settings.json {"model":"stale","modelProvider":"gemini"}.
  It is green on the new code.
- go test -count=1 ./internal/agent ./internal/cli on mote: ok (agent 259s, cli 67s) at base 139a6be2b.
- GOOS=linux go vet ./internal/agent and GOOS=windows go vet of both packages (cli's Linux vet needs cgo for Wails on a Mac); gofmt -l is
  clean.
- Real agy 1.5.9 in a sandbox HOME against a fake Gemini endpoint:
  - /model lists magpie/openai/gpt-5.5:low/:medium/:high;
  - picking :high wrote settings.json "model" and sent
    thinkingLevel "HIGH" with model openai/gpt-5.5;
  - /effort still says "Effort isn't adjustable" for custom models.

Not tried: a real magpie gateway and account behind agy (the fake
endpoint stood in), and Windows or a WSL distro.

Not changed: the agent-agy plugin has the same two gaps
(magpie-community/plugins#1188). The switch turning itself off didn't
reproduce on the built-in or the plugin.
2026-11-15 23:19:21 +08:00
yetone 139a6be2bb gui: a pin in the title bar keeps the main window on top (NovaStudiosss on X)
NovaStudiosss wanted to watch Usage and Routing while working in other
apps. The main window's toolbar now has a pin between Refresh and
Settings. A click keeps the window above other apps' windows
(Wails SetAlwaysOnTop through POST /api/window/ontop?on=1|0) and saves
it as settings.json's onTop, which this computer keeps for itself
(KeepOwn, not synced). makeMain opens the window pinned on the next
start, and boot.js shows the pin pressed before the first paint.
There is no pin in the panel, in a browser's page (magpie web) or
under Wayland, where always-on-top is ignored (GDK_BACKEND=x11 keeps
it). A refused pin goes back up. Tooltips "Keep on top" and "Stop
keeping on top" are in every language. A Settings save keeps onTop
(settingsapi.Merge), which a test showed was lost before.

Run (rebased on a80a920f5):
- go test -tags nogui ./internal/gui ./internal/settings
  ./internal/settingsapi on mica: ok. TestPinKeepsWindowOnTop,
  TestPinRefusedWithoutAWindowToPin, TestSetOnTop*, TestOnTopOwn and
  the settings-save keep test.
- At the rebased head, TestPinRefused had served webHost through
  Handler and left webPage set, which turned TestSessionTitlesName-
  OtherAgents and TestCursorEditorChatsAreNotCalledCursorCLI red in a
  full package run. It now goes through webPageHandler, and the package
  is ok. TestWebPageHandlerEveryWhere misses a webHost passed in a
  variable.
- window-pin.test.cjs (chromium + webkit, en zh zh-TW ja de) and
  i18n-keys: 36 pass.
- Full GUI suite on mote (pre-rebase tree, still running at push): about
  380 reds so far, none in window-pin. Seven of the red files
  (account-arrange, agent-details-ready, api-key-theme, bark,
  agent-switch-accounts, allow-ips, agent-bulk-visibility) were run on
  origin/main 30de93e9e: 77 of the same reds, and none red only here.
- go vet for darwin, windows, linux nogui and linux gtk3. Windows
  go test ./internal/gui ./internal/settings: ok. gofmt clean.
- Broken by hand: without the route, or without renderOnTop, the Go
  and GUI tests go red. Without the Merge line the settings-save test
  goes red.
- Real app on mote: with onTop saved, the main window opens at the
  floating level (CGWindowList layer 3, 0 unpinned).

Not tried: clicking the pin in the real app (no Accessibility over
ssh), a real Windows or Linux window, Wayland (hidden by design). At
the default 660px window, the English tabs now scroll about 15px, as
Japanese and German already did on main.
2026-11-15 23:05:56 +08:00
yetone a80a920f56 gateway: a turn on a Codex WebSocket says where its time went
buhaodeshiyehao on X (Codex through Lody's ACP): the Routing page's
"Where the time went" showed only the request's masking. Codex's turns
to the ChatGPT backend, and to a Responses provider with Socket, go over
a WebSocket (codexSocket), and every turn of a conversation after its
first goes on the kept socket. No HTTP request went out that the try's
client trace saw, so TryNet was nil and the page had nothing but the
masking to show. A new socket's turn had TryNet from its handshake only:
the 101's wait read as the vendor's, and the backend's real wait went
into "First token".

codexSocket.turn now tells the request's client trace of the turn as
Go's client tells it of an HTTP request (socketTrace): on a kept socket
GetConn and GotConn (reused), on a new one GotConn once the handshake is
answered (its DNS, connect and TLS stand; its round trip is the wait for
the connection), WroteRequest once the message is written and
GotFirstResponseByte at the first frame. Both callers' traces get it
(gateway.go's routed tries and codex_backend.go's own sign-in), and so
does the usage record's sent/own split, which kept-socket turns lacked.

Test: TestSocketTurnTellsWhereItsTimeWent, Codex's own sign-in and a
Responses provider with Socket, a new socket then the kept one, a 200ms
hold before the first frame. Red on the old code (new socket: Wait 0.4ms
for the 200ms hold; kept socket: no timing), green with it (Wait ~201ms
on all four turns).

Run on mote at this tree (base 9bcdcfb7d; rebased onto 2a8e1b444, whose three commits touch LESSONS.md, internal/plugin and internal/provider only): gofmt -l; go vet
./internal/gateway on darwin, GOOS=linux and GOOS=windows; go test
-count=1 -timeout 45m ./internal/gateway: ok (984s).
No GUI change: the page already draws every part once TryNet is there.
Not tried: a real Codex turn through Lody against chatgpt.com.
2026-11-15 22:43:30 +08:00
yetone 2a8e1b4448 LESSONS: a host outliving its test's HOME, a review's case argued away, Test's colour
- A helper that gives a test a new HOME also stops what an earlier
  test started under the old one (#6761, 248edad80; same class as
  #2449/#2702 on 10-17). Seen 2×.
- Never merge with a review's problem open: plugins#1183 merged with
  the tool-loop test the review asked for argued away. Seen 2×.
- Under "A cancelled run tests nothing": main's colour is the Test
  workflow's, not Docker's (923cc8747, e99307fb8), 7 of 12 Test runs
  cancelled, and #6764 filed as a duplicate of #6761.

Docs only; nothing run.
2026-11-15 22:39:30 +08:00
yetone 75ab21af4d plugin: a test binary takes no Bun from PATH (#6761, #6764)
TestRemoveListedAccountLeavesHiddenNamesake went red in every
whole-package run of internal/provider since 30de93e9e, on CI (ubuntu,
e99307fb8) and on mote, and passed alone.

The cause: 30de93e9e falls back on a Bun from PATH (or ~/.bun/bin) when
the download fails. A test's sandbox has no Bun, and testenv refuses the
download, so TestPluginEmptyKeyKeyAsked now copied the developer's or
CI's own Bun in and started a real plugin host, which nothing ended.
plugin.SignOut goes to the running host when there is one, so the later
test's ForgetLogin signed out in that host's HOME and its own
plugin-auth.json kept zcode#l47q19. Logging plugin.Running() in the test
showed true; the log shows "running plugins on Bun 1.4.2 from
~/.bun/bin/bun" in TestPluginEmptyKeyKeyAsked just before.

Now pathBuns is empty in a test binary testenv isolated
(MAGPIE_TEST_SANDBOX), as before 30de93e9e every test that asks a plugin
without MAGPIE_BUN got no host. TestBunOnPathAfterDownloadFailed sets
pathBuns itself, and BunReleaseForTest already emptied it. A real magpie
never has the marker.

Run on mote:
- before (9bcdcfb7d): go test ./internal/provider -count=1, red 2 of 2
  with "the account removed is still signed in" and running=true;
- after: go vet ./internal/plugin; go test ./internal/provider
  ./internal/plugin -count=1: ok (155s, 173s); gofmt -l clean.

Not run: the full ./... suite, and Windows/Linux; the change is one
early return under a test-only variable.
2026-11-15 22:38:49 +08:00
yetone 248edad80c provider: a plugin host ends with the test whose HOME it started in (#6761)
TestRemoveListedAccountLeavesHiddenNamesake failed in full runs (CI Test
at e99307fb8, ubuntu) and passed alone. A bisect over the 1779 tests
that run before it found TestPluginEmptyKeyKeyAsked: its PluginAPIKey
starts a real plugin host (Bun) and leaves it up. plugin.SignOut asks a
running host, and that host's files are the earlier test's HOME, so the
remove landed there and this test's plugin-auth.json kept the account.

claudeHome (which movedPlugin and the culprit both use) now stops a
host that is up before it sets the new HOME, and again in cleanup. That
covers every provider test that sets a HOME through it, not only this
pair.

Run (mote, then mica as mote was over its cores):
- red before: -run '^(TestPluginEmptyKeyKeyAsked|TestRemoveListedAccountLeavesHiddenNamesake)$'
  -> "the account removed is still signed in"; green after.
- go vet ./internal/provider/; go test -count=1 -timeout 45m
  ./internal/provider/ ./internal/plugin/ at this tree: ok 142.9s, ok 171.6s.
Not run: the full suite (test-only change in one package's helper).
2026-11-15 22:38:32 +08:00
yetone 9bcdcfb7d1 provider: Antigravity's Orchestrator ids are priced as the Gemini model each is
guyng35955 on X: an Antigravity local session's calls under
gemini-pro-orchestrator-argon, gemini-pro-orchestrator-carbon and the
worker gemini-flash-worker-agy showed tokens and cache but cost "—". They
are Orchestrator mode's role ids, which no catalog prices.

pricedNamesTo now reads them as the model Antigravity's docs name
(https://antigravity.google/docs/models/): Orchestrator (Argon) plans with
Gemini 4 Argon, Orchestrator (Carbon) with Gemini 4 Carbon, and Gemini 4
Hydrogen does the implementation, so the worker is priced as
gemini-4-hydrogen. gemini-pro-orchestrator (Carbon's id before Argon came,
per the Antigravity Context Window Monitor extension 1.17.1's table) is
Carbon too. Only these four ids, under a route prefix or an effort suffix;
a name only like one stays unpriced. Every cost reads through this one
place: the Sessions list and overview (sessions.priceOf -> PricedName),
the usage ledger, its totals and per-agent view (Pricer -> ListPrice /
MakerPrice). Prices are taken as rows are read, so sessions recorded
before the update are priced once it is installed; nothing is re-parsed.

Google publishes no rate for the role ids themselves; they are priced at
the named model's models.dev list price.

Run (mote, at this tree):
- the three new tests red on origin/main's models.go (every role id
  unpriced), green with the fix; red again with argon mapped to carbon
  by hand
- go test -tags nogui ./internal/provider ./internal/sessions
  ./internal/usage: sessions and usage ok; provider ok but for
  TestRemoveListedAccountLeavesHiddenNamesake (ZCode account removal,
  not reached by this change), which passes alone -count=3 with and
  without this change; filed as #6764 with its output
- go vet, GOOS=linux and GOOS=windows go vet of those packages; gofmt -l
  clean
Not tried: the reporter's own Antigravity database, or a real Orchestrator
mode account (this Mac has no Antigravity app and the account isn't
offered Argon). No GUI change.

Reported-by: guyng35955 on X
2026-11-15 22:17:30 +08:00
yetone e99307fb86 usage: a file read anew forgets when the last one was written or pruned (#6760)
TestWholeKeptAcrossReset was red on main at -count=5 (4 of 5, "after a
restart: <nil>"), and TestFeedExpiresACursorOlderThanItsTombstones at
-count=3 (2 of 3, "must be refused, not skipped over: <nil>"). Both had
the same cause. A package-level "last done at" outlived the file it was
about:
- carryLoad reset the window-holds map and dirty bit for a new path,
  but not wroteAt. carrySave then waited 30s from the last file's write,
  or from a held clock later than this one, and wrote nothing.
- feedLoad reset everything but pruned, so a journal read anew wasn't
  pruned for an hour after another one was.
In the app it matters when the config dir changes (MAGPIE_CONFIG_DIR, a
sandbox HOME) without a restart, or when the clock moves back.

Each reset is now done where its sibling fields already were.

Run on mote at origin/main 30de93e9e plus this commit:
- red before, on the unchanged files: TestWholeKeptAcrossReset
  -count=5 FAIL ("after a restart: <nil>"), and
  TestFeedExpiresACursorOlderThanItsTombstones -count=3 FAIL;
- after: go test -count=3 ./internal/usage/ ok (126s);
- go vet ./internal/usage/, plus GOOS=linux -tags nogui and
  GOOS=windows: ok. gofmt clean.

Not run: the full suite. Both mote and mica were busy with other
sessions' full suites under suite.lock (mica at load 63). The change is
two field resets in internal/usage, and nothing outside the package
reads carry or feed.
2026-11-15 21:58:28 +08:00
yetone 30de93e9e9 plugins: a request whose Bun is still downloading fails at once and fails over (#6735)
hixonchan (kyrierekkok123-del on GitHub): with magpie's own Bun missing
and its download stalled, every plugin-served request hung with zero
bytes, nothing in the log, no timeout and no failover, and `magpie
plugin` hung too. The host's lock (hostMu) was held across Bun's
download, which had no bound on the whole, so every caller waited on it
whatever its context said.

Now:
- Bun is downloaded in the background, once at a time per Bun
  (bunready.go). The host waits for it up to 10s from when it began
  (bunReadyWait); then each call ends with BunNotReadyError, "Bun
  runtime not ready: downloading Bun 1.4.2 (12s so far)…" or "… failed:
  <why>", logged, and the gateway goes on to the group's next member.
- A failed download is said at once for a minute, then tried again;
  installs (plugin.Bun) still wait as long as their context lets.
- hostMu is a channel lock that a caller's context can end (LockCtx);
  the gateway's TryLock polling loops use it.
- When the download fails, a Bun on PATH or in ~/.bun/bin is taken if
  magpie would run it itself: at least BunVersion, not set aside, passing
  the try a new release gets. It is copied in as magpie-bun (#1048).
  magpie's checksummed build stays first; the user's own Bun is better
  than no plugins, and it is what the reporter fell back on by hand.
- Each stage is logged: download started, failed after N, downloaded in
  N, the PATH Bun taken or refused and why.
- Every route through the host gets it: fetch, loader options, sign-in,
  the plugin listing (CLI and GUI). `magpie plugin` prints the list and
  the not-ready reason within ~10s.

Self-restart and env (the reporter's point 4): Reexec, RelaunchBinary and
StartBeside pass os.Environ; only the Mac's bundle relaunch (open -n)
starts with LaunchServices' env. Filed as #6757, not changed here. With
this change MAGPIE_BUN isn't needed.

Tests (each red on the old code with a shim for the new test hooks, logs
kept):
- TestHostWhileBunDownloadStalls: old code, "a caller whose context
  ended still waits on the stalled Bun download"; now not-ready at 2s,
  the 100ms caller returns, then the host starts on the download, asked
  once.
- TestHostAfterBunDownloadFailedSaysWhy: old code, a plain 500 error,
  not BunNotReady; now the 500 is said twice with one ask, Bun() retries.
- TestBunOnPathAfterDownloadFailed: old code failed; now 1.4.2 taken,
  1.0.0 refused.
- TestPluginWhoseBunIsNotReadyFailsOver (gateway, real Handler): old
  code, "group/mixed still unanswered after 20s"; now 200 from the next
  member in 0.84s, and the plugin's own model answers 502 "Bun runtime
  not ready" after ~300ms.

Run on mote at 923cc8747 + this commit (rebased since onto d7cda856a,
a GUI-only library change): gofmt -l clean; go vet ./...,
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go
build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok.
go test -tags nogui -count=1 -timeout 45m ./...: every package ok
(plugin 219s, gateway 1001s) except two untouched by this change:
- internal/usage TestWholeKeptAcrossReset: red on origin/main d7cda856a
  too, 4 of 5 at -count=5 (#6760).
- internal/provider TestRemoveListedAccountLeavesHiddenNamesake: red
  once in the full run, 5 of 5 alone (#6761).
The four new tests pass on Linux (WSL magpie-desktop) and, the two that
run there, on Windows (xiaomi-gpu).

Not tried: a real magpie binary with a really blocked GitHub download
(the gateway test runs the real handler with a stalled release server),
and the Mac relaunch.
2026-11-15 21:26:33 +08:00
yetone d7cda856ad library: MCP servers turned off fold away below the ones on (hzlxb on X)
hzlxb on X asked for Library -> MCP servers to keep the servers turned off
apart, folded, as Providers keeps the providers turned off. The list now
holds the servers on. The ones off sit below it, above "+ Add server",
under a "Servers turned off (N)" fold drawn with Providers' Turned off
markup (row-head off-head, .fold with the chevron, the count in .note).
It is folded at first and remembered in localStorage
magpie.offServersOpen, as magpie.offProvidersOpen is. A server switched
off moves under the fold, and one switched on comes back up. While
picking (Select) the fold is held open and disabled, so every server
picked is in sight, as Providers holds its fold open while searching.
The MCP tab has no filter of its own, so there is nothing else for it to
hide from. With every server off only the fold shows. With none off
there is no fold. Strings are in en, zh, zh-TW, ja and de.

Run:
- library-mcp-off-fold.test.cjs (new): Chromium and WebKit, 1100 and
  420 wide, en/zh/zh-TW/ja/de. It checks order, label, count, title,
  aria-expanded, that opening by a wheel-scrolled click leaves the head
  where it is and opens no editor, the reload memory, moving on a
  switch, picking, all off and none off. It is red on the old library
  files (no fold; checked on mica in chromium).
- Library/MCP/i18n/click-scroll/providers-off-fold GUI files (102 files,
  both engines) on mote at the pre-rebase head 29a5f10f9: 2304 of 2310 pass. The 6
  reds are library-open-again's 1100px cases, red the same alone on the
  old tree (filed as #6751).
- go test -count=1 ./internal/gui/ on mica at this head: ok (143s).
  gofmt clean.
- The whole GUI suite on mote at 29a5f10f9, in two parts (mote rebooted
  mid-run; the rest ran after it came back, under suite.lock). Part 1:
  411 not ok in 75 files. Part 2 (640 files): 11355 tests, 10911 pass,
  444 fail. No red is in the files this change touches except
  library-open-again (#6751). Every red file has an open issue saying it
  is red on main: skill-fold-all/skill-manual (#6667, #6668, the
  window's /api/update/using), skill-group-shared (#6687),
  view-open-wheel (#4723), view-trackpad-coast (#4724),
  view-wheel-unheard (#5158), usage-* (#6743, #4263), the rest in #6709
  or by name; icon-tile was unfiled and is now #6759 (dim-color from
  2649d5d72, not in app.css's tile rule).
- After rebasing on origin/main 923cc8747 (1f04ed219 touched
  library.css): Library/i18n/click-scroll/providers-off/gui-* files on
  mote: 1837 of 1847 pass. Reds: library-open-again's 1100px
  cases (#6751), library-env de (#6675, NO_PROXYlocalhost) and
  library-chip-fan de no-preference (#3072), both chromium only; those
  two pass 3 of 3 alone at this head and at origin/main 923cc8747; go test -count=1 ./internal/gui/ on mica: ok (154s).

Not tried: the real app, including WebKitGTK on Linux. The fold has no
motion of its own (it uses Providers' chevron rotation).
2026-11-15 21:22:45 +08:00
yetoneandliu-kan 923cc8747f routing: filtering groups reuses indexed lookups and cards (liu-kan, #6744)
Ported from liu-kan's routing_mod_filter branch at 5aca86598 (#6744).
Typing in the Routing groups filter re-ran every member's lookups as a
linear .find over all models, deciders, drawers and accounts, and redrew
the whole page each keystroke. Now a lazy index (Maps built first-match
like .find, splitMember and memberInfo cached, search text cached per
group and locale) is rebuilt whenever `groups` is reassigned (it never
is mutated in place) and dropped 5 minutes after both Routing pages are
hidden. The filter's input redraws only the group list from cached
cards, falling back to a full draw when groups or the locale changed.
No look, matching or saved config change; no new strings; app.js
untouched (client.js is outside the core budget).

Measured (mote, Playwright, 4000 models, 20 groups x 20 members, 16
keystrokes, ms per keystroke incl. layout):
  chromium: before mean 4767.6 / median 5086.3, after 0.37 / 0.2
  webkit:   before mean 4813 / median 5075,     after 0.88 / 1

Run:
- go test -count=1 ./internal/gui/ on 2bc25a2d6 (mote): ok 137.9s. Main since
  (1f04ed219) touches no routing file.
- New and touched GUI files (group-filter-render, group-index,
  group-search-cache, routing-group-plans) on 2bc25a2d6 on mote:
  54 pass, 0 fail.
- make test-ui (both engines) on mica before the rebase onto 2bc25a2d6
  (main's two routing commits since touch the stage only): the run
  stopped after 453 of 1542 files, 5788 results. Its 34 red files were
  each run on origin/main and on this branch: the same tests fail on
  both (main 2bc25a2d6: 378 pass / 204 fail; branch identical but one
  context-cap Settings flake, #6514). Each has an issue: #6010, #5814,
  #5982, #6369, #6371, #6365, #5925, #4959, #6444, #6212, #6543,
  #6029, #6179, #6658, #3293, #6372, #5972, #6514, #5801, #4870,
  #6475, #6424, #6156, #6201, #6660, #5013, #6268, #6293, #5049
  (group-editor-selected), #5594 (group-new-head), #3479, #6414, #4086.
- The other 1089 files: a run on mica went bad under another session's
  suite (load 117) and was stopped; a whole suite at 2bc25a2d6 is
  queued on mote behind the suite lock, followed up after push.

Not tried: the real app, a Linux WebKitGTK app, Windows.

Co-authored-by: liu-kan <liukan@126.com>
2026-11-15 20:25:50 +08:00
yetone 1f04ed2193 gui: a form's name and its control share a line in every editor
The owner (11-12, the second time): in a provider editor, Free for me and
Redaction sat 4-5px under their ticks. "这个事情发生过不止一次了,要彻底避免。"

Cause: each label carried a padding-top guessed for one control, 5px for
a 29px input. Any other kind of control, such as a tick, a switch, the
icon box, a row of options, a list or a JSON box, sat off its name.

Fix, at the shared row layout instead of per row:
- Every editor grid sets its rows on their first baseline: .editor, a
  dialog's .ebody, Advanced's .more .inner and Connect. The per-label
  padding and label.by-list are gone.
- Controls with no text of their own carry a text line at their middle:
  the icon box (line-height 30px) and the library switch (a ZWSP
  ::before).
- Exception: a row whose control starts with a text field is set at its
  top, its name padded to the field's line (--field-h, 44px on the narrow
  web). WebKit lays a baseline row out again on every layout and reveals
  a focused field each time, so the page jumped back to a new group's
  name (group-from-model-add). app.js's settleRows marks those rows
  .at-top (and a JSON box's name .by-json), only in grids a mutation
  touched. A CSS :has(+ ...) version held WebKit ~9s on Codex's editor
  (9209ms vs 249ms on base, provider-pass-errors).
- Connect's options wrap at <=520px instead of scrolling: WebKit grew a
  baseline row holding a scroller 6px each time its bar came and went
  (connect-snippet-shell).
- The rate-windows Add button sits at its row's top.
- provider-at-once compares the label's text height, not its padded box.
  The label is still one line; a name beside a 44px field is padded down
  to its line.

Guard: form-align.test.cjs opens the provider editors (a key's, Codex,
with Advanced open), the group editors and Connect. For every name and
control row it asserts the label's first text line and the control's
first line share a vertical centre within 2px. It runs in chromium and
webkit, en/zh/zh-TW/ja/de, at 1100, 420, a web 390 and a panel width.
LESSONS.md gets the rule.

Run (mica, through mica-run):
- At the pushed tree (49274f690, the same tree before this message): form-align, provider-pass-errors,
  provider-at-once, provider-count-free, provider-unmasked,
  provider-rate-windows, provider-proxy, connect-snippet-shell,
  group-from-model-add, icon-url, library-mcp-hub, settings-lines-wrap,
  settings-update-proxy, editor-roomy and i18n-keys: 499 pass, 3 fail at load 75. The 3: settings-lines-wrap chromium de 440 is red the same on origin/main 2bc25a2d6, 2 of 2 (#6353). connect-snippet-shell chromium en/de 390 passed when its file ran again alone (#4128 is its sibling).
- go test -run Budget ./internal/gui: ok.
- Earlier, at 648cd3fdb: the whole GUI suite (473 files). The new reds in
  it were the :has slowdown above (fixed). The 64 files it reached were
  then run again on mote, rebased on 343920464; the reds left are listed below.
- Broken by hand: every first baseline put back to start, form-align
  0/10. On the old CSS it was 0/10.

Reds that are the same on origin/main (343920464, 2bc25a2d6):
- connect-address-kept at 1100: #6755, filed now.
- provider-mask "Hide accounts": #5109.
- settings-groups warm-ups: #6597.
- editor-advanced-align webkit: #4615 / #6421.
- library-bili webkit: the tab click is lost about 1 run in 4, 2/8 on
  main, near #6015.

Not tried: the real app in WKWebView, WebKitGTK and WebView2, and Windows.
2026-11-15 19:53:10 +08:00