e4e22b23ec49ca0db92ff62992c8ef6661341eed
2813
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e4e22b23ec |
gateway: a relayed Gemini stream the upstream cut short ends in Gemini's own error (#1644, ggbdpq)
What: a Gemini client's stream relayed as it comes (a custom provider's Gemini URL, Vertex AI) that the upstream stopped cleanly before a candidate's finishReason was delivered as if whole: the relay's cut check (#370) only knew Anthropic's message_stop and Responses' response.completed. Now the usage sniffer marks a Gemini SSE stream ended on geminiEnds (the #1643 rule: a candidate's finishReason, or a chunk with no candidate), the tail switch counts Gemini, and streamFailure writes Gemini's own mid-stream error, the shape geminiEncoder already uses: data: {"error":{"code":502,"message":...,"status":"UNAVAILABLE"}} with no event line (Google's SDK reads none). Sibling: before this, a read that failed mid-reply on a Gemini relay (cutMidReply) also went through streamFailure's default and wrote Anthropic's "event: error" shape to a Gemini client; it now gets Gemini's. usageMetadata is not taken as an end, as the reporter suggested: Vertex AI sends it on every chunk (the captured vertexThought bytes). Run: - New TestGeminiRelayEndedShort: the captured Vertex reply cut mid-answer ends in the Gemini error and no event: line; the whole reply and a usage-only reply go as they came. - Broken by hand three ways, each red: Gemini dropped from the tail switch (the cut ended silently); streamFailure's Gemini case removed (Anthropic's event: error was written); the sniffer's geminiEnds removed (the whole and usage-only replies wrongly got the error). - go test -tags nogui ./internal/gateway -run 'GeminiRelay|Sniff|Passthrough|CustomGemini|Vertex': ok. - go test -tags nogui -count=1 -timeout 40m ./internal/gateway after rebase on origin/main: ok (505s). - gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway clean. Not run: no real Gemini CLI or Vertex relay cut mid-reply; httptest serving captured Vertex bytes cut by hand. |
||
|
|
17c56ed245 |
gateway: a Gemini reply the upstream cut short ends in an error, not as if whole (#1643, ggbdpq)
What: a translated reply from a Gemini upstream (a custom provider's
Gemini URL, Vertex AI, Factory's generate route) or Code Assist
(Antigravity) whose stream stopped cleanly before the last chunk was
delivered to the client as a whole reply: finish_reason "stop" to a Chat
client, end_turn to Claude Code, 200 to a client that asked for no stream.
The cut check from #1562/#1563 (errEndedShort) only ran for Anthropic and
Responses, since Gemini chunks have no type and there is no [DONE].
Why this way: geminiEnds reads a candidate's finishReason (Code Assist's
inside "response"). The reporter's patch also counted usageMetadata as an
end, but Vertex AI sends usageMetadata on every chunk
({"trafficType":"ON_DEMAND"} until the last; the captured vertexThought
bytes), so a real Vertex stream cut after any chunk would still read as
whole. A chunk with no candidate at all (usage alone, a blocked prompt)
does end the stream: the reply said nothing, and #667's empty-reply path
still handles it (TestGeminiEmptyReplyIsAnError's "no candidate"). An
error chunk still reaches the client as the vendor's own error, because
failed is set and the cut check needs failed == "".
Run:
- New TestGeminiUpstreamEndedShort (Chat and Anthropic clients) and
TestGeminiNonStreamEndedShort use the captured Vertex AI reply cut
after "No, 391 is not prime because it is". Broken by hand (geminiKin
dropped from the two cut checks), both fail: the Chat stream ended
"stop", the Anthropic one end_turn, and the non-streamed one came back
200 whole. With the fix, the Chat and Anthropic streams carry the
error, the non-streamed request gets a 502, and the whole reply is
served as it came.
- TestGeminiEnds: the Vertex usage-only chunk is no end; finishReason,
Code Assist's wrapped one, and no-candidate chunks are.
- go test -tags nogui -count=1 -timeout 40m ./internal/gateway: ok (425s).
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gateway: clean.
Not run: no real Gemini/Vertex/Antigravity stream cut mid-reply. There is
no reporter's live case; the fixture is a captured Vertex reply cut by
hand. Code Assist is covered by the geminiEnds unit test only, not an
end-to-end Antigravity request. A relay that strips finishReason from
whole Gemini streams would now get the error; none is known.
|
||
|
|
53abc8e283 |
gateway: a script Claude Code starts, naming a Claude id magpie doesn't serve, goes to Claude Code's tier (tbxark on X)
tbxark's request log: Claude Code's own requests went to its tier, while Python-urllib asked /v1/messages for claude-sonnet-4-6 and claude-opus-5-5 and got 404 "unknown model" in 5 ms. A hook, the statusline or a plugin's script that Claude Code starts inherits its ANTHROPIC_BASE_URL and token, so it reaches magpie with the plain gateway token and its own User-Agent. claudeTierStandIn mapped a Claude id to Claude Code's tier only for a request magpie took for Claude Code, by its User-Agent, so the script's ids went nowhere. Now a request that came with the plain token (not a magpie-<agent> token magpie gave an agent), whose User-Agent names no agent magpie knows (usage.IsAgent; claude-desktop and cursor-local are known too), and that names a Claude-family id magpie doesn't serve, gets Claude Code's stand-in for it, on /v1/messages and on count_tokens (the one choke point both use). Nothing changes when: - the id is served (a Claude subscription or an Anthropic key in the catalog lists it): it goes where it is served, as before; - the caller is an agent magpie knows, or uses an agent's own token; - Claude Code isn't routed through this gateway (StandIn says nothing), so the 404 stays. Run: - TestClaudeTierForAScriptClaudeCodeStarted (new) fails on the old gateway.go (404 for urllib, "", anthropic-python; count_tokens counted 0 without reaching the tier). Breaking the token check by hand or the served-id check by hand turns it red too. TestIsAgentByUserAgent (new, internal/agent) covers IsAgent with the real agent list. - Sandbox HOME, a fake Anthropic upstream, `magpie serve` on 127.0.0.1:3561 with Claude Code's settings.json routed there (sonnet/opus tiers set): python3 urllib POST /v1/messages claude-sonnet-4-6 with x-api-key magpie: old binary 404 "magpie knows no model", new binary 200, upstream got m-sonnet-tier; claude-opus-5-5 -> m-opus-tier; count_tokens reached the upstream on m-sonnet-tier. A codex_cli_rs User-Agent still gets 404. - gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; go test of every package (gateway with -timeout 25m). A full ./... run on the loaded Mac timed the gateway package out at 10m (#1654); run alone it passed in 330s. |
||
|
|
f57dc9610b |
library, gui: an instruction set made, saved or removed writes only the instructions, and the page holds its buttons while it does (#1624, Hipple)
On Windows 11 the Library's Instructions tab took 30s+ to show, and each instruction made, saved or removed took about a minute with nothing on the page to say so; a second click made a second set or removed twice. What an instruction change cost: - SaveInstructions and ImportInstructions went through change(), which gives every agent its MCP servers and skills again too (takeEdits and syncSkills look through every skill folder, and the projects), and the API then answered with a whole library.Read, which reads every agent's skill folders through again (foundSkills, behind: minutes on a machine with many skills, #541). - Every read of the library found the agents (Targets: every agent's folders, WSL too) three times: ReadInstructions, readView, and foundServers. Now: - library: changeInstructions writes only the instructions into the agents (with backups as before); readView finds the agents once and passes them to instructionsView and foundServersOf. ReadInstructions stays for the TUI. - gui: an instructions/* action answers {part: "instructions", instructions, result, problems}; the problems the last change had with servers and skills stay, those with the instructions are the new change's. - library.js change(): one change at a time; while one is out the page's (and the Library dialog's) buttons are disabled, the page is aria-busy, the button pressed says "Saving…" and so does the status. An answer with part "instructions" is merged into the page's library. Timed on the Windows test box (sandbox profile, 1 agent, 80 skills, copy mode): an instruction create was ~170ms + a ~460ms Read, now ~80ms + a ~70ms instructions read; Glance 350 -> 200ms, Read 480 -> 320ms. The 30s/1min the reporter sees wasn't reproduced there. Tests (each fails on the old code): - TestInstructionChangeWritesOnlyInstructions: a server taken out of codex's config by hand stays out through instruction create, switch, save and remove, and comes back with a server change. - TestInstructionChangeAnswersInstructions: the instructions answer and the problems kept. - library-instr-busy.test.cjs: a double click on Add sends one create, every page button is disabled and the pressed one says Saving… while the answer is held, the page keeps the rest of the library after an instructions-only answer; the sure Remove double-clicked sends one. Chromium and WebKit, en/zh/zh-TW/ja/de. Also run: go test ./internal/library ./internal/gui ./internal/tui; gofmt; GOOS=linux and windows go vet; every library*.test.cjs plus the 30 other GUI tests that reach the Library, Chromium and WebKit: all pass but library-mcp-tool-switch in WebKit, which fails the same alone on origin/main (#1609), and mobile-web's desktop-vs-main check, which needs a git checkout the scratch copy it ran in hadn't. |
||
|
|
47ccb7165b |
gui: Usage's Output speed card keeps its number inside it, and a page's bar across its foot is as thin as at its side on mac (#1623, fanbuz)
At ~983px on Usage › Requests the Output speed figure with its reply
count ("48 token/秒(781 次)", since
|
||
|
|
d5cae267a7 |
gateway: image recognition and web search pick only models the user enabled (JonahFu on X)
On a provider with a long list, AutoVision and the searcher picked their
small model from everything the vendor lists (Available), not from what
the user enabled. A Trae CN user's text-only model had its image sent to
OpenRouter's anthropic/claude-haiku-5.5, which they never enabled and
which OpenRouter refused for their region (403).
smallModel, and so AutoVision, searcherModel and the searcher's
first-model fallback, now chooses from Exposed: the user's picks, else
what agents are offered. With no enabled model that sees, a request
turned away says so ("none of the models enabled in magpie can see
images ... enable one that can, or pick one in Settings → Models → Image
recognition"); Vision off says it is off; a describer magpie picked
itself that fails is named as magpie's pick.
Not done: no fallback to another describer on a refusal. With the pick
limited to enabled models, a refusal is of a model the user chose, and
the error now names it and where to change it. Image generation's
AutoDrawer still picks from image models a provider lists: image models
aren't in the chat pickers, so limiting it to picks would turn drawing
off for nearly everyone.
Run: the two new tests fail on the old code (AutoVision =
router/google/gemini-3-flash, searcherModel = google/gemini-3-flash) and
pass now; go test ./... green except internal/gui's
TestDockJoinLeadsCommandTab, which reads the live desktop's Command-Tab
order and passes run alone; gofmt; GOOS=linux and windows go vet
./internal/gateway.
|
||
|
|
221e24a3c7 |
agents, gateway: Codex's subagent model offers every provider's models, not only ChatGPT's (#1633, laacmilan)
The Agents page's Codex "subagent model" field (settings.CodexSubagentModel,
which the gateway puts x-openai-subagent collab_spawn requests on) listed
only the ChatGPT accounts' models, and its setter refused any other
provider's. A user whose lead runs on a chat provider (Token中心, 智谱Plan)
couldn't put its subagents there.
- provider: CodexSubagentModels is Codex's shown catalog
(CatalogFor("codex"), so hidden or unpicked models stay out), ChatGPT
accounts first, routing groups included. SetCodexSubagentModel takes any
provider/model or group id, refuses a bare Codex name.
CodexSubagentUnserved says "magpie doesn't serve it now" for a non-ChatGPT
id that isn't served. CodexAccountModel exported.
- gateway: codexSubagentPick gets the body. When the lead ran on the
ChatGPT backend the task arrives sealed (encrypted_content), and only a
ChatGPT account can open it: set to another provider, such a subagent
stays on the model asked for, with Kept = sealedKept in the route trace
(#1613's constraint; the reverse, a chat lead with a subagent on ChatGPT,
was already handled by
|
||
|
|
0b0bd38b3f |
release: each tagged release is copied onto yetone/magpie with its notes and all 16 assets (PapainTea on X)
The main repo's Releases page was empty: the installers live only on yetone/magpie-releases, which is bad for finding magpie and confusing to people who look here first. A new mirror-release job, after the dispatch, waits (up to an hour, every 30s) until the magpie-releases release for the tag has 16 assets, downloads them, and creates the same release here with GITHUB_TOKEN (contents: write): title "magpie vX", the same notes plus a link to the magpie-releases page. A rerun edits the notes and replaces the assets. It fails when fewer than 16 land here. Nothing reads this repo's releases: self-update (internal/update), install.sh and the site's /api/latest still read magpie-releases, unchanged. A release made with GITHUB_TOKEN triggers no workflow, and none here listens for release events. Run: YAML parses; the wait and download half by hand against v0.1.1191 (16 assets, 554M, title "magpie v0.1.1191"). The create half runs for the first time on the next tag. |
||
|
|
639826a89d |
gateway: a routing group's compaction rule takes Minis's compactions (#1635, jueda12)
Minis (OpenMinis, iOS and Android) compacts with one request and no
tools: its own system prompt ("You are a context compaction engine. Your
summary will REPLACE the original messages in the conversation context
window. ...") and the conversation wrapped in one user message ending
"END OF CONVERSATION TO COMPACT.". Neither was in compactSystems or
compactAsks, so a group's Compact rule never matched it and Minis's
compactions went to the group's ordinary model.
Both are added, keyed on Minis's own text, not its User-Agent (which
Android lets the user change). The prompts were read from OpenMinis at
b4c0661 (Android ChatViewModel.kt compactSummarySystemPrompt and its user
message; iOS AIChatViewModel+Compaction.swift, whose line continuations
render the first paragraph to the same bytes), and the test's fixture is
those literal bytes.
A general signal (no tools plus a summarize request) was considered and
not taken: an ordinary tool-less chat asking for a summary would be sent
to the compaction model too.
Run: go test -tags nogui ./internal/gateway, gofmt -l, GOOS=linux and
GOOS=windows go vet. With the two entries removed, TestCompactingMinis
fails for all four compaction cases.
|
||
|
|
957aa79aa3 |
provider, gateway: refreshing a saved Claude account's card reads its allowance through Claude Code, without switching to it (#1630, hhh2210)
A saved (not signed-in) Claude account's Usage card read nothing on Refresh: claudeWindows only ever ran /usage for the account Claude Code itself is signed in to, so the button did nothing for the rest. Now the card's own refresh (RefreshUsage for that account, savedRefresh) runs the real Claude Code's /usage with CLAUDE_CONFIG_DIR set to the account's claudeSavedDir (readSavedClaudeUsage). magpie still never calls Anthropic with the token itself, and Claude Code's own account is not switched. The 30-second per-account floor holds, background reads keep the last reading, and asks for every card (the Usage page opened, magpie quota, magpie accounts) start no Claude Code per saved account: they keep the last reading, or the "not read yet: refresh this account's card" note. Claude Code may refresh the account's token in that directory while it runs, spending the old refresh token. So: - inSavedClaudeDir holds a per-account RWMutex (claudeDirRun) for the run, and switchSavedLogin takes it for writing first, so a switch never hands Claude Code a copy the run has just spent; - syncSavedClaude copies a rotated sign-in from the directory back into logins.json right after the run, under savedTokenMu and loginsMu. Two Claude Codes in one directory are kept from refreshing at once by Claude Code's own lock file (2.1.296's refresh lock in its config dir). A saved account's warm-up, which already ran in that directory, now goes through inSavedClaudeDir too. The plumbing (configDir through UsageClaudeVia, readClaudeUsage and the gateway's claudeUsage, and TestClaudeUsageRunsInSavedAccountDirectory) is from hhh2210's patch 043ee7d7, reviewed line by line. Its gate (any explicit read reads every saved account) was narrowed to the card's own refresh, and the lock and sync back are new. Run: go test -tags nogui ./internal/provider ./internal/gateway . (sandbox HOME, fake claude via UsageClaudeVia, no real token), gofmt -l, GOOS=linux and GOOS=windows go vet on the three packages. Broken by hand, each red: saved never read (all three new tests), any ask reads saved (TestRefreshSavedClaudeUsage), switch not held and no sync back (TestSavedClaudeUsageKeepsRotatedSignIn / SavesRotatedSignIn), run in "" instead of the account's directory. Not tried with a real Claude Code binary against a real saved account. Co-authored-by: hhh2210 <hzy2210@gmail.com> |
||
|
|
756fef4921 |
gui: an update out, downloading or failed offers its release page in the browser (PapainTea on X)
Where GitHub is slow to magpie, the built-in download can take ages. The About row's update now has "Open the release page" while an update is available (desktop; on web Download already opens it), while it downloads, and after a download error. The browser can then fetch the installer through the user's own proxy or accelerator. The mirror setting is unchanged. The button is kept across the 700ms download redraws, so a click on it isn't lost, and it goes away once the row is back to up to date. The string was already translated (en, zh, zh-TW, ja, de). Run: new update-release-page.test.cjs (5 languages, 560/900px, chromium and webkit: 22 pass, twice). Broken by hand three ways: the button made again on every redraw, no button while downloading, and the button never removed. Each one went red. All update-*.test.cjs pass (auto, blocked, check, download-percent, hide, mirror, notes-ask, stuck, wait). |
||
|
|
396a6a3d4f |
gateway: a flood of wrong remote keys is capped to 429, so a weak caller key can't be guessed unthrottled and each try stops being a valid/invalid oracle (akic404 on Discord)
A pentest of a publicly-exposed magpie gateway found the auth entry had no rate limit: a remote client could try keys as fast as it liked. The system key (sk-magpie-key-<48 hex>) is infeasible to guess, but a weak user-set key (8+ ASCII) is not, and every try returned a distinct 401 that told the caller whether the key was valid/well-formed. tooManyAuthFails is one token bucket (50 wrong keys, then ~1/s) shared across all remote callers. identifyCaller spends a token only on the !ok && !local branch; once empty, later wrong keys get 429 + Retry-After instead of the 401 message, closing the oracle and bounding the work. A request carrying a valid key, and any loopback request, never touch the bucket, so flooding wrong keys can only clamp later wrong keys -- it can never lock out a real caller (no self-DoS, which is why the bucket is global, not per-IP: behind a reverse proxy every caller shares the proxy's address anyway). Left unchanged, by design: the last-4 echo for a long key (#545, it names only the caller's own submitted key, for debugging), and MAGPIE_WEB_KEY (already forced >=16 chars + a charset in internal/gui/web.go). Run (macOS): go test ./internal/gateway/ ./internal/access/ (both ok); gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/gateway/ clean. Broke tooManyAuthFails to always return false and watched TestAuthThrottleSparesValidAndLocal go red ("never clamped to 429"). |
||
|
|
b0e25696eb |
gui: a segmented control's thumb glides once, one way, and no other thumb moves when a save redraws the page
Settings' Off/On (Lightweight mode in the report) shook back and forth when clicked, and the first click on the page replayed every thumb's animation. Why, in the old slide(): - Every save's answer runs renderSettings(), which draws a new control and a new thumb for each one. The new thumb took its place from what was remembered: within 300ms of the click it started from the position before the click, so a redraw mid-glide sent the thumb back to Off and slid it again. - Settings is drawn while hidden (at start, or from another tab), so every control was remembered 0 wide. thumbsUnderPicks put the DOM right when the tab was shown but never the memory, so the first save's redraw grew every thumb on the page in from the left. #1211 ( |
||
|
|
f156d90460 |
agent, gui: Codex isn't handed to a magpie it can't reach, through a proxy or after magpie quits (Muma102kMichael, Leon920717, thisisvainxx on X)
Muma102kMichael (Windows): after magpie took Codex over, every project and every new chat got 502. Codex's reqwest sends its requests for http://127.0.0.1:3425 through HTTP_PROXY/ALL_PROXY or the system's proxy, and only an exact IP or a CIDR in NO_PROXY (on Windows, with no NO_PROXY, the bypass list with "*." removed) keeps 127.0.0.1 off it: "127.*" and "localhost" don't, and macOS' exceptions aren't read. A proxy in global mode answers 502 for every request. With [features] respect_system_proxy Codex asks the system alone and goes direct with no proxy set there. Account failover, which magpie writes uninvited when 2+ ChatGPT accounts are on, put all of Codex's traffic, its own models included, behind that proxy. - codex_proxy.go works out Codex's proxy the way Codex does and probes GET / through it (must answer as magpie). Failover waits for that probe and isn't written while the proxy doesn't pass Codex on; one written before goes again. - New drift kind "proxied": the Agents pill says Codex reaches magpie through a proxy that doesn't pass its requests on, How to fix names the fix (DIRECT rule for 127.0.0.0/8, NO_PROXY=127.0.0.1, or 127.0.0.1 in Windows' bypass list), and the dialog has a one-click Disconnect from magpie (also on unreachable drift). - Leon920717: after quitting magpie Codex kept retrying. The app that serves the gateway now takes failover out in OnShutdown (EndCodexFailover); the next start's Sync writes it again. A connected Codex is kept (its model is magpie's; Disconnect restores). A kill or crash still leaves failover in place. - thisisvainxx: "several restarts". Codex's app-server keeps the base URL it started with, and KeepCodexDaemonCurrent ends with magpie, so EndCodexFailover restarts it when no codex session is on it. Run: - real codex-cli 0.162.1 in a sandbox CODEX_HOME against a fake 502 proxy and a fake gateway: NO_PROXY=localhost,127.* -> 30 POSTs to the proxy; NO_PROXY=localhost -> proxy; NO_PROXY=127.0.0.1 -> gateway; respect_system_proxy with HTTP_PROXY set -> gateway directly. - go test -tags nogui ./internal/agent/ (full package, 465s, ok) and the new tests after the daemon change; each new test went red with its guarantee broken by hand (failover gate, drift, EndFailover, daemon restart on quit). - node --test agent-proxied/agent-unreachable/agent-failover/ agent-disconnect-preview: 104 passed, chromium + webkit, en zh zh-TW ja de, window and panel. - gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui clean. Not tried: the quit path in the real app, on the Windows box, or whether computer use / remote connection broke for this same reason. |
||
|
|
8029d98b7e |
gateway: a large Codex request ChatGPT closes on is asked again, not told 413 (#1628, ScarfQian)
ScarfQian (#1628, v0.1.1184, Codex desktop computer use on a ChatGPT
subscription): a 1.1 MiB turn answered with ChatGPT's 503 "upstream
connect error or disconnect/reset before headers. reset reason: remote
connection failure" came back as a2b96139c's 413 "dropped this 1.1 MiB
request ... magpie didn't retry it". Codex doesn't retry a 4xx, and every
later turn carries the same screenshots, so each one got one try and the
same 413 and the conversation was stuck.
|
||
|
|
cfa280a6c2 |
provider, gateway, gui: You.com can be added as a search API, with no key for its free search or with a key (#1626, brainsparker)
A model's web search, when no provider can search, goes to the search APIs the user added; each of them needed a key except a SearXNG of the user's own. You.com answers with no key too, so it is one a user can add in one step. - provider: SearchVendor has KeyOptional (You.com, SearXNG); Ready and check let a vendor that has it go with no key. You.com is listed between Firecrawl and SearXNG, its keys at you.com/platform. - gateway: with no key, GET https://api.you.com/v1/agents/search?query= &count=6 (YouFreeSearch); with a key, POST https://ydc-index.io/v1/search {"query","count"} with X-API-Key, as its API reference says; with a base URL of the user's own and no key, GET <url>/v1/agents/search. Both replies are read from results.web then results.news: the snippets, else the description, and page_age. You.com's errors are a code beside a message, so the message is what the user is told (a 402 "prepaid credit balance has been depleted" is a refused key, the next key or API is asked). Its requests carry the User-Agent tag You.com asked for, "youdotcom-integration/yetone-magpie", after magpie's own. - gui: Settings › Web search lets You.com be added with the key empty, its placeholder saying so (zh, zh-TW, ja, de). - cli: magpie search add you [<key>]; the help lists it. New network addresses: api.you.com (keyless) and ydc-index.io (keyed), asked only when the user adds You.com, with the search query only. Checked against the real service on 10-11: a keyless GET to api.you.com/v1/agents/search answered 200 (testdata/you/free_search.json is that reply, cut to 3 hits), and a real run through askSearchAPIKeys returned 6 pages. ydc-index.io/v1/search answered 402 with no key (testdata/you/keyed_402.json, real bytes) and 403 to a made-up key. The keyless endpoint isn't in the API reference; You.com's own docs pages for third-party tools describe it (free, 100 a day per address, no account), as LiteLLM, ragflow and AnythingLLM use it. you.com/terms bars automated use of its website and apps, not the API. The keyed request shape is from its API reference only: no key with credit was tried. Run: go test -tags nogui . ./internal/gui/ ./internal/provider/ ./internal/backup/ green; ./internal/gateway/ green but TestTurnDoneSaidAtTheTurnsEnd (#1629, fixed in its own commit); search-api.test.cjs in Chromium and WebKit, en/zh, 980/420px green; gui-ja, gui-de and i18n-keys green; gofmt -l; go vet -tags nogui for linux, windows and darwin. The tests make no network request (a stub RoundTripper). Without the change, TestYouSearch, TestYouKeyOutOfCredit, TestYouNeedsNoKey and TestSearchCLIYouWithoutKey fail, and with the GUI's keyOptional check taken out search-api.test.cjs fails in all four Chromium runs (Add sends nothing). |
||
|
|
09136a6bf1 |
gateway tests: TestTurnDoneSaidAtTheTurnsEnd starts its clock at the turn's first request, as Took does (#1629)
Took runs from the turn's first request, but the bound took its start
just before the third, so the first two sends and the two noEnd waits were
outside it. A slow first request on a busy machine pushed Took past
Since(start)+20*quiet ("took 1.488977083s", a full gateway run). start is
now taken before the first send, so Took can never be over it, and the
slack is gone.
Reproduced by injecting a 1.5s sleep in the fake's tool-calling reply:
the old bound fails both subtests (took 1.99s, 2.40s), the new one
passes; the lower bound (8*quiet) still catches a Took measured from the
last request. Run: go test -tags nogui -run TestTurnDone ./internal/gateway/.
|
||
|
|
56bc93e9fa |
gateway: a 400 saying the user's location isn't supported goes to the next member or the fallback, and isn't told as too long (#1621, WardLu)
Antigravity (and Gemini, Code Assist) answer a request from an address Google doesn't serve with HTTP 400 FAILED_PRECONDITION "User location is not supported for the API use." retryable() only let a 400/422 through for model, quota and credit wording, so a routing group stopped at the member and the backup provider was never asked; Claude Code's turn just ended. tooLongUnsaid could also read the bare 400 on a long request as a context overflow. regionWords now names the refusal: Google's sentence, OpenAI's unsupported_country_region_territory code and its "Country, region, or territory not supported" message. A 400/422 matching it is retryable, and tooLongUnsaid leaves it alone. It is about the address the request went out from (the machine, or the account's own proxy), not the request, so the member is rested as failOther: the default 1 min backoff doubling to 10 min, never the 30 min credit rest or days. As WardLu set out, not every 400 is retryable: "location field is not supported", "Invalid value for location parameter" and "messages: field required" stay where they were, and a 200 whose text has the sentence switches nothing. Run: go test -tags nogui ./internal/gateway/ (TestTurnDoneSaidAtTheTurnsEnd red under load, the cause in #1629 and fixed in its own commit; everything else green), -run 'Region|Shape|NoFallback|PayloadTooLarge|Fallback' green; gofmt -l; go vet -tags nogui for linux, windows and darwin. Without the change in fallback.go, TestRegionRefusalIsRetryable, TestRegionRefusalIsNotTooLong, TestGroupFailsOverARegionRefusal and TestFallbackOnRegionRefusal all fail. |
||
|
|
863af7abc8 |
provider: a provider's Extra body adds JSON fields to every request's body, ${sessionId} as the session (#1604, Luc-xz)
What: a provider has an Extra body (extraBody in providers.json, a JSON
object, beside Headers; an "Extra body" box in the editor under Headers).
Its fields are added at the top level of every JSON body sent to that
provider, in the gateway's forwardOnce: Messages, Chat, Responses and
Gemini, relayed as they came or translated from another API. Test models
and Detect send them too (provider.tested), so a relay that
refuses a request without them can be tested before a Save.
- A field the request already has is kept; "!name" replaces it.
- ${sessionId}, in any string at any depth, becomes the session id: the
agent's session header (sessionOf), else the id conversationID derives
from the first user message (magpie-<hash>), stable through one
conversation. Test and Detect send magpie-test-<12 random letters>.
- model, stream and the conversation (messages, input, contents, system,
systemInstruction, system_instruction, instructions, tools) are never
set from it: Save refuses them (ExtraBodyOK), the editor says why as
they are typed and holds the Save, and one written by hand into
providers.json is dropped on read (cleanExtraBody).
- Not sent: count_tokens, embeddings, images, video, the decision model,
and signed-in accounts' requests. One object goes to every API;
per-API sections aren't done.
- A save that leaves extraBody out keeps the saved one; {} clears it.
Why: Luc-xz's relay turns Responses requests away without a
prompt_cache_key, and headers alone couldn't add one.
Docs: providers-accounts.md has an Extra body row and its tests.
Run:
- go test -tags nogui ./internal/provider ./internal/gateway ./internal/gui
-run ExtraBody: pass. The tests are TestExtraBodyResponsesRelayed,
ChatDerivedSession, Translated (messages→chat, chat→responses),
Anthropic (count_tokens left alone), Gemini (relayed and from chat),
TestExtraBodyTested/OK/ReadByHand, TestWithExtraBody and
TestProviderExtraBodySaved.
- Broken by hand, each FAIL recorded, then restored:
- WithExtraBody removed from forwardOnce: all 5 gateway tests FAIL.
- the countsTokens guard dropped: TestExtraBodyAnthropic FAIL.
- tested() without the extra body: TestExtraBodyTested FAIL.
- Save's ExtraBodyOK skipped: TestProviderExtraBodySaved FAIL.
- keep-when-omitted skipped: TestProviderExtraBodySaved FAIL.
- internal/gui/tests/extra-body.test.cjs: en, zh, ja and de, in Chromium
and WebKit, 8/8 pass. It covers live errors, Save held and focused, Test
sending the typed object, the 420px fit, Save as an object, and empty
saving {}.
- Also run: gui-de, gui-ja, gui-zh-tw, i18n-keys, provider-*, providers-*,
balance-fix, duplicate-pause, editor-short-window, ux-safety and
vertex-editor.
- gofmt -l clean; go vet -tags nogui for darwin, linux and windows on
provider, gateway and gui; the full go test ./... after the rebase.
Not tried: a real relay that needs prompt_cache_key; the fixtures are
httptest upstreams.
|
||
|
|
a2afc18282 |
gateway: a turn's end reads its length and hook as the reply ends, not in its timer (race in 7cba316b9's tests)
CI's -race run (38146011985, ubuntu and macOS) caught TestTurnDoneSaidAtTheTurnsEnd and TestTurnDoneWaitsForEveryRequest: the quiet timer read turnAfter and TurnDone on its own goroutine while a test put them back or changed the length. end() now reads both as the reply ends and hands them to the timer; the tests change the length through an atomic and wait out a timer still going before restoring the hooks. Run: go test -race -count=5 ./internal/gateway -run 'TestTurnDone|TestToolScan' (ok, 37s); gofmt -l clean. |
||
|
|
234b2399c4 |
library: an MCP server an agent has of its own can be removed from it, its files backed up first (#1618, sxwedo)
A server listed under Library > MCP servers > "In your agents" could only be brought into the library. As a found skill can (#1303), it can now be taken out of every agent that has it, without bringing it in. - library.RemoveFoundServer(name): every agent the server was found in has it deleted from its MCP settings by the same per-format code the library writes with (JSON/JSONC paths, Codex and Grok TOML, Goose and Hermes YAML, dsh profiles, the Also files and the Extra files an agent still reads, Pi's old mcp-adapter.json among them). The user's other keys, comments and servers stay. - Every file it touches is copied to magpie's backups (res.Backup) before it is written; a file that doesn't hold the server isn't. - Every file is read before any is written: one that doesn't parse stops the removal with nothing changed (a failed read is unknown, not empty). The file is read back after, and a server still there is an error, not "removed". - A server the agent's app puts there itself (Own, e.g. Codex's node_repl) is refused: taking it out wouldn't last. The GUI doesn't list those, and the TUI says so. - An agent with a different server by that name (Others) is left alone. - GUI: a trash beside Bring in asks first, naming the agents, that each file goes to the backups and that the other server by that name stays; posts servers/remove-found. Strings in zh, zh-TW, ja, de. - TUI: d twice on a found-mcp row, as on a found skill. What was run: - go test ./internal/library ./internal/tui ./internal/gui (sandbox HOME). New tests: TestRemoveFoundServer (Claude/Codex/OpenCode files with user keys, comments and other servers that must survive; Gemini with a different one and an unparseable Cursor file left byte-identical), ...Unreadable, ...Own, ...EveryAgent (claude, codex, gemini, opencode, mimocode, pi, goose, cursor, copilot, crush, dsh), TestRemoveFoundEntryEveryFormat (every format, with backups), TestRemoveFoundEntryPiExtra; tui's d-twice found-mcp case keeps the rest of .claude.json. - Broken by hand, each went red: no backup, Extra file skipped, Extra unreadable read as empty (mcp.json must stay unwritten), no delete, Own allowed; GUI trash posting without the confirm. The main file unreadable read as empty stays green on purpose: nothing is written and the read-back still refuses. - GUI: remove-found-server.test.cjs (new), remove-found-skill, i18n-keys, every library-*.test.cjs, view-no-sideways, mobile-web, by-agent in Chromium and WebKit. library-mcp-tool-switch fails in WebKit with or without this change, and also when run alone (#1609); it has no found servers. - gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on the three packages. Not tried against a real agent's live config. |
||
|
|
8902ec2179 |
library: a server that admits only the apps it lists says so at Sign in, and leaves the sign-in to each agent (#1619, Xichun123)
Figma's remote MCP server (mcp.figma.com/mcp) allow-lists clients by the client_name they register with: its registration endpoint (api.figma.com/v1/oauth/mcp/register) answered a plain registration named Magpie 403 with the bare body "Forbidden" (tried once, by hand). The Library's Sign in then showed "registering magpie with the server's sign-in failed (403): Forbidden", which reads as a fault to retry. magpie doesn't register under another client's name. A 401 or 403 from registration is now mcpauth.ErrClientRefused: the server's sign-in admits only the apps it lists and turned magpie away; the agents given it still have the server's own address, so each signs in itself (in Claude Code, /mcp). That address is what they already get while magpie isn't signed in (library.through), so Claude Code, a client Figma lists, signs in there with its own registration. The message is translated into zh, zh-TW, ja and de. Other registration failures keep their status and body. docs/subsystems/library.md says it. Run: TestSignInRefusedByAnAllowListLeavesItToTheAgents (new, through library.SignInServer against mcpauthtest serving Figma's 403 bytes) fails without the change with the reporter's exact "registering magpie with the server's sign-in failed (403): Forbidden", passes with it, and checks claude, codex and cursor keep the server's own URL. mcp-signin.test.cjs (Figma case added) passes in Chromium and WebKit, en and zh; gui-ja, gui-de, gui-zh-tw and i18n-keys pass. go test -tags nogui ./internal/mcpauth/... ./internal/library/ ./internal/gui/ ok under a temp HOME; gofmt -l clean; GOOS=linux and GOOS=windows go vet ok. Not tried: Claude Code's own /mcp sign-in to Figma (no Figma account here). |
||
|
|
eed5a6a829 |
provider, gateway, gui: a GPT model on a provider you added can be switched fast in Routing and the picker (#1615, iomect)
iomect: "目前只有官key可以开启快速模式, 希望在路由设置中 支持给供应商也开启快速模式". Fast mode (OpenAI's service_tier "priority") was offered only on a ChatGPT account, an OpenAI key, Cursor and an Anthropic key's Opus. A relay or sub2api the user added themselves had no toggle, though Codex's own Fast already reaches such a provider as asked (OwnTier, #1234). What changed - provider.OwnFast: a GPT/o-series model (by its slug, openai/GPT-x too) on a provider the user added by its address (no preset, no account, no plugin, not a cloud), served on an OpenAI API (Chat or Responses), not OpenAI's own host. CanFast now includes it, so the Routing group member toggle and the agent picker's bolt offer it. Nothing is on by default: it is sent fast only when the user switches it. - gateway: such a member or pick is asked for service_tier "priority" on the provider's Chat/Responses API whatever API the agent spoke. An Anthropic-speaking agent gets it through the translated request (forwardTranslated, via a ctx mark), and Claude's speed "fast" or its beta is never sent to the user's provider (a relay may turn it away). A provider that turns service_tier away is asked again without it and not sent it again (the existing optional-field refusal path, keyed per provider and protocol). - gui: canFast members/models carry ownFast; the toggle's and the bolt's titles say fast is asked of the provider, "where your provider serves it", in en/zh/zh-TW/ja/de. Not done: a provider's Claude model is not sent Claude's fast mode (no way to know a relay serves speed "fast"), and no relay is special-cased. What was run - go test -tags nogui ./internal/provider ./internal/agent ./internal/gui ./internal/gateway (gateway -timeout 40m): ok. - New: TestOwnFast, TestFastMemberOwnProvider (chat/responses/anthropic asks, plus a relay with an Anthropic URL too: no speed), TestFastMemberOwnProviderRefusing (refused once in 3 calls per API), TestFastPickOwnProvider; TestCanFast checks OwnFast is false for every vendor-official case. - Broken by hand: without the forwardTranslated tier line the anthropic cases go red (no tier sent, refused 0 in 2); with withFast ungated the both-APIs relay case goes red (speed:fast sent to /v1/messages); with the ownFast titles off, fast-pick and group-member-fast go red in every language. - GUI: group-member-fast, fast-pick in Chromium and WebKit; gui-ja, gui-de, i18n-keys in Chromium. - gofmt -l clean; go vet -tags nogui GOOS=linux and GOOS=windows clean. - Not tried against a real relay's priority tier. |
||
|
|
49caff3caf |
provider tests: a no-wait return is asserted by holding the slow thing, not a wall-clock bound (#1617)
The siblings of #1586 that
|
||
|
|
7cba316b90 |
gateway, gui: a notification when an agent's long task is done, opt-in in Settings › Usage (itieniu on X)
itieniu asked for a "ding" when a long Claude Code or OpenCode task
finishes. magpie sees every request an agent sends through it, so the
gateway now follows each agent session's turn and the app notifies at
its end.
Gateway (turndone.go): a request is of the turn unless it is one the
agent makes on the side (Kind) or a Claude Code subagent's. Its reply is
scanned on the way to the agent for a tool call in every wire format
(Anthropic tool_use, Chat tool_calls/function_call, Responses
function_call/custom_tool_call/local_shell_call/..., Gemini
functionCall), as a JSON value, never a key ("tool_calls":[]) or text.
The turn is done when no request of it is going, the last reply was
whole, under 400 and called no tool, and nothing more came for 4s; a
session idle past 30m starts over. The ChatGPT backend path is followed
too. Only a turn at least Settings' TurnDoneAlert seconds long is told,
and only when the app set gateway.TurnDone: magpie serve follows nothing.
Settings: turnDoneAlert (seconds, 0 = off, the default, at most a day).
GUI: Settings › Usage "Task done alert": Off / 1 / 3 / 10 min; the
notification says "Codex is done", "Took 1m 8s · folder", in en, zh,
zh-TW, ja and de. A click on it doesn't open the Usage page.
Tests: TestTurnDoneSaidAtTheTurnsEnd (chat and anthropic through the
gateway: a tool reply, a subagent's last reply and a short turn don't
fire; a final reply fires once with session and folder),
TestTurnDoneCodexBackend, TestTurnDoneWaitsForEveryRequest,
TestTurnDoneOff, TestToolScan (every split point), TestTurnDoneText,
settings' range. Broken by hand: without the capture's scan, without the
subagent exclusion, or without the codex backend's scan, they go red.
turn-done.test.cjs: every language, 900 and 380px, chromium and webkit.
The new row moved the Usage tab's geometry: usage-alert and currency
now wheel their row clear of the header before clicking it, as a reader
would (both green 5/5 here; on base they were green as before).
Run: gofmt -l; go vet darwin, GOOS=windows ./..., GOOS=linux gateway and
settings; go test ./... (gateway alone: ok, 863s under a GUI suite's
load); the full GUI suite in both engines. codex-credits and
gateway-key-models fail now and then here on base
|
||
|
|
0370048f2a |
agent: Claude Code's /model lists a model a tier runs at an effort once, not again beside the tier (#1616, iTanX)
With Codex's Luna on Haiku at Max, the tier's model is written as codex/gpt-6-luna:max. Claude Code's /model drops a modelPicker row that names a tier's model, but compares the ids whole, so Sol's and Astra's rows (Opus/Sonnet/Fable, no effort) were folded into their tiers while Luna's bare row stayed as a sixth entry "GPT-6-Luna · <account> · via magpie" under "codex/gpt-6-luna:max Custom Haiku model". writePicker now leaves out the row of a model that a tier runs at an effort of its own, compared by model (claudeSameModel: effort and [1m] mark aside). Tiers at no effort are left to Claude Code's own matching, as before, so the #1575 routing-group row stays. The rule sits in writePicker, which every path that writes Claude Code's tiers goes through (writeTiers, Sync's refresh; WSL's Claude Code via claudeIn). No other agent writes a model id with an effort suffix into a list. Run: TestClaudePickerLeavesOutATiersModelAtItsEffort (new) fails without the change ("picker [cx/gpt-6.1-sol cx/gpt-6-astra cx/gpt-6-luna cx/gpt-6-terra]: want Luna, on Haiku at max, left out ..."), passes with it; go test -tags nogui ./internal/agent/ ok under a temp HOME; gofmt -l clean; GOOS=linux and GOOS=windows go vet ok. Not tried in a real Claude Code /model: the dedupe rule is the one the reporter's screenshot shows. |
||
|
|
c763d4fe1d |
provider: a moved ZCode or Command Code account is brought to plugin 0.1.15 / 0.1.10, which say the agent's folder (plugins #86, Hipple)
Raises the movers' min so keepMovedCurrent updates every moved user: - @magpie-community/opencode-zcode-auth 0.1.15 (plugins baa788b): the Start Plan's environment section says the folder and git repository magpie tells it, never magpie's own folder, and leaves out what it isn't told and the shell. - @magpie-community/opencode-commandcode-auth 0.1.10 (plugins 7e67b98): a Go request's workingDir and isGitRepo are the agent's. Both were published by the plugins repo's publish workflow and are the registry's latest. Run: go test internal/provider. |
||
|
|
93c93a80c4 |
provider: built-in ZCode's Start Plan and Command Code's Go request say the agent's git repository as it is, not a home or shell they don't know (plugins #86)
The siblings of plugins #86 in the built-ins, for accounts not moved onto the plugins. ZCode (zcode_client.go): the Start Plan's environment section already took the agent's folder from its prompt, but fell back to the user's home when the prompt named none, said "Is a git repository: no" whatever the folder, and said magpie's $SHELL/%ComSpec% as the shell. zcodePlace now gives the folder and the git state: the agent's word, else this disk's (GitSaid/GitOnDisk). Each line is left out when unknown, and the Shell line is gone, as in plugin 0.1.15. Command Code (gateway/commandcode.go): a Go request's config said workingDir: home and isGitRepo: false always. It now says the agent's folder (workPlace) and its git state the same way. A request with no folder keeps the CLI's config in the home, as plugin 0.1.10 does. Run: TestZCodeEnvironmentSaysOnlyWhatIsKnown and TestCommandCodeGoSaysTheAgentsFolder (new), TestZCodeStartSentAsTheApp updated (its /work/proj isn't on this disk, so no git line, and no shell). Broken by hand: with git always "no" both ZCode tests fail; with the old commandcode.go 5 of the 6 cases fail. go test internal/gateway, internal/provider; gofmt -l; go vet darwin/linux/windows. |
||
|
|
1075991f90 |
gateway: a plugin's fetch is told the folder the agent works in and whether it is a git repository, never seeing magpie's own (plugins #86, Hipple)
A plugin runs in magpie's plugin host, so its process.cwd() is magpie's folder. The ZCode plugin's Start Plan request said that folder (C:\Users\<user>\.config\magpie) as the agent's "Primary working directory", with "Is a git repository: no", and the model looked there. forwardOnce now calls tellWorkPlace on every request to a plugin's provider. It reads the request as sent to the plugin with workPlace (the same reading rules by folder use) and sets two headers on the plugin's fetch: - x-magpie-work-dir (provider.WorkDirHeader): the folder, percent-encoded (url.PathEscape; decodeURIComponent reads it); - x-magpie-work-git (provider.WorkGitHeader): yes/no. The agent's own word beside the folder (Claude Code's "Is a git repository: true/false", OpenCode's "Is directory a git repo: yes/no") wins. Otherwise it is a .git in the folder or above it, when the folder is on this computer (provider.GitSaid, provider.GitOnDisk in the new workplace.go). Each is left off when unknown; a folder that isn't on this computer and that the agent didn't call a repository has no git value, never "no". host.js's fetch (unsaid) takes both headers off every request a plugin sends, so a plugin that forwards the headers it was given sends them to no vendor. Documented in docs/subsystems/provider-plugins.md. Run: TestPluginToldWhereTheAgentWorks (new) sends the captured Claude Code and Codex requests, and Pi-style ones from a temp repo subfolder and a plain folder, through the fake plugin to fake-claude and fake-1. It checks what the plugin read and that the vendor got neither header. Broken by hand: without the tellWorkPlace call every case fails; without unsaid in host.js it fails with "the vendor got X-Magpie-Work-Dir". go test internal/gateway (-timeout 40m), internal/provider, internal/plugin; gofmt -l; go vet on darwin, GOOS=linux and GOOS=windows for the three packages. |
||
|
|
96de5cac29 |
gui: Providers has a search box, and a provider's right-click moves it to the top or the bottom (#1614, ququdu)
ququdu has many providers and kept scrolling to find one, and moving one
far up the list meant a long drag. The Providers page had neither a search
nor a quick move; its rows moved only by dragging the logo or Alt+↑/↓ one
step at a time.
- A search box over the list, at its right edge as Settings' is (full width
in a narrow window). The words typed keep the rows, on and off, whose
text or data say them all: name, id, preset, addresses, every model's id
and name, the account's user and plan and each login's, account names
and key names. The Turned off fold stays open while searching; nothing
found says so; Escape or clearing the box shows every row and the fold
as it was (findProviders).
- A row that is on has a right-click menu, as an agent row has: Move to
top, Move up, Move down, Move to bottom (openProviderMenu), with their
keys. Alt+Shift+↑/↓ on the logo go to the top or the bottom.
- While searching, a row still moves, among the rows shown: Alt+↑/↓ and a
drop put it where the shown row it passes was, and the hidden rows keep
their order (stepProvider, shownToOn). Move to top and Move to bottom go
to the ends of the whole list. Every move saves the whole order through
/api/providers/arrange as before.
- After a save, the keyboard stays on the handle it is on, also when it
was another row's taken up while the save was out (it was lost before).
- The logo's tooltip says right-click moves it to the top or the bottom.
- Drag already scrolls the page near its edges (dragRows); unchanged.
Strings in zh, zh-TW, ja and de. docs/subsystems/gui-shell.md says how it
works.
Run:
- provider-find.test.cjs (new), en, zh, zh-TW, ja, de at 420x560, Chromium
and WebKit: matches by name, model id, account user, key name and two
words; the off row found with its fold open; nothing-found text; Alt+↑ and
a drag while filtered, with the posted order checked; Escape; the menu's
four items, which are off at each end; Alt+Shift+↑/↓; nothing scrolled,
nothing but the order posted, no overflow. Fails on the old assets ("no
search box on the Providers page"), and goes red with each of five breaks
by hand: steps over the full list while filtered, no right-click menu,
drop index taken as a full-list index, no Alt+Shift, the off fold
honoured while searching.
- provider-order.test.cjs updated for the tooltip.
- Every GUI test that opens the Providers page (150 files): WebKit 754/754;
Chromium 748/752 under load ~100, the 4 in azure-endpoint and
routing-save (30s waits on the add sheet and routing) pass alone in both
engines, with provider-search, provider-order and settings-search
(31/31). gui-zh-tw, gui-ja, gui-de pass in both.
- go test -tags nogui ./internal/gui/... (sandbox HOME), go vet darwin,
GOOS=linux and GOOS=windows -tags nogui.
- Screenshots looked at: zh narrow with a search, zh wide with the menu.
|
||
|
|
0fcf563e61 |
routing: a pause rule can hold by folder, in some or outside them (#1606, Ti800)
Ti800 keeps a subscription's quota for one long task in one folder and wants every other request kept off it (their option A). A pause rule held by hours, days and agents only; it now holds by folder too. What changed - provider.Rule gains ExceptFolders (json exceptFolders, CLI except-folders=, aliases except-folder/not-in/outside): the folder the agent works in is in none of them. An agent that says no folder isn't known to be in one, so except-folders holds for it; folders= still never matches an unknown folder. Both conditions are allowed on send-to and pause rules (Rule.ByFolder, inFolders); cleanRules cleans and dedupes both and lets a pause hold by time, days, agents and folders. - PausedOut takes the request's folder. The gateway reads it (workDir) only when a pause by folder is on the way (PausesByFolder); embeddings and System One's decision calls pass none. Paused carries Folder and ByFolder for the trace. ruleFor reads the folder for except-folders rules too. - Group sharing drops every rule by folder, except-folders included. - CLI usage, TUI hint, ParseRule/Line round-trip except-folders. - GUI: the rule editor has a "not in folder" condition beside "in folder", both shown on a pause and kept when a rule turns into one; a folder that isn't a whole path and a pause with no condition are refused; the group's rule and the trace say "not in …", and a paused reason says the folder read or that the agent said none. Strings in zh, zh-TW, ja, de. - Docs: gateway-routing.md, site start.html (en, zh, ja). What was run - go test -tags nogui ./internal/provider ./internal/gateway (folder, pause, share, rule tests); full go test ./... before pushing. - Broke it by hand: with the gateway's folder read replaced by nothing, TestPauseByFolder fails (in-task requests went to the other member). - GUI: routing-pause-folder.test.cjs (new), routing-pause, routing-folder, i18n-keys and 10 other rule-editor tests in Chromium and WebKit, en/zh/zh-TW/ja/de, at 1100px and 390px. - gofmt -l; GOOS=linux and GOOS=windows go vet of the touched packages. Not tried: a real Claude Code subagent's request against a live group; by the documented rule a request without a folder is paused off the kept member, which is what the reporter asked for. |
||
|
|
7b151cf549 |
provider tests: the stale copy's prompt return is asserted by a held refresh, not a 40ms bound (#1586)
TestSubscriptionUsageServesStale said "a stale copy comes back at once while it
refreshes" by timing the call: a 50ms ctx and a 40ms bound on time.Since(start).
On a loaded machine the bound is what fails -- the report has "waited
311.332917ms for a stale copy" -- so the test said nothing either way about the
guarantee it guards. Which step of the call took those 311ms I did not
establish; the assertion no longer needs to know, because nothing is timed.
The refresh is now held at the vendor instead: CopilotUserURL points at an
httptest server whose handler blocks until released, so the refresh cannot
finish. The copy is asserted to come back while SubscriptionUsageReading still
reports a refresh in flight, which is the guarantee itself rather than a proxy
for it, and <-reached proves a refresh really went out, so the test cannot pass
by never starting one.
The test also resets c.asked, the one field of the cache it primes that it had
left alone. It is not set when this test runs -- AskUsage is the only setter and
quota_asked_test.go's own restart clears it -- so this is not the reported
failure's cause; it completes what the test already does to c.data, c.at and
c.pending, so the test does not depend on another file's cleanup.
What was run:
gofmt -l internal/provider/subscription_usage_test.go (no output)
go test -tags nogui -count=1 -run TestSubscriptionUsageServesStale ./internal/provider
go test -race -count=20 -run TestSubscriptionUsageServesStale ./internal/provider
go test -tags nogui -count=1 ./internal/provider (whole package)
go vet ./... ; GOOS=linux go vet -tags nogui ./... ; GOOS=windows go vet ./...
go build ; GOOS=linux go build -tags nogui ; GOOS=windows go build
go test -tags nogui ./... (53 of 54 packages ok; internal/gateway reds only in
the parallel run, which this change cannot reach -- it does not compile this
file -- and which is filed already as #1543/#1544)
Without the change: with SubscriptionUsage's "if !have && pending != nil" broken
to "if have && pending != nil" -- a copy that has data waiting for the pending
refresh -- the new test fails with
subscription_usage_test.go:97: got [], want only claude: a copy that waited
for the held refresh comes back with nothing
--- FAIL: TestSubscriptionUsageServesStale (12.51s)
Reviewed and landed from nrenvo/magpie fix/1586-stale-copy-test (b5bda612),
posted on #1586 because PRs are collaborators-only. Run at the cherry-pick on
origin/main
|
||
|
|
149ab950e7 |
gateway: a Codex lead on a chat provider goes on when its subagent on one of Codex's own models sends it a message, the sealed message left out with a note (#1613, laacmilan)
laacmilan's lead was on token/gpt-6.1-sol, an API key on Chat Completions. Codex put a subagent on one of its own models, which magpie serves from the ChatGPT account. The ChatGPT backend seals that subagent's send_message, and Codex hands it to the lead as an agent_message: a plain "Message Type: MESSAGE" header plus encrypted_content (codex-rs protocol.rs to_model_input_item). serve's sealed gate (#619, #1237) took any sealed agent_message as a task. Only the ChatGPT backend can read it, so the lead's next turn was refused. The refusal said the lead "has since been on one of Codex's own models", which it never was. This had been so since the gate was added, not only since yesterday's release. - A sealed message (not a task) that no candidate can open is left out now (withoutSealedMessages). An input_text note naming its sender goes in its place, and the request goes on where it was. The subagent's final result still reaches the lead as text. A sealed task (NEW_TASK, or an item with no header) is still refused, as in #619: without it the subagent has nothing to do. - The refusal for a sealed task, where the provider that answered the lead can't seal, no longer says the lead switched models. It says the task came from an agent of this thread on one of Codex's own models, and points to Codex's subagent model on the Agents page. - docs/subsystems/gateway-routing.md says so. Run: - The new tests in sealed_message_left_out_test.go. The lead and subagent cases fail on the old code with the reporter's exact message, and also fail with the strip turned off by hand. - go test -tags nogui -run 'TestSealed|Codex|Sealed' ./internal/gateway. - go test -tags nogui -timeout 40m ./internal/gateway. - gofmt -l. - GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway. Not tried: real Codex desktop with a real ChatGPT account and a chat provider. The requests are Codex-shaped fixtures built from codex-rs's item format. |
||
|
|
398f8469be |
gateway: Codex's compaction on a custom provider goes on when its relay answers the summary 400 "Upstream request failed" (#1511, TooPub; #1523)
TooPub reported (#1511) that Codex through magpie to a custom relay provider stopped compacting with {"error":{"code":null,"message":"apex: Upstream request failed","param":null,"type":"invalid_request_error"}} while Codex pointed straight at the same relay compacted fine, and a new conversation worked. #1523 (jswysnemc, anyrouter) is the same failure. magpie answers Codex's compaction_trigger for a magpie model itself: it asks the model for a summary with the raw history (codexCompact). Normal turns are translated and worked; the summary request goes as it is, and the relay turned it away with its own generic 400. codexCompact's fallback (ask again with the conversation as text, then compact without a model) took the relay's generic failure only as a 404 (#866, "flyapi: Upstream request failed"), so the 400 went back to Codex and the compaction aborted. - upstreamFailed: a 4xx (not 401/403/429) whose body says "upstream request failed" now takes the same fallback as #866's 404. - The summary request sends "tools": [] instead of leaving tools out. Captured with Codex 0.162, that is the one difference between magpie's summary request and the summary request Codex sends a custom provider itself, which is what worked for the reporter. The relay hides the upstream's reason, so which of the two the relay objected to isn't known; the fallback covers it either way. Siblings: Chat-only custom providers go through the same codexCompact (covered in the test for both protocols). Other agents' compaction is a normal request through the translators, with no magpie-side compaction step. A pass-through option (#1523) wouldn't help: Codex compacts a custom provider it reaches itself locally, which is what magpie's summary request mirrors. Run: - New tests from the reporter's literal body: asks again as text, compacts locally (Responses and Chat), and 401/403/429 with the same words still go back to Codex. TestCodexCompactsThroughCodexRelay now and TestResponsesRelayCallIDs' compact cases now require "tools":[]. With the change reverted by hand, all three fail; TestCodexCompactOther400Stays and TestCodexCompactOtherFailuresStay stay green. - Real Codex 0.162 in a sandbox CODEX_HOME against an in-process magpie gateway and a fake relay answering the summary with the reporter's 400: on the old code "Error running remote compact task: {...apex: Upstream request failed...}" exactly as reported; with the change, "context compacted" and the turn completes. - go test ./internal/gateway and go test ./... (nogui); gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway. Not tried: the reporter's actual relay. |
||
|
|
03dcc90c81 |
gui: Usage's head is fitted again when its sum's box shrinks, not only when the head resizes (#1599, found while verifying)
The fit for #1599 ran on a resize of the head and on a change in its nodes. Under load the sum's box (#usageCost) sometimes shrank after the head had been fitted, with the head's width unchanged and no node changed, so nothing fitted it again and the sum stayed cut: usage-sum-whole failed in 3 of 5 runs at load ~45 (Chromium en at 780px: the sum 719.7–782.2, its box 719.7–764, the head not tight). The ResizeObserver now watches #usageCost too. What grows beside it after the fit isn't pinned down; the failing runs show the box narrower than at the fit, which this catches whatever the cause. Verified: - usage-sum-whole.test.cjs (Chromium and WebKit, en/zh/ja/de): 6 of 6 green at load ~43 with the change, where 3 of 5 failed just before without it at load ~45. |
||
|
|
76f802d37d |
gateway: Command Code's Provider API searches by itself for the 12 models that do, and the rest keep magpie's searcher (#1590, M3chD09)
Command Code's Provider API passes a provider-defined web_search on to the model's vendor, and only some models search: M3chD09 ran all 87 and 12 did (claude-sonnet-5-5 and claude-haiku-5-5 on Messages; gpt-6-luna, gpt-5.6-sol, gpt-5.6-luna, meta/muse-spark-1.2/1.3 and their -contributor ids, xai/grok-4.5/4.6/4.7 on Responses). magpie took the whole provider as one that doesn't search, so each of those searches went to the searcher instead. Marking the provider as searching (Searches, or its host in searchHosts) would have sent the tool to the other 75, which take it and don't search. searchModels now lists, per provider and API, the models that search by themselves; modelSearches reads it for a keyed provider made from the "commandcode" preset or at api.commandcode.ai, and none count when the provider is sent Command Code's x-cmd-zdr header, under which it refuses every built-in tool (cmd_zdr_unsupported_tool, from the report). It is read in searchesModel, so the relay/translate choice and the tool swap both follow it, and in webSearchOf, so a remote magpie's list says "native" for those models too. Sign-ins (the Command Code Plan, its plugin) are not changed. Verified: - TestCommandCodeSearchesForSomeModels: gpt-6-luna and xai/grok-4.7 on Responses and claude-sonnet-5-5 on Messages are sent the agent's own web search tool; deepseek-v4-pro and claude-opus-5-5 aren't; with x-cmd-zdr: 1 none is. Without the searchesModel change it fails for the three searching models. - go test -run Search ./internal/gateway, gofmt -l. - Not tried against the real Command Code API (no key for it here); the list is the reporter's run of 2026-10-11. |
||
|
|
d82985eee1 |
agent: a routing group whose members are all best on Responses is asked there by Pi, omp, droid and dsh, so its tool-call arguments stream (#1594, ObsidianArch02)
magpieModels gave a routing group no native API, since its members may each want another. Pi, omp and droid then asked every group on Chat Completions, and dsh put it on its Chat route, even a group of GPT members all served on Responses. The gateway translated each answer from Responses to Chat, and that translation holds a tool call's arguments until the call ends (#613), so Pi's Code Mode saw no code until the whole call had been generated. A group now has APIs ["responses"] when every member, nested groups' included, is served best on Responses (allResponses over the group's members, by Provider.Native). Any other group keeps none: one with a Chat member, and a Messages-only group too, as the gateway knows whether a Claude thinks adaptively by its own model id, not the group's. dsh moves a start on such a group to its Responses route (dshStartOnItsRoute); a dsh session resumed on it asks for the model once, as for any model that moved routes. The rest of the request (a protocol picked per group, conversion shown per request) is not in this commit. Verified: - TestPiModelsAskedOnTheirNativeAPI: auto-gpt-5-5, a GPT group and a group of that group get openai-responses; a group with a Chat member and one of Messages-only members get none. Without the route.go change it fails for the three Responses groups. - TestOmpModelsAskedOnTheirNativeAPI: the same for omp. - TestGroupOnResponsesRelaysArgumentDeltas (gateway): a group of two Responses-only members asked on /v1/responses relays each function_call_arguments.delta as the vendor sent it, on /responses. It guards what this change relies on, and passed before it too. - go test ./internal/agent ./internal/provider, gofmt -l, GOOS=linux and windows go vet -tags nogui. - Not tried with a real Pi against a real group. |
||
|
|
16b5c8700f |
gui: a library MCP server no agent or project has isn't checked on its own; its status says "not checked" and a click checks it (#1597, xiaozhu1337)
Opening the Library's MCP tab started (or reached) every server in the library once a session to list its tools, the ones switched off for every agent too. Some users keep many servers in the library and turn on a few, and each unused one was still started. A server that no agent has, here or in a project magpie keeps (inUse), is now left out of that check. Its status reads "not checked", with the reason in its tooltip, and a click checks it, as a click already checks any other server again. Once an agent is given it, the page renders again and the server is checked as before. New strings in zh, zh-TW, ja and de. Verified: - library-mcp-health.test.cjs: a server on for no agent shows "not checked" and is not in the first check; one on only in a project still is; a click on it checks it alone (fresh) and opens no editor. Chromium and WebKit, en and zh. Without the library.js change it fails: the first check asks for "idle" too. - library-mcp-tools and library-mcp-tool-switch: their padding servers were on for no agent and relied on the old check, so they are on for Claude Code now; the tests are otherwise unchanged. - library-servers-bulk, mcp-signin, library-mcp-copy-config, project-servers, library-zed-mcp, search-mcp, gui-ja, gui-de pass in both engines. library-mcp-tool-switch times out in WebKit at load ~180 on some languages with and without this change (#1609, filed earlier). |
||
|
|
7bfd02aa62 |
gui: Usage's sum at the head's right is never cut, in any window width or language (#1599, sean908)
Between 640px and the width the Usage head needs in full (the tabs, the periods with Custom named, Refresh's period and the sum), the sum was the one item in the head that could shrink, so ≈$0.001 read "≈$0." with nothing to say more was there. The narrow-window layout only began below 640px, and how wide the head needs to be depends on the language and the sum's own length, so no single breakpoint fits. The head now takes the narrow layout (.usage-head.tight: the sum's label hidden, the unpicked Custom unnamed, Refresh compacted, wrapping as a last resort) wherever the sum would be cut. A ResizeObserver and a MutationObserver on the head decide it on the next frame, by whether the sum's right edge passes its box. Verified: - usage-sum-whole.test.cjs (new): Chromium and WebKit, en/zh/ja/de, every width from 380px to 1240px in steps of 10: the sum reads whole, inside its box and the window, and the page never scrolls sideways. Without the change Chromium en is cut from 650px to 750px+ (the box 0px to 15px wide for a 62px sum). - usage-range, usage-arrange, usage-unpriced-names, currency, usage-ledger, usage-refresh, usage-refresh-flight, usage-quota-head, usage-hit-rate, click-scroll, gui-ja, gui-de: 104 pass in both engines. - Not tried in the built desktop app on the reporter's screen. |
||
|
|
0e89b090c1 |
gateway: Codex's auto-review on codex-auto-review goes through a ChatGPT account past its usage cap, since OpenAI made it free (#1593, hywang1230)
An account past the usage cap set on it in magpie was held for every
model, so Codex's auto-review on codex-auto-review was refused with
"usage cap reached" once the account reached its cap. OpenAI made
Auto-review free for every ChatGPT sign-in on 2026-10-06: the reviewer's
calls are counted in no usage window, so the cap, which keeps a share of
a window unspent, has nothing to keep for them.
capHeld now leaves the user's caps out for a Codex (ChatGPT) account's
call on codex-auto-review (freeOnChatGPT). Credits set not to be spent
still hold it at 100% of a window, as nothing says the backend answers it
there. A review run on another model, or any other model, is held as
before.
Verified:
- TestAccountCapLetsAutoReviewThrough: an account at 92% with a 90% cap
takes codex-auto-review on Codex's backend path and as
codex/codex-auto-review, and still refuses gpt-5.5 on both. With the
exemption disabled it fails with the reporter's exact 429 ("usage cap
reached: every account that serves "codex/codex-auto-review" ...").
- go test -run 'TestAccountCap|TestCodexNoCredits|TestWindowCaps'
./internal/gateway, gofmt -l, GOOS=linux/windows go vet -tags nogui.
- Not tried against the real ChatGPT backend with a capped account.
|
||
|
|
8b799cc890 |
usage, gateway, gui: a request's "In magpie" is magpie's own time, not a try the vendor held before its 503 (#1532, nianlee-official)
The reporter's Codex -> OpenCode Go deepseek-flash request read "In magpie
104 s" with "Vendor's first token 37 s". Record.Sent is the ms from the
request to its answering try's body being written, and by design it
includes the tries that failed first and the pauses after them; the
request detail showed all of it as "In magpie". The reporter's own
routing screenshot shows OpenCode Go answering 503 Service Unavailable
after holding a try ~70-100 s (01:07:08: 3 tries, 222 s), and rows like
01:01:48 / 00:58:27 answered on a second try. Their ledger row showed no
"2 tries" only because that badge came in v0.1.1182.
Now each record also keeps, of Sent:
- own_ms: magpie's own work (before the first try, and in the answering
try up to its request starting to go out, httptrace GetConn), floor 1;
- retried_ms: from the first try's start to the answering try's, i.e. the
tries that failed first and their pauses;
- queued_ms: the answering try's wait for a MaxConcurrency / MaxRPM slot.
What's left (Sent - the three) is connecting and sending the body. The
Requests detail shows In magpie, Tries that failed first, Waiting for a
slot, Connecting and sending, Vendor's first token (en, zh, zh-TW, ja,
de). A record written before keeps showing Sent as In magpie. Sent and
Vendor's first token are unchanged. The packed in-memory request rows
carry the three fields (no on-disk format).
Measured: with an isolated gateway and a fake chat upstream, a
Codex-shaped Responses body of 1.79 MB (~330 turns of reasoning,
function_call and function_call_output, 18 tools, zstd encoded, sent
over real HTTP) took 0.64-1.36 s of magpie's own time alone and
0.8-0.95 s with 4 at once, at load average ~228; far from 100 s.
Run: TestSentTellsMagpieFromEarlierTries (upstream holds the first try
1.5 s and says 503, the second answers: Sent 1514, Own <500, Retried
>=1500) and TestSplitSent; on the old code the detail's value is the
whole 1.5 s (reproduced: sent 1514 ttft 1515), and both go red with
splitSent returning (sent, 0, 0). usage-ledger-detail.test.cjs (Chromium
and WebKit, en and zh) adds the reporter's row and fails on the old
app.js ("104 s" where "180 ms" is expected); i18n-keys, gui-ja, gui-de,
gui-zh-tw pass. go test -tags nogui ./internal/gateway ./internal/usage,
go vet (darwin, GOOS=linux, GOOS=windows) and gofmt -l pass.
|
||
|
|
3bc9ab152d |
provider: moved Cursor users get cursor plugin 0.2.7, which keeps an assistant turn's reasoning across a tool continuation (plugins #82, nicegui)
The cursor mover's min goes from 0.2.6 to 0.2.7 so keepMovedCurrent updates every moved user's plugin. 0.2.7 (magpie-community/plugins 126b105, bump 379ec96) sends an assistant turn's reasoning_content back to Cursor as a reasoning part, the shape cursor-agent 2026.10.01 sends, when a tool result continues the turn. npm view shows 0.2.7. Run: go test ./internal/provider -run 'Moved|Mover|Migrat|KeepMoved|HandOver' (TestMovedBuiltinsSayTheirPlugin included), then the whole package and the full suite. |
||
|
|
2df2e0886d |
plugin, provider, gateway: a plugin's model is listed with every kind it takes and gives (audio, video, pdf), not image alone (#1595, tkhs101)
The plugin host read a model's capabilities.input only for "image", and
fromModelsDev hard-coded output to text, so /v1/models listed
opencode-zen-free's muse-spark-1.3-contributor-free (models.opencode.ai:
input text/image/audio/video/pdf) as ["text","image"] with no output.
- host.js: fromModelsDev and the config merge keep modalities.input and
.output whole; the listing sends inputs/outputs, the kinds the
capabilities object marks true, in OpenCode's order.
- plugin.Model gets Inputs/Outputs; pluginCatalog puts them on
catalog.Model's new InputModalities/OutputModalities (input only where
the plugin said what it takes, as ImageInput already is).
- catalog: models.dev entries and a vendor's live list (now reading
modalities.output) fill the same fields; Decorate carries the catalog's
when the live list says nothing, beside ImageInput.
- provider.Entry.Modalities() is what the gateway lists: the source's
kinds, with "image" still decided by Images, so the user's own
"takes images" override still wins and the other kinds stay.
Not changed: the 7 models the report lists as having lost their levels
have reasoning_options [] upstream (models.opencode.ai), so "reasoning,
no levels" is what they are; mimo-v2.6-flash turns away levels (#214).
DSH's model kinds and Muse's list still say text/image only.
Tests: TestPluginModelModalities (gateway) with the reporter's literal
metadata: muse-spark's config as opencode-zen-free 0.1.3's configModels
writes it, and mimo-v2.6-flash-free's capabilities as its models hook
lists them; a model said nothing of stays unlisted, and the image
override drops image only. TestFetchedModalitiesKeepEveryKind (catalog).
Broken by hand: host.js without inputs gives the report's [text image]
(red); Entry.Modalities without the Inputs branch (red); Decorate
without the fill (red). Run: go test catalog, plugin, provider, gateway;
gofmt -l; GOOS=linux and windows go vet on the four; go test ./...
green on 76db4c6c2+this; after rebasing on
|
||
|
|
e9f6e48d6a |
gateway, docs: keepIdle's record no longer says a reply ending after letGo kept a run twice, which serveSubscription rules out (#1596)
d1f0576a7's comment, test comment and subsystem doc named the cause of
a run under two keys as letGo keeping it at backKey and the same
request's ended then keeping it at the turn after. That order can't
happen: serveSubscription's ended callback starts with `if !gone()
{ return }`, and gone is the stop of the context.AfterFunc that calls
letGo, so for one request exactly one of the two runs. The reporter's
own overlap test drove ended by hand while letGo ran, an order the
gateway doesn't produce.
Which callers kept one run twice in the reporter's gateway is not known;
keepIdle, the only writer of b.idle, now holds the rule whichever it
was. The comments and doc say that instead. No code change.
Run: gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gateway, -run TestClaudeIdle ./internal/gateway.
|
||
|
|
dbe81adae6 |
gateway tests: TestClaudeIdleEvictionEnds fails on what keepIdle's old loop allocates, not on a 5s deadline (#1596)
d1f0576a7's child process failed the old loop by -test.timeout=5s under GOMEMLIMIT=64MiB, with 30s for the parent. On a busy machine (load ~130 here) starting the gateway test binary and its TestMain can take a good part of that, so the passing case had little room. Now the child runs the keeps in a goroutine and watches TotalAlloc: past 256 MiB without ending, it exits 2 with what it allocated. The ending loop is done in microseconds, so its child has 4m and the parent 5m. The rekey scenario set idleAt before keepIdle stamped it with time.Now(); it is now set after, so on a coarse clock (Windows) the stale run is still the oldest and the scenario still reaches the loop. Run: on origin/main |
||
|
|
93e118a578 |
testenv: a test that runs plugins on a bun older than 1.4.2 is skipped, saying which bun and to install 1.4.2 or newer, not failed on Bun's own differences (#1600, justrun1983)
justrun1983 saw TestPluginModelListThroughAccountProxy fail on main with "fake-not the list: http://models.invalid:80/list" among the models. The plugin tests run the bun on PATH (testenv.Bun), and Bun 1.3 names the default port in a proxy's request line: GET http://models.invalid:80/list, which Go reads as r.URL.Host "models.invalid:80", so the test's proxy answered 400 and the fake plugin took the error text as a model. Bun 1.4 sends GET http://models.invalid/list. It wasn't the offline environment: the test already clears every *_PROXY variable and reaches nothing real. magpie itself never runs plugins on a Bun older than plugin.BunVersion (1.4.2, the one it downloads and the floor CheckBun keeps), and CI pins 1.4.2, so an older bun on a developer's PATH tests something no user runs. On Bun 1.3.0 internal/plugin's TestPluginSOCKSProxy ("vendor vendor.invalid:80"), TestPluginProxy (the proxy saw http://vendor.invalid:80/...) and TestPluginHTTP2TakesTheProxy (Bun 1.3's node:http2 answers status 0, and the host quits) failed the same way. testenv.Bun now runs `bun --version` once (it already ran it to warm the binary) and skips with a message naming the bun when it is older than testenv.MinBun. testenv can't import internal/plugin (whose own tests use it), so MinBun is a copy, and TestMinBunIsBunVersion fails when it and plugin.BunVersion differ; BunVersion's comment names it and test.yml's bun-version. Run (bun 1.3.0 from npm's @oven/bun-darwin-aarch64 first on PATH, temp HOME): - before: gateway TestPluginModelListThroughAccountProxy FAIL with the reporter's exact text; plugin TestPluginSOCKSProxy, TestPluginProxy, TestPluginHTTP2TakesTheProxy FAIL. - after: all skipped, packages ok. A probe of the request line a proxy receives: 1.3.0 sends http://models.invalid:80/list, 1.4.2 and 1.4.3 http://models.invalid/list. TestBunOlderThanMinSkips (fake bun printing 1.3.0, 1.4.1, 0.9.9, 1.4.2, 1.4.3-canary, 1.10.0, 2.0.0, nothing) goes red with the skip removed by hand. With bun 1.4.2: go test -tags nogui ./internal/testenv, ./internal/plugin, ./internal/gateway pass; gofmt -l clean; go vet, GOOS=linux and GOOS=windows go vet -tags nogui on testenv and plugin pass. Not run: the full ./... suite, nor the fake-bun test on Windows (it skips there: the fake is a shell script). |
||
|
|
e9b16ca184 |
gui: a plugin's Update is a button the size of Install, in green, on its card, its row and Update all (#1587, timonwong)
timonwong saw a plugin update announced on Plugins but the button that
brings it hard to find: on a card it was a small chip among the meta
chips ("Update to v0.0.9"), on the Installed row a text link, and Update
all a text link in the footer.
- One updateButton() makes every plugin Update: .pm-act (Install's height,
min width, padding, font and corners) with .pm-up, green-soft with
green text, filled green on hover (the app's own tokens; no stripes).
Its title says the version (or the repo's newer commit for a git one),
and for a community package that magpie updates by itself within the
hour.
- A card's one button is Update in place of Signed in / Installed, as an
app store's Update takes Open's place, and the card's version reads
"v0.0.7 → v0.0.9" then. Sign in, not done yet, and Move keep their
place; the Installed row offers Update then. The plugin's page uses the
same button (actionFor).
- The Installed row's Update and the footer's Update all are the same
green button.
- The class is pm-up, not update: the title bar's app-update pill owns
.update (margin, height 22px), which the first try picked up.
Tests:
- new plugin-update-button.test.cjs: at 520px, Chromium and WebKit, en,
zh, zh-TW, ja, de: the card's Update, the row's Update and Update all
have Install's height, min width, padding, font, corners and margins,
are at least Install's width, have a colour that isn't Install's, fit in
the card, no sideways scroll. On the old plugins.js/css 7/7 fail; with
the class named update the margins check fails.
- plugin-card-update.test.cjs follows the chip to the card's button.
- every plugin*.test.cjs, both engines: 274/274. The
first run caught Update taking Sign in's place on the plugin's page
(plugin-market), fixed by the order above.
JS/CSS only; no Go changed.
|
||
|
|
b7a926e9aa |
library, gui: a market search one source of which didn't answer says which, over what the rest found, not a failed search; a 503 is asked once more (#1589, Ti800)
Ti800 searched the Library's Discover for "prototype" and saw the amber
error "couldn't search skills.sh: www.skills.sh answered 503 Service
Unavailable" over two results. The cause was neither a stale request
(fetchMarket already drops an answer whose seq is old, results and error
alike) nor an error left over from an earlier search: MarketSkills matches
skills.sh's most-installed list (front page, cached) and magpie's picks
itself, then asks skills.sh's search. The search answered 503; the two
cards were the most-installed list's matches, and the handler sent both
the list and the search's error, which the page drew as a failed search.
- library: the search's failure is a SearchError naming its source
(skills.sh, the MCP Registry); get() asks once more after a 503, after
a one-second pause (one extra try, nothing else retried).
- gui: /api/library/market/{skills,servers} add failed and cause beside
error. With results, the page says in a muted line with an amber dot
that skills.sh's search (or the MCP Registry) didn't answer and why, and
that these are only the matches among magpie's picks and the most
installed (or magpie's featured servers). With no results the error bar
is as before. Strings in zh, zh-TW, ja, de.
Siblings: the MCP market has the same shape (featured + registry) and gets
the same notice. The Plugins page's npm search already shows its error in
the "On npm" section only, beside the market's own list, keyed by query.
Tests:
- internal/library TestSkillsSearch503 (httptest fake skills.sh): 503 then
200 gives the search's results and no error; 503 every time gives the
popular match and a SearchError for skills.sh, searched exactly twice.
With the retry taken out it fails: "after one 503:
[mattpocock/skills/prototype] couldn't search skills.sh: … 503 …, 1
searches".
- internal/gui TestMarketOfNamesTheFailedSource.
- gui tests market-partial.test.cjs: the reporter's case (two results +
skills.sh 503), nothing found (error kept), an older search's 503
answered 1.2s after a newer search's results (nothing changes), and the
MCP Registry case; Chromium and WebKit, en/zh/zh-TW/ja/de, 520px wide:
10/10. With the new branch disabled, 5/5 Chromium fail with "the partial
list is shown as a failed search". market-*.test.cjs and
library-discover-jump: 114/114.
- go test ./internal/library ./internal/gui, gofmt -l, GOOS=linux and
GOOS=windows go vet -tags nogui on both packages; full suite in the
push record.
Not tried against the real skills.sh (it answers 200 now); the fake
answers 503 as the report's text says.
|
||
|
|
5c9221899f |
sessions, agent: MiniMax Code's own calls reach Usage's split by agent, and its 0.6.8 User-Agent names it (#1605, LukeZ1988)
Usage's split by agent counts the gateway's calls and the calls the agents' session files record (sessions.Calls). MiniMax Code had no session reader at all, so a MiniMax Code on its own MiniMax sign-in or a relay of the user's never showed in it. What @minimax-ai/code 0.6.8 really writes, run in a sandbox HOME and MINIMAX_DATA_DIR against a fake Anthropic upstream: each session is a folder under <data dir>/v2/sessions/<yyyy>/<mm>/<dd>/, named <time>-session_<base64 of its mvs_ id>, its messages in messages.jsonl. An assistant line names the provider and model that answered, its usage (input without the cache, output, cacheRead, cacheWrite, as pi's ai package counts them) and the time in ms. The new reader (calls_minimax.go) is a whole-file call source (callSources, wholeCallReaders), and the folder is watched (Dirs). A call through magpie's own entry (custom_provider:magpie) is skipped; the gateway already counted it, with the account that answered. A reply is keyed by its message_id, so one copied into another generation of the history counts once. Gateway side: magpie's entry sets User-Agent minimax-code, and the sandbox run showed it reaching the upstream on /v1/messages and count_tokens. 0.6.8 without that header (a provider pointed at magpie by hand) sends "MiniMaxCode", which now names minimax-code too. The class check: StepCode, jcode, Prime Agent, Snow and every other built-in agent are named by their own gateway key (TokenFor); TestEveryAgentNamedByItsKey guards that for all of Clients(). Their direct, non-gateway calls are not read yet, and neither are those of pi, Cline, Qoder, Grok, Droid, omp, Cursor, Hermes and Alma, which the Sessions page reads (filed as #1607). Run: TestMiniMaxCodeCalls (the two real messages.jsonl files, verbatim: three calls through magpie's entry and one on a relay; under ~/.minimax and under MINIMAX_DATA_DIR) passes; dropping the gateway skip by hand turns it red (4 calls). TestAgentOf (MiniMaxCode, minimax-code), TestEveryAgentNamedByItsKey. go test ./internal/sessions ./internal/usage, the agent tests named above, gofmt -l, GOOS=linux and GOOS=windows go vet. Not tried: MiniMax Code on Windows or in WSL (WSL distros' MiniMax sessions are not read), a call on the MiniMax sign-in itself (provider name taken from the file whatever it is), or a session after compaction. |
||
|
|
6b5181b927 |
agent: Codex on a relay or with several accounts in magpie offers its GPT models via magpie too (#1603, SwimmingLiu)
Codex's picker left out the models magpie serves on the Codex accounts in it (codex/...) whenever Codex wasn't routed through magpie, on the reasoning that going via magpie to Codex's own sign-in only adds a hop. That holds only when Codex is on its own ChatGPT sign-in and that one account is alone in magpie. With Codex on CC Switch's custom relay, the accounts in magpie are not what Codex is on, and with several accounts on, magpie routes over them; the reporter saw the GPT models direct only, with no 经 magpie entry. modelOptions now offers them via magpie, beside the direct ones, unless Codex is on its own sign-in with a single account. The stopped-WSL distro's options do the same when several accounts are on. Listing the options writes nothing. Run: TestCodexAccountsOfferedViaMagpie (relay + two accounts, relay + one account, own sign-in + one account) failed before and passes after; forcing the old branch by hand turns the third subtest red. codex-accounts-via.test.cjs: Chromium and WebKit, en and zh, 980 and 420px, 8/8 (the API is faked; the GUI itself is unchanged, no new strings). go test -tags nogui ./internal/agent, gofmt -l, GOOS=linux and GOOS=windows go vet clean. Not tried with real Codex accounts. |