ddb3cef51701db977d587edf3dcebc4e45caba6f
295
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
498b77fbca |
gui: the sign-in box shows the proxy it goes through, and another can be picked and kept as the account's (#1663, demystify0137)
What changed: while a sign-in waits (or after it failed), the box shows "Proxy: …" beside Open again. It opens the app menu (openProtoMenu, no native select) with Global (only when it could be kept), Direct, the subscription's proxy, each account's proxy and Custom…, which asks for an http://, https:// or socks5:// address. Picking one starts the sign-in again through it and cancels the open one; when it ends, the backend keeps the pick as the account's (keepSignInProxy). Userinfo in a proxy URL is never shown. "Sign in again" on an account now names that account (user), so it goes through the account's own proxy. The user and the pick are carried through the risk, site and plugin-method steps. Strings in zh, zh-TW, ja and de. docs/subsystems/providers-accounts.md describes the sign-in proxy. Why: the reporter asked that a sign-in use the subscription's or the account's proxy and be able to choose one; the default now does, and this lets the user choose and see it. What was run: - signin-proxy.test.cjs (new): Chromium and WebKit, en/zh/zh-TW/ja/de, at 900 and 380 wide, 40/40. It fails against HEAD's app.js (no link). - The sign-in, add-sheet, plugin-signin, click-scroll, i18n-keys and gui-<lang> files: 203/203; signin-close.test.cjs updated (the acts row now also holds the proxy link). - go test -tags nogui ./... ok; gofmt; linux/windows vet. Not tried: a real vendor sign-in through a real proxy from the window. |
||
|
|
ee7a9b24a6 |
agent: Grok App is an agent magpie connects: a magpie provider channel with magpie's models and their efforts (#1625, fjrtdk)
fjrtdk asked for Grok App (RongleCat/grok-app, a desktop GUI over the Grok
Build CLI) as a full agent: MCP, skills, RTK, models and effort.
What was already there, read in the App's source:
- MCP: the App reads ~/.grok/config.toml's [mcp_servers] in both of its
modes and hands them to the CLI it starts, so the Grok Build row's MCP
sync already reaches it.
- Skills: Grok Build's ~/.agents/skills, synced from the Grok Build row.
- RTK: rtk has no installer for Grok Build, so there is nothing to wire.
What was missing is models, and that is what changed:
- internal/agent/grokapp.go: a new agent, "grok-app" (alias grokapp), for
the App's agent-home/config.toml under its data folder: GROK_APP_HOME,
else ~/Library/Application Support/com.grokapp.grok-app or ~/.grok-app
on a Mac, %APPDATA%\grokapp\grok-app\data (and two older places) on
Windows, $XDG_DATA_HOME/grok-app or ~/.grok-app on Linux; the first
that exists.
- Connecting writes a [model.magpie] channel in the App's own format
(its custom routes): model, base_url = the gateway's /v1, name,
api_key (magpie-grok-app, so usage says the App), api_backend =
"chat_completions", app_provider_mode = "generic", app_models and
app_efforts as JSON strings (the App unquotes them with serde_json),
supports_reasoning_effort, app_supports_vision for a model that takes
images, and context_window when magpie knows it. app_models lists
magpie's models with their effort levels ("none" left out), so the
App's model and effort pickers show them.
- It sets [models] default = "magpie"; what was there is stashed, and
Disconnect puts it back and drops the channel: the file is
byte-identical to before (TestGrokApp).
- A sync keeps the model and the default effort the user picked in the
App while magpie still serves them, and writes nothing when nothing
changed.
- Picking one of the App's own routes (the official "grok", or a
channel of the user's with a base_url) takes magpie out.
- The notice says to start a new chat or restart the App, which reads
its providers when it starts an agent; translated in i18n.js (zh-CN,
zh-TW, ja, de) and listed in NOTICES.
- agents.go, agentenv.go (GROK_APP_HOME), docs/reference.md,
docs/subsystems/agent-wiring.md, both READMEs' agent lists.
Picking magpie in the App is a custom route, so the App runs that agent in
its independent mode (its own #557): it clears agent-home's auth.json
rather than syncing the official sign-in. ~/.grok is never written.
What was run:
- go test -tags nogui ./internal/agent ./internal/agentenv ./internal/gui:
ok. Full go test -tags nogui ./... under a temp HOME: ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui: ok.
- Broken by hand, each red: context_window written quoted (TestGrokApp);
the user's picked model ignored (TestGrokAppSyncKeepsTheirs); their
default effort dropped (SyncKeepsTheirs); Disconnect not unstashing
(TestGrokApp); a no-op sync writing (SyncKeepsTheirs); "none" listed
as an effort (TestGrokApp).
- Real use in a sandbox HOME: a built magpie on 127.0.0.1:3681 with a
fake upstream; `magpie grok-app magpie/fake/echo-1` wrote the channel;
the real grok 1.0.50, started as the App starts it on a custom route
(GROK_HOME=agent-home, --model magpie), answered through magpie, the
upstream saw echo-1 and usage.jsonl counted agent "grok-app". `magpie
grok-app default` restored the file (the only difference was grok's own
[marketplace] line written while it ran). ~/.grok/config.toml untouched.
Not tried: the real Grok App GUI (it would sign in through the keychain
and ~/.grok), a model with effort levels end to end, Windows and Linux
paths beyond TestGrokAppDir.
|
||
|
|
a0c4dba97d |
gui: the tray icon closes an open panel on the Mac under a window over the whole screen too, not only when the panel can be seen (#1661)
TestTrayCellClickReleasedPanel went red with "initial quota click did not open the panel". The cause: Wails' WebviewWindow.IsVisible on the Mac is the window's occlusion state, not [NSWindow isVisible]. This Mac runs UURemoteServer, whose privacy curtain is an opaque window over the whole screen at layer 2147483631, above every app's. Under it, every window is "occluded", so the panel the click had just opened read as closed. The same check is a product bug too. togglePanelNow went through Wails' SystemTray.ToggleWindow, which chooses hide or show by IsVisible. Under such a cover, a click on the tray icon showed the already open panel again and never closed it. With only the test's check changed, the test failed on "second quota click did not close the panel". Fix: on the Mac, togglePanelNow decides by windowOpen (shown and not miniaturised, the check #1381 brought in for lightweight mode). It hides the panel, or places it and shows it, itself. fitPanel, zoomWindows and trayCellClick use windowOpen in place of IsVisible as well. Linux and Windows still go through ToggleWindow, unchanged. The Hyprland branch's IsVisible checks are left alone, since they are Wayland only. Both AppKit tests (TestTrayCellClickReleasedPanel, TestPanelCloseHidesIt) now read the panel's state through windowOpen. gui-shell.md item 5 says so. Run, on darwin/arm64: - Under an injected cover (scratchpad cover.swift: opaque, max level, sharingType none, the whole screen): - origin/main: TestTrayCellClickReleasedPanel 0/8, and TestPanelCloseHidesIt 0/4 ("timed out waiting until the panel shows"). - Test-only change: 0/8 ("second quota click did not close the panel"). - This commit: TestTrayCellClickReleasedPanel 25/25, and TestPanelCloseHidesIt 20/20. - Under UU's own curtain: - origin/main: 30/30 red. - This commit: 10/10 green. - Before the curtain was up, origin/main passed 75/75. Under an activator load, it was 5/40 red. - go test ./internal/gui (GUI build) passes. go test -tags nogui ./internal/gui passes. gofmt is clean. - go vet with -tags nogui passes for linux and windows; go vet passes on darwin. Not tried: clicking the real status item by hand under a remote session. The test drives trayCellClick and togglePanel's path through the host. |
||
|
|
94fd332c35 |
agent, gui, tui: an agent's own models can be left out of its model picker (#1642, MizuIro-H)
DeepSeek Harness offers its own DeepSeek models beside magpie's in its
model picker, and nothing in magpie could leave them out: `magpie visible`
and the model list only cover magpie's catalog. An agent's model list now
has a switch at the top, "Show {agent}'s own models", for an agent that
has models of its own. Off, its picker offers magpie's alone.
- settings.OwnModelsHidden lists the agents whose own models are left
out. provider.OwnModelsHidden / SetOwnModelsHidden read and write it.
POST /api/settings keeps it: the Settings page doesn't send it.
- agent.Picks(f, cur) is a field's options without the agent's own
(no Ref, a value). It leaves them in when the field has no magpie
option at all, and always keeps the value the agent is set to now, so
the user's own choice isn't dropped or rewritten. The GUI's agent
fields and the TUI picker read it. The CLI still sets an own model by
name.
- GET /api/agent-models/{id} says `own` and `ownHidden`. POST
{ownHidden} sets it. The GUI's switch rolls back if the save fails,
and closing the list filters the picker at once, before the state is
read again. The order view (magpie's models alone) hides the switch.
- Strings in zh, zh-TW, ja, de.
Run: go test ./internal/agent ./internal/provider ./internal/settings
./internal/tui, all green. go test ./internal/gui is green apart from
TestTrayCellClickReleasedPanel, which fails the same alone on
origin/main
|
||
|
|
9ce12eec71 |
gateway: a tool_use turn sent to DeepSeek's Anthropic endpoint carries a thinking block, so DeepSeek no longer refuses the request with 400, or with 422 over Claude's redacted thinking (#1611)
What changed: in thinking mode, DeepSeek's Anthropic endpoint (api.deepseek.com/anthropic) refuses a request when an assistant turn has a tool_use and no thinking block: 400 "The `content[].thinking` in the thinking mode must be passed back to the API". It also refuses redacted_thinking anywhere in the request with 422 "unknown variant `redacted_thinking`". A Claude Code routing group whose Claude turns fall over to DeepSeek met both refusals. This is the Anthropic-endpoint sibling of #1592 (Responses) and #1462 (Chat). - anthropicReplaysThinking(host, model): DeepSeek only, by host or model id. It is never api.anthropic.com or a Claude model. - withThinkingOnToolTurns: a tool_use turn with no thinking gets a {"type":"thinking","thinking":" "} block first. Redacted thinking becomes that block, or is dropped when the turn already has thinking. The body is returned byte for byte when nothing changes. - The passthrough and the translated build (a Chat/Responses client to an Anthropic-only DeepSeek) both use it. The translated build also replays the turn's own reasoning text, where it has one. - docs/subsystems/gateway-routing.md describes it. Checked live on 2026-10-11 against api.deepseek.com/anthropic with deepseek-flash and deepseek-v4-pro: - Thinking on (no field, enabled or adaptive) with a bare tool_use: 400. - Thinking disabled with a bare tool_use: 200. - redacted_thinking, even in a text-only turn: 422. - Thinking " ", thinking "", unsigned thinking and thinking after text: all 200. What was run: - New tests in deepseek_anthropic_thinking_test.go: - direct and through group/cc; - glm-5.2 and claude-sonnet-4-6 on the same upstream are sent unchanged; - the translated path; - the body is returned byte for byte when nothing changes. - Breaking each call site by hand turns its test red. - go test ./internal/gateway passed (410s). gofmt -l is clean, and go vet passes for linux, windows and darwin. - End to end, with a built binary on port 3611 and a sandbox HOME holding the owner's real DeepSeek key: - before this change: 422 with redacted thinking, and 400 with thinking adaptive; - after it: 200 with a complete reply in all 8 cases (direct and group/cc, streamed and whole, adaptive and no thinking field). |
||
|
|
751ebe8f5a |
gui: magpie leads Command-Tab's order after opening its window on a busy Mac too, not only when the main thread keeps up (#1651)
TestDockJoinLeadsCommandTab failed under a full local go test ./...: the test app was LaunchServices' front app, yet last in Command-Tab's order (lsappinfo visibleProcessList), kitty first. Cause: setDock decided whether to activate magpie again by way of the Dock (#1381's fix) from [NSApp isActive]. The Mac makes an activated app the front app at once, but NSApp says it is active only once its main thread has taken the activation in. On a loaded machine the join came first, isActive read NO, dockStep chose a plain activate (a no-op for the front app), and magpie stayed last. A temporary print in setDock showed active=false in every failing run (3 of 5 at load ~120) and true in the passing ones. The same can happen to a user when the panel's focus and Open come close together on a busy Mac. Fix: joining the Dock to the front always goes by way of the Dock (activateAgain), whatever NSApp says. When magpie truly isn't active (the tray's Open), the Dock's turn in front changes nothing: magpie is activated after it either way. dockStep loses its active argument and appActive is gone. docs/subsystems/gui-shell.md item 7 says so. The test now activates magpie, waits for LaunchServices to call it the front app, and joins, all in one turn of the main thread, so the join always comes before NSApp knows: the busy-machine order, made certain. Run: - New test on the old dockStep: 5 of 5 red (magpie not first, kitty first). With the fix: 25 of 25 green at load ~120-135. - The old test (no injected order) with the fix: 10 of 10 green at load ~180; before the fix 3 of 5 red at load ~120. - TestDockStep (table without active). go test ./internal/gui (GUI build, darwin) 5 runs green. One run before them failed and its output wasn't kept, so which test failed is unknown. After rebasing onto |
||
|
|
d4eae3618f |
gateway: reasoning off goes to an Anthropic API as thinking off, and the log says the level a translated request went at (#1636, jswysnemc)
jswysnemc saw a custom provider think at another level than the one the agent asked. This commit fixes two places where magpie's own translation did that. - A Chat or Responses client turning reasoning off (effort none), translated to an Anthropic endpoint, was sent thinking enabled at a 4096-token budget (buildAnthropic read Effort "none" as a level). It now goes as thinking disabled. A model that refuses disabled (alwaysThinks / mandatoryReasoning / thinkingOffRefused, e.g. GLM) is asked again at its least (thinkingBackOn), and markUnfit(offRefused) sends it that way at once until restart. - none/minimal go as low to Chat/Responses for a model whose levels aren't known (effortOf). The route, the try and the usage log all said none/minimal. The route still keeps the level asked; the try and the usage log now say the level built (noteWireEffort/wireEffort via a context slot filled in forwardTranslated). Routing already draws asked -> went from the two. The passthrough path (a client on the provider's own API, e.g. Claude Code to an Anthropic relay) is unchanged: it sends the client's level as it came. Run: go test ./internal/gateway/ (full package, 304s, green); TestTranslatedEffortLoggedAsSent (8 cases) and TestTranslatedThinkingOffRefused fail with 11 assertions when the gateway.go/anthropic.go changes are reverted. gofmt; GOOS=linux and GOOS=windows go vet. Not tried: a real vendor's Anthropic API with thinking disabled. |
||
|
|
4b1b5dd822 |
agent: CC Switch's unified-history mirror waits for the proxy check and drops failover on quit too, tested on its own bytes (xuxing0727 on X)
CC Switch with "unify Codex session history" runs the official sign-in
as model_provider = "custom" (name OpenAI, requires_openai_auth,
supports_websockets), so failover goes on that table's base_url, not
openai_base_url.
|
||
|
|
18e82adc62 |
gui: the window's pages down a sidebar in groups, the open page's tabs under it, and a button to have the header's tabs instead
From 1024 points wide (SIDE_AT) the window lays its pages down the left as a Mac app's sidebar: Work (Agents, Sessions, Library), Models (Providers, Routing, Gateway), Insights (Usage), Extend (Plugins), with Settings and the gateway's address at the foot. The open page's own tabs (Usage, Library, Plugins, Settings) are listed under it, opening and folding on an iOS-like spring, and the page's strip is hidden. The header becomes a breadcrumb, and pages whose head held only tools have them in the title bar. Graphite: the open page is in the text's ink, not purple. A pressed row darkens and never shrinks. The selection under the tabs sets off as the row is pressed, on a 0.3s curve (it felt behind the finger), and is the list's only shape: a sub-row hovered or pressed has no ground of its own, which showed a block under the finger before the selection slid there. The page's tab is clicked at once, so what is typed next goes to it. The title bar's button (or ⌃⌘S, Ctrl+Shift+S), there at every width, picks the sidebar or the header's tabs. The choice is kept in localStorage magpie.navLayout (side or top) at every width, so it is laid out from the first frame; picked in a narrow window the sidebar is 184 points under 860. The two trade places in a view transition: the sidebar slides, each tab flies to its place, and the page slides as one. Without view transitions or under reduced motion, the change is at once. With nothing picked, narrower than 1024 the page beside a sidebar would be narrower than Usage's requests table needs, so the header's tabs come back. A resize drops what a click held (heldWidth). Usage's KPI strip goes two to a line by the room the page gives it (a container query), and Japanese counts wrap there. Tests whose window is 1024+ were updated for the sidebar, and docs/subsystems/gui-shell.md says how it works. Run: sidebar.test.cjs and side-toggle.test.cjs 16/16 in chromium and webkit, in en, zh, zh-TW, ja and de. Each was broken by hand (press shrink, address cut, press glide, sub-row ground, view transition, kept choice) and went red. Every page at 560 points with the sidebar picked, zh and de, both engines: nothing scrolls sideways. session-identity's ledger row sits under the footer beside the sidebar; WebKit's click doesn't scroll to it, so the test wheels it up first. Animation frames were checked from a recorded video. The 105 affected GUI files in both engines; their reds were rerun alone and fixed (filter-ime: the sub-row's click now at once; session-identity, above) or fail the same on main (tray-logos). The full GUI suite in chromium, on the rebase onto |
||
|
|
f11fdd854c |
provider: oMLX's Clef, Clef-Flash and OpenJev classify routing groups through System One, and agents no longer see them as chat models (#1641, ObsidianArch02)
oMLX 0.7.1.dev1 (jundot/omlx#4315) serves decision models at POST /v1/systemone. Its /v1/models lists them among the chat models with nothing to mark them, by the alias the user gave one. Its /v1/models/status (same key) gives each model's model_type, which is "decision" for these. oMLX finds that from the checkpoint's files, so the folder's name needn't say "clef" or "openjev". A name rule would miss an aliased OpenJev, so magpie reads the status list instead. - The omlx preset has a decision base, http://localhost:8000/v1. An oMLX provider saved before this gets its chat base as one, at whatever port it was given (the same backfill Zen and OpenRouter got). - omlxDecides joins listsDecisions. fetchDecide reads /v1/models/status and keeps the decision models under <id>.decisions, each by its alias where it has one. It leaves out the ones the user hid in oMLX and keeps the window oMLX serves. Clef and OpenJev both read images, so ImageInput is set. - DecidesModel then takes them out of the agents' lists and offers them as deciders. Jev() is the first of them. A server with none (or an older oMLX) lists none, and no Jev alias is made up for it. Run: - TestOMLXDecisionModels: the fake answers with get_status's real fields. Clef-Flash by name and OpenJev under the alias "router" are deciders, the hidden Clef isn't, the chat model alone reaches agents, and RouteDecider plus AskSystemOne post "router" to /v1/systemone. Red with omlxDecides taken out of listsDecisions. - TestOMLXWithoutDecisionModels: no decision model means none, not Jev. - go test ./internal/provider, gofmt, linux and windows vet. Not tried: a real oMLX 0.7.1.dev1 with a Clef checkpoint (no Apple-silicon oMLX install here). The fixture follows the server's source at the v0.7.1.dev1 tag, not captured bytes. |
||
|
|
1d67f79ca3 |
gateway: a Claude subscription's next turn goes on in the Claude Code that had the conversation, whatever the client's billing line says (#1638, chicring)
The bridge finds the run a conversation went on in by turnKey, and a rewritten turn's by newLooseTurn. Both hashed the request's system prompt raw, with the client Claude Code's x-anthropic-billing-header line in it. renderClaudePrompt already leaves that line out of what a run is told, but its fields change from turn to turn on the clients that send them: cch (#1600, 2.1.114), and cc_prev_req, cc_prompt_id, cc_prompt_index and cc_turn_index (2.1.296's binary, when it counts itself first party). So no next user turn found its idle run or its shelved session. Each turn started a new Claude Code that was told the whole conversation in one message, which wrote it to the prompt cache again: the reporter's cache_read stayed fixed (~18k, system + tools) while cache_write grew with the conversation (~368k). Tool rounds inside one turn still went on (follows doesn't look at the system), which is why it showed only when a turn ended. Both keys now hash withoutBillingHeader(req.System). The rest of the system prompt stays in, so a real change to it still starts a new run. Run: - TestClaudeBillingLineKeepsTheRun: two turns whose billing lines differ only in cch, cc_prev_req and cc_prompt_id go on in one run, and the run is told "b2" alone, never the billing line. Red on the old turnKey (2 runs; the second told the whole conversation). - TestClaudeRunKeysLeaveOutTheBillingLine: both keys ignore the line and still change with the rest of the system. Red with only newLooseTurn reverted. - go test ./internal/gateway (434s), gofmt, linux and windows vet. - Real Claude Code 2.1.296 under a fake upstream: --resume sent bytes identical to an in-process run, with and without an MCP tool round, so the resume itself doesn't move the prefix. Not tried: the reporter's own client version and setup. A 2.1.296 client pointed at a plain base URL sent a constant billing line, so I couldn't see the per-turn fields from the client side here. If a miss remains, it is logged as "a new Claude Code is told the whole conversation". |
||
|
|
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.
|
||
|
|
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
|
||
|
|
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> |
||
|
|
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. |
||
|
|
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.
|
||
|
|
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). |
||
|
|
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
|
||
|
|
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. |
||
|
|
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. |
||
|
|
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). |
||
|
|
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.
|
||
|
|
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 |
||
|
|
6f1b432759 |
provider, gui: smart routing spends WorkBuddy credits that expire soonest first (cdredfox on X)
WorkBuddy's Credits window had no reset, so in a Smart group every WorkBuddy account ranked alike. workbuddy plugin 0.1.14 (plugins f0274d6) reads WorkBuddy's own package lists (billing/meter/get-user-resource-paid- packages and -free-packages, the calls WorkBuddy's client makes) and reports on the Credits window when the soonest-ending package that still has credits ends (runsOutAt) and how many credits it holds (runsOut). The daily Free Plan slice (CapacityType 4) and code 001 aren't counted: they renew daily. magpie carries runsOutAt from the plugin's usage window into QuotaWindow and the routing Limit. Allowance.Renewal, which only Smart ranks on, treats it as the window's reset when it is sooner than the real one. Pace, the tiers, For, Full and resting are unchanged. The mover's min is raised to 0.1.14 so moved users get the plugin. The usage card and account meter say "232.4 expire in 5h" in every language. Run: - plugin: bun test, 63 pass; 2 of the 3 new tests fail on 0.1.13's index.mjs. Verified live on a workbuddy-ai account in a sandbox HOME: Bonus Pack 232.4 left ending 10-12T16:39Z ranked before Pro (10-28). - TestWorkBuddyCreditsRunOutForRouting and TestSmartSpendsWorkBuddyCreditsRunningOutFirst: both fail with the Renewal change removed by hand. - GUI: credits-run-out.test.cjs in webkit and chromium, 5 languages, at 360/440/1000px, red on the old app.js; with i18n-keys, quota-*, panel-usage, reset-each-title, usage-fold: 117 pass. - go test ./... green (agent and gateway rerun with -timeout 30m after the default 10m ran out under load from other sessions; 378s and 492s). - gofmt -l clean; GOOS=linux and windows go vet of provider, plugin, gateway clean. Not tried: the CN workbuddy site (its token was stale, 401), so the CN package list is assumed to have the same shape. The built-in WorkBuddy (not moved users) doesn't get this. The account-line tooltip has no GUI test of its own. |
||
|
|
e9ae318589 |
gateway: a relay's 500 "负载已经达到上限" is a busy server, not quota, so a group's Patience waits it out (#1418, real-jacket)
real-jacket's relay answered 500 "当前模型 gpt-5.5 负载已经达到上限,请稍后重试 (request id: …)". usedUpWords matched 上限, so failure() called it failQuota: the key rested till a reset and busy() (5xx only when failOther) never let Patience wait, so the agent got the 500 at once. Change: a 5xx is out of quota only on a vendor's own quota code (quotaCodes: Claude Code's "usage limit reached|<unix>", usage_limit_reached, RESOURCE_EXHAUSTED). The quota words still classify a 4xx, and the 429 plan words are unchanged; credit is unchanged. gateway-routing.md says so. Run: - routing_test's failure table: the literal 500 → failOther; a 503 "upstream quota service unavailable" → failOther; 500 usage_limit_reached and 503 RESOURCE_EXHAUSTED → failQuota; 403 "今日额度已达上限" → failQuota; 429 "当前分组上游负载已饱和" → failRate. - New TestGroupWaitsOutRelayLoadLimit (two members answering the literal 500, Patience 240): fails on the old code with the 500 (a 1, b 3), now 200 after a replan with no quota rest. - go test ./internal/gateway, gofmt, GOOS=linux/windows go vet -tags nogui. Not done: a 429 with the same load wording still reads as quota (no literal case of it seen). |
||
|
|
691858e064 |
gateway: a Codex routing group that falls to DeepSeek sends every tool call with reasoning_text, so DeepSeek no longer refuses it with 400 (#1592, waangzh)
What the reporter saw: a Codex mixed group (ChatGPT first, DeepSeek after)
answered 400 "The `reasoning_text` in the thinking mode must be passed back
to the API." once the turn fell to DeepSeek.
Cause, checked against the real api.deepseek.com/v1/responses on 2026-10-11
with the owner's key: DeepSeek refuses a history where
- a reasoning item is sealed only (ChatGPT's encrypted_content, no summary),
- a function_call/custom_tool_call has no reasoning item in its step (an
assistant turn ChatGPT answered without one, or a second step), or
- a reasoning item's reasoning_text is empty.
It accepts reasoning_text " " (with or without encrypted_content and id).
withReasoningText only filled the third case.
Change:
- withReasoningText (passthrough) walks the input by step: a reasoning item
with no text gets its summary, else noReasoning (" "), keeping its other
fields (encrypted_content, id); a tool call with no reasoning item since
the last output or user message gets one with noReasoning before it.
- buildResponses (translated, e.g. an Anthropic agent onto DeepSeek's
Responses) does the same for a tool call with no thinking before it.
- Only where replaysReasoning says so (DeepSeek); gpt-5.4 on a relay gets
no reasoning_text.
- gateway-routing.md describes the Responses replay.
Run:
- The reporter's 400 reproduced on the real API, directly and through the
old binary (direct model and group/codex-different); the new binary
answers 200 completed for each case, whole and streamed.
- New TestDeepSeekGroupMemberAfterChatGPT (8 subcases) and
TestTranslatedDeepSeekCallWithoutReasoning fail on the old code, and
TestDeepSeekReasoningPassedThrough's empty item; all pass now. The fake
now refuses what the real API refuses.
- go test ./internal/gateway, gofmt, GOOS=linux/windows go vet -tags nogui.
Not done: DeepSeek's Anthropic endpoint has the same rule (a tool_use with
no thinking is refused, checked live); not changed here. Kimi and GLM
thinking were not checked: no key, and magpie has no replay rule for them.
|
||
|
|
35eea09464 |
gateway: a provider routed its own way keeps that order inside a group that routes another way (kchen0x on X)
kchen0x had a Smart routing group with Antigravity (9 accounts, set to 按顺序) and a Business account. Requests still went to the 9th account, the one renewing soonest. planLevel pooled every member's keys and accounts into one list for any group not routed in order, so the provider's own routing was never read; Smart then put the soonest renewal first. Now a member whose provider routes other than Smart, and other than the group does (ownRouting), is planned as a nested group already is: a unit weighed by the first account or key it would try (firstAwake), then tried whole in its own order. A provider left on Smart is pooled as before. leastHeld, which reorders a rotate group's first request, leaves such a group alone as it does one holding a nested group (without that, a rotate group still came back "k2 k1 k3 kb"). GUI hint (GROUP_NEST, 4 languages), start docs (en, zh, ja) and gateway-routing.md say so. Run: - TestProviderKeepsItsOwnRoutingInAGroup covers outer Smart, rotate, usage, pace and manual, plus a Smart provider still being pooled. On the old planLevel it fails with "k3 k2 k1 kb" (the reported order). - go test -tags nogui -count=1 -timeout 40m ./...: all ok. - gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/gateway. - GUI: i18n-keys, gui-ja/de/zh-tw and every *group*/*routing* test, both engines: 765 pass. A first run beside the full go test had 9 webkit timing reds (routing-group-fold, routing-keys-fold, routing-ctx-still, gateway-key-groups); each file passes alone, and the whole set passes when nothing else runs. |
||
|
|
917a365778 |
gui: opening the Usage page or the tray panel's Allowances reads the allowances now, once in 30s (#1588, qq666666qq)
On Windows the tray panel's Allowances tab, and the window brought back
on Usage, showed the reading magpie kept until "Read the allowances
again now" was pressed: picking the panel's tab and the panel shown
again only loaded usage/quotas without ?asked=1, which hands back the
backend's cache, and so did the window coming back to the front on
the Usage page.
Opening the allowances is now asking to see them (quotasOpened), as
Refresh now is and as #1518 counts the Usage page opened:
- the window: Usage from the nav (as before), the Overview tab picked,
and the window back to the front on the Overview;
- the tray panel: the Allowances tab picked, the panel brought up on it
(focus / visibility), and a menu bar cell clicked (panelQuotaFocus).
A panel page loaded while it is put away (hidden or without focus)
doesn't ask, so a panel prepared at login sends nothing with allowance
reads at "When I ask".
An asked read makes the backend read every account again (AskUsage
clears the caches; only Claude has its own 30s floor), so an opening
within 30s of the last asked read (QUOTAS_OPEN_GAP) sends an ordinary
read instead: switching tabs and back, focus and visibilitychange both
firing, focus-follows-mouse don't reach the vendors again. Reads stay
one at a time: an opening during an ordinary read goes after it
(loadQuotas, unchanged). Refresh now still asks every time; the timed
refresh is unchanged and never asks.
Written against main from qq666666qq's fork patch
(qq666666qq/magpie#1), which asked on every tab click and every return
without a gap; this keeps their entries and adds the gap, the Overview
tab, and the hidden-panel guard.
Run: new allowance-open-read.test.cjs (Chromium and WebKit, en and zh,
panel at 360px): passes; red on the old app.js (the panel's Allowances
never asks; the window re-asks on every nav click), red with
QUOTAS_OPEN_GAP = 0, and red with the window-return line removed. The
GUI tests touching the allowances (every test naming usage/quotas, the
Usage view or the panel's Allowances tab) in both engines, and
go test -tags nogui ./internal/gui. No Go changes. Not tried in the
native Windows tray.
Of the GUI run (3164 tests, load ~120-230), the 8 failures passed when
their files were run again, except library-mcp-tool-switch in WebKit,
which fails the same with main's app.js (
|
||
|
|
99548470d0 |
gateway: Claude Code's billing line no longer goes to vendors' models, so their prompt cache is read again (#1600, justrun1983)
Claude Code puts `x-anthropic-billing-header: cc_version=…; cc_entrypoint=…; cch=…;` in system[0], a block of its own whose cch changes every turn. magpie sent it on to every upstream, so a vendor's model read it as the first words of the prompt and its prefix cache missed from byte 0 on every turn: the reporter's Claude Code on commandcode-plan/deepseek-v4.1-flash read 4.1% of its input from the cache, ~96-99% with the line turned off in Claude Code. The line now goes on only to a Claude model asked on Anthropic's Messages API (a key's, a relay's, Bedrock's), byte for byte as Claude Code sent it (keepsBillingLine, billing_line.go). Everywhere else it is left out and the rest of the system goes as sent, cache_control included: - a vendor's model relayed on Messages (passthrough: DeepSeek's, Command Code's Provider API, a moved plugin's Messages); - every translation to Chat, Responses or Gemini (forwardTranslated, a Claude model on Chat too: it is for Anthropic only); - the subscriptions asked through their own clients' APIs: Cursor, Devin, Kiro, Qoder, Zed and Command Code's Go plan (attempt). Untouched: the Claude subscription (its run sends its own, already without the caller's: withoutBillingHeader), another magpie (it decides for the provider it picks) and Code Assist, where antigravityTurnsAway reads the line to explain Antigravity's refusal (#666). Tests use the reporter's literal block (cc_version=2.1.114.aff; cc_entrypoint=sdk-cli; cch=…): TestBillingLineLeftOutForVendors sends two turns differing only in cch through Messages (DeepSeek), Chat (DeepSeek and a Claude), Responses and Gemini upstreams and requires the same body without the line; TestBillingLineLeftOutOnCommandCode does it for Command Code's Go plan and Provider API; TestWithoutBillingLine covers the system string, the line inside a first block, a system of the line alone, and mentions that stay. TestBillingLineKeptForClaude and the existing TestClaudeCodeBodyReachesRelayAsSent require a Claude model's Messages body unchanged byte for byte. Broken by hand: dropsBillingLine returning false turns every vendor subtest and the Command Code test red; the backend strip removed turns the Go plan check red; keepsBillingLine returning false turns both Claude tests red. Run: go test -tags nogui ./internal/gateway (whole package), the full suite under the queue lock, gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway. Not tried against a real DeepSeek or Command Code account: the cache-hit numbers are the reporter's. |
||
|
|
15872d977a |
gui: with the window open, magpie leads Command-Tab's order, so one Command-Tab away and one back returns to it (#1381, ttmouse)
ttmouse on v0.1.1168: open magpie's window, Command-Tab to another app, Command-Tab back, and magpie is last in the switcher. Cause: magpie is out of the Dock (Accessory) until the window opens. With Settings > Dock set to "while the window is open" (or a full-screen window), the quick panel's focus activates magpie while it is still Accessory, and it joins the Dock (Regular) after that. An app activated before it joins stays last in LaunchServices' front-to-back order (lsappinfo visibleProcessList), which Command-Tab follows, though it is frontmost. Wails' Focus only calls activateIgnoringOtherApps when the app isn't active, and calling it again while active is a no-op. setDock also ran async (dispatch_async), so openMain's Show/Focus could come before the policy change. Fix: - setDock runs on the main thread at once (InvokeSync), so openMain joins before it shows the window. - A pure dockStep(regular, on, active, front) decides the move. Joining while already active activates the Dock and then magpie again (activateAgain), which puts magpie first in the order. Joining while not active just activates it; leaving never re-activates. - The full-screen join does the same once the window is in full screen (DidEnterFullScreen) if magpie was active when it joined. - Dock "off" (the default) is unchanged: magpie stays out of the Dock and out of Command-Tab, by design. The tray panel's behaviour is unchanged. - docs/subsystems/gui-shell.md: Runtime path item 7 for the Dock setting. Run: - TestDockStep (table, pure). TestDockJoinLeadsCommandTab (darwin GUI build): a real Accessory Wails app activated, then setDock(true, true) + window Show/Focus, asserts it is first in lsappinfo's order. Red with `again` forced false (front was the test, kitty first in the order), green with the fix. - go test ./internal/gui (GUI build, darwin) passes; full go test -tags nogui ./... passes; gofmt -l clean; go vet ./internal/gui (darwin) and GOOS=linux / GOOS=windows go vet -tags nogui clean. - Real build on this Mac, sandbox HOME, own bundle id, port 3481, DockWindow on: launched with the quick panel, window opened through the Mac's reopen, then two osascript Command-Tabs. Old build: magpie front but 11th of 11 in the order (the report). New build: magpie 1st; after Command-Tab, the other app 1st and magpie 2nd; Command-Tab again brings magpie back. Dock "always": magpie 1st, round trip works. Dock "off": stays UIElement, not in the order. Not tried: the full-screen path in the real build, a human Command-Tab (only osascript keystrokes), real accounts (not involved). |
||
|
|
d1f0576a78 |
gateway: a Claude run kept again leaves its old key, so letting go past idleMost ends instead of spinning with the bridge locked (X, Sma1lboy)
Sma1lboy found magpie at 158 GB after two days with many omp agents on a Claude subscription, and traced it to keepIdle. Cause: letGo keeps a run at backKey when the client goes away mid-reply, and the reply's ended can then keep the same run at the turn after. The run sat in b.idle under both keys. Past idleMost, the eviction loop picked that run as oldest on every pass but deleted only run.idleKey (the newer key, then ""), so len(b.idle) never fell: the loop never ended, held b.mu (stopping every Claude subscription request) and appended to drop without bound. Fix: keeping a run again removes its earlier entry when that entry is still its own (not a run that replaced it), and the eviction loop deletes the map key it found as oldest, aborting each run once. Run: go test -tags nogui ./internal/gateway/ (ok, 396s); gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/gateway clean. The new TestClaudeIdleRunMoves and TestClaudeIdleEvictionEnds (rekey and stale, in a child process) fail on the old keepIdle: the child times out in the loop. Not reproduced with a real two-day omp workload. Co-authored-by: Sma1lboy <541898146chen@gmail.com> |
||
|
|
85089a2400 |
gui: a routing group whose plugin lists none of its models no longer blanks the Routing page; it shows as matching nothing, the rest as ever (#1585, dbydd)
The reporter's Routing page showed only "null is not an object
(evaluating 'g.members.map')" and no group, while every group still
routed. A group made of patterns only whose models a provider stops
listing (a plugin behind on updates) has no members, and Go's nil slice
went out of /api/groups as "members": null. groupRow, pickedRow, the
filter and the group editor (inGroups reads every group) all call
members.map/some/flatMap, so one such group threw out the whole list.
- groups.go: groupsState says a group's members as [] when it has none,
and an unmakeable template's too.
- providers.go: the Gateway's group entries say icons and providers as
[], never null (app.js gatewayModels joined g.providers).
- routing.js: every /api/groups response goes through groupsFrom, which
makes each list a list and leaves out an entry that isn't a group;
drawGroups draws a group that still throws as one flagged row
("This group can't be shown: …", zh/zh-TW/ja/de), never the whole list;
the filter shows such a group rather than throwing.
- app.js: gatewayModels reads null icons/providers as none.
Verified: a probe through provider.SaveGroup({Match: a/m*}) then the
provider listing other models gave "members":null on main; the Go test
TestGroupsNeverNullMembers goes red with groups.go reverted (group and
3 templates null) and green with it. GUI test group-null-members.test.cjs
uses that response's literal bytes: 12/12 red on the old assets, 12/12
green now (Chromium + WebKit, en + zh, 1100 and 420 wide, plus the
Gateway list). gui-de, gui-ja, i18n-keys, group-*, panel-routing,
gateway-model-info and the routing-manual/save/provider-off tests pass
(221/221). Which plugin the reporter has was not asked; the fix covers
any provider whose models a pattern group stops matching.
|
||
|
|
76db4c6c28 |
main, agent: --help on any command or agent only prints its usage, and Snow and Gemini CLI refuse a value they don't know instead of taking magpie out (#1457, blackrion)
`magpie snow --help` printed "✓ Snow CLI model --help" and did what
`magpie snow default` does. It deleted profiles/magpie.json, put back the
active profile, and wrote "--help" as advancedModel into the profile it
went back to. There were two causes:
- run's agent forms took any second argument as a model. The `len(args)==2`
branch special-cased only `default`.
- Snow's model Set, on magpie's profile, treated a value no profile of the
user's is on as "leave, and write it into the profile left for".
The arguments were the class, not Snow alone. Under the old code, `magpie
claude --help` and `magpie codex --help` wrote "--help" as Claude Code's
and Codex's model, and `magpie save --help` saved a profile named
"--help" (the new guard test caught each of these).
What changed:
- help_cli.go and run: -h or --help anywhere in the arguments, or help as
the word after the command, prints that command's usage and returns
first, before run reads, moves or starts anything. It prints the
command's own usage where it has one (model, group, group rule, library,
plugin, quota, sessions, search, visible, webdav, s3, claude-code), its
lines of magpie's usage otherwise, and for an agent its forms and
fields. The usage gains a `magpie <command> --help` line.
- `magpie <agent> …` refuses any other argument starting with "-"
(negative numbers aside): "unknown flag X: nothing was changed".
- snow.go: on magpie's profile, a model that is neither through magpie
nor any profile's model is refused, and the files stay as they were.
A `magpie/<x>` that isn't in the catalog is refused on or off magpie's
profile; it used to fall through to the same leave. A model of one of
the user's profiles still switches Snow there, and empty still goes
back to the profile they were on.
- gemini.go, a sibling found by auditing every agent's Set: provider is
Gemini CLI's first field, so `magpie gemini <a model with no option>`
reached it. It unrouted Gemini CLI (stashed key, sign-in and model put
back) and only then said "unknown provider". An auth it doesn't know is
now refused before unroute. The audit found no other Set that leaves
on an unknown value. The other model Sets write an unknown value as the
agent's own model, which is the intended own-model pick. The on/off
provider fields of ante, claudedesktop, copilotjetbrains, cursorlocal,
pencil, t3code, workbuddy and zcode take any non-empty value as "on".
Both are left as they are.
- docs/subsystems/agent-wiring.md says the above.
Tests:
- TestHelpOnEveryCommandDoesNothing reads the commands from run's switch
in main.go's AST, so a new command is covered without a list to keep.
It adds every agent id. For each one it runs --help, -h and help in
several positions under a sandbox home, and checks that nothing is
written, the run returns within 20s and usage is printed.
- TestAgentHelpLeavesSnowWired is the reporter's case: Snow wired, then
`snow --help`, `-h`, `help`, `model --help` and `snow-cli --help`,
unknown flags, and `snow nonsense`. Snow's files must stay the same.
- TestSnowUnknownModelChangesNothing and TestGeminiUnknownAuthChangesNothing
cover the Sets.
What was run:
- Each test was run against the old code. Old main.go: the save, snow,
claude and codex subtests FAIL ("✓ saved profile --help" with
profiles.json written; "✓ Snow CLI model --help"; "✓ Claude Code model
--help"; "✓ Codex model --help"), and so does TestAgentHelpLeavesSnowWired.
- Old snow.go with old main.go: TestAgentHelpLeavesSnowWired FAILs with
Snow's files changed, and TestSnowUnknownModelChangesNothing FAILs with
`"--help" taken`.
- Old gemini.go: TestGeminiUnknownAuthChangesNothing FAILs with
`"nonsense-model" changed Gemini CLI`.
- All pass with the fix.
- In a sandbox HOME with pinned Go caches, at origin/main
|
||
|
|
642bea3a99 |
gui, tui, provider: Remote magpie has a heading of its own in the Add sheet, Another computer's magpie, after On this machine, not among the Relays (Avalon on Discord)
Avalon on Discord (v0.1.1168): "供应商添加中没有Remote magpie 的选项". It was
there, filed under Relays (中转), where nobody looks for another computer's
magpie, since it isn't a relay.
The preset is now of its own kind, KindRemote ("remote"), declared after the
local presets. Kind only groups presets for display: the GUI's add sheet,
`magpie presets` and the TUI's add list; makerCatalogs (vendors only) and
the import matcher (skips local) are unchanged for it, as it has no URL.
- GUI: a fourth section after On this machine, "Another computer's magpie"
/ "shared on its network" (zh 另一台电脑上的 magpie / 在它的局域网上共享,
zh-TW, ja, de too). A preset's note is now also found in the words it is
shown in, and the zh/zh-TW/ja note begins with 远程/遠端/リモート, so 远程
finds it as remote and magpie do.
- TUI: the add list says "Remote magpie · another computer's magpie, shared
on its network" instead of "· relay" (kindNote).
- CLI: `magpie presets` lists it under "another computer's magpie".
- Docs: reference.md, subsystems/providers-accounts.md and the site's
remote page (en, zh, ja) say where the tile is.
Run:
- remote-magpie.test.cjs gains "Remote magpie has its own heading in the
add sheet" (420px, en and zh, Chromium and WebKit): the heading and hint,
right after On this machine, Remote magpie under no other heading, no
sideways scroll, and remote / magpie / 远程 each find it alone under its
heading. With the old app.js it fails "no heading of its own" in both
engines and languages; with only the note search taken out, zh fails on
远程. Its older test now wheels the sheet to the tile (now the last row;
a scroll from code is put back by the page's guard, which made it flaky
in WebKit at 700px): 8 of 8 WebKit runs green.
- TestTUIAddListSaysRemoteMagpieIsAnotherComputers fails on the old note
with `listed as "Remote magpie · remote"` (and "· relay" before the kind).
- Every GUI test that opens the add sheet (40 files) plus gui-de, gui-ja,
gui-zh-tw and i18n-keys, in Chromium and WebKit: all pass.
- site worker.test.mjs passes.
- gofmt -l clean; go vet -tags nogui on ., internal/provider, internal/tui,
internal/gui for darwin, GOOS=linux and GOOS=windows.
- go test -tags nogui -timeout 40m ./... under a temp HOME: all 48 packages ok.
Not tried in the real Wails window.
|
||
|
|
1c0eab7c84 |
gui, gateway: every search API takes a base URL of the user's own, under its key in Settings (#1580, xzhlksh)
The reporter has endpoints that answer as Tavily, Exa and others do, at
addresses that aren't the vendors', and Settings only took a key. The
saved SearchAPI already had a url, and the CLI's url= set it, but the
Settings row showed the field only for SearXNG and sent "" for the rest.
- Settings › Models › Web search: the add row has a base URL field on a
line of its own under the key, for every API, with the vendor's own
address as its placeholder (searchVendorJSON.base). Picking an API
already added fills in its saved URL, so Add with a new key alone keeps
it; Add with no key typed changes only the URL, the key kept (the key
placeholder says so). Strings in zh, zh-TW, ja, de.
- provider: check() also refuses a URL with a ?query or #fragment, since
the vendor's path goes after it.
- gateway: the key goes only to the URL set. Go drops Authorization on a
redirect to another host but keeps Brave's X-Subscription-Token and
Exa's x-api-key, so a search API's redirect to another host is not
followed; the error names where it was sent. The request still goes
through the gateway's client and so magpie's proxy settings.
- CLI: `magpie search add <api> <key>` keeps the url set before; `url=`
with nothing after it puts the vendor's own back (was: a new key alone
dropped the url).
- docs/subsystems/gateway-routing.md: "A search API's base URL";
gui-shell.md: the field.
- search-api.test.cjs: Settings is drawn twice (/api/state, then
/api/settings), so scrolling to the add row can hit a detached node
(WebKit, 1 in ~6 runs here); it retries the scroll.
magpie ships and lists no third-party search endpoint; the URL is only
the user's.
Tests (sandbox HOME, pinned caches):
- TestSearchAPIAtItsOwnBaseURL: an httptest fake at <fake>/relay/<vendor>/
gets tavily POST /relay/tavily/search with Bearer, exa POST
/relay/exa/search with x-api-key, brave GET
/relay/brave/res/v1/web/search with X-Subscription-Token, firecrawl
POST /relay/firecrawl/v2/search with Bearer. Passes on the old gateway
too: the backend already honoured a url.
- TestSearchKeyStaysAtItsBaseURL: with search_api.go put back, FAIL
"a key reached another host: exa-secret / brave-secret".
- TestSearchCLI: with search_cli.go put back, FAIL "a new key took the
base URL away"; with provider/search_api.go put back, FAIL
"url=https://x.example.com/?k=1 taken".
- TestSearchAPIBaseURLFromSettings: POST /api/settings/search-api saves,
keeps the key, refuses ftp/no-scheme/query URLs, lists vendor bases.
- search-api.test.cjs in Chromium and WebKit, en and zh, 980px and
420px: 8/8; with the old app.js, FAIL "Tavily takes a base URL"
(false !== true). WebKit 980px 10 runs in a row green after the retry.
search-first, search-mcp, searcher-pick, i18n-keys, gui-ja, gui-de,
gui-zh-tw, click-scroll with it: 45/45 in each engine.
- Screenshots at 980/420 in both engines checked by eye.
- go test -tags nogui -timeout 40m ./... on
|
||
|
|
93c5d846ca |
plugin: a plugin's requests to a host on the user's own network go direct, as magpie's own do (#1572, ggbdpq)
What changed: with a proxy set (magpie's, the environment's or the system's), the plugin host sent a plugin's requests for a host on the user's own network - a Remote magpie, an LLM relay on the NAS - through that proxy, which can't reach it (502 Bad Gateway) or resolve its name. Go's netproxy.Func leaves such a host direct since #982 (lan.go onLAN); host.js's proxyFor and its node:http2 sessions (#1035) were that rule's siblings without it. - host.js ports lan.go's rule: onLAN takes a private (10/8, 172.16/12, 192.168/16, fc00::/7), link-local, loopback or CGNAT (100.64/10) address, a .local name, or a name every address of which is one of those; looked up for 400 ms at most, kept a minute (256 names), a failed or slow lookup is "not on the network". It is asked only when the global proxy would be taken (after loopback, a provider's own proxy or "direct", and NO_PROXY), as Func asks it, so a user without a proxy pays no lookup and a provider's own proxy is still taken as is. IPv6 is compared on its bytes, so a v4-mapped address in hex form (::ffff:a00:1, how URL writes it) is judged as its IPv4 address. - http2.connect returns its session at once, so tunnel() now takes a promise of the proxy and connects when onLAN has answered: straight to the host for one on the user's network, through the CONNECT otherwise. Unlike the issue's patch, a LAN name that needs a lookup is covered on this path too. - The issue's patch was reviewed, not applied: its lanIP missed loopback and hex v4-mapped IPv6, it didn't strip a trailing dot, it never cleared its lookup timer, and it left HTTP/2 to LAN names proxied. New TestPluginLeavesTheUserNetworkDirect (real Bun, a proxy that keeps every target it is asked): a fetch to this computer's private address over http:// (absolute form) and https:// (CONNECT; a certificate for that address via NODE_EXTRA_CA_CERTS), to "localhost." (a name decided by what it resolves to), and an HTTP/2 session to the private address all reach the server directly; a public address (203.0.113.5) and a name that resolves nowhere (vendor.invalid) still go through the proxy. Run: the new test against the old host.js fails on all three fetches (proxy asked for each); with only the HTTP/2 check removed it fails on the session ("h2: proxyconnect tcp: 502 Bad Gateway"); with every host taken as LAN it fails on the public address and the vendor name. A bun check of lanIP over 24 addresses (both sides of every range) matched lan.go. go test ./internal/plugin ./internal/netproxy ok; full go test -tags nogui ./... ok in every package (the five whose build hit another session's go-build cache prune were rerun, all ok: ., agent, gateway, gui, library); gofmt -l clean; go vet -tags nogui internal/plugin on darwin, GOOS=linux and GOOS=windows clean. Not tried with a real NAS or Remote magpie behind a real proxy. |
||
|
|
5fa908c087 |
gateway, provider: Claude Desktop's requests to ModelScope go on its Responses API, which reports the cache and reasoning that its Chat API leaves out (#1578, sparrowbits)
What changed
- provider.ResponsesTellsCache: ModelScope's API-Inference (the
"modelscope" preset, or a provider whose Responses URL is
api-inference.modelscope.cn) with both a Chat and a Responses URL.
ResponsesFirst is true there for every model, so `usable` puts
Responses before Chat. A translated request (Claude Desktop / Claude
Code's /v1/messages, a Gemini client) goes to /responses, and
Provider.Native wires Pi, omp and droid to Responses. A Chat client's
request is still relayed on Chat, and Codex's on Responses, as before.
- forwardTranslated: when Responses is first only for the cache report,
a 404 there marks the model unfit on Responses and asks it on Chat. A
ModelScope model with no Responses route then works as it did before.
This fallback is scoped to ResponsesTellsCache.
- docs/subsystems/gateway-routing.md: the "One try" row names it.
Why
The reporter's usage.jsonl covers 202 Claude Desktop requests, all
/v1/messages -> /v1/chat/completions: 0 cache_read over 34.9M input
tokens, and reasoning 0/202. Codex on /v1/responses with the same model,
on the same day, read 94% from cache. Their direct calls show why.
ModelScope's /responses answers
input_tokens_details.cached_tokens = 12288 on the second identical
prompt. Its /chat/completions answers only prompt_tokens /
completion_tokens / total_tokens, though it is served from the same
cache. magpie already maps Chat's prompt_tokens_details.cached_tokens
(and prompt_cache_hit_tokens, cached_tokens, cache_read_input_tokens) to
cache_read_input_tokens (cUsage.usage). The new test
TestOtherChatAndResponsesKeepChat pins that. So the missing figure was
not a mapping gap: ModelScope's Chat API never sends one. The fix is to
ask on the API that does.
Scope: other presets with both Chat and Responses URLs keep Chat.
- DeepSeek, xAI, Zhipu, MiMo, Qianfan, Tencent TokenHub, Volcengine's
plans, OpenCode Zen/Go, Command Code, PipeLLM and CherryIn have an
Anthropic URL, so Claude-format requests are relayed on Messages as
they are.
- Groq's and Volcengine Ark's Chat APIs report
prompt_tokens_details.cached_tokens, and Groq's Responses API is a
partial beta.
- OpenAI keeps its existing OpenAI-model rule.
- Nothing is known of a custom relay's Responses API.
What was run
- New tests in internal/gateway/responses_tells_cache_test.go, against
an httptest fake that answers with the reporter's literal usage
bodies:
- TestModelScopeMessagesTellTheCache: streamed and whole Messages go
to /v1/responses, and the client gets cache_read_input_tokens 12288,
input_tokens 108 and output_tokens 32.
- TestModelScopeModelNotOnResponsesGoesToChat: a 404 on Responses
goes to Chat, and stays on Chat for the next request.
- TestOtherChatAndResponsesKeepChat
- TestModelScopeNativeIsResponses
- Broken by hand:
- Without the ResponsesTellsCache check in ResponsesFirst,
TestModelScopeMessagesTellTheCache fails ("Messages went to
[/v1/chat/completions], want /v1/responses"), and so do
TestModelScopeNativeIsResponses and the fallback test.
- Without the 404 fallback, TestModelScopeModelNotOnResponsesGoesToChat
fails with "404 ModelScope: Not Found".
- gofmt -l is clean. go vet, and GOOS=linux and GOOS=windows go vet
-tags nogui, pass on internal/gateway and internal/provider.
- Full suite: go test -tags nogui ./... under a temp HOME at base
|
||
|
|
f1001ec991 |
library, gui: each of an MCP server's tools has a switch, and the agents that can leave one out are told to (nf1qaz2w on Discord)
nf1qaz2w asked to turn single tools of a Library MCP server on and off.
|
||
|
|
05cf7814eb |
gateway: a translated reply cut short reaches a client that asked for no stream as the error too (#1563, ggbdpq)
What changed: every translated request is asked of its upstream as a stream, and a client that asked for no stream gets its reply assembled from it. translate read that stream and rendered whatever came as the whole reply, so an Anthropic upstream that stopped with no stop_reason and no message_stop, or a Responses one with no response.completed, handed the client a truncated answer presented as finished — the same cut a streaming client is told of in its stream (errEndedShort). The read now watches for the upstream's last event the same way (upstreamEnds), and ends with the 502 "the reply ended before it was complete" instead: nothing has been sent, so the next candidate is asked, and the last one's error reaches the agent. An error the upstream said still reports itself; a stream that said its last event (stop_reason, message_stop, response.completed) is served as it came. Review (yetone's session): with the cut check disabled by hand TestNonStreamEndedShort fails (both subtests 200 with "Let me look at the"); restored, green. The 502 takes the same path as the read-error 502 beside it (cutMidReply): nothing written yet, retryable() lets the next candidate answer, and no account is rested for it as content. The full suite, gofmt and the cross-OS vets were run on the series. Author's run: TestNonStreamEndedShort (new; Anthropic and Responses cases) fails on the old code — both cuts came back 200 with finish_reason "stop"; with the change both come back 502 naming the cut, and a reply whose last event came is served 200 whole. gofmt -l clean; go vet and go build on darwin, linux, windows; go test -tags nogui -race -count=20 on the relay-stop tests; the full go test -tags nogui ./... (TestOffline and TestSearchFollowsTheSearchersProxy red on the clean baseline too). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
e435fe00f1 |
gateway: a translated Responses reply the upstream cut short ends in an error, not as if whole (#1562, ggbdpq)
What changed: streamTranslated ended a translated reply in "the reply ended before it was complete" when an Anthropic upstream's stream stopped with no stop_reason and no message_stop; a Responses upstream's stream that stopped with no terminal event (no response.completed, response.incomplete, response.failed) was still finished as if whole, and the agent's turn ended a few words in with nothing to say why — the same reply the passthrough already tells apart (sniff.whole, #370). It now ends in the same error, asked again in place where the upstream goes on from a prefill, as an Anthropic cut is. The event that ends a stream is read by its type as the passthrough reads it (upstreamEnds, was anthropicEnds, already lastEvent), so a response.completed carrying no status field still counts as the reply's last. Chat (may end without [DONE] and be whole) and Gemini stay as the passthrough treats them. Run (review, yetone's session): TestResponsesUpstreamEndedShort passes; with the Responses half of the end check taken out by hand it fails ("a cut reply finished as whole", finish_reason "stop", no error). TestRelayStream*, TestRelayStop* ok. The full suite, gofmt and the cross-OS vets are in the series' last commit. Author's run: the red/green above, -race -count=20 on the relay-stop tests, gofmt, go vet and go build on darwin, linux, windows, go test ./... (TestOffline red on the clean baseline too, offline machine). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
440fded2dc |
gateway: a turn stopped with its tool call out is answered on Google's APIs, not refused by them (#1560, ggbdpq)
What changed: a client replaying a conversation whose turn was interrupted with the tool call still out — the call in the history, no result for it — had every later turn refused by Google's APIs with 400 "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn", the conversation with it, however it was routed: a Google sign-in (Code Assist), Vertex AI, a custom provider's Gemini URL (#1346) and a model pinned to Gemini ( |
||
|
|
fa5ef88d63 |
gateway: a Chat client's sampling is asked again without it when the Claude it is translated to refuses it by a name magpie can't read (#1559, ggbdpq)
What changed: forwardTranslated's retry loop now answers the "`temperature` is deprecated for this model" refusal (#1454) the way passthrough's does: asked once more with temperature and top_p left out. samplingAsTaken drops the sampling up front only where the model's name on the wire is one claudeLine reads; a Chat or Responses client's request to a Claude behind a relay that spells it otherwise carried the sampling into a 400 that reached the client, where the same request relayed from an Anthropic client was asked again without it. Review (yetone's session): the new case fails on the old code (400 "`temperature` is deprecated for this model" reaching the Chat client) and passes with the retry. The retry is scoped to an Anthropic upstream, a 400 matching samplingDeprecated and a request that carried sampling, so it is asked at most once and before anything reached the client; no account is rested for it. The doc conflict with main's prefill line was resolved keeping main's line. The full suite, gofmt and the cross-OS vets were run on the series. Author's run: the new case "a name magpie can't read is asked again from chat" red then green; the sampling/thinking/prefill tests ok; go test -tags nogui ./... ok except internal/testenv TestOffline (offline machine, red on the baseline too); gofmt -l clean; go vet and go build on darwin, linux, windows. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
1d016ee3f3 |
provider, gui: Token Plan 企业版 shows its usage on the Usage page, read with the account's SecretId and SecretKey (#1574, undirectlookable)
#1574 asks for Tencent Cloud Token Plan's usage on the Usage page through TokenHub's cloud API (api/1823/132270). That API covers the enterprise plan only (Token Plan 企业版; the previous commit added its regions). The personal plan (api.lkeap.cloud.tencent.com/plan) has no usage API, only the console, so it has no card. The API takes the account's API key, a SecretId and SecretKey signed TC3-HMAC-SHA256, never the plan's sk- key. provider (tencent_usage.go): - A provider at /plan on tokenhub.tencentmaas.com (ap-guangzhou) or tokenhub-intl.tencentmaas.com (ap-singapore) with a SecretId and SecretKey gets a card per team plan in PlanQuotas (tencentPlanQuotas), each key and region asked once. - It asks DescribeTokenPlanList, then DescribeTokenPlan per plan (version 2026-03-22), all at tokenhub.tencentcloudapi.com. Where a reply leaves a part out, the list's copy of it is kept. - The window is TotalUsed of CycleQuota (else TotalQuota), in credits (专业套餐) or tokens (轻享套餐, enterprise-auto). It resets at TokenSummary.CycleEndTime. Without that, it counts months from StartTime and stops at ExpireTime. - The docs don't say whether TotalUsed is the cycle's or the package's. This reads it as the cycle's. - A plan that isn't enable shows its status beside the plan's name. - An AuthFailure or UnauthorizedOperation reply says to check the key and its CAM rights. No plan visible to the key says so (a sub-user sees only the plans it made). - The SecretId and SecretKey sit in the AccessKeyID and SecretAccessKey fields Volcengine's access key uses (#1427). They are stored, kept out of key-less backups and dropped from cached cards the same way. AccessKeyVendor tells the two vendors apart. gui: - The listing tells whose access key a provider or preset takes. presetAccessKey lists the regions that take one: Tencent Cloud's two Enterprise regions. - The editor names the fields SecretId and SecretKey, with Tencent's hint, and shows them only at those regions (or at an endpoint none of the regions has). - A SecretId with no SecretKey is refused only where the fields are shown. The new strings are in zh, zh-TW, ja and de. - docs/subsystems/providers-accounts.md and the GUI tests README describe it. Run: - TestTC3SignMatchesDoc pins the signing doc's worked example (payload hash 35e9c5b0…, Signature 10b1a37a…). - TestTencentPlanRegion, TestTencentPlanWindow and TestTencentPlanQuotas use the API docs' own response examples. The last is an httptest fake that rechecks each TC3 signature and the X-TC-* headers, and fails if the plan's key is ever sent. - TestProviderListTellsTencentAccessKey covers the listing, alongside TestVolc* and TestPlanQuotas. - Breaking the action's lowercasing in the signature, or dropping TokenSummary, turns them red. - GUI: tencent-access-key.test.cjs (new) 12/12 in Chromium and WebKit at 420px, en and zh. It goes red with the region hook or the vendor labels taken out. volc-access-key, tencent-cloud, i18n-keys, gui-ja and gui-de pass. - gofmt; go vet on darwin, linux and windows; the full go test ./... Not tried against the real API: we have no Tencent Cloud account. What is read is what the docs show, and the reporter is asked to try it. |
||
|
|
47269f448f |
usage, gateway, gui: the Requests card counts requests once, a try handed on to the next isn't a failure, and says how many were answered on a retry (小一 on Discord)
小一's Codex-on-credits ledger read "5,482 · 1,094 failed" while many rows said "2 tries/3 tries" and had been answered. "Failed" counted usage rows, not requests: besides each request's final row, the gateway writes a row for every try a vendor refused or turned away (hw.refused/hw.turnedAway), and each of those was counted as a call and a failure even when a later member answered. (Ordinary failovers write no row; 499 cancels and the agent's own client-side retries are separate requests.) In the owner's own usage.jsonl, 24 of the 71 "failed" rows were such refusals a later member answered. Now a request counts once, by how it ended: - usage.Record gains `tries` (final row, when the route took more than one) and `handed_on` (the row of a try that failed and handed the request on). Totals.count skips handed-on rows; a failure is a request whose agent got an error (LostRequest); one answered after a failed try is Totals.Retried (RetriedRequest), with a `retried=1` filter. - Logs written before this are read the same way: the log index marks a failed, non-rejected row followed by another of the same route id as handed on and raises the later row's tries (routeRows); the packed row and its snapshot carry both. - Panel card, Usage overview tile, ledger card, rankings and group rows, `magpie usage` and the TUI say "N answered on a retry"; the CSV adds `tries` and `handed_on` at the end. A row says "· handed on" (with why in its title) or "· N tries". - On the ledger's Requests card "N failed" and "N answered on a retry" are buttons that switch the list to the Failed / new Retried filter, and back when pressed again. The lines wrap rather than cut a button off (German). zh, zh-TW, ja, de strings added. - Docs: reference.md (counting, filter, CSV columns), gateway-routing.md. Run: - go test -tags nogui ./internal/usage ./internal/usageapi ./internal/tui ./internal/gateway . : ok. New TestRequestsCountedOnceWithTheirRetries (JSONL fixture: legacy refused row + 200, handed_on + 200 tries 3, 502 tries 2, plain 200, routeless 429 → 5 calls, 2 failed, 2 retried, across Ledger, QueryPage, Summarize, heatmap, filters, CSV) and TestRetriedRequestCountsOnce (group a refuses, b 500s, c answers → 1 call, 0 errors, 1 retried; a lone 400 → 1 error). - Broke each by hand (count without the HandedOn skip, gateway without HandedOn, log index without routeRows): each test went red; restored. - go test -tags nogui -timeout 40m ./... under the gotest lock, rebased on origin/main |