ac4af582301a4e8a29245dbba767eba31334ddf9
7089
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9fdcb7c31e |
gateway: a Claude Code call made before its input is written reached the client with no arguments (#4611)
What changed Claude Code 2.1.314 makes the calls of one message side by side, so a second call can arrive through the MCP helper while its input is still being streamed, carrying no arguments field at all. The run's fast path (a call the transcript has not yet, tells the client itself) emitted that shape as it came, and the client received a function_call with empty arguments that could only fail; the message written seconds later carried the input whole and was left out with the rest. A call that arrived between the client's replies ended the same way, its block dropped with its message. Such a call is now held back and told by that message itself: a message with a held call is no longer left out, its blocks the calls already told are skipped, and every held call goes out with its whole input (#4611). Run go test ./internal/gateway -run 'TestClaudeTUI' -count=1 Generated-by: GLM-5.3-Flash (ZCode) Landed from ggbdpq's branch (patch posted on the issue; sha256/patch-id checked against the issue) by yetone, rebased on origin/main 2026-11-03. Run at the pushed tree, on mote (macOS): go test -tags nogui -count=1 of internal/gateway with -run over this batch's tests and their families (PlainSchema, Antigravity, AutoMode, WebP, ClaudeTUI, NativeRelay, Namespace, Grok, Zed, Codex, ClinePass, rewrite) ok; -race -count=3 of the new tests ok; GOOS=linux and GOOS=windows go vet of internal/gateway and gofmt -l clean. The full gateway-and-importers run, started at an earlier base, was still running at the push; its reds get issues. Broken by hand: the product change reverted, TestClaudeTUICallWithNoInputYetWaitsForItsMessage red; restored, green. Risk kept: a call held in unheard waits for its message; if Claude Code ever held that message until the call's result is in, the turn would wait. Not tried with a real Claude Code TUI. |
||
|
|
e8b6c3d357 |
gateway: a webp a vendor can't read is written again as a JPEG, and GLM's word for one fails over (#4732)
Claude Desktop's browser tool answers a screenshot as image/webp, and GLM can't read one: its 400 [1210] "图片输入格式/解析错误" turns the picture away, and its Anthropic-style endpoint says of the same picture 400 [1214] "messages[0].content[0].file必须传入file_id、file_url、 file_data至少之一", having taken it for a file of its own — the two alternating (zhangqingwen204's report). The picture rides in the conversation's history, so every later turn was refused the same way, and the session was stuck; another model or provider of the same conversation fared no better. Now the request is asked again with the picture written again as a JPEG (as PNG when it has transparency), the way a HEIC is (heic.go), and the provider is remembered (unfit, webpRefused) to have every webp of its requests written again before they leave — the session's later turns pay the refusal no more. The words themselves join the shape refusals (shapeRefused, retryable): a request no webp of whose can be written again (one gone as an URL, say) moves to the next member, which may take the picture as it is, and this one doesn't rest. Z.ai's bare "1210", its word for a model that always thinks, is none of this: the family is the double-bracket "[1210][" and "[1214][" forms and the two wordings, read decoded (#1669). Most vendors take webp, so nothing is written again for them until their first refusal says otherwise. Run: go test -tags nogui ./internal/gateway/ Generated-by: GLM-5.3-Flash (ZCode) Landed from ggbdpq's branch (patch posted on the issue; sha256/patch-id checked against the issue) by yetone, rebased on origin/main 2026-11-03. Run at the pushed tree, on mote (macOS): go test -tags nogui -count=1 of internal/gateway with -run over this batch's tests and their families (PlainSchema, Antigravity, AutoMode, WebP, ClaudeTUI, NativeRelay, Namespace, Grok, Zed, Codex, ClinePass, rewrite) ok; -race -count=3 of the new tests ok; GOOS=linux and GOOS=windows go vet of internal/gateway and gofmt -l clean. The full gateway-and-importers run, started at an earlier base, was still running at the push; its reds get issues. Changed in review: the ask-again records the try (failShape) in the route trace, as the serve loop's other ask-agains do. Broken by hand: the serve-loop branch and the pre-send rewrite turned off, TestWebPRefusalHealed red; restored, green. Not tried against GLM. The issue doesn't show the screenshot's media type, so 'Claude Desktop's screenshot is webp' is the reporter's reading, not checked here. |
||
|
|
6ac6760086 |
gateway: the Claude bridge passes the request's effort to the CLI it spawns (#2899)
A request for a Claude Code subscription could name its effort in output_config.effort and the bridge still ran Claude Code at the CLI's own level: parseAnthropic reads output_config.effort only when the request asks thinking with it, so a request carrying an effort and no thinking ask reached serveSubscription with no effort, and the --effort its claudeCLIArgs appends for one was never appended. The reporter sampled the spawned claude -p and found no --effort on its command line and no effort variable in its environment, while their A/B table has the CLI's own --effort low and --effort max at 325 and 1002 output tokens and the same efforts through the gateway indistinguishable (~9s either way). serveSubscription now takes the effort an Anthropic request's output_config names even when its parse left none (outputConfigEffort), unless the request turned thinking off. The gate that keeps a thinking-less effort from turning thinking on upstream still stands for every other backend: through the bridge the level is --effort, which works whatever the turn thinks of. A request with no effort spawns as it did, and a turn resumed in a run waiting for it is told the level as before (setEffort). TestClaudeBridgePassesTheRequestsEffort stands in for Claude Code with a script that records the arguments it is spawned with, and fails on the old code: output_config.effort max came through with no --effort on the recorded command line. With the change it reads --effort max, a request that asks its effort with thinking reads it as it always did, and a request that asks no effort spawns with no --effort. go test ./internal/gateway/ -count=1 (full package, 341.9s), -run TestClaude (33.3s), -race -run TestClaude (40.5s), go vet (darwin, GOOS=linux, GOOS=windows), gofmt and go build -tags nogui (darwin, GOOS=linux, GOOS=windows) pass. Generated-by: GLM-5.3-Flash (ZCode) Landed from ggbdpq's branch (patch posted on the issue; sha256/patch-id checked against the issue) by yetone, rebased on origin/main 2026-11-03. Run at the pushed tree, on mote (macOS): go test -tags nogui -count=1 of internal/gateway with -run over this batch's tests and their families (PlainSchema, Antigravity, AutoMode, WebP, ClaudeTUI, NativeRelay, Namespace, Grok, Zed, Codex, ClinePass, rewrite) ok; -race -count=3 of the new tests ok; GOOS=linux and GOOS=windows go vet of internal/gateway and gofmt -l clean. The full gateway-and-importers run, started at an earlier base, was still running at the push; its reds get issues. Changed in review: the effort taken from output_config no longer outranks #250's forced low for Claude Code's auto mode classifier (the injection ran before start's req.Effort == "" check); the test has a classifier case that fails without the guard. Broken by hand: the product change reverted, the effort test red; the classifier guard alone removed, its case red (--effort high). Shell-script fake Claude Code: skipped on Windows, not run there. Not tried with a real Claude Code sign-in. |
||
|
|
6e1e3af9e3 |
gateway: an Antigravity schema's array always says its items, tuple or not (#2826)
What changed
- plainSchema (internal/gateway/codeassist.go) now leaves every array
schema with an items object, at any depth:
- a tuple's items (an array, draft 07) collapses to its first member
that says anything;
- an array whose members were said in prefixItems — dropped by the
subset — takes that tuple's first meaningful member as its items;
- an array that still has none gets items {"type":"string"}.
Why
- Google requires items on every schema of type array. Claude Code's
tools (ArtifactData's query.where) say an array of arrays in JSON
Schema 2020-12 tuples, and stripping prefixItems left the inner array
with none, so Antigravity turned the whole request away with 400
"tools[0].function_declarations[3].parameters.properties[query].
properties[where].items.items: missing field". plainSchema is the
Antigravity path only: Gemini CLI and Vertex take the schema as it
came, and no other vendor path strips tuples.
Run
- go test -tags nogui -count=1 -run 'TestPlainSchema|TestCodeAssist|TestAntigravity' ./internal/gateway/: ok (TestPlainSchemaArrayAlwaysHasItems red on
|
||
|
|
f822689ada |
gateway: a relay's "referenced reasoning item" refusal is read as an unreadable item (#3062)
What changed: unreadableItem, the matcher that reads a 400 as "this input
item can't be read", now also takes the wording a Responses passthrough
relay answers in — "Referenced reasoning item 'rs_…' was not found or has
expired" — beside OpenAI's own ("Item with id 'rs_…' not found",
"encrypted content for item"). The refusal is recognized wherever the
matcher is read: the passthrough turn is asked again without the bare
reasoning (and the provider's model isn't sent them again), the ChatGPT
backend drops the named item and asks the rest again, and a compaction
refused so is asked again as text.
Why: a Codex thread behind such a relay (opencode.ai's OpenCode Go)
collects reasoning ids the relay can't resolve, two ways — a turn failed
over to a provider magpie translates leaves Codex reasoning items magpie
minted (an rs_ id and a summary, nothing sealed), which never existed on
the relay's store; and the relay seals its own reasoning only briefly, so
after a resume gap ids from its earlier replies read as expired. Codex
replays the whole history every turn, and the relay's 400, worded by the
relay and naming no input param, passed refusesInput unread — so the
thread 400s on every later turn. The reporter's repro now strips the
named bare item, asks again, and answers 200.
Run: TestRelayRefusedReasoningItemReadAsUnreadable and a TestRefusesInput
row for the reporter's exact body are red before the change and green
after; the bare-reasoning, foreign-seal and item-not-found families stay
green (also with -race, and under an ablation and a mutation of the new
wording, where the old wordings' tests stay green); gofmt clean; go vet
on darwin, linux and windows; builds with -tags nogui on the three. Full
./internal/gateway/ is green on the third run (511s); a first run hit go
test's default 10m timeout and a second failed only
TestAsyncGatewayResponseDoesNotHoldStream — a fixed-10s-guard streaming
hook test unrelated to this change, which passes 3/3 alone.
Generated-by: GLM-5.3-Flash (ZCode)
Landed from ggbdpq's branch (patch posted on the issue; sha256/patch-id
checked against the issue) by yetone, rebased on origin/main 2026-11-03.
Run at the pushed tree, on mote (macOS): go test -tags nogui -count=1 of
internal/gateway with -run over this batch's tests and their families
(PlainSchema, Antigravity, AutoMode, WebP, ClaudeTUI, NativeRelay,
Namespace, Grok, Zed, Codex, ClinePass, rewrite) ok; -race -count=3 of
the new tests ok; GOOS=linux and GOOS=windows go vet of internal/gateway
and gofmt -l clean. The full gateway-and-importers run, started at an
earlier base, was still running at the push; its reds get issues.
Broken by hand: the regexp change reverted, test kept:
TestRelayRefusedReasoningItemReadAsUnreadable red; restored, green.
Not tried against the reporter's relay; the fixture is its literal body.
|
||
|
|
2ab9235711 |
agents: an agent's picks can be kept to this computer, as an MCP server can
chenxiang0010 on Discord: 「agent当前选择的模型可不可以像mcp那样 只对当前设备生效」.
Sync carries every agent's picks (model, effort...) between computers;
an MCP server has an opt-in "This computer only" that sync and backup
files never carry. Agents now have the same: the row's menu (right-click
or ...) has This computer only, off by default, so an upgrade changes no
pick on any computer.
- settings: AgentsHere, this computer's own (KeepOwn), and kept by a save
of the Settings page (settingsapi.Apply), which doesn't send it.
- davsync: each kept agent adds "<id>.*" to the own set (withHere, isOwn),
so a sync neither pushes its fields nor brings the server's; a Restore
from the server leaves them. sync-state.json records the list as of the
last sync (Here): hashes before a sync use it and after use the current
list, so turning it on or off is no change on either side, and a changed
list forces the sync past its early returns. Turned off, the next pick
goes up again. Other agents still sync both ways; the implicit own
fields (hayden4608) are unchanged.
- backup.Restore skips a kept agent in a backup file.
- gui: POST /api/agents/here; the row says "This computer only" beside
the version (hidden in the tray panel and in a narrow row), menu ticks.
Core words moved from the library plugin's i18n into core i18n
(zh/zh-TW/ja/de). Comments in renderAgents cut to pay for it under the
core budget (no raise).
- cli: the route is named under stage 3 (no command yet).
- docs/subsystems/sync-backup.md describes it.
Run on mote, at the base
|
||
|
|
5ec2375688 |
gateway: a call's HTTP headers both ways, masked, folded under its bodies
usrname1833 on Discord asked to see the raw request and response HTTP headers (查看原始请求和原始响应的http头), to debug as with a capture. magpie kept the client's request headers and its own response headers only in the request archive, and nothing of what went upstream. Now a call keeps its headers both ways (internal/gateway/wire_headers.go): - the client's, as they reached magpie: headerLogged in Handler() clones them for every request that isn't a GET, HEAD or OPTIONS; - each request magpie sent upstream for the call: method, address, headers, and the answer's status, protocol, headers and time, or the error. rpmTransport (under s.client) records it as it is sent; provider.SendsThroughPlugin records a plugin account's hand-off, shown as handed to the plugin, since the plugin's own request to its vendor is made in Bun and magpie doesn't see it (the view says so). The first 8 tries are kept, the rest counted. Recording copies each header map; nothing is masked or sorted as a request goes. Secrets are taken out when the headers are read (Call.Headers): by what each header is (new redact.SecretHeader, now behind redact.ScrubHeader: Authorization, cookies, x-api-key, api-key, any *-Key, *-Token, *-Secret, *-Auth, *-Signature, but Idempotency-Key and a count of tokens such as anthropic-ratelimit-tokens-remaining), any Bearer or Basic value, and redact.Scrub on the rest; an address loses its password, a secret-named query value (?key=) and its fragment. They live with the call in the 40-call ring; /api/gateway/call gives them as "headers". The request archive keeps the upstream ones as "upstream" beside the request's and response's headers, masked the same way. No body is stored that wasn't before. GUI: under a recent call's bodies on Gateway and a request's on Routing, "HTTP headers" folds open the client's headers, then each upstream request beside its answer (wireHeadersView, plugins/usage/page.js); the archive's copy shows its upstream requests too. Strings in all four languages. docs/subsystems/gui-shell.md describes it. Also changed by SecretHeader: the request archive no longer masks a rate-limit count header (…-tokens-remaining), which the old name rule took for a token. (provider.SecretHeader, which backups use, is another function and unchanged.) Tests: TestRecentCallHeadersBothWays (a fake vendor; the client's key and cookie, magpie's upstream key and the vendor's Set-Cookie all masked; status, protocol and response headers kept), TestRecentCallHeadersEachTry (a 429 then the next key, both kept in order), TestPluginHandOffHeaders, TestScrubURL, TestSecretHeaderRealNames (real header names both ways), TestArchiveOnThisComputer and TestRecentCallBodiesOnDemand extended, call-headers.test.cjs (Gateway, Routing and the archive's copy; chromium and webkit; en at 1100px, zh, zh-TW, ja, de at 380px and Routing at 440; nothing out of the box, no left-border accent). Run (on mote, macOS 27.2, through mote-run, unless named): - Full suite at ebd22b1b4 (the same change on |
||
|
|
8d4d8b2d5f |
redact: a field set to nothing takes nothing from the next one (mx_albert)
mx_albert on Discord (#feedback): with Secrets masking on, this command
line went to the vendor with 127.0.0.1 replaced:
env -i PATH HOME UI_USER= UI_PASSWORD= UI_ADDR=127.0.0.1:39117 DATA_DIR=/tmp/x ./syncer serve
The SECRET rule (a name with password/secret/token/api_key, then = or :)
lets a space stand after the separator, for `password = hunter2` in a
config. UI_PASSWORD is set to nothing, so the rule took the next word,
UI_ADDR=127.0.0.1, as its value and masked it as {{SECRET_…}}:39117;
once masked it was a known value and went masked wherever it came again.
The other field rules (*_KEY / *_PASS, key, 密码, 密钥, "token 是") had the
same shape.
Now a value that is an assignment of its own after a space (UI_ADDR=,
addr=, --listen=; an = with something other than = after it, so a
base64 value's padding is never one) is the next field: the match is
dropped and the search goes on from that value, which is read with its
own name (fieldMatches, nextField). UI_ADDR's address goes as written;
UI_PASSWORD= UI_TOKEN=t0k3nValue2 still masks the token, as UI_TOKEN's.
Old data: what was masked before is known only in memory, so after the
update's restart 127.0.0.1 in that line goes as written for every user;
a conversation carrying it sends it as written from then on (one prompt
cache miss).
Tests: TestEmptyFieldTakesNotTheNext (the reporter's literal line, plus
0.0.0.0, [::1], localhost:port, logfmt, --flag=, and the CJK and
"token 是" rules, every category on) and TestSecretBesideEmptyFieldMasks
(hunter2pass9, a token after the empty field, a *_KEY, a base64 value,
password = with spaces).
Run at this head on mote: go test ./internal/redact ./internal/masking
./internal/otlp ./internal/pii ./internal/sessions ./internal/settings
./plugins/redact all ok; ./internal/gateway and ./internal/gui (nogui)
-run 'Redact|Mask|Privacy|Secret' ok, gateway
TestLoopGuardLeavesOrdinaryRepliesAlone ok (it reads the doc page);
GOOS=linux and GOOS=windows go vet ./internal/redact ok; gofmt -l clean.
Broken by hand: findAll with the field check turned off. Both new tests
go red: the reporter's line masks {{SECRET_…}}:39117, and 17 of the
other cases fail (UI_TOKEN= after an empty field masked with its name,
UI_ADDR=127.0.0.1 then masked as known in the next case).
Not tried: the full gateway and gui packages (another session's suite
was on mote), the GUI, a real request through a running gateway.
UI_PASSWORD=hunter2 itself is not masked by a rule, before or after
this: the rule asks 8 characters of a value, hunter2 has 7.
|
||
|
|
3e61d814e5 |
gateway: an AI Studio key speaks the Gemini API too, and searches by googleSearch
cocoasoda (Discord) asked for a native Gemini API mode on the Gemini API provider, so it can search with Google Search on the API credit a Gemini subscription comes with. The Google Gemini preset (and any provider whose Chat URL is AI Studio's OpenAI-compatible one) now gets AI Studio's Gemini API base, https://generativelanguage.googleapis.com/v1beta, at the same key, filled in by normalize, so existing providers get it on load. A Gemini URL of the provider's own is kept; other hosts, Vertex and sign-ins get nothing. Ordinary turns stay on Chat as before. What changes: - A Gemini client (Gemini CLI) is relayed natively, its googleSearch tool included, instead of being translated onto Chat. - A web search with no tools of the client's own (Claude Code's WebSearch) goes to the Gemini API with tools [{"googleSearch":{}}], and the grounding comes back as the client's search result. - A turn with function tools stays on Chat: Gemini doesn't take googleSearch beside function declarations, so before this the switch to Gemini dropped the search silently. Its model is given magpie's search tool, and the same key answers it by a tool-less googleSearch request (searchesOwn / ownSearcher, as Google sign-ins do since #757), on the user's own credit, not another provider's. - The model list isn't asked twice: AI Studio's OpenAI-compatible list is its Gemini API's list. Run on mote at this change on |
||
|
|
898c314b79 |
gui tests: old-webkit knows profilerename.js is loaded on Rename
|
||
|
|
d5dc8eeccc |
gui: Scroll to top and Scroll to bottom on a long page (emo172)
#1090 (emo172) asked for back-to-top and back-to-bottom buttons on the main pages. Once a page is scrolled more than one window down, a small capsule with two buttons, Scroll to top and Scroll to bottom, fades in. It sits in the page's right margin when a wide window leaves one, and otherwise over the page's corner, above Providers' sticky Add buttons. It stays hidden near the top of the page, while a dialog is open, and (over the corner) at the page's foot, where the last row can't scroll out from under it, unless it has the pointer or keyboard focus. The page's own height never changes for it, because app.js's scroll guard measures that height. A press goes through scrollOnPurpose, so the window's scroll guard takes it as the reader's own scroll. It scrolls smoothly, or at once under reduced motion, and the button at the end it already reached is aria-disabled. Both buttons are real buttons, reachable by Tab, with a label and tooltip in en, zh, zh-TW, ja and de. They are drawn from the window's tokens in both themes, with no gradient and no coloured edge. scrollends.js is imported on the window's first scroll, so the core scripts carry one line in app.js, paid for by two comments cut from the scroll guard's. No budget was raised. old-webkit lists scrollends.js among the lazy scripts. docs/subsystems/gui-shell.md says where the capsule sits and when it shows. Run on mote at this head (on |
||
|
|
d8a34cbcf6 |
provider: WorkBuddy's mover min is 0.2.14, whose free window is set aside (plugins#641)
XiaoFeiyu9 (plugins#641): a WorkBuddy account paying credits read 99% on deepseek-v4.1-flash's free window at 187.7M tokens, with 937 calls answered and no refusal from WorkBuddy, and magpie routed away from it. The window's 190M was a soft cap measured on two other accounts. Plugin 0.2.14 (plugins eea8c9b) shows the window's sum against 200M, marks it aside so routing never counts it as the allowance, and only WorkBuddy's own 429 refusal makes it 100%. The gateway already rests that model on that account until the refusal's reset. npm has 0.2.14 (npm view --prefer-online). This raises the mover's min so every moved user gets it. Run: go test ./internal/provider -run 'Mover|Moved|Migrat|WorkBuddy|Min' on mote: ok. Plugin: bun test in packages/workbuddy, 314 pass; with the aside taken out, 2 fail. Not tried: a real China-build account; whether a paid account shares the Free plan's window at all is unknown, the refusal decides either way. |
||
|
|
eb8b840dd4 |
claude: a one-off ask's instructions go after Claude Code's system prompt in the interactive mode (#2432)
The interactive mode's helper pastes a run's first message as one text,
without the cache marks renderClaudePrompt puts on it. A one-off ask's
caller instructions were in that message, so Claude Code's auto mode
classifier wrote them to the cache on every check of one conversation:
laozhang713's six checks on one account, no 429, read 1,197 and wrote
83-85k each (#2432; j1374615791-lab saw the same at 125k).
A new interactive run for a one-off ask (no tools, no reply before it,
not lean, no client marks: appendsPrompt) now gets the instructions by
--append-system-prompt-file (append.md, the leanSystem text, the
environment note worded as a lean run's), and its first message holds
the ask alone. Such a run is let go after its reply (ended); it is never
shelved or branched (run.appended), since a session resumed without the
file would have no instructions. Every other run is unchanged.
Run:
- TestClaudeTUIOneOffAskAppendsInstructions and
TestClaudeAppendOnlyForInteractiveOneOffs (tools, reply, -p) on mote.
Broken by hand (appendsPrompt returning false): the first goes red.
- mote: gofmt; go vet ./internal/gateway for darwin, linux and windows;
go test ./internal/gateway -run 'Claude|Lean|TUI|Subscription|Replay|Branch'
ok (65s), at base
|
||
|
|
2c90922b06 |
gui: Picked only with nothing picked picks nothing, and its Save is refused (yuancjun)
yuancjun (#help on Discord) found the provider editor's Picked only, with no model picked, ticked the first 24 models the vendor's list serves (draft.chosen = dashed(), #1818). On a 42-model relay that reads as Select all, and the next Save wrote those 24 down as the picks. Ported from their fork (yuancjun/magpie, fix/legacy-picks-serve-all, 321dfd5c9), with two siblings added. - Picked only with nothing picked now picks nothing (draft.picking), says "Pick a model first." (the words Names & levels already uses, in every language), and draws nothing as served. - Its Save is refused with the same words, in a provider of keys' editor (yuancjun's) and in a subscription's account editor, which draws the same models box (renderModels) and would have saved the vendor's list the same way. - Select none from there is Usage only, and once a model is picked the last unpicked leaves none as before (#1831). - Picks set aside by Vendor's list or Usage only are still given back by Picked only. app.js's comments around the models box were cut to pay for it: the core stays in its budget with no raise. provider-none-picked now checks that Picked only from Usage only ticks nothing, says to pick a model first, refuses the Save (no save request) and that Select none from there is Usage only. provider-best-in-family says Picked only ticks nothing. Run on mote at this commit (rebased on |
||
|
|
952309abcf |
provider: a provider of keys' picks saved before PickedFrom are served as they are (yuancjun)
yuancjun (#help on Discord, magpie web on Linux at v0.1.2679) found that the provider editor saved every model when one was picked, and sent the fix from their fork (yuancjun/magpie, fix/legacy-picks-serve-all, 2d82267d2). Ported here, with the Save side added. withNewlyListed reads picks saved before PickedFrom was kept as "held every model" when they hold every model released up to the newest pick, and adds every model released after it. A pick of one OLD model reads the same way, so every newer model was served beside it, the editor showed them all as picked, and the next Save wrote them all down. With 10 models released 2026-01..10 and "models":["m0"] with no "pickedFrom", Exposed() was 10. PickedFrom is nil too for a provider whose picks were saved before its list was fetched (an import), not only for old ones. - A provider of keys (no Account) with no PickedFrom: its picks are served as they are (yuancjun's change). A subscription keeps the date rule: its list is the catalog's and Select all is a state its editor offers (TestClaudePicksOfEveryModelTakeOnesListedSince). - listedWith: such a provider's next Save keeps the list with its picks, the same picks too (it used to keep was.PickedFrom, nil, so a key provider whose every model was picked before PickedFrom would never be given a model listed later). A subscription's same-picks Save still keeps what it had. Every path that writes picks reads them through Picks(): the GUI editor (PicksOf in /api/providers' chosen), the TUI's model toggles (pages.go). The CLI's `provider set models=` and the importers write the ids given, and their Save goes through listedWith. Users whose picks were already saved as every model can't be told from a real Select all: those picks have PickedFrom kept and are served as saved. They unpick in the editor (Picked only, or Select none, then the models wanted). A provider that showed every model but was never saved since is back to its own picks at once. TestLegacyPicksServeWhatWasPicked (yuancjun's, plus a Save as the editor does it) and TestLegacyPicksOfEveryModelGetPickedFromAtSave. Run on mote at this commit: go test ./internal/provider ./internal/tui ok; go vet GOOS=linux and GOOS=windows ./internal/provider ok; gofmt -l clean. Broken by hand: the Account==nil branch off, the first test is red with all 10 served [m1..m9 m0]; the listedWith change off, both tests are red (PickedFrom [] after the Save; m3 not added). Not tried: a real relay with a real providers.json from before PickedFrom. |
||
|
|
a3768cdd11 |
mcp router: a tool its server no longer lists still goes to that server
A Claude Code session listed Magpie Browser's tools before magpie updated to the one browser tool ( |
||
|
|
17c465375d |
provider: Qoder's mover min is 0.2.54, which sends model_config as Qoder's client builds it (plugins#638)
square-235 (plugins#638): Qoder CN billed magpie's DeepSeek-Flash (dfmodel)
calls as Auto, at Auto's rate; Kimi-K3.1-Pro was billed as itself.
opencode-qoder-auth 0.2.54 (plugins fa144e4) stops sending the model's
whole model-list entry (minimal_version, strategies, prices,
thinking_config) as model_config and sends the trimmed object Qoder's own
client builds (CN CLI 1.1.81, desktop 0.4.3). A model with no key of its
own, or key auto, is refused with a 400, never sent. npm has 0.2.54
(npm view --prefer-online). This raises both Qoder movers' min, so moved
users get it.
Run (mote), at this tree on origin/main
|
||
|
|
95d0c97bf9 |
routing: "Use before expiry" counts credits that expire before the reset (lcyksp)
lcyksp on Discord: the 「重置前用完」 strategy (pace) ranked a WorkBuddy
account by its monthly 500 credits ("积分 0 / 500 · 已用 0% · 28 天后重置").
WorkBuddy spends check-in credits first because they expire sooner
("70.85 积分 将于 2026/11/3 09:28:52 过期"), and the account was ranked as
if nothing would be lost for 28 days.
What changed:
- provider.Allowance.Pace takes a budget window's soonest expiry into
account (Limit.RunsOut, from QuotaWindow.RunsOutAt, which the
WorkBuddy plugin and others set on the credits window). When that
expiry comes before the window's reset, the window's pace is the
higher of:
- what is left per hour until the reset;
- the share that expires (QuotaWindow.RunsOut, now carried as
Limit.RunsOutLeft) per hour until it expires. When the amount isn't
told, all that is left counts. A share is capped at 100%, and the
hours at no less than one.
The account whose credits are lost soonest per hour goes first.
Expiry at or after the reset, or already past, changes nothing.
Zero-config: nothing new to set.
- The trace says DueBy "expiry" when the expiry set the deadline. The
Routing page's reason then reads "Use before expiry: {who} has the most
credits expiring per hour until they expire — {n} of its allowance
expires in {d}."
- Label: "Weekly pace" / 重置前用完 / 週ペース / Wochentempo becomes
"Use before expiry" / 到期前用完 (zh, zh-TW) / 期限前に使い切る /
Vor Ablauf aufbrauchen. Product call: the strategy's goal was always
"lose nothing at the deadline". A reset and an expiry are both such a
deadline, and "到期" covers both, where 「重置」 names only one. The id
stays pace, so saved groups are unchanged.
- The descriptions (Routing, Settings, group editor), docs/reference.md,
docs/subsystems/gateway-routing.md and the site's start page (en, zh,
ja) say the same.
Go, run on mote at base
|
||
|
|
c47fc516a4 |
provider: Tencent Cloud's Token Plan is at tokenhub.tencentmaas.com/plan (ysm119)
ysm119 (Discord) showed Tencent's docs: Token Plan's OpenAI base is now https://tokenhub.tencentmaas.com/plan/v3 and the Anthropic one on tokenhub.tencentmaas.com is the recommended one, with api.lkeap.cloud.tencent.com marked as going away. Tencent's current pages (product/1823/130060 个人版 overview, 130070 Claude Code, 130071 Codex, 130119 quickstart, 136601 CC Switch, all updated 10-15 to 10-22) give 个人版 the same endpoints as 企业版 China (130659): chat/responses at https://tokenhub.tencentmaas.com/plan/v3, messages at https://tokenhub.tencentmaas.com/plan/anthropic, one sk-tp- key for 通用 and Hy plans. - The tencent-cloud preset's plan region (and the preset default) are at those endpoints, with Responses added (Codex's page uses wire_api "responses"). magpie tells regions apart by endpoint, so the personal and China enterprise regions, now one address, are one: "plan", models the union of both lists. "enterprise" stays an alias (regionAliases, RegionID): a key saved on it, an import link with region=enterprise and `region=enterprise` on the CLI land on plan. Singapore 企业版 (enterprise-intl) is unchanged. - A Tencent Cloud provider saved at the old lkeap /plan/v3 or /plan/anthropic is moved to TokenHub at load (moveEndpoints in normalize), and gains the Responses endpoint when it had chat. A Responses address the user set stays. A provider of no preset (a custom one the user typed lkeap into) keeps its address: that is the user's value, and lkeap still answers today. - An app config still at lkeap (Tencent's OpenClaw page, 130062, still gives it) imports as tencent-cloud at the new endpoints. - Usage: DescribeTokenPlan is 企业版's API (api/1823/132270 lists enterprise products only), and Guangzhou's endpoint now serves 个人版 too, so a Guangzhou provider with no SecretId no longer gets the card asking for one (tcSharedRegion); Singapore's still does. The editor shows the optional SecretId/SecretKey at the plan region, so a personal user sees them too. - docs/subsystems/providers-accounts.md says all of this. Run at the pushed head's base |
||
|
|
d29f02d650 |
agent: omp's image role lists magpie's image models (treeman_26897)
treeman_26897 on Discord: omp's ROLES -> IMAGE offered none of magpie's image models. omp's image role takes a model of kind image alone (pi-coding-agent model-roles.ts), and every model magpie wrote to ~/.omp/agent/models.yml was a chat model. magpie's image models (gateway.ImageModels: Settings > Images, as Pi's extension and the magpie-image MCP have them) now go into magpie's provider as kind: image on api openai-images. omp's generate_image posts those to baseUrl + /images/generations (or /images/edits), the gateway's /v1/images (pi-ai images/openai-images.ts). Only for omp 18.7.0 and later, the first whose models.yml takes kind and a runner api; 18.6.3's schema turns the whole file away over openai-images, and an omp whose version isn't known gets none, as ompTakesMax. An image id a chat model already has is left out. With an image model listed, the provider carries the gateway's key (apiKey: magpie) instead of auth: none: generate_image skips a keyless provider's model as "credentials unavailable" (isAuthenticated turns kNoAuth away), while chat goes without one. Without an image model the entry is as before. Run at this head (rebased on |
||
|
|
f3551387c6 |
gateway: a vendor's overload rests no account and climbs no backoff (celestial_eagle_99230)
celestial_eagle_99230 on Discord (v0.1.2670, Codex on auto/gpt-6-sol,
eight ChatGPT Plus accounts, reported several times): every account
showed "休息中 · 529 · 失败 · 10 分钟后恢复", with "它已连续失败 5 次:
休息 10 分钟,每次更久". The request log had the ChatGPT backend's
{"type":"service_unavailable_error","code":"server_is_overloaded",
"message":"Our servers are currently overloaded. Please try again
later."} on /backend-api/codex/responses.
restAfterMarked read the 529 as failOther: the account's own failure,
counted on the backoff ladder (1m, 2m, 4m, 8m, 10m cap). An overload is
the vendor's servers, which every account meets alike, so one spell of
it benched all eight accounts for growing periods and left nothing to
answer.
|
||
|
|
5daba8337b |
provider: zed's mover min is 0.1.15, which sends Zed compaction edits only (nllay, plugins#636)
Claude Code's clear_thinking_20251015 context edit was answered 400 by
Zed's cloud ("unknown variant ..., expected `compact_20260112`"). zed
0.1.15 (plugins 48d0cec) keeps only compact_20260112 edits and leaves
context_management out when none remain. npm has 0.1.15
(npm view --prefer-online). keepMovedCurrent brings every moved Zed
user up to it.
Run on mote at
|
||
|
|
b0174e7615 |
usage: a ChatGPT card says why its allowance can't be read, and a ChatGPT API account says where it shows
hmy on Discord: five ChatGPT accounts each said only "暂时无法获取额度"
(Allowance unavailable). danzi002 on Discord: accounts added through the
API never show usage, ones added as ChatGPT do.
What changed:
- Codex's usage read (codexWindows) now words its failure
(codex_usage_words.go): a Cloudflare challenge names the proxy/VPN
address as the usual cause; any other HTTP answer names its status and
what ChatGPT said; a network error says chatgpt.com couldn't be
reached; a reply magpie can't decode says so. The error still unwraps
to accountStatusError, so expiry and passing logic is unchanged.
- A ChatGPT API account (chatgpt-api) was read as a Codex account: a
saved one said "chatgpt-api accounts can't be used side by side", the
one in use read Codex's own sign-in ("Codex is signed out", or another
account's allowance under its name). OpenAI's API tells no plan usage,
so its row now says so, names chatgpt.com/settings/usage (SeeAt) and
says the same account added as ChatGPT shows it here.
- GUI quotaError translates each of these (en, zh, zh-TW, ja, de), and
"not read yet" (errNotAsked) gets its own words. The generic fallback
now reads "Allowance unavailable — hover for why"; the row's tooltip
has always been the raw error. Comments in app.js were shortened to
stay under TestCoreScriptBudget, which is not raised.
- docs/subsystems/providers-accounts.md describes the words.
Endpoint: the real wham/usage read of the owner's accounts in a sandbox
HOME copy (read-only, ~/.codex untouched) answered 200 and parsed, so
the endpoint itself is not broken; the "error decoding response body"
work is another session's and is not touched here.
Run (on mote; provider and gui again at the pushed head, rebased on
18c69aa46;
|
||
|
|
18c69aa467 |
gui: Windows reads the screens with one callback, not one per display change (1111_13879)
1111_13879 on Discord: on Windows the app died after a few hours with
"fatal error: too many callback functions", taking the gateway with it
(clients got connection refused). Five dumps all ended in
w32.GetAllScreens -> syscall.NewCallback -> runtime.compileCallback,
from Wails' WM_DISPLAYCHANGE handling.
Wails (v3.0.0-beta.24 here; v3.1.0 and v3.2.0-nightly.20261101 are the
same) reads the screens again on every WM_DISPLAYCHANGE, and on
WM_SETTINGCHANGE for SPI_SETWORKAREA, through w32.GetAllScreens, which
passes a fresh closure to syscall.NewCallback each call. Go never frees
a callback and throws past about 2000, unrecoverably.
magpie now sets WndProcInterceptor (screensWndProc): on Wails' hidden
main-thread window ("__wails_hidden_mainthread") it takes those two
messages before Wails does, enumerates the monitors with one callback
made once at package level (allScreens), builds the screens exactly as
Wails' processAndCacheScreens does (wailsScreen) and hands them to
Screen.LayoutScreens, then answers as Wails would (DefWindowProc for
WM_DISPLAYCHANGE, 0 for WM_SETTINGCHANGE). Other windows and messages go
on to Wails. Wails' one read at start-up is the only per-call callback
left. No go.mod change: no newer Wails fixes it, and magpie has no fork.
Other per-call NewCallbacks in Wails' Windows code: w32.EnumChildWindows
and w32.SetWindowsHookEx, neither called by Wails or magpie. WndProc
classes are registered once; the WebView2 COM vtables are package-level.
magpie's own (internal/agent apprestart) is already made once.
Run at this tree (base e156fdd03; origin/main since adds only
|
||
|
|
2251ca1ce9 |
providers: a ChatGPT account's row says when its paid plan ends (danzi002)
danzi002 on Discord (#general, 11-02): 「codex 账号什么是可以加一个 plus 账号到期时间」. The Usage page, the tray panel, the TUI and `magpie quota` have shown "Until …" for the signed-in Codex account since |
||
|
|
e156fdd032 |
usage: a model's region deployment answered under its own name is not a swap (plugins#628)
WorkBuddy AI lists DeepSeek V4.1 Flash as deepseek-v4.1-flash-sg, its paid id for the Singapore deployment. The plugin's product config names it paidId to the free deepseek-v4.1-flash, with one window for both. WorkBuddy answers under the model's own name, so the Routing page tagged each request "请求 deepseek-v4.1-flash-sg · 实际 deepseek-v4.1-flash". Old routes and kept usage rows kept the mark, so removing the model and setting the provider up again didn't clear it (chansee97, plugins#628). - RegionTail (internal/usage/served.go) covers a name that is the other with -sg, -us, -eu, -cn, -intl or -global after it. Such a pair is the same model, and Swapped excludes it. - A region in both names, or a name that differs besides the region, is still a swap. - Kept rows (request_page.go) and kept routes (gateway history.go's routedAgain) are judged again with it, so old marks go too. Run on mote, at |
||
|
|
a32588528f |
provider: WorkBuddy's mover min is 0.2.13, whose free window reads the ledger in linear time (xmoon76)
xmoon76 on Discord: with WorkBuddy on, the bun plugin host sat at 99% CPU and every session hung. Restarting didn't help; turning WorkBuddy off did. The plugin's free-model daily window read magpie's usage ledger in O(n^2), because pinned(chain) ran after every kept row. 16k rows took 10.5 s on each card refresh, all of it on the host's single JS thread, so every plugin's chats waited behind it. workbuddy 0.2.13 (plugins 3167531) pins once per read and takes 14 ms. Raising the min makes keepMovedCurrent bring every moved user to it. npm view --prefer-online --registry https://registry.npmjs.org @magpie-community/opencode-workbuddy-auth version: 0.2.13. Run at this tree on mote (rebased onto |
||
|
|
c51bc9063b |
provider: ZCode's mover min is 0.1.42, which spends a live gift first (sgfvdsg86265 on X)
zcode 0.1.42 (plugins b820704) makes freeFirst the default: a plain GLM model spends the account's live ZCode gift first and falls back to the coding plan. "freeFirst": false in the plugin's or the provider's options keeps the plan first, as before. Raising the min updates every moved user's plugin (keepMovedCurrent). npm view @magpie-community/opencode-zcode-auth version --prefer-online: 0.1.42 when this landed. Run on mote: go test ./internal/provider -run 'Mover|Moved|Min|ZCode' ok; gofmt -l clean. Not tried: a real account with a claimed gift. |
||
|
|
9c58c87e8f |
provider: Qoder CN mover min 0.2.53, enterprise dedicated domain sign-in
Milktea (Discord) signs in to Qoder CN on a dedicated domain (https://<corp>.rdc.aliyuncs.com) through the IDE's 「企业版专属域登录」; the plugin's VPC sign-in failed for it. opencode-qoder-auth 0.2.53 (plugins 7312770) adds "Sign in with Qoder CN Enterprise dedicated domain", read from Qoder IDE 1.38.0's bundle: it probes <domain>/algo/api/v1/version (404 = Lingma 1.0, refused with what it is; anything else = Qoder CN 2.0), then runs the VPC device flow against the -openapi host with the dedicated client id, and chats on the -gateway host (the origin when that host doesn't answer). npm has 0.2.53. This raises the mover's min so moved users get it. Run: - plugins: bun test packages/qoder (355 pass, 0 fail, 10 new dedicated tests on a fake server), bun scripts/check.mjs ok. - magpie: go vet + go test -count=1 ./internal/provider on mote: ok (125s). gofmt -l clean. Broken by hand: - TestQoderCNMoverHasTheDedicatedDomainSignIn red with min 0.2.52. - plugin: disabling the dedicated branch, the 404 check and the origin fallback turned 4 of the 10 dedicated tests red. Not tried: any real dedicated-domain account; the chat host (-gateway) is inferred from the IDE's experts-center rule, not seen in a capture. The Lingma 1.0 dedicated path (cosy's login flow) is not implemented. Thanks to Milktea on Discord for the report. |
||
|
|
07dc0b4ec1 |
usage: an agy following the Antigravity app's gateway is counted once (Chamberlain_zyz on X)
An agy not connected on its own row follows the Antigravity app's
gateway, with the app's key (internal/agent/antigravity.go), so the
gateway records its calls as the app's ("antigravity"). Its transcript's
steps were matched only to records of agent "agy", so each one was
counted twice: Chamberlain_zyz's 17:00 hour showed Antigravity
39,104,506 and Antigravity CLI 38,562,861 tokens for the same calls.
agyGateway takes the app's session-less records too, at all three places
that matched agy's alone: the gateway side of the match key, the chunk
hints that pick which transcripts to open, and matchingRecords. The
match is still by exact tokens and time, so an app call of its own is
paired with an agy step only if both counted the same tokens within the
step's window. It is worked out when usage is read, so hours already
recorded are counted once too, for every user, with nothing to redo.
Run (mote, this tree):
- go test -count=1 -run Agy ./internal/usage: ok.
- Broken by hand (agyGateway back to "agy" alone):
TestAgyStepThroughTheAppsGatewayCountedOnce and
TestMatchOpensAgyChunksForTheApp fail; restored, ok.
- go test -count=1 ./internal/usage ./internal/sessions: both ok.
- go vet ./internal/usage, and with GOOS=linux and GOOS=windows: ok.
- The whole suite was not run: only these two packages are touched.
Not tried: a real agy through a real Antigravity app's gateway; the
reporter's case is taken from their screenshots and the app's wiring.
|
||
|
|
5f0a84a003 |
agent: Air in JetBrains IDEs gets magpie's Magpie agent in ~/.jetbrains/acp.json (Jumy on Discord)
Jumy asked for the "air-plugin" new in IntelliJ IDEA 2026.3 (Settings ›
AI › Air). magpie's air agent wrote the Air app's acp.json, in
~/Library/Application Support/JetBrains/Air, which the IDE plugin never
reads: the plugin (com.intellij.air, air-plugin-262.8665.521-mac-arm64
from JetBrains Marketplace) loads its custom ACP agents in
AcpConfigurationLoader (intellij.air.backend.acp.runtime) from
user.home/.jetbrains/acp.json on every system, the file AI Assistant's
custom agents use too; AgentServerConfig takes command, args, env,
use_idea_mcp and use_custom_mcp. The standalone app (Air-262.1037.14,
Fleet-based) reads acp.json from its own configs folder
(genericAcpConfigPath), so the two are separate files.
Air's own agents have no base URL: JetBrains AI, the agent's own login,
or an Anthropic, OpenAI, Gemini or OpenRouter key under AI › Air ›
Accounts. So the IDE gets the same route as the app: a new air-ide agent
("Air (JetBrains IDEs)", aliases air-plugin, air-in-ides) writes a
Magpie entry (opencode acp, OPENCODE_CONFIG naming magpie-opencode.json
beside acp.json) and nothing else; the user's agents and
default_mcp_settings stay, and disconnecting takes out that entry and
that file. air and air-ide share airAt. air-ide shows for an IDE config
folder of 2026.2 or later (the plugin is bundled from 2026.3), or with
its entry already in acp.json. Notice in en, zh, zh-TW, ja, de; README,
reference and agent-wiring rows.
Run at this head (rebased on
|
||
|
|
ed978e560f |
gui: the Quit question's Don't ask again, and Settings › General › Ask before quitting (zhujiu on Discord)
zhujiu (Discord #feedback) asked for a 不再提示 on the question a tray Quit asks while agents go through magpie ( |
||
|
|
b58669eb09 |
gateway: an overload told in Codex's stream says server_is_overloaded (wjh66)
wjh66 on Discord (Windows, v0.1.2710, Codex on the ChatGPT sign-in, gpt-6.1-sol): every turn showed "reconnecting 5/5", and app.log had the backend's "Our servers are currently overloaded" again and again. With one ChatGPT account, magpie asks an overloaded turn again (lastRetries) and keeps Codex alive past keepHeldAfter with the stream's 200 and comments. When the retries ran out, the backend's busy status (529, or a 503 saying overloaded) went to Codex in that stream as response.failed with code server_error. Codex reads server_error as Retryable (codex-rs codex-api sse/responses_error.rs) and sent the turn five more times, each one asked three times by magpie: 18 asks of an overloaded model, then the last error alone. The backend itself says an overload in a stream as server_is_overloaded (#1418), which Codex reads as ServerOverloaded: "Selected model is at capacity. Please try a different model.", without the reconnects. streamError now gives a Responses client server_is_overloaded when the status is 529, or a 5xx whose words say overloaded (saidOverloaded). Other failures keep server_error, which Codex retries. A routing group or the codex subscription's fallbacks still take an overload before any of this, as before. This does not explain the earlier "error decoding response body". Codex says that only when the body of a 2xx fails to read. magpie's streams read clean over real TCP in every overload shape tried (see |
||
|
|
f95bacdfba |
gui tests: agent-panel-name-width's lists tick two models, as menuSaid names them (#4203)
The fixture gave WorkBuddy's and Claude Desktop's lists `shown`/`total`, but /api/state counts them as `listed`, and since |
||
|
|
c99901765b |
gui: one provider of an agent's own is said in the singular (Renzexi01 on X)
Renzexi01's screenshot of the Agents page had MiMo Code's row reading "Not connected · now has 1 providers of its own". With one, the row now says "now has 1 provider of its own"; with more, as before. The singular is translated in zh, zh-TW, ja and de. Two comments in app.js are cut so the core stays in its budget, with no raise. Run on mote (macOS 27, Playwright 1.62.0): - agent-own-providers.test.cjs (new): chromium and webkit, en, zh, zh-TW, ja, de, 980 and 420px; 20/20. On origin/main's app.js it is red: "Not connected · now has 1 providers of its own". - At the pushed tree (this commit and the next, on origin/main |
||
|
|
58a833f254 |
mcp router: initialize says what each server behind it is and does
packinggoodsllc_07668 (Discord) runs magpies that only share MCP servers,
and an agent given several routers knew each by its name alone. A
router's initialize instructions now describe what it holds, built from
what the servers themselves say; no model writes any of it.
- After the "Tools of …" first line (and the router's name sentence when
it has one), a line per server: "- name (its serverInfo.title): what it
is for. Tools: tool (first clause of its description), …". The tools
the Library turned off are left out; another router's "[name] " prefix
is dropped. A line too long for its share says tools by name, then as
many as fit and "and N more". The whole is at most 2000 characters
(hubSayMax), the closing text kept whole.
- What a server is for: the market's words as before, else its
serverInfo.description, else its instructions' first line (saysOf).
Another magpie's "Tools of a (…), b." is said with "Tools of" once.
- What a server said and listed is kept in settings.Dir()/
mcp-hub-servers.json (not the synced library folder), keyed by name and
a hash of hubKey, written via temp+rename only on change, pruned of
servers gone. A router started again describes its servers without
starting any; one added or edited since is listed by initialize, which
waits up to 5s for it.
- Pi's hub description (hubAbouts) uses the server's own words too.
Agents, from their installed source (research, not run): Claude Code
shows instructions (4096 chars), Codex as the namespace description,
OpenCode, Gemini CLI (trusted folders only), Qwen Code, Pi (first line in
the prompt); Kimi CLI ignores them. None shows serverInfo.title.
Run at this tree (mote):
- go test -tags nogui ./internal/library: ok (116s)
- go test ./internal/gateway -run 'Hub|MCP|Roots|OversizedBody|
ReadOnlyKeyEveryRoute|FileURI|ImageModel': ok
- GOOS=linux and GOOS=windows go vet internal/gateway internal/library;
go vet internal/gui internal/cli; go build ./...; gofmt -l: clean
- New: TestHubInstructionsDescribeServers, TestHubDescriptionsOutlive
ARestart (library); TestHubAboutBounded, TestHubServerLine,
TestHubClauseBrackets, TestHubLineOfARouter (gateway).
- Red on the old code: TestHubInstructionsDescribeServers at
|
||
|
|
1cb4d43013 |
profiles: a saved profile renames, in its details, the TUI and magpie rename (#2721, erlinerd)
erlinerd's patch on #2721 (profile.Rename, /api/state profile/rename, a Rename button in the details), reviewed against main and adapted: - profile.Rename trims both names, refuses an empty, taken or missing name and leaves profiles.json as it was, renames by case only (home -> Home), and keeps what the profile holds. - GUI: Rename turns the details' name into a field. Enter renames through profileAction, so the chip is renamed at once, pending, and rolled back with the error if magpie refuses; the details stay open under the new name, with In use kept. Escape or a click away puts the name back. The field lives in profilerename.js, imported on press, so the core script stays under its budget (no raise; 50 bytes under after comments in app.js were cut). While the field is open In use, Apply and Rename hide so a 360px panel's field has room. - TUI: ctrl+e on a profile renames it on the name line. - CLI: `magpie rename <old> <new>`; a flag is never taken for a name. - WebDAV: a rename syncs as the old name gone and the new one in (davsync test). Run on mote at 47672f11c (on |
||
|
|
ea51526b69 |
provider: WorkBuddy's mover min is 0.2.12, the China build's free-model window (plugins #625)
workbuddy 0.2.12 (kunghim's plugins #625, the open half of #288) shows a WorkBuddy (China) account's free-model daily token window, about 200M tokens a day as kunghim measured on two Free-plan accounts, kept apart from WorkBuddy AI's 100M one, and reads the China refusal's "将在 … UTC+8 重置" as its reset. npm has 0.2.12 (npm view --prefer-online, registry.npmjs.org). keepMovedCurrent updates every moved user's plugin to it. Run at origin/main |
||
|
|
7c2442b425 |
provider: Devin's mover min is 0.1.34, so pings follow their request and a grown permission check keeps one key (plugins #626, #620)
devin 0.1.34 (plugins 4c801e5, on npm) times each cache keepalive ping from when the request before it was sent, not from when its reply ended, so a slow reply's first ping no longer lands past the 5-minute cache (#626), and keys a permission check by the session and subagent magpie now tells it (#620). Both reported by zelong77. keepMovedCurrent brings every moved user's plugin up to it. Run at origin/main |
||
|
|
a00b53f7b1 |
gateway: a plugin's fetch is told the session the agent named and its Claude Code subagent (plugins#620)
magpie builds each plugin's request itself, so the agent's own headers (x-claude-code-session-id, x-claude-code-agent-id, x-opencode-session) never reached a plugin. Devin's cache keepalive therefore keyed Claude Code Auto's permission check by its text alone, and on the translated path magpie merges consecutive same-role messages, so a check whose history grew changed its first message in the middle and got a new key: its older pings kept running beside the new ones (zelong77, plugins#620, still seen on devin 0.1.33). forwardOnce now sets X-Magpie-Session (sessionOf: the caller's own X-Magpie-Session, else the agent's session header) and X-Magpie-Subagent (Claude Code's agent id) on a plugin's request, after deleting any the caller sent, and host.js's MAGPIE_ONLY list strips both from what the plugin sends on, so the vendor never gets them. A request naming no session has neither. devin 0.1.34 keys its pings by them. docs/subsystems/provider-plugins.md says so. Run at origin/main |
||
|
|
9f641daeab |
codex: a turn stuck on a used-up account no longer holds the Codex app's Send grey after a switch by hand or magpie's takeover (xiaoq6285)
xiaoq6285 on Discord (v0.1.2700): Codex on an official ChatGPT account ran out of quota, and after switching to another account or provider in magpie, the Codex app's Send button stayed grey. magpie has no chat composer of its own; the button is the Codex app's, which greys Send for every model while the app-server it runs is on a ChatGPT account the app holds. magpie lifts that by restarting the app's app-server (codexAppStep), but never while a Codex turn is open in its sessions, for up to codexTurnWindow (30m). When quota runs out mid-turn the turn is left open, so the restart, and the grey, waited. |
||
|
|
52195b6b07 |
backup: the setup is backed up into a folder by itself, and any version put back (jwaitq)
jwaitq (Discord) nearly lost their setup on Windows and got it back only
from a Downloads\data folder they happened to have. They asked for
backups made on a schedule into a folder, with a version to go back to.
What changed
- internal/backup/auto.go: Settings › Sync › "Back up by itself". On by
default: once every 24 hours, the last 7 kept, into
<config dir>/auto-backups. Interval (1 hour, 6 hours, 1 day, 1 week, or Off), keep (3,
7, 14, 30) and the folder are the user's to change. autobackup.json holds
only what the user set; a field they never touched follows the default,
so a later default never overrides their own value. An unreadable
autobackup.json makes no backup and says so, never "off" or a default.
- What goes in is the export without API keys (backup.Collect(false)),
the same bundle and the same handling of secrets as the manual no-keys
export, with the proxy URL blanked as well (it can carry a password).
Not sealed, so it opens without a passphrase. Files are 0600 in a 0700
folder, written to a temp file, fsynced and renamed, and listed only
when they parse and their sha256 matches, so a half-written file is
never a version. A temp file over an hour old is removed.
- A backup is made only when the setup changed since the newest one, so
a quiet week keeps a week of versions, not seven copies of one day.
The loop runs inside the gateway (WhileServing), first 2 minutes after
launch, then every 10 minutes it checks whether one is due by the
newest file's time, so a restart doesn't make an extra one.
- Restore puts a version back the way Import does (additive), after
first writing the current setup as a "-restore" backup. If that
backup can't be written, nothing is put back. The row says when the
undo copy was made, and restoring it undoes the restore. "-restore"
backups are pruned past Keep like the rest.
- internal/gui/backup.go: GET /api/autobackup and POST
/api/autobackup/{set,choose,now,reveal,restore}. internal/cli
settings_parity_test names the two routes in notYet (S2).
- GUI: autobackup.js, imported lazily when Sync is drawn, so app.js and
the core budget are not raised. The app's own segmented controls and
menus (no <select>), the folder row with Change…/Show/Default, Back up
now, and the versions list with Restore behind a confirm. Strings in
en, zh, zh-TW, ja, de (22 keys each).
- docs/subsystems/sync-backup.md: "Backups by themselves".
- Tests touched beside it: sync-sign-in's "last row" is now the last of
Sync's own rows (the new rows come after Import); usage-computers
scrolls its tick to the middle, since in WebKit the sticky Settings
tabs covered it at the page's end; agent-prefs waits for Settings'
first draw instead of reading the static index.html's rows.
Tests
- internal/backup/auto_test.go: TestAutoBackupOnSchedule (injected
clock, no sleeps), TestAutoBackupAfterRestartWaits,
TestAutoBackupOffOrUnreadable, TestAutoBackupPrunes,
TestAutoBackupHoldsNoSecrets, TestAutoRestoreRoundTripAndUndo,
TestAutoRestoreNeedsTheBackupFirst, TestAutoHalfWrittenNeverListed.
- internal/gui/backup_test.go: TestAutoBackupRoutes.
- internal/gui/tests/auto-backup.test.cjs: chromium and webkit, 1100px
and 420px, en/zh/zh-TW/ja/de; plus "Sync redrawn while the backups are
being read still shows them", which found a real bug (the rows were
dropped when Sync redrew during the first read) and is red on the old
code.
Broken by hand, each test red, then put back: dedup off (OnSchedule),
interval check off (OnSchedule, AfterRestartWaits), keep+1
(Prunes), proxy left in (HoldsNoSecrets), no backup before a restore
(RoundTripAndUndo), restore going on after a failed backup
(NeedsTheBackupFirst), unreadable config read as default
(OffOrUnreadable), checksum not checked (HalfWrittenNeverListed),
os.Rename without the temp step (HalfWrittenNeverListed). And the
redraw fix, reverted: the redraw GUI test red in both engines.
Run on mote (macOS 27) at this change on c9af34446; rebased then onto
|
||
|
|
70b96126ef |
gui: a provider's editor grows with a large window (5046312 on Discord)
5046312 on Discord: in a large, wide window the provider editor (Codex's, with its accounts, meters, cap pill, switches and many option rows) stayed a 600px box in the middle, cramped, and asked for a better layout or a resizable sheet. drawEditor's editor now carries `roomy`, and openModal copies it onto #modal's dialog as it already did `wide`. `.modal .dialog.roomy` is min(max(600px, 56vw), 880px, 100%): 600 up to a 1071px window, then 56% of it, at most 880, as a Mac sheet takes the room its content needs. Its height already follows the content up to the window, so no new height rule. A question that takes the editor's place in the same dialog (Sign out's forget-ask, Disconnect, ...) drops the class and stays 600. No drag handle. The rows themselves are unchanged. Every provider editor (subscriptions, keys, new providers, presets) goes through drawEditor. The core-script budget is not raised (7 bytes under). Sizes (chromium, en; width x height of the dialog): window before after 2560x1440 600 x 1228 880 x 1038.5 1440x900 600 x 810 806.4 x 810 1100x800 600 616 1024x768 600 600 560x420 512 512 390 web 374 374 Run at the pushed tree (this commit on 019b308f1; the whole-suite runs below at earlier bases, editor-roomy, i18n-keys and the budget tests again at |
||
|
|
019b308f1a |
provider: one key added again for another API of the same host is a provider of its own (#3388)
energetic_wolf_99424 (Discord #help) has one relay key that works in both the OpenAI and the Anthropic format. They added a custom provider with it in one format; adding a second custom provider with the same key in the other format was refused with "<name> is already added with that key". The same refusal blocked OpenCode Go beside OpenCode Zen with one account's key (#3388, found by ggbdpq, verified by Edward4226). Add's duplicate check (add in provider.go) used sameProvider, which judges by key + host + headers only. It now also needs servesAll: the new provider brings no API, and no address of one, that the provider already there lacks (Chat, Responses, Anthropic and Gemini compared slot by slot after normalize). So the same key at the same addresses is still refused as the one already here, and another format, or another product path on the host, is added under its own id. The GUI, the CLI (`magpie provider add`) and the TUI all go through provider.Add, so all three are covered. AddCopy never had the check. Two providers sharing one key already existed (AddCopy, another host), so nothing keyed by the key (KeyID, usage by provider id, resting) meets a new state. Not changed: the app import still calls an entry "Already added" when the provider there has the key at that host, even if the entry brings an API it lacks; filed as #4904. Run at this head (rebased on |
||
|
|
c9af344466 |
codex: the Codex app's model list follows the account Codex is signed in to
chzbz on X: a ChatGPT 20x (Pro) account added and switched to, and GPT-6.1 Sol never showed in the Codex app's picker; ~/.codex/magpie-desktop-models.json didn't update. The backend's list for the Codex app (CodexDesktopCatalog) was kept for an hour whatever account Codex was signed in to, and a Pro account lists models a Plus one doesn't. After a switch the sync wrote the other account's list again, for up to an hour. The kept list now names its sign-in (provider.CodexSignInWho: the account and its plan); on another one it isn't handed out, the backend is asked at once, and the file is written again once it answers. A switch made while an ask is under way is told as a change, so the next look asks about the new account. Run (mote): go test -run 'TestCodexDesktop|Revoked' ./internal/gateway ok. Broken by hand: with the sign-in check off (mine := true), TestCodexDesktopCatalogFollowsTheSignIn is red (the Plus list handed out as the Pro account's). go vet of ./internal/gateway ./internal/provider on darwin, GOOS=linux and GOOS=windows: clean. go test -count=1 ./internal/provider ./internal/gateway (mote): provider ok; gateway red only on TestCodexPoolSaysTheClientsVersion, #4807 (a newer Codex version known on mote, 0.165.0 over the test's 0.161.0), code this change doesn't touch. Not tried: a real Plus to Pro switch with the Codex app open. |
||
|
|
1829cd52ff |
sessions: a poll while a session grows makes only the rows it shows
VeryBTC on X (tweet 2117104179454091396) reported RSS that rises and
stays up while the window is open and a long-context session is active.
In that case every Sessions poll sees a changed file and rebuilds the
list. That rebuild copied every gateway-only session three times
(GatewaySessions, listedGateway, gatewayListed) and made each one a
Session row before EachMerged stopped at its 5000-row limit. It also
made every Claude Code file's path and key again.
- usage.EachGatewaySession walks the projection without copying it.
gui's listedExternal stops at the list's limit and skips hidden
sessions and sessions without an agent or id, as listedGateway did.
- sessions.EachMerged sorts indexes and makes a row only when the merge
reaches it. The order is unchanged: newest first, stable on ties.
- listCCFiles reuses the last listing's path and key strings while a
folder lists the same names. One file new or gone is stepped over.
This holds ~32 B per file (~480 KB at 15k files), and the strings are
shared with the listing it already held.
- page_memory.go's ~330 MB comment now has current numbers.
gateway-sessions.md describes the lazy rows.
Per poll, on mote (go test probe through the real /api/sessions
handler, TotalAlloc):
15k sessions x 10 turns, 400k ledger rows
after a session file grows 150.6 MB, 201 ms -> 109.9 MB, 170 ms
unchanged (warm) 17.2 MB -> 12.0 MB
3k sessions x 40 turns, 150k rows (no gateway-only rows past the cap)
after a session file grows 31.3 MB -> 29.6 MB
unchanged (warm) 4.5 MB -> 3.4 MB
/api/usage is unchanged at 0.4 MB.
Tests:
- TestSessionsListMakesOnlyTheGatewayRowsItShows (gui) uses 3 natives,
6000 gateway sessions in tied pairs, one hidden and one carrying a
native's id. At limits 5, 40 and 6010, and with no limit, the rows
equal the old pipeline's (listedGateway + gatewayListed +
MergeExternal) after the JSON round trip. A grown native comes first
with its new Last. The poll's allocation stays under 6000 rows' size.
- TestEachMergedMakesOnlyTheRowsItReaches (sessions): 15000 externals
and 20 rows give MergeExternal's first 20, with allocation under a
tenth of the rows.
- TestCCListingKeepsItsNames (sessions): a second listing of 3000 files
is equal to the first, in at most 3n mallocs. A file added, files
removed, and a folder gone with another new each list as a fresh
listing does. Another agent's keys keep their own prefix.
Broken by hand, each red:
- EachMerged building every row first: 8.8 MB, the sessions test fails.
- The GUI handler back on the listedGateway(GatewaySessions) loop, with
the lazy merge kept: 13.7 MB, the gui test fails.
- The gui test on origin/main's code: 23 MB, fails.
- The ccNames reuse turned off: 12197 mallocs, the listing test fails.
Run on mote (mote-run) at 73a1b8769, rebased on origin/main
|
||
|
|
07f4d46c52 |
gateway: a Codex reply that ends early, and any failed call, is written to app.log
wjh66 (Discord, Windows, v0.1.2696) saw Codex on a ChatGPT sign-in with
gpt-6.1-sol show "reconnecting 5/5" and then `error decoding response
body`, and app.log around 15:27 held nothing about it. That text is
reqwest's for any read error in a body (a reset, a chunk cut short, a
timeout), so it says the connection broke mid-reply, not which side broke
it. The cause is not found; this change only makes the next report carry
evidence.
- record logs a failed call (status >= 400 or an error) when debug is off,
once a minute per agent/provider/model/status/error, counting repeats.
- codexUpstream logs a reply that ended before its last event (or a
non-SSE body cut by a read or write error): bytes passed on, whether
OpenAI's stream failed or ended, and whether Codex went away, a write
to it failed, or it was told response.failed.
- Shutdown with requests in flight says they are cut (Windows has no
handover, so a quit or update cuts streams after shortDrain).
Run at this head (rebased on 4bd0d6f38; the new and stream-cut tests and vet run again after the rebase on mote and Windows, the full gateway run on Linux was at
|
||
|
|
881c9f28a4 |
gui: an open picker follows a resize by its button, and closes once the button is out of sight (#1134, emo172)
emo172 opened the Agents page's model picker in a full-screen window and left full screen: the picker stayed at the coordinates it was opened at, half of it past the window's right edge. #pop is position: fixed and openPicker placed it once (placePop), with nothing on resize, where every other menu either closes (closeAgentModels, closeAgentMenu, closeProtoMenu) or is placed again (placeProfiles). As planned on the issue: a resize places the open picker again by its button, at the sizes it was opened with (pickSize, now shared by openPicker), and closes it when the button is gone or out of sight. The Agents row moves for a few frames after a resize (its wrap animates), so placing it only at the resize event left it ~17px off the button's final place; followPick places it again each frame the button moves, and stops nine frames after it stays put. On a touch screen it only moves, so a keyboard opening over the button never closes the list being typed in. placePop has one caller, openPicker, so every picker that uses it (model, effort, menus of a field) gets this. Four long comments in openPicker and holdPop were cut to pay for it: app.js is 91 bytes smaller. Test: picker-follows-resize (chromium + webkit, en + zh) opens the model picker at 1440x800, narrows to 840 (the issue's numbers), waits for the pop to rest by its button inside the window and to stay there after the row's animations end, then makes the window too short for the button and sees it close. Run on mote at this head: picker-follows-resize 6/6; every GUI file that opens #pop (60 files, chromium + webkit) 760 pass, 10 fail, all mobile-web's "desktop matches origin/main", which reads its baseline through git and mote-run's copy has no .git (page.goto fails before any check); TestCoreScriptBudget ok. Broken by hand: without the resize listener, red (pop left 942 in an 840 window, the issue's case); placing once at the resize without following frames, red in zh (top 141.5 under a button whose bottom settled at 119). Not tried: a real full-screen exit in the app's window on Windows (the reporter's) or macOS; a phone keyboard. |
||
|
|
02727188a4 |
gateway: a Zen free model asked on OpenCode Go is asked at Zen's free tier, else the refusal says where it is served (51bit.eth)
51bit.eth (Discord #general) ran Claude Code through magpie with OpenCode's free models on a provider named OpenCode Go (opencode.ai/zen/go). Every request failed "400 OpenCode Go: Upstream request failed: Model is unavailable.", and a header of their own (x-opencode-session) didn't help. The same models worked in OpenCode. Cause: OpenCode's two gateways serve different free models. Zen's free tier (/zen, the public key) serves the -free models and big-pickle; Go (/zen/go, a Go key) serves only beam-free and iceman-contributor-free (its /models on 2026-11-02). Go answers any model it doesn't serve 400 "Model is unavailable." before it reads the key. A user ends up with a Zen free model under Go by typing it, or because a Go key /models refuses makes the provider list models.dev's opencode-go catalog, which names free models Go doesn't serve (#4900, not changed here). What changed: - provider.RetryOpenCodeFreeOnZen, called in forwardOnce for OpenCode URLs beside RetryZhipuCoding: a 400 "Model is unavailable" from Go for a model OpenCodeFree calls free is asked once more at Zen's free tier on the same API (openCodeGoToZenFree: /zen/go/v1/... and /inference/go/... to OpenCodeFreeURL's /inference/openai|anthropic), with the public key in Authorization (and x-api-key on Anthropic), never the user's Go key. Zen's 2xx is returned as is. - Refused at Zen too, Go's 400 keeps its words and adds what Zen said and where the model is served: under the OpenCode Zen provider, which needs no key. A model that isn't free isn't asked at Zen; its 400 says to pick one the OpenCode Go provider lists. - docs/subsystems/providers-accounts.md: a row beside the GLM Coding Plan one. Run (mote, through mote-run): - go test ./internal/provider -run 'OpenCode|Zen' and ./internal/gateway -run 'OpenCodeGo|ZenFree': ok, at the pushed head after the rebase too. - gofmt -l: clean. GOOS=linux and GOOS=windows go vet ./internal/provider ./internal/gateway: ok. - go test ./internal/provider -count=1 -timeout 45m: ok (113.9s). go test ./internal/gateway -count=1 -timeout 45m: one red, TestCodexPoolSaysTheClientsVersion, which is #4807 (open, red in full runs on mote; this change touches no Codex path). Output added there. - Real: a built magpie serve on mote, sandbox HOME, port 3591, an opencode-go provider with a made-up key, Claude Code-shaped /v1/messages: - deepseek-v4.1-flash-free (Zen's): Go 400, then asked at /inference/openai/v1/chat/completions with the public key; Zen answered 429 FreeUsageLimitError (#3491), and the message names both and the OpenCode Zen provider. - cat-jam-free (in the catalog, served by neither): Go 400, Zen 400, message says where. - glm-5.3 (Go's, paid): "Invalid credential" as before, Zen not asked. Broken by hand: - Retry call removed from forwardOnce: TestOpenCodeGoFreeModelAskedAtZen and TestOpenCodeGoUnavailableSaysWhere red (old message, one request). - Key swap removed: TestOpenCodeGoFreeModelAskedAtZen red, Zen asked with "Bearer sk-go-users-own". Not tried: - A working Go key (the owner's is expired), so beam-free on Go end to end is only the fake. - A Zen free reply end to end: from mote Zen's free tier answers 429 FreeUsageLimitError to magpie with the built-in OpenCode Zen provider too (#3491). - Gemini protocol: not asked at Zen (OpenCode has no Gemini free URL). |
||
|
|
4bd0d6f389 |
gateway: a provider whose model asks for a tool turn's thinking back, under a name that doesn't say DeepSeek, is asked again with it and sent it from then on (qisishiqi)
qisishiqi (Discord #help): a routing group fell from a rate-limited Codex subscription to "My Claude", an Anthropic-format endpoint, and the request failed 400 "My Claude: The `content[].thinking` in the thinking mode must be passed back to the API." That is DeepSeek's model refusing a tool loop continued without the thinking of its tool turn. magpie fills those turns (a space, or the turn's readable reasoning) only when the host or the model names DeepSeek (anthropicReplaysThinking, chatReplaysReasoning, #1462/#1611). A relay serving DeepSeek under another name, or a model the user named otherwise, got nothing, and Codex's sealed reasoning has no text to give. Now forward reads a 400 on Messages or Chat whose words are DeepSeek's (thinkingBackRefusal: `content[].thinking` / `reasoning_content` ... in the thinking mode must be passed back), and when filling the tool turns (withThinkingOnToolTurns / withReasoningOnToolTurns) changes the body, remembers the provider's model (unfit, thinkingBackNeeded) and asks once more; forwardOnce fills them for it from then on, every route alike. A provider that never asked is sent the conversation as before. Scoped to the vendor's refusal, not to every Anthropic endpoint. Checked against api.deepseek.com with the owner's key, 2026-11-02 (deepseek-flash, Messages and Chat): a tool turn of the loop being continued with no thinking is refused with exactly these words (the test fixtures are those bytes); a space thinking block or reasoning_content " " is taken; readable unsigned thinking is taken; finished tool turns and plain replies without thinking are taken, with or without tools; thinking disabled takes it all. So DeepSeek's docs' "even for turns without a tool call" is not enforced today, and the existing tool-turn rule stands. Sibling: the Chat side had the same name-only gate, and gets the same learned fill (TestReasoningBackLearnedBehindAnotherName). Responses (reasoning_text) is filled by model name on any host already. Run at this head on mote: - go test ./internal/gateway -count=1 -timeout 45m: every test ok but TestCodexPoolSaysTheClientsVersion, #4807 (red in a full run, passes alone; passed 5 of 5 alone here). Not touched by this change. - GOOS=linux and GOOS=windows go vet ./internal/gateway: ok. gofmt -l: clean. - New: TestThinkingBackRefusalRead (the live bytes and qisishiqi's literal error read; Responses' reasoning_text and a bound-signature refusal not), TestThinkingBackLearnedBehindAnotherName (Codex request mid loop, group: 429 on the Responses member, then "My Claude" with claude-sonnet-4-6 and relay-model: 200 on the second ask with a space thinking block first, next turn 200 on the first ask, another provider sent no thinking), TestReasoningBackLearnedBehindAnotherName. Broken by hand: with the retry in forward off, all three cases go red with qisishiqi's error ("400 after 1 calls ... My Claude: The `content[].thinking` ..."); with the learned fill in forwardOnce off, the second turn is refused again ("400 after 2 calls"). Not tried: qisishiqi's own provider (its host and model are unknown); a real relay in front of DeepSeek; a plugin provider's fetch path. |