Commit Graph
7089 Commits
Author SHA1 Message Date
yetone b0d0092be5 middleware: a streaming request's runtimes let its body go once its request hooks are done (#3383)
A request keeps its middleware runtimes until its reply has streamed,
so its hooks share ctx.state, and moejs kept the body each hook was
given, parsed, in the runtime's registers until End: a long context's
body was alive for the whole reply, ~10 MB for a 7 MB body. The report's
inuse profile had 448 MB under moejs ParseJSON with many agents
streaming at once. Request and Tried now call ReleaseCallData on the
request's runtimes once their hooks are done; ctx, and what ctx.state
holds, stay. Not after each onEvent: an event is small and its hooks run
a thousand times a reply.

Run:
- TestStreamingRequestHoldsNoBody: 8 requests streaming with a 7 MB
  body hold under 7 MB, and onEvent still reads ctx.state; with the
  release commented out by hand it fails ("8 streaming requests hold 69
  MB, their body is 7 MB").
- go test -count=1 ./internal/middleware/ ./internal/gwmw/: ok.
- go test -count=1 -run 'Middleware|Think|Strateg' ./internal/gateway/
  ./plugins/...: ok.
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags nogui
  clean for internal/middleware.
2026-10-24 21:00:05 +08:00
yetone 4753a6cfbb gateway: a look at the routing history reads today's file only past what it counted, and parses only its latest routes (#3383)
The Routing view asks /api/gateway/history every 15s while requests are
done. History read a day's .jsonl whole whenever its size had changed,
which today's always has, so a busy day's 350 MB file (19,751 routes in
the report) was read through at every look, and asking for today
unmarshalled all its routes to keep the latest 2000. Now a .jsonl's
count is kept with where each of its lines starts: a look reads only the
bytes added since, and the asked day parses its latest historyMax plus
200 lines (historySlack, for a route done after later ones began). A
last line without its newline is counted, as readDay reads it, but
tallied again at the next look, as it may be half written; a file
smaller than what was counted is counted again from its start. .gz days
are read as before, an asked one skipping the unmarshal of all but its
latest lines.

Run:
- TestHistoryReadsOnlyWhatWasAdded: ok; red on the old history.go
  ("want 2252 requests", got 2251: it read the blanked routes again).
- BenchmarkHistoryLook (20k routes, ~100 MB, one added per look):
  54.1 ms/op on the old code, 1.19 ms/op now.
- go test -count=1 -run 'History|Trace|Route' ./internal/gateway/
  ./internal/gui/: once exited 1 with the failing test's name lost to a
  tail; rerun with the whole log kept, then -count=3: ok every time.
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags nogui
  clean for internal/gateway.

Not done here: the route's Order list's size on disk, and moejs's
retained JSON (#3383's other two findings).
2026-10-24 21:00:05 +08:00
yetone f8fa8147ba sessions: a page-asked first read uses half the cores, not twice them (#3238)
The index's cold scan with a page waiting started min(max(8, 2*NumCPU),
32) readers, as if reading waited on the disk. On an SSD decoding and
parsing is the work: on the Windows box (32 cores) a cold start over
6751 real Codex session files (15156 MB) with /api/sessions waiting
held 2154% CPU, the ~2000% the reporter saw, while other apps ran
beside it. Now max(2, NumCPU/2) readers; the quiet warm-up's NumCPU/4
slots are unchanged.

Run:
- TestAskedIndexReadsWithHalfTheCores: ok; with the old count put back
  by hand it fails ("the index read 28 files at once, want 2 to 7").
- go test -count=1 ./internal/sessions/: ok (64s).
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags nogui
  clean for internal/sessions.

- On the Windows box (32 cores), a cold read of 14051 session files
  (~44 GB) with a page waiting, magpie built from this commit's parent
  against this one: peak CPU 1634% -> 1172% (about 900-1100% sustained),
  peak working set 1612 MB -> 1108 MB, ~22s -> ~27s to read them all.
2026-10-24 21:00:05 +08:00
yetone fc9430e12d proc: Windows lists processes from a Toolhelp snapshot, not a new PowerShell and WMI each time (#3467) 2026-10-24 21:00:05 +08:00
yetone b5d46acbed agent: Kiro Crew runs on a harness connected to magpie
Vincent on Discord asked for Kiro Crew (kirodotdev/KiroCrew v0.9.0: the
KiroCrew.app desktop app, the kirocrew CLI, its dashboard and the Gateway
on :5476). Crew has no model provider of its own. It runs each session on
an ACP harness picked by agent.acp_backend (and dispatched members by
agent.member_acp_backend) in $KIROCREW_HOME/config.json, default
~/.kiro/crew (src/kiro_crew/config/paths.py, loader.py, sections.py;
ACP_BACKENDS_MEMBER_DISPATCH in agent_sdk/backends.py).

Connecting sets those keys to an agent already connected to magpie,
tried in this order: Codex, Claude Code, OpenCode, Pi, Goose. One whose ACP
adapter is installed (codex-acp, claude-agent-acp, pi-acp) wins, so one
click is enough. magpie looks for the adapter where Crew does and installs
nothing; when it's missing, the notice gives the npm command. With no harness
connected the connect is refused with a message naming which agents to
connect. A harness set in config.local.json wins over config.json, so magpie
doesn't write it and the row says so. The previous values are stashed. On
Disconnect they are put back, but only for keys that still hold what magpie
wrote, and a file magpie created is removed once it's empty. The row reads as
connected only while its harness is still wired to magpie. deepseek is not
offered: Crew runs it as dsh --profile acp, which magpie's dsh wiring doesn't
reach. KIROCREW_HOME and the adapter path variables are read from the login
shell (agentenv).

Run (Go and the GUI files at base 137187a40, then again after the rebase onto 3d758d034):
- go test -tags nogui ./internal/agent ./internal/agentenv: ok, in a
  sandbox HOME
- gofmt -l is clean; GOOS=linux and GOOS=windows go vet -tags nogui
  ./internal/agent/... ./internal/agentenv/...: ok
- GUI: the new agent-kiro-crew-lang.test.cjs (refusals, notice and words in
  en, zh, zh-TW, ja and de; chromium and webkit; 1100 and 420px) 22/22. The
  agent*, gui-*, i18n* and header-relang files (45), concurrency 2 at load
  ~250: 632/633. The red was agent-models-own, chromium en 420, where the dsh
  row's model click timed out at 5s (#1666, filed). After the rebase that
  file and the new one, run alone: 38/38.
- After the rebase: go build ./...; the KiroCrew, Notice, FolderVars,
  EveryPicker and ListsModels tests: ok. go test ./internal/gui: everything
  passed except TestMainWindowCorners, which was killed at its 40s
  measurement at load ~200 (#1936, #2645, both filed; this change touches
  no window code).
- No go test ./... at the pushed head before the push: the machine is at
  load 200-300, other sessions are queued for the suite lock, and ships go
  out at once (owner, 10-22). Queued to run behind them at the pushed
  head.
- Real Kiro Crew: Crew v0.9.0 was installed from source into a sandbox venv,
  and its own loader (load_config_with_content_stamp, overlay_pins) read the
  config.json magpie wrote over the real Codex wiring in a sandbox HOME:
  acp_backend='codex', member_acp_backend='codex'. With a config.local.json
  pin it reads the pinned value and overlay_pins is True. Disconnect gave the
  user's file back as it was, and removed the file magpie had created.

Broken by hand, each red:
- restore off: Connect, PicksAHarness, HarnessPick, MakesItsFile
- the pin check off: LocalPin
- adapter preference off: PicksAHarness
- the member key always written: PicksAHarness, HarnessPick
- harness wiring unchecked in on(): FollowsItsHarness, OnRealCodexWiring
- the ja translation of the pinned refusal removed: the new GUI test, ja at
  both widths

Not tried: Crew's Gateway starting a real session through codex-acp
against magpie's gateway, and none of Crew's harnesses was run under it.
Adapter paths on Windows. A user who pinned agent.model to a kiro-only
model on a non-kiro harness.
2026-10-24 20:59:25 +08:00
yetone 3840333c51 site: APIKEY.FAN is a README sponsor
APIKEY.FAN added a README seat to its in-app one. README.md shows its
English logo ("Enterprise AI Gateway"), README.zh-CN.md its Chinese one
("企业级 AI 中转站"), each with a dark copy whose #111111 lettering is
#F2F2F2, the orange mark unchanged. Both link usemagpie.ai/go/apikeyfan/readme,
which sponsors.js sends to apikey.fan/?aff=mg_readme, the link APIKEY.FAN
gave for the README.

Run: node --test site/*.test.mjs (30 of 30 ok). The four logos rendered
with rsvg-convert on white and on GitHub's dark background and looked at.
After the deploy, /go/apikeyfan/readme is checked for its 302.
2026-10-24 20:50:18 +08:00
yetone 3d758d0345 gui: Settings › About's Version row keeps its height while the update read is out (#3469)
xisdumpling: going back to Settings › About from another page made every
row jump up about 12px and back. renderSettings rebuilds #about, and the
new Version row had no line under its name and no Check button until
renderUpdate's GET /api/update came back.

Now renderUpdate keeps the last state it drew (updateLast, which
renderUpdateBadge's read at start fills in too). A row made again draws
that state at once, then reads. Once the read is back it bumps the
row's sequence, so timers the early draw started stop. There are two
exceptions:
- no early draw while a check is out (the old code drew the row blank,
  then "checking");
- Download from GitHub clears the cache before it redraws Settings, so
  the mirror's old error isn't drawn again.

Size: app.js and the core are under their budgets, which are not raised.
No function in app.js has a single plugin as its only user, so the
room came from renderUpdate itself: one opener for the release page
(4 copies), one dim() (2) and seqOf(r) (9).

Run, at a3b8d706e's tree rebased on 5222a4b12:
- update-row-held (new), update-check, update-mirror, update-wait,
  update-restart, i18n-keys and settings-sections, in Chromium and
  WebKit: 92 of 92 pass.
- go test -tags nogui ./internal/gui/ -run 'TestCoreScriptBudget|I18n|Asset': ok.
- Before the last rebase: go test -tags nogui ./internal/gui/...: ok.
  The 31 GUI files that reach Settings › About or /api/update, in both
  engines (update-*, settings-*, i18n-keys, header-*, whats-new*,
  cli-behind, menu-scroll, refresh-page, segs-glide): two reds were mine
  and are fixed above (update-mirror zh, update-check "drawing the row
  again while a check runs"). Two are not mine:
  - update-wait chromium en, under load, is #3275. It passes 3 of 3
    alone.
  - header-centre webkit "en at 125%" is red on origin/main 5222a4b12
    too. It is a ResizeObserver loop reported as a page error, filed as
    #3479.

Broken by hand: update-row-held.test.cjs, run against origin/main's
app.js, is red in both engines: "the row was 60.28125px with \"Up to
date\" and Check; 36 of 39 frames drew it otherwise" (WebKit 39 of 40).

Not tried:
- the real Windows app, where it was reported. The test runs the
  page's own show("agents") then show("settings") path with the update
  read held;
- the first-open case in the real app (the cache comes from the start's
  badge read). It is covered only by reading the code.
2026-10-24 20:34:42 +08:00
yetone 7765f27fcc gateway: a model an account refuses goes on to the accounts not listing it yet
01huadalang (Discord): Antigravity with several accounts, only some can
use Gemini 4. The model and its bar showed only after the right account
was made preferred and probed, and a request failed with the preferred
account's error instead of going on to the account that serves it.
st3lland (Discord): on ZCode (plugin) accounts serve different models.
Owner: no manual setting, magpie knows per account and routes.

Two causes:
- perKeyBarred puts an account whose own saved list lacks the model in
  pl.unlisted / pl.left (Unlisted) and serve never asked it. So when
  the listing accounts refused the model (Antigravity's real 404
  NOT_FOUND "Requested entity was not found.", codeAssistModelMissing;
  plugins through modelRefused's unservedWords), the agent got that
  error even though an account whose list was simply stale serves it.
  Now, once every listing account of that subscription/model has been
  asked and one refused it as unserved (unservedTry), its unlisted
  accounts are asked next, right after it and before any other member
  or fallback (unlistedNext, askUnlisted for the trace). The refusing
  try rests as before (restAfterMarked, for that model). Not for a
  pinned account, a sealed conversation or strict affinity; a gateway
  key's account list narrows unlisted too (allowedCandidates). Other
  refusals (403 PERMISSION_DENIED, 429 RESOURCE_EXHAUSTED) don't open
  the unlisted accounts.
- Antigravity's per-account lists were refreshed only on the first
  listing, a probe, a sync or a Refetch, so a model granted later and
  its bar (chosenWindows filters by exposed models) stayed hidden. Its
  quota reading already fetches fetchAvailableModels per account; now
  it saves that account's list (noteAntigravityList) and re-merges the
  pooled list from every On account's list when it changed. An Off
  account's reading changes nothing.

Other vendors: the unlisted route only opens on the existing unserved
classifiers (Antigravity's 404, plugins' unservedWords), unchanged here;
TestUnlistedAccountNotAskedForOtherRefusals holds that the other real
Antigravity bodies don't open it.

Run (at the rebased head on origin/main 5222a4b12):
- go test ./internal/gateway -run TestUnlistedAccount (4 new) and
  ./internal/provider -run 'TestAntigravityQuotaReadingListsNewModels|
  TestAntigravityModelsAcrossAccounts': ok.
- Targeted: ./internal/gateway -run 'Unlisted|Antigravity|Fallback|Refus|
  Unserved|KeyModel|Lists|Plan|Rest' and ./internal/provider -run
  'Antigravity|Google|Gemini|Pool|Lists': ok (gateway 34.9s, provider 4.5s)
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
- Full suite: queued behind three other sessions' full runs on this
  machine (load ~300); its result goes on this commit's follow-up, not
  claimed here.
- GUI: no asset changed; none run.

Broken by hand, each red, then restored:
- unlisted fallback off (false && unservedBy[key]): AskedAfterModelRefused
  404, BeforeFallback served a's fallback.
- unlisted appended after fallbacks instead of inserted: BeforeFallback red.
- key doesn't narrow unlisted: HeldFromKey got b's 200, want a's 404.
- quota reading keeps no list: QuotaReadingListsNewModels pooled list
  lacks Gemini 4.

Not tried: no real Antigravity accounts with and without Gemini 4 (the
404 body is the one on record from earlier reports); no real ZCode
"model not available" body is on record, so none was invented and ZCode
relies on modelRefused's existing words; the plugins repo is unchanged
(ZCode's models(provider,{auth}) already lists per account). Known
limit: a resting listed account that is the lone candidate is still
asked first on later turns until the unlisted account's list refreshes
at its next quota reading, one extra request a turn.
2026-10-24 20:32:33 +08:00
yetone 5222a4b129 gui tests: segment-press-dialog waits for the add sheet the page opens itself
With no provider, the Providers page opens its add sheet itself once
/api/providers is in (app.js renderProviders), and the add button goes
away. The test pressed #addProvider right after goto: when the list came
first, as it does on a busy machine, the press waited 30s for a button
that was gone. It was red 1 of 2 runs at f35c721c4~1 (load ~310) and
3 of 4 in the 112-file #modal run; the test now waits for the sheet's
tile instead.

Run: segment-press-dialog, chromium and webkit, en and zh, 3 runs in a
row: 4/4 ok each. No other test that presses #addProvider has an empty
list.
2026-10-24 20:16:25 +08:00
yetone 3d56822d41 gui: a provider's editor grows from where its row was pressed
The owner (10-24, 点击这里,然后放大弹窗的时候,应该从点击处可放大吧):
pressed past its name, a provider row's editor grew from the row's left
end, its logo and name, not from the press. Pressed on the logo itself
(the row's drag handle), it didn't grow from the row at all: the handle
was recorded with no way to find it again once the row was drawn anew,
so the dialog opened with no morph.

The press now keeps its x. rowOwnRect still takes a strip the size of
the logo and name, and when the press is past them it centres that strip
on the press, inside the row. A press on .pv-handle counts as the row's.
Closing goes back to the same strip.

Run (darwin, chromium and webkit, on d0a54d74a's calm() refactor):
- modal-morph: 6/6 ok at 1240 and 420px. Its first open now presses the
  logo, and a new case presses at 62% of the row and checks the strip:
  centred within 3px of the press, as wide as the first one, inside the
  row, closing back to it. Broken by hand: without the handle mapping,
  red at "opening clips the dialog: none"; without the centring, red at
  "again: the strip centred on the press".
- modal-centred-late 6/6, group-morph 22/22 ok.
- go test ./internal/gui -run TestCoreScriptBudget: ok, with no room
  added (calm() made the room).
Not run: the whole GUI suite (load ~400 on the box); the real Wails app.
2026-10-24 20:12:27 +08:00
yetone ed0425fc9f gui: every reduced-motion check in app.js asks calm()
app.js asked matchMedia("(prefers-reduced-motion: reduce)") in nine
places, and calm() did the same as a const defined at the dialog code.
calm is now a function declaration, so code above it can call it too,
and every other place asks calm(); stillMotion and navCalm stay its
names where they were. Nothing changes in what moves: this frees ~470
bytes of the core script budget for the next change (the editor
growing from where its row was pressed).

Run (darwin, chromium and webkit):
- node --check app.js: ok. go test ./internal/gui -run
  TestCoreScriptBudget: ok.
- GUI: modal-morph 6/6, held-animations 4/4, routing-ctx-still 16/16,
  context-map 22/22 ok.
Not run: the whole GUI suite (load ~400 on the box).
2026-10-24 20:12:27 +08:00
yetone 31275d0734 gateway: a history call to a tool the request doesn't declare gets a stub where it is refused (pi, T3 Code tool_search)
Gearclickist on Discord: pi and T3 Code, on magpie's /v1 chat/completions,
load tools on demand. The tools a tool_search found are called in the
history but not declared in the next request's tools, and pi sends
"tools": [] with history calls when it has no tools left.

Cause, per upstream (magpie forwarded the calls unchanged on every path,
seen in a probe through fakes):
- Anthropic Messages (API, Bedrock/Vertex Claude, relays): a call to a
  tool it isn't given is accepted, but calls with no tools at all get
  400 "Requests which include tool_use or tool_result blocks must
  define tools". anthropicBody dropped tools when the request had none,
  so pi's tools: [] turn failed. Now each tool the history called is
  declared as a stub (any object, "Called earlier in this conversation;
  not available now.") with tool_choice none, as LiteLLM's dummy tool
  and the Kiro plugin do.
- OpenAI Chat/Responses, ChatGPT backend, Gemini/Code Assist: take the
  history as it is; left as sent (TestUndeclaredHistoryToolTakenAsSent).
- Stricter Chat/Responses/Messages upstreams (relays in front of Kiro or
  Bedrock, vendors that check each call's name): a 400/422 that names an
  undeclared history tool as not found/unknown/not defined, or says tools
  must be defined beside the calls, is asked once more with a stub per
  missing tool, relayed or translated, and remembered per provider and
  API (historyToolsRefused). tool_choice none only where the client
  offered no tools. Namespaced Responses calls are left to the namespace.
- Claude subscription: runs real Claude Code with the history as text,
  not affected. Kiro plugin already stubs its history's tools.

Run, at 54874c9ee rebased on origin/main:
- the new tests and the gateway's ToolStrict/Anthropic tests: ok
- gofmt -l: clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean (before the rebase)
- go test -tags nogui ./... -timeout 45m was running at the pre-rebase
  commit when this was pushed (ship-immediately); its result goes on the
  tag's report.

Broken by hand, each red, then restored green:
- the refusal matcher off: RefusedThenStubbed (chat, responses,
  anthropic) and ToollessHistoryRefusedOnChat red
- the remembered upfront stubs off: RefusedThenStubbed red (3 asks)
- anthropicBody's stubs off: ToollessHistoryToAnthropicDeclaresStubs red
- the stubs' tool_choice none off: same test red ("tool_choice \"\"")

Not tried: no real vendor was asked (fakes only); the refusal wordings
for stricter vendors are modelled, not captured from the reporter, who
named no upstream; the other community plugins' own translators
(Cursor, Devin, Qoder, ...) were not read for this; real pi/T3 Code not
run against this build.
2026-10-24 20:11:06 +08:00
yetone b995095637 gui: a routing group's strategy is switched from its row (MoChou, #3450)
MoChou (#3450): changing a routing group's strategy took opening the
editor, finding the routing control, picking and saving. The routing
tag on each group row is now a pop-up button: it opens the app's own
menu (openProtoMenu, no native select) with the routings the editor
offers (GROUP_ROUTE_OPTS plus JS plugin routings), the current one
checked. Picking one saves the group through /api/groups/save with
every other field as it was, as the editor's Save would. Manual keeps
the pick the group had; with none the gateway takes the first member
(provider.cleanGroup), as with the editor. "Rate limited to the back"
is dropped when the new routing can't sink, as the editor does.
Re-picking the checked routing saves nothing; an editor with unsaved
changes asks first (confirmDiscard). The row's Edit button and switch
are unchanged; clicking the tag doesn't open the editor and doesn't
scroll. Keyboard: Enter/Space opens, arrows move, Escape closes back to
the tag, and focus returns to the same group's tag after the save
redraws the list. At <=560px in the window the row keeps only its
routing tag (the other tags stay hidden as before). New string "How
{name} routes: click to change it" in zh, zh-TW, ja, de.

Run (worktree; the new test, i18n-keys and internal/gui budget/i18n tests again at this head after rebasing on e698a688f, 22/22 ok):
- internal/gui/tests/routing-group-strategy.test.cjs (new): 18/18 ok,
  chromium + webkit; en/zh x light/dark, 520px window and 390px web,
  zh-TW/ja/de strings.
- Not the whole GUI suite: the machine sat at load 130-540 behind
  other sessions' suites for 2.5h. Ran every routing-*, i18n-*,
  plugin-* and gui-* file, both engines (1031 cases before I stopped
  it at load 500): reds only in routing-groups-jump (1 case, filed
  #3478; 3/3 alone), routing-intent-entry, routing-keys-fold,
  routing-levels, routing-manual, routing-mode-goes, routing-pause,
  routing-rule-effort, routing-rule-remove, all 5s timeouts or
  counts read early. routing-manual passed 4/4 rerun alone;
  routing-pause and routing-rule-remove fail the same way on an
  origin/main c819e00c4 copy at the same load (filed: #3410, #3411,
  #3408, #3096, #3094, #1612).
- go test -tags nogui ./internal/gui (core script budget): ok.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./..., gofmt -l, the three builds: clean.

Broken by hand, each red in the new test, then restored:
- origin/main's assets (MAGPIE_ROUTING_ASSETS): 18/18 fail ("the row's
  routing is a button", 0).
- keeping sink for Manual; dropping stopPropagation (the editor
  opened); dropping the focus restore; hiding every tag at narrow
  width.

Screenshots of the row and open menu, light and dark, en and zh, both
engines, checked by eye.

Not tried: the real app (WKWebView/WebKitGTK/WebView2) with real
groups; Windows; a JS plugin routing in the menu (only its code path
through withJS, which the editor shares).
2026-10-24 19:54:30 +08:00
yetone 137187a401 gateway: Claude Code's auto mode classifier follows a /model switch at once
CyberCaius on Discord: after switching models, the first auto mode
permission check went to the previous model. The model is Claude Code's
choice, not magpie's. Claude Code 2.1.310 ($Xe/BB) names
ANTHROPIC_DEFAULT_SONNET_MODEL for the classifier, not the session's
model. magpie's sonnet tier follows the main model only once Follow runs
(the GUI's state poll), and Claude Code reads env again only on its next
start. So right after /model the classifier named the old main model.

At the gateway, a classifier request (recognised from its body: a
<transcript> and a <block>/<severity> verdict, no tools) on a sonnet tier
that follows a main model settings.json no longer has goes to the tier
the new main model gives it (followAt, keeping the tier's effort). It is
left alone when the user set CLAUDE_CODE_AUTO_MODE_MODEL, when the sonnet
tier is their own, when the base URL isn't magpie's, or when the main
model hasn't moved. WSL distros are read the same way. Only the
classifier is rerouted: a turn naming the old model may be another open
session that is still on it. The haiku, opus and subagent siblings are
#3474.

Run (sandbox HOME; packages at 7edf5b0a3, then rebased on f35c721c4,
where the build, Windows build, Linux vet and the classifier, StandIn,
tier and Follow tests ran again: ok):
- TestAutoModeClassifierFollowsTheSwitchedModel (gateway) and
  TestClaudeClassifierFollowsTheSwitchedModel (agent): pass.
- go test -tags nogui -timeout 45m ./internal/agent ./internal/gateway
  ./internal/cli: ok (agent 787s, gateway 1191s, cli 129s, load ~450).
- gofmt -l clean; go vet, GOOS=linux go vet -tags nogui, GOOS=windows
  go vet on the three packages; go build, GOOS=linux -tags nogui,
  GOOS=windows: ok.

Broken by hand, each red then restored:
- classifierStandIn never rerouting: gateway test red ("went to m1").
- claudeClassifierIn returning "": agent test red at line 56.
- without the own-sonnet-tier check: red at line 84.
- without the CLAUDE_CODE_AUTO_MODE_MODEL check: red at line 67.

Not tried: real Claude Code doing a /model switch against this build. A
full ./... suite didn't run either: another session's full suite held the
machine, with several more queued behind it.
2026-10-24 19:47:12 +08:00
yetone e698a688fd gui: Insights › Masking shows each request as sent, what was masked and how
What masking did moves out of Settings › Privacy into a page of its own
under Insights (plugins/redact: client.js, page.js, redact.css, i18n.js).
Privacy keeps how it is found and what to mask, with a "What was masked"
row that opens the page.

- The top card is Privacy's card, made shorter: the flow animation
  (agents → this computer → providers) with magpie's bird on the centre
  line and "magpie masks it on this computer" under it, so a screenshot
  says who masked it; the count and a 7-day bar. Nothing the list repeats.
- The list: one row per masked request, narrowed by kind, by who found it
  (rules or the local model), by agent or provider, or to held-back
  requests; or by value, each with how often it was put back.
- A request: the message as it went to the vendor beside the original,
  each mask marked, unchanged parts folded; picking a value lights every
  place it was masked; a held-back request offers "Mask it instead".
- Gateway's masked badge and ?view=masking&key=N (trace.go's mainView)
  open one request.
- Classes are msk-: library.css owns mk- (a first cut stacked the flow).
- Budgets lowered to the core's size after the move.
- Not shown: rule names and the local model's confidence; the records
  don't keep them.

Run on f5b1d36ff (rebased since onto 344d11484, which only raised the
budgets and changed a dialog's centring and two unrelated files):
- masking-records.test.cjs: 32/32, Chromium and WebKit, 5 languages,
  1100px and 640px (card, list, filters, detail, put back, held back,
  Gateway badge, deep link, Settings row, no scroll on click), with
  key-import and i18n-keys: 48/48.
- go test ./internal/maskrec ./internal/redact ./plugins/redact
  ./internal/gui ./internal/provider: ok. TestCoreScriptBudget and
  TestMainView ok; gofmt -l clean.
- Before the rebase, on 628e18987: go test ./... -timeout 45m, every
  package ok; GOOS=linux go vet -tags nogui ./... and GOOS=windows go
  vet ./... clean.
- Budgets lowered to the sizes at the pushed head (app.js 1,317,486,
  core 1,524,789), ~26KB under what f35c721c4 raised them to after
  ce5b23cdb's add-key spinner put the core over.

Broken by hand: the bird's href (#bird → #nobird) turns masking-records
red.

Not run at this head when pushed: internal/gateway, which main's newer
commits touched (run right after; the result goes on the release).
Not tried: the whole GUI suite (hours long, and another session's runs
held the machine), the real Linux (WebKitGTK) and Windows apps.
2026-10-24 19:45:03 +08:00
yetone 51667a34c6 maskrec: records narrow by several kinds, by who found them, and to held-back requests
The Masking page's facets ask for a set of kinds (Secrets is API keys,
passwords, private keys...), for what found the values (rules or the
local model), and for the requests held back. Filter.Kind takes a comma
list, Filter.By and Filter.Blocked are new, and /api/masking/records
passes by= and blocked=1 through.

Run: go test ./internal/maskrec ./internal/gui -run 'Filter|Records|Masking|MainView|ShowMain' ok.
2026-10-24 19:41:03 +08:00
yetone 9b57261b62 masking: a record keeps its request as sent, how long masking took and what the answer put back
For the 观测 › 脱敏 page's request view. In memory only: the masked body
of the latest 100 requests (each up to 4MB, 64MB in all), and by
placeholder how many places of the answer had the value put back
(redact.Writer.Put, counted once per place even when a stream splits
the placeholder). Took (µs) is written to disk too; it holds nothing of
the request.

GET /api/masking/sent?key= gives the body, POST /api/masking/values the
values the masker still remembers, both no-store.

Run: go test ./internal/maskrec ./internal/redact ./internal/gui
-run TestMaskingRecordsAPI and ./internal/gateway -run TestMasked; ok.
Broken by hand: without toldBack, TestMaskedRecordKeepsSentAndBack is red.
2026-10-24 19:41:02 +08:00
yetone 344d11484e provider: Remove takes the account listed, by its slot, not a hidden one of the same name
dev (Discord) couldn't remove a ZCode account. The ZCode app's own
account had been removed in magpie (hidden), and a second one signed in
through magpie had the same name. Two things in the source caused it:

- editSideLogin matched the first saved entry by agent and name, hidden
  ones included, so Forget took the hidden "zcode" slot. It signed out
  the ZCode app's own account and left the listed zcode#l47q19 one.
- pluginLogins applied the own account's name (pluginOwnUser) after
  pluginLabels had added the slot suffix to tell same-name accounts
  apart, so both read "dev@z".

Now:
- pluginLabels applies the own names first and adds the suffix after,
  so the listed names are unique ("dev@z (l47q19)").
- Forget, Switch and On/Off resolve the name against the accounts as
  listed, then edit that saved entry by its slot (Home) or own-ness
  (listedMatch/sameSaved). editSideLogin, which the other callers use
  (chatgpt_api, copilot_lapsed, google, signin_revoked), prefers a shown
  entry over a hidden one of the same name.
- A saved id doesn't help here: it is made from the name, so both
  accounts had the same id (66dbee89c5d33fcd).

Existing data: an account whose name collided with another one is shown
with its slot suffix from the next read on. Nothing is rewritten.

Run:
- go test -tags nogui -timeout 45m ./... in a sandbox HOME: ok, every
  package, at 7edf5b0a3 plus this change.
- gofmt -l is clean; go vet ./..., GOOS=linux go vet -tags nogui ./...
  and GOOS=windows go vet ./... pass; go build for darwin, linux (nogui)
  and windows pass.
- Sandbox repro with real binaries built from origin/main and from this
  change, a sandbox HOME seeded with dev's layout (the hidden zcode slot
  and zcode#l47q19, both dev@z), and the real Bun plugin host, using
  `magpie accounts zcode` and `magpie accounts forget zcode <name>`:
  - old: listed as "dev@z", and forget left plugin-auth with only
    zcode#l47q19 (the wrong one signed out);
  - new: listed as "dev@z (l47q19)", and forget left plugin-auth with
    only zcode and logins.json with the hidden zcode entry.

Broken by hand: the three new tests in same_name_login_test.go fail on
the old code:
- TestRemoveListedAccountLeavesHiddenNamesake: "the account removed is
  still signed in", "the hidden ZCode app's account was signed out in
  its place";
- TestPluginOwnNameKeepsSlotApart: "accounts *dev@z (own),dev@z";
- TestForgetSideLoginTakesTheListedOne: "left [own hidden, magpie's]".

Not tried:
- a real ZCode account;
- clicking Remove in the GUI. The GUI sends {agent, user} as before,
  and the server now resolves it by slot;
- Copilot and Google. Their lists carry no saved entry, so they get the
  prefer-shown fallback only.
2026-10-24 19:40:14 +08:00
yetone f35c721c48 gui: a dialog stays centred while its content comes in, until it is pressed
The owner (10-24): a plugin's page opened low, not in the middle. It
opens short, with a skeleton, and its README comes after; holdModal held
the top the skeleton had put it at, so the dialog grew down to the
window's foot and sat low.

Until the reader's first press or key in it, holdModal now keeps the
dialog centred over what it holds, measured by its layout height
(content that comes during the open's morph was read under its scale).
From the first pointerdown or keydown it holds its place as before, so
what is under the pointer doesn't move.

Run (darwin, chromium and webkit, logs kept whole):
- modal-centred-late (new): 6/6 ok, 3 runs in a row; on the old app.js
  red at "centred after the README came" (bottom gap 0, top 181.5).
- The 112 GUI files that use #modal: started, not finished at the push;
  the owner asked to release without waiting. Reds it finds get their
  own commits.
TestCoreScriptBudget: main was already 208 bytes over the core budget
(f5b1d36ff's refresh and ce5b23cdb's spinner, each checked alone); with
this change's ~1.1KB both budgets are raised to the exact sizes, with no
room added. go test ./internal/gui -run Budget: ok.
Not tried: the real Wails app; Windows and Linux webviews.
2026-10-24 19:34:34 +08:00
yetone c819e00c4e routing: a ClinePass route reads as its route, with what was asked for (zRain)
zRain (Discord #feedback, 10-24; magpie 0.1.1377, Windows, Codex CLI
0.164.0) asked clinepass/cline-pass/deepseek-v4.1-flash-1017 from Codex
(/backend-api/codex/responses -> /v1/chat/completions, 200). The reply
named vmc/deepseek-v4p1-flash-1017-contributor-fallbacks. Routing showed
"served vmc/..." titled "likely another model", with no upstream.

What was found:
- The pin goes out on Codex's Responses path the same as on a Chat
  client's. The test below checks the sent body on both paths. The
  built-in ClinePass pins only with "DeepSeek and GLM models only from
  their makers' own APIs" ticked. The Cline plugin pins Pass DeepSeek by
  default. zRain's id is the built-in, so with the tick off nothing asked
  for DeepSeek.
- upstreamOf reads finalProvider from choices[].delta/message
  provider_metadata on every path (Codex streamed, chat streamed,
  Responses streamed and not). zRain's rows had none, so the reply most
  likely carried none there. canonicalSlug is not recorded; left alone.
- The contributor-fallbacks name is ClinePass's own route. Its name does
  not mean another model.

Change:
- provider.ClinePassAsked: the upstream a request asks the Cline API for
  (ClinePin with the tick, or deepseek on the plugin's provider).
- Try.Pin records it on the answering try.
- Routing: a cline-pass/ model served as vmc/... is tagged "ClinePass
  route ...". Its title and story say it is the route's name, not another
  model's, and then one of:
  - who answered, when the reply said;
  - that the asked provider wasn't confirmed;
  - that nothing was asked, naming the tick for DeepSeek/GLM.
- The Usage page's Requests title says the route too, without the pin it
  doesn't keep.
- Strings in zh, zh-TW, ja and de.

What was run (rebased on origin/main 7edf5b0a3):
- TestClinePassAsked (provider) and TestClinePassTryKeepsWhatWasAsked
  (gateway: chat and responses, tick on/off, sent body and try pin).
- Broken by hand: the try literal without Pin, and the tick-on cases go
  red ("try pin \"\" (want \"deepseek\")").
- go test -count=1 ./internal/provider in a sandbox HOME: ok (280s).
- ./internal/gateway -run 'Cline|Upstream|Swap|Served|Try|Trace|Route':
  ok.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows on gateway
  and provider.
- go test -run 'Budget|I18n|Strings|Plugin' ./internal/gui: ok.
- GUI: routing-cline-route.test.cjs, new, Chromium+WebKit, en+zh, every
  string in all 4 languages. Pointed at the old assets
  (MAGPIE_ROUTE_ASSETS): 4 of 4 red. Now 4 of 4 green.
- GUI: every routing-*, usage-* and gui-* file, plus i18n-keys,
  panel-routing, remote-group-served and session-identity, at
  concurrency 3, load ~110. Reds: routing-held-dot (WebKit zh 560px,
  timeout; passes alone at the rebased head) and routing-intent-entry
  "Add a rule makes a rule by intent" (also red on origin/main 117937b8d
  in WebKit alone: #3408).

Not tried:
- No real ClinePass account. The raw bytes of a contributor-fallbacks
  reply are unseen, so whether ClinePass puts finalProvider elsewhere for
  that route is unknown. No parser change was made without them.
- Full go test ./... was not run: the machine is at load ~110 with other
  sessions' suites.
- Not run on the Windows box.
2026-10-24 19:21:02 +08:00
yetone f5b1d36ffa usage: a card's refresh opens after its "Refreshed just now", so the text never moves
The owner: on hovering a usage card, the refresh icon appearing pushed
"刚刚刷新" right each time. The icon opened from width 0 in front of the
text, so the text moved by the icon's width on every hover.

The refresh button now comes after the text in every place quotaRefresh
is put (the read-when line, a panel row's name, the panel's error line,
both panel sub lines, and a failed window's line after its fix button),
and opens rightward into the card's padding: open, it is 14px with a
-2px right margin, so the text before it stays where it was. A panel
row's name ellipsizes rather than being pushed.

Run (darwin, chromium and webkit, logs kept whole):
- usage-card-refresh, panel-quota-refresh, quota-curve,
  quota-balance-error, usage-remote-key-limits, usage-remote-cards:
  144/144 ok
- quota-refresh-order, usage-refresh, i18n-keys: 17/17 ok
usage-card-refresh's hover check now asserts the text's rects don't
move when the icon opens and that the icon sits after the last of them;
on the old code it fails at the text moving.
Not tried: the real Wails app; the Windows and Linux webviews.
2026-10-24 19:19:24 +08:00
yetone ce5b23cdb4 gui: adding a key shows a spinner and Adding… until it is done; the name field is narrower
The owner, on the provider editor's add-key row: a key's Add (one key,
and Paste several's) only faded while the gateway checked the key with
its provider, which can take seconds, so nothing seemed to happen. It
now goes through saving(), the editor Save's spinner and "Adding…",
takes Enter once while it runs, and gives its label back when the key is
refused. The name field, only for telling keys apart, takes 1/3 of the
row instead of 2/5.

Run:
- key-import.test.cjs, new case: spinner, aria-busy and Adding… while
  keys/add is held, a second Enter posts nothing, a refusal puts Add
  back and keeps the row, the name field narrower than the key's.
  12/12, Chromium and WebKit, en and zh, at load 510.
- The GUI files on the key list, provider editor and accounts
  (key*, provider-*, account-*, zen-anon-key, gateway-own-key,
  api-key-usage, keep-login, lane-limit, i18n-keys) in both engines.
  Four reds at load ~190: the new case (a click over the file's 5s; the
  file now allows 15s) and key-replace (420px, twice) and
  provider-advanced-fold, files this change doesn't touch; checked
  against origin/main after this push.
- go test ./internal/gui -run Budget ok.

Broken by hand: old app.js turns the new case red (Add, not Adding…);
old app.css too (name 180px beside a 269px key). An injected 3.5s delay
before the first post turned the case red through its 3s wait; it now
waits for the posts it expects.

Not tried: the real Linux and Windows apps, the whole GUI suite.
2026-10-24 19:11:47 +08:00
yetone 48194bbee0 routing: an In order group's later members aren't said to go after a known allowance (bitssly on X)
bitssly on X (10-24) asked why, with a group set 按顺序 (In order), an
account whose quota isn't known "can't be used", quoting the Routing
page: "opencode:剩余额度未知,排在已知的之后。" and "腾讯-国际:剩余额度未知,
排在已知的之后。"

Cause: the gateway does what the mode says. planGroup/planLevel try an
In order group's members in the order given and never by what each has
left; each member's own accounts go as that member's provider routes
them (Smart by default, where an unknown allowance still comes before
any account at 90% or more and is tried when the known ones fail). The
explanation was wrong. weighed() gives an ordered group's rows their
member's routing (""), so the page's smart() judged each row against
every known row of the whole request: an In order group's later
members read as ranked behind a known allowance, and the first got a
Smart reason ("its allowance renews soonest ...") instead of In order.
A By weight group's first had the same fault.

Change:
- client.js: placeRouting/wholeMembers/weighedWith scope what a row is
  weighed against to its own member when the level that placed it takes
  members whole (order, weight). firstWhy says "In order: {who} is
  first ..." for such a group, and "By weight: it's {who}'s share ..."
  for a weighted one; the unknown, learns, spent and low asides are said
  only of an account weighed against another of its own member. Rebased
  onto 6d707af08 (Creat.wu, memberSplit): its member line now asks the
  scoped someKnown(x), so an unknown account alone in its member gets no
  line at all, and one beside a known account of its own member gets
  6d707af08's one line for the member.
- i18n.js: the By weight line in zh, zh-TW, ja, de.
- routing-order-unknown.test.cjs: In order, Smart and By weight groups
  over Codex (known), OpenCode Zen Free "opencode" (unknown) and two
  WorkBuddy AI accounts (one known, "腾讯-国际" unknown); chromium and
  webkit, en/zh/zh-TW/ja/de, 1100 and 420 wide.
- docs/reference.md: Smart's unknown account is still tried when the
  known ones fail; an In order group keeps its order whatever is known.

Why the quotas are unknown: OpenCode Zen Free is a free tier with no
allowance to report. Tencent Cloud Token Plan and Volcengine access-key
plans are read for the Usage page but not for routing; that class is
#3251. No plugin change.

Run:
- old client.js with the new test: red on the why line (chromium en/zh
  1100: "c@x.test goes first: of those with quota to spare, its allowance
  renews soonest ..." where "In order: c@x.test is first ..." was due).
- at the rebased head (origin/main 1f8f80e4a plus this):
  routing-order-unknown, routing-weight-member-low and i18n-* 64/64.
- go test -timeout 45m ./internal/gui/... at the rebased head: ok but
  TestMainWindowCorners (killed measuring windows at load ~80; red alone
  too; #1936, #2645, AppKit, not this change). Before the rebase: ok
  (112s).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: clean. No Go file changed, so gofmt has nothing to check.
- whole GUI suite at ab287a839 (before the rebase), concurrency 4, load
  50 to 80: files a* to roughly o* ran; reds, all outside routing and
  filed: api-key-theme chromium system (#3307, also 1 of 3 alone),
  fonts webkit narrow (#3227), library-mcp-health-wsl ja (#3350),
  menu-input-scroll chromium en/zh (#3402). The rest of that run is void:
  my own rebase put conflict markers in client.js mid-run. The files from
  n* on are run again at the pushed head after this push.

Broken by hand: someKnown made global again (the old aside scoping):
red, the opencode aside is back under the In order group.

Not tried: the reporter's own trace and accounts (not shared); a Go
test for the gateway's order (unchanged here, covered by the existing
fallback tests); routing reading the access-key plans (#3251).
2026-10-24 19:09:41 +08:00
yetone 117937b8d9 sessions: every agent in the Agent menu and in Continue in shows its icon
The Sessions page's agent picker showed the chosen agent's icon on its
button, but the menu it opened listed bare names. Each item now carries
its icon between the tick and the name, level with the name; the
"Continue in another agent" menu does the same. The icons are drawn by
the sessions plugin after the menu opens, so the core scripts stay
within TestCoreScriptBudget (a first try in openProtoMenu went 116
bytes over).

Run: sessions-toolbar and sessions-talk GUI tests, chromium and webkit,
en and zh, light and dark: 8 pass. Broken by hand (no icons drawn):
sessions-toolbar red in chromium, "every agent in the menu has its
icon". go test ./internal/gui/ -run 'TestCoreScriptBudget|Plugin' ok.
Looked at the webkit zh dark menu screenshot.
Not run: the whole GUI suite (load ~380 on this machine).
2026-10-24 19:02:50 +08:00
yetone 7edf5b0a3d gui: the context window is a map of tiles by default, the block grid a switch away
After flohoeller's "Context map" on X. The Context window card (Usage ›
Context, and Routing's request card) drew its window as 400 cells. It now
draws it as a map:
- Each item is a tile sized by its tokens, inside its part's area
  (squarified, parts in their usual order).
- The tile has a soft fill of its part's colour, its name, and
  "tokens · part".
- The free space is a hatched tile that names its share.
- The used share is drawn on a gentle curve (share^0.35), so a window
  8% full still has tiles to read. The free tile states the real share.

Small items:
- Items too small to read go in one "{n} more" tile.
- A part whose items would leave a strip thinner than 14px is one tile.
- No tile is laid under 700px².

Hover and click:
- A hovered tile tells its item, part, tokens and share (a part's tile
  lists its largest five) and dims the others.
- A row or the legend lights its tiles.
- A clicked tile opens its text, as a cell does.

Motion:
- Tiles come in with a short stagger (opacity, scale .94, blur), over
  560ms with the iOS ease.
- A live update keeps the same nodes and glides them to their new rects.
- Tiles that are gone fade out.
- With motion reduced, or on a still pane, nothing moves.

The block grid is kept. A small segmented switch at the end of the legend
(Context map / Block grid) picks the look for every card, remembered in
localStorage magpie.ctxLook. The card eases to the other look's height.
The new look is the default, and the old one stays one click away (UI
restraint, owner's ask).

The text view shows an image the request sent inline (the gateway's Src,
previous commit), where it said "An image: magpie doesn't show it here".
It fades in, and a click opens it larger with a FLIP scale. An image with
no Src, or one that fails to load, keeps the old note.

Words: "Context map" and "Block grid" in zh, zh-TW, ja and de.

The core budget goes to 1,549,478, the new size with no room added:
context.js is drawn by the Routing page as well as Usage, so it is the
core's own (+14.4KB).

Tests:
- Seven existing tests read the grid's cells. They now pin
  magpie.ctxLook=grid.
- New context-map.test.cjs, in both engines, en/zh/zh-TW/ja/de, at
  1100 and 420px:
  - The map is the default, with a free tile.
  - Every tile is inside the map, none overlap, and none is a sliver.
  - Hover gives the tip and dims the others.
  - A refresh keeps the nodes.
  - A click opens the text.
  - An inline image loads (naturalWidth 2) and opens larger. One without
    Src is named.
  - The switch to the grid survives a reload, and the map comes back.
  - With motion reduced, nothing animates.

Run at this head (rebased on 1f8f80e4a):
- context-map, i18n-keys, context-window, context-text, held-animations,
  routing-live-patch, routing-ctx-fold, routing-ctx-still and
  routing-context-fold, Chromium and WebKit: 130 pass, 0 fail.
- go test ./internal/gui/: ok (TestCoreScriptBudget at the new budget).
- gofmt -l internal/: nothing. go vet: ok, with GOOS=linux -tags nogui and
  GOOS=windows.

Broken by hand, each red in context-map.test.cjs (restored after each):
- pieceView never showing the picture.
- The grid as the default.
- The thin-strip rule removed ("two tiles overlap").
- drawMap ignoring calm() (the reduced-motion test).

Looked at: screenshots in light and dark at 1100 and 420px, at 8% and 90%
full.

Not run: the whole GUI suite (it runs after the push), and the real Linux
app (WebKitGTK).
2026-10-24 18:40:01 +08:00
yetone 069bf0583b gateway: a prompt's inline image comes to the text view as a picture it can show
The Context window's text view said "An image: magpie doesn't show it here"
for every image a request carried. The gateway now reads the image's
source as the request sent it (Anthropic's base64 source, a Responses
input_image's image_url, a Chat image_url, Gemini's inlineData) into
PromptPiece.Src, from the same masked bodies kept in memory as the text.

Only a data: URL of PNG, JPEG, GIF or WebP whose payload is base64 is
given: a remote URL (Gemini fileData, an http image_url) or anything else
(svg, a data URL with markup in it) stays "", so the view never fetches
from anywhere and never renders markup. Src is read out only when the
text is asked for (read()), like the text itself.

Run:
- go test ./internal/gateway/ -run PromptText: ok.
  TestPromptTextImagesArePictures sends each protocol's image and checks
  its Src, and that a URL source, an svg, a data URL with <script> and
  Gemini's fileData come back "".
- Broken by hand: read() setting pc.Src = "" turns the test red; restored,
  green.
- gofmt -l internal/: nothing. go vet ./internal/gateway/,
  GOOS=linux and GOOS=windows: ok.
Not tried: a real Claude Code or Codex session's image through a live
gateway (the GUI side is covered by context-map.test.cjs with a fixture).
2026-10-24 18:29:53 +08:00
yetone 1f8f80e4af provider: Kiro's mover min is 0.1.16 (cache unknown, not 0)
opencode-kiro-auth 0.1.16 (plugins 9f6c4e8) says magpie_cache_unknown
when Kiro gives no token counts. Before, it reported cache_read 0, which
the Routing page showed as 0% (zeewell on X). keepMovedCurrent brings
every moved Kiro user up to it.

`npm view @magpie-community/opencode-kiro-auth version --prefer-online`
gives 0.1.16 at landing. Its publish run is red only on the known
think-tags E404 (plugins#180); the run's log has
"+ @magpie-community/opencode-kiro-auth@0.1.16".

Run at this head (origin/main 628e18987 + the routing commit): gofmt and go vet (darwin, linux, windows) clean;
go test -timeout 45m ./internal/provider ./internal/gateway: ok, ok.
2026-10-24 18:16:17 +08:00
yetone 436bcc946d routing: a request whose vendor counts no cache tokens shows no hit rate, not 0% (zeewell on X)
zeewell on X: every Kiro request in a routing group showed cache 0%, for
claude-sonnet-5.5 and claude-opus-5.5 from Claude Code, with 148k to
182k tokens and consecutive calls.

The cause, from real Kiro calls on the owner's account (read-only, from
a sandbox): Kiro does cache. A repeated 900-line prefix cost 0.0912
credits and then 0.0484, with or without cachePoints, and with a fixed
conversationId too. But Kiro's reply holds only assistantResponseEvent,
metadataEvent {stopReason}, contextUsageEvent (a percent) and
meteringEvent (credits). There are no token counts at all, and
kiro-cli 2.32's own trace shows the same. The plugin wrote
cache_read_input_tokens: 0, which magpie showed as 0%.

opencode-kiro-auth 0.1.16 (plugins 9f6c4e8) now leaves the cache fields
out and says `magpie_cache_unknown: true`. This commit reads that field:
- aUsage reads it into Usage.cacheUnknown, ORed in Usage.add.
- routeUsage sets RouteUsage.CacheUnknown (cache_unknown, omitempty) on
  a try that counted no cache read or write.
- The Routing page's promptOf leaves such a try out of the hit rate. The
  row and its session then show no Cache metric, as for older history.

Clients are never told the field. Usage.anthropic() leaves it out, and
a passthrough forwards the plugin's bytes as they came. The gateway
already relays cache_control to an Anthropic-protocol plugin as Claude
Code sent it, so nothing was lost on the way to Kiro.

Left alone: the usage ledger. usage.Record has no such flag, so the
Usage page's aggregate hit rate still counts a Kiro prompt as a miss.
Filed as #3464.

Run at this head (rebased on origin/main 628e18987):
- gofmt -l internal/gateway internal/provider: clean.
- go vet ./internal/gateway ./internal/provider: clean on darwin, with
  GOOS=linux and with GOOS=windows.
- go test -timeout 45m ./internal/gateway ./internal/provider: ok, ok
  (465s, 126s).
- go test ./internal/gui -run Budget: ok.
- GUI: routing-request-metrics.test.cjs, chromium and webkit, en and zh:
  4 of 4 pass.
- Every routing-*.test.cjs, one base back, at load 130 to 150: the only
  reds were routing-intent-entry, routing-keys-fold and routing-manual.
  Run alone, those three files also go red on a fresh origin/main
  628e18987 worktree (8 reds there, 5 on this branch). They are already
  filed: #3408, #1612 and #3409. This change touches only promptOf's
  cache_unknown rows, which none of their fixtures have.

Broken by hand:
- With aUsage.usage() not carrying the field, TestCacheUnknownReachesTheRoute
  fails in its four Kiro cases (Claude Code whole and streamed, translated
  whole and streamed). The counted-miss case still passes, at 0%.
- With promptOf's skip removed, the GUI test fails in chromium for en and
  zh: "a vendor that counts no cache tokens has no hit rate, not 0%".

The test fixtures are the plugin's real reply bytes from Kiro, captured
10-24.

Not tried: a magpie build running the 0.1.16 plugin against Kiro from the
GUI. The plugin's own end-to-end run against Kiro gave
{"input_tokens":0,"output_tokens":19,"magpie_cache_unknown":true}.
2026-10-24 18:16:17 +08:00
yetone 628e18987b gui: Settings › Privacy puts the local model first, marked New
The owner asked for "Find with a local model" to come earlier on
Settings › Privacy, where people see it at once, with a light mark.

"How it's found" (#findList) moves from below the try box to right
under the masking card, before "What to mask", and its first row is
the local model, then Rules. The model's name carries a small accent
"New" badge (.badge.new: accent-soft background, accent text; en New,
zh/zh-TW 新, ja 新着, de Neu). app.js stays inside its budget with no
raise (1,343,322 of 1,343,324): comments were trimmed to fit.

Tests: privacy-model checks the badge in every language, that the
model's row is the page's first settings row, and that #findList comes
before #redactList. redact-rule-row and redact-words-any-case wheel
their row into view first (wheelTo, reach): with the section above
them, at 640px their row sat under the bar along the page's foot, and
the second control under the sticky tabs in WebKit.

Run at 35c648593 (on 616c87256), both engines:
- go test ./internal/gui: ok
- GUI: account-discovery, account-mask-sessions, account-mask,
  click-scroll, i18n-keys, mask-actions, mask-emails, masking-records,
  privacy-hides-accounts, privacy-model, privacy-usage-stats,
  provider-unmasked, redact-kinds, redact-rule-edit, redact-rule-row,
  redact-words-any-case, settings-search, settings-sections,
  sidebar-glide, sidebar-overlay-scrollbar, sidebar-tab-top, sidebar:
  all pass
- Screenshots in zh, light and dark, 1100 and 640, Chromium and WebKit.
Rebased on ef37b6fb7: go test
./internal/gui -run 'Budget|I18n|Key', i18n-keys, privacy-model and
redact-rule-row pass again (and redact-words-any-case).
Broken by hand: with the old index.html order, privacy-model is 11 of
12 red in Chromium.
Not tried: the real Linux and Windows apps, the whole GUI suite.
2026-10-24 17:50:20 +08:00
yetone 56b90893f7 provider: Command Code's mover asks for commandcode 0.1.16 and Qoder's for qoder 0.2.33, so no request names magpie (plugins #352, #354)
commandcode 0.1.16 sends the Go catalog with Node fetch's own User-Agent
and /alpha/generate with the working folder's slug, as command-code
1.88.0 does, where both said "magpie". qoder 0.2.33 names a task with
the prompt's first ten characters, as Qoder.app 0.4.3 does, not "magpie
session". keepMovedCurrent brings every moved user up to them.

Both versions checked with npm view --prefer-online at landing:
opencode-commandcode-auth 0.1.16, opencode-qoder-auth 0.2.33.

Run at this tree (base origin/main ef37b6fb7):
- gofmt -l internal/provider/: nothing
- GOOS=darwin|linux|windows go vet ./internal/provider/: ok
- go test -timeout 45m ./internal/provider/: ok (106s), log kept whole

Live (in the plugins repo, sandbox HOME): commandcode against the owner's
GOAT key and qoder against the owner's Qoder account, 0 recorded
requests naming magpie.
2026-10-24 17:47:21 +08:00
yetone a6002ef0e6 site: APIKEY.FAN is a partner in the Add sheet
APIKEY.FAN took an in-app seat. The partner "apikeyfan" serves Chat
Completions, Responses and Anthropic Messages at api.apikey.fan (region
"Default") and at its direct line slb.apikey.fan (region "Direct"); both
region names already have zh, zh-TW, ja and de strings. Its key page and
website are its aff=magpie link. It asked to be shown in Chinese and
English, so langs is ["zh", "en"] (zh-TW is listed through "zh"), with a
tagline in en, zh and zh-TW. Listed from 10-24, no end set yet. The icon
is their square logo at 128px (12.7KB PNG).

Run: node --test site/*.test.mjs (30 of 30 ok). The served feed
(worker.js served() over partners.js) parsed with partnerFeed and passed
checkPartner and validPartners in a throwaway test in internal/provider:
both partners kept, apikeyfan's links /go ones. Against the real service
with the test keys it sent: /v1/models, Messages (plain and streamed),
Responses and Chat Completions each answered "OK" on both hosts.
Not tried: adding it from the app's Add sheet; the balance endpoint it
sent (/v1/usage) has no place in a partner entry.
2026-10-24 17:46:11 +08:00
yetone ef37b6fb76 gateway: an exhausted ChatGPT account no longer greys Codex app's Send while magpie can serve the turn (MasterYi on Discord)
MasterYi (#help, 1563467829687222343): with magpie wired into the Codex
app, a used-up ChatGPT account greys the Send button, so the third-party
models joined in Codex's picker can't be used either.

Cause, as far as the app's bundled code (ChatGPT.app 26.1013.40934,
read-only) shows: Send is gated in the app itself. It needs
authMethod == "chatgpt", the /wham/usage reading (fetched by the app
straight from chatgpt.com, not through magpie) saying not allowed, and
no credits. authMethod is read as the app opens or on account/updated,
which the app-server sends only on login/logout, not on a config change.
So the gate lifts only when model_provider is magpie AND the app has been
opened again. #540 already made magpie the provider while out, but only
when a magpie model was the default; on one of Codex's own models
(joined), nothing changed.

What changed:
- A (agent/codex.go Sync): joined on one of Codex's own models and the
  account out (not Always ChatGPT, not magpie API), magpie becomes the
  provider on that model as magpie serves it (codex/<model>), the model
  kept in codex.out_own. Once the account has room, Codex is put back
  joined on that model. A model picked meanwhile stays the user's. With
  no ChatGPT account in magpie to serve it, nothing changes. New
  Agent.AppOut says magpie is the provider for a used-up sign-in.
- C (provider/codex_app_out.go): a usage_limit_reached rest on the
  active Codex account (gateway routing) or an x-codex-* window heard at
  100% (NoteCodexLimits) has the account read again at once
  (CodexMayBeUsedUp: active account only, at most every 20s, only
  while a KeepOnAnAccountWithRoom loop has made its first reading and
  still runs), not only on the 5-minute look. A first cut turned this
  on for good as the loop started; every gateway test's Serve starts
  it, so later gateway tests had accounts read again behind them, and
  TestCodexOwnModelMovesToNextAccount and
  TestCodexSpentMovesToNextGroupMember went red in the package run
  (green alone 3 of 3). Now a counter, up after the first minute's
  reading, down as the loop ends; the package run is green with it.
- B (gui/codex_app_out.go): the app open when the account ran out is kept
  by its app-server's pid (provider.CodexAppOut; a new pid means it
  reopened and read the provider, standing in for "authMethod is still
  chatgpt"). On macOS, every 10s, magpie reopens it through the Agents
  row's ReopenCodexApp when: AppOut, the account still out, the app is a
  copy from before the config change, no turn in flight through the
  gateway and none ended in the last 30s. At most once per time the
  account runs out, success or not.
  Drafts: the app's code keeps composer drafts in a persisted store
  (composer-prompt-drafts-v2, 250ms debounce, flushed on quit), and
  threads are server-side, so an unsent draft and open threads should
  survive the quit. Not watched in a real app.
- D (GUI): Codex's accounts say "The Codex app can't send on {user}'s
  used-up account": on macOS that magpie reopens it once no turn runs;
  off macOS (no reopen path) or once tried, to quit and reopen it.
  en, zh, zh-TW, ja, de.

Tests (each red on the code without its part, broken by hand):
- TestCodexOwnModelGoesThroughMagpieWhileUsedUp: red at "used up" with
  the out case off, at "allowance back" with the restore off.
  TestCodexOwnModelKeptOnChatGPT: Always ChatGPT stays.
- TestCodexMayBeUsedUpReadsAtOnce: red at "a window full: not read"
  with the NoteCodexLimits hook off. TestCodexAppOutEpisode.
- TestCodexUsedUpReplyAsksAtOnce (gateway): red, asked [], with the
  routing hook off.
- TestCodexAppOutReopenedOnce (gui, reopen stubbed): red at "a turn in
  flight" with the idle check off, and at "again" with the once checks
  off.
- codex-app-out.test.cjs: 40 of 40 (chromium, webkit; 900/480; five
  languages; both texts); 2 of 2 red with the notice's call site off.

What was run, at this tree:
- gofmt -l: none. go vet ./... (darwin), GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./...: exit 0.
- go test -tags nogui -timeout 45m: internal/agent ok (414s, before a
  comment-only reorder in Sync); internal/gateway ok (534s),
  internal/gui ok (78s), internal/provider ok (137s), after the
  live-check fix, at this tree before the previous commit's JS-only
  move (then with a budget raise since taken back); internal/gui
  again after the move.
- GUI (chromium, webkit), at this tree: codex-app-out, codex-app-stale,
  i18n-keys, gui-de, gui-ja, gui-zh-tw and the files reaching the
  previous commit's move: 164 of 164. Before the trim, every codex-*
  and account-* file: 447 of 448; the red, codex-predictions chromium
  ja 420 "picking a model scrolled the page", is #2624 and is red alone
  on origin/main 5a85a2a91 too (1 of 2); one codex-app-out case timed
  out launching chromium at load ~100 and passed on the rerun.
- TestCoreScriptBudget with the budgets unchanged: ok. The three Codex
  notices now share one box builder (codexNote), and the previous
  commit moved ledSaid out of app.js.

Not tried:
- No real Codex app was quit or reopened (the owner's live app is left
  alone); the reopen path is stubbed. Whether the reopened app's Send
  comes back, and whether a draft survives, is from reading its code.
- No real used-up account; the move was run in a sandbox HOME.
- The full suite: no suite lock on this machine, load ~75.
- A gateway served by another magpie process: the episode lives in the
  process that serves the gateway, so a GUI that doesn't serve it never
  reopens the app or shows the notice.
2026-10-24 17:38:50 +08:00
yetone 7dd69d6e70 gui: a conversation's said-part (ledSaid) moves from app.js to the Usage page's script
app.js is at its budget (1,343,323 of 1,343,324 on origin/main
5a85a2a91), and the next commit, the Codex app's used-up notice
(MasterYi on Discord), adds ~650 bytes to it. The budget is not raised
(#2710); this moves code out instead, as 34ad18ed8 did.

What moved: ledExpanded, LED_KINDS, LED_ROLES and ledSaid, unchanged,
from app.js into plugins/usage/page.js beside viaText (1,803 bytes).
Nothing in app.js or the other core scripts calls them. Their callers
are plugins/usage/page.js (the Requests ledger's content) and
plugins/sessions/client.js (a session's conversation), which calls
ledSaid only in its render after a fetch, after page.js has loaded
(index.html loads page.js after app.js and before start.js). Their
words stay in i18n.js.

What was run, at this tree plus the next commit:
- go test -tags nogui ./internal/gui: ok (TestCoreScriptBudget with
  the budgets unchanged).
- GUI (chromium, webkit): gateway-conversations, sessions-subagents,
  sessions-talk, sessions-talk-model, usage-ledger-content, i18n-keys,
  plus the next commit's files: 164 of 164.
2026-10-24 17:38:50 +08:00
yetone 6d707af083 routing: a member behind another by weight or order isn't told as kept for last (Creat.wu)
Creat.wu on Discord (#general, 10-24): in a group routed by weight, a
sub-group whose accounts are all near their limit "is skipped however
high its weight". The screenshot is the Routing page's line
"<account> 已用 91%,其他账号都无法响应时才用。"

Cause: the routing itself already gives such a member its share.
weightedUnits leaves a unit out of the round only when its head is
resting; Smart's 90% band orders accounts inside the sub-group and
nothing in the parent reads it. A sandbox probe with the reporter's
shape (parent weighted, group/sb:4 with two Codex accounts at 91% and
92%, a key at 1) sent 16 of 20 new conversations to the sub-group and 4
to the key. What was wrong is the explanation. On a request whose turn
went to the key, the sub-group's accounts are listed after it, and the
page's asides (client.js) said of each one "used 91%, kept for when the
others can't", which reads as the member being passed over.

Change:
- client.js: memberSplit finds where a later account parts from the
  first one in the group tree. When that level is routed by weight (the
  first has the round's turn) or by order (no affinity kept, no rule),
  a low or not-yet-known account there gets one line per member instead:
  "{member} isn't passed over for being near its limit: by weight this
  request was {first}'s share, and {member} takes its own share of the
  requests while it can answer." or "... it comes after {first} in
  {group}'s order." Spent and resting lines are unchanged, and inside a
  Smart sub-group the low line stays, since the band does order those
  accounts.
- i18n.js: both strings in zh, zh-TW, ja and de.
- weighted_low_test.go: TestWeightedGroupGivesALowGroupItsShare holds
  the share (16/4 over 20, only the account with most left inside, and
  the sub-group's accounts behind the key not resting).
- routing-weight-member-low.test.cjs: weight, inner-Smart, order and
  plain Smart scenes, chromium and webkit, every language.
- gateway-routing.md: the weighted sentence says a unit near its limit
  keeps its share, and points at memberSplit.

Siblings: Smart, usage and pace parents weigh a nested group by its
head, so a low head goes later there by design and its line stays.
Manual picks a member and sorts the rest smartly (line stays). Rotate
is account-level.

Run (worktree at origin/main 7d9165d84; rebased on c30af359b, which changes
nothing under the routing plugin, weighted.go or fallback.go, and run
again there: go test ./internal/gui (budgets) ok, the new Go test ok,
routing-weight-member-low and i18n-keys 44/44):
- the new Go test -count=3 with the weighted tests: ok
- go test ./internal/gui/...: ok (112s)
- node --test routing-*, i18n-*, group-member-weight GUI files, both
  engines, all languages, at load 40 to 110: 1227 of 1285 pass. The 58
  reds are in the rule editor and manual and steady files
  (routing-pause, -rule-effort, -rule-remove, -intent-entry, -manual,
  -steady, -time, -rules-line, -busy-frames), all click timeouts.
  busy-frames and rules-line pass when rerun one at a time. The rest are
  red the same way on a clean origin/main 5a85a2a91 worktree, and are
  filed: #3408, #3409, #3410, #3411, #3412, #3094, #3096, and #3465
  (routing-time, new). routing-weight-member-low: 40/40.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./...: clean; gofmt -l on the changed files: clean
- go test ./internal/gateway/... -timeout 45m: ok (408s)

Broken by hand:
- weightedUnits with `|| heads[i].p.Account != nil` added to the skip:
  the Go test is red (0 of 20 to the sub-group). Restored.
- the old client.js: the weight and order scenes are red (10 failures
  on chromium), the inner-Smart and Smart scenes stay green.

Not tried: real accounts, or the reporter's own config (not shared);
the full ./... suite (another session's full suite held the machine).
2026-10-24 17:38:26 +08:00
yetone c30af359b4 usage: the line chart's lines are smooth curves, not straight segments (owner, after molvqingtai's reference)
The Requests chart's line mode (1c617c153) joined its points with straight
segments, so every change of hour turned a sharp corner. The owner compared
it with molvqingtai's reference chart, whose lines curve, and asked why ours
looked so stiff.

Each unbroken run is now one cubic curve through its points, drawn the way
d3's curveMonotoneX draws it (Fritsch-Carlson tangents): it bends between
points but never past one, so a quiet hour is never drawn dipping below
zero and a peak is never drawn above its value. The stacked bands follow
the same curves on both edges, so a band still meets its line. The dots at
every point are gone, as in the reference; a point alone in its run (no
neighbour to curve to) still gets its dot, or it would not show. Lines are
1.8 wide instead of 1.6. Bars, the tooltip, hover, day pick and the speed
tab's dashed and broken lines are unchanged.

Tests: usage-chart-line's point reader takes each command's end point (M,
L or C). The speed check now requires luna's run to be 13 curves between
its 14 points, and a new check fails if any line's box reaches past its
highest or lowest point (an overshooting curve).

Run at origin/main 5a85a2a91 plus this change (and before the rebase at 2027381ac):
- usage-chart-line and i18n-keys: 48/48, chromium and webkit (en, zh,
  zh-TW, ja, de x light, dark x 1180, 420).
- go test ./internal/gui: ok.
Screenshots of the token chart checked by eye: the steps between hours are
curved, the band and line agree, nothing goes under the axis.

Not tried: the whole GUI suite, the real Linux app (WebKitGTK) and Windows.
Only page.js, app.css and the one test changed; nothing else draws lines.
2026-10-24 17:27:27 +08:00
yetone c8901d4723 gateway: auto mode's classifier asks a model of unknown levels for no reasoning
CyberCaius on Discord (#help): in Claude Code's auto mode every
classifier request ended 499 in magpie, on a new-api relay's
gpt6.1-sol (an OpenAI-compatible provider the user added), v0.1.1364.

Cause (likely; not confirmed against the reporter's relay): Claude Code
2.1.310 sends the classifier as a non-stream sideQuery, thinking off or
left out, 64 (or 2112) tokens, and waits 60s an attempt for it (WWt in
the bundle; 120s cap on large prompts). fitAutoModeClassifier asked for
the least reasoning only when magpie knew the model's levels. For a
relay's own name it sent no reasoning_effort / reasoning.effort, so a
reasoning model reasoned at its vendor's default over the whole policy
and transcript. That ran past Claude Code's wait, and Claude Code
closed the request (499).

Change:
- automode.go: with the levels unknown, the classifier is asked for
  effort none, marked as magpie's own ask (Request.OwnEffort).
- gateway.go forwardTranslated: a 400 to that own effort
  (ownEffortRefused) is asked again. If it named the level, it is
  asked at low (offRefused). If it named the field ("Unrecognized
  request argument supplied: reasoning_effort", "Unsupported
  parameter: 'reasoning.effort'"), it is asked without the effort, as
  before. Either is remembered in unfit until restart. Only the
  classifier gets OwnEffort, and no other request changes.
- docs/subsystems/gateway-routing.md: a bullet on the local
  classifier.

Run:
- TestAutoModeClassifierReasonsLeastOnAnUnknownModel covers Chat and
  Responses, non-stream, thinking off/64 and left out/2112. It is red
  on the old code: no effort was sent in any of the four cases.
- TestAutoModeClassifierEffortRefusedGoesWithout covers a named level
  going to low, and the Chat and Responses field refusals going
  without. Each next ask takes one request.
- TestAutoModeClassifierOnlyTheClassifier now expects none for unknown
  levels (the 7a3337dd2 decision, re-derived). It still checks that a
  title ask is untouched.
- gofmt -l is clean. go vet ./... passes on darwin, GOOS=linux
  -tags nogui and GOOS=windows.
- go test -tags nogui -timeout 45m ./internal/gateway/ (sandbox HOME, this
  tree on 9d6436311): ok in 541s.

Broken by hand:
- With the refusal branch off, both field cases go red.
- With the remembered-field check off, the next ask takes 2 requests.

Not tried:
- the reporter's relay or a real reasoning model's timing. The 60s
  wait is read from Claude Code's bundle, and no fake measures time.
- Sibling side queries (agent_namer, hook_prompt,
  subagent_config_classifier, titles) that send thinking off to such a
  model still leave reasoning to the vendor. They aren't recognisable
  as the classifier is, and the main turn shares their shape.
- Responses still drops the classifier's stop sequence. Its verdict
  regex reads <block>no without it.
2026-10-24 17:25:01 +08:00
yetone 5a85a2a915 gui: ZCode's "gift plans need ZCode's sign-in" card line in zh, zh-TW, ja and de
The line's name comes from the ZCode plugin 0.1.26 (plugins cc0bd90),
next to its claim-hint line. Run: go test ./internal/gui -run 'I18n|Translat|Key' (ok).
2026-10-24 17:13:06 +08:00
yetone 638e51fe3f provider: ZCode's mover min is 0.1.26, so a signed-in account's gift plans keep their -Trial models
bigsteven (Discord #feedback, 10-24) saw no GLM-5.3-Trial on the latest
ZCode plugin. plugins cc0bd90 (0.1.26) fixes three ways the -Trial
entries went missing:
- ZCode's config out of reach marked the list fellBack, so magpie's host
  kept the last good list and dropped a gift's fresh -Trial entries;
- one failed gift-balance read hid them for 10 minutes (now 1);
- an API-key account, or a sign-in whose ZCode session expired, listed no
  -Trial models and the card said nothing. The card now says the gift
  plans need ZCode's sign-in.

Run: go test ./internal/provider (ok, 129s) at this head, on
origin/main b855cfee9. npm view --prefer-online gives 0.1.26.
In the plugins repo: bun test packages/zcode (102 pass) and
bun scripts/check.mjs zcode; each of the three fixes reverted by hand
turns its own tests red.
Not tried: a real account with a gift plan through the moved plugin.
2026-10-24 17:13:06 +08:00
yetone 24f24abde3 usage: a ClinePass contributor-fallbacks route still shows as a swap (plugins#351)
woyin's Routing rows show cline-pass/deepseek-v4.1-flash-1017 served as
vmc/deepseek-v4p1-flash-1017-contributor-fallbacks. Third-party Cline Pass
tools record that name as a private contributor deployment
(finalProvider "openai-compatible-private"), not DeepSeek's own API. So
the row has to keep saying it was served elsewhere. 6db5e9d59's
ClineServing already does this, because only the exact model maps. This
commit is tests only: they hold the rule, so a looser match (a prefix,
say) can't hide the route later.

- TestSwappedClineServingName: -contributor-fallbacks (with and without
  the -1017 date), -contributor and -fallbacks are swaps.
- TestRouteKeptClineServingNameNotSwapped: a kept row served as
  ...-contributor-fallbacks stays swapped when it is read again.

Run at 616c87256's tree:
- go test ./internal/usage: ok.
- go test ./internal/gateway -run 'Clin|Swap|Served|routedAgain|History': ok.
- go vet on darwin, linux and windows: ok. gofmt -l: clean.

Broken by hand: ClineServing changed to a prefix match. Three usage cases
and the history case went red. Restored afterwards.

Not run: the full suite (tests only, in two packages).
2026-10-24 17:07:35 +08:00
yetone 2027381acf gui: Usage's empty Sessions text is translated again (Outvi V on Discord)
Usage's Sessions tab, with no sessions on this computer, said "No sessions
yet. Claude Code's, Codex's, OpenCode's and Pi's sessions..." in English
in every language. 5a4104632 (#569) added Hermes to that text's key in
i18n.js, and the page kept the old wording, which has no key. The page now
says the key's text, Hermes included (Hermes sessions are listed there).

i18n-keys gains "every word the window says has a key": every t("...")
literal in assets' scripts must have a zh key, "magpie" and "ID" excepted
as English on purpose. This was the only one missing.

Run: node --test internal/gui/tests/i18n-keys.test.cjs, 4 of 4 pass; with
the old page.js the new test fails naming page.js:2532. No other test or
source names the old wording.
Not tried: the window itself in each language.
2026-10-24 17:04:32 +08:00
yetone 616c87256a provider: Cursor's mover min is 0.2.20, whose requests to Cursor never name magpie
opencode-cursor-auth 0.2.20 (magpie-community/plugins a41a8d3) serves the
caller's tools to Cursor as the MCP server "tools", where 0.2.19 named it
"magpie" in the system prompt's tool catalog, each CallDynamicTool call,
each tool definition's provider_identifier and the mcp_state answer. Text
added to a vendor's prompt names neither magpie nor the vendor's limits
(LESSONS.md, 5d33f060b / 3c4f8f9ae). Calls under the old name are still
read back. keepMovedCurrent brings every moved user up to it.

npm: https://registry.npmjs.org/@magpie-community/opencode-cursor-auth/latest
says 0.2.20 at landing (publish run 40079878280 is red only for
middleware-think-tags, plugins#180; cursor-auth@0.2.20 was published).

Run at this tree (origin/main 9d6436311 + this change):
- gofmt -l internal/provider/: nothing
- go vet ./internal/provider/ on darwin, GOOS=linux and GOOS=windows: ok
- go test -timeout 45m ./internal/provider/: ok (106s)
The plugin side's record (279 bun tests, a red-then-green upstream-words
test, live tool calls on the owner's Cursor account from a sandbox HOME)
is in a41a8d3's body.
Not run: the full go test ./... suite; the change is the min string only.
2026-10-24 17:02:02 +08:00
yetone 9d6436311a gui: Warm up on reset says a window that resets during sleep starts on waking
LEO_CHEN_X on X (https://x.com/LEO_CHEN_X/status/2113864310367961569):
on opening the lid, Codex's 5-hour window always shows 4h59m left, and
they took it to mean the auto-start is broken.

The code does what it should. keepWarm (internal/provider/codex_warmup.go)
checks every minute on a Go timer. On macOS that timer runs on
mach_absolute_time, which stops during sleep, so it fires within a minute
of waking. The 5-minute look goes by the wall clock, so the look is due
at once. warmNow then finds the window past its reset (asOf, even on a
read cached before sleep) and idle, and sends the one request. A window
still running at wake is not idle and gets nothing (checked in a scratch
test: an account warmed at 20:00 and woken at 22:00 sent nothing, and
one woken at 04:00 sent one). Nothing can send during sleep, and magpie
doesn't schedule a wake. Starting at wake is the earliest start there
is, no later than the user's own first request would make it.

What was wrong is that the row never said so. Daily warm-up's title
explains what a sleeping computer does with its time, and Warm up on
reset said nothing. Codex's and Claude Code's Warm up on reset lines now
carry a title (index.html data-tt, translated with the page) saying
nothing is sent while the computer sleeps, and that a window which
resets then starts on waking and counts from then. Translated into zh,
zh-TW, ja and de. The title is static, so app.js doesn't change and
TestCoreScriptBudget keeps its budget (an app.js version came in 754
bytes over).

Run at this tree:
- gofmt -l internal/: nothing. go vet, GOOS=linux go vet -tags nogui,
  GOOS=windows go vet on ./internal/gui ./internal/provider: ok.
  go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok.
- go test -tags nogui -timeout 45m -count=1 ./internal/gui: ok (92s).
- New internal/gui/tests/warm-reset-asleep.test.cjs: 10 of 10 in
  Chromium and WebKit, en zh zh-TW ja de. With the old index.html it
  fails 10 of 10.
- Both engines, 13 files: gui-de, gui-ja, gui-zh-tw, header-relang,
  i18n-keys, settings-general, settings-groups, settings-search,
  settings-sections, settings-tabs-stick, warm-at-own, warm-at-times
  and warm-reset-asleep, 162 of 162 pass.
Not run: the full GUI suite, since app.js is unchanged and no selector,
API or layout changed. Also not run: go test ./... and a real sleep and
wake of a Mac with a real account (the wake path was read in the code
and checked with the scratch test above).
2026-10-24 16:46:04 +08:00
yetone 4689ba69bd provider: the ZCode mover's min is 0.1.25, so a planless key says a ZCode gift plan needs ZCode's sign-in (rtbeilin on X)
rtbeilin's account is on ZCode 1024 Dev Day with no GLM Coding Plan.
ZCode's sign-in worked, an API key did not. zcode.z.ai serves gift
plans only to ZCode's session JWT, so a key can never spend one; 0.1.24
showed such a key an empty card and passed its requests' 1113 through
bare. zcode-auth 0.1.25 (plugins 71021b8) says why and what to use, on
the card and on the refusal. keepMovedCurrent brings every moved user
up to it.

npm: npm view --prefer-online @magpie-community/opencode-zcode-auth
version = 0.1.25; registry latest shasum 86033cf1 matches the publish
run 40078784618 (the run is red only for think-tags, plugins#180).

Run at this head (origin/main 6db5e9d59 + this change): gofmt -l and
go vet ./internal/provider/ clean; go test -count=1 ./internal/provider/
ok (97s), TestMovedBuiltinsSayTheirPlugin included.
Not tried: a moved account's plugin update from 0.1.24 in a real app.
2026-10-24 16:44:59 +08:00
yetone 6db5e9d593 usage: ClinePass's vmc/ name for the model asked is not a swap (zRain on Discord)
zRain (Discord, 10-24) sent Snow CLI through magpie to
cline/cline-pass/deepseek-v4.1-flash-1017 and read the Routing row's
"vmc/deepseek-v4p1-flash-101…" as the upstream, so the DeepSeek pin
(cline plugin 0.1.11) looked ignored. That text is magpie's swap tag
("实际 vmc/…", "likely another model"): ClinePass answers a cline-pass/
model under its virtual model config's name, the version's dot written
"p", and Swapped read deepseek-v4p1-flash as another model than
deepseek-v4.1-flash. hy125245's pinned requests (finalProvider deepseek,
X 10-23) carried the same vmc/ name, so the name says nothing about the
upstream; the upstream is the "上游:…" tag after it, which the swap tag
pushed out of a narrow row.

Changed: usage.ServingName now includes ClineServing: served "vmc/<name>"
for a sent model with a cline-pass/ path, equal once "<d>p<d>" reads as
"<d>.<d>". Scoped to ClinePass: the same vmc/ name for deepseek/… (not
cline-pass/), another model (v4-pro answered as v4p1-flash, v4p1 vs v4p2,
glm-5.3 vs glm-5p3-flash) and another prefix stay swaps. ServingName is
what routedAgain and the ledger's kept rows already re-read, so routes
and Requests rows kept marked swapped read as not swapped too.

Facts checked, not changed:
- The pin reaches ClinePass on every path. The real opencode-cline-auth
  0.1.11 index.mjs, loaded in magpie's plugin host against a fake
  api.cline.bot (scratch wrapper over fetch, not committed), got
  providerOptions {gateway:{only:["deepseek"],has:["vision",
  "implicit-caching"]}} for a Snow-shaped streamed /v1/responses, a
  non-streamed one, /v1/chat/completions and /v1/messages, and the
  route's Upstream was the reply's finalProvider.
- With the fake refusing the pin ("no matching upstream"), the plugin's
  one unpinned retry went out and the route showed the fallback's
  finalProvider as Upstream: a fallback would show as another "上游".
- Vercel's AI Gateway lists deepseek for deepseek-v4.1-flash-1017 with
  vision and implicit-caching, so the has filter doesn't rule it out;
  "vmc" is not one of its providers.
- @magpie-community plugins update by themselves hourly; npm has 0.1.11
  since 10-23 14:18 UTC.

Run at this commit, rebased on origin/main 3e9efe1d5:
- gofmt -l, go vet (darwin), GOOS=linux and GOOS=windows go vet of
  ./internal/usage ./internal/gateway: clean.
- go test -count=1 -timeout 45m ./...: ok, 70 packages, no FAIL (internal/gateway 544.996s)

Broken by hand (ClineServing returning false), each red:
TestSwappedClineServingName, TestKeptRowClineServingNameNotSwapped,
TestRouteKeptClineServingNameNotSwapped; and the scratch real-plugin run
marked all four routes Swapped.

Not tried: a real ClinePass request (no Cline sign-in on this machine),
so whether zRain's four rows had "上游:deepseek" after the vmc/ name is
the reporter's to say; the GUI suite (no GUI file changed).
2026-10-24 16:29:44 +08:00
yetone 3e9efe1d51 gateway: a Codex turn chatgpt.com's WebSocket refuses as too big goes over HTTP (Lamrfu)
Lamrfu on Discord, after updating: the Codex desktop app through magpie
kept showing "正在重新连接 2/5" with
  unexpected status 502 Bad Gateway: Codex: Post ".../backend-api/codex/responses":
  codex websocket: failed to get reader: received close frame:
  status = StatusMessageTooBig and reason = ""

Cause. a2e98cd79 (v0.1.1349) sends a streamed Codex turn to chatgpt.com
over its WebSocket as one message, the whole request body. magpie's read
limit is -1, so the 1009 close came from chatgpt.com, after our message.
Codex's own client (codex-rs core/src/client.rs at openai/codex 970111f,
get_incremental_items / previous_response_id) keeps its socket and sends
each later request as a delta after previous_response_id, so its
messages stay small; it sets no outgoing size cap of its own
(responses_websocket.rs websocket_config: tungstenite defaults plus
permessage-deflate), and after its retry budget it falls back to HTTP for
the session (responses_retry.rs, try_switch_fallback_transport). Codex
speaks HTTP to magpie (magpie answers its handshake 426), so magpie gets
the whole conversation every turn and opens a socket per turn. That the
server's message size limit is what Lamrfu's long conversation passed is
likely but not confirmed: the limit isn't in codex-rs and I don't know
its value. Before this change the socket's close before the reply was a
502, and Codex retried into the same 502.

What changed (internal/gateway/codex_socket.go):
- codexSocketEnded: when the socket ends, or the message's write fails,
  before any frame of the reply was handed on (any close status, a
  dropped connection, a normal close with no reply, also after only the
  codex.rate_limits / metadata frames), the same body goes over HTTP
  (t.next), which answers as the route does. Nothing has reached the
  caller then and the backend has begun no reply. This replaces the 502
  for 1009 and its siblings (1001, 1008, 1011, 1012, 1013, 1006, 1000
  with no reply).
- codexTooBig: a 1009 records the message's size for that host; a
  message at least that big goes straight over HTTP to it for
  codexSocketShun (10 min), so a long conversation isn't uploaded twice
  each turn. Smaller turns keep the socket. Logged once per host.
- A close after the reply began is still a cut stream and is not asked
  again (no double turn).
- No Codex prompt, instructions or identity is touched.
- docs/subsystems/providers-accounts.md says the new fallback.

Tests (internal/gateway/codex_socket_test.go), fake WS server, no network:
- TestCodexSocketTooBigGoesOverHTTP: the fake's read limit closes 1009
  on a big turn; the turn is served over HTTP, a second big turn doesn't
  open a socket, a small turn still goes over the socket.
- TestCodexSocketEndedBeforeReplyGoesOverHTTP: 1009 after the message,
  1009 after the limits frames, 1011, 1012, 1013, 1008, 1001, and a
  normal close with no reply: each served over HTTP.
- TestCodexSocketTooBigMidReplyIsCut: 1009 after response.created and a
  delta is a cut stream with no HTTP post.

Broken by hand: with origin/main's codex_socket.go, TooBig and all eight
EndedBeforeReply subtests go red with 502, the first with Lamrfu's own
text ("received close frame: status = StatusMessageTooBig"). With only
the codexMessageTooBig check removed, TooBig goes red ("2 posts, 2
sockets"). MidReplyIsCut passes on both (it guards against asking twice).

Run at this head: gofmt -l (clean), go vet ./..., GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./..., go build; go test -run Codex
-count=1 ./internal/gateway/ in a sandbox HOME: ok (30.2s), every Codex
test in the package. Pending: go test -timeout 45m ./internal/gateway/...
is queued behind the machine's full suites and runs after this push, as
the owner's ship-at-once rule asks; its result goes on the release.

Not tried: a real chatgpt.com turn big enough to be refused 1009 (the
limit isn't known); Lamrfu hasn't confirmed yet. Not run: the full ./...
suite (only the gateway packages this touches).
2026-10-24 16:15:28 +08:00
yetone 7d9165d842 gateway: tests for plugin-served Factory with Standard usage only, 99% caps and order routing (plugins#349)
TestPluginFactoryStandardOnlyCaps runs the fake plugin as factory (marked
moved, two OAuth accounts A then B, order routing, each capped at 99% with
SetAccountCap as `magpie provider account-cap factory <account> 99` does).
The windows are those Factory's plugin 0.1.38 reports with standard_only
on (limitWindows(l, true)): Standard's 5 hours and 7 days with no model
list, Droid Core's and Extra usage aside. The fake plugin gains
$FAKE_WINDOWS, a file of each account's windows read at each usage
reading, so routing reads them through the host and provider.Allowances,
not a stub.

What it holds, today's behaviour, no code change:
- A's 7 days at 99% (its 5 hours at 40%): A is not sent the request; B
  serves fake-1, fake-claude and glm-5.3 (a Droid Core model). The trace
  shows a@fake 99/99 left out with its reset. Core windows at 100% on an
  account below its Standard caps don't hold it.
- Both capped (A's 5 hours 99%, B's week 100%): 429 rate_limit_error,
  "usage cap reached: every account that serves ... - Factory (a@fake) is
  at 99% of a usage window, past its 99% cap, until <time>; Factory
  (b@fake) ...", advice naming magpie provider account-cap, Retry-After
  at the sooner reset (A's 5 hours), nothing sent to the vendor, logged
  "every account at its usage cap".
- A read again below its cap serves again; a kept reading still at 99%
  whose reset time has passed serves too.
- A conversation on A moves to B when A is capped. Once A is back: auto
  affinity with no cache worth keeping goes back to A; with B's cache
  (5000 cached tokens) it stays on B; affinity session stays on B. A new
  conversation goes to A.

Broken by hand, each red at the step it guards: capHeld returning nil
(A served while capped), allowanceOf keeping aside windows (glm-5.3 went
to B while A's Standard windows were below cap), CapHeld ignoring a
passed reset (429 where A should serve).

Run: go test -tags nogui ./internal/gateway -run
TestPluginFactoryStandardOnlyCaps -count=1 -v, ok; go test -tags nogui
./internal/gateway ./internal/plugin ./internal/provider ./internal/cli
-count=1 -timeout 45m at base ed91aa04e: all four ok (gateway 494s,
plugin 217s, provider 191s, cli 88s); rebased onto ef1a203df and the new
test run again there (below). gofmt -l clean; GOOS=linux go vet -tags
nogui and GOOS=windows go vet of ./internal/gateway clean. No full ./...
suite: tests and testdata only, and another session's full suite was
running.

Sandbox HOME, built binary, fake plugin as factory, two accounts signed in
with magpie plugin login factory (browser opener stubbed on PATH):
magpie provider account-cap factory alice@fake 99 -> "capped at 99% of
each usage window", saved as accountCaps in providers.json; --window
"7 days" 95 and default work; an unknown account and 150 are refused.

Not tried: real Factory accounts, the real plugin's own option toggle in
magpie (its own usage.test.mjs covers the switch), the Anthropic
/v1/messages route's 429 body.
2026-10-24 15:33:17 +08:00
yetone ef1a203df9 gateway: an Antigravity account out of quota rests until the reset its 429 names, not 15 minutes (Dani Ariyanto)
Dani Ariyanto (Discord #feedback, 10-24): seven Antigravity accounts,
several ticked, one First, OpenCode on Gemini 3.8 Flash. With the First
account out, requests kept going to it instead of the next account, which
had all its quota.

Cause: Antigravity's 429 for a model's quota used up says when it is back
as a Go duration: "You have exhausted your capacity on this model. Your
quota will reset after 3h19m30s." (QUOTA_EXHAUSTED; the fixture
antigravityQuota, already in the tests since ea1c5d045). Nothing read
that form. The try was failQuota and the request failed over to the next
account, but the account rested only quotaRest (15 minutes). The
per-model window fetchAvailableModels gives is the 5-hour figure, so when
the weekly pool is the one spent, no window reads full either. Every 15
minutes for hours or days, the First account was asked again, refused,
and only then passed over.

What changed:
- routing.go: quotaResetAfter reads "quota will reset after <duration>",
  and resetsAfter returns it (beside Factory's "resets in ...") when it is
  above zero and no more than longestWritten. The rest is By "resets" for
  that long. As before, pooled decides whether the account or only that
  model rests. keepRetry passes it on as Retry-After when no account is
  left.
- docs/subsystems/gateway-routing.md: a bullet on the form.

Checked and not changed:
- Failover within one request already worked. A probe with two accounts,
  OpenCode's system prompt on /v1/chat/completions, streamed and not, with
  the literal 429, had u1 fail as quota and u2 answer 200. A per-model
  window the vendor reports at 0 (remainingFraction left out) benches the
  account until that window's reset after one try.
- Routing doesn't read the pool windows from retrieveUserQuotaSummary
  (Aside). That is unchanged.

Run, in a worktree at ed91aa04e:
- TestAntigravityQuotaRestsUntilItsReset is red on the old routing.go
  ("u1 rests 14m59.98s by "quota", not the 3h19m30s its quota resets
  after") and green with the change. It also checks that the next request
  asks only u2, plus reader cases: 45m2s, 26s, 155h2m1s, past 7 days (0),
  cut short (0), and the "check quota" 429 with no time (0).
- go test ./internal/gateway -count=1 -timeout 45m: ok (598s)
- go test ./... -timeout 45m: not run before this push. Another
  session's full suite was running here; it runs after the push.
- gofmt -l clean. GOOS=linux go vet -tags nogui ./... and GOOS=windows go
  vet ./... clean.

Not tried: a real Antigravity account out of quota (none spent locally),
so the 429's words come from the existing fixture, not a fresh capture.
RetryInfo's retryDelay detail isn't read.
2026-10-24 15:31:51 +08:00
yetone 1d6b72ada8 gateway: a search magpie runs for a model cites its pages in Anthropic text blocks (H20)
H20 on Discord (#general, 10-24): a client offering web_search_20250305
to auto/deepseek-v4.1-flash or deepseek/deepseek-flash got its text
blocks back with no citations, where Anthropic's API gives
web_search_result_location entries pointing at the
web_search_tool_result pages.

magpie's web_search tool asks the model to "Cite the URLs you use", so
the answer names pages by URL. After a KSearch event (or a Search part),
the Anthropic encoder and renderAnthropic now cut the following text
into lines (citer, search_cite.go). A line naming a found page's URL
whole (urlIn: not a longer path, a query or another host; Chinese
punctuation, markdown links and bold end a URL) is its own text block
with citations {type, url, title, encrypted_index, cited_text}; the
lines between run together in one uncited block, and whitespace-only
lines are held for the next, so no block is whitespace alone (Anthropic
refuses one sent back). Streamed, a cited block's citations_delta come
before its text_delta; text is buffered to the line end, only after a
search. The text is the model's, unchanged. A reply with no search is
said exactly as before.

encrypted_index is "", as the results' encrypted_content already is:
it is Anthropic's sealed pointer, which magpie can't make (Claude Code
2.1.310 knows "invalid encrypted_index in text block" and strips these
citations when that comes back). cited_text is Hit.Cited cut to 150
characters: a search API's page text, or the cited_text of an Anthropic
searcher's own citation (searchWith now reads it), else "". No prompt
text sent upstream changed; no Codex prompt touched.

Sibling filed: Responses and Chat replies still carry no url_citation
annotations (#3455). docs/subsystems/gateway-routing.md has a new
"Citations in translated Anthropic replies" section.

Run (at c579609d9 on ed91aa04e, sandbox HOME, pinned caches):
- go test ./internal/gateway -run 'TestSearchCitedAsAnthropics|
  TestNoSearchNoCitations|TestCitesOnlyTheWholeURL|
  TestWebSearchForAModelThatCannot|TestSearchToldAsAnthropics': ok
- go test ./... -timeout 45m -count=1: exit 0, 70 packages ok,
  internal/gateway ok 647s
- gofmt -l internal/gateway: empty; go vet ./internal/gateway,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...,
  go build ./...: ok

Broken by hand: with anthropic.go put back to main,
TestSearchCitedAsAnthropics/stream and /body both FAIL ("blocks [text
server_tool_use web_search_tool_result text]": one text block, no
citations); restored, both pass. TestNoSearchNoCitations holds a reply
with no search to one uncited block, streamed and whole.

Not tried: a real DeepSeek model through a running magpie (whether it
writes the URLs the tool asks for, and how often); a real Anthropic API
taking such a reply back in history; [n] markers (a search API's
numbered pages) are not matched, since numbers repeat across searches.
2026-10-24 15:31:05 +08:00
yetone ccbbcbffcb gui: a restart to update leaves the Mac's menu bar icon for the next magpie (Mitsuha, audie)
From v0.1.1354 a restart to update hands the gateway over, and the old
magpie hides its own menu bar item with Wails' Hide, which is
[statusItem setVisible:NO]. AppKit keeps that in the app's defaults by
the item's autosave name ("NSStatusItem VisibleCC Item-0" = 0 on macOS
26), and the next item made under that name starts hidden. So after the
update the icon was gone, and quitting and reopening didn't bring it
back (Mitsuha on v0.1.1364; audie on two Macs, macOS 27.0.1).

Evidence: a 30-line Cocoa probe made a status item, setVisible:NO, and
every later launch of the same program started with visible=0 and the
key = 0; removeStatusItem kept nothing; removing the key brought it back
on the next launch. This machine's com.yetone.magpie.sbhandover.plist
(the handover commit's own sandbox run) holds
"NSStatusItem VisibleCC Item-0" => false.

Fix (internal/gui/trayshown_darwin.go, app.go):
- leaveMenuBar (was the onHandedOver closure) queues forgetTrayHidden
  on the main thread after Wails' hide block, so the hide is made on
  screen but not kept.
- bringTrayBack, once per computer (a flag in the Mac's defaults, never
  in a WebDAV backup), forgets a kept hide before the tray is made: that
  repairs everyone an older magpie already hit. A hide kept after that
  is the user's and is left alone.
- A magpie handed over to by an older one (which still hides for good)
  forgets the hide once that pid has quit and shows its item, unless a
  hide was already kept when it started.
docs/subsystems/gui-shell.md says so under the handover.

Run (worktree at origin/main ed91aa04e):
- TestHandoverLeavesTheMenuBarIconForTheNextMagpie (AppKit child with a
  real Wails tray, CFFIXED_USER_HOME sandbox): ok, -count=3.
- Broken by hand: leaveMenuBar without forgetTrayHiddenLater -> "handing
  over kept the menu bar icon hidden for the next magpie (1 kept)";
  bringTrayBack without forgetTrayHidden -> "the icon an older magpie hid
  wasn't brought back (still hidden true, 1 kept)".
- go test ./internal/gui/ -count=1: ok 86.7s; go test -tags nogui
  ./internal/gui/: ok 67.2s.
- gofmt -l: nothing. go vet ./internal/gui/ (darwin), GOOS=linux go vet
  -tags nogui, GOOS=windows go vet: ok. go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build: ok.
- No GUI asset changed, so no Playwright run.

Not tried: a real signed update from v0.1.1367 to this build on the
user's bundle id; whether Control Center hides the new version's running
item live when the old one writes the key (the probe's running item kept
visible=1; the on-screen window list needs screen recording rights). Not
run: the full go test ./... (one package touched; other sessions are
queued for the suite). audie's WebDAV sync carries no tray setting and
doesn't restart magpie; the icon going there is taken to be the same
update's restart, not confirmed with them.
2026-10-24 15:20:37 +08:00
yetone ed91aa04ef checkin: an inactive or ineligible check-in shows the plugin's reason (plugins#304)
Qoder's plugin 0.2.32 (magpie-community/plugins 74be632) says why no
check-in was offered: it asked with this machine's own device identity
and Qoder offered no campaign, and Qoder desktop can claim one it shows.
magpie dropped a hook's message for inactive and ineligible and showed
only "No check-in event now". Now:

- GUI: the Usage card's row reads "<label> · <message>", wrapped under
  the label rather than cut off with "…" (data-why, as a failed row's
  reason wraps, #821); Settings' check-in line under the plugin's switch
  carries it too. A result without a message reads as before. No new
  i18n keys: the message is the plugin's own text, as for failed rows.
- TUI: the Usage cell is too narrow, so it adds "c says why"; c's flash
  carries the message (checkinWhy).
- CLI: `magpie accounts checkin` prints it after the label.
- The Qoder mover's min is 0.2.32 (npm view --prefer-online: 0.2.32).
- docs/subsystems/provider-plugins.md says how the message is shown.

Run at this tree (based on origin/main dd1e8822d):
- go test -timeout 45m ./... (tee'd, grepped): every package ok
  but internal/handoff, whose TestTakeOnlyAFreshOfferForThisProgram
  could not bind a unix socket under my long scratch TMPDIR (path over
  104 bytes); with the default TMPDIR internal/handoff is ok.
- gofmt -l: clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean.
- GUI, chromium and webkit: checkin-reason (new: en, zh, zh-TW, ja, de;
  900 and 440px), plugin-checkin, qoder-checkin-recheck, usage-checkin,
  checkin-account, checkin-early-done, usage-quota-head, i18n-keys:
  155/157. The 2 reds are usage-checkin's "webkit en/zh: Settings has a
  Qoder check-in tab", red the same on a fresh origin/main a9a001a7a
  (#2549, #3091).
- TestCoreScriptBudget: app.js 1,343,313 of 1,343,324, no raise.

Rebased on origin/main 4683a0382 (a9a001a7a's app.js line, 4683a0382's
provider change) and run again at this head: internal/gui (budget:
1,343,323 of 1,343,324), internal/cli, internal/tui and the whole
internal/provider ok; the same 8 GUI files in both engines, 155/157,
the same two #2549/#3091 reds.

Broken by hand: app.js's change reverted, checkin-reason goes red on the
reason; app.css's reverted, red on the wrap; checkinWhy returning "" in
internal/cli and internal/tui, TestCheckinSaysWhyNoneWasOffered red in
each.

Not tried: a real Qoder account offered no campaign (the fixture is the
plugin's own text); the real Linux app (WebKitGTK).
2026-10-24 14:52:13 +08:00