ac4af582301a4e8a29245dbba767eba31334ddf9
7089
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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.
|
||
|
|
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).
|
||
|
|
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.
|
||
|
|
fc9430e12d | proc: Windows lists processes from a Toolhelp snapshot, not a new PowerShell and WMI each time (#3467) | ||
|
|
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 |
||
|
|
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.
|
||
|
|
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 |
||
|
|
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
|
||
|
|
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. |
||
|
|
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. |
||
|
|
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).
|
||
|
|
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.
|
||
|
|
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 |
||
|
|
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 |
||
|
|
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 |
||
|
|
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. |
||
|
|
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. |
||
|
|
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
|
||
|
|
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. |
||
|
|
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 |
||
|
|
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. |
||
|
|
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. |
||
|
|
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
|
||
|
|
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). |
||
|
|
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
|
||
|
|
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). |
||
|
|
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
|
||
|
|
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
|
||
|
|
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 |
||
|
|
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
|
||
|
|
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. |
||
|
|
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
|
||
|
|
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 |
||
|
|
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
|
||
|
|
c30af359b4 |
usage: the line chart's lines are smooth curves, not straight segments (owner, after molvqingtai's reference)
The Requests chart's line mode ( |
||
|
|
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
|
||
|
|
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). |
||
|
|
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
|
||
|
|
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). |
||
|
|
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.
|
||
|
|
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, |
||
|
|
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). |
||
|
|
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
|
||
|
|
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
|
||
|
|
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.
|
||
|
|
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 |
||
|
|
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 |
||
|
|
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
|
||
|
|
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
|
||
|
|
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 |