Since fdcdb5af (#860) the table fits a narrow window much more closely,
and at the test's 700px the Chinese table was 76px wider than the window
on this Mac but 33px on the reporter's machine (689 vs 656), whose
narrower fonts failed the test's "wider than the window by 50px" premise
in Chromium and WebKit. The product is right; the test's window was a
premise #860 took away. At 600px the Chinese table is 176px wider here.
Verified: ledger-hscroll passes 6/6 (Chromium and WebKit, en and zh).
With the reporter's narrower fonts stood in for by letter-spacing
-0.06em / -0.08em on .led (zh 696 vs 658), the old test fails zh in both
engines (2 pass, 4 fail) and the new one passes 6/6. No product code
changed.
The custom provider editor's Base URL has a fifth API, "Gemini compatible"
(Gemini 兼容 / Gemini 互換 / Gemini-kompatibel), beside OpenAI, Anthropic and
Responses; More endpoints has a Gemini URL; the CLI takes gemini=. A
Gemini URL is kept as its base (…/v1beta, a relay's path prefix kept, a
pasted models/…:generateContent cut off). Every client's request, Chat,
Messages, Responses or Gemini, streamed or not, goes upstream to
models/{model}:streamGenerateContent?alt=sse under it, with no model in
the body and the key in x-goog-api-key; models are listed from its
/models, a page at a time, keeping those that serve generateContent.
Detect doesn't ask a Gemini API and is hidden while it is picked.
Factory's Gemini route and Bearer token are unchanged.
With five APIs the pick no longer fits a 900px editor in English and
German, so it wraps to a second row, and its thumb now follows the
picked option onto that row.
Verified against fake httptest upstreams only; no real Gemini key or
relay was tried:
- TestCustomGeminiUpstream (gateway): chat, chat stream, messages, a
Gemini client's stream and non-stream, behind /proxy/v1beta. Fails with
"chat: 404" without the gateway.go change.
- TestCustomGeminiProvider, TestGeminiBase, TestFactoryGeminiUnchanged
(provider).
- go vet, HOME=$(mktemp -d) go test -tags nogui ./... (44 packages ok),
GOOS=linux and GOOS=windows go vet on the touched packages.
- provider-gemini.test.cjs (new, en/zh/ja/de, Chromium + WebKit, 8 pass;
fails with "900px: the thumb is 22px off" without the slide() fix),
and in both engines: provider-base-api, provider-detect,
provider-detect-models, provider-add-models, provider-output-picks,
provider-search, provider-url-each-api, seg-contrast, settings-groups,
menu-scroll, click-scroll, ledger-hscroll, strip-scrollbar,
view-scrollbar, usage-ledger-chart, system-one, gui-ja, gui-de,
gui-zh-tw: all pass.
Found by logging every off-host request in a full Chromium GUI run:
signin-paste-codex opened the real auth.openai.com (Cloudflare's
challenge, the page that hung login-import's clicks), signin-again
loaded www.codebuddy.cn with its downloads and trackers, and
signin-closes-sheet example.com. Each routed only its page. Now the
context answers anything off magpie.test with an empty page; a rerun
logged only the three window URLs, no subresources. Chromium and
WebKit, all three files: 9/9 pass each.
Like login-import's ChatGPT window, only the page was routed, so the
window GitHub's device sign-in opens loaded the real site (304 requests
to github.githubassets.com in one full Chromium run). It wasn't red here
(10 at once in Chromium: 0/20 failed), but its outcome rested on pages
the test doesn't control. Chromium and WebKit, en and zh: pass, and no
request went past the two window URLs, which the route answers.
The browser sign-in calls window.open on auth.openai.com, and only the
page was routed, so the new window loaded the real site: Cloudflare's
challenge. While it runs, Playwright's clicks on the opener in Chromium
stall at "performing click action" past their 5s.
Shown with a page that opens the same window and then clicks a button
30 times, 8 at once: real window, every run had 1-2 clicks time out
(max 5.0-5.5s), twice over; window routed to an empty page, 0 timeouts
(max 1.2-4.0s at load ~100-117). The test itself, 10 at once in
Chromium (load 150-190): before 20/20 and 19/20 subtests failed (click
or fill timeouts at lines 111-117, after the window opened); after
0/20 twice. WebKit, 8 at once: 0/16. en and zh both run.
A copy is a new program, which macOS checks before its first exec; the
host's init ran it inside the test's minute. Timed here with load ~130
and syspolicyd not pegged: a fresh copy's first `--version` took
0.9-1.6s, a hard link of the same bun 0.04-0.3s; with syspolicyd busy
the same check took 26-55s a program in #1284. Where no link can be
made (another filesystem), the copy is run once before the minute starts.
Run in Docker (golang:1.26.8, linux/arm64, bun 1.4.2): -count=3 of the
test with bun on a bind mount (copy path) and beside HOME (link path),
all PASS; go test -tags nogui ./internal/plugin ok; go vet for linux,
windows and darwin clean. Not run: the test on macOS itself (Go tests
are kept off this Mac while syspolicyd is overloaded), so the red under
a slow first-run check is shown by the timings above, not by a failing run.
* provider: a background reading of an account writes its quota history too
GET /v1/magpie/quotas/history was written only by the Usage page's
reads, so a magpie only ever serving other magpies - nobody opens its
Usage page - kept an empty history while its routing read each account
every few minutes.
When a login's fresh reading is kept, it is now noted in the history as
a page reading is, named for its account (a login's reading itself
carries no user); a read that failed is skipped, not told again. The
test is the reporter's story: a background LoginUsage, then the
history, no Usage page involved; it fails on main. Keys' background
readings (KeyAllowance) are not noted here - the page names a key's
history line by its key name, which routing's reading does not have.
Invited by yetone on #1317 after 137ebee8 closed the cards half of
Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
#1313.
* provider: a LoginUsage batch notes its quota history once, off the request path
Per review on #1318: a kept reading per account meant N full
read/parse/write cycles of quota-history.json for N accounts, and the
write ran before close(r.done), so routing's waiters on a reading
waited on the disk, the writes serialized under quotaHistMu.
loginUsageAt now notes the batch once after wg.Wait(), each reading
named for its account, through noteHistory, whose write runs in its own
goroutine; a cached reading notes nothing new (its ReadAt is no newer)
and a failed one is skipped. Tests: several accounts cost one write
(TestBackgroundReadsNoteHistoryOnce) and a held write holds no waiter
(TestHistoryWriteHoldsNoWaiter).
Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
* provider: note the batch's quota history synchronously
The detached write goroutine outlived its caller: it read Path() and
wrote quota-history.json after a test had returned, racing t.TempDir
removal and leaking into the next test's HOME (go test
./internal/provider red with the PR, green on main). Note synchronously
in loginUsageAt after wg.Wait(): every reading has completed and
released its in-flight marker by then, so no routing waiter is held.
Only the LoginUsage caller pays for one write per batch, and Allowances
already calls it from its own background goroutine.
TestHistoryWriteHoldsNoWaiter now holds the write during the first
LoginUsage and asserts a second caller on the same account answers from
the completed readings, with a timeout on the write-start wait.
Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
---------
Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
On 0.2.0, cursor/claude-opus-5 at xhigh went as claude-opus-5-thinking-high
with thinking=false, effort=xhigh, because Opus 5 without thinking stops at
high. 0.2.1 sends claude-opus-5-high with effort=high, as 0.1.11 did. The
cursor mover's min goes from 0.2.0 to 0.2.1, so keepMovedCurrent updates
every moved Cursor user.
0.2.1 on npm (registry.npmjs.org) has an index.mjs byte-identical to plugins
main cf0de01e. The plugin PR was reviewed at ea00bd9 and merged:
- bun test in packages/cursor: 49 pass, 0 fail
- whole repo: 987 pass, 0 fail
- bun scripts/check.mjs passes for all 15 packages
- the new test fails on 0.2.0's index.mjs
- not tried with a real Cursor account on the review side (the stored token
answers 401)
The case where the default's own branch stops short is still open:
magpie-community/plugins#55.
go test -tags nogui ./internal/provider passes (temp HOME, pinned caches).
go vet -tags nogui ./internal/provider passes for darwin, linux and windows.
gofmt -l is clean.
John's Kimi Code rows after v0.1.1119 (OpenCode, group/k3-glm, api.kimi.ai,
Chat, k3-256k): 550 tokens, 22 of them reasoning, in 16 s with the first
content at 5.2 s read 2,237 tok/s, and 395 tokens in 19 s 2,012. 528 answer
tokens at 2,237 tok/s is 236 ms: the burst the vendor let go at the end.
de5455b8 measured how long the content took to come (flow) and took the
window as no longer than it, so a burst sent in one write (flow ~1 ms) fell
under the 100 ms floor and told none, but a burst let go over 236 ms of
many events read its tokens over those 236 ms, under the 10,000 tok/s
ceiling. The time a burst takes to come is not the time it took to write.
usage.DecodeOf now tells no speed for a reply held back and let go at its
end, both ways the burst can show:
- its content came in under a quarter of its window (flow*4 < window):
the text came early, the tool call it wrote over the rest of the time
came at the end (window 10.6 s, flow 236 ms);
- it reasoned, and its answer came over 20 times faster than its
reasoning came between its first content and its first text: the text
came with the burst, so the window from it is the burst itself (22
reasoning tokens over 10.5 s, then 528 in 236 ms). Hidden reasoning
(OpenAI's, Claude's omitted) comes before the first content and leaves
that time short; streamed reasoning comes at its answer's pace.
Between the two the window is the whole window again, not the flow.
routing.js's decodeOf and app.js's ledDecode do the same; docs/reference.md
says it.
Tests: TestKimiHeldBurstTellsNoSpeed, a fake Kimi Code (Chat: four
reasoning_content deltas, then text and a tool call whose arguments come
as 40 writes 6 ms apart over the last 236 ms; usage 538/550/22), through
the real gateway for a Chat, a Responses and an Anthropic agent, with the
wait shortened (first content 1.3 s, end 4 s): the held call and the held
answer tell none (before: 2,112 to 2,237 tok/s on all three), a steady
50 tok/s answer after the same reasoning keeps ~50. TestKimiHeldBurstAtJohnsTimes
feeds firstToken the same streams at John's times (5.2 s, 16 s): before,
2,138 and 2,237 tok/s. TestJohnsRowsTellNoSpeed: his rows as records
(before: 2,237, 2,237, 2,015). routing-burst-speed and usage-speed gain
his rows and a steady 50 tok/s one; they fail on the old routing.js and
app.js ("2237 tok/s", "2,237 tok/s") and pass now in Chromium and WebKit,
en and zh, with reasoning-speed, routing-request-metrics,
usage-ledger-detail, click-scroll, gui-ja, gui-de and i18n-keys.
Run: go test -tags nogui ./internal/... (golang:1.26.8 in Docker, as a
non-root user: as root, internal/agent's TestAside* write-refusal tests
fail because root ignores the file modes they rely on, unrelated to this);
-race -count=5 of the new and the burst tests; go vet (linux, windows,
nogui) on internal/gateway and internal/usage. Not tried against the real
Kimi Code API: the owner's Kimi Code key answers 403 (subscription has no
access), so how Kimi Code lets the reply go is inferred from John's
numbers; which of the two shapes his rows were is not known, and both are
covered.
Each new request in a session emptied the card while the gateway read its
prompt (the box collapsed to 0, everything under it jumped up), then drew a
new card whose 400 cells scaled in again, then a third card when it was
done; a request under way had no Prompt cache stat, so the grid moved
again when it came. Now ctxCard returns a card with ctxUpdate: the grid's
cells are made once and only their classes change, the head, stats,
legend, contents rows and foot are morphed in place, and an under-way
request keeps the cache stat's place with "—". Routing patches the live
card, keeps it in place while a live request has no prompt yet, and still
draws a request the reader picks afresh.
Verified: routing-live-patch.test.cjs (new) feeds two requests in three
steps each, at 420 and 1100 wide, in Chromium and WebKit: the old rows,
card, grid, cells, legend and contents rows stay the same nodes, the grid
and card keep their height on every ResizeObserver frame, the view never
scrolls. Without the change it fails: the card reads '' while the request
is under way, the card/grid are new nodes, the box goes 884 -> 0 -> 789
-> 884. routing-*, context-*, click-scroll, panel-routing, old-webkit,
gui-ja/de/zh-tw, usage* pass in both engines; go test ./internal/gui and
GOOS=linux/windows go vet pass.
The app's version is read from /Applications or ~/Applications
ChatGPT.app (or Codex.app) Contents/Info.plist, taken only when its bundle
id is com.openai.codex, so the ChatGPT chat app (com.openai.chat) isn't
taken for it. macOS only: the Windows Store package isn't read yet. The
app chip's tooltip says it reads the same settings as the CLI, so
connecting Codex connects both. At narrow widths the chip ellipsizes, and
below 250px it gives way so the name keeps its room.
Verified: TestCodexAppVersion fails without the CLI() change ("the app
alone, no CLI"); agent-app-version.test.cjs fails 12/16 without the app.js
change and passes 16/16 with it, Chromium and WebKit, en/zh/ja/de, at 980,
560 and 440px. agent-cli-missing, agent-connect, agent-field-names,
agent-layout, agent-update-all, cli-update, click-scroll, gui-ja, gui-de,
i18n-keys pass in both engines. internal/agent passes in Linux Docker
(non-root); full ./... on macOS; vet darwin/linux/windows. Read
26.930.51102 from the real /Applications/ChatGPT.app on this Mac. Not
tried on the reporter's machine.
A Claude Code fork sub-agent's first request is its lead's conversation
with a result for each of the lead's in-flight calls ("Fork started —
processing in background") and its directive after. The lead's own resume
and every fork it started therefore match the same run at once; the first
to claim it won and the rest got a terminal 409 that Claude Code does not
retry, so the forks died. The 409 dates from e8cd4bac (#794); nothing
between v0.1.1108 and main changed it. A request that loses the claim now
gets a run of its own, told the conversation whole.
Verified: TestClaudeForksAnsweringTheLeadsCallsEachGetAnAnswer drives the
real server stack (httptest Handler, fake claude whose MCP calls go back
through /_magpie/claude-mcp) with a lead and 8 forks resuming at once.
Before the change it failed 7/20 plain and 5/10 under -race (409 for forks
and the lead); after, -count=30, -race -count=20 (macOS) and -race
-count=10 (Linux Docker) pass. TestClaudeBridgeSafeguardConcurrentHandoff
now expects the second caller to get its own run. go test -race
./internal/gateway is green on macOS and in Linux Docker; go vet for
darwin/linux/windows and gofmt clean. Not tried with a real Claude
subscription.
The drift check asked only whether refs.MAGPIE_GATEWAY_KEY equals the key
magpie writes into .env, so a caller key the gateway itself issued — which
dsh's store prefers and the gateway authenticates — was named as "another
MAGPIE_GATEWAY_KEY" and the user was told to remove it there, while
delete → disconnect → re-apply wrote the very same state back. The check
now asks the gateway's own Authenticate first: a key it takes means dsh is
going through magpie, and only a key it would refuse (a foreign one, a
switched-off one) is drift. The .env side needs nothing: the serving round
rewrites .env to magpie's key, so a stray value there heals itself.
TestDshStoreHoldingAGatewayCallerKey (a key from access.Update add-key in
the store's refs) failed without the change with the "holds another
MAGPIE_GATEWAY_KEY" drift; with it the check is quiet, and a key the
gateway doesn't take still reports.
Verified: go test -tags nogui ./internal/agent -count=1; the three dsh
store tests under -race -count=10; gofmt -l clean; go vet -tags nogui
./internal/agent; go build and GOOS=linux/GOOS=windows go build -tags
nogui.
Generated-by: GLM-5.3-Flash (ZCode)
List sorted the session keys by file mtime and truncated them to the
limit before assemble dropped empty sessions, so a newest empty file
ate the page: List(1) answered no session at all though List(0) found
two, and on an mtime tie an empty one could win the key tie-break.
The limit now falls on the assembled sessions: keys are walked newest
first and a nonempty one takes an empty one's place until limit are
collected; the most-recently-active-first order is kept.
Reproducer by @Ethereal49 in #1320, red before (limit=1 returned 0
nonempty sessions, want 1) and green after; the TestList flake they
saw under -race -count=20 does not repeat with it. Fixes#1320.
Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
The five fakes answer a Run in full duplex (EnableFullDuplex) and return
while magpie's request body is still open, as Cursor does. Go's server
then reads the rest of that body in finishRequest's Close, after it has
stopped the connection's background read; the read's EOF starts another
background read, and the kept-alive connection's next request reads
beside it and panics. net/http recovers it and the tests pass, so it
was only noise in the log, beside the run's real failure
(TestBurstTellsNoSpeed, fixed in 5e17a183). magpie's own server never
uses full duplex: the panic is the fakes' alone. cursorDuplex enables
full duplex and sends Connection: close, so there is no next request on
that connection.
Red before: the cursor tests -count=10 -cpu 1,2,4 log the panic 11
times (a standalone full-duplex server returning before the body ends
logs it on every other request; 0 with Connection: close); after, 0.
go test -race -tags nogui ./internal/gateway (temp HOME), go vet
-tags nogui ./internal/gateway for darwin, linux and windows, and
gofmt -l pass at this head.
serve's try took its lane slot and waited for the minute (04704111)
before holdWriter.watch started, so for up to 2 minutes (or QueueWait,
unbounded by default) the agent got no status, no headers, no byte.
keepQueued runs beside lanes.take and rpms.wait: past keepHeldAfter it
sends the stream's 200 and ": keepalive" comments every keepaliveEvery
(keepAlive, the mechanism held tries already use; none for Gemini, #934).
Once they are out the try is held, so the vendor's error, or the queue
turning it away, reaches the agent as its protocol's stream error
(failTo: Chat's error chunk, Responses' response.failed, Messages'
event: error), and the next candidate still answers in the same stream.
A wait shorter than keepHeldAfter sends nothing: its 429 keeps its
Retry-After. Non-streamed requests are unchanged.
What the agents do with it (read from their app bundles, not tried live):
- WorkBuddy 5.5.6 / WorkBuddy AI 5.6.2 (codebuddy-headless.js): no
header timeout, first-token timer 20 min, so a 2-minute queue alone
doesn't time it out there.
- Qoder 0.4.3: 60s to headers, then 60s more after them; its SSE parser
drops comment lines, so keepalives don't extend that. Headers at 15s
give it 75s instead of 60s; longer waits need firstPayloadTimeoutMs.
- Trae: its agent is downloaded at runtime and wasn't read.
Verified (Linux, golang:1.26.8 in Docker):
- queue_keepalive_test.go through lanGuard(New().Handler()), with an
agent whose connection gives up after 400ms of silence: a request
queued 1.2s for the minute (chat, responses, messages) and one queued
for a Concurrency slot get 200, keepalives, then the reply; a vendor
500 after keepalives is each protocol's stream error; a QueueWait
waited out is the stream's error naming the limit; a short wait is
still a plain 429. With keepQueued taken out, every one but the 429
test fails with "i/o timeout". TestQueuedUnheldTryHeldOnceKeptAlive
fails without the hold (": keepalive\n{\"error\":...}" in the stream).
- go test -tags nogui ./internal/gateway: ok (122s).
- go test -race on internal/gateway the way CI runs it (go test -race -c,
build/race-shards.sh over 14 processes, -test.timeout=20m): 1258 tests,
every shard ok. A single serial -race process passes 10m's default
timeout, which is why CI shards it (#923).
- go vet -tags nogui ./internal/gateway for linux, windows and darwin;
gofmt -l clean. After rebasing on 5e17a183: TestQueued, TestBurst,
RPM, TestQuiet and TestSilentHeld under -race, and linux vet, pass.
A burst tells no speed when its window is under MinDecodeMs or its speed
over MaxDecodeSpeed. de5455b8's burst was 1,000 tokens: on a busy macOS
runner magpie took 138 ms to relay it, which is over 100 ms and under
10,000 tok/s, so it read a speed. A real burst of a few thousand tokens
reads over the cap; at 5,000 the relay would need over 500 ms to read a
speed. TestCodexBackendBurstTellsNoSpeed had the same 1,000; both change.
Red before: with the fake upstream taking 150 ms over the burst (two
writes), all three burst cases fail with CI's message ("1000 tokens in
192 ms … read 5208 tok/s"); with 5,000 they pass 3 of 3 with the same
delay. Still guards de5455b8: with DecodeOf's flow clamp off, all three
fail ("5000 tokens in 608 ms (flow 1) … read 8223 tok/s").
Run in docker golang:1.26.8 as uid 1000: go vet -tags nogui
./internal/gateway; go test -race -count=15 -cpu 1,4 on both tests pass.
A repository tagged magpie-plugin whose npm copy (from that repository)
names no file to load (no main, no exports) was listed and installed from
npm without the entry check the GitHub route has; it then failed every
host start with "has no entry" and a stack. Now:
- the Unreviewed list checks npm's copy the same way: one that names no
file needs the index.js the repository's own route needs (askTagged);
- `magpie plugin add` / the Plugins page refuse a package that names no
file, has no index file and is neither pi's nor a middleware, take the
package just installed for it out again, and say it isn't an OpenCode
or magpie plugin, and, for one with a bin, to add an MCP server under
Library → MCP servers (notPlugin);
- the host says the same, without a stack, for one already on the list.
Run: TestCommandOnlyPackageIsNoPlugin (magpie-x-search 1.2.0's real
package.json) fails without the change (Add = <nil>; with only host.js
reverted, the stack message), TestTaggedRepos with the real GitHub
package.json and npm latest of cyberElar/magpie-x-search fails without it
(listed), both pass with it; TestNotPluginKeepsPlugins (index.mjs, main,
exports, middleware, pi, a file stay plugins). go test -tags nogui
./internal/plugin under a temp HOME ok; go vet -tags nogui for darwin,
linux, windows. The built binary in a sandbox HOME: `magpie plugin add
magpie-x-search@latest` from real npm prints the new error, and
plugins/package.json no longer lists it.
Co-Authored-By: Claude <noreply@anthropic.com>
Run: go test -tags nogui ./internal/agent under a temp HOME: FAIL before
("MAGPIE_PARTNERS, read by ../provider/partners.go, is not in
agentenv.Vars"), ok after.
Co-Authored-By: Claude <noreply@anthropic.com>
wslTargetOf knew only Claude Code, Codex, Pi and OmO, so hermes@wsl:Ubuntu
was never a Library target and a skill meant for it could only go to
Windows' ~/.hermes. An agent whose places are all its own folder (a.Dir,
or beside a.Path) now gets the target targetOf makes on this machine, at
the distro's home the agent was found with: copies for skills, its MCP
file marked as WSL's (a Windows program is refused, magpie's own image
server goes by its WSL path), and the skills it reads besides its own are
the same distro's agents'. Agents whose places depend on this machine's
variables or home (Kimi Code, Crush, Cline, CodeBuddy, Goose) stay out.
Run: TestWSLOwnFolderTargets fails without the change (hermes@wsl,
omp@wsl, droid@wsl, opencode@wsl aren't targets; no copy of the skill),
passes with it. go test -tags nogui ./internal/library ./internal/agent
under a temp HOME on macOS (library ok; agent's TestFolderVarsAreListed is
red on main since 10578ce6, fixed in its own commit next), and
./internal/library in golang:1.26.8 Docker (Linux) ok; go vet -tags nogui
for darwin, linux and windows. Not run: a real Windows box with Hermes in
WSL.
Co-Authored-By: Claude <noreply@anthropic.com>
Run: usage-ledger-chart (Chromium + WebKit; new corner checks fail on the
old CSS, pass now; hover screenshots wide and 560px, dark), usage-ledger,
usage-ledger-fit, -detail, -content, ledger-hscroll, ledger-protocol,
mobile-web, number-units: all pass in both engines.
The app fetches the list behind the call every 6 hours (10 minutes after a
failure), never waiting, and keeps it in the cache folder. Each entry is
checked: its own id, never a built-in preset's; a name and an endpoint;
https only; at most 12; no decision API, no-key or user endpoint. Its logo
goes through FetchIcon. A partner is a preset to the rest of magpie, and
one that has left still is to the providers added from it, unsponsored.
The window lists a partner in the languages it names only, with its tagline
in the page's language; `magpie presets` and the TUI list them first too.
MAGPIE_PARTNERS moves the list, off lists none.
Run: go test -tags nogui -race ./internal/provider ./internal/gui
./internal/tui . (ok); TestPartners* -race -count=3; node --test
internal/gui/tests/partners.test.cjs add-sheet gui-ja gui-de i18n-keys in
Chromium and WebKit (en/zh/ja/de, 900 and 440px); node --test
site/worker.test.mjs site/install.test.mjs; the built binary in a sandbox
HOME against a local feed: listed, an http entry left out, listed from the
cache with the site down, `provider add` from it.
53 agnes-3.0-flash keys were 53 near-identical stage rows and 53 rows
under Accounts and keys. Now three or more keys of one provider standing
together for one model (same fixed effort, fallback and group-in-group
heading) fold into one stage row: "Agnes 53 keys agnes-3.0-flash", then
the lit key and what it does, "51 available · 2 resting". A request on a
folded key flies to the fold; a key failing and the next answering show
there (its 429 tag too). A click, Enter or Space opens it in place: each
key keeps its own row, state and wire, drawn from the fold. Accounts and
keys folds the provider's keys into one row with their summed tally and
models, and opens the same way. Open folds are kept per reader in
localStorage magpie.routingKeysOpen. Two keys stay two rows; one key is
as before. Display only: the gateway's order and choice don't change.
New strings in zh, zh-TW, ja and de. docs/subsystems/gui-shell.md says how.
routing-account-order's relay has three keys, so it now opens their fold
to read their order.
Run: routing-keys-fold.test.cjs (32: folded, open/persist/Enter, live
updates folded and open, Accounts and keys, 440px; Chromium and WebKit;
en, zh, ja, de) — fails on main (no fold). All routing-*.test.cjs,
panel-routing, click-scroll, fold-show-grip, gui-ja, gui-de, gui-zh-tw,
i18n-keys: 409 pass. Every other test that opens Routing (29 files, 152
tests) passes but purpose-filter's WebKit "returning focus does not scroll
the page", which fails the same alone on origin/main (off by 1px).
go vet -tags nogui ./internal/gui (darwin, GOOS=linux, GOOS=windows).
DeepSeek's /user/balance lists balance_infos in an order that changes from
read to read. readDeepSeek wrote them as they came, and the balance history
kept the first number of the string, so the chart alternated between the two
currencies. readDeepSeek now sorts them (money left first, then by code). The
history keeps each currency of such a balance under a key of its own
(balanceCurrencies), the card's trend is the first one's with
BalanceTrend.currency set, and the card's old line (which can't be split
again) is dropped on the first such read. app.js says the curve's legend,
readings and pace in that sign alone ("$11.12", not "$11.12 · ¥-0.05" after
every amount). The usage alert reads the first amount too, so it no longer
flips between the two currencies either.
Red before: TestBalanceHistoryTwoCurrencies (reporter's shape: CNY -0.05 and
USD 11.12, order swapped each read) fails with 'card says "¥-0.05 · $11.12",
want "$11.12 · ¥-0.05"' on the old readDeepSeek, and with the old history
alone the trend holds 11.2, -0.05, 11.15, …; TestBalanceReaders' two new
cases fail the same way. balance-currencies.test.cjs fails on the old app.js
with 'Balance$11.12 · ¥-0.05' and 'about $0.44 · ¥-0.05 a day'.
Run (Docker golang:1.26, temp HOME): go test -tags nogui ./... (only
internal/agent's TestAside* write-failure tests fail, as root in the
container; they pass as uid 501), go vet ./internal/provider ./internal/gui,
GOOS=linux/windows/darwin go vet ./internal/provider, gofmt -l. GUI:
balance-currencies, balance-curve, balance-parts, balance-fix in Chromium
and WebKit (110 pass; en/zh, light/dark, 900 and 440px). No new t() strings.
Not tried with a real DeepSeek account holding both currencies.
Library's and Plugins' sticky tab strip (.lib-head) and Providers' sticky
Add bar (#view-providers .after-list) reached over the view's side padding
by a negative margin (-12px, -16px in the window, the view's padding in
the narrow browser page), so their boxes ran 12-16px past the view's
content end edge. macOS 15's WebKit (Safari 18) takes a flex scroller's
scrollable width as the furthest in-flow child's right edge plus
max(0, margin-end), then adds the padding-end (RenderBlock::computeOverflow's
includePaddingEnd, before WebKit 290159@main / bug 218579, which shipped in
macOS 26): the negative margin is left out, the page is 12px (Providers) or
16px (Library, Plugins) wider than the view, and with classic scrollbars a
draggable horizontal bar shows. That is the reporter's three pages and only
those, at every text size and width. Chromium and macOS 26's WebKit count
the margin, so neither scrolls.
The strips' boxes now keep to the content box; a ::before paints the
frosted strip / the fade over the padding (--bleed-l/-r), the hairline
moves to it, and the pre-color-mix fallback too. Looks the same
(before/after screenshots, light, window and browser page).
New internal/gui/tests/view-no-sideways.test.cjs visits every page, en/zh/
ja/de, the window (body.mac) at 560 (windowMinW) and 1000px and the browser
page at 360/440/1000px, Chromium with its scrollbars shown and WebKit, and
checks both macOS 15 WebKit's sum, worked out from the layout, and the
engine's own scrollWidth. Red before: 40 of 40 cases in each engine, on
providers (12px, div.after-list), library and plugins (12/16px,
div.lib-head) and no other page. Green after, 42/42.
Also run, BROWSER=chromium and BROWSER=webkit (712 of 714 pass; the 2 are
library-servers-bulk in Chromium, the same 2px flake on the old assets, #1322):
click-scroll, gui-ja,
gui-de, add-button, deprecated-subscriptions, plugin-market,
provider-discovery, every library-*, plugin-* and provider(s)-* test.
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gui pass.
Not tried in a real macOS 15 WKWebView: this Mac runs macOS 26, whose
WebKit has the fix; the rule was read from WebKit's source at 2025-01.
The cursor mover's min goes from 0.1.11 to 0.2.0, so keepMovedCurrent updates every moved Cursor user. The ids picks were saved under before (claude-opus-5-5, claude-opus-5-5-fast, cursor-grok-4.6, a variant's own slug) keep working. magpie still sends an id the plugin no longer lists to the plugin unchanged: provider.Resolve accepts any cursor/<model> while the provider is on, and pluginFetch builds a stub model. The plugin's named() then resolves the id to its variant.
0.2.0 on npm was checked against registry.npmjs.org: its index.mjs is byte-identical to plugins main 8cd5a0f. The plugin PR was reviewed at c64bc3d and merged onto main:
- bun test in packages/cursor: 48 pass, 0 fail
- bun scripts/check.mjs cursor passes
- seven deliberate breaks, each caught
- not tried with a real Cursor account on the review side
go test -tags nogui ./internal/provider passes in Docker (golang:1.26.8, temp HOME, module cache read-only). go vet -tags nogui ./internal/provider passes for linux, windows and darwin. gofmt -l is clean.
The warm-up reads every session file for the Sessions page and Usage › Requests. On a 13.5k-session history it allocates ~830 MB (QueryPage ~570, StatsFor ~260) to keep ~80 MB of indexes, and Go's scavenger returns the freed pages only over the next minutes. warmUp now calls debug.FreeOSMemory once its reads are done: one forced GC and scavenge, once, at start.
RSS of a linux nogui `magpie web` in Docker on a copy of a real config with those sessions mounted read-only, sampled every 15 s from start (with the dsh round change before it): 15 s 472 -> 197 MB, 30 s 475 -> 285, 60 s 417 -> 281, 2 min 337 -> 281, 3.5 min 266 -> 218, 12 min ~250 -> ~204. TestWarmUpReturnsItsGarbage fails without the FreeOSMemory call (10 of 10: 46-334 MB of freed heap still held, or the heap not yet collected) and passes 10 of 10 with it. go test -tags nogui ./internal/gui ./internal/sessions (Docker golang:1.26.8, temp HOME), go vet -tags nogui ./internal/gui for linux, windows and darwin, and gofmt -l pass. Not measured on macOS: a fresh build there hangs at exec behind syspolicyd today.
dshWiredOnce built magpieModels("dsh") before looking for a profile, so every magpie, dsh or not, built the catalog every 30 s and threw it away: 93% of what a magpie at rest allocated (pprof heap?gc=1 delta over 120 s, a linux nogui `magpie web` in Docker on a copy of a real config with 13.5k Codex and Claude Code sessions mounted read-only). That garbage kept the heap at its GC goal, about twice what it keeps. It now returns before the catalog when there is no profile; with one, nothing changes.
Same measurement, this commit and the warm-up one together: idle allocation 73 MB per 2 min -> 6.8 MB (3.8 MB of it the profile read itself); RSS at rest after the first minutes ~250 MB -> ~203 MB, the heap no longer climbing 125 -> 192 MB between GCs. TestDshRoundWithoutDshBuildsNoCatalog fails without the change (475 allocations a round) and passes with it. go test -tags nogui ./internal/agent (Docker golang:1.26.8, non-root, temp HOME), go vet -tags nogui ./internal/agent for linux, windows and darwin, and gofmt -l pass. Not measured on macOS: a fresh build there hangs at exec behind syspolicyd today.
de5455b8's tests asserted that the time from the first word to the end
was at least the upstream's 600 ms wait. The fake upstream starts that
wait once it has sent the first word, and magpie stamps TTFT when the
word arrives, so the span is the gap less the delivery time: 599 ms on a
busy macOS runner. TestBurstTellsNoSpeed had the same `span < gap`
check; both now want 90% of the gap. The speed assertions they guard
(a burst tells no speed, a steady stream keeps it) are unchanged.
Run in docker golang:1.26.8 as uid 1000: go vet -tags nogui
./internal/gateway; go test -race -count=15 -cpu 1,4 -run
'TestCodexBackendBurstTellsNoSpeed|TestBurstTellsNoSpeed' pass. Not
reproduced locally with an injected delay; the CI log above is the red.
After pi compacted a session, every turn on factory/claude-opus-5-5 was 403
"Factory: Forbidden". The reporter's replays found the refused part: pi's
fixed opening of its summary message, "The conversation history before
this point was compacted into the following summary:"
(COMPACTION_SUMMARY_PREFIX in pi-coding-agent dist/core/messages.js), whole.
Plugin 0.1.21 (magpie-community/plugins f4c0d96, on npm) rewords that
sentence, and pi's branch summary opening, when a user text is pi's whole
summary, on Messages, chat completions and Responses; the mover's min is
raised so keepMovedCurrent updates moved users. The built-in, which has
none of the plugin's pi or Claude Code adaptations (#952, #1132), is
unchanged.
Plugin: its new pi.test.mjs tests fail on 0.1.20 and pass on 0.1.21; bun
test (114 pass) and check.mjs factory pass; the npm tarball's index.mjs is
the committed one. Here: go test -tags nogui -count=1 ./internal/provider/
in Docker (golang:1.26.8; on the Mac new test binaries hung in dyld while
syspolicyd was at 100%), go vet -tags nogui for darwin, linux and windows,
gofmt -l pass. Not tried against Factory itself (no Factory account here).
Cause: window focus and visibilitychange called load(), which on the Usage
page called loadUsage(): renderUsageLoading() hid #chart, put the KPI
skeletons up, and renderUsage() drew every bar again. Under focus-follows-
mouse every pointer crossing is a focus. load(true) now goes through
refreshUsage() when the tab's figures are drawn (usageDrawn), and loadUsage()
as before on a first draw or when the language changed.
Test: internal/gui/tests/usage-focus-steady.test.cjs fires focus and
visibilitychange and watches the Overview bars, the Requests columns, the
tray panel's columns and Routing's group card. With the old app.js it fails
in all 4 runs ("nothing changed: the chart isn't blanked": skeleton, chart
hidden); with only the panel change reverted ("dimmed", "bars removed");
with only the Requests path reverted ("bars removed"); with the old
routing.js ("the same group card stays": 0 vs 1). Passes in Chromium and
WebKit, en and zh. 998/998 pass across the usage*, panel*, tray*,
sessions*, context*, group*, routing* and focus/visibility-firing GUI
tests in both engines. No strings or Go changed (no gui-ja/gui-de, go vet
needed). Not tried on real Hyprland.
usage.WithWindowHolds fills QuotaWindow.Holds on GET /api/usage/quotas and its refresh, from usage.jsonl: the card's provider (by its id now, so a moved plugin's card and a renamed provider count), its account (ProviderAccount, or an older record's Host), calls to the models the window counts (Claude's Opus-only or Fable week), not turned away, from the window's start up to when the share was read. Priced by catalog.Price.CostSplit at the maker's list price, else the provider's own list, never the user's own subscription price: Anthropic's 5-minute and 1-hour cache writes at 1.25x and 2x input, OpenAI's cached input and no cache write price. A call with no API price leaves the window tokens-only. The caller's cards are not written to.
Not told where it wouldn't be honest: under 5% used, nothing routed in the window, magpie's log starting after the window did, no reset or no span (credits with no reset, Copilot's premium requests), Antigravity's per-model family and pool windows, Aside windows, a card with an error, a balance, or one read from another computer. The tooltip says how it was reckoned and that use of the account outside magpie makes it read low (the request said 偏高; such use raises the share without adding to what magpie saw, so the estimate is lower than the truth). en, zh, zh-TW, ja, de.
Run: go test -tags nogui ./... in Docker (golang:1.26.8): all pass but internal/agent's Aside* chmod tests, which fail only as root and pass with --user 1000. The new tests fail with the log-start check removed, the model scope removed, the caller's windows not cloned, and 1-hour cache writes at the 5-minute price. Against a read-only copy of the owner's usage.jsonl, quotas.json and models.json: Claude's week (71%) ≈ 46K tokens / $14.16 from 165 calls, its Fable week and 5 hours (12%) nothing, every other card nothing (under 5%, or no reset). New quota-holds.test.cjs passes in Chromium and WebKit at 360, 440 and 1000px in en, zh (万), zh-TW (萬), ja, de, and fails with the new CSS removed; click-scroll, gui-ja, gui-de, i18n-keys, quota-* and usage-* pass (304/304). go vet -tags nogui (darwin, GOOS=linux, GOOS=windows) and gofmt -l on the touched packages pass.
A magpie serving only other magpies (`magpie serve` in a container) has nobody on its Usage page, so GET /v1/magpie/quotas/cards, answered by CachedCards from the page's caches (subscriptionUsageCache, planQuotaCache, keyBalanceCache), said "nothing read on that magpie yet" while its Codex account's usage was read every few minutes behind the requests: those readings land in loginUsageCache (and a key's in keyAllowances), which CachedCards never looked at; after a restart even a page-read card was gone until the page was opened, though quotas.json held it.
CachedCards still asks nobody. It now lays each account's latest LoginUsage reading over its card when it is newer by readSeq (perLogin's cards are that same reading, so the page's own later read stands), adds a card for an account read that way and never on the page, named and drawn as the page names it (accountCard: perLogin now takes that face), and falls back to the reading kept on disk, dated (AsOf). Keys the same way: routing's KeyAllowance reading now keeps what was read with the windows (plan, balance, parts, readSeq) and is laid over the key's plan or balance card, or makes one; with no card read since start, the plan and balance cards kept in quotas.json are told. Cursor (known by asking its CLI), Grok (read by home) and a Kiro key keep the page's cards only. The local Usage page is unchanged.
Not fixed here: the quota history (/v1/magpie/quotas/history) is still written only by the page's reads.
Red before: with CachedCards as on origin/main and everything else in place, TestRemoteMagpieShowsBackgroundReadings (gateway, through lanGuard(New().Handler()) and a remote-magpie provider: CodexUsedUp, then RemoteCards) fails with the reporter's card ("nothing read on that magpie yet; refresh to have it read"), and TestCachedCardsTellBackgroundReadings, TestCachedCardsKeepALaterPageRead and TestCachedCardsTellKeyReadings fail; all pass with it. ForgetKeptCardsForTest is called from the gateway's fresh() so TestRemoteMagpieQuotas's "nothing read" holds under -count.
Run (Docker golang:1.26.8, the Mac's syspolicyd pegged): go test -tags nogui ./internal/... (internal/agent as uid 1000), go test -race ./internal/provider ./internal/gateway, go test -count=2 -run TestRemoteMagpie ./internal/gateway; go vet -tags nogui for darwin, linux and windows on internal/provider and internal/gateway; gofmt -l. No app.js change.
* agents: Qwen Code (qwen) as a managed agent (#1279)
Qwen Code (QwenLM/qwen-code, a Gemini CLI fork) keeps custom model
providers in ~/.qwen/settings.json modelProviders.<protocol> entries
({baseUrl, envKey, id, name}, envKey naming a variable in the same
file's env object) and its session model in settings.model
{name, baseUrl}.
magpie writes one modelProviders.openai entry per catalog model —
wire id the gateway takes, name magpie/<provider>/<model>, every one
on env.MAGPIE_API_KEY holding the gateway's key, which is how an entry
of magpie's is told from the user's own — and points settings.model at
a pick. Stash, Check/drift, Sync, port-move Rewire and disconnect work
as for the other JSON-config agents; on disconnect the user's entries,
model and key are restored, the file byte-identical to before.
Verified: go build, GOOS=linux nogui + GOOS=windows builds, go vet
./...; go test -tags nogui ./internal/agent (TestQwen* pass;
TestDriftUnwiredEveryAgent/qwen and TestPortMovesEveryAgent pass after
binding drift identity to the entry, not the address), go test -race
-count=3 -run TestQwen, go test . (TestAgentQwenDefault: set then
'default' restores the settings byte-for-byte). TestQwen fails with
'unknown agent' when the registration is reverted. Real use: a copy of
a live 341-line settings.json in a sandbox HOME — wire, then
'qwen default' left it byte-identical. Not run: GUI suite (no
gui/assets change); TestReasonixCLI* and TestPluginHTTP2TakesTheProxy
fail on main too (fixture/network), unchanged by this.
* agents: qwen honors QWEN_HOME, sets auth type, owns a qwen-specific key name, carries context windows (#1279 review)
- $QWEN_HOME stands for ~/.qwen, resolved as the other agents'
(via place.getenv, appdir.Getenv; a distro's isn't read), and is in
agentenv.Vars so the sandbox clears it
- wiring sets security.auth.selectedType openai so qwen skips the
/auth prompt; the user's own (including a pre-existing "openai",
told from magpie's by a stash marker) is restored on disengage
- envKey is MAGPIE_QWEN_API_KEY: a shell-exported or ~/.qwen/.env
value wins over the settings' env, so the magpie-generic name is
not used
- entries carry generationConfig.contextWindowSize from the catalog
- a settings.json without modelProviders reads as no models of anyone,
instead of gjson's 'cannot use null as iterable'
Verified: TestQwen* incl. TestQwenAuthOpenAIOfTheUsersOwn and
TestQwenHomeOverride, TestAgentQwenDefault (CLI), -race -count=3;
unwired-drift and port-move generic tests pass. Real end-to-end:
dev gateway on 127.0.0.1:3999 in a sandbox HOME, real qwen binary in
a sandbox QWEN_HOME ran a prompt through the gateway (PONG), and
wire → default left the settings byte-identical. Reasonix fixture
tests fail on main too (environment).
* agents: qwen's requests are attributed by their QwenCode/<version> User-Agent
Reported by mac0923: Agent Space rejects Responses probes with anthropic-version as 400 invalid_headers. Add the default version only for Anthropic Messages while preserving custom headers through Sign.
TestProviderProbesUseProtocolHeaders fails before the fix across endpoint tests, model tests and both detection paths, then passes with the fix, including 20 race-detector runs. go vet and macOS, Linux and Windows builds pass.
A custom provider with the same relay as its OpenAI compatible and OpenAI
Responses URL: magpie asks a GPT on a relay on Chat Completions first (Pi is
wired on openai-completions for it), and the relay turned Pi's tools away with
400 "gpt-6.1-sol requires Responses for tool calls; this account only supports
Chat Completions". wrongEndpoint didn't know that wording, so the 400 reached
Pi instead of the request going on to the Responses URL. "requires responses"
is now one of its phrases: the model is remembered as not served on that
relay's Chat, and the request (relayed as Pi sent it, or translated from
Claude Code's Messages) is spoken as Responses there, later turns at once.
Where the provider has no Responses URL, the error now says so
("gpt-6.1-sol is served on /v1/responses, which <provider> has no URL for")
rather than the relay's word alone (wrongAPINote reads the error body).
Red before: TestToolsThatNeedResponsesGoThere failed with the user's exact
error ("status 400: ... requires Responses for tool calls; this account only
supports Chat Completions"); TestTranslatedToolsThatNeedResponsesGoThere,
TestToolsThatNeedResponsesNameTheMissingURL and TestWrongEndpoint's new case
failed too. With the phrase but without the note, the missing-URL test fails.
go test -tags nogui ./internal/gateway ./internal/provider pass, and
./internal/agent as a non-root user (as root in Docker its chmod-based
aside_offline tests fail, unrelated); go vet -tags nogui ./internal/gateway
for darwin, linux and windows, and gofmt -l pass (linux, golang:1.26.8 in
Docker: this Mac's syspolicyd is pegged and new binaries hang at launch).
Not tried against the reporter's real relay.
169c23c1 cut only `@wsl:` from agent ids, and 78d90571 (four minutes
earlier) made each omp profile an agent `omp#<name>`, so the profile
name went to PostHog. modelLabel sent `<preset>/<model>` for any model
on a preset's provider, and on Ollama, LM Studio or a fine-tune that id
is the user's own text. docs/reference.md promised "No names". Model ids
on subscriptions and plugins are the vendor's and are unchanged; known
models on a key's provider still go by id (deepseek/deepseek-v4).
Red before: with the old usage.go, TestAgentLabel fails ("omp#acme-secret",
want "omp") and TestModelLabelKeepsTheUsersOwnModelIDs fails
("openai/ft:gpt-4o:acme-corp::abc123", want "openai/other";
"ollama/acme-internal-llm", want "ollama/other"); both pass with it.
Run in docker golang:1.26.8 (this Mac's syspolicyd is pegged and new
test binaries hang before start): gofmt -l, go vet -tags nogui on
stats/agent/catalog, GOOS=windows go build, go build -tags nogui, and
go test -tags nogui ./... — all pass except internal/agent's aside
chmod-0500 tests, which root ignores; internal/agent passes as uid 1000.
Set in the provider editor (under Concurrency; empty or 0 is no limit) or
with `magpie provider rpm <id> [n|off]`; kept per provider as MaxRPM, a
subscription's with its picks. Over the limit the gateway waits until the
oldest request of the minute is a minute old, in the order they came,
after the lane's slot and right before sending. A wait longer than 2
minutes (or the provider's Queue wait, when shorter) is turned away at once
with a 429 and a Retry-After of when the minute has room; nothing rests for
it. An agent gone while waiting gives its place back and is never sent.
Every request that reaches the vendor counts: each try of the forward
loop (retries, the next key, fallbacks) waits in serve, and requests a try
makes on the way plus the gateway's own (count_tokens, System One
decisions, embeddings, drawing/video, Kimi search) are counted by an
rpmTransport on s.client. count_tokens never waits: a key with no room is
skipped and the local estimate answers. A key or account with no room in
its minute gives way to a ready one of the provider or the group, as a
full lane does (laneMate). No wait happens under rpms.mu. Not counted: a
plugin account's own extra requests (its own transport; its tries are).
Verified (Go tests on Linux in Docker, golang:1.26.8, since new binaries
hang at launch on this Mac while syspolicyd is pegged):
- internal/gateway rpm_test.go through the real server stack
(lanGuard(s.Handler())): limit 2, third request reaches the vendor a
window after the first, all 200; past the bound a 429 with Retry-After
and no rest; a cancelled waiter is never sent and gives its place back;
a 503 retry and a count_tokens count, and a count with no room is
estimated; a group member with no room gives way. With RPMLimit forced
to 0, those five gateway tests fail. -race -count=5 passes.
- internal/provider TestSetRPM (clamp, subscription picks reach each
account), TestRPMCmd, internal/gui TestRPMSave.
- go test -tags nogui ./... on Linux: all pass except internal/agent's
TestAside* write-refusal tests, which fail only as root in Docker and
pass as uid 1000.
- go vet -tags nogui for linux, windows and darwin; gofmt -l clean.
- GUI: new provider-rpm.test.cjs (en/zh/ja/de, 360 and 440px, Chromium
and WebKit; 32 pass, and all 16 Chromium cases fail on the old app.js),
plus gui-ja, gui-de, gui-zh-tw, i18n-keys, provider-concurrency,
lane-limit, provider-price-rate and clinepass-pin in both engines.
Not tried against the real OpenRouter.
John's request (OpenCode, a group served by Kimi Code at api.kimi.ai,
Chat) showed 1,367 token/s: its tokens counted over the time from its
first token to its end, though nothing came in between and the rest came
at once. The 100 ms / 10,000 tok/s bounds catch a burst only when the
first content comes with it.
firstToken now reads on past the first text and marks when each content
event's bytes came (one mark a millisecond, up to 65,536 marks and the
8 MB it reads), and flowMs is how long the content took to come from
where the speed is counted: the span from a tenth of its bytes to nine
tenths, scaled to the whole. A steady stream gets about its whole window;
one let go in a burst about 1 ms. It is kept as Call/Try/Route .flow and
usage.Record.flow_ms (and the Requests page's packed rows), and
usage.DecodeOf, routing.js's decodeOf and app.js's ledDecode count no
longer a window than it. A record without it reads as before.
Verified: TestBurstTellsNoSpeed, a fake Chat vendor that sends a word,
waits 600 ms, then 199 words and the end in one write (1,000 tokens), for
a Chat and a Responses agent: no speed; before, 1636 and 1655 tok/s. Its
steady case (a word every 60 ms) keeps 200 tokens over most of its
window. TestCodexBackendBurstTellsNoSpeed is the same through Codex's own
ChatGPT backend (before: 1,000 tokens in 601 ms). TestFirstTokenKinds now
expects the stream read past its first text. Go tests ran on Linux
(golang:1.26 in Docker; this Mac's syspolicyd held new test binaries at
launch). GUI: routing-burst-speed (a route with John's 5.1 s first token,
6.7 s and a 2 ms flow: was "1367 tok/s", now none) and usage-speed (a row
with flow_ms 2 shows "—") fail without the JS change and pass with it,
with reasoning-speed, routing-request-metrics and usage-ledger-detail, in
Chromium and WebKit (en/zh, ja/de where the tests have them); no strings
changed. Not reproduced with Kimi Code itself: whether it holds the
stream so is inferred from the numbers.
Alma has one: Settings › Image Generation, settings.imageGen.model,
"<providerId>:<model>" like chat.defaultModel, "" for Auto (Alma's
src/services/settingsApiService.ts defaults). Its `alma image gen` and
in-chat image requests send an openai-type provider's model to
{baseURL}/images/generations, which the gateway draws with.
Choosing one of magpie's models for Alma now also sets imageGen.model to
magpie's provider and the model magpie draws with (gateway.Drawer: the
Settings' Image generation model, else AutoDrawer's), only when it is
Auto: a model the user picked, theirs or magpie's, is left. Sync leaves
an Auto alone (the user may have gone back to it) and only replaces one of
magpie's that magpie no longer offers. That model is listed on magpie's
provider with capabilityOverrides.imageOutput, as Alma's picker lists only
a provider's models that make images and shows another as "unavailable".
Going back to Alma's own model puts an image model of magpie's back to
Auto with the provider. Nothing changes when magpie draws with nothing.
Verified: TestAlmaImageGen against the fake Alma (settings kept whole,
aspectRatio untouched): Auto filled with p1:img/gpt-image-1 and the model
listed with imageOutput; the user's own pick and a magpie chat model kept
by Apply and Sync; Auto kept by Sync; a stale magpie drawer replaced; Auto
again on going back. It fails without almaSetImage ("image generation:
\"\", want \"p1:img/gpt-image-1\""). TestAlma checks nothing is written
when magpie draws with nothing. Go tests ran on Linux (golang:1.26 in
Docker). Not tried with the real Alma: Alma's settings page reading the
override as an image model, and an image drawn through it, are unverified.