magpie wrote modelProvider gemini, the model and its custom models into
agy's settings.json. That made every agy an API-key session: no Google
account, so no remote control (needs the sign-in plus Google's server-side
flag), and a plain agy asked for GEMINI_API_KEY too.
Now they go in ~/.gemini/antigravity-cli/magpie-settings.json, handed to agy
as --settings for the one session (the launch command, magpie agy run, and
the function in a shell or a WSL distro). settings.json stays the user's.
An older wiring is given back (stashed model and provider) at the next Sync
or pick. agy remote-control and --remote-control run plain, on the sign-in.
Run (mote): go vet, GOOS=windows and linux nogui vet, agent/cli/sessions/update
packages (see push note). Real agy 1.5.3 in a sandbox HOME: plain agy with
the user's untouched settings.json now asks for sign-in (no GEMINI_API_KEY
error); the new launch reached a stub gateway at /v1beta/models/<m>:streamGenerateContent.
Broken by hand: remote-control bypass removed, TestAgyRun red; TestAgy red
on the old code (settings.json written).
Not tried: real remote control (needs a Google sign-in, none in the sandbox);
signed-in BYOM custom models; Windows PowerShell function run.
A 429 or quota refusal whose body names the model asked (Groq's per-model
TPD, OpenAI's per-model TPM, Gemini's QuotaFailure, any vendor's "limit for
model X") used to rest the account's key, so every other model of the
provider waited. modelNamed (routing.go) now sends such a refusal down the
same path as modelCooledDown: it rests restID (key/model). Readers of rest
state (restingOf, sink, GUI badges via Rest.Model) already understood those.
Account-wide refusals (no model named, another model named, credit, auth)
still rest the key. The id match is on whole ids (gpt-4o is not gpt-4o-mini).
Cline's and ZCode's guard tests expected another vendor's words to rest the
key even when they named the very model; they now expect the model alone.
The "not a trial" ZCode row moved to the new test.
Run (mote): the new TestModelNamedLimitRestsTheModelNotTheKey,
TestLimitNamingNoModelRestsTheKey and TestModelNamedReads, red on the old
code (mr-red.log); gateway tests matching Rest|Rate|Quota|Fallback|Limit|
Cooled|Pool|Overload|Sink|Credit|ZCode|Cline; gofmt; darwin, linux and
windows go vet of internal/gateway.
Broken by hand: modelLimited back to modelCooledDown only, the new tests go red.
Not tried: a real vendor account; the full suite (started after the tag).
The Windows and Linux downloads (and the CLI builds) are the raw binary, so
what is embedded counts in full. 8.2 MB of the 12 MB under internal/gui/assets
is scripts, styles and svgs. `make assets-pack` (build/assetpack) writes them
to internal/gui/assets.zip (deflate; png/jpg/webm stored), and the release
targets and `make app` build with -tags packedassets, which embeds that zip
instead of the tree (assets_packed.go: a file is unpacked once, on first use,
and served seekable with no modification time, as an embedded one is). Plain
`go build`, `make build`, `make cli` and every test still embed the tree.
The zip is git-ignored and made before every release build.
Sizes (go build -trimpath -ldflags="-s -w", on mote, at e430e2750):
linux/amd64 nogui 73,203,874 -> 67,502,242 (-5,701,632)
windows/amd64 app 88,401,408 -> 82,755,584 (-5,645,824)
The macOS zip/dmg compress the binary already, so they gain nothing.
Run: assetpack, then `go test -tags packedassets -run TestPacked ./internal/gui`
(passes: every file byte for byte and no other; / and a range of the webm served;
no Last-Modified). The first try failed it with "packed has 0 files, the tree
301" (zip entries lacked the assets/ prefix), so it does go red on a bad pack.
go vet ./internal/gui on darwin, linux nogui, windows and -tags packedassets:
clean. gofmt clean.
Not run: the full suite and the GUI suite (default builds embed the tree as
before; api.go only lost the embed line), a real release through
magpie-releases (its release.yml calls these make targets), the Linux GTK
build (cgo).
IDEA 2026.3 starts a WSL project's ACP agent inside the distro through EEL.
An absolute Windows command whose environment differs from the project's is
refused ("ACP executable belongs to a different environment"), which the AI
Assistant shows as "Magpie does not run". The host entry in ~/.jetbrains/acp.json
therefore never worked for a WSL project.
Now each running distro that has opencode gets its own "Magpie (WSL <distro>)"
entry: command is the distro's opencode as a \\wsl.localhost UNC path (the
WSL descriptor, accepted), env OPENCODE_CONFIG points at a magpie-opencode.json
written in the distro's ~/.jetbrains. Set, Sync, Check and the uninstall path
all reach the entries; a stopped distro is never started. The probe now
records the binary paths (distro.Paths).
Ran: mote-run go test -run 'TestAir|TestWSLProbeKeepsPaths' ./internal/agent
(ok), the same on win-run and wsl-run (ok), gofmt, GOOS darwin/linux/windows
go vet ./internal/agent. Broke by hand: turning the WSL branch off in airAt
turns TestAirIDEAddsMagpieAgentForWSLProjects red.
Not tried: a real JetBrains IDE (none on the Windows box); the EEL rule was
read from the IDE's bytecode.
Follows Rainier's two commits (cherry-picked with authorship, #5987).
What LazyCat's own docs say (developer.lazycat.cloud/en/http-request-headers.html,
read today): lzc-ingress authenticates a request, and after a success sets
X-HC-User-ID, -User-Role (NORMAL or ADMIN), -Device-*, -Login-Time; "if
authentication fails, it will clear the above X-HC-XX headers", and "lzcapp
developers ... can directly trust X-HC-User-ID". X-HC-User-Groups is said to
have the caller's own removed. X-HC-Source is in no page of the docs; the
sign-in's use of it only narrows who gets in. The docs name no address for
the ingress, so the peer can't be named; a TCP ingress or port forward passes
headers as sent (the docs for it say no authentication), which the manifest
section already says to keep off the page's port.
This commit: lazyCatSignIn turns away a peer that isn't on a private,
loopback or link-local address (or isn't an address), whatever headers it
sends. The client-routes list gains /magpie-ca.crt, which main added after
the branch's base (TestLazyCatManifestListsTheClientRoutes was red on it).
TestTranslatedRoutesDropProxyIdentity adds the chat and messages routes to
the vendor-leak tests (native, Codex relay and MCP were covered).
Run (mote, go1.26.8): gofmt clean; go vet on gui, gateway and cli for darwin,
linux nogui and windows; LazyCat, ProxyIdentity, OnePort and Web tests in
internal/gui and internal/gateway ok.
Broken by hand: with the peer check off, TestLazyCatSignInIgnoresAPublicPeer
is red; with X-Hc- out of proxyIdentity, TestNativeAnyDropsProxyIdentity and
TestPassthroughDropsProxyIdentity are red.
Not tried: a real LazyCat box (none here); the plugin fetch route builds its
headers from the request magpie made, read, not run. Full suite and GUI
tests follow the tag.
Co-Authored-By: Rainier <74943233+Rmosser@users.noreply.github.com>
magpie in a LazyCat app (懒猫微服) is opened from the box's app list by
someone signed in to the box already, and asks for a key they never
saw: it is in the container's log. A package can only hand the key to
every browser that reaches the app, or put a proxy in front that adds
the key's cookie to what the box signed in.
The box's ingress, lzc-ingress, sends a browser that isn't signed in to
the box's login page, and puts on every request it passes the app the
box account (X-HC-User-ID), its role (X-HC-User-Role, ADMIN or NORMAL)
and what sent it (X-HC-Source, client for a browser), in place of what
the caller sent. With MAGPIE_WEB_SIGN_IN=lazycat webGuard takes that
sign-in besides the key: lazyCatSignIn lets in an ADMIN account sent by
a browser, each of the three named once, and tells anyone else the box's
reason.
The box's sign-in is a cookie of the box's, and the box's apps are one
site, so a browser sends it with another app's page's requests too: an
earlier build of this change let another app's page on the box include
/boot.js and read window.bootPrefs. So it is taken only for what the
page itself or the user asked for (boxFetched, the Fetch Metadata:
Sec-Fetch-Site same-origin or none, or a GET or HEAD navigation to a
document from another page), never for another page's script, frame,
fetch or form POST, nor from a browser that sends no Fetch Metadata.
It sets no cookie of the page's own, so signing out of the box signs out
of the page. The key's link and cookie work as before, /api still
answers the page alone (webOwnPage), and the gateway's client routes on
the page's port go to the gateway first (onePort), which asks for a
gateway key. StartWeb refuses another value, and lazycat where
LAZYCAT_APP_DOMAIN, which LazyCat sets in an app's containers, isn't
set: all magpie can check, so the setting is the package's word that the
box's ingress is the only way to the page's port. magpie web prints the
box's address beside the link.
Docs: reference.md's new LazyCat section, with a manifest and what must
never reach the page's port, and gui-shell.md's Browser mode row.
On a box (lzcos 1.6.2+fix.4), a probe app that echoes its request
headers: a signed-in browser's request carries X-HC-User-ID,
X-HC-User-Role ADMIN and X-HC-Source client, forged ones replaced; not
signed in, / goes to the login page and a public path gets none of the
three (forged ones taken off, repeated or in lower case too), while
X-HC-User-Groups passes on as the caller wrote it, so it is never read;
a TCP ingress passes every header as sent. Another app's container
reaches the app through the ingress alone (straight to the app's
container it times out); the box itself, and a container in its network
(network_mode: host, which a manifest may set), reach the port.
A test app made from the docs' manifest, running a build of this change
on 68cb92e8e in the image's place as its user (uid 65532): the box's
administrator opens the console with no key, and no cookie is set;
/v1/models still asks for a gateway key; from another app's page a
navigation opens the console, while a script include of /boot.js and a
frame are turned away; in the container, past the ingress, a request
with no Fetch Metadata, no X-HC-Source, NORMAL or a header twice gets a
401. Bound to /lzcapp/var/config, which the box makes as root's, magpie
couldn't write /config; bound to /lzcapp/var it can, and a gateway key
outlived the container.
Tests, through webServed with the headers the probe saw:
TestLazyCatSignInOpensThePage, TurnsAway, AsksWhereFrom, IsAskedEachTime
and IsNoGatewayKey (the client routes, with each sign-in that opens the
page), and TestWebBoxSignInChecksItsValue.
TestRemoteOpensTheOtherMagpie, new on main, gives webHandler no box
sign-in.
Run, at this tree, on 6c3f113ce: Docker golang:1.26.8 (linux/arm64):
gofmt clean; go vet -tags gtk3 ./... (with the GTK and WebKitGTK
headers, as CI), -tags nogui and GOOS=windows clean; both builds ok.
macOS 27.2 (go1.26.8, not root, a temporary HOME): go vet ./... and the
two cross vets clean, the three builds ok; go test -tags nogui ./...,
TestScriptFindsClaudeMoved skipped (it runs the real
/Applications/Claude.app, #5989): 92 packages ok; red outside
this change, each red the same at 6c3f113ce:
TestBunProxyLoginWithReservedCharacters (#3397),
TestGitUpdateInstallsTheBranchsCommitNow and
TestGitUpdateKeepsACommitPin (#5988), on this Mac's bun 1.3.11,
older than MinBun; TestEveryRouteHasACommandOrIsNamed: POST
/api/settings/join, new with e053c337a, has no command. /join, new
with it too, is a client route, so the docs' manifest lists it.
Broken by hand, each red, all green again put back; a break that lets in
what must be turned away was seen to reach the page: TurnsAway with the
once-each check out, no sender taken, the role in any case, the role or
the sender check out (IsAskedEachTime too), app:… and system alone
turned away, or the key's "open the link" kept in the box's 401;
AsksWhereFrom with boxFetched out, no Fetch Metadata taken, another
page's navigation taken of any method or into a frame, an object or an
embed (or anything but an iframe), its request for a document that isn't
a navigation, or another app's page's script (same-site, no-cors);
OpensThePage with another page's navigation taken by GET alone, or none
taken (IsNoGatewayKey too), a cookie set, or webOwnPage out;
IsAskedEachTime with the first sign-in kept; ChecksItsValue with lazycat
taken outside LazyCat or StartWeb not asking webBoxSignIn's error;
IsNoGatewayKey with the client routes behind the box's sign-in, or one
the box signs in on, or a HEAD to one, given to the page;
TestLazyCatManifestListsTheClientRoutes with /me out of the docs.
Not tried: a NORMAL account in a real browser (the box has one
account); signing out of the box in a browser; the box's own client
apps opening the page; a browser without Fetch Metadata; a header named
twice on a signed-in request through the ingress (a browser can't send
one); a multi-instance app; another lzcos version; a community plugin's
page on the box; a real vendor call through the box.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a LazyCat box (懒猫微服) every app sits behind the box's ingress,
lzc-ingress, which puts on each request it passes the app who sent it:
the box account (X-HC-User-ID), its role (X-HC-User-Role), what sent it
(X-HC-Source), the device (X-HC-Device-ID, -PeerID and -Version) and
when it signed in (X-HC-Login-Time); the box's docs name
X-HC-User-Groups and X-HC-User-Ticket too. A request signed in to the
box gets them on the app's public paths as well, where a package serves
the gateway's client routes. The native route, the Codex passthrough and
relay to the ChatGPT backend (copyHeaders) and /mcp/<server> passed them
all on, so a vendor, the ChatGPT backend or a remote MCP server was told
the box account's name and role and the device's ids.
proxyIdentity takes any X-Hc-* as what a proxy says of the caller, as
it takes Tailscale-*, so nativeHeaderDropped, copyHeaders and the MCP
proxy's header loop skip them. lzc-ingress's X-Forwarded-By was dropped
already (X-Forwarded-*). What 7d196b679 checked and left stays as it
is: a provider's PassHeaders passes on the names it lists, these too, as
the user chose them (gateway-routing.md now says so); Codex's
allow-listed codexHeader, the Codex websocket's headers (taken from a
request magpie built) and passOnCaller are as they were.
What the ingress puts there was read off a probe app on a box (lzcos
1.6.2+fix.4) that echoes its request headers: a browser signed in to
the box got X-HC-User-ID, X-HC-User-Role ADMIN, X-HC-Source client,
X-HC-Device-ID, -PeerID, -Version and X-HC-Login-Time, on a public path
the same as on /.
Tests: TestNativeAnyDropsProxyIdentity and
TestPassthroughDropsProxyIdentity send ten X-HC-* headers and
X-Forwarded-By beside the twelve they sent, and check that none arrive
and X-Custom still does.
Run (macOS 27.2, go1.26.8 darwin/arm64), at this tree, on 6c3f113ce:
gofmt clean; go vet, GOOS=linux -tags nogui go vet and GOOS=windows go
vet of internal/gateway clean; go build -tags nogui ok; both tests ok.
The next commit adds a test to internal/gateway and changes nothing else
of it; the whole package ran there: ok.
Broken by hand: with the X-Hc- prefix out of proxyIdentity, both are
red: the native vendor, the ChatGPT backend and the MCP server were each
told all ten X-HC-* headers.
Not tried: a real vendor call through a box; a provider whose
PassHeaders names an X-HC-* header.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/docs/openclaw says how magpie runs OpenClaw on magpie's models: the
magpie provider it adds to openclaw.json (the gateway's /v1, OpenAI chat
completions, a key of OpenClaw's own, one entry per model), the
magpie/<provider>/<model> refs, the primary model set with fallbacks
kept, magpie/* added to a non-empty allow list, 128K for an unknown
context, no restart but /model default for a chat that already has a
model, what is left alone (other providers, the user's own keys, a
per-agent model, $include, a JSON5 file), where the file is found
(OPENCLAW_CONFIG_PATH, _STATE_DIR, _PROFILE, _HOME) and
`magpie openclaw default`. Each claim is from internal/agent/openclaw.go
and the CLI's usage text. Linked from each language's OpenCode models
page; in the sitemap, llms.txt and llms-full.txt.
Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
mote: node --test worker.test.mjs install.test.mjs: 71 pass, 0 fail.
Not tried: OpenClaw itself on magpie for this page; it names only what
magpie's source says.
Usage's Requests tab gets a "Model speed" card: per model, the median output tokens/s, the median wait for the first token and the request count, over the selected range, sortable by every column (aria-sort header buttons, quiet table, no gradients). A request counts when it was answered (not rejected, handed on, failed or canceled), its first token was timed and it wrote 100 tokens or more (usage.MinRankTokens; the tooltip says so). Computed locally: each chunk keeps a 2% log-bin histogram per model beside its cells (speed_rank.go, chunkPart.speeds), a page merges the chunks' histograms, so there is no per-request sort and medians are within ~1%. The settled chunks' histograms are in the page file; its key salt is now page-v2, so the first load after upgrade recounts settled history once. /api/ledger sends speeds and speed_min.
Run (mote): gofmt clean; go vet darwin, linux nogui, windows for the touched packages and ./... earlier; go test internal/usage, internal/usageapi, internal/gui ok at this head; usage-model-speed.test.cjs 12 of 12 (chromium and webkit, en/zh/zh-TW/ja/de, 400px: order, sort by every column, aria-sort, focus kept, no horizontal overflow, ellipsis, hidden when empty); with i18n-keys and i18n-en-no-cjk 20 of 20; the whole GUI suite once on the branch before the rebase: every red is in a file unrelated to this change (account-arrange #6010, account-refresh-holds #5814, account-eye #5052, agent-switch-accounts #5925, bulk visibility and disconnect previews #5982 fixed in e430e2750, accounts-own-signin #6038), each red alone on origin/main 71a68639b or load-only.
Timing: 1M requests added to a chunk in ~185ms (TestModelSpeedRankAtTheLargestLedger).
Broken by hand: dropping the Failed/Canceled exclusion (gpt: 5 requests, 59.7 tok/s) and dropping the page's merge of chunk speeds (ranking empty) each turned the new tests red; restored.
Not tried: the real Linux app (WebKitGTK), a real ledger of hundreds of thousands of rows through the page-v2 file, a Windows run (win-run).
The relay to a remote MCP server (mcpClient) is a Go http.Transport with
HTTP/2 on and carried request bodies, so a server that answers pings but
never opens its flow-control window held the call as long as the caller
waited (the same hang as f6c24c680's, @imty42 on X). It goes through
stallGuard now.
Audit of every Go sender a plugin-served request can pass: the gateway's
call to a plugin is pluginFetch -> plugin.Fetch, a JSON line on the host's
stdin to Bun's fetch, no Go HTTP client. The netproxy bridge relays a
CONNECT as a raw tunnel (Bun does the TLS and h2) and a plain-http request
over an HTTP/1.1 Transport with no TLS. internal/plugin's own Go clients
fetch the plugin market with GETs. None sends an h2 body. image_fetch_guard
and wbConfigClient only GET; codexrelay is HTTP/1.1 with keep-alives off.
Run (mote-run): TestMCPRelayBodyStalledIsGivenUp red 60s on the old code
(guard taken off by hand), green 2.9s with it; TestBodyStalled*, TestMCP*
ok; go vet linux, windows, darwin clean; gofmt clean.
Not tried: a real remote MCP server; the full suite after this commit.
10c4dc109 posts /api/update/using on the window's first pointer or key event. Both files record every POST and count or compare them, so bulk visibility (10 cases: 4 posts, not 2) and disconnect previews (4 cases: the two /api/update/using posts) were red on origin/main 71a68639b, run alone on mote. The recorders now leave that path out, as provider-find's did in b96847c3d.
Run: both files on mote, chromium and webkit, 5 and 2 languages: 14 of 14 ok (before, at 71a68639b: all 14 red). Not tried: the rest of the ~250 files with a strict POST recorder (#5982's open part).
A model's price looks its provider up among every provider
(BasePriceIn → byIDOrWas → All), and with nothing held each look built
every provider again from their files and accounts. keptStill checks
every kept price on each 10 s refresh of the Sessions page, so this was
the largest allocator left there: provider.All 59 MB cumulative, 40.5 MB
of it from sessions.priceOf, in 4 minutes. pricer now holds the
providers for a price it hasn't seen, and what a hold built stays for
heldFor (1 s) after it, so the rest of the pass reuses it.
Run:
- TestPricerBuildsTheProvidersOnce (new) counts provider.AllBuilt
across six models priced with the real priceOf. Fixed: pass. Broken
by hand (Hold removed, in a copy): "built every provider 6 times".
- mote: go test ./internal/sessions ./internal/provider
./internal/usage ./internal/gui ok; GOOS=windows go vet and GOOS=linux
go vet -tags nogui ./internal/sessions clean; gofmt clean.
- Real accounts (mote, sandbox HOME copy, ad4.sh: /api/sessions/stats
for days 0, 7 and 30 every 10 s with X-Magpie-Had, heap at 120 s and
360 s): total allocated in the 4 minutes 294.3 MB (t68) → 210.1 MB
(t69); provider.All cum 59.3 → 18.3 MB, allProviders 50.6 → 11.7 MB,
sessions.priceOf 41.1 → 14.2 MB.
Not tried: Windows and Linux runs of the package (vet only).
Over HTTP/2 a vendor can answer the health ping and never send WINDOW_UPDATE: the sender sits in awaitFlowControl for good, the connection counts as healthy, and the header wait never starts (net.send 535971ms, 499 after 8m56s). The ping watch and WriteByteTimeout can't see it: nothing is written, and the ping is answered.
stallGuard wraps each of upstreamTransport's three transports: a request body whose transport holds a chunk for bodyStall (90s) without asking for the next is cancelled, its connection closed, and the request sent once more on a new connection (GetBody; a body Go's own retry takes from GetBody is watched too). Still stalled, the error says so (errUploadStalled, read by failure as failProxy: nothing reached the vendor whole, nobody rests, the next member is asked). The clock runs only while the transport holds a chunk, never while the body makes one, and stops at the body's end, so a slow upload that moves or a long streamed reply is never cut.
Tests: TestBodyStalledByFlowControlIsGivenUp (h2 vendor, 128KB windows, never reads: red on old code, 60s ctx deadline; green after, 2 tries on 2 connections), TestBodySlowButMovingIsNotCut, TestStallBodyClock. Broken by hand: stallGuard taken off the transport. -race not run; 960 stressed runs (24 parallel x 10 x 4) of the three green. Not tried: the real commandcode account, WSL/Windows runs.
With more than one Claude folder (CLAUDE_CONFIG_DIR per account),
claudeFiles appended each folder's files to a slice grown file by file.
It runs on every pass over the session files, and the Sessions page's
ranges are refreshed every 10 s, so on the owner's real history it was
the largest single allocation of that refresh. The folders are listed
first now, and the answer made once at their total; with no Claude
folder the answer is nil, as before.
Run: TestClaudeFilesMadeAtTheirSize (new) passes; on the old code it
fails ("listed into room for 76, want the 41 listed"). go test
./internal/sessions ./internal/gui and go vet (darwin, GOOS=windows,
GOOS=linux -tags nogui) ok at 9cd4ef6a1 plus this change. Real account
(mote, ~/r2278/acct, /api/sessions/stats polled every 10 s for days 0,
7 and 30 with X-Magpie-Had, as the page does; 4 minutes of
alloc_space diffed): claudeFiles 41.7 MB flat / 57.5 MB cum before,
17.7 / 39.6 MB after.
/docs/claude-desktop says how magpie runs Claude Desktop's chat, Code and
Cowork tabs in Desktop's third-party gateway mode on magpie's models:
turning it on from the Agents tab or `magpie claude-desktop magpie`,
the restart Desktop needs, the model list read at start-up (a 1M model
listed once), the Code tab's opus/sonnet/haiku picks and the subagent
model, chats kept in Desktop's own profile (Settings → Import), the
separate Claude Magpie.app on a Mac (`launcher add`), Desktop's English
window in gateway mode, and `magpie claude-desktop default`. Each claim
is from internal/agent/claudedesktop*.go, its notices and the CLI's
agent forms. Linked from each language's Claude Code models page; in
the sitemap, llms.txt (also named in the agent list) and llms-full.txt.
Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
mote: node --test worker.test.mjs install.test.mjs: 71 pass, 0 fail.
Not tried: Claude Desktop itself on magpie for this page; it names only
what magpie's source and notices say.
f2039c13f kept the usage ledger's last good read when the log's stat
failed but for absence (@simonzyzy on X), and shipped with no test.
TestUnreadableLogKeepsItsLastRead takes search permission off the log's
folder, so the stat fails with EACCES, and checks that the last read
stands. It also checks that a log removed for real drops it.
Run: on mote, the new test -race -count=3 ok, and ./internal/usage ok
(37.7s), go vet ok, gofmt clean. On Linux (wsl-run, magpie-desktop),
-v shows the test run and pass, not skipped.
Red on the old code: with f2039c13f^'s log_index.go, it fails with
"a failed stat replaced the last read" (an empty snapshot, info nil).
Not tried: Windows. The test is !windows because its stat goes through
CreateFile there, and folder permissions don't fail it the same way.
While the Sessions page is open, the GUI reads the 7, 30 and all-days
ranges again every 10 s. Those ranges are kept (keptStats), so a read
with nothing changed costs almost nothing, except when a model is
counted under another name (a usage alias, or a shared group's spelled
name). Then aliasStats copied every day's usage and every session's
summary of each range on each read: ~5 MB a read for the owner's real
history, which was then thrown away because nothing had changed.
aliasKept keeps each range's aliased Stats with the kept Stats it came
from and the names (provider.UsageNamesKey). When the kept Stats are the
same slices and the names haven't changed, it returns the same answer.
Kept Stats are never written, and MergeExternalStats copies before it
writes, so the answer can be shared. The memo is dropped with the kept
ranges (forgetKeptStats), so it never outlives them. UsageAliasKeyed
reads settings once for both the alias and its key.
Run: TestAliasedRangeMadeOncePerNames (new) passes. With the memo
skipped it fails at "named again with nothing changed". With the key
and source check removed it fails at "the old names' range given after
the names changed". go test ./internal/sessions ./internal/provider
./internal/gui and GOOS=windows / GOOS=linux -tags nogui vet: ok at
328dc97e2 plus this change.
Real account (mote, ~/r2278/acct, /api/sessions/stats polled every 10 s
for days 0, 7 and 30, 4 minutes of
alloc_space diffed): aliasStats 75.1 MB before (v0.1.3664 build), not
in the profile after; everything allocated 519.7 -> 467.3 MB. Not
tried: Windows and Linux runs (nothing here is per OS).
Run at the pushed head (rebased on origin/main): go test internal/sessions,
internal/usage, internal/provider ok; gofmt clean; go vet darwin, linux,
windows ok. Test red on the old code by stash. Not tried: a real Claude
Code with a failing /usage; the full suite.
/docs/cherry-studio says how magpie adds itself to Cherry Studio as one
OpenAI-compatible provider: the Agents tab's Add magpie (or `magpie
cherrystudio add`) opens Cherry Studio's add-provider link, confirmed
there; the models come from /v1/models; the row shows magpie once
Cherry Studio 2.x's database has the gateway (read only; 1.x keeps the
button); usage is counted as Cherry Studio's on an unshared gateway.
Each claim is from internal/agent/cherrystudio.go, agentKeyAt and the
CLI's import path (shipped in v0.1.3325). The page has a TechArticle,
FAQPage and BreadcrumbList, and is in the sitemap, llms.txt,
llms-full.txt and linked from each language's start page.
Run: the three pages' JSON-LD parsed with node; llms-full.mjs rebuilt;
mote: node --test worker.test.mjs install.test.mjs: 71 pass, 0 fail.
Not tried: Cherry Studio's dialog itself (no Cherry Studio here); the
page names only what the link fills in.
TestKeyConcurrencyKeepsStreamAlive went red on macOS CI (Race run
42920368236 at 8fa91a852) with `first = ": keepalive\n"`. The test sets
keepHeldAfter to 10ms, so a first chunk slower than that under -race
comes after a keepalive comment, and the test read that comment as the
vendor's reply. The first read now skips comment and blank lines and
checks the first data line.
Broken by hand: a 60ms sleep before slowVendor's first chunk for
"first" turned the old test red 3 of 3 with CI's exact message; the
new test passed under it. The sleep is reverted.
Run on mote: gofmt -l (clean), go vet ./internal/gateway, and
go test -race ./internal/gateway -run "TestKeyConcurrency|TestKeySlot"
-count=10: ok.
Not run: the full suite (test-only change in one test).
TestGatewayModeStatsNameTheGatewaySessions wrote its record at
time.Now()-1h, which in the first hour of a local day is yesterday, so
days=1 left it out: red on macOS and ubuntu CI at 4167419ab (00:31 UTC)
and on mote at 00:40 PST (#5690). The test now runs in a testing/synctest
bubble whose clock is moved to the next local 00:30, writes the record at
that moment, and checks the clock didn't move during the queries. A usage
test pins GatewaySessionWindow's edge: a local midnight is left out, one
nanosecond after it is in, on two consecutive days.
skygunner's patch (1554065a on their fork, posted on #5690 on 11-08),
applied as written on origin/main e12244aca; it waited three days unported.
Run on mote at this tree:
- The old fixture (-1h) inside the bubble: red at days=1 (TZ=UTC).
- -race -count=3 of both tests in UTC, America/Los_Angeles,
Asia/Shanghai and Australia/Sydney: ok.
- go test -tags nogui ./internal/gui ./internal/usage: ok; go vet ok;
gofmt -l clean.
Not run: the full suite (test-only change).
Co-authored-by: skygunner <skygunner@users.noreply.github.com>
readDirectory took a failed stat or listing of a project folder as an
empty folder. A refusal that passes (too many files open under a long
history's parse, a sharing violation, a stalled network home) took every
session in the folder off the Sessions page, and refresh let go their
parses with them; a later poll read the folder again and parsed them
anew, so sessions vanished and came back. A failed read is unknown: the
last good listing stands. A folder that is gone still lists as none.
Run (mote-run): TestUnreadableDirectoryKeepsItsLastListing red on the
old code (listed 0 entries, want its last 2), green with the change;
go test ./internal/sessions ok; gofmt clean; go vet on darwin, linux
nogui and windows for internal/sessions clean.
Not tried: the full suite before the tag (started after it); a real
EMFILE; a per-file stat that fails for a moment (statFiles still drops
that one file, filed in the report as open).
b5adaa8bd read Codex's sessions folders with dirent.Stats, and measured
on a real-account HOME it allocated about as much as the walk it
replaced (dirent.entry and nameOf 4.1 MB of 12.7 MB in 4 idle minutes):
Stats copies every name and builds a listing, for a check that keeps
none of it.
dirent.Each gives a callback each entry's name, in getattrlistbulk's
buffer, and its Stat, and stops when told; stats is now built on the
same reader. codexSessionsQuietListed makes a path for each folder and
nothing for a file.
Run:
- mote: go test -count=1 ./internal/dirent ./internal/sessions ok;
./internal/provider ok (141s); GOOS=windows and GOOS=linux -tags nogui
go vet ./internal/dirent ./internal/provider ok; gofmt clean
- xiaomi-gpu (Windows): -run 'TestEach|TestCodexSessionsQuiet' ok
Broken by hand: Each copying each name (string(name)), and
TestEachIsLstatWithNothingMade is red with 302 allocations for 301
entries.
tayedexuanfeng asked for GPUStack so locally deployed models import quickly.
GPUStack (github.com/gpustack/gpustack, read at 26b4af6) serves its
OpenAI-compatible API at <server>/v1 (/v1-openai is the legacy path), takes
the key as a Bearer (docs/user-guide/api-key-management.md), and lists the
ready models at GET /v1/models as {"object":"list","data":[{"id",
"object":"model","created","owned_by":"gpustack"}]} (routes/openai.py).
A KindLocal preset, so the Add sheet's Server address field, the CLI's
address=, the TUI's ask and AtAddress all apply as for Ollama; unlike
Ollama it is not NoKey, so its key is asked for. Default http://localhost/v1
(port 80). Logo: the project's own docs/assets/logo.png (Apache-2.0), 96px,
in pngIcons as mlx-serve's is (lobehub has none). Note translated in zh,
zh-TW, ja, de.
Run on mote: go test -count=1 of internal/provider, gui, cli, tui (ok);
go vet on darwin, windows and linux nogui for provider and gui (ok);
GUI i18n-keys, i18n-en-no-cjk, models-add-and-icons, local-address and the
new gpustack-add (56 of 56 in chromium and webkit; gpustack-add also in en,
zh, zh-TW, ja, de at 900 and 440px). The new Go tests use a fake server in
GPUStack's documented shape and never reach the network.
Broken by hand: NoKey true on the preset turns TestGPUStackPreset red;
dropping gpustack from pngIcons turns gpustack-add red (11 failed).
Not tried: a real GPUStack server (none on the LAN), the Linux WebKitGTK
app, the Windows box. Not built: GPUStack's /v1/responses and /v1/messages
(chat only).
Library's, Usage's, Plugins' and Settings' tabs, listed under their page
in the sidebar (navSubs), were names alone while every page above them
has an icon (the owner, with a screenshot of Library's list). Each tab
now has a 14px line mark before its name, from NAV_SUB_IC by page and
tab id: segs gives its buttons data-seg (Usage's own strip too), and
Settings' tabs have data-set. A tab with no mark (none today) keeps an
empty slot, so the names stay in one column. The mark is muted, and
takes the row's ink when the row is hovered or picked.
The marks are in navicons.js, imported with the first list drawn, which
then draws again with them. Its one line in app.js is paid for by two
navSubs comments cut, so the core's script budget is not raised
(1,533,751 of 1,533,802).
German's longest Settings names ("Synchronisierung und Backup") were
cut with an ellipsis at 1100 before this; "Netzwerk und Freigabe" now
is too (7px). Left as is: shortening the word would change it in five
other German sentences that name the tab.
Run:
- nav-sub-icons.test.cjs (new): every row of the four lists has its
mark, 14px, before its name and level with it, one column per list,
names whole (not German); en zh zh-TW ja de, Chromium and WebKit, on
WSL (magpie-desktop): 12 of 12. Red with Library's memory mark taken
out by hand ("library: Memory has a mark").
- go test ./internal/gui on Windows: 8 reds, the same 8 alone on
origin/main b46f23ffa (#4115, #5928, #5324; TestCherryStudioImportRow
added to #4115).
- At this head, on origin/main b50910fee, on mote: 27 GUI files a
sidebar list, a tab strip or a core script reaches (nav-sub-icons,
nav-sub-unroll, nav-lamp, sidebar*, side-width, side-toggle,
settings-sections, settings-tabs-stick, settings-back, segs-glide,
segs-press-redraw, plugin-pick-sub, plugins-more-discover,
plugin-updates, usage-refresh, library-items, library-bili, i18n-keys,
i18n-en-no-cjk, click-scroll, readable-focus, icon-one-tone,
old-webkit), both engines: 588 of 590. The 2 reds are old-webkit's,
red the same alone on b50910fee: headerpresets.js unlisted (#6030,
filed now) and .side-foot:has() (#5919). go test ./internal/gui
-run 'Budget|Core': ok.
- settings-search is red on b50910fee alone too (the window's
/api/update/using in its strict list, commented on #5982), so it was
left out of the run above.
- Not run: the whole GUI suite (mote's suite.lock queue is ~30 deep)
and the whole Go suite at this head.
Raises the WorkBuddy and WorkBuddy AI mover's min to 0.2.27 (npm has it,
`npm view --prefer-online` printed 0.2.27). The plugin's runsOutOf now also
counts check-in rewards that only the detail lists have, so the Credits and
Total windows give the soonest lapse of all of an account's credits and Smart
routing (Allowance.Renewal via Limit.RunsOut) spends that account first.
Run: mote-run go test ./internal/provider -run 'Moved|Mover|WorkBuddy' ok;
go vet for darwin, linux nogui and windows ok; gofmt clean. The plugin's own
test (bun test packages/workbuddy, 336 pass) was red on the old code.
Not tried: the full suite before the tag (started after it), a real account
(the desktop sign-in here was stale).
While Codex is idle each look of KeepOnAnAccountWithRoom asks whether a
session was written in the last 30 minutes, and the answer walked every
session file of the history: a directory read, a joined path and an
lstat() each. With a real-account HOME that walk was the largest thing
an idle magpie allocated once dsh's model build went (readdir 3.5 MB,
paths and lstat names 2.5 MB of 15 MB in 4 minutes), and a long history
(~20k rollouts) is as many syscalls a look.
codexSessionsQuietListed reads each folder with dirent.Stats
(getattrlistbulk on macOS, Lstat's own times), and the walk stays where
there is no bulk listing (Linux, Windows) or a folder can't be read so.
The listings are not kept between looks.
Run:
- mote: go test -count=1 ./internal/provider ok (148s); GOOS=windows and
GOOS=linux (-tags nogui) go vet ./internal/provider ok; gofmt clean
- xiaomi-gpu (Windows): go test -run TestCodexSessionsQuiet ok (walk path)
Broken by hand: the listed path never counting a file new, both
TestCodexSessionsQuietFor and TestCodexSessionsQuietListed are red.
Not tried: Linux (WSL box down); its path is the unchanged walk.
With a real-account HOME, an idle magpie allocated ~53 MB per 4 minutes,
and ~42 MB of it was dsh's wiring round building magpie's models again
because dshModelsFor (5 minutes) had passed, with provider.StampNow
unchanged. The forced build is only for what the stamp can't see: another
app rewriting an account's file, and models retired by date. Now it runs
every 30 minutes, and once more when the local day changes, so a dated
retirement still reaches dsh's lists that day.
Run on mote:
- go test -count=1 ./internal/agent: ok (244s)
- GOOS=windows go vet, GOOS=linux go vet -tags nogui ./internal/agent: ok
- gofmt -l: clean
Broken by hand: dshModelsFor back at 5 minutes, TestDshModelsStale is red
(10 and 29 minutes counted stale). The existing "unseen" subtest still
rebuilds models dshModelsFor old.
Not tried: a measured idle allocation on a real binary; that comes with
the next release's acrss/ad run.
Each docs page in en, zh and ja (98 pages, contributors left out) gets
a schema.org BreadcrumbList: magpie (the language's home page) > Docs
(that language's start page) > the page's h1. Search results can then
show the path instead of a bare URL. The eleven pages that had no JSON-LD
at all (docker, remote, intent, plugins, import, integrate, library,
mcp-router, masking, start, privacy) also get a TechArticle built from
their h1, meta description and canonical URL, like the other pages.
zh pages' inLanguage is zh-CN everywhere, as the older pages had it.
Existing JSON-LD is only appended to (the diff has no deletions besides
the inLanguage fix).
Run: every docs page's JSON-LD parsed with node (98 with a
BreadcrumbList); mote: node --test worker.test.mjs install.test.mjs:
71 pass, 0 fail.
Not tried: Google's Rich Results Test on the deployed pages.
The key's Model names editor was one textarea of "name = provider/model"
lines. It is now a row a name: the name typed, the model picked in the app's
menu (search by name or id), x to remove, Add a name for another, the
Headers editor's row. A row with a name and no model, or the reverse, holds
Save off; a row with neither is left out. aliases-key's body and the saved
data are as before; the line-format message is gone, so is its key.
Run (mote): gateway-key-search-names (rewritten for the rows) + i18n-keys,
24 ok, chromium and webkit, en/zh/zh-TW/ja/de, 1100 and 440. Broken by
hand: half-row check off, the test goes red in all 10 chromium cases.
Screenshots before and after in chromium, dark and light, 900 and 420.
Not tried: Windows/Linux GUI run; the whole GUI suite runs after the tag.
Switching Codex between magpie and OpenAI left the chat that was open
unusable. The Codex app holds the writer lock of every chat it has loaded, so
no move touched that chat's row, and Codex 0.167 refuses to resume a chat whose
provider isn't the configured one (modelProviderMismatch openai to magpie,
modelProviderNotConfigured magpie to openai). Reopening it did not help.
Just before magpie ends the Codex app's app-server for the route change, the
held chats are now moved to the provider Codex is on: a paginated one by its
row, a legacy plain rollout in place at equal id length (openai and magpie),
packed legacy rollouts and other lengths left to the next sync
(provider.CodexBeforeAppEnd, agent.codexRetagOpenThreads,
sessions.RetagLoadedCodexThreads). The end is a clean SIGTERM and Codex writes
nothing back.
Run (mote-run): gofmt -l on the three packages; go vet for darwin, windows and
linux with nogui over ./internal/...; go test internal/sessions, provider and
agent. Real codex 0.167.1 app-server in a sandbox CODEX_HOME, both ways: no
retag gives modelProviderMismatch (openai to magpie) and
modelProviderNotConfigured (magpie to openai); with the row retagged and the
app-server SIGTERMed, thread/resume succeeds on the new provider in both.
Broken by hand: the hook call removed and the retag call emptied; both new
tests go red (open chat stays on the old provider, order is [end] only).
Not tried: the Codex app GUI itself, Windows runs, a packed legacy thread held
open (left to the next sync). A resumed thread's sandbox falling back to
config.toml's default happens with no provider change and is #6028.
Accounts run with their own CLAUDE_CONFIG_DIR (~/.claude-work beside
~/.claude) had only one folder's sessions and token use counted. Claude
folders are now found as Codex's are (appdir.ClaudeHomes): the one in use,
siblings named claude*/.claude* (or one level down) that hold projects/, and
the folders of Claude accounts saved in magpie. The sessions list, calls
(Usage), traces, the read-permission check, Dirs and a deleted session's
companion folders (file-history etc., taken from the session's own folder)
all go through it. A session id in two folders is kept once.
No setting to add folders by hand and no GUI change: discovery needs no
configuration; a folder with another name is not found.
Run (mote): go test appdir, sessions, cli, usage ok; gofmt clean; go vet on
darwin, linux and windows for appdir and sessions. New tests
(TestClaudeHomesIn, TestCallsReadEveryClaudeFolder,
TestListReadsEveryClaudeFolderOnce) fail on the old code for the second
folder's sessions. Broke by hand: dropping the key dedupe in claudeFiles
still passes, since the list and calls dedupe by key later; it is kept as a
guard, not tested alone.
Not tried: real second Claude account, Windows/WSL, GUI.
observer.Serve makes its 1024-row onUsage queue when the gateway starts,
for every user, with or without a module that has onUsage. Its slots were
whole usage.Records (~930 bytes each), so the empty queue held ~1 MB for
the life of the process: 1.08 MB of the 18.9 MB idle heap with real
accounts at 1c3056a2e. A slot is now a pointer (8 KB for the queue); a row
is copied only when a module has onUsage, as before (Ledger returns first
otherwise).
Run on mote at this head: go test ./internal/middleware ok; gofmt clean;
GOOS=windows go vet and GOOS=linux go vet -tags nogui
./internal/middleware ok.
Broken by hand: with the old points.go, TestOnUsageQueueIsSmall fails
("the queue's slots take 950272 bytes, want at most 16 KB").
Siblings: no other buffered channel of a value type is larger than 16
slots (grep make(chan in internal).
8fa91a852 wrote its new test over the existing dsh_idle_test.go, which
held the tests that magpie's dsh routes carry streamIdleTimeoutMs
(544b91ca8), so they were deleted with it. They are back as they were,
and the parses' idle test moves to dsh_parses_idle_test.go.
Run on mote at this head: go test ./internal/agent ok (255s), go vet ok.
Startup's RenameLegacy parses every dsh profile's patch list and entries
(dshNodes and filememo's "dsh list"; ~2 MB of YAML nodes in the t60 idle
heap with real accounts), and KeepDshWired's round reads none of them
while nothing changed, so they were kept for the life of the process for
nobody. Two minutes after the last look they are let go (dsh_idle.go, the
same pattern as usage, sessions and catalog); the drift poll and a round
that writes parse them again.
Run on mote at this head: go test ./internal/agent ok (255s); gofmt
clean; GOOS=windows go vet and GOOS=linux go vet -tags nogui
./internal/agent ok.
Broken by hand: without the dshNodes reset, TestIdleDshParsesLetGo fails
("idle: 1 parsed entries kept"); without DropKind("dsh list") it fails
("the patch list kept while idle").
Not tried: a fresh real-account heap at this head (next acrss run).
dropEffortPeriods let go of every period's kept CodexModelEffort answer,
but effortOlds (each period's effort before the cut, ~2.1 MB in the t60
idle heap with real accounts, under effortSplit) stayed for the life of
the process. It is in effort-v1.json and effortSplit reads it back from
there when the entry is missing, so it now goes with the rest, under
codexEffortBuilding (TryLock: a build under way keeps it).
Run on mote at this head: go test ./internal/usage ./internal/usageapi
./internal/gui ok; gofmt clean; GOOS=windows go vet and GOOS=linux go
vet -tags nogui ./internal/usage ok.
Broken by hand: without clear(effortOlds),
TestIdleCodexEffortLetGoAndBuiltAgain fails ("0 periods' answers and 1
periods' effort before the cut kept while idle").
Not tried: a fresh real-account heap at this head (next acrss run).
bf4d8f3e5 let a key's model be a re: pattern, and covered() tried that
pattern on an issued key's glob as text. A regex's '.' or a class like
[^-] takes the glob's '*' too, so an issuer holding "re:^openai/[^-]*$"
(openai/o3, not openai/gpt-4o) could issue "openai/*", and at the
gateway foldModels kept "openai/*": the issued key used openai/gpt-4o,
which its issuer may not. "re:^gr" covered "gr*", which names group/…
ids a pattern never does. The other way, a child's glob "r*" matched
the text "re:^openai/" and so took the issuer's whole pattern.
Now a pattern covers a glob only when it matches the glob's text before
the first '*' and asserts nothing about what follows ($, \z, \b, \B),
which makes it a match in every id the glob names, and when the glob
can't name a group. A pattern is covered only by itself or by "*". The
same check runs at issue time (IssueKey) and at each request
(foldModels). It is stricter than needed in one way: "re:gpt" no longer
covers "*gpt*" (only the text before the first '*' is judged).
Run on mote at this tree:
- TestPatternCoversAGlobOnlyForAll: red on origin/main ce5e5964d (7 of
its checks, the openai/gpt-4o fold among them), green here.
- go test -tags nogui ./internal/access: ok.
- go test -tags nogui -run "Key|Issue|Pattern|Alias" ./internal/gateway
./internal/gui . : ok.
- GOOS=linux and GOOS=windows go vet ./internal/access, gofmt -l: clean.
Not run: the full suite, and the GUI (no GUI change).
The Headers editor gets a small Presets button beside + Add header. It
opens the app menu (openProtoMenu) with Codex CLI, Gemini CLI, OpenCode,
Kilo Code, Cline, Roo Code and Cherry Studio. A pick adds that client's
headers: a header the draft already has with a value keeps the user's own,
one with no value is filled, the rest become rows. The list lives in
headerpresets.js, imported when Presets is pressed, so the core's script
budget is not touched. No Claude Code preset and nothing that imitates it.
Where each value comes from (another app's values come from that app):
- Codex CLI: originator codex_cli_rs and the User-Agent shape from
codex-rs login/src/auth/default_client.rs (as internal/provider
codex_request.go sends them), version 0.167.0 = @openai/codex on npm.
- Gemini CLI: GeminiCLI/<ver>/<model> (<platform>; <arch>; terminal) as
internal/provider/google.go userAgent has it, 0.67.0 = @google/gemini-cli
on npm.
- OpenCode: opencode/latest/<ver>/cli (packages/core/src/app.ts,
internal/provider/opencode_client.go), 2.2.7 = @opencode/cli on npm.
- Kilo Code: HTTP-Referer, X-Title, User-Agent, X-KILOCODE-EDITORNAME from
Kilo-Org/kilocode request.ts and headers.ts (internal/provider/kilo.go),
7.8.27 = @kilocode/cli on npm.
- Cline: cline/cline sdk/packages/llms/src/providers/cline-client-headers.ts
(internal/provider/cline.go), desktop client, 3.5.54 as cline.go has it.
- Roo Code: DEFAULT_HEADERS in RooCodeInc/Roo-Code
src/api/providers/constants.ts, RooCode/3.53.0 = src/package.json on main.
- Cherry Studio: defaultAppHeaders in CherryHQ/cherry-studio
src/main/utils/http.ts, read from main on 2026-11-11.
Run (mote, at the pushed head, rebased on origin/main):
- new header-presets.test.cjs: 20 of 20 in chromium and webkit, en, zh,
zh-TW, ja, de, 900px and 420px. With the user-value rule broken by hand
(a preset overwrote a set value) it was 0 of 20.
- header-session-hint, model-headers, i18n-keys, i18n-en-no-cjk: green.
- TestCoreScriptBudget: ok. app.js is smaller than before.
- editor-hints.test.cjs webkit: 10 red here and on a clean origin/main
copy alike ("Tab didn't come back to Certificate's box"), filed in
#5872.
- The whole GUI suite is running on mote after the tag; reds will be
filed.
Not tried: a real request through a preset's headers against a vendor
that checks them. Codex's and Gemini's User-Agents carry macOS and arm64
as magpie's own Go code does.
The model picker of a gateway key gets a search box (name or id) and takes
"re:<regexp>" typed then Enter; the row menu gets Model names (aliases-key).
Docs: gateway-routing.md "A key's model patterns and names".
Run (mote): go vet darwin, windows, linux nogui on access/gateway/cli/gui;
go test internal/access, gateway (937s), cli, gui all ok at the pre-rebase
base; after rebasing on origin/main: go build ./..., the new Go tests,
TestCoreScriptBudget, and GUI gateway-key-search-names + gateway-key-models
+ i18n-keys (28 ok, chromium and webkit, en/zh/zh-TW/ja/de, 1100 and 440).
Broken by hand: pattern match off (gateway + access tests red), aliasRequest
off (alias test red), search argument removed (all 20 chromium GUI red).
Not tried: Windows/Linux GUI run, a real client against a real key; the
full suite runs after the tag.
Access layer, CLI and gateway; GUI and docs follow. Tests: access pattern and alias tests; gateway TestGatewayKeyModelPatternHoldsEveryRoute and TestGatewayKeyAliasRenamesAModel, each red with the pattern match or aliasRequest switched off by hand.
CodexModelEffort kept each period's answer (every Codex thread's
consumption by model and effort) for the life of the process. On a real
history it was ~6.9 MB of the idle heap after one visit to the Sessions
page (t59 measured on mote, heap at 10 idle minutes:
usage.keptCodexModelEffort).
Each ask now notes itself with derivedUsed, as the pairing and heatmap
reads do, and dropDerived lets go of every period's answer but one being
built. The page polls every 15 s while open, so it keeps them; the first
ask after derivedIdle (3 minutes) builds the answer again, waiting for it
as a first ask does.
Run on mote (go1.26.8):
- go test -count=1 ./internal/usage ./internal/usageapi ./internal/gui: ok
- gofmt -l, go vet, GOOS=windows go vet, GOOS=linux go vet -tags nogui
for internal/usage: clean.
- Broken by hand: with dropEffortPeriods left out of dropDerived,
TestIdleCodexEffortLetGoAndBuiltAgain fails ("1 periods' answers kept
while idle").
On a real history (~15k Claude Code sessions), the idle heap after one
visit to the Sessions page still held two things:
- ccUUIDMemo's set of message uuids per file, as map[string]bool with
the strings gjson copied out: ~5.1 MB. It is now a uuidSet,
map[[16]byte]struct{}: an 8-4-4-4-12 uuid (any case) is parsed into
its 16 bytes, anything else is hashed with FNV-128a.
- ccListed, every Claude Code folder's last listing (path and key per
file): ~2 MB, kept for the life of the process. dropIdleCache now
clears it with the other memos it lets go; the next listing builds it
again from the folder.
Run on mote (go1.26.8):
- go test -count=1 ./internal/catalog ./internal/sessions
./internal/provider ./internal/agent ./internal/codexcat: ok
(before the ccListed line); ./internal/sessions again after: ok.
- gofmt -l, go vet and GOOS=windows go vet for internal/sessions: clean.
- Broken by hand: with ccListed.Clear() commented out,
TestIdleParsesLetGoAndComeBackFromDisk fails ("3 Claude Code
listings kept").
Not tried: the real-account idle measurement of this change alone; it
runs with the catalog change's measurement.
An idle magpie's heap (real-account copy, 600s idle on mote, t58) held
two copies of models.dev's catalog for the life of the process:
- the shipped copy, unpacked by Seed at start into a sync.OnceValue:
5.7 MB of io.ReadAll, though Seed has nothing to write once a newer
catalog file is there, and nothing else reads it then;
- the parsed catalog (loadGen, ~6.7 MB with its votes and indexes),
loaded at start and by dsh's five-minutely rebuild.
Seed now looks at the file before unpacking, and the copy is unpacked
for each call and kept by no one. The loaded catalog, with what is built
and indexed of it, is let go once nothing has read it for two minutes
(load_idle.go, like the sessions' cacheIdle). The next read parses the
same file again. Forget is not told: the provider package's lists stay
right, since a changed file is Reset by whoever wrote it.
TestIdleCatalogLetGoAndReadAgain and TestSeedUnpacksNothingOverANewerCatalog
are red with dropIdleLoad returning false and with Seed unpacking first
(broken by hand in a copy).
TestListedByReadsAnIndex is red under -race at the base too (#6023).
Each dsh round (every 30s, for dsh's home and dsbot's) kept the model
list it last built between rounds, for the life of the process, though a
round that finds nothing changed only compares its sum. With a copy of
the real accounts the end heap of an idle v0.1.3641 still held 9.7 MB of
catalog (catalogKept, keptFit) after the held/kept sweep let its own
copy go: the dsh rounds' lists shared it. Now a round keeps the stamp,
the time and the sum, and builds the list again only for a round that
writes, which is what it did when a file changed anyway.
Ten docs pages (docker, remote, intent, plugins, import, integrate,
library, mcp-router, masking, start) had one-word titles like "Docker ·
magpie docs", in en, zh and ja. Docker and remote are among the most
read docs pages, and Search Console shows searches such as "局域网远程"
and "magpie docker" with no title matching them. Each <title> now names
what the page does; h1, og tags and the article are unchanged.
Run (mote): node --test worker.test.mjs install.test.mjs: 71 pass,
0 fail.
Not tried: how Google rewrites the titles in results.