f37742e14d112aee9cd04a03fcac741bc08d4eac
1680
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f37742e14d |
agent: a used-up ChatGPT account magpie can't serve past leaves the Codex app on its sign-in (xiaoq6285)
xiaoq6285 on Discord (magpie 0.1.2798, the Windows Codex app, one ChatGPT Plus account, Codex on its own model joined beside the sign-in): at the five-hour limit the app showed an error and had to be restarted, then its account menu showed only "magpie" with no quota; at the reset it restarted by itself and the account came back. Cause. When the active account was held (used up, no credits), Sync's own-model takeover made magpie Codex's provider on codex/<model> whenever magpie's catalog listed that model on any Codex account -- the same used-up one included. With one account and no fallback every turn it took over is refused on that account anyway, while the takeover: - has account/read answer no account, so the menu drops the user, Plus and the usage meter until the reset; - changes the route twice (into it, back at the reset), and KeepCodexAppOnItsProvider ends the app's app-server each time, which ChatGPT desktop 26.1027.x shows as "ChatGPT 遇到了问题" and relaunches (#4550, still open, the app's own reaction to an ended app-server). Separately, magpie's [model_providers.magpie] requires_openai_auth follows the account out and back (openaiAuth), and codexAppRoute counted it even when that table was not Codex's model_provider, so staying beside the sign-in would still have ended the app-server at the limit and at the reset. Change. - provider.CodexServesWhileOut(model): the Codex subscription has fallbacks for codex/<model> (FallbackModels), or another ChatGPT account is not known held and not lapsed. - Sync's own-model takeover runs only when that holds. Otherwise Codex stays on its sign-in: the app keeps the account, its quota and reset, and shows its own limit message. With a fallback set it moves as before ( |
||
|
|
e41ef6288c |
providers: a spend cap on an API key, per day, month or in all (sparkling_lemur_62868)
sparkling_lemur_62868 on Discord: a team's OpenAI key holds granted credits that other docker services spend from too, and they want magpie to stop at a share of it. Their workaround was two magpies behind a gateway-key limit. What changed - provider: KeySpendCaps on a provider, keyed by the key's fingerprint (key_spend.go): USD over a local calendar day, a local calendar month, or in all since it was set. Since is kept while the cap stays one in all. SetKeySpendCap and ParseSpendCap refuse an amount outside 0 < usd <= 1,000,000 and an unknown period, and leave the saved cap as it was. Subscriptions are refused, since an account has its own usage-window cap. - usage: KeySpent(keyID, start) is what magpie's own calls on the key cost at the Usage page's prices. Turned-away calls and app-reported ones are left out. It reads usage.jsonl once per key and start, keeps the sum for 5 minutes, and Append counts each new call into it (spentNew). A read that a write races is read again. - gateway: perKeyEvery bars a key at its cap (spendHeld) as a usage cap holds an account. The next key serves, then the fallbacks. With none, the reply is 429 "spend cap reached: ..." naming each key, what it spent of which cap, and how to go on. Retry-After is when the soonest period renews; a cap in all gives none. A spend hold is not a usage cap: Stop at the caps and strictKeep don't end at it (capHeldOnly). The trace's barred row carries the cap, the spend and the period. - GUI: a pill on each key's row in the provider editor, for example "$7.50 of $20.00 today". It opens the app's menu (No spend cap, Per day..., Per month..., In all...) and then takes the amount in place, as the lane-limit pill does. A key at its cap gets a line under its row: "At its spend cap · back in ...". Every string is in all five languages. The pill and the line are in keyspend.js, which app.js imports when it draws a key's row, so the core's script budget is not raised. /api/providers' keyList carries spend, and POST provider/keyspendcap sets it. - CLI: magpie provider spend-cap <id> [key [usd [day|month|total]|off]] lists each key's spend and sets or removes a cap. - docs: providers-accounts.md and gateway-routing.md. Caveats, also in the tooltips: - What counts is magpie's priced usage, not OpenAI's bill. - A model with no known price counts $0. - Requests already under way when the cap is reached still finish, so a key can go a little past it. Run on mote at the pre-rebase head ( |
||
|
|
3088872e63 |
claude: an interactive run goes on when only Claude Code's varying safety context changed (xybio)
xybio on Discord (Claude Pro, Claude Code through magpie, likely in auto mode) saw it twice: right after the 5-hour window reset, one message took the window from 100% to 0%. Their Usage page for the day (claude-opus-5-5): - 62 requests and 17M tokens, almost all of it cache (input 102, output 31.3K); - a 29.4% cache hit rate, so about 12M tokens were written to the cache, around 290K for each of the 41 that succeeded. That is the whole conversation written again on almost every request. The cause is in the bridge. With server review on, which it is for a Claude account (AutoModeReviewed), every request carries Claude Code's `safeguards`. The interactive mode's Claude Code reads CLAUDE_CODE_EXTRA_BODY only as it starts, so setSafeguards restarted the run whenever the field differed in any byte. A new run is told the whole conversation, and that writes it all to the cache again. The field's classifier_context differs on nearly every request. That is in Claude Code's own code (2.1.316, Jmr): - prior_turn_context grows with each tool round's tool_use_ids; - git_state.status follows every edit; - system_reminders, artifacts, text_provenance and the shed list vary too. So every tool round and every turn of one message started a fresh run (4 turns gave 4 runs in the new test on the old code), each paying a full cache write of the history. Change: in an interactive run, setSafeguards compares safeguardsKept forms. That form leaves out the parts Claude Code itself names as variable and sheds over its 256KB budget: - prior_turn_context, system_reminders, artifacts, text_provenance, shed; - Chrome's tabs; - git_state except cwd, root, branch and default_branch. When only those changed, the run goes on with the context it started with. A change to the rules, permission or auto mode, folders, or the repository and branch still restarts it. A field that isn't the expected JSON is compared whole. The -p path is unchanged: it takes every change in place through apply_flag_settings. The cost is that the server classifier sees those varying parts as they were when the run started. This is noted in docs/subsystems/claude-subscription-bridge.md. Run at the pushed head (52d69934f, on origin/main |
||
|
|
9335e23d3b |
claude-desktop: every inferenceModels entry carries its /v1/models name (chengming0v0)
chengming0v0 on Discord (v0.1.2806, Claude Desktop): the models of an
API-key provider read "mythos-magpie-0167851852", "mythos-magpie-3494120245"
and the like in Desktop's model menu, beside rows named properly
("DeepSeek V4.1 Flash 1017 · 寄吧鲁东", "GPT-6.1 Sol · ag:zdgit").
Cause: since
|
||
|
|
3e31962225 |
provider: Request headers to pass, the agent's own values to its provider
A provider's fixed Headers can't say a value that changes from request
to request or from client to client. 3jRzfF52Qx on X asked for the
agent's own header values to reach the vendor. Each provider now has a
comma-separated list of request headers, saved as `passHeaders`. When the
agent's request carries one of them, its value goes to that provider as
the agent sent it.
- Where it is: the editor's "Request headers to pass" (zh 透传请求头),
under Advanced, right after Reply headers.
- The agent's value stands over a fixed Headers value of the same name.
When the agent sends none, the fixed one goes.
- Never passed on, listed or not (provider.RequestHeaderPassable):
- magpie's key: Authorization, X-Api-Key, X-Goog-Api-Key, Api-Key;
- cookies and sign-ins: Cookie, Set-Cookie(2), WWW-Authenticate,
Authentication-Info, Proxy-*;
- the connection's own fields: Host, Connection, Keep-Alive, TE,
Trailer, Transfer-Encoding, Upgrade, Expect;
- what magpie writes for the body: Content-*, Accept,
Accept-Encoding;
- Origin, Sec-* and X-Magpie-*.
Save refuses such a name with a reason (RequestHeadersOK), and so does
the editor, before the save. The editor's list is held to Go's by
TestReplyHeadersNeverAsTheProvidersAre. A name written into
providers.json by hand is dropped on read.
- Only that provider gets them. forwardOnce, which every chat,
responses, messages, count_tokens, group-member, fallback and plugin
try goes through, puts the agent's headers in the try's context under
the try's provider id (WithClientHeaders). Provider.Sign passes only
what that id lists, before an account signs, so a signed-in account's
own signing still wins. A plugin's fetch gets them in req.Header.
- Wire headers are still masked when read (
|
||
|
|
63dc359fb4 |
providers: a subscription account's rest, or its model's, shows on its row (maxleebeta)
maxleebeta on Discord (#feedback): WorkBuddy answered 429
{"type":"rate_limit_error","message":"WorkBuddy: 您的使用量已超出频率限制,将在
2026-11-03 23:57:19 UTC+8 重置,您也可以切换其他模型继续使用。"} while the
provider's card said 1,934/2,350 credits left (82%), and nothing on the
Providers page said the account was held back.
Routing already handled the refusal: resetsWhen reads the time (UTC+8, the
space before 重置 included), failure() gives failQuota, and since it says
切换其他模型 the rest is that model's alone (restID), by "resets", till
15:57:19 UTC; the account's other models are still asked (#1669). What
was missing was the page: a key's rest showed on its row, an account's
never did.
- gateway.RestsUnder(prefix) lists the rests in force under a key prefix
(provider@ for a subscription's accounts, provider@user/model for a
model's), with Key and the rest's note (Model, By, Error).
- providerJSON.accountRests gives them by user in lower case, the model
filled in from the key when the note has none; provider.KeyRest gains
By, Model and Error.
- app.js: the account row in the provider editor gets a line per rest
(accountRestLines): "<model> resting · 429 quota used up · back at
<time>" or "Resting · …" for the whole account, the vendor's words
beside it (shown whole when it names a time magpie couldn't read, so
an unknown format still says why), and Try now (gateway/unrest by the
rest's key). The key row's rest line is now the same helper
(restLineOf), so app.js grows ~800 bytes, under the core budget.
- New strings in zh, zh-TW, ja and de. docs/subsystems/gateway-routing.md
says where the Providers page reads them.
Not changed: the "-sg" maxleebeta saw in pi is WorkBuddy AI's own model
id (deepseek-v4.1-flash-sg, the paid Singapore id beside the free
deepseek-v4.1-flash); pi's footer and model picker show ids by design,
and the name magpie writes for it is the vendor's ("Deepseek-V4.1-Flash",
"(SG)" added by the plugin only where two ids share a name). Neither
magpie nor the plugin appends "-sg"; the CN build has no -sg ids.
Run (mote, through mote-run):
- go test ./internal/gateway ./internal/gui ./internal/provider at f0df4bb2b
(base
|
||
|
|
06944e065b |
gateway: a reply that begins as an event stream is read as one whatever its Content-Type (uk.jent)
uk.jent (Discord, #feedback): MiniMax Code's plugin (0.1.7) served as
Anthropic Messages to Grok Build 1.0.74. The first token took minutes
(5-6 at worst), then hundreds of characters came at once, and every
thinking block said "Thought for 0.0s".
Cause: eventStream decided a reply was a stream by its Content-Type
alone, unless the type was empty or text/plain. A stream sent under
any other type (application/octet-stream, say) was read as a whole
reply. On the Messages passthrough, sigFieldTidy, anthropicTextCalls
and the other tidies hold a whole reply until it ends, so the agent got
the turn only at its end, every block at once. On Chat and Responses
(translated) the same reply failed "did not stream". Under
application/json, notAnAPIReply turned it into a 502 ("isn't JSON").
The plugin itself passes MiniMax's body through untouched, and the host
streams it chunk by chunk, so neither is the cause.
Fix:
- eventStream reads the body's first bytes under any Content-Type that
isn't text/event-stream. A body that begins as an event stream
(event:, data:, a ":" comment) is one, and its Content-Type is set to
text/event-stream for the agent. A JSON or binary body never begins
that way.
- notAnAPIReply lets a JSON-labelled body that begins as an event
stream through (eventsStart, shared with eventStream).
- docs/subsystems/gateway-routing.md says the rule.
Test: TestPluginThinkingStreamsAsItComes. The fake MiniMax plugin is
put in front of a vendor that sends its first thinking and then waits
until the agent has heard it (or gives up after 10s). It covers
messages, messages with tools (as Grok Build sends them), chat and
responses, each under text/event-stream, application/json, text/plain,
no type and application/octet-stream.
Run on mote:
- On origin/main
|
||
|
|
441a2b6b16 |
plugin: a cancelled sign-in saves nothing, and a failed authorize says why (#5016)
Found reviewing magpie-community/plugins#658 (AStudio's and Agnes Code's
sign-ins wait up to 5 minutes for the vendor's desktop app).
Cancel didn't end a plugin sign-in. The window's Cancel (and the sign-in's
timeout) ended plugin.Finish's context, but "callback" was not a
cancellable call, so the host never heard: the plugin's wait went on, and
a session file written after Cancel still saved the account. Now
authorize, callback and apiKey are cancellable as gatewayRequest is
(host.go `cancellable`): magpie writes `abort`, host.js (`signInSteps`)
drops whatever the plugin answers after it, so nothing is saved, and
counts the call done at once. The plugin's wait is told too: every fetch
it makes for the sign-in carries the sign-in's signal
(`whileSigningIn`), and magpie's hook passes the signal as
callback(code, { signal }) / authorize(inputs, { signal }), which OpenCode
doesn't, so a plugin can stop polling a file. A plugin that ignores the
signal keeps running until its own deadline, but its answer is dropped.
An oauth method's authorize that returned { type: "failed", error } (no
callback) was stored and its missing callback called, so the user saw
"s.a.callback is not a function". host.js now answers that, or any result
with no callback, as the sign-in's failure, and plugin.Authorize returns
ErrFailed with the plugin's reason, for auto and code methods; an api
method's authorize already did. The GUI's start shows it as its failure,
`magpie plugin login` prints it.
Docs: provider-plugins.md, and the plugin guide (en, zh, ja) on failing
from authorize and the signal.
Not changed: #3083's timeout field, #4678's model/usage task lifetime.
Tests (testdata/signinend, no network; the vendor is testenv.FakeVendor):
TestCancelledSignInSavesNothing, TestCancelledSignInEndsThePluginsWait,
TestCancelledSignInEndsItsFetch, TestSignInFailsWithThePluginsReason
(internal/plugin), TestCancelledPluginSignInSavesNothing
(internal/provider, through StartPluginSignIn/CancelSignIn).
Run on mote (macOS 27), at this change on
|
||
|
|
897e88d7e6 |
gateway: most's timer looks again no sooner than a second while an upload earns (#4775)
Cause: with wuuli's upload credit, a request's charged time stands still while its body earns at least as fast as it is read. When little was left, checkMost re-armed most's timer at that sliver, and again every time it fired, for as long as the body kept coming. In the #4775 review, a hold frozen 100µs short of unroutedMost was looked at 6731 times in a second. Change: checkMost waits at least unroutedRecheck (1s, or an eighth of unroutedMost when a test shortens it) before it looks again. A hold is answered at most that much late. Masking, the 30s unknown-work guard, the 60s socket idle deadline, the decoded cap and the trickle's 408 are unchanged. Test: TestUnroutedMostRecheckIsNoSpin freezes a hold's charged time a sliver short of unroutedMost and counts the timer's looks in a second. It allows 30. Run, via mote-run (macOS arm64, Go 1.26.8), at this tree before the rebase (base |
||
|
|
b4e3885477 |
gateway: earned upload time banks nothing, and a body that decodes to nothing still ends (#4775)
Review tests for wuuli's and Leng's upload credit, guarding the two ways an earned allowance could hold a request too long. Banking: a body sent at once earns far more than it took to read (2 MiB earns 64s at 32 KiB/s). TestUnroutedFastUploadBanksNothing holds a request after such a body with a lock routing needs. It is answered 504 at unroutedMost, and the credit buys the later internal hold nothing (`d -= min(spent, earned)`). Empty encoded streams: empty gzip members (a 60 KB extra field, no content) or zstd skippable frames keep the wire busy, decode to nothing, never reach the 512 MiB decoded cap, and earn upload time forty times faster than they are read. TestUnroutedEmptyEncodedStreamIsBounded sends one chunked over a raw conn through Front. It is answered 408 at unroutedMost plus unroutedUploadGrace: the cap ends it, not the rate. Go 1.26.8's gzip.Reader loops over members without recursion (read on mote), so no stack grows with the member count. unroutedUploadGrace becomes a var so the test can scale it, as unroutedMost already is. Its value is unchanged (8m). Run, via mote-run (macOS arm64, Go 1.26.8, -tags nogui): - go test -run TestUnrouted ./internal/gateway/: ok at this stage. - The full verification is in this series' last commit. Broken by hand: - `d -= earned`: FastUploadBanksNothing went red, unanswered at 20s. - No clamp on bytes read: EmptyEncodedStreamIsBounded went red in gzip and zstd, unanswered at 30s, and Leng's TestUnroutedUploadAllowanceHasCeiling went red (1m and 11m charged). Not tried: a real client sending such a stream, and a slow real link. Co-authored-by: Xulin Wu <wuxulin@bytedance.com> Co-authored-by: Leng <Lengjingxu@gmail.com> |
||
|
|
639a15c507 |
gateway: a chunked body is still arriving between two reads until a read meets its end (#4775)
Cause: bodyArriving (#4511) counted a body as still arriving between two reads only when the request said its Content-Length. A chunked body, which every encoded upload from an agent can be, was judged by the read alone. When most's timer fired between two of its reads, the request was answered 504 "without routing it to any provider", as a hold of magpie's own, though its body was still coming. A decoder spends its time between reads too: in the #4775 review, a stream of empty gzip members got the 504 in 2 of 10 runs. Change: waitedBody records that a read met its end or an error (bodyEnded). A chunked body counts as arriving between reads until then. A body read whole, an empty one, and one not yet begun (the wait for body room) still count as magpie's hold. Every watched route reads the body through request_bounds' io.ReadAll, so a read reaches EOF or an error. Tests: - TestUnroutedBodyArrivingBetweenReads now expects a chunked body to count as arriving between reads, and not once its end is read. - TestUnroutedChunkedBodyReadWholeHeld504 (identity, gzip and zstd, sent chunked) guards the other side: a hold after the whole body has been read is still 504. Run, via mote-run (macOS arm64, Go 1.26.8, -tags nogui): - go test -run TestUnrouted ./internal/gateway/: ok. 24 tests at this stage on 07b6834fe (wuuli's and Leng's patches). - The full verification is in this series' last commit. Broken by hand: - No bodyEnded store: ChunkedBodyReadWholeHeld504 went red in all three encodings, answering 408 "its body was still arriving". - The old `d <= 0` condition: BodyArrivingBetweenReads went red, with "a chunked body between two reads ... did not count as arriving". Not tried: a real slow link or proxy, and the reporter's conversation. |
||
|
|
19d04425c8 |
gateway: cap earned upload time before duration arithmetic
Bound upload credit to eight additional minutes so progressing compressed streams cannot keep pre-routing requests alive indefinitely. Clamp wire bytes before multiplication to avoid duration overflow. Keep the progressing-upload fix by Xulin Wu in its original authored commit. |
||
|
|
df69ffe979 |
gateway: let progressing uploads outlast the routing hold (#4775)
Latest main
|
||
|
|
0872bc2a0e |
context: a request's text and reply from the request archive (wangbinyq)
wangbinyq on Discord: with the request archive on, clicking a block of
the context window card still said "只保留最近 10 个请求的原文", since the
card read only the last 10 bodies magpie keeps in memory.
What changed:
- /api/context/text tries memory first, then the request archive's copy
when the route names one (Route.Archive, the route found in the trace
or in the history file of the card's ?day=, HistoryRoute looks a day
either side). gateway.ArchivedPromptText parses it as PromptText does
and masks it through maskedCopy, as the body in memory is; it is
marked from "archive" and the card says so.
- New /api/context/reply: the reply to the request, from the Recent
calls (Server.ReplyBody) or the archive's Response. gateway.ReplyPieces
reads it into thinking/assistant/call pieces (conversationOutput, split
out of conversationTurn) after redact.ScrubJSON, and masks every piece
through maskedCopy. The card's text view has a Reply button beside
Close that shows it and goes back to the part.
- What is shown is what the archive stores, masked as the memory copy
would be, nothing more. A body or reply that can't be masked shows
nothing (404 "unread"); one the archive cut short isn't parsed ("cut");
one it names and doesn't have says so ("missing"), and one with no
archive copy keeps the old "only the last 10" line ("off"). A failed
bucket read is an error, not "gone".
- The archive read is capped at archiveReadMost and the last copy read is
kept 5 minutes, so the items opened one by one read it once.
- ctxtext.js takes the route (id and time) instead of the id; context.js
passes it (its one-line change paid for by a comment cut, core budget
not raised). New strings in zh, zh-TW, ja and de.
- docs/subsystems/gateway-routing.md (Prompt) and gui-shell.md.
Run on
|
||
|
|
d73f2254d7 |
gateway: a relayed reply Anthropic reviewed for auto mode makes no call out of its text
xybio on Discord (#feedback): Claude Code through magpie (127.0.0.1:3425) shows "We're changing auto mode to no longer charge for classifier requests ... this session isn't eligible because your requests go through 127.0.0.1:3425". Anthropic's llm-gateway-protocol page asks a gateway to forward request headers and body fields unchanged (safeguards among them) and to return replies without dropping keys like safeguard_results or rewriting tool-use ids. Audit of the Anthropic-to-Anthropic path (passthrough, forwardOnce): - Request: anthropic-beta and anthropic-version always go; safeguards and the dangerous-tool-use beta go as sent to a reviewed route (serverReview/AutoModeReviewed) and are taken off for any other model. No body field is dropped there. - Reply: safeguard_results already pass, whole and streamed (TestAutoModeServerSideReviewRelayed). tool_use ids go as they came; toolUseIDs salts one only when the client already holds it (#4910), which Anthropic's unique ids never are. - The one rewrite found: anthropicTextCalls ( |
||
|
|
f3335dd1b4 |
gateway: DeepSeek's thinking is left out of a request to Claude (GgbondHi6930 on X)
GgbondHi6930 on X: a Smart group of DeepSeek and a Claude API key. A conversation ran on DeepSeek at max effort; with DeepSeek unticked its next turn went to Claude and failed "signature in thinking". A new conversation worked. Cause: DeepSeek's Anthropic endpoint signs each thinking block with its reply's id, a UUID (checked against api.deepseek.com/anthropic). The agent keeps those blocks and sends them back, so the first Claude turn carries them, and Claude refuses the request, 400 "messages.1.content.0: Invalid `signature` in `thinking` block" (real reply through OpenRouter's Anthropic route, req_011CgfP4zyRcUhPiTg5sLpoe). Until now magpie mended this only after the refusal, in forward's bound-thinking retry. That needs the refusal to reach forward as a 400/422 with Claude's wording, and it spends a request. With fakes that answer as Claude does, main recovers through it, on Messages (whole and streamed) and on Codex's Responses. So the reporter's failure is where that retry can't read the refusal. A relay's status or wording is the likely case; it is not reproduced exactly. Change: forwardOnce, which every route to an Anthropic upstream passes (relayed, translated Chat/Responses, group fallback and Smart routing, a plugin's fetch, count_tokens), now calls withoutForeignThinking. For an upstream serving Claude (api.anthropic.com, or a claude- model name) and not DeepSeek, it leaves out each thinking block whose signature is a UUID. Those blocks never reach Claude, and refuseBoundThinking reads a refusal's indices against that same body. These go byte for byte: - Claude's own signatures (base64; 3,000 of Claude Code's own were checked, all base64 and 800+ characters); - unsigned blocks (Claude took one in a real request); - redacted_thinking; - other vendors' signatures, which the retry still mends. DeepSeek's endpoint and every other upstream get the body unchanged. Tests (thinking_switch_test.go): - TestDeepSeekThinkingThenClaude: the reporter's case, whole and streamed. 3 DeepSeek tool turns, then DeepSeek unticked and 3 Claude turns. Claude refuses nothing and gets its own blocks back as signed. With DeepSeek ticked again and Claude unticked, DeepSeek is sent every block, its own and Claude's. - TestDeepSeekThinkingThenClaudeResponses: the same through Codex's /v1/responses. - TestWithoutForeignThinking: Claude, DeepSeek and Kimi upstreams. Run on mote (mote-run): - gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: clean, at cfa9a6987 (base |
||
|
|
2c214ce252 |
agents: Air's row says which of Air's own agents go through magpie (jumy_18634)
jumy_18634 on Discord picked a model on the Air (JetBrains IDEs) row and
found Air's Codex in IDEA 2026.3 still on another model. The model on an
Air row is the Magpie ACP agent's alone, and the row never said so.
What Air's own agents run, read from the jars (air-plugin
262.8665.521, Air app 262.1037.14):
- The IDE plugin's Codex runs this computer's codex (the terminal's
PATH, else the @openai/codex it installs) as `codex app-server` with
the user's CODEX_HOME or ~/.codex, and sets no model_provider
(CodexAppServerProcessKt, CodexCliUtils). Its menu is model/list, its
default config/read's model, and a task's model goes in thread/start.
Its Claude Agent runs claude with only Air's hooks in --settings.
So both are on magpie while Codex / Claude Code are connected here.
- The Air app's Codex runs with a CODEX_HOME of its own and JetBrains'
gateway ([model_providers.air-gateway]), and never is.
Changed: an Air row, opened, says to pick Magpie in Air's agent menu and
that the model there is Magpie's. The IDE plugin's row says whether
Codex and Claude Code are connected here, and so whether Air's Codex and
Claude Agent go through magpie; the app's says its own agents don't
(airSaid in app.js, words in zh, zh-TW, ja, de). air.go's comment and
docs/subsystems/agent-wiring.md say what the jars showed, in place of
"not tried in an IDE". Six Agents-page comments in app.js are cut to one
line each to keep the core under its budget, no raise.
Run at the pushed head, on mote:
- Codex 0.166.0 `codex -c check_for_update_on_startup=false app-server`,
as Air starts it, in a sandbox HOME with a magpie-style config.toml
(model_catalog_json, model_provider magpie on a fake gateway at
127.0.0.1:3599): model/list gave the catalog's two models, config/read
the config's model; after config.toml changed under the running
server, config/read gave the new model; a thread/start with model
kimi/kimi-k3 (as Air's CodexThreadStartParams sends it) and a turn
sent /v1/responses with model kimi/kimi-k3 to the gateway.
- GUI: agent-air-own.test.cjs (new), chromium and webkit, en zh zh-TW ja
de, 1100 and 640px: 20 of 20.
The 166 GUI files that reach the Agents page or i18n, both engines:
red only in page-width-steady, found-skill-pick-remove, mobile-web and
remote-magpie, which fail the same way alone on origin/main
|
||
|
|
3d7b1233dd |
claudetui: /usage's screen is read at the terminal's own 200 by 50 on macOS and Linux (#4988, shinnqy on X)
shinnqy on X: in the latest magpie Claude Code's usage doesn't load.
#4988 (0.1.2776, macOS, Team plan): the card said 100% / unused, and
`magpie quota refresh claude` gave one window, "7 days · Fable" 0%, while
the account's 5 hours were 29% and 7 days 17% used.
Cause:
|
||
|
|
affa979d56 |
gateway: Codex's one account used up goes on to the Codex subscription's fallbacks
adorable_piglet on Discord: once the ChatGPT (Plus) account's quota ran
out, the Codex app couldn't send at all, and magpie never moved the turn
to the fallback they had set (their own API key, another provider).
Cause: with one ChatGPT account and nothing to route, a turn on Codex's
own sign-in is relayed as it came (codexUpstreamOn). The relay handed an
overload on to the subscription's fallbacks (codexFallBack), but a
quota, credit or rate refusal went to Codex as the backend said it, the
429 usage_limit_reached with its x-codex headers. Codex then stops.
Change: codexAccountOut names the refusals that are the account's, not
the request's: failure() quota, credit or rate, as a status or as a
stream's failure before any reply (response.failed, an error event, a
stream without Content-Type), and a 403 usage_not_included. Never a 401:
Codex renews its own sign-in on it. When the subscription has fallbacks
(codexFallsBack, never a compaction), such a refusal now goes on to them
once the credits retry and the automatic reset have been looked at, as
an overload does; the trace keeps the try's real failure kind. With no
fallback set, Codex still gets the backend's refusal.
What Codex's own client does: it greys Send from its own /wham usage
read. magpie already gets past that once the usage reading says used up
(codex.out with the app-server restart, #540,
|
||
|
|
17d2ef10fa |
claude: a conversation's instructions stay after Claude Code's prompt in every interactive run
m4rs0n on Discord: since #2432 ( |
||
|
|
6b81344301 |
library: the keep-here switch says sync, and is on while it syncs (bin.90)
bin.90 on Discord read the Library editor's 「只在这台电脑」 switch as a
LAN-sharing switch: "this computer only" says nothing about what it keeps
from where. It is about sync, so it now says so.
- Library editor (MCP servers, skills): the switch is "Sync to your other
computers" (同步到其他电脑 / 同步到其他電腦 / ほかのコンピュータと同期 /
Mit deinen anderen Computern synchronisieren), on while the server or
skill syncs. Its note says off keeps it here, and a sync from the
others neither removes it nor replaces it.
- The stored value keeps its meaning: `local` true is still kept here.
The switch shows !local and saves !on, so every saved library.json,
sync payload and CLI flag (`magpie library mcp local NAME on|off`)
means what it meant.
- Row tag: "Not synced" (不同步 / 同步しない / Nicht synchronisiert) where
it said "This computer only", in the Library, the TUI ("not synced ·")
and `magpie library` output.
- Agents page sibling (the same words for an agent's picks): its menu
item is "Don't sync picks to your other computers", its tag "Not
synced". The agentsHere setting is unchanged.
- docs/subsystems/library.md and sync-backup.md name the new labels.
app.js stays in its budget: origin/main
|
||
|
|
1d8658abca |
routing: a group's model picker offers the providers' image models, and a group of them draws (jzw690 on X)
jzw690 on X: the Routing page's group editor ("Add a model") listed no
image models, so a group of image models, to draw at
/v1/images/generations and to pick in Settings > Images, couldn't be
made.
What changed:
- /api/groups gains `drawers`: each provider's image models
(gateway.Drawers, less ones unticked in its editor unless a group
names them), apart from the chat `models`. The picker offers them
after the chat models, noted "<provider> · Image model" (an existing,
translated key); a member row says so and offers no reasoning level.
Decision-model groups don't offer them. Image models stay out of the
chat catalog, so agents are not offered them.
- An image member drew only when its provider had no picks: picks are
of chat models, so membersFound dropped it as unpicked, and GroupDraws,
resolveDrawing, the group's turns and DrawerMissing all failed.
provider.FindDrawingGroup keeps such a member when drawsModel holds;
the image path uses it (drawingMembers), video keeps FindGroup.
DrawerMissing for a group ref asks GroupDraws.
- Routing card: such a member reads ready (groupsState), and Settings >
Images lists every group that draws, not only those reached through
Served.
- docs/subsystems/gateway-routing.md says so.
Tests:
- TestImageGroupOfUnpickedImageModelsDraws (gateway), from the
reporter's case: two key providers whose live lists hold gpt-5.5 and
gpt-image-2, one with gpt-5.5 picked. group/<id> draws at
/v1/images/generations (the first member's 502 moves on to the next),
as the Settings pick a request naming no model draws, and the model
gone from the list makes it missing.
- TestGroupEditorOffersImageModels (gui): drawers listed, an unticked
one not offered unless a group names it, none among chat models, the
group's members ready, Settings offers the group.
- group-pick-drawers.test.cjs: the picker offers it with its note, adds
it, no reasoning button, Save posts it; en and zh, Chromium and
WebKit.
Broken by hand: drawingMembers passing nil instead of drawsModel made
the gateway test red ("group/pix-images doesn't draw"); turning off the
groups.go drawer branch made the gui test red ("group not ready").
Run at
|
||
|
|
84da86ebd5 |
gui: Hide accounts is one switch for every page, window and the panel (paultian)
paultian on Discord (#feedback): Routing, Usage and Providers each kept their own "Hide accounts" state, so turning it on in one page left the others showing emails. Now window.hideAccounts is one switch, one localStorage value (magpie.maskEmails), behind #rtMask, #usageMask and #pvMask alike. Flipping it in any page applies to every page at once, and a storage event carries it to other windows and the tray panel. The old magpie.maskProviders value is folded in on first load (hidden if either value was on) and then removed, so nobody who hid accounts on one page sees them shown after updating. The tooltip and the Settings line now say "on every page" instead of "on this page", in every language. Tests: provider-mask.test.cjs checks that one switch hides accounts on every page and in a second window, that the state survives a reload, and that an old maskProviders=1 comes through as hidden. account-mask's expected tooltip text is updated. Run on mote (GUI files at base 05aba5ca4; the Go asset/budget tests again at this head after rebasing on |
||
|
|
a92cc3f331 |
agent: Antigravity's effort is picked in its row, as its app can't say one (#4838)
MDX-Tom (#4838): Antigravity's app lists the gateway's models by id, with no level control of its own, so a request for one of Antigravity's families of levels (gemini-3.8-flash -> -high/-low) went at the level the app asked or the family's default, and nothing in magpie could change it. Their plugins PR #655 forced a level in middleware, over any level the request carried and on every model named like gemini/flash, for every agent. This puts it in core instead, as Cursor Private Inference has since #1003: Antigravity's agent row gets an effort field, kept in magpie (provider.AgentEffort "antigravity"), whose levels are those of the models it lists (cursorLocalEfforts is now pickedEfforts(agent)). The gateway already asks an agent's requests for its picked level; on an Antigravity account that picks the family's variant (AntigravitySentID) and its thinkingLevel. With none picked the requests go as they asked. The field is shown only while the app is on magpie's gateway, and nothing is written to the app's settings.json. Run on mote at the pushed head (on |
||
|
|
a858e53fa9 |
gateway: Copilot's "unsupported beta header(s)" is read as a refused beta
bigcat1800 on Discord: with Claude Desktop's tool search on (the commit
before), Claude Code in its Code tab asks tool search by
tool-search-tool-2025-10-19. Copilot's Messages API turns that name away:
400 "Copilot: unsupported beta header(s): tool-search-tool-2025-10-19",
which reached Claude Code, since refuseBetas read only Bedrock's
"Unexpected value(s) `x` for the `anthropic-beta` header". It now reads
Copilot's wording too: the request is asked again at once without the
betas named, and they are left out for that provider from then on, as
Bedrock's are. Any provider wording it the same way gets the same.
Through the live gateway, Copilot's claude-haiku-5.5 answered the same
request (a ToolSearch tool and a defer_loading MCP tool) with no beta and
with advanced-tool-use-2025-11-20, and refused tool-search-tool-2025-10-19.
A Claude subscription took both names.
Run at the pushed head, on mote: TestCopilotUnsupportedBetasLeftOut,
TestUserBetas*, TestBedrockBetas, TestSignInBetaStaysWithMagpie and
TestAutoModeReviewGoesWithItsBeta ok; go test ./internal/gateway
(-timeout 45m) ok but TestCodexPoolSaysTheClientsVersion, the full-run
red filed as #4807 (another test's Codex identity; nothing about betas);
linux and windows vet, gofmt clean.
At the pushed head, rebased on
|
||
|
|
80d0cc1a66 |
claude-desktop: magpie's profile turns on Desktop's tool search
bigcat1800 on Discord: Claude Desktop 4.4212 in 3p mode (Code tab,
bundled Claude Code 2.1.309) on magpie, 13 MCP servers, and no MCP tool
was deferred: ~162K tokens of tool schemas on every request, though
ENABLE_TOOL_SEARCH=true was in the CLI's environment.
Cause, read from Desktop 2.7032's app.asar (Ztr, $tr, pnr) and Claude
Code 2.1.312/2.1.316 (oae, Wvn, Yar): with Desktop's 3p policy
toolSearchEnabled unset (the default, and magpie never wrote it), the
gateway provider's tool-search mode is "off", and Desktop starts the CLI
with CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. The CLI then answers
"standard" (no tool search) whatever ENABLE_TOOL_SEARCH says; only an
admin-tier ENABLE_TOOL_SEARCH=force beats it. The model id shape
(magpie-<n>.anthropic.claude-opus-5-5[1m] or plain claude-opus-5-5)
plays no part. With toolSearchEnabled on, Desktop passes
ENABLE_TOOL_SEARCH=force as a managed setting ("host" mode, bundled CLI
2.1.247 and later) or turns the betas back on ("legacy").
magpie's profile now gets toolSearchEnabled: true once, on a switch on
and from Sync (so a Desktop already on magpie gets it at magpie's next
start), as claudeAiImport is: desktopSeedImport and the new
desktopSeedToolSearch share desktopSeedOnce. A value the user set, false
too, or took away in Desktop's window since, stays theirs (stash mark
claude-desktop.tool-search). A profile the user applied themselves for
magpie's gateway is not written. The gateway already carries deferred
tools and tool_reference to every upstream (#2660, anthropic_shapes.go).
Run:
- CLI 2.1.312 in a sandbox HOME against a recording fake (port 3591),
60 MCP tools, model magpie-1.anthropic.claude-opus-5-5[1m]:
DISABLE_EXPERIMENTAL_BETAS=1 (+ ENABLE_TOOL_SEARCH=true): 83 tools,
0 deferred, 205KB. Same plus --managed-settings
{"env":{"ENABLE_TOOL_SEARCH":"force"}} (Desktop's host mode): 13
tools, ToolSearch, beta tool-search-tool-2025-10-19, 56KB. Plain
claude-opus-5-5 behaves the same in each mode.
- At the pushed head, on mote: gofmt -l internal/agent empty; GOOS=linux
(nogui) and GOOS=windows go vet ./internal/agent ok; go test
./internal/agent and its importers (backup cli davsync gui library
profile stats tui uninstall) ok but internal/gui's
TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 red filed as
#3949 (AppKit corners, nothing this touches).
- Broken by hand: the seed returning nil turns
TestClaudeDesktopTurnsOnToolSearch red ("switch on: toolSearchEnabled
<nil>"); the once-mark ignored turns it red ("seeded again over the
user's choice").
- The same CLI in Desktop's host mode through the live gateway, in a
sandbox HOME: a Claude subscription model and a GPT routing group each
ran ToolSearch, loaded the deferred tool and called it. A Copilot
Claude model got 400 "unsupported beta header(s):
tool-search-tool-2025-10-19"; the next commit reads that refusal.
Not tried: a real Claude Desktop 4.4212 or its bundled CLI 2.1.309 (the
CLI was 2.1.312, Desktop's code read from 2.7032), a real request
through magpie in host mode to a Claude subscription or a translated
upstream with the tool-search-tool-2025-10-19 beta, and the reporter's
note that magpie's recorded shape had no anthropic-beta (the CLI sends
claude-code-20250219, interleaved-thinking and effort betas even in off
mode).
|
||
|
|
625938a2f8 |
search: a picked searcher that can't serve gives way to the next that can (plugins#635)
pedestrianz (magpie-community/plugins#635) set Codex's gpt-6.1-sol to
search for Cursor's models. When the Codex plan was used up (429, usage
limit), every web search of a Cursor turn failed with it: a searcher named
in Settings gave way only to the ones named after it (SearcherThen), never
to the searchers magpie would pick itself. That rule is Gearclickist's:
Grok, picked, answered without searching, and the search moved to a
pricier Codex model the user hadn't picked.
Now a named searcher that can't serve at all hands the search on, after
those named after it, to the searchers magpie would pick in turn
(searchInTurn: the ones not spent first, up to two more providers). Can't
serve means every account or key is out of its allowance (searcherSpent),
or the search was refused for quota, credit or rate (failure() in
searchWith). Both are marked errCantServe, through a cantServe wrapper,
without changing the error's text. A named searcher that is spent is no
longer asked first; it is asked last only if no one else could search.
One that answered without searching or found nothing still gives way to
no other, so Gearclickist's case is unchanged. The Routing row and
Settings' SearcherFailed name who searched in its place
(searchingInstead, namedFailed). If none can, the errors go back to the
model as a failed tool result ("... no other provider could search in its
place") and the turn goes on to the model's answer. The AI Studio keys
|
||
|
|
b295d11965 |
serve, update: one magpie works the gateway; the service waits, the copy an update left stops (#4938)
ox01024's #4938, Bug 2. Two magpies did the gateway's work at once on a Mac: - launchd's com.yetone.magpie.serve ran `magpie serve` beside the app. It ran startUp (plugin Settle/Refresh, FoldCopies, Hold, the agent moves), the plugin host and every account's model fetch, then failed to bind, exited 1 and was started again 5s later: 6,035 times in two days, a 279MB serve.log, and logins.json.lock held against the app's requests until they went 504. - The copy an update left (.magpie-update/old) handed the socket over, hid, and lived on ~3h, its loops writing beside the new one. What changed: - cli: `magpie serve` (no --web) checks codexrelay.Leave, gateway.ServedBy and gateway.Taken before startUp, as the app's serveGatewayLocked does. While the port is held it prints one line and looks again every 15s, doing nothing else. Once the port is free it serves (serve_wait.go). It waits rather than exiting 0: under KeepAlive SuccessfulExit:false a clean exit would leave no service after the app quits. - gui: after a handover the old magpie's loops end with backendCtx: - library.KeepLinked (now takes a ctx), - provider.WatchQuotas, - the menu bar usage loop, - the updater's check/auto-restart loop. lighten lets its hidden webviews go as lightweight mode does, so their polls stop. quitBy exits it at handedOffDrain + 3m whatever holds its quit up (gateway.HandedOffDrain getter; exitNow stubbable). - docs/subsystems/gui-shell.md says both. Run at the pushed head on mote (mote-run): - gofmt -l internal/: nothing. go vet ./internal/{cli,gui,library,gateway}; GOOS=linux go vet -tags nogui and GOOS=windows go vet of the same: ok. - go test -count=1 -timeout 45m ./internal/cli ./internal/library ./internal/gui ./internal/gateway at |
||
|
|
8819beeb0e |
gateway: a display reads routing as it happens at /v1/magpie/route-events (#3387)
joe21_eee (sywyyhykkk on GitHub) wrote this for an ESP32 screen that shows each agent's requests live: started, each try, the first content, fallback, done. Ported from their route-events branch (42e1fa43f) with the changes below. What a display gets (route_events.go): - GET /v1/magpie/route-events/snapshot: cursor, active, routes (every request the trace has that is still going). - GET /v1/magpie/route-events?after=<cursor> (or Last-Event-ID): SSE, one "route" event a change, id = cursor, from a 512-change ring under trace.mu, so a short request is told step by step. 409 snapshot_required for a cursor not this process's or too old, "event: reset" for a reader that fell behind, a heartbeat every 15s, a 10s write deadline. - A route is routeActivity, an allow list: trace id (base 36), time, agent label, the provider of the seat the last try went to (never the seat id, which names an account or a key fingerprint), model, attempt, fallback, phase, status, failed, ms, ttft_ms. No session, account, key, folder, prompt, reply or error text. - firstToken.onFirst tells the first content as it comes (serve and the ChatGPT backend's reads), written to an unexported Try.firstMs so the full trace's TTFT is unchanged. Changed from the branch: - No new key type. The branch added an "sk-magpie-route-" key, its CLI flag and its own Authenticate path through access, identifyCaller and corsGuard. main has read-only keys now (readOnlyGuard), and the feed is answered as /v1/magpie/usage is: this computer, and another machine with an enabled key while shared; a held key is refused (refuseHeld). Both GETs are in readOnlyRoutes, so the display gets `magpie gateway-key add Screen --read-only`. A full key already reads more than this (every call's usage). access, cli, cors.go and lan.go are untouched. - A route the trace drops unfinished (drop: an unrouted request's stand-in once its own route begins; trim past twice traceKeep) is told request_dropped and marked offFeed. The branch kept its own active map that only "done" cleared, so a stand-in stayed going forever. The snapshot is read from t.routes, no second map. - A stream ends when the gateway stops serving (Server.streamsEnding, closed first thing in ListenAndServe's drain). Before, an open stream held srv.Shutdown for its whole drain, 15 minutes on a handover. - Revocation is access.On(KeyID) (identifyCaller swaps the secret out before handlers see it), asked at most once a second when there are changes and at every heartbeat, and remoteKeyed for a remote reader. A rotated key keeps its id, so its open stream goes on until it reconnects (said in the docs). Docs: gateway-routing.md "Route events for a display" and the read-only key's route list; reference.md beside the usage API. Run at the pushed head on mote (Go 1.26.8): - At daaafeb6e (rebased on |
||
|
|
443e53d6b2 |
search: an AI Studio key that searches by googleSearch searches for other providers' models
cocoasoda on Discord: a Gemini AI Studio key provider searches natively
(googleSearch grounding, geminiKeySearches), but it never showed in the
search-for-other-providers (代搜索) list. searchRank knew only a Google
sign-in (googleAccount) at rank 5, so namedSearcherRank gave such a key
-1 and Searchers() left it out; autoSearcher never chose it.
searchRank now gives geminiKeySearches(p) rank 5 too: a saved key
provider, not a plugin, not Vertex, whose Gemini searches itself. That is
the same rank and the same googleSearch route as a Google sign-in, and
Searchers() marks it Own (it searches by its own tool, not a relay or a
search key).
Run on mote (macOS 27), at the rebased head e76db5515's tree:
- go test -count=1 ./internal/gateway -run
'AIStudio|GeminiKey|Searcher|WebSearch': ok; ./internal/gui -run
'Budget|Script|Search': ok; gofmt -l: clean.
- GUI: searcher-pick, searcher-then, search-instead, search-order,
provider-search (chromium + webkit): 84/84.
- Before the rebase, at
|
||
|
|
ffc4aa6844 |
providers: an Antigravity pool's meters and a family's set their own caps
pluviophile714 on Discord: an Antigravity (Google AI Pro) account row's
"上限 90%" pill says 每个窗口可单独设上限:点击下方它的用量条, and a click on
its "剩余 97.8% · 7d" meter did nothing. The class: a meter is a cap
button only when its window has a capId. Two kinds of meter never had one:
- A pool's own windows (Gemini · 5 hours / · 7 days, Claude & GPT · …),
set Aside for routing, got no Capped/CapID from WithCapped, and
routing's allowanceOf skipped them, so a cap there could not hold.
Now WithCapped marks a pool window that has members capped (CapsSome),
with CapID = its LineName ("gemini · 7 days", as both pools have a
"7 days"). allowanceOf hangs each pool window on its members' own
windows (Limit.pool), and CapHeld and NearCap count them through
capLimits, so a cap on it holds that pool's models only. Routing's
used-up and For still read the models' own windows, as before.
- A family's meter (windowCapMeter skipped `tiers`): several models'
windows shown as one (Gemini 3.1 Pro High/Low, a pool read without its
summary). It now posts every tier's capId in a new `windows` field;
provider.SetWindowCaps sets them in one save (SetWindowCap, the CLI's,
is it with one).
Changed for users: an account cap (the reporter's 90%) now also counts
an Antigravity pool's 5h and 7d windows, as the pill already says it
does ("each usage window"). Other Aside windows (on-demand spending,
Ollama's bought credits, MCP · Month) and windows past the first two
(tooltip only) stay unsettable: routing doesn't hold on them.
app.js shrinks 305 bytes (comments trimmed); no budget raised.
Run on mote (macOS 27), at the rebased head a2c1e8df1's tree:
- go test ./internal/gui -run 'Budget|Script', ./internal/provider -run
'Cap|Pool|Allowance': ok. GUI: window-cap-pool (new), window-cap,
quota-pools, quota-families, i18n-keys, chromium + webkit: 112/112.
- Before the rebase, at
|
||
|
|
c28220a5e7 |
sessions: a Codex thread saved on another provider resumes from Sessions
mrten_95615 on Discord: opening a Codex session from Sessions ran
`codex resume <id>` and Codex 0.166 stopped at "This chat uses custom,
but your current provider is magpie. Switch to custom to continue."
(modelProviderMismatch). Codex 0.166's app-server resumes a thread only
on the provider it was saved with (its state-database row, else its
session_meta), checked against the one config.toml (with -c) selects
(codex-rs app-server config_manager.rs load_for_resume); no flag lets a
resume go on another provider, and a provider config.toml no longer has
fails as modelProviderNotConfigured. Codex 0.165 resumed it on its own
provider without asking.
sessions.ResumeNow is the line that runs when the user opens a session
(GUI Terminal, TUI enter); the listed line is unchanged and nothing more
is read on a listing. For a Codex thread saved on a provider other than
the one Codex is on:
- config.toml still has that provider's table, or it is a Codex
built-in (openai, amazon-bedrock(-runtime), gcp, ollama, lmstudio):
`codex resume -c model_provider=<it> <id>`. Codex runs that embedded
(no shared daemon) on the thread's own provider.
- the provider is gone: MoveCodexProvider moves the thread to the
provider Codex is on (files copied to magpie's trash first, the state
row too) and it resumes there, the only way Codex resumes it at all. A
thread written to in the last minute or open in a Codex is left
(ErrActive) and the plain line runs.
A WSL distro's Codex session and every other agent are as listed.
Run at this head (mote):
- go test -count=1 -run 'TestCodexResume|TestMoveCodexProvider|TestCodexProviderIn' ./internal/sessions: ok
- go vet ./internal/{sessions,gui,tui}, GOOS=linux -tags nogui and GOOS=windows vet of them: ok; gofmt -l: clean
- At this head (rebased on origin/main
|
||
|
|
eb779ce92a |
gui: the tray icon's tooltip is in magpie's language (yi_time)
yi_time in #feedback: magpie set to Chinese on Windows, and the tray
icon's hover tooltip said "Today: 121K tokens (2.9K in · 180 out ·
118K cached)" and "3 requests" in English. The tray menu already
followed magpie's language (trayLang, #301); the tooltip's words were
hard-coded English in trayusage.go.
Now every tooltip is in trayLang(settings.Lang, systemLang), on
Windows, macOS and Linux alike. That covers trayIdleTip, magpie's
totals (trayTotalCard), and each subscription card (trayCardText: its
use or what is left, the pace, when it resets, until's d/h/m, "as of
…"). The words are in trayWords beside the menu's, for zh, zh-TW, ja
and de; English stays the key and the fallback. A window's name and an
error are still the card's own. A change of language in Settings now
also refreshes the tooltip (onTrayUsage); before, only the menu was
relabelled. The test-only trayUsageText and trayUsageView stay in
English, so the existing tests keep their strings.
Test: TestTrayTooltipFollowsMagpiesLanguage.
- yi_time's own numbers in zh: "magpie\n今天:121K token(输入 2.9K ·
输出 180 · 缓存 118K)\n3 个请求".
- The same numbers in en are unchanged.
- Covers the total card and a card's used, left, reset and as-of.
- For zh, zh-TW, ja and de, no English word in the idle, totals, card
(with pace) or combined tooltips.
Run at this head (rebased on
|
||
|
|
5573f79231 |
agent: an agent's own models say they go direct, and a pick of one asks before 接入 goes off (maxleebeta)
maxleebeta in #feedback: Pi 1.5.0 connected to magpie; picking one of Pi's own OpenCode Go models (opencode-go/<model>) turned 「接入」 off at once, with nothing said, while magpie's models kept it on. The cause: the pick writes defaultProvider opencode-go, so Pi asks OpenCode Go itself and magpie is no longer in its config, and Wired() is rightly false. What was missing is that the model said so. Options from ownProvider (every ownOptions agent: Pi, OpenCode, Crush, Goose, Cline, Hermes, Morph, OpenChamber, Qoder, StepCode, plugged agents, the WSL twins) and ompOwnOptions carried no Direct, unlike Claude Code's and Codex's own models. So the picker neither tagged them "direct, not via magpie" nor asked before a pick took the agent off magpie. Each now carries Direct = its vendor's name. The GUI already does the rest (pathTag, the leave-ask, direct options listed after magpie's). Tests: - internal/agent TestOwnModelsSayTheyGoDirect: Pi, OpenCode, Crush and omp, signed in to OpenCode Go, each give every opencode-go/ option Direct "OpenCode Go"; magpie's options have none. Picking one writes defaultProvider opencode-go. - internal/gui/tests/agent-own-direct.test.cjs: the tags, magpie's first, the ask (Cancel keeps 接入 on, nothing written), magpie's other model not asked, confirmed → written and off. Run in chromium and webkit × en/zh/zh-TW/ja/de × 980/420. Run at this head (rebased on |
||
|
|
12599e9cd0 |
signin: ChatGPT signs in by device code, the first way from another computer
curtinp118 on Discord runs magpie on a VPS and opens its web UI from home. ChatGPT's browser sign-in comes back to localhost:1455, which is the viewer's own computer. The page there won't load, and the box's main line said "The account shows up here as soon as you're done", so the sign-in looked broken. The fix until now was to copy the dead page's address back by hand. ChatGPT now also signs in by device code, as `codex login --device-auth` does (codex-rs login/src/device_code_auth.rs). This is startCodexDeviceSignIn, with StartSignInWith site "device": - magpie asks auth.openai.com/api/accounts/deviceauth/usercode for a code with Codex's client id and headers; - the box shows the code and https://auth.openai.com/codex/device; - magpie polls deviceauth/token, where 403/404 means not entered yet, for up to 15 minutes; - it then trades the authorization code at the token endpoint with the returned verifier and the /deviceauth/callback redirect. Nothing listens on this computer. The window starts this way when magpie web is opened from a host other than localhost or loopback (remotePage in app.js). Either way, the box has a link to the other way: "Sign in with a code instead" or "Sign in in the browser instead". A device code that ChatGPT turns away (404) fails, and that box links to the browser's way. Strings are in zh, zh-TW, ja and de. providers-accounts.md describes the flow. This went over TestCoreScriptBudget. It now fits with no raise (1,533,700 of 1,533,802, on main's 1,533,789). The two way-switch buttons share one helper (codexWay), and eight comments on the sign-in code are cut down: openSignInPage, signingKept, startPluginSignIn, the sign-in proxy, signInProxyChoices, Copilot's GHE.com, dropSigningIn and renderStepPlan. Run on mote (the pushed head is rebased on |
||
|
|
ae060550b9 |
claude-desktop: a tier's pick runs with its tier's Claude prompt (behavesAs)
moer2831 on Discord: a model picked for one of Claude Desktop's tiers ran
in the Code tab on Claude Code's generic prompt, not the one of the
Claude model of that tier ("通用提示词和对应模型提示词差距挺大的,感觉直接
蠢了一个度"). Desktop 4.29 and later hand Claude Code behavesAs only from
a profile's inferenceModels (z3t in 4.4212's app.asar: modelPicker
options with each entry's behavesAs).
What changed:
- gateway.DesktopInferenceModels: while a model is picked for a tier,
the list is every row /v1/models gives Desktop, by its id and in its
order (a non-empty list replaces discovery, pzn), with supports1m,
prefer1m and labelOverride as Desktop read them off the row, and a
pick's anthropicFamilyTier/isFamilyDefault. A pick that isn't a Claude
model gets behavesAs = its tier's newest Claude id (claude-opus-5-5,
claude-sonnet-5-5, claude-haiku-5-5, claude-fable-5-1). Nothing picked
(or a pick no longer listed): no list. Unreadable picks are unknown.
- agent: desktopSyncModels writes it into magpie's Desktop profile on a
tier's Set, as Desktop comes on magpie and on Sync; temp+rename, only
when it changed; taken away when nothing is picked. The list is
magpie's only while its hash is one magpie recorded (stash mark
claude-desktop.models); any other list (the user's) is never written
over or removed.
- Claude Code's modelSettings gets the pick's own window even when it
matches the default (claudeBudget.behaves), since behavesAs would
otherwise give it the Claude model's.
- GUI: the tiers menu ends with one line, "Claude Desktop reads the
tiers as it starts: restart it after a change." (en, zh, zh-TW, ja,
de). The Agents row's Restart already lights from the profile hash.
- docs/subsystems/agent-wiring.md and gateway-routing.md.
Run on mote at this tree (base
|
||
|
|
7c115f6f5b |
provider: picks gone from a list for over an hour serve the list (maxleebeta)
maxleebeta on Discord: with WorkBuddy and WorkBuddy AI both signed in, the Agents page's model picker had no WorkBuddy AI model, and its Providers row read "已登录 · 1 个图像模型 · Free plan" where WorkBuddy's read "1 个模型". WorkBuddy AI's /v3/config (read 2026-11-03 with the owner's account) no longer lists deepseek-v4.1-flash, its free model until now; hy3 is at x0.00 instead. The China build still lists deepseek-v4.1-flash. A pick a plugin's list stops listing goes to Delisted ( |
||
|
|
6a6e4fefac |
sessions: WorkBuddy AI's own sessions are listed under its name (maxleebeta)
maxleebeta (Discord #general) is signed in to both WorkBuddy builds, the
China one and the international one, and the international one was
missing from an agent list. The provider side lists both: provider.All()
and CatalogFor have workbuddy/* and workbuddy-ai/* models under "WorkBuddy"
and "WorkBuddy AI". The sessions package, though, read only ~/.workbuddy.
WorkBuddy AI keeps the same files in ~/.workbuddy-ai (its product.json
dataFolderName, as internal/agent wires it), and nothing read them. So
WorkBuddy AI was missing from the Sessions page's agent picker, from
Usage > Sessions' agent strip, from the reading consent's folders and
from the usage ledger.
Changed:
- WorkBuddyAIDir and workbuddyAIFiles read ~/.workbuddy-ai/projects as
agent workbuddy-ai with WorkBuddy's parser, in allFiles, Dirs,
callSources (wholeCallReaders), Deletable and Found.
- buddyDir picks WorkBuddy AI's own models.json for the
call-through-magpie skip.
- A ~/.workbuddy-ai that is a link to ~/.workbuddy is read once, as
WorkBuddy's.
- skillsCounted names workbuddy-ai (WorkBuddy's parser counts no skills).
- docs/subsystems/gateway-sessions.md has a line for it.
Tests:
- TestWorkBuddyAI checks sessions, cwd, title, tokens, Deletable, Found,
calls, the skip of magpie's gateway, and the link.
- TestWorkBuddyAIGatewayIsItsOwn: one model id that WorkBuddy's
models.json gives to magpie and WorkBuddy AI's gives to the user's own
provider.
- TestWorkBuddyAISessionsListedUnderTheirName checks /api/sessions,
/api/sessions/manage and /api/sessions/stats: name "WorkBuddy AI",
icon workbuddy-color, deletable.
Broken by hand (each went red): allFiles, parserFor, Deletable, Found,
the call sources, the wholeCallReaders entry, buddyDir.
Run on mote at this head (base origin/main
|
||
|
|
c86fa2a341 |
gateway: a relayed citation without the offsets OpenAI's schema wants is dropped, the thread healed (#4921)
A thread a routing group served once on Volcengine Ark (or another vendor whose Responses endpoint writes its url_citations with no start_index/end_index) never worked on a codex member again: magpie relayed the reply's annotations as they came, Codex stored them, and the ChatGPT backend refused every later replay of the history whole — "Missing required parameter: 'input[221].content[0].annotations[0]. start_index'" — five retries a turn, on any codex member, through any upgrade (#4921, the reporter's routing log and rollout). This is #2855's defect with a different field: what magpie hands a client must be something magpie could send again. Such an annotation goes, at both seams, as the reasoning-item fix did: - a whole reply streamed as the vendor's own events (responsesWholeEvents) drops it in every place a client reads a citation: its annotation events, the content part, the item and the reply the client keeps (dropOffsetlessCitations); - the history Codex replays loses it on its way to the ChatGPT backend (withoutOffsetlessCitations, the same leaving-out as a reasoning item's text, #1411): to the backend by its own sign-in and compaction relay (codexUpstreamOn), to it as a group member or an openai.com or Azure upstream (the provider loop, beside withoutReasoningText), and asked again without it where a relay in front of it names the parameter (refusesCitationOffsets), marked so it is never sent one again — a thread already poisoned heals on its next turn, no new thread needed. The text, and a citation that carries its offsets, go as the vendor wrote them; a turn with no "annotations" in it is not decoded (anyInputItem scan, itemCitesWithoutOffsets; the undecoded-turn test holds, allocations and all). Run: the three new tests fail on the base with the reporter's exact 400 and pass here (ablation: the tidy call and the rewrite's body neutralized, tests kept); TestCodexRewritesAsBefore, TestCodexRewritesLeaveTurnUndecoded and the fuzz hold the rewrite to its scan; the citation/whole/reasoning neighborhood ok (23s); gofmt, go vet (linux, windows) and go build -tags nogui clean. Review: this is skygunner's version of the fix (fcea11649), not ggbdpq's 57dc7b420. ggbdpq's stripped citations only for a request that wasn't for a magpie model, so the reporter's own path (a routing group's codex member, the history passed through) kept the bad annotation. ggbdpq's parity table and verification of the report were used to check this one. Changed in review: annotationLacksOffsets looks only at url_citation and container_file_citation, the two types OpenAI's schema gives start_index and end_index. file_citation and file_path carry a single index, so the patch dropped every one of them as "offsetless". TestCitationsWithOneIndexKept (added in review) holds both kinds and checks that a history with only file_citations is sent byte for byte. Broken by hand at the reviewed head: annotationLacksOffsets made to return false, all four citation tests red; the type check removed, TestCitationsWithOneIndexKept red. Restored, green. Run at the pushed tree (this stack of nine on origin/main |
||
|
|
0561d53521 |
gateway: spawned Claude Code registers no claude-cli:// URL handler (#4928)
--setting-sources "" keeps the user's own disableDeepLinkRegistration from loading, so every spawned claude registered the claude-cli:// OS URL handler again and "Claude Code URL Handler.app" came back after the user had deleted it. A headless run has no use for an OS URL handler: the setting is now passed as flag settings (--settings is not one of the sources --setting-sources controls) on the bridge run and the warm-up and usage runs beside it, whatever the user's settings read. Review: applied as ggbdpq posted it (patch sha256 checked against the issue's). Checked in the Claude Code binary that flag settings read disableDeepLinkRegistration === "disable" and that --setting-sources "" doesn't filter --settings. `claude auth login` and `auth status` take no --setting-sources, so the user's own settings already apply there; they are not changed. Broken by hand at the reviewed head: claude_warmup.go and claude_subscription.go reverted to their parent, TestClaudeSubscriptionPromptKeepsForeignHarnessOutOfSystem, TestWarmClaudeAsksClaudeCodeOnce, TestClaudeUsageRunsClaudeCode, TestAskClaudeTUIOn and TestClaudeUsageTUIOn red. Restored, green. Run at the pushed tree (this stack of nine on origin/main |
||
|
|
a8d36b0faa |
fix(claude): a run let go after answering a prompt suggestion leaves its session for the conversation's next turn (#4914)
Claude Code asks its prompt suggestion after each turn as the conversation and one message more, and its run goes on with it (#1638): the run waits on from the suggestion's exchange, under a key the conversation's own next turn never comes by, since the client leaves the exchange out of its messages. While the run is kept, that turn finds it by where it stood before and takes it back to there (resume). But a run let go past idleMost was lost to its conversation: shelve kept its session where the suggestion's exchange had left it, or, when the conversation's own turn had already taken the run back from a suggestion (-p), not at all — its session was marked taken back, which the file may not say, and no session was kept. The next turn found no run and no saved session, and a new Claude Code was told the whole conversation in one message, a prefix the cache had never seen, written to the cache again (a 50k conversation: 19k read and 29k written where 49k read and 50 written; the log said no run here had had a conversation one had). The shelf now keeps a session where the conversation's next turn comes by, too (savedSession.behind, run.behindKey), and unshelve takes it from there when no session waits at the turn's own key. A session taken back is kept once the run has answered a whole turn since (run.replied, set as a turn ends, cleared at each take-back): the file's lines since are that turn and what came after, and Claude Code's resume goes on from them. And a run's end is kept under the boundary before its own (run.convPrev), so the log of a turn that finds it gone says what became of it when its last exchange was a side question. Run: TestClaudeLetGoConversationAfterSuggestionResumesItsSession fails on the parent |
||
|
|
8f6dacbf7f |
gateway: a browser's CORS preflight from another machine is answered, not asked for a key (#4931)
From the report (magpie 0.1.2698, macOS 27.0.1, LAN sharing on, gateway port 3425): a page at https://learn.trancy.org, listed in Settings -> Network and sharing -> Web pages, failed to add itself as a custom engine ("Failed to fetch"). The same OPTIONS preflight for /v1/models, declaring GET and the authorization header with no key on it, was answered 204 with the CORS headers at http://127.0.0.1:3425 and refused 401 with no CORS headers at the machine's LAN address and behind an HTTPS reverse proxy (Nginx Proxy Manager, no CORS handling of its own); the browser logged net::ERR_FAILED, corsError: PreflightMissingAllowOriginHeader, and gave up before the keyed POST. The 401 body was the gateway's own "no API key was sent: send a magpie gateway key as Authorization: Bearer <key> (or x-api-key)". lanGuard sits in front of Handler (Front, oneport.go), and corsGuard is inside Handler, so a request from another machine met the key check first: with the gateway shared (or listening on the network), identifyCaller refused the keyless preflight 401 before corsGuard could see it. On loopback lanGuard asks no key, which is why the same preflight was answered there. A preflight is an OPTIONS that declares the call to come, and per what CORS asks of it carries no key and no body: the browser cannot send one. lanGuard now hands a preflight (corsPreflight: an OPTIONS with an Origin and an Access-Control-Request-Method) to corsGuard instead, after the allow list and the shared/on-network rules have judged it as they judge every request. corsGuard answers a listed origin's with its 204 and headers and refuses any other page's as on loopback; the call the preflight asks after still needs an enabled gateway key, and an OPTIONS that declares no call is no preflight. `magpie web`'s page port, which hands client routes to the same Front, is covered by the same change. Tests (internal/gateway/cors_test.go), from the report's three-row table: - TestCORSPreflightFromLAN: the loopback preflight answered 204 (the row that already worked), the LAN-direct one and the reverse-proxy one (X-Forwarded-For, loopback peer) answered 204 with Allow-Origin and Allow-Headers; an unlisted origin's preflight refused with no CORS headers; a keyless GET and a plain OPTIONS from the LAN still 401; a preflight while magpie isn't shared still refused. Broken by hand (the preflight handoff taken back out of lanGuard): the LAN-direct and reverse-proxy rows go red, 401 with the report's own error body, while the loopback row stays green; restored, ok. Run (macOS arm64, this tree, -tags nogui): - go test -run 'TestCORS|TestLAN|TestForeignPages|TestOpaqueOrigin| TestLocalhostSubdomain|TestRebound|TestOnePort|TestFront' ./internal/gateway: ok. - the same with -race: ok. - go vet ./internal/gateway, and with GOOS=linux and GOOS=windows: ok. - go build . with GOOS=darwin, GOOS=linux and GOOS=windows: ok (the darwin cgo enum-conversion warnings in internal/gui are pre-existing). - gofmt -l on the three touched files: clean. - go test -count=1 -timeout 50m -tags nogui ./internal/gateway: every test ok except TestCodexPoolSaysTheClientsVersion, the known #4807 (another test's Codex identity reaches it in a full package run); it passes run alone at this head. - go test -tags nogui -count=1 ./internal/access ./internal/settings .: ok. ./internal/gui: TestProxyCheckSaysAProxyPassedBy fails, and fails the same way run alone on the untouched base |
||
|
|
3c2dceb340 |
gateway: "member" in Model name in replies names the member to Claude Code and Codex too (ZoeCats)
ZoeCats (Discord #feedback, after v0.1.2760): with Settings › Models › Replies › Model name in replies on "vendor" the name is no longer written over, but on "member" (作答的成员) a reply still didn't name the routing group's member that answered. Cause: replyNamingOf turned the "member" setting into the model asked for whenever the agent was Claude Code, Claude Desktop or Codex (vendorNamed, kept from #822's memberModel). ZoeCats's agent is Claude Code, so the setting did nothing for them, while "vendor" was already for every agent. The setting was saved and read as it should be (the vendor choice worked through the same path), and an absent X-Magpie-Response-Model falls through to the setting. Fix: the user's pick is for every agent. Those three already take a provider/model id back under the default (the group or provider/model they asked for), so the member's provider/model id is no new shape for them. vendorNamed, replyNamingOf's unused agent argument and the dead namesMember are gone. The menu's note for "member" says "for every agent, groups included" in en, zh, zh-TW, ja and de; settings.go's comment and gateway-routing.md say the same. Tests (fake upstreams, no network): - TestReplyNamesMember: "on, codex", "on, claude code", "old file on, codex" now want the member, plus "on, claude desktop" and "on, codex, name asked" (the header still wins), on 6 paths x streamed or not, each after a failover in a group. - TestPluginReplyNamesMember (new): a group served by the fake plugin, Chat and Messages, streamed and whole, with no token and Claude Code's, member and default. - TestGeminiReplyNamesAskedModel: also with replyModel member and vendor. - reply-model-setting.test.cjs: the member note says every agent and names no Claude Code. Red on origin/main |
||
|
|
1851ead1a7 |
library: Pi and omp lock ~/.agents/skills from their versions; Put skills in links every skill there
usrname1833 on Discord asked for two things.
Pi reads ~/.agents/skills itself, so a skill kept there is Pi's whatever
is ticked, with the lock as Codex and OpenCode have. Pi started to in
0.54.0, not 0.19 (its CHANGELOG; userAgentsSkillsDir in
package-manager.js), and omp in 11.0.0 (src/discovery/agents.ts; 10.6.2
doesn't). Target.SharedToo says so from the version, and every reader of
readsShared goes through Target.readsSharedDir: Always (the lock),
syncSkills' inShared (no second link) and a handover's readsSharedHere.
OmO's senpi reads it in every npm version (0.74.0 up), so omo joins
readsShared. A Pi or omp of no known version is taken as older, as
before.
The second ask is a switch: Library > Skills > "Put skills in": each
agent's own folder (the default, today's behaviour) or ~/.agents/skills
(Library.SharedSkills; POST /api/library/skills/where {how};
magpie library skill where agents|shared). On, every library skill on
here gets magpie's link in ~/.agents/skills (syncShared, after
sweepShared), so every agent and tool reading that folder has it and
shows it locked. The files stay in the library rather than moving, so
updates, edit tracking and Off here keep working; existing skills just
get links when it is turned on, nothing is moved. A user's own entry by
the same name is never written over. Off takes out magpie's links there
and nothing else, and agents' own links come back. Per computer:
Collect doesn't carry it. docs/subsystems/library.md says all this.
Not covered, filed: on Windows without link rights the shared entry is
a marked copy, and takeEdits doesn't take edits made in it (#4958).
Run on mote rebased on
|
||
|
|
91379b9339 |
settings: a reply's model can be the vendor's own name again, the member, or the model asked for (ZoeCats)
ZoeCats (Discord #general): since v0.1.2473 a reply's model says the name the client asked for (a group or provider/model id), groups that aren't aggregates included, and the only way back to the vendor's own text was the X-Magpie-Response-Model header, which their client can't send. Settings › Models › Replies › Model name in replies (replyModel), picked from the app's menu, in en, zh, zh-TW, ja and de: - "" the model asked for (the default, as now); - member: magpie's provider/model that answered (what memberModel did; Claude Code, Claude Desktop and Codex still get the name asked for); - vendor: the vendor's own text, for every agent, the vendorNamed three included, as every agent got before v0.1.2473 and as the header's "vendor" already gave them. X-Magpie-Response-Model (asked, member or vendor) still picks for its request; an unknown value falls through to the setting, as before. memberModel is folded in without changing anyone's choice: a file with memberModel on reads as replyModel member, an explicit replyModel wins, and memberModel is written beside it as a mirror so an older magpie reads the same. An older page sending only memberModel changes the setting only when its switch moved (a vendor choice survives its saves). The CLI's set/reset goes through Keys/Choices (replyModel in place of memberModel). app.js's row is paid for by five comments in Settings' code cut down: app.js is 145 bytes under its base, no budget raise. Run on mote at this head (rebased on origin/main |
||
|
|
3a74cd92e8 |
claude: /usage waits for its figures, and a read without them is unknown
Seagull fries (haioushutiao, Discord #help; magpie 0.1.2704, Claude Code
2.1.316, Windows 11, Claude Pro): the Claude card said 暂时无法获取额度,
"Claude Code's /usage told no allowance: ❯ /usage ─── Settin s Status
Config Usage …". Reproduced with a real Claude Code 2.1.316 under
Windows' pseudo console in a sandbox: /usage's panel is drawn first with
"Loading usage data…" while Claude Code asks Anthropic for the figures
(5s timeout, retried only on a 401), and the helper took 3s of a still
screen as the panel drawn whole. On a slow answer it told the panel's
frame as the result, and parseClaudeUsage called any text with no window
"told no allowance". A failed load ("Error: Failed to load usage data",
"r to retry") went the same way.
claudetui:
- screen.go: a small terminal grid (CUP/CUU..CHA/VPA, EL, ED, ECH, CR/LF
with scrolling, OSC/DCS skipped, an escape or UTF-8 character cut
between reads kept), 200x50 on Windows as the pseudo console is made,
80x24 elsewhere. The pseudo console sends only the cells that changed,
skipping a cell that holds the same letter ("Settin\x1b[1Cs"), so the
stream read split words and kept a redrawn digit beside the old one.
While /usage is read, each look of the screen with a window is kept
(panel), and usageText reads that before the stream.
- command(), built on b4073c06a's wait for the panel (ikunbots; its
usageDrawn and "hadn't drawn" error kept, now also judged on the grid,
since the pseudo console's split "Settin s" never matched its tabs):
"Loading usage data" on screen is waited out (to
commandWait, s.doing "was still loading /usage's figures" for the
deadline message); "Failed to load usage data" gets one "r"; a panel
still with no figure and loading or failed on screen is an
error_during_execution result, "/usage couldn't load the plan's usage:
<screen>".
- the fake draws the panel a frame at a time (fakeFrames), as Claude Code
does: with one write, the pseudo console passed on only the last
frame, which no longer shows the windows. TestShimReadsUsage now passes
on Windows (#4820, the fake's side; a real panel with figures was not
seen on Windows, see below).
provider:
- parseClaudeUsage: a panel with no figure is "Claude Code's /usage
showed no usage figures: …", not "told no allowance" (kept for
claudeUsageDenied's refusals).
- claudeUsageUnknown: Claude Code's "temporarily unavailable" and the
helper's "couldn't load the plan's usage" keep the account's reported
reading (quota_last), as the first did alone before. Other no-figure
text is still shown as an error (TestClaudeHeaderSurvivesUnclassified-
UsageFailure, TestClaudeUsageReadingAloneDoesNotHideUnclassifiedFailure
hold that).
Fixtures are the reporter's case as the pseudo console passed it on for
the real 2.1.316 (a temporary dump of the helper's screen bytes, sandbox config,
proxy that never answers / refuses): testdata/usage-loading-win-2.1.316.bin
and usage-failed-win-2.1.316.bin.
Run at the pushed head:
- mote: go test ./internal/claudetui ./internal/provider ok; go test
-run 'Claude|Usage|TUI' ./internal/gateway ok; GOOS=darwin/linux/
windows go vet ./internal/claudetui ./internal/provider ok; gofmt -l
clean.
- xiaomi-gpu (win-run): go test ./internal/claudetui: all pass except
TestShimFirstMessageWaitsForTools, red on Windows at main (#4810).
- xiaomi-gpu, real Claude Code 2.1.316 (npm), sandbox CLAUDE_CONFIG_DIR
with a fake token, magpie.exe built from this tree, helper run as the
gateway runs it: a proxy that never answers gives is_error "/usage
couldn't load the plan's usage: … Settings Status … Loading usage data…"
after the 20s wait (was a success with the chrome); a refused proxy
shows "Failed to load usage data", "r" is pressed, and the same error
comes back in 6.6s. "Settings" is whole now.
Broken by hand (before the rebase onto b4073c06a; the merged loop is
re-checked below):
- old tui.go: TestShimWaitsForUsageFigures slow, retried and failed again
all red, each telling the reporter's chrome as success.
- the "r" not written: TestShimWaitsForUsageFigures/retried red.
- old parse message: TestClaudeUsageWithoutFiguresIsUnknown red ("told
no allowance"); old quota_last check: its couldn't-load cases red.
- after the rebase, on the merged loop: the "r" not written,
TestShimWaitsForUsageFigures/retried red; the old "anything still 3s"
in place of usageDrawn on the grid, TestShimWaitsPastTheBanner red.
Not tried: a real account (the box has none of the owner's), so a real
2.1.316 panel with figures was never seen through the pseudo console;
whether Claude Code's frames that show the windows reach the pseudo
console's output before it renders the next one is shown only by the
fake. Not taken: asking Anthropic's /api/oauth/usage, which the owner
ruled out (
|
||
|
|
6c08ee13b0 |
gateway: a model asking for earlier reasoning back goes on to the group's next member
EDwinpzy (Discord #feedback, magpie 0.1.2717): Command Code's reflection/beam:free answered a second turn with 400 "Missing required parameter: 'messages[N].reasoning_content'". The 400 wasn't retryable, so a routing group of Beam then Glyph ended at Beam and never asked Glyph. The client's request is whole; it is that model's demand for history it doesn't have, and another member's model may not make it. reasoningBackRefused (thinking_back.go) reads the demand: DeepSeek's "must be passed back" (thinkingBackRefusal) and words that name reasoning_content as missing or required. shapeRefused and retryable take it, so the member fails as a shape refusal (failShape): no rest, the next member is asked once. refuseThinkingBack's refill still runs first, inside forwardOnce. A 400 for a missing 'messages' or 'model' still stops at the first member. The plugin side (commandcode 0.1.22 fills Beam's earlier replies with reasoning_content) ships separately. Tests: TestGroupFailsOverAMissingReasoning (chat and responses routes, the reporter's two-turn shape, his words in the Provider API's error JSON) and TestMissingReasoningIsNotABadRequest. Run on mote: go test -count=1 -timeout 45m ./internal/gateway: every test passes except TestCodexPoolSaysTheClientsVersion, red in a full package run and green alone, already filed as #4807 (another test's Codex identity reaches it); go test ./internal/provider ok; GOOS=linux and GOOS=windows go vet ./internal/gateway ok; gofmt -l clean. After a rebase on |
||
|
|
b4073c06a0 |
claude-tui: /usage waits for its panel, never takes Claude Code's banner as it (ikunbots on X)
ikunbots (v0.1.2738) showed a Claude card saying "Claude Code's /usage told no allowance: ▘▘ ▝▝ /private/var/folders/…/magpie-claude-work-501 ────". After /usage is typed, Claude Code draws itself again (banner, folder, the prompt's rules) before the panel. A slow /usage leaves that still, and the helper took any screen still for 3s as the panel, so the banner was told as /usage's answer and parsed as an error. Now a screen without "NN% used" counts as drawn only when the panel's Settings tabs show and nothing says loading (usageDrawn). With no panel by commandWait (or the caller's deadline), the result is an error naming what was last drawn, never a success carrying the banner. Run (on mote): - go test ./internal/claudetui/: ok (new TestShimWaitsPastTheBanner: the fake draws the reporter's banner, then the 2.1.316 panel 4.5s later; TestUsageDrawn; a "banner, no /usage panel" case in TestShimEndsAtItsCallersDeadline). - Broken by hand (old "anything still 3s" condition back): TestShimWaitsPastTheBanner red, told the banner as the result, as in the report. - go test -run 'Usage|TUI' ./internal/gateway/ ./internal/provider/: ok. - GOOS=darwin/linux/windows go vet ./internal/claudetui/ ./internal/gateway/: clean; gofmt clean. Not tried: a real slow /usage on a real account; the "loading" word is a guess at the panel's loading text, which only keeps waiting longer. |
||
|
|
dfd3b720bd |
docs: the gateway's OpenAI images and videos routes, and what each vendor is sent
A table of POST /v1/images/generations, /v1/images/edits, POST /v1/videos, GET /v1/videos/{id} and /content, what each takes and answers, and each vendor's translation, checked against draw.go, draw_volcengine.go and video.go. Asked for by axelburks on Discord. Docs only; nothing run.
|
||
|
|
5bd1aee637 |
video: Seedance takes a last frame and Ark's own fields through /v1/videos
/v1/videos read OpenAI's request into Ark's content-generation body but left out the last frame (last_frame, which magpie reads for MiniMax), and dropped every field OpenAI's API doesn't have, so a caller in OpenAI's shape couldn't turn off Seedance's audio, fix a seed or ask for an adaptive ratio (axelburks on Discord asked that the OpenAI shape be converted to the vendor's). volcengineVideoBody now sends last_frame as an image_url item with role last_frame, and passes the request's other fields on as sent (masked as the prompt is, as for a provider's own videos API). A multipart form's "false" or "42" goes as false or 42, as Ark takes them. Run (mote): at a7f31ef46 (this stack on |