Commit Graph
7289 Commits
Author SHA1 Message Date
yetone 0f94acc994 provider: Kiro's mover min is 0.1.36, the overage against its own cap (wizcheu on X)
wizcheu on X, Kiro Power (10000 credits) with overage on: magpie showed
12589.24 / 37500 where the Kiro IDE shows 10000 / 10000 in plan and
2589.24 post-paid. The plugin took the overage cap for the month's
whole limit. Kiro plugin 0.1.36 (plugins 5292fc9f, on npm) shows the
plan's credits (shown only) and an "Overage" window against the cap,
which counts the overage alone; that window stops the account. This
raises the mover's min so every moved Kiro user gets it, and gives the
new window name "Overage" its zh, zh-TW, ja and de words.

Run (mote, macOS, at this commit):
- go test -count=1 ./internal/provider: ok.
- go vet ./internal/provider for darwin, linux (nogui) and windows: ok.
  gofmt -l: clean.
- node --test i18n-keys and i18n-en-no-cjk: 8 pass, 0 fail.
- npm view --prefer-online @magpie-community/opencode-kiro-auth version:
  0.1.36.
Plugin side: bun test packages/kiro 172 pass; origin/main's index.mjs
under the new tests is 6 red, a region used up by its plan instead of
its overage is 1 red.

Not tried: a real Kiro account with overage on, nor the GUI card with
the new windows in a browser; the full suite starts after the tag.
2026-11-10 18:13:38 +08:00
yetone 617200a320 providers: Vercel AI Gateway is a preset (Archie627 on X)
Archie627 said magpie has no Vercel AI Gateway. It is now a preset in
Add: Chat Completions and Responses at https://ai-gateway.vercel.sh/v1,
Anthropic Messages at https://ai-gateway.vercel.sh (Vercel takes the key
as Bearer there too), models.dev's "vercel" catalog, the vercel icon the
vercel-jev decision preset already used, and its API keys page. An
OpenCode or URL import at that host becomes the preset. READMEs and the
site's import pages (en, zh, ja) list it.

Its /v1/models (public, 505 rows today) marks each row's "type". Read
as before, the decision models (liquid/d1, typesafe-ai/jev) and realtime
voices showed as chat models, ElevenLabs voices were dropped, and
transcribers (elevenlabs/scribe-v2) showed as chat. At Vercel's host
alone (catalog.VercelGateway) the type now decides: evaluation and
realtime rows are left out, speech, transcription, embedding and
reranking rows get their Serves, image rows draw and video rows film.
The 48 "-batch" ids are left out: Vercel's docs say "Synchronous
requests don't accept -batch IDs". context_window gives the window.
Another host's "type" is read as before.

Run: TestVercelPreset and TestVercelLiveList (real rows from Vercel's
list in testdata, served through an httptest server, no network);
go test ./internal/catalog ./internal/provider on Linux (wsl-run) and
macOS (mote, -run Vercel|Preset|Import before mote stopped taking SSH);
gofmt; go vet linux, windows, darwin (CGO off).
Broken by hand: VercelGateway returning false turns TestVercelLiveList
red (decision, realtime, batch and transcriber rows back in chat); the
-batch skip alone turned off turns it red too.
Not tried: no Vercel key, so no real chat, Responses or Messages call;
only the public GET /v1/models. No GUI file reads the preset list by
name (the Add sheet is built from /api/presets), so no GUI run.
2026-11-10 18:11:38 +08:00
yetone 8cc4bd7e3c agent: Craft Agents, through a keyless connection at the gateway (springg1998 on X)
Craft Agents (lukilabs/craft-agents-oss, thecraftagents.com) keeps its LLM
connections in config.json under $CRAFT_CONFIG_DIR or ~/.craft-agent
(paths.ts, storage.ts, llm-connections.ts, v0.15.8). magpie adds one
connection: slug magpie, providerType pi_compat, authType none, baseUrl at
the gateway's /agent/craft-agents/v1, customEndpoint.api
openai-completions. Its models are the ones picked for it, and defaultModel
is always one of them, because Craft resets a default that isn't in the list
to the first. magpie makes it defaultLlmConnection. The user's default is
stashed (as JSON, "" for none) and put back on off when that connection still
exists. A name the user gives magpie's entry stays, and a sync with nothing
to change writes nothing. A config.json with no workspaces list is one Craft
doesn't load, so magpie never creates one: open Craft once first. Picking one
of the user's own models removes magpie's entry and sets that model on their
default connection. Sessions keep the connection they started on, so the
notice says new sessions use it (zh, zh-TW, ja, de).

Detected by ~/.craft-agent, Craft Agents.app (com.lukilabs.craft-agent), or
%LOCALAPPDATA%\Programs\@craft-agentelectron\Craft Agents.exe (per-user
NSIS; the GUID is the UUID v5 of the appId, derived the same way as dsh's
known one). Skills go to ~/.agents/skills. CRAFT_CONFIG_DIR is in
agentenv.Vars. Icon from Craft's own icon.svg (#9570BE). README, reference,
agent-wiring and site list it.

Run on mote, first on origin/main 720200092:
- go test -tags nogui ./internal/agent ./internal/library ./internal/agentenv: ok.
- go test ./internal/gui: ok.
- go test ./internal/proc: ok (at the pre-rebase head).
- GUI tests in chromium and webkit, 69/69: i18n-keys, i18n-en-no-cjk,
  icon-one-tone, icon-tile, tray-logos and usage-agent-filter-icons.
- gofmt -l is clean. go vet passes for darwin, GOOS=linux -tags nogui, and
  GOOS=windows.
Then rebased on 6b92824ff and run again there: go test ./internal/gui,
the Craft, hand-wired, spelled, drift and every-agent tests in
./internal/agent and ./internal/library, and i18n-keys: all ok.
Pushed rebased on 2fbead798 (provider relay URL, Windows restart, gateway cap: no
files in common), not run again there; the full suite runs after the tag.
Broken by hand: with unwire's restore of the user's default taken out,
TestCraftAgents goes red at "restore". On the old code the tests don't
compile (no craftAgents). The first run also showed every-agent tests
(drift, LAN, proxy, port move) needing a Craft fixture, which is now added.
Not tried: a real Craft Agents app or its Pi server against the gateway, or
the Windows install path on a real install.
2026-11-10 18:09:54 +08:00
yetone 2fbead7983 provider: a relay URL typed without its /v1 (CRS's …/openai) is tested, detected and listed under it (Cyrus_4433 on X)
Cyrus_4433 added a claude-relay-service provider as OpenAI compatible at
http://<ip>:55088/openai. The list couldn't be fetched and Test models
said "gpt-6.1-sol: 404 · Not Found". From CRS's src/app.js and routes:
/openai mounts unifiedRoutes (POST /v1/chat/completions) and
openaiRoutes (/responses, /v1/responses); /api mounts GET /v1/models.
There is no /openai/chat/completions or /openai/models, and anything
unrouted is 404 {"error":"Not Found",...}. magpie asked base +
/chat/completions, i.e. /openai/chat/completions.

- probe: a Chat/Responses 404 at an unversioned base equal to the
  provider's URL is asked once more at base/v1/... (missingV1; not
  accounts, Azure, Bedrock, Vertex). Answered OK there, the saved URL
  takes /v1 (setV1) and the result carries it (Result.V1); Detect uses
  it as the base; the editor's URL field follows (draft.onV1) so Save
  doesn't undo it. A 404 at both stays the first 404.
- catalog: an unversioned …/openai base is also listed at
  <origin>/api/v1/models (RelayOpenAIList), and fixV1 adds /v1 when the
  list answered there.

Run (WSL magpie-desktop via wsl-run; mote's sshd reset every
connection this session):
- at 630b0de98 (this change on 987eac0aa): go vet -tags nogui (linux),
  CGO_ENABLED=0 GOOS=windows and GOOS=darwin go vet of the touched
  packages ok; go test -tags nogui ./internal/catalog ./internal/provider
  ./internal/gui ok; GUI chromium + webkit: provider-test-v1 (new: en/zh,
  900/420px, Test models and a chip's Test this model, then Save posts
  .../v1), model-test-one, model-test-why, model-test-stop,
  provider-detect-models, provider-base-api: 54 pass, 0 fail.
- rebased again on 6b92824ff, the core went 366 bytes over its budget;
  five provider-test comments cut in app.js pay for it, no raise
  (core 1,533,689 <= 1,533,802). At this head: internal/gui's budget
  tests, internal/catalog and internal/provider, and the
  provider-test-v1 and model-test-one GUI files: all ok, 20 pass 0 fail.
- models-works-only is red, also red on untouched origin/main
  7c41060c2: #4391 (commented there). gofmt -l clean.

Broken by hand: missingV1 returning false and RelayOpenAIList returning
"" -> TestCRSOpenAIBaseTestsUnderV1/ListsAtAPI/DetectsV1 red with
"gpt-6.1-sol: 404 Not Found"; restored.

Not tried: a real CRS instance (the fake follows its routes and 404
body); the gateway itself doesn't retry /v1 for a provider never
tested, listed or detected since this release (the user presses Test
models or types .../openai/v1); the full suite runs after the tag; no
Windows or macOS run.
2026-11-10 18:07:27 +08:00
yetone 185ee6d5c1 gui: an auto restart brings a minimised main window back minimised on Windows (#3495, realLemonawa on X)
Settings' Auto restart after an update brought the main window back if
it was up, and on Windows a window minimised to the taskbar counts as
up, so the new version showed it on screen (quietly, without focus).
Now the old version notes whether it was minimised: the restart-quiet
mark reads "<seconds> minimised" (mainUp reads up and minimised
together on the main thread). The new version, on Windows, puts the
window straight onto the taskbar with SetWindowPlacement and
SW_SHOWMINNOACTIVE, never shown on screen and never activated, at its
kept place and size, with WPF_RESTORETOMAXIMIZED when it was maximised
(placeMain split into placeAt and the maximise). A mark of the seconds
alone, from an older version, still reads as a window up. A restart the
user clicked is unchanged.

The first auto update into this version is still made by the old one,
which doesn't write the word, so the window comes back minimised from
the update after it. macOS and Linux keep showing it quietly: #5926.

Run:
- Windows (xiaomi-gpu, in the signed-in console session through a
  one-shot schtasks /it, since the windows are real):
  TestRestartMinimisedComesBackMinimised, which starts the test binary
  as a Wails app three times: minimised, minimised and maximised, and
  shown. It checks the window comes back minimised, is never shown
  whole (WindowShow while not iconic), doesn't take the foreground,
  mainUp says up and minimised, and that SC_RESTORE brings it back
  (maximised when it was) with its page visible (the page reports
  document.visibilityState). PASS.
- Windows over ssh: go test -count=1 ./internal/gui/ fails only
  TestGatewayHeldByAContainer, TestPluginAgentMissingSaysSo (#5324),
  TestLodyImportHandoff, TestImportStatusUnreadableIsUnknown,
  TestUpdateThatWontStart (#4115, #1827) and TestProviderSaveClientCert
  (filed #5928); all six fail the same at origin/main 987eac0aa.
- mote (darwin): go test -count=1 ./internal/gui/ ok (166s); at the
  head rebased on 6b92824ff, the three vets and -run
  'Quiet|Restart|Lightweight|Main' ./internal/gui/ ok.
- gofmt clean; go vet darwin, GOOS=windows and GOOS=linux -tags nogui
  ./internal/gui/ ok (GOOS=linux with the GUI needs cgo and doesn't
  cross-compile from mote, on main too).

Broken by hand: showsMinimised false on Windows (the old show): the
two minimised cases red ("came back not minimised"). Without
WPF_RESTORETOMAXIMIZED: the maximised case red ("maximised=false, want
true"). Taking the minimised flag out of the mark is red in
TestRestartBySelfComesBackQuietly.

Not tried: a real update of the installed app on Windows (the
schtasks run drives the same openMain path the app's start takes); the
Windows test stays green with no show of our own after SC_RESTORE
(the restored page reports visible), so none was added.
2026-11-10 18:07:05 +08:00
yetone f1996e7e5d gateway: a provider named past its usage cap is not sent on to a group (Anotiaww on X)
Anotiaww on X: magpie on server B asked magpie on server A for
claude/claude-opus-5-5. A's Claude account was past its usage cap (the
trace: "a usage window at 98%, over the account's 98% cap"), and the
Claude provider had no fallback set. The request was answered by a
WorkBuddy member of the user's routing group claude-opus-5.5 (the trace
row marked Fallback), with nothing said. They expect the cap's refusal.

Cause: 44d6dd75d (adorable_piglet, v0.1.3354) made serve plan a capped
provider again with every user-built routing group that has the model
in it (provider.GroupsAfter, groupsAfter) whenever no candidate was
left, so the Codex app, which asks its own model bare and never the
group, reaches the group's APIs. That rule did not look at what the
client asked for: a request naming the provider itself got the same
implicit fallback. Not the cause: the remote/shared path, auto groups
(GroupsAfter leaves them out), or a peer magpie's model mapping; the
peer sent claude/claude-opus-5-5 as written.

Fix: namedProvider(r, call.Model) in serve's groupsAfter arm. A model
asked with its provider in it (call.Model after unprefixed, so a flat
or aliased spelling of one too) is that provider's alone: past the cap
it goes to the provider's own Fallback list (planned before, untouched)
and else gets cappedError's 429 "usage cap reached". A bare model, and
Codex's own model that codexAccounts rewrote to codex/<model> on the
backend path (marked with providerPicked), still go on to the groups as
adorable_piglet asked; so does a turn codexFallBack hands on. CapStop is
unchanged. GroupsAfter's only other caller, codexFallsBack, is the
backend path, where Codex asks bare. Images and embeddings never read
GroupsAfter.

Tests:
- TestNamedProviderCappedRefuses: codex/gpt-5.5 past its 98% cap, a
  group [codex/gpt-5.5, a/m], on /v1/chat/completions, /v1/responses
  and /v1/messages, stream and not: 429 "usage cap reached" and the
  group's API not asked; with a fallback f/m set on the provider, the
  fallback answers (the user's fallback still holds).
- TestPluginCarefulPool: the plugin's model asked bare ("fake-1") still
  goes to the group; named "factory/fake-1" it is the 429.
- TestCappedCodexOwnModelGoesToItsGroup keeps the backend path's bare
  gpt-5.5; its /v1/responses "codex/gpt-5.5" subtest is now the named
  case above, the reverse answer.

Broken by hand (mote-run): the namedProvider guard out of serve:
TestNamedProviderCappedRefuses 6 subtests red (200 "from the group")
and TestPluginCarefulPool red ("named, group, stop off: 200 ... from
kf"). Restored: green.

Run (mote-run, mote at load ~130-165):
- gofmt -l internal empty.
- At the pushed tree, rebased on origin/main 208b89422: go test -count=1 ./internal/gateway -run 'TestNamedProviderCappedRefuses|
  TestCappedCodexOwnModelGoesToItsGroup|TestCappedSubscriptionGivesWayInGroup|
  TestSubscriptionCappedMidConversationGivesWay|TestCodexOneAccount|
  TestPluginCarefulPool|Fallback|Cap|Group': ok (144.6s; 138.9s before the rebase).
- go vet ./internal/gateway ./internal/provider: darwin, GOOS=linux -tags nogui, GOOS=windows: ok.

Rebased again onto 6b92824ff before the push (26 files of usage,
sessions and provider window-hold changes, none of the files here); the
runs above were at 208b89422, the tests run again at the pushed head
after the tag.

Not tried: a real Claude account past a real cap, and a real second
magpie (fakes only). The full suite runs after the tag. No GUI change.
2026-11-10 18:04:25 +08:00
yetone 6b92824ff5 usage: a window's whole also at base rates, without long-context premiums (#5861, Norethcy on X)
A window's whole (WindowHolds) is priced at API list prices, which charge
GPT-6.1 Sol's input above 272K at a premium a subscription's own use
doesn't pay. A cycle with more long calls then reads as a larger
allowance: NorethSea's previous week came to $76.56, $53.52 without the
premium, against $56.99 for the current one.

Each priced call is now also costed at its model's base rates, the
long-context tiers left out and a peak hour's price kept (baseRates), and
the window's whole sent as BaseCost beside Cost, only when the two differ.
Past cycles get it too (HistoricalWindowHolds goes through windowHolds).
On the card the figure then says which it is ("≈ $76.56 API") and is a
button: a click switches every card, past cycles too, to the base figure
("≈ $53.52 base") and back, moves nothing, and is kept in the browser.
Its tooltip names both and says neither is an official dollar allowance
or a fixed quota. A window that paid no premium is drawn as before. The
ledger's and the API's real cost are unchanged. #4181 (auto-review calls
counted in the whole) is not part of this.

app.js and the core stay in their budgets with holdsLine's and holdsWhy's comments cut, no raise.

Run (mote's sshd reset every connection, so on the Linux box through
wsl-run; the package run at base 720200092, and the -run tests,
quota-holds and i18n-keys again at this head on 208b89422; rebased since onto 44732325e,
a gateway test only):
- go test -count=1 -tags nogui ./internal/gui ./internal/provider
  ./internal/sessions ./internal/usage ./internal/usageapi: ok (incl.
  TestCoreScriptBudget)
- go vet -tags nogui (linux), GOOS=darwin CGO_ENABLED=0 go vet, go vet on
  Windows (win-run): clean. gofmt -l: clean.
- GUI: quota-holds (new test: every language, 360 and 1000px), i18n-keys,
  i18n-en-no-cjk, quota-fit-batched, provider-fetch-holds in chromium and
  webkit: ok.

Broken by hand:
- baseRates keeping the tiers: TestWindowHoldsBaseCostLeavesOutLong-
  ContextPremiums red (base figure 0).
- the click updating only its own button: quota-holds' new test red in
  both engines ("the other card didn't switch").

Not tried: a macOS run (mote unreachable), the darwin gui package's vet,
and the reporter's own log; the test's prices are gpt-6.1-sol's shape.
2026-11-10 18:01:13 +08:00
yetoneandNorethSea 4921bf5a97 usage, sessions: one model option for a found routing group's two ids (#5892, Norethcy on X)
A found routing group is called by its public id (auto/<model>) and is
kept as group/auto-<slug>; calls recorded under either were counted as two
models, so Usage › Sessions' model filter listed the same group twice and
the ledger, summaries and session lists split its calls.

Ported from NorethSea's 30d6261cd on their fork: UsageAlias names a found
group by its public id before the user's alias (both spellings, old
session files too), sessions' lists, the ledger keyer, the summary cache's
key and Codex's model/effort read through it, and a cache keyed on the
group names (UsageNamesKey) is read again when a group is renamed. A user's
own provider named "auto" keeps auto/<model> (autoRefsOn).

Changed in review: the patch's ledger filter compared every record with
provider.SameRef, which reads the providers (customIDs, a stat of
providers.json) for each record a filter passes over. FilterOf, the one
place a Filter is made from a query, now canonicalizes the model once, and
keepsRecord asks the providers only for an auto/ record under a group/
filter (sameGroupModel).

Run (mote's sshd reset every connection all afternoon, so on the Linux box
through wsl-run; the package run at base 720200092, and the -run tests,
quota-holds and i18n-keys again at this head on 208b89422; rebased since onto 44732325e,
a gateway test only):
- go test -count=1 -tags nogui ./internal/gui ./internal/provider
  ./internal/sessions ./internal/usage ./internal/usageapi: ok
- go vet -tags nogui (linux), GOOS=darwin CGO_ENABLED=0 go vet (provider,
  usage, usageapi, sessions), and go vet on Windows (win-run, those and
  internal/gui): clean. gofmt -l: clean.
- GUI: usage-ledger-model-pick, usage-ledger, quota-fit-batched,
  i18n-keys in chromium and webkit. usage-ledger's "newest live route
  needs no return-to-live button" (and zh "request routing links") is red
  the same on origin/main 987eac0aa on that box: #3104, #4078.

Broken by hand:
- keepsRecord back to r.Model != f.Model: TestUsageFoundGroupNames and
  TestLedgerFoundGroupNames red.
- usageGroupNames returning nothing: TestUsageFoundGroupNames (provider,
  usage), TestSessionsFoundGroupNames, TestCodexEffortFoundGroupNames,
  TestLedgerFoundGroupNames red.

Not tried: a macOS run (mote unreachable), the darwin gui package's vet,
and the reporter's own usage log.

Co-authored-by: NorethSea <963979204@qq.com>
2026-11-10 18:01:13 +08:00
yetone 44732325e7 gateway: test that OpenCode Go's keys take over at its usage limit (MelWoutersgghi on X)
MelWoutersgghi asked for an OpenCode Go provider that holds several
keys and switches between them. That already works: OpenCode Go is a
built-in key provider (presets.go), and every key provider keeps
several keys (Provider.Keys, keys.go). The provider's editor lists
them under Accounts with "Add another key" (renderKeyAccounts), a key
is turned on or off by its dot, and with more than one on, Routing
says how requests spread. Each key's 5-hour, weekly and monthly Go
windows are read on its own (planquota.go, key_allowance.go).

Nothing guarded it with OpenCode Go's own refusal, so this adds
TestOpenCodeGoKeysTakeOverAtUsageLimit: the first key answers the 429
GoUsageLimitError body OpenCode's client records (its composer.spec.ts
fixture), the second key serves the request, a key that is off is
never tried, and the next request goes straight to the second key
while the first rests.

Run: go test -run 'TestOpenCodeGoKeysTakeOverAtUsageLimit|
TestSeveralKeysOnTakeOverFromEachOther' ./internal/gateway, PASS, and
go vet ./internal/gateway, clean, both on Linux (wsl-run; mote refused
SSH six times in a row). gofmt -l clean.
Broken by hand: KeysOn returning only the first key for opencode-go
makes the test red (429, tried k-spent only); restored.
Not tried: a real account with two OpenCode Go keys; the full suite
(test-only change).
2026-11-10 18:00:14 +08:00
yetone 208b89422d routing: a group carries a note of its own (ConatusMoon2222 on X)
ConatusMoon2222 asked whether a routing group can have a note. It
couldn't: a group had an id and a name, nothing else of the user's.

A group now has an optional one-line note (provider.Group.Note,
"note" in providers.json). SaveGroup cleans it: whitespace and newlines
run together, cut at 200 characters (in runes), and an empty one is no
note. It is the user's own word and is never sent to an agent or a
vendor.

- Routing page: the note shows under the group's name as one muted,
  ellipsized line, the whole of it on hover, and only when there is
  one. The group editor has a Note field under Name (Enter saves, as in
  Name). Every save of the group sends it: the editor, a manual group's
  pick and a routing picked from the row, so none of them wipes it.
- CLI: `magpie group set <id> note=...` (note= clears it),
  `magpie group add ... note=...`; `magpie group <id>` and the list
  print it.
- TUI: N in a group's view edits it; the view shows it under the head.
- A copy, a shared group, a backup (StoredGroups/RestoreGroups) and
  sync (Mirror) carry it: they move whole Group structs. TestGroupNote
  checks each.

Two existing GUI tests clicked rows that the extra editor row pushed
under the view's foot bar at 420px in WebKit, which doesn't scroll the
page's own scroller to a click: group-defaults' reach() now counts in
sight as above the foot bar, and group-unlists' openAdvanced wheels the
summary into view as its other helpers do. Both passed on origin/main
and failed on this change before the fix.

Run (on mote, at this head rebased on origin/main):
- go test ./internal/provider ./internal/cli ./internal/tui ./internal/gui: ok
- gofmt -l: clean; go vet ./... darwin, GOOS=linux -tags nogui,
  GOOS=windows: ok
- GUI, chromium + webkit: group-note (en, zh, zh-TW, ja, de, and 390px),
  every group-*, routing-group-*, routing-groups-*, settings-groups,
  routing-manual, routing-save*, routing-tag-whole, fallback-group and
  i18n-* file: 752 tests, 752 pass

Broken by hand, each red:
- SaveGroup without CleanNote, and the CLI's note= without it:
  TestGroupNote and TestGroupNoteCLI fail on the uncleaned note.
- the editor's Save body without note: group-note fails (the typed note
  never posted).
- the pick and route-tag bodies without note: group-note fails (the
  note wiped by a pick).

Not tried: the real TUI by hand, the real app in Linux WebKitGTK, and
Windows (the change has no OS-specific code; windows vet ran).
2026-11-10 17:56:42 +08:00
yetone 40ca0c88de gui: a model's price is set from the Usage page (soilzhu80 on X)
A model an agent runs is often in no provider's list, so no provider's
Model settings could price it. A model's row on the Usage page (its "…"
or a right-click) and its bar in the Sessions tab's Models card (a
right-click) now offer "Set price…": a sheet with input, output, cache
read and cache write in $ / 1M tokens, the maker's list price greyed in
the empty boxes. It sets the model's price from any provider (*/model),
the key `magpie model price '*/model'` writes, through GET/POST
/api/model-price (modelprice.go). A provider's own price for the model
still comes first. Restore default takes the price away. Sessions' stats
are forgotten on a save, so past calls are counted at the new price too.
A Sessions bar prices the id after its last "/", the id sessions'
priceOf looks up.

Run (mote): go test -run ModelPrice ./internal/gui; node --test
usage-model-price (chromium + webkit, 420px wide, en/zh/zh-TW/ja/de),
usage-clear (its menu now has Set price… above Clear usage…),
i18n-keys; gofmt -l; go vet ./... for darwin, linux -tags nogui and
windows.
Broken by hand: SetModelPrice skipped, TestModelPriceFromAnyProvider red
("set: 200 {Price:<nil>}"); Set price… taken out of the row menu,
usage-model-price red.
Not tried: a real gateway call priced after setting it in the real app.
2026-11-10 17:45:42 +08:00
yetone 35fb5ad1bd gui: Model settings searches and expands a long list (soilzhu80 on X)
A relay's Model settings, hundreds of models, was a small box to scroll
with no way to find one. A list of more than five now has a search field
in its head, matching each row's id, name and typed names (every word
typed, each anywhere), and an Expand that lets the list be as tall as its
rows while the editor scrolls. Escape clears the search before it closes
anything; a list of five or fewer has neither. The code is modelfind.js,
imported when such a list is drawn, so app.js gains one line.

Run (mote): node --test model-find (chromium + webkit, en/zh/ja/de, 420px
wide), names-fold, old-webkit, i18n-keys; gofmt -l; go vet ./... for
darwin, linux -tags nogui and windows.
Broken by hand: the modelFind call turned off, model-find red in every
language.
Red not mine: old-webkit's "styles hold up in Safari 15.0" fails on
.side-foot:has(> .nav-sub) from d374168d0, filed as #5919.
Not tried: the real app window with a real relay of hundreds of models.
2026-11-10 17:45:41 +08:00
yetone b9e5f856f7 lessons: two more guard tests red on main from untouched packages (11-10) 2026-11-10 17:44:57 +08:00
yetone e39ecfec8d plugin: the hook-chain test leaves the first hook room for the host's start
TestGatewayHookChainStillTenSeconds gave each of two hooks 8s and had
both sleep 6s. On macOS CI at 286e3b6d5 (run 42784088261) the first one
ran past its 8s with the host's start counted and was dropped:
"the chain's 10s changed: {"note":"original"}". The first now sleeps 4s
(4s to spare), the second 7s: inside its own 8s, past the ~6s the chain
has left, so only the chain's 10s cuts it.

Run on magpie-desktop: go test -tags nogui -count=3 -run TestGatewayHook
./internal/plugin ok. Broken by hand (chain budget 20s in host.js and
gateway.go): red, "first":true,"second":true kept.
2026-11-10 17:44:37 +08:00
yetone 2d92221880 site: APINEBULA's card takes the copy APINEBULA sent
The zh text is theirs word for word; en, ja and de are translated from
it (0.6折 = 6% of list price).
Ran: node --test site/*.test.mjs on magpie-desktop (WSL; mote refused
ssh), 107/107 pass.
2026-11-10 17:43:39 +08:00
yetone 25c36e862a gateway: a relay's pooled refusal of one model rests that model, not the key (Jray05343207 on X)
Jray05343207 (Windows) connected Codex through magpie and got
"auth_unavailable: no auth available (providers=codex, model=gpt-6-sol;
last upstream error: model_not_found: The 'gpt-6-sol' model is not
supported when using Codex with a ChatGPT account." That text is not
magpie's: it is CLIProxyAPI's (sdk/api/handlers/handlers_errors.go,
enrichAuthSelectionError), a relay pooling ChatGPT accounts. It lists
gpt-6-sol whatever its accounts' plans serve, and once every account
refused it answers 503 with the last refusal in its words.

modelRefused read only 400/403/404/422, so the 503 was a plain outage:
the whole key rested on the backoff ladder, every model on the relay
with it, and the model stayed offered. Now a 5xx whose body is that pool
answer ("no auth available (providers=…; last upstream error: …)",
poolLastError) is judged by the last upstream error's own words, as a
404 would be: a model refusal rests only that model on that key
(restID), and the key's other models are asked straight. A last error of
quota, or none named, reads as before. plainUnavailable leaves such a
refusal to modelRefused too. docs/subsystems/gateway-routing.md says so.

Run (WSL magpie-desktop, Linux; mote's sshd reset every connection):
- TestPoolModelRefusalRestsTheModelNotTheKey (two keys on a relay
  answering the reporter's exact body as 503) and TestPoolLastErrorRead:
  pass.
- Broken by hand (the poolLastError branch removed): both red; each key
  rested whole ("Why:other Status:503 By:backoff") and gpt-6-sol didn't
  rest on its own.
- TestModelNotInPlan*, TestFallback*, TestEscapedWords*: pass.
- go vet ./internal/gateway for linux, windows and darwin; gofmt -l clean.
- go test -count=1 -timeout 45m ./internal/gateway: ok (1025s, Linux)

Not tried: a real CLIProxyAPI with a plan lacking gpt-6-sol (fixture is
the reporter's literal text in CLIProxyAPI's body shape); the user's
Codex still gets the 503 if gpt-6-sol is the model it asks for and no
other provider serves it, so the reply asks them to pick another model.
2026-11-10 17:42:14 +08:00
yetone 68cb92e8e6 library: name miniQ among the agents not looked at for the Library
d109ec8da added the miniq agent with no Library target and no line in
noLibrary, so TestEveryAgentInLibrary was red: "miniq (miniQ): no place
in the Library". It joins the agents #5897 has not looked at yet.

Run on magpie-desktop: go test -tags nogui ./internal/library red at
origin/main 987eac0aa with that line, ok with this.
2026-11-10 17:40:35 +08:00
yetone 7869a454cc library: the market's docker volume name is compiled on first use
d3f862340 put volumeName at package level with regexp.MustCompile, so
TestNoEagerPackageRegexps was red on main on ubuntu and macOS CI from
then on (run 42784088261 at 286e3b6d5). It is lazyre.New now, like
every other package-level regexp.

Run on magpie-desktop (mote's ssh was refusing): go test -tags nogui
-run TestNoEagerPackageRegexps . ok (red at origin/main on CI), and
./internal/library ok.
2026-11-10 17:40:35 +08:00
yetone 987eac0aae gateway: a reported call keeps the model asked for and the one that answered (req, served) (#3534, realLemonawa on X)
POST /v1/magpie/usage/requests took a usage.jsonl line's fields except
req and served, and refused a record that carried them, so a call an
app reported showed an empty Requested and Served model on the
Requests page. Both are now optional fields: req is the model the app
asked for (an alias or a group of its own), served the one its vendor's
reply said answered. Each is checked as model is (a string, at most
256 characters, no control characters) and kept only as sent; a record
without served is never filled from model, so it says nothing of what
answered. The GUI already shows Record.Requested and Record.Served.

The issue's other metadata (the rest of a gateway row's columns) is
left out: only the two models were asked for by name.

Run (mote): go test -count=1 -run 'TestUsageIngest|TestReported'
./internal/gateway/ ok. go vet darwin (gateway, usage), GOOS=linux
-tags nogui and GOOS=windows go vet ./internal/gateway/ ok. gofmt clean.

Broken by hand: req and served taken out of ingestFields again;
TestUsageIngestRequestedAndServed went red ("req: not a field a
reported record takes").

Not tried: a real app reporting its calls; the full suite runs after
the tag.
2026-11-10 17:35:15 +08:00
yetone 720200092e agent: turn off an agent's own telemetry from its settings (OipsAnthony on X)
An agent with a documented telemetry switch has a Telemetry row in its
Settings on the Agents page (opened row and settings sheet). Off writes
that switch into the agent's own config the way magpie writes it already:

- Codex: [analytics] enabled = false in config.toml (feedback left alone)
- Claude Code: env DISABLE_TELEMETRY and DISABLE_ERROR_REPORTING = "1"
- Gemini CLI, Qwen Code: privacy.usageStatisticsEnabled = false

Nothing is written until the user turns it off. Off writes only keys the
file lacks and records them in the stash; a key the user set on refuses
Off and names it; one they set off stays, and the row says so. On takes
out only the keys magpie wrote that still hold magpie's value. An
unreadable config is unknown: the row says so and can't be pressed.
Agent.Telemetry is not a Field, so profiles never carry it and Unwire
leaves it. Only agents on this computer (no WSL distro, #3896).
POST /api/agents/telemetry/{id}; strings in zh, zh-TW, ja, de.

The row is paid for in the core budget with sixteen Agents-page comments
cut in app.js (core 1,532,840 of 1,533,802 after the rebase), no raise.

Run (mote, at this head on origin/main 1ad9d157f; vet, the three packages and agent-telemetry, i18n-keys, agent-details-ready, click-scroll again there, 98 of 98):
- go test -run Telemetry ./internal/agent, then go test -count=1
  ./internal/agent ./internal/gui ./internal/cli: ok
- go vet ./..., GOOS=linux -tags nogui, GOOS=windows: ok; gofmt clean
- GUI, chromium and webkit: agent-telemetry (34 pass: every language at
  1100 and 640px, no scroll on click, no select, the user's own off,
  a refusal, the sheet), and 104 agent-*, i18n-*, click-scroll,
  settings-search, panel-agent and agent-settings files: reds only in
  page-width-steady and mobile-web (red the same at origin/main
  5a347ca8c, #5013, #4541) and agent-compact once under concurrency 6
  (passes alone, 8 of 8; #5607; its fixture has no telemetry)
- internal/cli failed once in the first run with its name lost to a
  tail of mine; it passed on a rerun at this head and at origin/main

Broken by hand: skipping the user-on check, dropping the "still ours"
check before a delete, and removing the WSL gate each turned
TestCodexTelemetryLeavesTheUsers, TestClaudeTelemetryChangedSince,
TestUsageStatsTelemetrySwitch and TestTelemetryOnlyHere red. The tests
don't compile on the old code (no Agent.Telemetry).

Not tried: real Codex, Claude Code, Gemini CLI or Qwen Code reading the
written keys (the keys come from their source); Crush (left for later),
OpenCode (no switch); WSL agents; the whole GUI suite (the agent-*,
i18n and agent-settings files only); the full go suite runs after the tag.
2026-11-10 17:28:15 +08:00
yetone 7c41060c2c provider: Qoder's mover min is 0.2.65 (plugins#930)
opencode-qoder-auth before 0.2.65 joined two tool calls Qoder streams at
one tool_calls index into one, even with their own ids and names, so the
client got a single tool_use whose input was {"key":"A"}{"key":"B"}
(invalid JSON) and neither call ran. 0.2.65 (plugins 34786eda) keeps them
apart. Raising the min lets keepMovedCurrent move every moved Qoder and
Qoder CN user onto it.

TestQoderMoversKeepToolCallsAtOneIndexApart holds both movers at 0.2.65 or
later, as the 0.2.53/0.2.54/0.2.61 floors do.

npm: `npm view --prefer-online @magpie-community/opencode-qoder-auth
version` prints 0.2.65, checked again just before this commit.

Run on mote (mote-run, at this tree rebased on 1ad9d157f; the same was green on fbc1808f2 first):
- gofmt -l internal/provider: empty
- go vet ./internal/provider/...: ok
- go test -count=1 -timeout 45m ./internal/provider/...: ok (156.4s)

Broken by hand: with the min put back to 0.2.64,
TestQoderMoversKeepToolCallsAtOneIndexApart fails ("the qoder mover
installs opencode-qoder-auth 0.2.64, which joins two tool calls at one
index into invalid JSON").

Not tried: no real Qoder account was moved or chatted through 0.2.65, and
keepMovedCurrent's update was not run against a real install. The
plugin's own parser fix is tested in the plugins repo, not here.
2026-11-10 17:18:32 +08:00
yetoneandggbdpq 1ad9d157fe gateway: a compaction a ChatGPT-account relay refuses as system asks again with the roles as sent (#5067, acui145 on X)
Codex's summary ask to a provider that isn't OpenAI's carries its
developer messages as system ones (forVendor, #2955). A plugin provider
fronting a ChatGPT account (magpie-sub2api -> sub2api -> Codex backend)
is such a provider, and the backend behind it takes developer alone:
every compaction came back "System messages are not allowed", the
sessions that got through fell to the conversation-as-text summary,
and the ones whose refusal came as an error event after a 200 skipped
every retry and were held after three (compactFails).

Now a summary refused "System messages are not allowed" (as passed
through, or as a current sub2api words it), or with a relay's bare
"Upstream request failed" (the reporter's sub2api), as a 4xx or as an
error event in the stream (roleRefused), is asked once more with the
roles as Codex sent them (askAsSent turns off the compaction marker,
whose only reader is forVendor's swap), then as text, then made by
magpie. A summary with no developer message to give back is not asked
the same twice. Every route a compaction reaches a Responses provider
by (CodexPath, Codex's own models through magpie's accounts, the mask
route, a CC Switch table) goes through codexCompact and serve's one
forVendor call, so all of them are covered. #2955's chat-only vendors
take system and are unchanged.

Ported from ggbdpq's patch (fix/5067-compaction-system-messages,
79ec15d26), which matched only the passed-through wording on a 400.
The review added the reporter's own "Upstream request failed", the
error-event shape, the developer gate, lazyre for the words, and the
subsystem page.

Run on mote at this change on 6a253f8af; rebased onto fbc1808f2 (then 15acba534, no gateway change) and the targeted
run repeated on Linux (wsl-run, mote refused ssh): ok.
- TestCodexCompactSystemRefusedAsksAgainDeveloper (5 wordings/shapes)
  and TestCodexCompactSystemRefusedEverywhereNeverHolds: ok.
- Red on origin/main's product files: all 7 subtests fail (400 to Codex,
  502 "so there is no summary", or the text downgrade).
- Red on ggbdpq's patch alone: older sub2api, both in-stream shapes and
  the in-stream never-holds case fail.
- Broken by hand: the developer gate dropped -> the existing
  TestCodexCompactUpstreamFailed400AsksAgainAsText goes red (3 asks).
- go test -tags nogui ./internal/gateway/: queued behind ~/suite.lock on mote at push time (other sessions' suites); the full suite runs after the tag
- gofmt -l clean; go vet darwin, linux -tags nogui, windows: clean.

Not tried: a real sub2api relay of a ChatGPT account; the fakes answer
sub2api's two wordings (writeOpenAIUpstreamClientError and the older
upstream_error) and the backend's {"detail":...}. After an in-stream
"Upstream request failed" serve itself asks the same account again
(15 asks in the fake), unchanged here. The reporter's other 400
(reasoning effort 'none' on gpt-6.1-sol) is a separate path, not
touched.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-10 17:13:15 +08:00
yetone 15acba5347 codex: the Codex app's projects follow an account switch, and the app isn't quit unasked (Michael25651150 on X)
"切换账号 codex 添加的项目丢了 发生过好几次了 另外额度用尽时会强制重启 codex 客户端"

Projects. The Codex app (ChatGPT.app 26.1103 and on) keeps its sidebar's
projects per ChatGPT identity in $CODEX_HOME/.codex-global-state.json,
under electron-account-renderer-state-v1 ({owner, inactive:{<sha256 of
JSON.stringify([chatgpt_user_id, chatgpt_account_id])>: {atoms, globals}}}).
On an account change it parks the old identity's account-scoped globals
and loads the new one's, so magpie's switch (auth.json, then the
app-server's restart) showed an account that never had the app open with
no projects (#5497, #5602, #5702, #5874). Read from the app's own bundle
(early-bootstrap-133 selectRendererOwner, -815's owner hash). The app reads
the file only at launch and writes its memory over it, so magpie writes
it only while the app is closed (codex_projects.go): from the 3s loop once
the file, auth.json or logins.json changed (process listing at most every
30s), and between the quit and the open of every reopen (appQuitDone in
reopenBundle and restartWin). Each identity of auth.json and the saved
Codex logins whose snapshot has no local-projects key gets the project
keys of the identity with the most; an own list (an emptied one too) is
left; g-p- ChatGPT project mirrors and their ties aren't carried, and a
backing naming another account is dropped (the app refuses those). A
file without the key or that doesn't parse is not written; the first
write keeps the file as it was beside it (.magpie-before-projects).

Restart. When quota runs out magpie restarts the app's app-server (the
takeover needs it: the app reads its account only as its app-server
starts, else Send stays grey). A ChatGPT app can then show "hit a snag",
and magpie quit and reopened the whole app (CodexAppRelaunch), and on
Windows reopened an app that started no app-server (codexAppGotNone).
Both now happen only with "Restart the Codex app when magpie switches its
account back" ticked (codexRestartsApp, off by default); otherwise the
Agents row says to quit and reopen, as it did where a relaunch failed.

Run (mote unreachable all session: ssh kex reset on every try; so on the
Linux box and Windows box instead):
- wsl-run: go vet -tags nogui, GOOS=darwin CGO_ENABLED=0 go vet and
  GOOS=windows go vet of internal/provider and internal/agent: ok.
- wsl-run go test -tags nogui ./internal/provider ./internal/agent:
  provider ok; agent red only on TestGrokInstalled (#3548, WSL binfmt).
- win-run go test -run 'TestCodexProjects|TestCodexRendererOwner|
  TestCodexApp|Restart' ./internal/provider ./internal/agent: provider ok;
  agent red on TestWorkBuddyRestartOnMac (#4115) and
  TestOpenMausBotRestartOnMac (added to #4115), neither touched.
- gofmt -l: clean.
- The owner hash checked against node's crypto (TestCodexRendererOwner).

Broken by hand: carryCodexProjects returning at once -> the four
TestCodexProjects* red; the snag gate removed -> TestCodexAppNotQuitUnasked
red (relaunched 1); the Windows gate removed -> red (reopened 1); the
backing strip removed -> TestCodexProjectsFollowASwitch red.

Not tried: the real Codex app. This Mac's ~/.codex state has no
per-identity key (read-only check), so the switch is reproduced against a
Go port of the app's selectRendererOwner on the issues' layout, not the
app itself. No macOS test run (mote down). The takeover (no account)
still shows no projects in the app, by the app's own rule; they come back
with the account. Projects added while the app runs reach other accounts
once it is closed.
2026-11-10 17:10:32 +08:00
yetone fbc1808f28 gui: an omp role is one line, its thinking level the step after its model (hongzaitou on X)
omp's roles square listed each role on one model twice: its model, then
"<role> thinking" on a line of its own, so nine roles ran to a long menu.
Now each role is one line, "model · level" once a level is set, and its
level is picked as the next step of picking its model: a model picked
(the current one too, which writes nothing) opens the level slider for
that role, from the state the pick answered with. Same as model and omp's
own pick leave the role on no model of its own, which takes no level, so
no step follows. Claude Code's tiers keep their effort lines: a tier's
effort can be set while the tier follows the model, an omp role's can't.

The square now opens its menu from the state as it is, not as it was
drawn: a level set from it isn't drawn again until the next render, so
the line still read the old level.

TestCoreScriptBudget: app.js is 4 bytes smaller, the change paid for by
comments cut around the tiers' and Codex subagent squares, no raise.

Run (mote-run, Chromium and WebKit): omp-roles (now with zh-TW too: en,
zh, zh-TW, ja, de at 1100px and 390px) 20 of 20 ok, and mobile-web,
desktop-tiers, tier-effort, wsl-claude-tiers, i18n-keys,
i18n-en-no-cjk, panel-effort, subagent-effort,
claude-subagent-effort-row, reasonix-roles, click-scroll and
claude-effort: 156 ok (before the comment cuts); at the pushed head
omp-roles, i18n-keys, tier-effort, desktop-tiers and
go test -run Budget ./internal/gui again. mobile-web's 8 "desktop matches origin/main"
subtests fail in a mote-run copy, which has no .git for their git show,
whatever the tree; its phone subtests, omp's square among them, pass.
Broken by hand: the old menu (a level on its own line, no level step)
makes omp-roles 10 of 10 red in Chromium.
Not tried: the real omp binary reading a level written this way (the
write path, omp.go's role _thinking Set, is unchanged), the tray panel
by hand.
2026-11-10 17:01:04 +08:00
yetone 5a347ca8c6 lessons: two sub-second guards red on main eight times on 11-10 2026-11-10 17:00:34 +08:00
yetone 488d0f9fc2 cli: name /api/memory/status with the Memory tab's routes
6a253f8af added POST /api/memory/status without a line in
settings_parity_test.go, so TestEveryRouteHasACommandOrIsNamed has been
red on ubuntu and macOS CI since (run 42779311609). It joins its
siblings under the library stage of #4745, as 71fbb33a7 did for
/api/memory/distill/stop.

Run (wsl-run, magpie-desktop; mote's ssh was resetting):
go test -tags nogui -count=1 -run TestEveryRouteHasACommandOrIsNamed
./internal/cli: red on origin/main without the line (the CI message),
ok with it.
2026-11-10 17:00:10 +08:00
yetone ece12b370d search: TinyFish is a built-in search API (Niapyaya on X)
Niapyaya asked on X for TinyFish (tinyfish.ai) among the search APIs.
TinyFish has a plain Search API beside its browser agents, so it is added
as vendor "tinyfish", following Yuanbao Search (0804f2d97), from its own
docs (docs.tinyfish.ai/search-api/reference, /error-codes):
- GET https://api.search.tinyfish.ai/?query=<q> with X-API-Key: <key>;
  keys at agent.tinyfish.ai/api-keys (KeysURL). Its path is the root
  ("/", SearchVendor.Paths), so a base URL of the user's own works as
  every other API's does.
- The reply's results[] (title, url, snippet, date for news and some web
  pages) is read by the shared reader; snippet is its only text. It takes
  no count and answers one page of about 10, cut to the search's count.
- Errors come with their status and {"error":{code,message}}: 401 a wrong
  key, 402 INSUFFICIENT_CREDITS (the day's 12,000 free searches spent with
  an empty wallet), 429, so the next key or API is asked and the key rests
  as any other's; the message is what the user is told, the key masked.

The GUI's picker and Get key button are built from SearchVendors, so no
GUI file changes. README (en, zh), the CLI help and gateway-routing.md
name it.

Fixtures: testdata/tinyfish/search.json is the docs' example reply;
invalid_key_401.json is the real service's reply to a made-up key on
11-10. The 402 body is the docs' Search example.

Run on mote (mote-run), at the rebased head (3b261932e):
- go test -run 'Search|TinyFish|WSA|Volcengine|DeepSeek|You'
  ./internal/gateway/ ./internal/provider/ ./internal/cli/: ok (first
  run: TestSearchAPIBaseURLWithItsPath's guard caught an empty Paths;
  fixed with "/"); ./internal/gui/ ./internal/backup/ ./internal/davsync/
  with the same -run: ok
- search-api.test.cjs and searcher-pick.test.cjs (Chromium and WebKit):
  30/30 ok
- go vet -tags nogui darwin/linux/windows: ok; gofmt -l clean
- a throwaway test (not committed) asked the real api.search.tinyfish.ai
  through askSearchAPI with a made-up key: searchRefused 401 "Invalid or
  expired API key", so the address, path and key header are the ones it
  reads (a header it didn't read answers MISSING_API_KEY).

Broken by hand, each made TestTinyFishSearchAPI red: the key sent as
Authorization: Bearer instead of X-API-Key, and the "tinyfish" case
removed from askSearchAPI.

Not tried: a search with a real key (none available), so the success
reply rests on TinyFish's docs. The full go test ./... is to follow.
2026-11-10 16:47:33 +08:00
yetone d109ec8da8 agent: miniQ, its provider on magpie's gateway (xiancrong on X)
miniQ (LeadingThink/miniQ, 0.1.213) is a desktop coworker and a `miniq`
terminal, both clients of one miniq-daemon. Its model is one provider in
<data dir>/settings.json, {baseUrl, apiKey, model, apiProtocol}: the data
dir is $MINIQ_DATA_DIR, else the folder miniq-data-dir.json names, else
%LOCALAPPDATA%\miniq or ~/.local/share/miniq (macOS too).

Picking one of magpie's models writes the provider as the gateway's /v1,
magpie's key for miniQ (it sends no User-Agent of its own), the catalog id
and apiProtocol chat_completions ("auto" guesses a protocol from the model
name). What the user had is stashed whole and put back on Disconnect; the
rest of settings.json is left alone. A settings.json magpie made is 0600
and goes again when magpie steps out. The daemon reads settings.json once
and writes its copy back on every change, so a running one is told too:
settings.update over the WebSocket daemon.json names, as miniQ's own
Settings does, which also moves open chats. Notice compares the daemon's
settings.get with the file and asks for a restart when they differ.
"On magpie" is known by magpie's key, so a moved port or a proxy in front
of the gateway is told apart by Check (baseUrl and apiKey). WSL: the
distro's ~/.local/share/miniq. Icon, i18n (zh, zh-TW, ja, de), READMEs,
reference, site, MINIQ_DATA_DIR in agentenv.Vars.

Run:
- At the pushed head, rebased on 286e3b6d5: internal/agent and
  internal/agentenv ok; i18n-keys, agent-notice-lang, icon-tile 29 of 29.
- mote: go test ./internal/agent/ ./internal/agentenv/ ok;
  ./internal/gui/ and ./internal/cli/ ok except
  TestGatewayModeStatsNameTheGatewaySessions, run in mote's first local
  hour (00:2x), which is #5690.
- GUI on mote, chromium and webkit: i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone, icon-tile,
  routing-client-icons, usage-agent-filter-icons, agent-connect,
  agent-models, agent-layout: 110 of 110.
- Windows (win-run): TestMiniq*, TestOwnProviderNamedAsMagpies/miniq,
  TestFolderVarsAreListed ok (the LOCALAPPDATA path).
- gofmt; go vet darwin, linux nogui, windows.
- Real miniQ in a sandbox on mote: the 0.1.213 aarch64 terminal tarball,
  sha256 checked against terminal.json, miniq-daemon on a sandbox
  MINIQ_DATA_DIR, a fake OpenAI upstream at MAGPIE_ADDR (uncommitted
  test). Set magpie/deepseek/pro: the running daemon's settings.get
  showed the gateway's /v1 at once; `miniq exec --no-start "say pong"`
  sent POST /v1/chat/completions with Bearer magpie-miniq and model
  deepseek/pro and printed the reply. Set "": the daemon and the file
  were back on the user's provider with their key; nothing else in
  settings.json changed. Run twice, before and after the key fix.

Broken by hand:
- push sent "settings.nothing": TestMiniq red ("the daemon was told
  nothing").
- apiProtocol dropped from the provider: TestMiniq red.
- on() by URL only (the first version): TestPortMovesEveryAgent,
  TestDriftUnwiredEveryAgent/miniq and TestReverseProxyIsStillMagpie red.

Not tried:
- miniQ's desktop app; only the terminal and daemon ran.
- Windows and WSL with a real miniQ.
- Session titles: miniQ asks a hard-coded gemini-3.8-flash on the same
  provider for them; without such a model at magpie the chat stays
  untitled (miniQ retries later). Nothing in its settings changes that.
- A project's own model in miniQ overrides the global one, as in miniQ.
- settings.update can't remove a provider, so a daemon that had none
  before magpie keeps magpie's until it restarts; the notice says so.
2026-11-10 16:46:39 +08:00
yetone 3b261932e1 usage: what is kept of each chunk by its serial is let go after three idle minutes
Message keys, match hints, chunk first times and heat sums are kept by
chunk serial and pruned only by turns, so with no pairing or heatmap
while nobody looked they stayed for the life of the process (~4 MB of
message keys alone in a real history's idle heap). They are now let go
once none was read for three minutes, and read again from the chunk on
the next ask.

Test: TestDerivedLetGoWhenIdle (kept while read, let go when idle, same
answers after).

Run: go test ./internal/usage on mote at this head (ok, 36s) and on
the Linux box; go vet linux, windows, darwin. Broken by hand (the drop
skipped): red, "idle: 3 heat sums and 3 firsts kept". Real-account copy
on mote, 330s idle, both orders: hintsOf's 1.6 MB is gone from the end
heap; footprint moved with run order (+10-15 MB for whichever ran
second), so no footprint gain is claimed. Not tried: an idle after the
Requests page was paged, where message keys are kept.
2026-11-10 16:45:02 +08:00
yetone 77035a4429 antigravity: a model read as its group's week is the group's, not a pool of its own (stacofman on X)
One Antigravity account showed "Gemini … 7d" rings at 1% once per Gemini
model, beside Gemini's own 7d ring at the same 1%. The account's Gemini
week was used up while its 5 hours were untouched, and then
fetchAvailableModels gives each model the week's reading (1% left, reset
in days), not the 5 hours'. pools() compared a model's reading with its
group's 5 hours only; since it differed, each model became a pool of its
own (the branch for Gemini 4 Argon read apart from its group, runking on
Discord), each "7 days" at the week's figure.

Now a model read as any other window of its group (same share left, same
reset to a minute: sameReading) draws on the group: its Pool is the
group's and its Span that window's, so the card, the menu bar rings and
PooledWindows show the group's 5h and 7d once. A model read apart from
every window of its group is still a pool of its own (runking's Argon
case unchanged). Antigravity is the only provider with pools().

Run (mote): go test ./internal/provider ok; gofmt clean; go vet darwin,
linux -tags nogui, windows ok; node --test quota-pools and
window-cap-pool (chromium + webkit) 44/44.
Broken by hand: without the new branch,
TestAntigravityQuotaModelsReadAsGroupWeek fails with every model in a
pool of its own and the pooled list showing a "… · 7 days" per model, as
in the screenshot.
Not tried: a real account with a used-up week; the fixture is built from
the reporter's screenshot (Gemini 5h 100% left, 7d 1% left), not their
bytes.
2026-11-10 16:43:47 +08:00
yetone f2b9ec354a gateway: Codex's auto-review goes on where its conversation does when the sign-in is out (riverleaf88 on X)
riverleaf88 on X: with Codex's ChatGPT allowance spent and magpie routing
Codex on to another model, Codex's automatic review still failed.

Codex's guardian (codex-rs guardian-v2 sync_reviewer) asks the same
provider, so magpie's /backend-api/codex/responses, on codex-auto-review
(approval_review_preferred_model) with x-openai-subagent: guardian. On a
spent sign-in codexFallsBack and serve's groupsAfter looked for fallbacks
and routing groups of codex/codex-auto-review, a model no group names, so
the review was handed ChatGPT's 429 while the conversation's turns went
on to the group.

- codexReviewAfter: an auto-review on the codex sign-in takes the model
  its conversation's own turns go on (codexLeads). A codex model brings
  that model's fallbacks and groups (fallbacksOnly on the lead too); a
  magpie model the caller may use (servedSession) is tried itself.
  codexFallsBack and groupsAfter add them.
- codexHolds: once a 429 naming a reset held the account, later turns
  (main turns too) were answered with the held refusal before any
  fallback. The held branch now hands a /responses turn with fallbacks to
  codexFallBack as the first spent turn was.
- docs/subsystems/gateway-routing.md says both.

Run (mote): go test -count=1 -run 'TestCodexReviewSpent|TestCodexHeld|
TestCodexOneAccount|TestCodexSpent|Hold|Held' ./internal/gateway/ ok
71.2s; gofmt -l clean.
New tests red on the old code: TestCodexReviewSpentFollowsTheGroup and
...FollowsMagpieModel (review got 429 usage_limit_reached); the held case
in TestCodexHeldTurnFollowsTheGroup.
Broken by hand: codexReviewAfter returning nil turns
TestCodexReviewSpentFollowsTheGroup, ...FollowsMagpieModel and
TestCodexHeldTurnFollowsTheGroup red; dropping the held-branch fallback
turns TestCodexHeldTurnFollowsTheGroup and ...FollowsTheGroup red.
Not tried: a real exhausted ChatGPT account; guardian-v2's async scorer;
the multi-account pool path past serve's candidate loop is covered only
through the one-account tests.
Also run (mote, at this tree): go vet ./internal/gateway/ for darwin,
GOOS=linux -tags nogui and GOOS=windows: clean. go test -count=1
-timeout 45m ./internal/gateway/: ok 1037.9s (base 2219fdd49).
Rebased on 662546e78 (agentpath change only): go vet ./internal/gateway/
and -run 'TestCodex|Hold|Held|Fallback|Group': ok 289.7s.
2026-11-10 16:43:25 +08:00
yetone 286e3b6d5f gui: the tray panel's Usage tab puts a vendor's account first from its count (RealZeroP27 on X)
RealZeroP27 asked to switch the Codex account in use from the menu bar
panel's quota page, not from the Providers page.

A vendor group with several accounts on the panel's Usage tab now draws
its count as a button (the count and a chevron). It opens the app menu
(openProtoMenu) with the accounts the provider editor can put first, the
first one ticked, and Manage accounts… at the foot, which opens the
window's Providers page. Picking one does what the editor's Make first
or Use does, through the same code: putFirst, now shared by the editor
and the panel. Kept signed in to one, that is provider/arrange with the
account first in the order; otherwise login/switch. The first account's
card gets a small tick. It works for any subscription with several
signed-in accounts (Codex, Claude, a plugin's), not only Codex.
Setup-token, access-only and lapsed accounts are left out, as in the
editor; kept signed in, so are paused or off ones. A vendor with one
account that can be first keeps its plain count.

The panel's provider list (panelAccts) is now also read when the Usage
tab has two accounts of one vendor, one read at a time. The menu reads
a fresh list first when only the kept one is drawn. pluginSubs falls
back to that list, since the panel has no window list (it threw on
null before).

Budget: the menu is in panelfirst.js, loaded when the count is pressed,
and the Allowances tab's arranging (panelArrange, hidePanelUsage) moved
out to panelarrange.js, loaded when Arrange is pressed. That pays for
the rest with no comments cut and no raise (#5918); the core is at
1,533,604 of 1,533,802. old-webkit's lazy list names both files.

Run (mote, at this change on origin/main 662546e78; rebased after onto
55b0d7c24, which changes only internal/gateway):
- GUI, chromium and webkit: panel-usage-first-account (5 languages x
  440/360px), panel-switch-accounts, panel-arrange, grip-inset,
  old-webkit, i18n-keys: 227 ok, 1 red: old-webkit's "the styles hold
  up in Safari 15.0" on main's .side-foot:has() from d374168d0, filed
  as #5919, the same at main.
- go test -run Budget ./internal/gui/ at this head: ok. The whole
  package before the rebase: the only red is
  TestGatewayModeStatsNameTheGatewaySessions, run at 00:22 local, which
  is #5690 (red in the first hour of a local day), untouched here.
- go vet ./internal/gui for darwin, GOOS=linux -tags nogui, GOOS=windows:
  ok. gofmt -l: clean.
- Before the rebase, 21 GUI files were run at this change and at main
  6a253f8af; the reds they share are the same on main under load. The
  two head-only reds (panel-switch-accounts' "reads the list once", a
  null box while the group redrew) were fixed here.

Broken by hand:
- The new test is red on origin/main's assets (no .pq-pick).
- putFirst with the kept branch turned off sends login/switch in the
  kept case: the kept test goes red.
- Dropping !l.accessOnly puts the access-only account in the menu: the
  menu's list check goes red.

Not tried: the whole GUI suite, a real account switch from the real
panel, the real Linux (WebKitGTK) app.
2026-11-10 16:37:19 +08:00
yetone 55b0d7c24e gateway: a test that agy on magpie's Antigravity uses every account that is on (leoooeth on X)
leoooeth asked for several Antigravity accounts in agy. It already
works: agy is started on magpie's gateway with a custom model
magpie/antigravity/<model>, and the gateway spreads it over every
Antigravity account that is on, passing over a spent one, as for any
other agent. No test held that for agy's own route (Gemini's API with
the agy key), so this one does: two accounts, the first 429 out of
quota; both turns answer from the second, and the second turn asks it
first.

Run (mote): go test -count=1 -run
'TestAgyUsesEveryAntigravityAccount|TestAgyAgent' ./internal/gateway, ok.
gofmt -l clean.
Not tried: real agy with two real Antigravity accounts.
2026-11-10 16:36:49 +08:00
yetone 662546e78d usage: a cache hit rate reads 100% only when all of the prompt was cached (ZhangXiaof48473 on X)
Routing's request list showed "缓存 100%" for Codex requests of 77.5K
tokens that read 77,200 of them from the cache (99.6%), beside rows at
99%, and the route line said "请求缓存命中率 99%". Every hit rate was
Math.round(100 * h) + "%", so anything from 99.5% up read 100%.

One formatter now says every hit rate: hitPct(h, d) in app.js, whole
percents (d decimals) unless rounding would say 100% or 0% of a prompt
not all or none cached, then one or two decimals (99.6%, 99.95%; never
past 99.99% or under 0.01%). Its callers: Routing's request rows, their
route line and a session's Avg. cache (plugins/routing/client.js); the
tray panel's Cache hit rate and the ranking rows' hit rate (app.js); the
Usage page's tiles, agent rows, Requests table, request detail and its
KPI strip, which keeps its one decimal (plugins/usage/page.js); the
context card's Prompt cache and the session traits Cache-friendly,
Cache misses and Cache hit (context.js). The TUI's and CLI's sessions
line, which floored the integer, use usage.HitPct, the same rule in Go;
it rounds now, so the TUI test's 67% (25.2K of 37.3K, 67.6%) reads 68%.
No new strings; app.js pays its bytes with six ledger comments cut, so
the core scripts are 15 bytes smaller than at its parent, no raise. Main
is over the core budget already (1,534,476 > 1,533,802 at the parent,
#5918); this commit doesn't add to it.

Run on mote:
- new internal/gui/tests/cache-hit-pct.test.cjs (Routing rows 99.6% /
  100% / 99%, the route line, hitPct at its edges) in chromium and
  webkit, en and zh: green; with the escalation line removed by hand,
  red (99.99% where 99.6% is wanted).
- cache-hit-pct, panel-usage, context-window, i18n-keys, usage-ledger,
  tray-totals, ctx-route, ledger-cache-hit, usage-hit-rate,
  routing-request-metrics (both engines; ledger-cache-unknown and
  ledger-cache-tokens in an earlier run): 186 pass, 6 red, all in
  usage-ledger's 'newest live route needs no return-to-live button',
  red the same on origin/main 00e8242e8 (#5048, #4078).
- go test ./internal/usage ./internal/cli ./internal/tui: ok, with
  TestHitPctNeverRoundsToAllOrNone and a 99.6% case in
  TestHitRateCountsCacheWrites (red on the old floor: 99%).
- go test ./internal/gui at the first base: TestCoreScriptBudget ok; one red,
  TestGatewayModeStatsNameTheGatewaySessions, run at 00:25 local (#5690,
  the first hour of a local day).
- gofmt; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: clean.
At the pushed head (rebased, comments cut): cache-hit-pct and
routing-request-metrics again, both engines, 8 of 8.
Not tried: the real app's window, or GUI files beyond those above (a
65-file run waited on mote's suite lock behind four full suites).
2026-11-10 16:28:04 +08:00
yetone 5a02bf8c14 agent: mu, Pi with a judgment kernel, wired in ~/.mu/agent (xteam3301 on X)
mu (github.com/qybaihe/mu, npm mu-agent, the mu command and the mu
desktop app) is Pi 1.4.0 with a judgment-kernel extension. Its
kyrn/bin/mu.mjs starts Pi on its own agent folder, so Pi's settings.json
and models.json live in ~/.mu/agent, and the desktop app runs the same
Pi on the same folder. magpie now wires it as it wires Pi.

- agent: mu (piLikeKeyed). Its folder is found as mu.mjs finds it:
  $MU_AGENT_DIR, $KYRN_AGENT_DIR, $MU_CODING_AGENT_DIR,
  $KYRN_CODING_AGENT_DIR ("~" expanded), else ~/.mu/agent, or
  ~/.kyrn/agent while ~/.kyrn is a folder and ~/.mu isn't. Its requests
  say pi/<version>, so the provider's key magpie-mu names it. The alias
  is mu-agent. Its judge (~/.mu/mu.json) is left alone.
- `mu` is also maildir-utils' command (brew, distros). A mu on PATH
  that neither is nor names mu.mjs / mu-agent is not taken for it
  (notMuAgent).
- Gemini models stay on Chat for mu, as for Pi and StepCode (piAsked).
- WSL kind at ~/.mu/agent (found by its folder, not the command); CLI
  update through npm mu-agent; the desktop app (io.github.qybaihe.mu,
  mu.app, %LOCALAPPDATA%\Programs\mu\mu.exe, /opt/mu).
- agentenv and appdir know the four variables.
- library: mu's AGENTS.md / AGENTS.override.md, its mcp.json (Pi's
  native format) and skills in its folder; it reads ~/.agents/skills.
- GUI: a one-tone icon. Default in its model picker says it clears the
  default and mu picks one itself (PICKS_ITSELF).
- docs: READMEs, reference.md, agent-wiring.md.

Run (mote, at this tree before the rebase):
- gofmt -l internal/ clean; go vet darwin, GOOS=linux -tags nogui and
  GOOS=windows of agent, library, appdir (and agentenv on darwin): clean.
- go test -count=1 ./internal/agent ./internal/library ./internal/appdir
  ./internal/agentenv ./internal/usage: ok (agent after its maildir
  fixture stopped using testenv.Program, which refuses a non-script).
  New: TestMu, TestMuDir, TestMuNotMaildirUtils, TestMuTarget; mu added
  to the handwired, spelled, Pi scope, scope-gone and Gemini-on-Chat
  lists.
- Windows (win-run on xiaomi-gpu): go test -run 'TestMu|TestPiScope|
  TestScopeGone|TestHandwired|TestSpelled|TestPiFolderKeepsGemini'
  ./internal/agent ./internal/library ./internal/appdir: ok.
- Real mu-agent 0.3.9 (Node 22.22.0) on mote in a sandbox HOME, a
  sandbox gateway on 47822 over a fake OpenAI upstream: `magpie agents`
  found mu with the user's deepseek model; `magpie mu magpie/fakeup/m1`
  wrote defaultProvider magpie and providers.magpie with key magpie-mu,
  keeping the user's deepseek provider; `mu -p ping` answered "pong from
  fake upstream" (upstream saw POST /v1/chat/completions, model m1,
  UA pi/0.3.9); `magpie usage today` counted the call under agent mu;
  `magpie mu default` put settings.json and models.json back byte for
  byte (cmp).
- GUI, chromium and webkit: pi-default-note (with mu added),
  icon-one-tone, icon-tile, mono-icon-redraw, routing-client-icons,
  usage-agent-filter-icons, i18n-keys, i18n-en-no-cjk, agent-connect,
  agent-models, agent-layout: 88 of 88.
- Rebased onto 1b2ad557f: gofmt clean; vet darwin (agent, library,
  gui), linux nogui and windows (agent, library) clean; go test
  ./internal/library ./internal/appdir ok; ./internal/agent -run
  'TestMu|TestPi|TestHandwired|TestSpelled|TestScopeGone|TestDesktop|
  TestCLIUpdate|TestWSL' ok; ./internal/gui ok but two reds that are red
  on an origin/main 1b2ad557f copy as well: TestCoreScriptBudget
  (1,534,470 > 1,533,802 on main, #5918; this change adds 6 bytes) and
  TestGatewayModeStatsNameTheGatewaySessions (run at 00:xx local, #5690).
  The rebase onto 4c5b89489 only adds LESSONS.md.

Broken by hand, each red:
- no binNot: TestMuNotMaildirUtils (maildir-utils' mu detected as mu).
- no ~/.kyrn fallback: TestMuDir.
- mu out of piAsked: TestPiFolderKeepsGeminiOnChatForRaft.
- mu out of PICKS_ITSELF: pi-default-note, 2 of 2 red (chromium).

Not tried: the mu desktop app (its install paths are read from its
electron-builder config, not an installed copy); a real vendor behind
the gateway (fake upstream only); a Gemini model through mu; WSL with a
real distro; mu's own session files are not read for usage outside
magpie.
2026-11-10 16:27:14 +08:00
yetone 4c5b894891 lessons: a size budget that counts comments is met by deleting them (#5918) 2026-11-10 16:26:26 +08:00
yetone 1b2ad557fb agent: Alma or OpenHanako uninstalled is turned off without opening it first (aooo_han on X)
aooo_han connected Alma, uninstalled the Alma app, and then couldn't turn
Alma off in magpie: it said "Alma isn't running - open Alma and try again".
Alma's settings are reached only through its local API, so an app that is
gone could never be turned off.

- Alma: when the API is down and Alma isn't installed (macOS bundle,
  Windows install folder or registered guid, Linux /opt or desktop entry,
  or alma-server on PATH), turning it off clears magpie's own record and
  remembers a takeout (alma.takeout in the stash). Alma's providers live
  in its SQLite database, so magpie doesn't edit its files. If Alma comes
  back, the next Sync takes magpie's provider and default model out of
  it, then forgets the takeout. Turning Alma on again forgets it too.
  An installed Alma that isn't running still says to open it.
- OpenHanako (the sibling with the same need: a sealed catalog it
  rewrites only while running): uninstalled, the model in its config file
  goes back to the user's own and the sealed provider entry is left
  alone, instead of errSealed.
- An app in the Trash, as a Mac app is uninstalled, still shows up in
  Spotlight. spotlightBundles now skips ~/.Trash and /.Trashes paths.

Run: go test -run 'Alma|Hanako|InTrash' ./internal/agent and the whole
internal/agent package (wsl-run, since mote's sshd refused connections);
go vet for darwin, linux (nogui) and windows; gofmt. e2e in a sandbox
HOME on WSL with no Alma: on origin/main `magpie alma default` printed
"Alma isn't running - open Alma and try again"; with this change it
prints "Alma model default", exit 0, and the list shows Alma off.

Broken by hand: without the Alma branch TestAlmaOffUninstalled fails
with "isn't running"; without the Hanako branch
TestHanakoSealedUninstalled fails with errSealed; without the Sync
takeout magpie's provider and default model stay in a returned Alma;
inTrash returning false fails TestInTrash.

Not tried: a real uninstalled Alma on macOS or Windows (the live Alma is
the owner's); a reinstalled OpenHanako doesn't get its sealed provider
taken out (its Sync is skipped once hand-wired); an AppImage OpenHanako
isn't detected as installed.
2026-11-10 16:19:58 +08:00
yetone 00e8242e85 library: Hermes folds its context with billion-context through its /bili/ prefix (Duckb7si on X)
Library › billion-context said no agent could use it on a machine where
Hermes was connected to magpie. Hermes was left out of the lanes on
purpose: bili's native Hermes plugin (hermes-plugin/__init__.py,
apply_env, billion-context 0.1.213) only sets HTTPS_PROXY, HERMES_CA_BUNDLE
and SSL_CERT_FILE. magpie's Hermes provider is http://127.0.0.1:3425/v1,
plain http on loopback, so that proxy never sees it: the plugin would add
its tools and fold nothing.

Hermes now takes the route Zed takes, bili's documented /bili/ prefix.
Turned on, magpie runs `bili start --port 8787` and sets base_url of the
magpie and magpie-anthropic providers to http://127.0.0.1:8787/bili/<gw>,
in config.yaml and in every profile that has magpie's provider
(agent.HermesThrough). Each later Sync or pick keeps a loopback prefix
with a path (hermesPrefix), and drops anything else back to the gateway.
Turning it off puts the gateway back. The empty-list string, docs (en, zh,
ja), llms-full.txt and docs/subsystems/library.md name Hermes.

The other agents bili supports that magpie wires (dsh, Kimi, ZCode, Codex,
Gemini, Qwen, ...) are #5915.

Run (mote, at the rebased head unless said):
- go test -tags nogui ./internal/library: ok (252s) at the rebased head
- go test -run 'TestHermes|TestZed|TestProxy|TestBili|Kept'
  ./internal/agent ./internal/library: ok before the rebase (base
  2219fdd49); the whole internal/agent at the rebased head was still
  running at push (mote load ~60), result goes on #5915
- GUI library-bili, library-all, i18n-keys, i18n-en-no-cjk (chromium and
  webkit, every language): 84, 26, 4, 4 pass, 0 fail (before the rebase)
- site node --test: 107 pass (llms-full.txt regenerated with llms-full.mjs)
- go vet darwin, GOOS=linux -tags nogui, GOOS=windows on agent and
  library: clean; gofmt -l clean
Broken by hand:
- hermesEntries without the prefix: TestHermesThroughBili red (a pick
  drops the prefix)
- no "hermes" URL lane: TestBiliHermesThroughPrefix red (Hermes not
  offered)
Not tried:
- a real Hermes and a real `bili start`; tests fake bili and the probe
- a profile created after turning it on goes to the gateway until Hermes
  is turned on again
- bili's native Hermes plugin installed at the same time
- Windows run (vet only)
2026-11-10 16:16:11 +08:00
yetone d3f8623408 library: a market docker server's options stay inside the container
eff7f9f62 started taking an MCP registry entry's runtimeArguments for an
OCI package as docker run's own options, whole. Anyone can publish to the
registry the market searches, and the market shows such a server as
"docker" alone, so the publisher's line ran unseen: `--network host` put
the container on this computer's loopback, where magpie's gateway and
GUI API take a request as the owner's, and `--privileged`, `--pid host`,
`--cap-add`, a bind of / or of docker.sock, or `--env-file ~/.aws/...`
reached past the container to the computer. Before eff7f9f62 none of
them was taken.

dockerOptSafe now takes only options that keep the container one: -i,
--rm, --init, --read-only; the container's own env, entrypoint, workdir,
user, platform, name and pull; a -v or --mount of a named or anonymous
volume or a tmpfs (never a path, ~, a Windows drive, or a volume driver's
options); --network none or bridge. Any other is left out, and a server
that needs one (isRequired) isn't offered. Every curated docker server
the market offered still starts the same line (MARM's volume, env and
entrypoint included).

Run on mote at origin/main 6a253f8af plus this change (then rebased onto
cec267f90, which changed GUI assets only):
go test ./internal/library ok (./internal/gui ok before the rebase
onto it, which brought no Go change there); GOOS=linux and
GOOS=windows go vet ./internal/library ok; gofmt clean.
Broken by hand: with the gate taken out,
TestRegistryDockerOptionsStayInTheContainer fails 23 of its 32 cases
(host network, privileged, root/home/socket/drive binds, bind mounts,
volume-opt, env-file...).
Not tried: a real `docker run` of an entry with these options; the full
suite.
2026-11-10 16:14:54 +08:00
yetone cec267f902 gui: a field's long explanation shows on asking, in the editor and Routing groups (yujezhang on X)
yujezhang on X (11-10): "现在界面好多描述都太繁琐了 ... 界面只保留完成
操作必需的信息". The longest always-visible lines left were in a
provider's editor (100 to 666 characters a field) and Routing groups'
settings (69 to 318). They now work like Settings' rows since 11-02:
with a mouse, the explanation rests out of sight and the row's hover
(450ms) or keyboard focus shows it in the shared .set-hint card. A touch
screen keeps every line. No layout moves, no new page, no info icon
(the owner chose hover on the row for Settings).

Removed or moved:
- Routing's empty caption ("Every request an agent sends to magpie
  shows up here, routed for real.") is gone from the empty state: the
  mode line above it says the same. The key stays, the panel uses it.
- A provider editor field's explanation (.fld > .hint.expl): Headers,
  Certificate, Compaction, the routing and rate-limit fields and the
  rest: in the card. A line with a link or control in it, a warning and
  an error stay in sight.
- Two fields keep one short line in sight for what turning them on
  costs: Certificate ("Turn it on only on a network you trust.") and
  Compaction ("A conversation compacted this way continues only on
  this provider and account."). New keys in zh, zh-TW, ja and de.
- The editor's own settings rows (.prov-prefs: warm-up, check-in,
  resets) hide their lines as Settings' do; a result line (.say) stays.
- Routing groups: Found, Names and the three defaults' small lines: in
  the card. The no-names line stays.
- settingshints.js listens on document, so the editor (in #modal) and
  Routing get the card; the card grows from its row in 150ms, strong
  ease-out, a fade alone under reduced motion.

A line held out of sight is position: absolute in its field's box
(.fld and .hint-row > .txt are position: relative): placed against the
page, deep in the editor's scroll, it grew the page a scrollbar and
made the editor 10px narrower, and account-weight's de 390 in WebKit
ran an account line 3px past its row. Its sr-only -1px margin is
dropped, so it no longer sits 1px left of its row (warm-at-times,
warm-now and checkin-now-account check every .sub is inside its row).

Tests:
- New editor-hints.test.cjs (chromium + webkit, en/zh/zh-TW/ja/de,
  1100 and 420): at rest the explanation is out of sight and still
  described; Certificate's lead is in sight on one line; a hover shows
  the card with the text, inside the window, not over the name, nothing
  moving, taking no pointer; leaving hides it; Tab onto a field shows
  it; every out-of-sight line is placed in its own field; Routing
  groups' lines the same. 42/42 with account-weight on the Linux box.
- Broken by hand: the hide rule replaced and ROWS without the editor
  and groups: 0/20 red. The position: relative rule removed: 20/20 red
  (the placement check), then restored.
- vertex-editor: a hint resting out of sight isn't "cut".
  group-found-off: rows carry hint-row.
- 271 GUI files (every editor/edit= test, hints, visibility, prov-prefs,
  rt-gset/rt-cap, i18n-keys, old-webkit) in both engines on the WSL box
  (magpie-desktop), mine against a copy of 5d9e29814: 5589 pass / 241
  fail mine, 5528 / 262 base. Every file red in mine is red on base too
  except group-morph, provider-image-files and restart-app (one subtest
  each at concurrency 8); alone those three pass 114/114.
- settings-hints ja/de 420 and settings-lines-wrap de 440 fail the same
  on base (#5872).

Not tried: the whole 1343-file GUI suite (mote's suite.lock queue was
hours long); a touch screen; the real Linux app (WebKitGTK); macOS
Playwright.
2026-11-10 16:09:34 +08:00
yetone 6a253f8af7 memory: pick several memories and keep, archive or delete them at once (RealZeroP27 on X)
Library -> Memory reviewed one memory at a time: To review held
candidates that had to be opened and kept or deleted one by one.

- Select (beside the filters, shown when two or more are listed) puts a
  box on each memory. A click picks one, Shift-click the range from the
  last one clicked, up/down move between the boxes (Shift picks as it
  goes), Cmd/Ctrl+A picks all shown, Escape ends it. A search or filter
  unpicks what it hides.
- The bar under the list (the library's lib-pickbar, as Skills' Select)
  keeps (To review), archives (In use) or restores (Archived) the picked
  ones, and deletes them on a second click.
- POST /api/memory/status {ids, status}: memory.SetStatus changes them in
  one write, each as Edit by the user (an archived inferred memory is
  dismissed, so it isn't proposed again). Unknown ids are skipped; none
  found, or a bad status, is a 400 and changes nothing.
  Delete reuses POST /api/memory/remove {ids}.

Run (mote, at this head):
- go test ./internal/memory ./internal/memdistill ./internal/library: ok
- go test -run 'Memory|Distill|Dream' ./internal/gui: ok
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., and the three builds: ok. gofmt -l: clean.
- library-memory-select.test.cjs (new): 22/22, chromium and webkit,
  en/zh/zh-TW/ja/de at 980 and 420 wide (no native select, no sideways
  overflow).
- Every library-*, i18n-* and gui-* GUI file (67), both engines: 1309 of 1309 pass.
- Rebased on 2219fdd49: i18n-keys, library-memory, library-memory-select
  and library-bili 132/132; go test ./internal/memory and -run Memory
  ./internal/gui ok (at d374168d0; only a
  client_icons test changed in those packages since).

Broken by hand:
- SetStatus without editIn: TestSetStatusOfSome red ("after keeping two:
  candidate candidate candidate candidate"), and
  TestMemoryStatusRouteActsOnSome red.
- memPick with no Shift range: the GUI test red (got [c1, c4], wanted
  c1..c4).

Not tried: the real app with a real memory.json, the WebKitGTK Linux app,
Windows' WebView2.
2026-11-10 16:00:30 +08:00
yetone 93a33d8174 agent: OpenBot's icon, its requests named its own, its skills in the Library (SSNQT on X)
SSNQT on X, magpie 0.1.3503 on macOS, OpenBot (611ce90d1): no icon in
the Agents list, its requests listed as OpenCode's, and no way to pick
it for skills or MCP servers in the Library.

- Icon: OpenBot's production icon (build/icon-production.png in
  nightly-labs/openbot, 128px) as icons/openbot.png, in pngIcons and in
  app.css's tile rule (a solid tile, icon-tile.test.cjs); openbot is off
  client_icons_test's generic list.
- Requests: OpenBot seals an endpoint's key and headers in safeStorage,
  which magpie can't write, and hands the endpoint to the OpenCode it
  runs, so every request came with OpenCode's User-Agent and nothing of
  OpenBot's. magpie's entry is now at <gateway>/agent/openbot/v1
  (gateway.AgentURL). lanGuard takes /agent/<id> off the path when <id>
  is an agent magpie knows (takeAgentPath), agentOf names that agent
  first, and startedByAgent never takes such a request for a script. An
  unknown id is left in the path (404 as before). An entry written at
  /v1 is rewritten at the next sync; OpenBot reads it after a restart,
  which its notice already says. Requests recorded before stay
  OpenCode's.
- Library: an openbot target with skills in ~/.agents/skills, the only
  folder OpenBot reads (home-skills.ts, HOME_SKILL_FOLDER). Its MCP
  servers are rows in its SQLite database (openbot.db,
  projection_mcp_servers), which magpie doesn't write, so it stays out
  of the MCP picker: #5896.
- Guard: TestEveryAgentInLibrary fails for a built-in agent that has no
  Library target and isn't in noLibrary with a reason. 34 agents had
  none when it landed; they are listed as "not looked at (#5897)". The
  icon guard (TestEveryClientHasNameAndIcon) and the agent-name guard
  (TestIsAgentByUserAgent) were there already.

Run (mote unless said): gofmt -l internal (clean); go vet darwin, GOOS=linux
-tags nogui, GOOS=windows on agent, gateway, library, gui: ok;
go test -count=1 ./internal/agent ./internal/gateway ./internal/library
./internal/gui ./internal/usage: all ok but internal/gui's
TestUpdateSlowDownloadOutlastsTheCheckBound (its check request hit its
deadline with four other suites on the box; passes 3 of 3 alone; the
updater isn't touched here; #5905); TestAgentInPath and
TestEveryAgentInLibrary on Windows (win-run): ok; GUI i18n-keys,
icon-tile, icon-one-tone, icon-builtin-over-address,
routing-client-icons, library-pick-remove: chromium 101/101, webkit
54/54. Real gateway (nogui build, sandbox HOME, port 3591): a POST to
/agent/openbot/v1/chat/completions with OpenCode's User-Agent was
recorded as agent openbot, the same at /v1 as opencode, and
/agent/openbot/v1/models answered the list.

Broken by hand, each red: the takeAgentPath call in lanGuard taken out
(TestAgentInPath: path kept, agent opencode); the pathAgent check in
agentOf taken out (agent opencode); the openbot case in targetOf renamed
(TestEveryAgentInLibrary: openbot has no place); Icon back to generic
(TestEveryClientHasNameAndIcon).

Not tried: real OpenBot or a real OpenCode sending to the new address
(the URL is built as `${baseURL}/chat/completions` by
@ai-sdk/openai-compatible, read in its source); the full suite (runs
after the tag).
2026-11-10 15:56:21 +08:00
yetone 2219fdd49e lessons: a searched-for word a port or id can spell, seen again (#5616) 2026-11-10 15:54:04 +08:00
yetone 902237b325 gateway: TestSearchAPIFailureKeepsNoURL's comment names the route_id too (#5616)
On 11-10 ubuntu CI (run 42771382484, at 03a800ac6) the old query's
"4410" was found in route_id 1794294410888, not the port, so the
comment Gaoshou101's patch adds names both. The letters-only query
covers either.
2026-11-10 15:53:24 +08:00
Gaoshou101 17b9b5b031 gateway: TestSearchAPIFailureKeepsNoURL's query has no number a port can hold (#5616)
Fixes #5616

Ubuntu CI run 42368406605 failed it: "the query's "4410" is in
usage.jsonl", where the only 4410 was the fake server's random port,
host 127.0.0.1:44105. The row rightly logs the host, so a query word
made of digits matches the port now and then. The query is letters
only now, as 4a4a82cd4 did for the sibling TestSearchAPIAsksAreLogged;
the check that no query word reaches usage.jsonl is unchanged, and the
new word still rides in the GET URL, so a leaked URL still fails it.

Test-only; no gateway code changes.

Broken by hand: the untouched test with the fake server's listener
pinned to 127.0.0.1:44105 (throwaway harness, not committed) fails with
the CI message: the query's "4410" is in usage.jsonl. With this change
and the same pin it passes.

Run at this tree (origin/main 56f095604 + this):
go test -tags nogui -race -count=20 -run 'TestSearchAPI|TestOwnSearchIsLogged' ./internal/gateway ok.
GOOS=linux go vet -tags nogui ./internal/gateway and
GOOS=windows go vet ./internal/gateway clean; gofmt -l and
git diff --check clean. Not run: the whole gateway package (one-line
test literal change).
2026-11-10 15:53:24 +08:00
yetone 6fa9ff8358 library: billion-context's version is read past the warnings bili prints first
readBili ran `bili --version` with stderr and took the output's first
word. bili writes its warnings to stderr before the version; with a
config key it doesn't know (models, in a sandbox HOME on mote, bili
0.1.213) the output began "2026-11-09T23:44:06.211 [warn] [v=0.1.213]
...", and that timestamp was the card's version. biliVersion takes the
first word of the first line that is a version.

Run:
- go test -tags nogui -run 'TestBili' ./internal/library on mote: ok.
- go vet ./internal/library for darwin, GOOS=linux -tags nogui and
  GOOS=windows: ok. gofmt -l clean.

Broken by hand: readBili and the test back on the first word of the
output: TestBiliVersionPastItsWarnings red (the timestamp, "[warn]",
"command").

Not tried: the card showing it in the GUI (the field is the same
string the card already prints).
2026-11-10 15:47:32 +08:00
yetone 97fcbe3540 library: billion-context's card shows the tokens it saved (Scott__D on X)
The RTK tab says what RTK saved (rtk gain); the billion-context tab said
nothing of its effect. bili 0.1.213 has no command that prints its
savings. Its running proxy serves its dashboard's numbers at
GET /__bili/overview, summed over every session in its one store, and
each bili that runs registers in <state>/instances/<id>.json
($XDG_STATE_HOME or ~/.local/state, then billion-context, on every
system; read from bili's dist and its Hermes plugin's twin reader).

readBiliSaved (internal/library/bili_saved.go) asks the registered
bilis newest first, loopback http origins only, 3s in all, and puts the
first answer on BiliView.Saved: netSavedTotal (bili's headline "net
savings", after post-fold rebuilds and the summaries' cost, only with
hasFoldData), grossSavedTotal (which bili calls an upper bound),
foldsTotal, sessions, requests. The answer is kept in bili-saved.json
in magpie's config folder and shown "as of" its time when no bili runs;
a kept file that doesn't parse is no answer. magpie never starts a bili
to ask (it would auto-update and start watchers). The card says
"166.3k tokens saved over 7 folds in 1 session", bili's own count over
every session on this computer, the gross before costs; "Nothing folded
yet over N requests" before a fold; and that it shows once bili has run
when no bili ever answered. zh, zh-TW, ja and de; site docs (en, zh,
ja) and docs/subsystems/library.md.

Run:
- Real bili 0.1.213 on mote in a sandbox HOME (ACP_AUTO_UPDATE=0, 20000
  token window, bili start on 18799, a fake OpenAI upstream answering
  usage = bytes/4): ten turns of a growing conversation through
  /bili/<upstream>/ gave overview net 166285, gross 166390, 7 folds,
  1 session, 10 requests. That literal answer is the Go fixture
  (testdata/bili/overview-0.1.213.json) and the GUI test's numbers.
  readBiliSaved/ReadBili run on mote against that live bili with that
  HOME read the same numbers (Live true, Version 0.1.213).
- go test -tags nogui ./internal/library ./internal/gui on mote: ok.
- win-run go test -run 'TestBiliSaved|TestBiliLoopback'
  ./internal/library on xiaomi-gpu: ok.
- library-bili, i18n-keys and i18n-en-no-cjk in chromium and webkit
  (every language, 1100 and 420 wide): 92 pass, 0 fail.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui and
  GOOS=windows for internal/library and internal/gui: ok.
- site/public/llms-full.txt regenerated (node llms-full.mjs); site
  worker.test.mjs: 38 of 38 ok.

Broken by hand:
- the loopback filter taken out: TestBiliSavedFromRunningBili red
  (192.0.2.7 asked first, the 3s budget gone, nothing read).
- net read from tokensSaved, and a kept answer marked live:
  TestBiliSavedFromRunningBili and TestBiliSavedOnThePage red.
- the card's line taken out: library-bili 40 of 42 red (chromium).

Not tried: a real agent session with a real model through bili (the
upstream was a fake with made-up usage, so only the plumbing of bili's
numbers is checked, not how much a real session saves); a bili with
money data (hasMoneyData; its dollars are passed as usd but not shown);
the card on Linux WebKitGTK.
2026-11-10 15:47:32 +08:00
yetone eff7f9f62a library: a market server starts the way its registry entry says (fwxkogaia on X)
Serena from Library → MCP's market showed "已退出 (2)": magpie ran
`uvx serena-agent`, which prints its help and exits 2. The registry has
uvx run it as `uvx -p 3.13 serena-agent start-mcp-server
--project-from-cwd --context desktop-app`: its runtimeArguments, which
the shipped crawl (market_servers.json) had dropped and magpie never
read.

The class, fixed in launchLine (market_launch.go):
- runtimeArguments are read: the runner's own options (uvx -p/--from/
  --with/--prerelease, npx --package, docker's mounts, -e and
  --entrypoint) go before the package, the program's words after it,
  then packageArguments. A required option with no value magpie can
  fill keeps the package from being offered.
- An executable not named after its package is reached with
  `uvx --from <pkg> <bin>` / `npx -y --package <pkg> <bin>`. The crawl
  now keeps each package's executables (`bins`: npm's `bin`, the
  wheel's console scripts); a package with none, or several with none
  standing out (pickBin), isn't offered. `python -m mod` among
  runtimeArguments runs that module from the package.
- One package that can't be started no longer hides another of the
  same server (npm, then pypi, then oci).
- serverKey/packageOf skip uvx's option values, so Serena's key stays
  "uvx serena-agent" and an installed one is still found.

Audit of the 500 shipped entries (old line → new): 101 change. Among
them firebase (`npx -y firebase-tools mcp`), basic-memory, docling,
ouroboros, pm-claude-skills, llm-sandbox, polymarket-paper-trader,
visualtorch, canvas-mcp, alfanous (python -m), uniswap, pyscrappy,
llmtrim, reddit-research-mcp, word-mcp-live, omega, tinysearch,
haiku-rag, orcareplay, terravision, watch-skill, PyMemoryEditor,
edgartools/mirobody/new-term-radar/backlot (--with/--python), docker
robin/funasr/MARM (mounts). No longer offered (no line that starts):
aihawk and mcp-sap-docs (not on PyPI/npm), mcp-video, unifi-mcp-server,
antigravity-link-extension (no executable), token-savior, flyto-core
(several, none for MCP), maintenant and apollo (a docker mount to fill
in).

Users who installed one already: heal() gives a uvx/npx server whose
command and arguments are exactly the line magpie offered before the
line the registry says (healMarketLines), so the next start of magpie
rewrites library.json and every agent given it. A line the user edited
is left as it is.

Run (mote, via mote-run): go test ./internal/library ./internal/gui;
go vet darwin, GOOS=linux -tags nogui, GOOS=windows; gofmt.
TestRegistryLaunchLines uses the registry's own entries (Serena,
docling, olcli, alfanous, visualtorch, basic-memory, firebase, MARM,
...); TestPopularSerenaStarts reads the shipped crawl;
TestInstalledMarketLineHealed seeds `uvx serena-agent` given to Codex,
syncs, and checks config.toml and library.json. No network in tests.
Real starts on mote in a sandbox HOME (MCP initialize): `uvx
serena-agent` exits 2 with usage; the new Serena line answers
initialize (serverInfo Serena). Also answer: polymarket pm-trader-mcp,
basic-memory, llmtrim, pm-claude-skills, visualtorch-mcp. canvas and
reddit start but need their keys.

Broken by hand: ignoring runtimeArguments and the bins check turns 14
of TestRegistryLaunchLines' cases and TestPopularSerenaStarts red;
dropping healMarketLines from heal turns
TestInstalledMarketLineHealed red.

Not tried / still wrong upstream: omega and tinysearch now run their
real executable but their registry entries omit the `[server]` extra
(omega also needs `serve`), so they still don't serve MCP; that is
their registry entries. Docker lines weren't started. No GUI asset
changed, so no GUI files were run. The full suite runs after the tag.
2026-11-10 15:47:14 +08:00
yetone 0ecba163b6 gui: the core scripts back under their budget after d374168d0
d374168d0 (Settings stays where it was clicked, jen_celeus on X) was
measured under the core-script budget at 86825005e with 220 bytes to
spare. It was rebased once more onto 281a7e024, whose sync change added to
app.js, and pushed without measuring again: the core went 52 bytes over
1,533,802, so TestCoreScriptBudget is red at d374168d0. Two sidebar
comments (NAV_SUBS', navSubLeave's) are cut to one line each, no code
changed, no raise. 109 bytes under now.

Run (mote, at this head): go test -run Budget ./internal/gui ok.
2026-11-10 15:46:34 +08:00
yetone 710a290e26 sessions: every session file's parse is let go three minutes after its last read
The parses of every session file (the sessions index, kept on disk as
sessions.json) stayed in memory for the life of the process after one
visit to the Sessions or Usage page, or the start's warm-up: ~23.5 MB of
a 68 MB idle heap for a real history of 24.6 MB on disk. Now, once
nothing has read them for cacheIdle (3 min), they are let go and the next
read loads them from sessions.json, with no session file read again.

They stay while a refresh is reading files, while glances are overlaid,
while a save is not on disk yet (it is hurried first), and when the last
save failed (writeCache now records that), so a let-go never means
parsing a long history again.

Measured on mote (macOS) with a copy of the real accounts, idle, no
asks, 330 s, t51 = origin/main before this, t52 = this:
  footprint at the end  111 MB -> 96-100 MB
  Go heap at the end    68.05 MB -> 46.15 MB (decodeCache's 23.5 MB -> 0)
Reads after 200 s idle (t52 had let go; t51 had not):
  /api/sessions          0.28 s -> 0.54 s
  /api/sessions/stats    0.19 s -> 0.36 s
  process CPU over the run 4.03 s -> 4.40 s
A warm read is unchanged (0.24 s / 0.01 s).

Run: go vet ./internal/sessions (darwin; windows and linux with
CGO_ENABLED=0); go test ./internal/sessions ./internal/gui
./internal/usage on mote, all ok. TestIdleParsesLetGoAndComeBackFromDisk
broken by hand twice: dropping the failed-save guard (red: "let go while
the last save had failed") and not clearing the cache (red: "idle parses
kept"). Not run: the full suite; Windows and Linux runs of the package.
2026-11-10 15:46:24 +08:00