21d0066232aec0daaff43bf83b4565a104f160a1
246
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5a27b924e2 |
providers, gateway: Google Vertex AI is a preset, Gemini in the user's own Google Cloud project, signed with their Google credentials rather than a key
Gemini on Vertex AI was reachable only through a proxy of the user's own
in front of Vertex AI's OpenAI-compatible endpoint, added as a custom
provider. The Google Vertex AI preset (google-vertex) asks Vertex AI
itself.
* The provider holds a project, a location (global when none is given;
us, eu or a region), an optional credentials file and an optional
service account to go as (provider.Vertex). It has no key and no
URL: Save refuses a key, normalize clears a key and the four URLs
kept by hand, and its one address is
https://<host>/v1/projects/<project>/locations/<location>, the host
following the location (vertexHost). It is ready when it has a
project, never for a key or an account, and an import link can't add
it.
* Each request is signed with a Google token (Sign), and the token goes
to no other address. The credentials are found as Google's libraries
find Application Default Credentials: the provider's file, else
GOOGLE_APPLICATION_CREDENTIALS's, else gcloud's
application_default_credentials.json. A GOOGLE_APPLICATION_CREDENTIALS
that isn't a full path is an error, not unset, since gcloud's file
read in its place may be another account's. authorized_user,
service_account and gcloud's impersonated_service_account are read;
external_account and another universe are refused by name. With a
service account set, the token is traded at IAM Credentials'
generateAccessToken for one of that account's, as gcloud's
--impersonate-service-account does. Tokens are kept in memory per
file and account, minted once for requests made together, again 5
minutes before they expire or when the file changes (gcloud signed
in again). A mint is given 30 seconds; one that fails fails the
requests that waited through it too, and a request given up on
stops waiting. A sign-in Google refuses says the command that makes
that file again: gcloud's for its own files, impersonating as it
did.
* The gateway speaks Gemini to it alone. A Gemini client's request is
relayed as it came, its thinkingConfig, safetySettings and schema
with it: streamed to
publishers/google/models/<model>:streamGenerateContent?alt=sse, or
asked whole to :generateContent. Every other API's is translated
(buildVertex), streamed, and read back with thoughts as reasoning,
never as the answer. The path names a model by its upstream name
when one is set, as the usage log's endpoint does. Gemini 3 is sent a thinkingLevel fitted to the
model's levels, 2.5 a thinkingBudget in the model's range, off
included (Pro's least, as Pro can't stop). A call's thought
signature goes to the client in its id and comes back on the call;
a 400 "Invalid thought signature." is asked again with every call
waved through, for that request, and a 400 refusing minimal is asked
again at the model's lowest level, kept until restart. Neither is
tried for another provider.
* Vertex AI has no list of the models a location serves, so each
location has the ones it answered with on 2026-10-06: 12 at global,
6 Flash at us and eu, the 2.5 trio at a region.
* The preset offers Priority PayGo's and Flex PayGo's request headers
(HeaderHints). GOOGLE_APPLICATION_CREDENTIALS and CLOUDSDK_CONFIG are
in agentenv.Vars, so the desktop app takes them from the login shell
and the tests clear them.
Not read: the metadata server of Compute Engine, Cloud Run and GKE;
workload identity federation; Vertex AI's express-mode API keys. No
quota project is sent.
Reference: docs/subsystems/providers-accounts.md (Google Vertex AI,
Vertex AI tokens, four constraints) and gateway-routing.md (Vertex AI).
Verified: go test ./... (nogui), -race -count=5 on the Vertex tests,
gofmt and vet. A fake Google (token endpoint, IAM Credentials, Vertex
AI) checks each credentials type, the mint shared, bounded and
re-minted, every refusal's advice and that no token reaches another
host. Each of 24 mutations made after review, of the mint, the key
rules, the advice, the upstream path and the retries, fails a test.
Live, against a real project through an impersonated service account,
with magpie in a sandboxed HOME: Chat, Anthropic Messages, Responses and
Gemini clients, streamed and whole, with thinking and with tool calls, a
whole Gemini call and its signature sent back streamed, at global, us
and us-central1, and with Flex PayGo's header. No token was found in its
files or logs afterwards.
|
||
|
|
4e584faa51 |
agent: a Codex the user disconnected stays disconnected through restarts and updates (paynezhuang)
paynezhuang on Discord: magpie's first start pointed Codex at the gateway by itself; they switched Codex on, chose "Disconnect from magpie", and after each update and restart config.toml had openai_base_url again. Cause: Codex's Sync runs at every start (SyncCatalog) and calls failover(), which writes openai_base_url whenever Codex is signed in to ChatGPT and another of the user's ChatGPT accounts is on in magpie. Nothing told it the user had taken magpie out. The same Sync's #701 branch (sign-in "magpie API" on one of Codex's own models) wired a disconnected Codex again too, and with magpie API Disconnect itself left failover's base URL behind (its own model Set ran failover). Fix: Disconnect marks the agent disconnected in the stash (<id>.disconnected) before it writes anything; connect() and an Apply that leaves the agent wired take the mark out. Codex's failover treats a marked Codex as having no other account on (and takes out a base URL it owns), and the #701 re-wire skips it. Failover for a Codex never disconnected, and a base URL written by hand (#856), are as before. Siblings: TestDisconnectStaysThroughSync connects and disconnects every non-WSL agent with fields, then runs SyncCatalog and dsh's KeepDshWired round twice: none is wired again and no file outside magpie's own changes. It passes on the old code too (only Codex had the problem); it guards the class. Cursor, Copilot CLI and Devin can't be connected in the sandbox and skip; Native (Aside) and Launch agents don't Sync wiring. Run: - TestCodexDisconnectStaysWithAccountsOn (ChatGPT and magpie API) and TestCodexAPIDisconnectStays fail on the old code ("start 0 after Disconnect wired Codex again", "disconnect left magpie in") and pass now. - go test -tags nogui ./internal/agent ./internal/gui . (sandbox HOME): ok - gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent: clean - Real magpie (nogui build, `magpie web --gateway`) under a scratchpad HOME, gateway 127.0.0.1:3481, web 3482, fake ChatGPT auth.json plus a second ChatGPT login on: old build re-wrote openai_base_url 2s after a restart following Disconnect. New build: first run wires (failover), connect, disconnect, restart as 0.1.99998, then start as 0.1.99999 (last-version moved): config.toml byte-identical to after Disconnect, no failover; connecting again wires it and a restart keeps it. |
||
|
|
a5114d931f |
agent: Claude Desktop from its MSIX isn't said to be off magpie when the package's copy is emptied, and Reconnect puts its gateway back (dumplings)
dumplings (Windows, Desktop 2.31226.0 from the MSIX) saw "Claude Desktop
已不经过 magpie:配置已变更" while Desktop ran on magpie, and Reconnect
didn't clear it; switching Desktop's provider off magpie and back did.
Two causes:
- Check went over both sets of folders magpie writes for a packaged
Desktop (the package's LocalCache and the real ones, as which build
is installed can't be told) and failed when either was off magpie.
2.31226 reads the real %LOCALAPPDATA%\Claude-3p (bg5eau, already in
desktopdir), so the package's copy, emptied, isn't Desktop off
magpie. desktopRead now judges only the set whose Claude-3p Desktop
ran in last ("Local State", desktopdir.LastRun), every set when it
ran in none, as before.
- Reapply on an unwired drift re-set the field drift shows on and
fields on magpie's models. Desktop's drift shows on a tier (sonnet,
on a magpie model), and its provider field ("magpie") isn't a model,
so the gateway was never written back. Reapply now also re-sets a
field whose value is magpie itself, as Wired already counts it.
The reporter's analysis said 2.31226's AppxManifest excludes
Claude-3p from virtualization; that manifest wasn't seen here (the
Windows box has no MSIX Desktop), the fix rests on Desktop reading the
real Claude-3p, which bg5eau's case showed.
Run: TestClaudeDesktopMSIXChecksTheFoldersDesktopRuns (MSIX layout:
package Roaming\Claude and Local\Claude-3p with an older Local State,
the real Claude-3p newer); red with Check over every set, and red
with Reapply without the magpie-valued field. go test -tags nogui for
internal/agent, internal/desktopdir, internal/gui, internal/library;
the agent package's TestClaudeDesktop* built for windows/amd64 and run
on the Windows box, all pass; gofmt -l; go vet -tags nogui on darwin,
GOOS=linux and GOOS=windows for internal/agent, internal/desktopdir.
|
||
|
|
66f920e3a3 |
provider: a Claude account whose user picked every model is served Haiku 5.5 once models.dev lists it, beside the picks (wakaka)
|
||
|
|
53cce81664 |
gateway: Codex hears an event of its reply within its idle timeout while magpie holds its tries, instead of reconnecting on "idle timeout waiting for SSE" (fadenoob on Discord)
Codex counts only SSE events toward its stream idle timeout (300s by default), not the ": keepalive" comments magpie sends while it holds a try. Each try was bounded by itself (holdLead, 4 minutes since |
||
|
|
cb406c8425 |
plugins: a plugin can add an agent magpie has no setup of its own for
Plugins could be subscription providers or gateway middleware. Now a third
kind: an agent plugin, so a user whose agent magpie doesn't ship can still
put it on magpie.
- internal/agentplug: a plugin's magpie.agent module (or a *.agent.js file)
exports agent = {id, name, config, format?, model, prefix?, bin?, dir?,
ua?, icon?, notice?} and an optional connect({gateway, model, models,
agent}) returning the other keys to write. Compiled in moejs, reloaded
when plugins.json or the file changes; why one didn't load is kept.
- internal/jsmod: module compiling (imports kept inside the plugin), moved
out of middleware so both share it.
- internal/agent/plugged.go: each becomes an Agent (Plugin set) after
magpie's own. JSON, YAML and env files are edited key by key, comments
kept; what each key held is stashed typed under plugin:<id>:<path>, and
its own model or Disconnect puts every key back. A built-in id is
refused; a connect that throws writes nothing. Key magpie-<id>; usage
names it by key or ua (usage.PluginAgents).
- GUI Plugins page: an Agent kind chip and glyph, a Discover "Agents"
section (market kind "agent"), and an installed row line "Adds X to
Agents" or why it didn't load. zh, zh-TW, ja, de strings.
- Docs: site Plugins page (en, zh, ja) "Agent plugins", reference.md,
agent-wiring.md, gateway-middleware.md.
Run:
- go test ./... (all ok); gofmt -l clean; GOOS=linux go vet -tags nogui
./... and GOOS=windows go vet ./... clean.
- TestPluggedYAML, TestPluggedJSONUnwire, TestPluggedRefused.
- GUI: plugin-agent.test.cjs 22/22 (en, zh, zh-TW, ja, de; 980 and 420;
chromium and webkit); all plugin-*.test.cjs, i18n-keys,
deprecated-subscriptions, filter-ime: 315 pass, 0 fail.
- Real use, in a sandbox HOME: an Aider plugin (~/.aider.conf.yml, prefix
openai/, connect writes openai-api-base/key) installed in a dev build;
picking DeepSeek V4.1 Flash on the Agents page wired the file keeping the
user's comment and keys; real aider 0.86.2 `--message` answered through
magpie from the real DeepSeek account; usage.jsonl recorded agent aider,
provider deepseek, 200; Disconnect restored the file byte for byte.
|
||
|
|
61aa681e60 |
library: an MCP server, or the servers picked, are copied as an agent's project file has them, to paste into a project magpie doesn't keep (#1478, xiaozhu1337)
A project's MCP servers could only be given by adding the project to
magpie first. For a one-off (add them, then let the project keep them),
that is a detour. Now the servers page's Select bar, and a server's
editor, have Copy config…: a menu of the agents that read a project's
servers from a file (Claude Code .mcp.json, Codex .codex/config.toml,
Gemini, Cursor, OpenCode, ZCode, Pi), each with its file. A pick puts
that file's text on the clipboard and the status says where to paste it.
What changed:
- library.ConfigOfServers(agent, names): the servers written by the same
code a project of magpie's is written with (mcpFile.put, through() for
one magpie is signed in to, the agent's own variable syntax) into a
fresh file in a temp folder, read back and removed. Nothing in the
user's files is written. A server the agent can't take there (SSE for
Codex or Pi, a ${VAR} it can't read) is left out and named, as a
project's sync leaves it out.
- POST /api/library/mcp/config answers {file, text, skipped}.
- library.js: copyConfigButton in the pick bar and the editor's bar;
strings in zh, zh-TW, ja, de.
- docs/subsystems/library.md says so.
Run:
- TestConfigOfServersIsTheProjectFile: for every agent in
projectMCPFiles, the copied text equals byte for byte the file magpie
writes into a fresh project with the same servers, the servers left out
are those supports() refuses, a signed-in server is the gateway's
/mcp/<name>; with through() taken out it fails.
- library-mcp-copy-config.test.cjs in Chromium and WebKit, en/zh/ja/de at
440px: the menu's agents and files, the post, the clipboard text, the
left-out status, nothing copied when nothing fits, the editor's button;
no sideways scroll. The library and project GUI tests that draw the
pick bar or the editor (18 files) pass in both engines.
- go test -tags nogui ./internal/library/ ./internal/gui/ under a temp
HOME; gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui.
- Not clicked in a running magpie window; the page against a faked API
and the library code under a sandbox HOME only.
|
||
|
|
a690d8d7a1 |
main: magpie web behind a reverse proxy prints its link through the proxy, key and all (#1479, uclort)
magpie web on a server, listening on 127.0.0.1:3430 behind nginx or Caddy, printed only http://127.0.0.1:3430/?k=…, and the reporter had to join "/?k=…" onto their domain by hand. It now also prints "through your proxy https://magpie.example.com/?k=…" when it is told the proxy's address: MAGPIE_WEB_URL (the page's own address there), or else MAGPIE_PUBLIC_URL with no port of its own, which NetworkLinks already takes as a reverse proxy for --lan (#372). A MAGPIE_WEB_URL with a query, a fragment, credentials or another scheme is ignored. Only the printed link changes: the key, its cookie and webGuard are as they were, and nothing new is listened on. The key itself was already fixed with MAGPIE_WEB_KEY (16+ letters, digits, - . _ ~); the usage text and docs/reference.md say both. Run: go test -tags nogui -run TestWebProxyLink . (red with proxyLink returning ""); a built magpie web under a sandbox HOME with MAGPIE_WEB_URL=https://magpie.example.com, MAGPIE_WEB_KEY set, on 127.0.0.1:3493 printed the proxy line, answered 401 with no key and 303 with the key under Host: magpie.example.com. |
||
|
|
9ca4b9ec28 |
gateway: provider search can be Off in Settings, so a model's web search goes to the Search APIs alone (#1483, NorethSea)
Settings › Search gets an Off choice beside Automatic and the providers. With it, no provider is asked to search for another model (no ChatGPT or Claude account's allowance spent, no Kimi Code search service, no Google sign-in's separate search), and the saved Search APIs are asked in their order; one failing never falls back to a provider. With Off and no ready Search API, magpie offers no search tool of its own. A provider's native search on the client's own protocol is unchanged. NorethSea's change (from their fork, feature/search-provider-off, 68fe54ff), cherry-picked onto main. On review one sibling was missing: ownSearcher and webSearchOf (what this magpie's model list tells another magpie about searching) still treated a Kimi Code plan or Google sign-in as searching for its models with Off. Both now go through searchesOwn, the one check canSearchFor uses, so with Off a remote magpie is told there is no search instead of adding a tool that has nothing behind it. Run: go test -tags nogui ./internal/gateway ./internal/gui ./internal/settings (sandbox HOME); TestSearchProviderOffTellsRemoteMagpie goes red with webSearchOf's old check put back; searcher-pick, gui-ja, gui-de, gui-zh-tw .test.cjs pass in Chromium and WebKit. Co-authored-by: NorethSea <963979204@qq.com> |
||
|
|
0fb4ff17ba |
agent: Snow CLI's thinking level is set from the Agents page, from the levels magpie's model has (#1457)
zRain (#1457) asked for thinking.effort, responsesReasoning and responsesVerbosity. magpie's profile asks the gateway on Chat Completions (requestMethod "chat"), and on that protocol Snow 0.9.2 reads chatThinking only (api/chat.ts: enabled sends reasoning_effort; unset or disabled sends thinking {type: "disabled"}). thinking.effort is the Anthropic method's, responsesReasoning and responsesVerbosity the Responses method's, so none of them would change a request of magpie's profile, and they aren't written. A "thinking" field, as Pi's and dsh's, writes chatThinking {enabled: true, reasoning_effort: <level>} the way Snow's own settings screen does (ui/pages/configScreen/useConfigState.ts), on magpie's profile only, and copies it to config.json. Its levels are the catalog's for the model picked through magpie, after a default that says Snow takes off then; a model that lists none offers none. Clearing it deletes chatThinking. A chatThinking the user had on the profile magpie's was made from comes along and is shown as theirs; it is only changed when picked here. Enabled with no level reads as "on". On a profile of the user's own the field is empty, offers nothing and refuses a pick. Tests: TestSnowThinking, with a user profile in Snow's own format carrying chatThinking: shown as theirs, levels offered, a pick written and mirrored, kept through Sync, none offered for a model without levels, cleared to Snow's default, the user's profile untouched. Writing a fixed level instead of the pick fails it ("chatThinking: map[enabled: true reasoning_effort:high]"). TestSnow* and TestSync* pass under a temp HOME with pinned caches. GUI: snow-fields.test.cjs (Chromium and WebKit, en/zh/zh-TW/ja/de, window at 1240 and 720, tray panel at 440): on magpie's profile the row draws the small and thinking pills, the thinking default reads "default (off)" in each language and no pill runs past the row; on a profile of the user's own neither is drawn. With the small key taken out of app.js none() it fails 5 cases. The agent field, layout, effort and subagent GUI tests pass beside it (156 tests), and go test ./... passes under a temp HOME. Real Snow CLI 0.9.2 (sandbox HOME made by Snow itself): with magpie's profile written by this code (model relay/glm-4.6, small relay/glm-4.5v, thinking high) and its baseUrl pointed at a fake server, `snow --ask` sent its turn as relay/glm-4.6 with max_tokens 131072 and reasoning_effort high, and its light request as relay/glm-4.5v. |
||
|
|
e949c0ca8f |
agent: Snow CLI's light model (basicModel) can be picked apart from its main model on the Agents page (#1457)
zRain (#1457) asked for Snow's advancedModel and basicModel to be chosen separately; magpie wrote the picked model to both. Snow 0.9.2 asks basicModel for its summaries, compaction and file search (utils/config/apiConfig.ts; agents/compactAgent, summaryAgent). A "small" field, as OpenCode's and Crush's, sets basicModel on magpie's profile (profiles/magpie.json, copied to config.json): a model through magpie only, since both models go to the profile's one baseUrl, the gateway. Empty, it follows the main model. A small model of its own stays through a new main model and a catalog sync (snowProfileFor keeps a basicModel that differed from the advancedModel it replaces), and one the gateway no longer resolves goes back to following. On a profile of the user's own the field reads empty, offers nothing and refuses a pick: that profile's models are theirs to set in Snow. The Agents row leaves a small field with nothing to offer and no value out, as it does an effort with none (app.js none()). Tests: TestSnowSmallModel (pick, read back, refuse a non-magpie model, kept through a new model and Sync, follows again when cleared, Disconnect). With the keep in snowProfileFor removed it fails "small after a new model and sync". TestSnow* and TestSync* pass under a temp HOME with pinned caches. |
||
|
|
6ad5dc5855 |
agent: Snow CLI's window, output and image support follow magpie's model until the user sets them in Snow, and a vision model of theirs that would reach the gateway is left out (#1457)
zRain (#1457, Discord #feedback) asked that maxContextTokens / maxTokens be synced when the model changes, and for Snow's vision settings. magpie's profile (profiles/magpie.json) already took maxContextTokens and maxTokens from the catalog on every pick and catalog sync, which also wrote over a value the user had set on that profile in Snow's own settings. Now what magpie last wrote of maxContextTokens, maxTokens and supportsVision is stashed (snow:<dir>:wrote), and a value that differs from it is the user's and is kept through later picks and syncs; the others follow the new model. Leaving magpie's profile forgets the stash, so connecting again starts from the user's profile. supportsVision is now set as every agent is told a model sees (fx, Copilot): true while magpie's Vision describes images at the gateway, else the catalog's word; it used to be copied from the user's profile, where it described their own model. Snow 0.9.2 sends images to the main model only when supportsVision !== false (agents/visionAgent.ts). The user's profile is copied into magpie's, vision settings included. Snow's vision model takes visionBaseUrl || baseUrl and visionApiKey || apiKey (buildVisionConfigOverride), so one with no endpoint of its own went to the gateway, which doesn't know it, and one with its own endpoint but no key sent magpie's key there. snowOwnVision keeps only a vision model with both, on the requestMethod and baseUrlMode it was asked with. Checked against Snow CLI 0.9.2's source (6ef56454: utils/config/ apiConfig.ts ApiConfig, agents/visionAgent.ts, api/chat.ts). Tests (temp HOME, pinned caches): TestSnowSyncedKeepsTheUsers, TestSnowVisionThroughMagpie, TestSnowUsersVisionModel, with Snow's own profile layout. With the stash check disabled TestSnowSyncedKeepsTheUsers fails "the user's window was written over: 65536"; without supportsVision TestSnowVisionThroughMagpie fails "supportsVision <nil>"; without snowOwnVision TestSnowUsersVisionModel fails "visionModel kept: glm-4.5v". go vet (darwin, linux, windows) clean, gofmt clean. |
||
|
|
91581fca27 |
library: a WSL agent under NAT is given a signed-in MCP server with the LAN key, so the gateway no longer answers its every call 401 (#1488, ggbdpq)
A server magpie signed in to (#615) is given to the agents at the gateway's /mcp/<name>, at the address each reaches the gateway at. A WSL distro under NAT reaches it at Windows' address, so its requests come from another machine, and lanGuard refuses such a request without an enabled gateway key with a 401, which an MCP client takes for the server asking it to sign in. through() gave it no key. Its models already carry the LAN sharing key there (keyAt, whqtian on Discord); the relay didn't. The gateway's checks are unchanged: a request from another machine still needs the key, and mcpProxy still lends a sign-in beyond loopback only to a request that carried it (sharedWith). What changed: - agent.KeyAt exports keyAt: the LAN sharing key for an agent that reaches the gateway from another machine while sharing is on, else gateway.Token. - through() gives such an agent Authorization: Bearer <that key>. The gateway takes it in lanGuard, and mcpProxy drops Authorization for magpie's token, so the server never sees it. An agent on loopback, and one in WSL while nothing is shared, stay keyless. - access.LANChanged runs after sharing is turned on or off or its key is made anew; the library syncs again then when it relays any server, so the entry carries the key there is now without a visit to the Library. - docs/subsystems/library.md says so. Run: - TestSignedInServerCarriesKeyBeyondLoopback (library: a FakeWSL distro routed via 172.20.0.1, LAN on) fails on the old through() ("claude@wsl: Ubuntu under NAT is given headers map[X-Team:acme], want the LAN key as its Authorization") and passes now; with the LANChanged call commented out it fails at "after a new key ... is given" the old key. - TestMCPProxyFromWSLWithLANKey (gateway, through lanGuard as the server runs it): 401 without the key and the server not called, 200 with it, the server gets magpie's token and never the key. - go test -tags nogui ./... under a temp HOME; gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on the touched packages. - Not tried on a real Windows + WSL NAT machine with a real OAuth MCP server; FakeWSL and httptest only. Patch by ggbdpq in #1488; the LANChanged resync added on top. Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
bfd5c82d1f |
gateway: a thinking budget turned adaptive for Claude Opus 4.7 and later still shows the thinking, so an Anthropic client's budget or a Chat client's effort on a model named by an alias is no longer answered with empty thinking (#1485)
forwardOnce turns thinking {type: enabled, budget_tokens} into adaptive
for a model that thinks only adaptively (adaptiveThinking): an Anthropic
client's own budget, or one buildAnthropic made for a model magpie knows
by another name than the vendor's (relay/opus mapped to
claude-opus-4-7: a Chat client's reasoning_effort, which the previous
commit's display didn't reach). Enabled thinking shows its text
(display "summarized" by default); adaptive thinking on Opus 4.7 and
later leaves it out unless asked, so magpie's rewrite hid the thinking
the client asked for. It now asks display "summarized" unless the
request names its own display.
adaptiveThinking now runs before withoutRefusedShapes, so a provider
that refused display isn't sent one again, and refuseShapes reads the
display as forwardOnce sends it, so a strict relay's 400 for it is
learned when the client's body had none.
Run: TestBudgetTurnedAdaptiveIsShown fails without the display (relayed
budget, plain and streamed, and a Chat effort on an alias: thinking
empty) and with the old order (a strict relay's 400 passed to the
client); passes with the change. TestAdaptiveOnlyModelsNeverGetABudget
and TestFableAndMythosNeverGetABudget expect display on a relayed
budget, and a client's own display ("omitted") is kept. go test -tags
nogui ./internal/gateway ./internal/usage under a temp HOME, gofmt -l,
GOOS=linux and GOOS=windows go vet -tags nogui. Not tried against a
real Anthropic key or a real strict relay.
|
||
|
|
6934853b42 |
gateway: a Chat or Responses client that asks Claude Opus 4.7 or later to reason sees the reasoning, asked as thinking.display "summarized", not left out (#1485, ggbdpq)
Claude Opus 4.7, 4.8, 5 and 5.5, Sonnet 5 and 5.5, Haiku 5.5, Fable and
Mythos default thinking.display to "omitted": a thinking block comes
back with an empty thinking field unless "summarized" is asked for
(Anthropic's thinking docs, Controlling thinking display). buildAnthropic
asked them {"type":"adaptive"} alone, so a Chat client's
reasoning_effort or a Responses client's reasoning (Codex) got a reply
with no reasoning_content and no reasoning summary, while OpenAI's
(summary "auto" in buildResponses) and the Claude subscription's
(--thinking-display summarized) show it, as 4.6 did by default.
buildAnthropic now asks {"type":"adaptive","display":"summarized"}. A
relay that refuses display is asked again without it and from then on
sent none (refuseShapes, as for Claude Code's display). Thinking turned
off later (disabled, between_tools, none) replaces the whole thinking
object, so display never goes with it.
Run: TestTranslatedClaudeReasoningIsShown (a fake Anthropic API that
writes thinking text only for display summarized, and for 4.6 by
default) fails on the old code for Opus 5.5, Opus 4.7 and Fable 5.1 over
Chat and Opus 5.5 over Responses (no display, no reasoning in the
reply); TestTranslatedDisplayLeftOutWhereRefused fails on the old code
and passes with it (a strict relay still answers, then is sent none).
TestAdaptiveThinking and TestFableAndMythosNeverGetABudget expect the
new shape for a built request. The shapes tests
(TestRelayRefusingClaudeCodesNewShapes, TestClaudeCodesNewShapesKeptWhereTaken)
pass. Not tried with a real Anthropic key, Bedrock or Vertex, nor in
the real Codex UI.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
fcae505ff7 |
gateway, codexcat: Codex is offered Fast on a remote magpie's model where that magpie offers its own Codex Fast, and the tier asked reaches it (#1234, PennyVibe)
remote-magpie/codex/gpt-6.1-sol had service_tiers [] in the local /v1/codex/models while the remote's own codex/gpt-6.1-sol had Fast: the local catalog only gave tiers to a provider added by its address (OwnTier, Preset == ""), and the gateway sent service_tier only to one. Now a remote magpie's /v1/models (asked with X-Magpie-Drawers) tells each model's service_tiers as its own Codex catalog offers them (codexcat.ServiceTiers over the same CodexCatalog/Entries as its /v1/codex/models). The local keeps the ids (catalog.Model.Tiers -> Entry.Tiers), codexListed hands them on for the remote's models, and codexcat.Entries offers them with Codex's own names. The gateway sends the tier Codex asked for to a remote magpie as it was asked (OwnTier, still dropped and remembered if refused); the remote serves it as its own Codex's turn. A remote from before this sends no tiers: unchanged. Run: - TestRemoteMagpieOffersItsTiers (gateway, the gateway as both computers over HTTP): fails without the codexListed change with `office/relay/gpt-6.1-sol offered "" ..., want "priority:Fast "`, and without the gateway change with `tier sent to the remote magpie [(none)], by it to its vendor [(none)]; want priority, priority`. - TestServiceTiersGoOnToAnotherMagpie (codexcat): a ChatGPT account's model with Codex's own entry tells priority+ultrafast, a relay's GPT Fast, glm none; fails when either the own-entry branch of ServiceTiers or the namedTiers branch of Entries is taken out. - gofmt -l clean; go vet -tags nogui for darwin, linux, windows on gateway, provider, codexcat, catalog, agent; go test -tags nogui of those five packages under a temp HOME: ok. Not tried with a real ChatGPT account behind a real remote magpie. |
||
|
|
59c0added8 |
gateway: a refusal naming the levels is tested to mark reasoning off whole, the other off level counts only quoted, and the error fixtures say which bytes are captured
Review on #1117 (yetone): - TestPassthroughEffortNoneRefused goes on: after Command Code turns none away with the levels named, minimal goes at low in one call. With every passthrough refusal marked per level, it fails. - otherOffNamed matches the level quoted ('none', or "none" with JSON's escaped quote), so an English "None" in an error isn't taken for it. TestOtherOffNamed fails with \bnone\b, and with the escaped quote dropped for either level. - aiStudioRefusal's status and message are AI Studio's literal bytes for minimal on gemini-3.8-flash, captured 2026-10-06 before the project's credits ran out; the capture kept only those two, so the envelope is Vertex AI's. The generateContent case is now Vertex AI's captured message for gemini-3.1-pro-preview, up to its "Learn more" link. The gpt-5.1 text in TestPassthroughMinimalRefusedNoneTaken is marked as reconstructed. |
||
|
|
67c6df418f |
gateway: Gemini turning away any thinking level, at once or passed through, is remembered for that model and level, and no longer stops a provider's thoughts
The commit before last tells Google's 400 for minimal apart from
thinking_config turned away. It left three ways for a level refusal to
still mark the provider unfit for thinking_config, or to reach the client:
* Only minimal was told apart. Gemini 3 turns away any level a model
hasn't, in the same words (AI Studio's "Thinking level MINIMAL is not
supported for this model. Please retry with other thinking level."
for gemini-3.8-flash). Any other level's 400 names thinking, matched
refusesThinkingConfig, and the provider was marked unfit for
thinking_config: no model on it was asked for its thoughts again
until magpie restarted.
* The check ran only while the model wasn't yet marked as refusing
reasoning off. Claude Code sends its turn, a title and the auto mode
classifier at once. A second 400 for minimal that arrived after the
first had marked the model matched refusesThinkingConfig, and the
provider lost its thoughts the same way.
* Passed through, a Chat client's own reasoning_effort minimal went to
gemini-3.8-flash as sent, and AI Studio's 400 went back to the client
every time. The passthrough asked again only when the error listed the
levels (effortLevelsNamed, Command Code's), and didn't remember that
either.
Now:
* geminiRefusedLevel reads the level from Google's 400, in AI Studio's
words, Vertex AI's ("Thinking level is unsupported:
THINKING_LEVEL_MINIMAL") and generateContent's ("thinking_level
MINIMAL is not supported by this model"). forwardTranslated marks that
level refused for the model (levelRefused) and asks again at the
nearest level the model has left, still for its thoughts, and at that
level from then on. geminiLevels gives the levels left: the model's
own, or Gemini 3's where they aren't known or none of its own is left.
A level turned away a second time in one request, with none left,
goes back to the client as it came. Such a 400 never reaches
refusesThinkingConfig.
* The passthrough asks a none or minimal that Gemini turns away again at
the model's lowest level (onEffort), and from then on sends that level
at the lowest up front (turnedAway). The mark is per level. AI Studio
takes none from gemini-3.8-flash, so none still goes as sent after
minimal was refused. A refusal that lists the levels marks reasoning
off as a whole (offRefused), as the translated route already did,
unless it lists the other off level among those taken
(otherOffNamed: OpenAI's "'minimal' is not supported with the
'gpt-5.1' model. Supported values are: 'none', 'low', 'medium', and
'high'."), which marks only the level refused. It is asked again at
onEffort rather than a fixed low.
* Both routes read and write the same marks. A refusal on one holds for
the other.
Tests, with what the commit before this one (b9fe82b9) gives:
* TestGeminiRefusedLevel: each of the three wordings gives its level.
Gemini's fields turned away, a level named but not turned away
(made up), Command Code's list of levels and an OpenAI unsupported
value give none. (The function is new.)
* TestGeminiThinkingLevelRefused/medium: gemini-3-pro-image-preview
turning away medium is asked again at high with its thoughts, and at
high at once the next turn. gemini-3.8-flash on the same provider still
goes at medium. There: "gemini-3-pro-image-preview: the thoughts
weren't asked for".
* TestGeminiThinkingLevelRefused/no_level_left: a model turning away
every level is asked at each once (minimal twice), and the client gets
Google's 400. The provider's other model still gets its thoughts.
There: "200 at [low ]", the turn asked again without the field.
* TestGeminiMinimalRefusedTwiceAtOnce: two reasoning-off turns at once
are both turned away at minimal. Each is asked again at low, and the
next thinking turn still asks for the thoughts. There: "reasoning off
went at [ low minimal minimal]".
* TestPassthroughGeminiMinimalRefused: a Chat client's minimal to
gemini-3.8-flash goes [minimal low], then [low], and none [none]. Claude
Code's reasoning off then goes at [low]. gemini-3.7-flash, turned away
at minimal by Claude Code's reasoning off, has a Chat client's minimal
go at [low]. gemini-3.5-flash, which takes minimal, has it go as sent.
There: "gemini-3.8-flash at "minimal": 400 at [minimal]".
* TestPassthroughEffortNoneRefused: when Command Code refuses none, the
second turn goes at low in one request. There: "turn 2: ... after 2
calls".
* TestPassthroughMinimalRefusedNoneTaken: on Chat and Responses,
OpenAI's refusal of minimal has minimal go at low, in one request from
the second turn, and none still go as sent. There: "chat turn 2 at
minimal: ... after 2 calls". Marking reasoning off as a whole for it
fails with "chat turn 3 at none: ... last sent ... low".
* TestGeminiThinkingOffAtItsLowest also runs AI Studio's wording. It
shares geminiUpstream with the tests above.
Mutations of the change were each caught by these tests:
* dropping the second-refusal guard, or the fallback to Gemini 3's
levels;
* dropping the refit of an effort;
* dropping the passthrough's up-front step, its mark, or its Gemini
match;
* marking reasoning off as a whole for a Gemini refusal, on either
route;
* narrowing the pattern to one vendor's wording, or loosening it to
any level after "thinking level", lazily or not;
* checking refusesThinkingConfig first;
* turnedAway ignoring offRefused.
Verified on b9fe82b9 with a temporary HOME. gofmt -l, go vet ./...,
go build, GOOS=linux go build -tags nogui and GOOS=windows go build pass.
go test -tags nogui ./... passes, and so does -race -count=20 on the tests
above.
Not tried live. The AI Studio project's prepayment credits were depleted
(402), so the calls never reached the model. The wording for minimal is
AI Studio's, as observed on gemini-3.8-flash. Other levels are taken to be
refused in the same words.
|
||
|
|
7f66a0cce2 |
gui: on Linux the quick panel is dragged by its header, as the window is (#1430, olivezane)
On KDE Wayland the panel can't be put by the tray icon (a Wayland window
can't place itself, so KWin places it), and since ownFrame took KWin's
title bar off it (#1283) it had no handle at all: only Meta+drag moved
it. The panel's header set --wails-draggable: no-drag on every platform
(
|
||
|
|
884dbdb201 |
gui: on KDE a right-click on the tray icon opens its menu and leaves the quick panel shut (#1430, olivezane)
Wails (v3 beta.24, systemtray_linux.go) calls the tray's click handler
both for the icon's click (Activate) and from the dbusmenu "opened" event,
when the tray host opens the icon's menu. KDE Plasma opens the menu on a
right-click, so the right-click also opened the quick panel, which took
the focus, and on Wayland the menu shut at once (it stayed under
GDK_BACKEND=x11, as the reporter saw). On Linux the click handler now
ignores a call whose callers include Wails' (*linuxSystemTray).Event
(menuOpening, trayclick.go); a left-click (Activate) opens the panel as
before. Wails has no public hook for the menu opening.
Run: TestTrayMenuOpeningIsNoClick fails with openedBy broken ("a click
from the menu's opened event was counted a click") and passes;
TestTrayMenuOpenFrameIsWails reads the Wails module's source and fails if
Event stops calling the click handler on "opened" or is renamed.
go test -tags nogui ./internal/gui/ under a temp HOME passes; gofmt -l
clean; go vet (darwin, with the GUI) and GOOS=linux/windows go vet -tags
nogui ./internal/gui/ pass; GOOS=linux go build -tags nogui passes.
Not tried on a real KDE Plasma 6 Wayland session: no KDE machine here.
|
||
|
|
8a00d0bfa9 |
agent: Cursor Private Inference is listed on the Agents page when it is installed in a folder of the user's choosing on Windows, or kept as its AppImage on Linux (#1254, whiteS18, laacmilan)
It was found only by a product.json naming it in one of the apps
folders (on Windows %LOCALAPPDATA%\Programs, %LOCALAPPDATA%, Program
Files). Its 3.24.9 Windows user setup (CursorUserSetup-x64-3.24.9.exe,
from the cursor-local download) installs flat - resources\app\
product.json beside "Cursor Private Inference.exe" - into whatever
folder the installer is given, so one put on another drive or folder
was never found, and Routing still showed requests from it while the
Agents page had only Cursor. On Linux the build is only an AppImage
(Cursor_Private_Inference-3.24.9-x86_64.AppImage), a single file that
no product.json lookup could find.
findCursorLocal now also takes the folders Windows' uninstall entries
name for "Cursor Private Inference (User)" (cursorLocalInstalls: HKCU
and HKLM, InstallLocation, else DisplayIcon's folder), and an AppImage
named for the build in the Linux apps folders plus ~/.local/bin, ~/bin,
~/Downloads and ~ (regular Cursor's Cursor-<v>-x86_64.AppImage isn't
taken).
Run:
- TestCursorLocalFoundWhereInstalled fails with each half removed by
hand ("installed in a folder of the user's: found \"\"", "its
AppImage: found \"\"") and passes with the change.
- On the Windows 11 box: the real 3.24.9 user setup installed silently
into C:\Users\yeton\cpi-1254\app; a probe test in the cross-built
agent.test.exe found nothing with the old lookup and found
"...\app\Cursor Private Inference.exe" (detected: true) with the
new; TestCursorLocal* pass there. The copy was uninstalled after.
- go test -tags nogui ./internal/agent under a temp HOME; go vet
(darwin, GOOS=linux and GOOS=windows, nogui); gofmt -l clean.
Not run: the AppImage on a real Linux desktop.
|
||
|
|
c78974407b |
library: an MCP server's check gives each step its own budget, 60s for a URL, says which step went unanswered and for how long, and doesn't keep a timeout for the session (#1467, xiaozhu1337)
xiaozhu1337's remote MCP servers are slow but healthy: initialize took 0.6-12s, notifications/initialized 0.7-3.5s and tools/list 38-53s. The check had one 15s budget for all of it (checkTimeout), so every such server showed "no answer", and CheckServers kept that first result for the session. Now each step (initialize, notifications/initialized, tools/list; connect for an SSE server's stream) has a budget of its own: remoteStep 60s for a URL, stdioStep 30s for a command (was 15s for the whole check). The timer is reset as each step starts (stepTo). A timeout says its Step and how long it Waited (ms), and the row reads "no answer to tools/list", the tooltip "No answer to tools/list in 60 seconds". A timeout isn't kept, and it drops an earlier answer kept for the server, so the next look (or a click on the status, as before) asks again. Strings in en, zh, zh-TW, ja and de; the old "No answer in 15 seconds" is gone. No per-server setting: the per-step budget covers the reported timings. Run: - TestCheckSlowRemoteServer, TestCheckTimeoutNamesTheStep, TestCheckTimeoutAskedAgain (new): fail on the old code (one budget: the 2.9s server times out at initialize; the step is always initialize; a timeout, and an earlier ok after a fresh timeout, are served from the cache), pass now. The rest of TestCheck* pass. - go test -tags nogui ./... under a temp HOME: all ok. - gofmt -l: clean. go vet (darwin, GOOS=linux, GOOS=windows) on internal/library and internal/gui: clean. - GUI: library-mcp-health (status names the step, stays one line within 220px), i18n-keys, gui-ja, gui-de in Chromium and WebKit: 13/13 pass. - Real use: `magpie web` on 127.0.0.1:3783 under a scratch HOME, a library server on a fake streamable HTTP MCP on 3784. POST /api/library/mcp/check: at 8s/2s/45s it is ok with 7 tools (55s); with tools/list at 70s it is timeout, step tools/list, waited 60000 (62s); then at the reporter's slowest 12s/3.5s/53s a non-fresh check asked it again and got ok with 7 tools (68s). |
||
|
|
c43681d64c |
gateway: a group whose every member is busy asks them again within a budget, 1 minute by default, instead of ending the agent's turn on the last one's error (#1418, Aliceonly)
Aliceonly's Codex turns ended on server_is_overloaded when plus-B and sub2api were both overloaded, to be told "continue" by hand. #1421 promised a group-wide budget for errors that pass. This builds it. When every member of a group has failed in a way that passes (busy: 408/500/502/503/504/529 that isn't a proxy, quota or response protection; a 429 that is a short rate limit, not a plan or credit), and nothing of the reply has been sent, the members that failed so are asked again in turn after a pause (replan). The pause starts at 2s, doubles each round up to 30s, and is never shorter than the soonest Retry-After; a member still asking for time goes after the others. At most 6 rounds, and only while the group's Patience lasts, counted from the first time every member had failed (provider.Group.Patience: 0 = 60s default, -1 off, at most 240s). While another member is busy too, the last one isn't first retried alone (passing): the members take turns. The last member's failure is held while the budget lasts, and a streaming agent gets SSE keepalives through the pause (pauseAlive). The trace's try says Again (the pause), Replan (how many) and Patience. Plain providers are unchanged. GUI: the group editor's "Every member busy" row (Off / 1 min / 2 min / 4 min) and the trace's line for a replanned try, in en, zh, zh-TW, ja and de. Run: - TestGroupWaitsOutEveryMemberOverloaded, TestCodexStreamWaitsOutOverloadedGroup (new): both fail with patience forced to 0 (the old behaviour: the 529, and the response.failed stream, reach the agent), pass now. - go test -tags nogui ./... under a temp HOME: all ok. - gofmt -l: clean. go vet (darwin, GOOS=linux, GOOS=windows) on internal/gateway and internal/provider: clean. - GUI: group-patience (new), group-first-token, i18n-keys, gui-ja, gui-de in Chromium and WebKit: 15/15 pass. - Real use: a sandbox `magpie serve` on 127.0.0.1:3782 under a scratch HOME, group/sol of two Responses providers on a fake upstream that sends 200 + response.created/in_progress, pings, and 20s later response.failed server_is_overloaded. curl streaming /v1/responses: plus-B failed at 20s (held, not let through), sub2api at 40s, 2s pause, plus-B asked again answered "hello from a"; the client saw only keepalives and the reply. Trace: plus-B 529, sub2api 529 with again 2000 replan 2 patience 60, plus-B 200. With both always overloaded the request ended after 3 rounds (127s) with the vendor's response.failed. |
||
|
|
1a5d790814 |
gateway: a stream that has said nothing but its frames stays held while the agent is kept alive, so a server_is_overloaded after 15s goes to the group's next member (#1418, Aliceonly)
Aliceonly's trace: plus-B answered 200 with response.created, in_progress and codex.rate_limits, nothing else, and 36s on failed the response with server_is_overloaded. The holdWriter let any stream through on the first write after holdLongest (15s), so the failure came after passing was set: it reached Codex as the turn's end, and sub2api, next in the group, was never asked. A stream with nothing but its lead frames is now held as long as one that is thinking (holdLead = holdThinking) when its agent is being kept alive with SSE comments (keptQuiet: a streaming agent that isn't Gemini). The comments keep the agent from timing out, so holding costs nothing; a stream with content is let through as before, and a Gemini stream, whose agent takes no comment, is let through at 15s as before. Run: - TestLeadOnlyStreamHeldWhileKeptAlive (new): fails on the old code with "let through after 15s with nothing said" (checked by putting the old hold back), passes now. - go test -tags nogui ./internal/gateway under a temp HOME: ok. - gofmt -l internal/gateway: clean. |
||
|
|
d81706f974 |
gateway: a Chat or Responses client's xhigh on Claude Opus 4.7 and later, Sonnet 5 and later or Haiku 5.5 goes as xhigh, not max
buildAnthropic asked every Claude that thinks only adaptively for max when the client asked xhigh, on the grounds that 4.6 has no xhigh. Only Opus and Sonnet 4.6 lack it: Anthropic's effort docs list xhigh on Fable 5 and 5.1, Mythos 5 and 5.1, Opus 5.5, 5, 4.8 and 4.7, Sonnet 5.5 and 5, and Haiku 5.5, and describe max as no constraint on token spending. So Codex, Cursor or any Chat client picking xhigh on claude-opus-5-5 was billed for max. Claude Code's own levels in magpie (claudeEffortsFor) already say only Opus and Sonnet 4.6 skip xhigh. Now xhigh becomes max only on 4.6 (noXhigh, which reads the version through claudeVersionOf, shared with adaptiveOnly). A relayed thinking budget is unchanged: budgetOf gives xhigh and max the same budget, and 31999 is Claude Code's old ultrathink, so a budget above high still goes as max. docs/subsystems/gateway-routing.md now says which models are asked adaptively (#1470) and where xhigh stays xhigh. What was run: TestXhighStaysXhighWhereClaudeTakesIt (Chat and Responses through the server stack to a fake Anthropic upstream) fails on the old main with output_config = map[effort:max], want "xhigh" for Opus 5.5 (Chat and Responses), Opus 4.7, Sonnet 5 and Haiku 5.5, and passes with the change; Opus and Sonnet 4.6 get max before and after, and a Fable 5.1 row asserts xhigh. TestAdaptiveThinking's Opus 5.5 xhigh case now asserts xhigh, beside a 4.6 case asserting max. Broken by hand (noXhigh always false) the 4.6 cases fail. gofmt -l prints nothing; go vet -tags nogui ./... passes for darwin, linux and windows; go test -tags nogui -count=1 ./... under a temp HOME passes. Through the aihubmix relay, claude-opus-5-5 with adaptive thinking and effort xhigh answers 200. Not tried against Anthropic directly (no credential outside the keychain); a relay that checks effort against an older list could still refuse xhigh. Reported and fixed by ggbdpq (#1471). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
ddd4f43144 |
provider: a routing group can be duplicated, from its menu on the Routing page or with magpie group copy (lc on Discord)
provider.CopyGroup(id, name) saves a copy of the group as it is now: its
models and patterns, routing, stays, rules, classifier, effort, context,
levels, and fast and off members. The copy is deep, so its rules' time
windows aren't shared. Its name is the one given, or "<name> copy", with a
number added past a name in use. Its id comes from the name, numbered past
any id in use, removed ones included. It is listed right after the group
it copies. The copy is a group of the user's and switched on, even when
it copies a found group or a switched-off one. The original is unchanged.
Surfaces:
- GUI: a group row's menu (right-click, or a click on its logos) has
Duplicate under Move up and Move down. It posts /api/groups/copy with
the id and t("{name} copy"), so the name is in the reader's language.
It asks before discarding an editor with unsaved changes. The status
then says "Duplicated {name}". No click scrolls the page.
- CLI: magpie group copy <id> [name]; duplicate, dup and clone work too.
- zh, zh-TW, ja and de strings. docs/reference.md and the site's start
page (en, zh, ja) list the command.
Run:
- TestGroupCopy (internal/gui): the copy has the models, pattern,
routing, rule and off member, is on, and is listed after the original.
The original stays off and unchanged. A second copy is "Fast copy 2" /
fast-copy-2. An unknown id is refused.
- TestGroupCopyCLI (root): the default name, a given name, a found
group's copy as the user's, and the errors.
- group-duplicate.test.cjs: Chromium and WebKit, en/zh/zh-TW/ja/de at
420px, 10/10. It fails 10/10 on the old routing.js. Siblings
group-arrange, removed-groups-menu-scroll, group-bulk-remove and
click-scroll pass 36/36.
- Sandbox CLI (sandbox HOME): group copy and duplicate made "DupTest copy"
and "DupTest copy 2", listed after DupTest.
- gofmt -l clean. go vet darwin/linux/windows on the root, provider and
gui packages: ok.
|
||
|
|
9e665491ec |
context: Tuned for you — each agent's settings worked out from the user's own calls, for the fewest tokens, put in on a click and undone on another
The Context tab now replays the period's calls of each agent against the
settings that decide what they cost, and shows, per agent and per model,
the value that would have used the fewest tokens for how this user works:
Claude Code's auto-compact window per model (modelSettings.<model>.
autoCompactWindow), its main and subagent prompt cache lifetimes
(promptCacheTtl, subagentPromptCacheTtl: 5m or 1h), and Codex's
model_auto_compact_token_limit. Each row says where the value comes from
now (the agent's default, the user's own setting, one magpie set, or a
variable that comes first and locks it), why (how fast conversations grow,
what a compaction leaves, how long the user pauses), the cost curve, and
the saving. Nothing is written until "Use …" is clicked; what was there is
stashed and Undo puts it back, unless the user changed it since. A window
the user set past the model's own is shown capped, as Claude Code caps it
(min(setting, model window)), so no saving is claimed that wouldn't happen.
Advice under a 3% saving is "already the leanest".
On the owner's 7 days (88K Claude Code calls, 956 Codex): opus keeps 200K
(their 500K is capped to it), fable 5.1 200K → 160K saves 5% (2.56M
tokens), both cache lifetimes and Codex's 272K are already the leanest.
Run: go vet ./... and go test ./... pass (internal/tune, internal/agent
TestTune*: user-set values kept, env locks, undo after a user edit, TOML
key order). context-tune.test.cjs passes in Chromium and WebKit, en/zh/
zh-TW/ja/de, at 360 and 1100px (22); context-window, context-scroll-end
pass. Full GUI suite: library-servers-bulk and market-have failed once
under load and pass alone; market-have fails on origin/main
|
||
|
|
a154197bbb |
accounts: ChatGPT accounts come in from codexbar's config.json (碳碳双键)
碳碳双键 on Discord (#general): several Codex accounts switched with
codexbar on the old computer; after a magpie backup and restore the new
one had only the account Codex itself was signed in to. A backup carries
no sign-in by design (a refresh token rotates, so two computers can't
share one); importing is how accounts move. But codexbar's own store,
~/.codexbar/config.json, wasn't a shape the importer knew: its accounts
sit under providers[].accounts, so the whole file was read as one entry
with no token ("#1: failed").
codexbarEntries reads it as codexbar (lizhelang/codexbar 9f2e0f53)
writes it (CodexBarConfig.swift, CodexBarConfigStore): the accounts of
the provider of kind openai_oauth and openAI.remoteConnectionAccounts,
camelCase tokens, the workspace from openAIAccountId (its id is
codexbar's own). api_key accounts are said to be keys; other providers
(API endpoints of other vendors) are left alone; a sign-in in both places
is read once. codexbar signs in with Codex's own OAuth client, so the
refresh works as for Codex's auth.json. Its own export (Sub2API's shape)
was already read.
The import window's texts (en, zh, zh-TW, ja, de), the CLI's warning and
the docs name codexbar; reference.md says a backup carries no sign-in and
that importing the old computer's file is how accounts move.
Run:
- TestImportCodexbarConfig, fixture in codexbar's encoder output (pretty,
sorted keys, ISO dates; two Team seats, a duplicate remote account, an
access-only account, a DeepSeek api_key provider): fails on the old code
("got #1:failed"), passes on the new; seats kept apart by
openAIAccountId with an id token that doesn't name the workspace.
- Built nogui binary, sandbox HOME: `magpie accounts import codex
config.json --yes` lists the three accounts, ChatGPT refusing the fake
tokens; no real codexbar install here to try with real accounts.
- login-import.test.cjs (chromium, webkit; en, zh) and i18n-keys.test.cjs
pass.
- go test -tags nogui ./... (temp HOME, pinned caches): all ok.
- go vet (darwin, GOOS=linux, GOOS=windows) on . and internal/provider;
gofmt -l clean.
|
||
|
|
494dedcf8f |
desktopdir: Claude Desktop installed from the Microsoft Store (package AnthropicPBC.Claude_*) has its folders found, as the setup.exe's Claude_* package's are
Desktop 2.31226.1's own code knows two MSIX package families, Claude_pzs8sxrjxfjjc and AnthropicPBC.Claude_fnn82j28hfe8t (hze/_ze in index.chunk-Cyt2WTko.js). packageDir only globbed Packages\Claude_*, so a Store install's LocalCache was never found: magpie wrote Claude Desktop's gateway, MCP servers and read its sessions and skills in the unpackaged folders instead. Checked while following up v0.1.1156: the same bundle has a %LOCALAPPDATA%\Claude-Data folder for 1p userData, but in 2.31226.1 it is dormant. globalThis.userDataMoved is only read, never set, and the Claude-Data dir is chosen only when %APPDATA% is a network share, while relocateUncUserData does nothing in index.pre.js. So 1p userData is still %APPDATA%\Claude (or the package's copy), and desktopdir is left as it is for that. Run: go test ./internal/desktopdir ./internal/library ./internal/agent (macOS); TestFindMSIX fails on the old packageDir for the Store family; desktopdir's Windows test binary passes on the Windows box; go vet for linux, windows and darwin. |
||
|
|
e04824714d |
library: a skill's templates and other big files go with a backup and a sync (Crispin)
Crispin on Discord (#help): a skill's template files, a PPT among them,
didn't reach the other computer. Collect read each skill file with a 2 MB
cap and left everything bigger out, so a .pptx template with its pictures
never travelled. Links, copies and WSL copies on one computer already carry
every file (copyDir and hashFiles have no filter); only the backup/sync
carry dropped them.
- A file goes up to 16 MiB, all skills together up to 32 MiB. A sealed
backup is JSON with the bytes base64'd twice (~x16/9), and a sync reads
at most 64 MiB of one, so 32 MiB raw is what still fits.
- readSkills fills that budget smallest file first across every skill, so
one skill's big file never keeps another skill's SKILL.md from coming.
- What is left out (Left) and the computer being put to already has is
kept (keepLeft): a Put no longer sets the folder aside without it. A Left
name is checked like a carried one.
Run:
- New tests fail on the old code: TestCarryTemplates (template left),
TestCarrySmallFirst (zzz's notes.md left), TestCarryKeepsWhatWasLeft
(the local file went), TestSkillTemplatesTravel (0 bytes of 6291456).
Pass on the new. TestSkillTemplateReachesEveryAgent covers link, copy
and WSL copies of a pptx.
- Break check: maxCarriedAll = 48 MiB makes TestSkillTemplatesTravel fail
("the backup is 64 MiB, more than a sync reads").
- Real use: built nogui binary, sandbox HOMEs, a real 2.8 MB and a real
14 MB .pptx in a library skill, `magpie backup` then `restore
--no-agents` on another HOME: sha256 identical both times.
- go test -tags nogui ./... (temp HOME, pinned caches): all ok.
- go vet (darwin, GOOS=linux, GOOS=windows) on internal/library and
internal/backup; gofmt -l clean.
|
||
|
|
8424a004e2 |
gateway: a reply whose reasoning loops before it says anything is asked again once in place, not ended (cdredfox on X)
cdredfox (X, 2108799237324701897): WorkBuddy AI's DeepSeek v4 flash through
magpie often stops half way with "magpie ended this reply: the model's
reasoning was stuck in a loop ... ("OK." "Writing." "Now." "Producing."
"Let me output." ...)". That is the #1359 loop, found correctly; nothing
magpie sends causes it (12 direct runs on the real account, effort
high/max, temperature 0/1/unset, a 900-line file: no loop, the same
"OK. Writing." precursors at the tails), so the model does it on its own
now and then, and the agent's turn ended on it.
When magpie translates the reply into the agent's protocol
(streamTranslated: Claude Code, Codex, Gemini clients) and the loop is in
the reasoning, before any text or call and not on a continuation, the
try is let go and the same request asked again once (loopReasks), the
way an empty reply is (#667): the agent keeps the reasoning it has, the
next try's follows in the same stream. A loop on that try ends the reply
with the error as before. holdWriter.onLoop lets streamTranslated take a
trip before cutLoop ends the stream. A text loop, a loop after a text or
call, and a Chat stream passed through stay ended at once.
Run: go test ./internal/gateway (ok); -race on the loop and empty-reply
tests -count=3 (ok); gofmt; GOOS=linux,windows go vet. On old code
TestReasoningLoopIsAskedAgain and the updated
TestLoopEndsTheReplyOnEveryProtocol/TestLoopEndsWorkBuddysReply fail
(the vendor is asked once). Real account: a sandbox gateway in front of
a proxy signing for WorkBuddy AI (deepseek-v4.1-flash); the proxy
injected the reporter's units into the first real stream, the guard let
it go after 257 lines, the second real request answered, and the agent
got one whole message (Anthropic: message_stop, no error; Responses:
response.completed).
|
||
|
|
3ee97def30 |
claude: a server or container without Claude Code can have magpie download Anthropic's own build, asked first and checked against its manifest (Jorben)
A Claude subscription signs in and answers through the local `claude`, so
on a server or in the Docker image, which has none, it couldn't be used
(Jorben on Discord: could it be downloaded on first use, as Bun is).
- internal/claudecode: Anthropic's native build, as claude.ai/install.sh
takes it: downloads.claude.ai/claude-code-releases/latest names the
version, its manifest.json the platform's SHA-256 and size (linux
glibc/musl, darwin, win32). A build that doesn't match both is not kept.
It goes to <cache>/claude-code/<version>/claude, one version kept. Find
takes the machine's own claude first, then the download.
- magpie claude-code [install [--yes]|remove]: says the version, platform,
size, the URL it comes from, where it goes, that its checksum is checked
and that it is Anthropic's software under Anthropic's terms, then asks
[y/N]. magpie accounts add claude offers it when there is no Claude Code
(not on Windows, where one in WSL may be the one).
- the gateway's claudeBinary and the sign-in's claudeExecutable take
claudecode.Find; their "not installed" errors name the command.
- Docker docs (en, zh, ja): Claude sign-in needs `docker exec -it magpie
magpie claude-code install` first; kept in /config/cache.
The Dockerfile is unchanged: distroless cc-debian12 has glibc.
Run:
- go test -tags nogui ./... under a temp HOME with pinned caches: all ok
- gofmt -l: none; go vet (darwin), GOOS=linux and GOOS=windows go vet
-tags nogui ./...: clean; darwin, linux, windows builds
- TestClaudeSubscriptionRunsTheDownloadedClaudeCode fails on the old
proc.FindTool lookup ("Claude Code is not installed"); taking the
checksum compare out fails TestInstallRefusesABuildTheManifestDoesntName
- real: magpie claude-code install --yes downloaded Claude Code 2.1.296
darwin-arm64 (230 MB) into a sandbox HOME, checked; it ran --version
- real, in gcr.io/distroless/cc-debian12:nonroot with the image's /config
layout: install downloaded 2.1.296 linux-arm64 (245 MB) to
/config/cache/magpie/claude-code, it ran `2.1.296 (Claude Code)` there,
and magpie accounts add claude went on to print the claude.ai sign-in
link and ask for the pasted address
- the claudecode tests built for linux/arm64 pass in debian:12-slim
|
||
|
|
c431225a08 |
gateway: a browser that reaches loopback under a web site's name (DNS rebinding) is refused unless it sends an enabled gateway key
What changed
- lanGuard refuses (403) a loopback request that carries a browser's
marks (Origin, Sec-Fetch-Site/Mode, a Mozilla/ user agent) when its Host
isn't this computer's: an IP, localhost, *.localhost, a container
runtime's name for the host (host.docker.internal and kin),
MAGPIE_PUBLIC_URL's or MAGPIE_ADDR's host, or the machine's own name.
An enabled gateway key still lets it in.
- Why: a page whose DNS answers 127.0.0.1 after it loads is same-origin
with the gateway. Its GET sends no Origin and its POST one equal to the
Host, so corsGuard's foreignPage let it by, and on loopback no key is
asked. The nightly security review reproduced it on origin/main: Host
and Origin rebind.attacker.example:3425 from 127.0.0.1 got 200 on
GET /v1/models, POST /v1/chat/completions (spends subscriptions) and
GET /v1/magpie/quotas (account names, balances). The subsystem doc
listed it as a known gap.
- Agents send none of a browser's marks and pass under any name; browsers
and webviews calling localhost or an IP are unchanged.
- Tests: TestCORSKeyThroughTheServer and the Omarchy test now set a real
Host (httptest's default is example.com). TestForeignPagesRefused's
"own origin behind a port-443 name" row from loopback with no forwarding
header now sends a key: without one it is the rebound page.
- docs/subsystems/gateway-routing.md describes the check in place of the gap.
Ran
- TestReboundPageRefused: fails on origin/main ("a rebound page's GET:
200"), passes with the change.
- go test -count=1 ./internal/gateway/ ./internal/gui/ ./internal/access/
(macOS, go1.27): ok. gofmt -l clean; GOOS=linux and GOOS=windows go vet
./internal/gateway/ clean.
Not tried: a real browser against a real rebinding DNS name.
|
||
|
|
ea84c99c78 |
gateway: a DeepSeek model's tool call the client kept no thinking for goes with reasoning_content, so DeepSeek no longer turns the request away (#1462, Clear8Heart)
DeepSeek's Chat API in thinking mode refuses a whole request with 400 "The `reasoning_content` in the thinking mode must be passed back to the API" when an assistant tool-call message since the user's last message comes back without reasoning_content. OpenCode (and any client that continues a turn another model made, or that dropped the thinking) sends such turns, and magpie relayed them as they came. What changed: - chatReplaysReasoning(host, model) names the Chat upstreams that want reasoning back: a DeepSeek host, a model named deepseek wherever it is served (OpenCode Go's deepseek-v4.1-flash, OpenRouter), and Command Code's plugin. buildChat uses it as before. - Passthrough (gateway.go, provider.Chat): for such an upstream, not Mistral (#494), withReasoningOnToolTurns gives every assistant tool-call message without reasoning_content one: its thinking from another field (reasoning, OpenRouter's) when it has some, else " ". The gate takes the member's model, so a group reaching a DeepSeek member is covered. - Translated (buildChat, Responses/Anthropic -> Chat): a tool-call turn with no thinking gets " " too. - Every tool turn, not only the last: DeepSeek also refuses an earlier tool turn of the current user turn missing it. - " ", not "": DeepSeek's Chat takes "", but relays that omit empty fields drop it, and DeepSeek's Responses API refuses an empty reasoning_text. A vendor that refuses the field still gets the #494 retry without it. Checked against api.deepseek.com (owner's key, deepseek-flash, Chat): last tool turn missing -> 400; "" -> 200; " " -> 200; real -> 200; an earlier tool turn of the current user turn missing -> 400; a tool turn before the latest user message missing -> 200; answers missing -> 200. Not changed, found on the way: DeepSeek's Responses API refuses a function_call with no reasoning item (and empty reasoning_text), and its Anthropic API a tool_use with no thinking block; magpie relays those natively as they come. OpenCode Go's deepseek-v4.1-flash could not be tried for real: the owner's workspace answers "requires Global regions". Run: - New tests fail on the old code (TestChatToolTurnWithoutReasoningRelayed: 400 "reasoning_content ... must be passed back"; TestTranslatedToolTurn WithoutReasoning: 400), pass now; TestChatToolTurnWithoutReasoning NotForMistral and the Mistral/MessageReasoning tests pass. - gofmt -l clean; go vet -tags nogui ./internal/gateway on darwin, GOOS=linux, GOOS=windows. - go test -tags nogui -count=1 ./... under a temp HOME: all ok. - Real use: the built binary's gateway in a sandbox HOME with only the DeepSeek provider. Old: last tool turn missing 400, earlier one missing (stream) 400, plain answer 200. New: all three 200. |
||
|
|
282c9feb23 |
agent: a packaged Claude Desktop gets magpie's gateway in the real %LOCALAPPDATA%\Claude-3p too, which 2.31226 reads, not only the package's (bg5eau on X)
bg5eau on X: Claude Desktop 2.31226.1, installed as an MSIX package on
Windows, never reached magpie. magpie wrote deploymentMode and its
configLibrary profile only into the package's
LocalCache\Local\Claude-3p, and that build reads the real
%LOCALAPPDATA%\Claude-3p. Copying configLibrary there and setting
deploymentMode 3p fixed it for them.
What the build does: 2.31226.1's asar (index.chunk-Cyt2WTko.js) resolves
the 3p userData with Ou() = path.join(LOCALAPPDATA, "Claude-3p"). 2.7032.0
has the same code (GY()). It reads deploymentMode from
Ou()/claude_desktop_config.json and the gateway from Ou()/configLibrary.
The path didn't change; the package stopped redirecting it into
LocalCache. An install's folders don't say which build it is, so:
- desktopdir.Sets returns every set of folders: Find's choice first, then
the other one for an MSIX install. Everywhere lists every set's folders.
- Claude Desktop's switch writes and removes deploymentMode, the profile
and _meta.json in each set. The package's set keeps its own stash keys
(".package"). A stash that an older magpie wrote for the package's
folders moves onto those keys, so turning it off still restores them.
- The check runs on each set, names the folder when there are two, and
checks Claude-3p's deploymentMode as well.
- The siblings: the library's MCP servers go into every Claude-3p file
that exists, and Cowork skills and Desktop sessions are read from every
set.
Run:
- go test ./internal/{desktopdir,agent,library,sessions,usage}: green.
- The new tests (TestClaudeDesktopMSIX, TestClaudeDesktopMSIXStashBefore,
TestClaudeDesktopMSIXBoth3p) and TestCallsCoworkMSIX are red against
the old code. StashBefore also goes red with desktopAdoptStash disabled.
- gofmt; go vet for darwin, linux and windows.
- On the Windows box, Windows test binaries for the four packages:
- desktopdir and library pass.
- agent and sessions fail exactly the set that main's binaries fail
there (#1388, and newly filed #1468).
- Every Desktop test passes.
|
||
|
|
c98160c045 |
gateway: a group's rule can pause one of its models at set hours, days or agents, leaving it out of the group then, not first, not a fallback, not kept by affinity (John on Discord)
John asked for a pause in a group's Rules, e.g. a model paused in its vendor's peak hours. A time rule could only send those turns to another member first: the paused-for model stayed behind it for failover, went first when the other was unready, and was kept by affinity mid-turn. What changed: - provider: Rule.Pause (`"pause": true`, typed `pause=<model>`). It holds by time/days and agents only; cleanRules and ParseRule refuse any other condition, and refuse a pause with none. Pause rules are not send-to rules: MatchesBesidesIntent, ruledEntry and Ruled() leave them out. PausedOut(g, ms, agent, at) drops members a pause holds for, from the group's own rules and each nested group's (a group named = all its models; a model named = wherever a nested group has it, #625). - gateway: serve and embeddings run PausedOut on ruleClock before planning, on every request. Every member paused -> 503 naming each rule (pausedError). The trace's GroupRef carries Paused. - GUI: the rule editor's "send to" is now an app-menu action button (send to / pause); a pause hides the request conditions (clearing them), keeps hours, days and agents, and isn't saved without one. The group card's rule reads "→ pause <model>", and the Routing trace says which model was paused by which rule. Strings in zh, zh-TW, ja, de. - CLI/TUI: `magpie group rule add <g> pause=<model> time=… days=…`. - docs: gateway-routing.md step 2; start.html en/zh/ja "Hours and days". Run: - gofmt -l clean; go vet -tags nogui ./...; GOOS=linux and GOOS=windows go vet -tags nogui on gateway, provider, tui, root; go build ./... - go test -tags nogui ./... under a temp HOME with pinned caches: all ok. - rules_pause_test.go (3 tests) fails with the PausedOut call in serve removed (the paused model answers mid-turn, as a fallback, and the all-paused case returns 200). grouprule_pause_test.go covers clean, parse/Line, Ruled, Pauses and nested PausedOut. - GUI: routing-pause.test.cjs in Chromium and WebKit, en/zh at 1100px and en/zh/zh-TW/ja/de at 420px: 14/14; all 7 Chromium cases fail on the old routing.js. routing-*, group-*, i18n-keys, gui-ja, gui-de, click-scroll: 618 pass, 4 fail under --test-concurrency=4 (routing-blocked, -idle-frame, -side-calls, -wb-refused), all of which pass run alone; routing-side-calls failed 1 of 6 alone and passes with the old routing.js too, so it is a load flake not touched here. |
||
|
|
34f2078db8 |
site: a partner's website and key links go through usemagpie.ai/go, which counts the click; fetches of the partner list are counted too
The app's own partner counts only come from users who leave the stats on, so a sponsor's reach and clicks are now also counted where the server sees them. /api/partners hands out each partner's website and keysUrl (and a region's) as usemagpie.ai/go/<id>/site|keys[/<region>]; /go sends a "magpie partner go" event to PostHog (partner, link, region, country) and 302s to partners.js's own URL. One in ten list fetches sends "magpie partners fetch" with weight 10 while someone is listed. Events carry a random id each, no install id or address. Ended entries leave the list but /go still resolves them, since added providers keep the links. Privacy text updated in README (en, zh), docs/reference.md and the site docs (en, zh, ja). Run: node --test site/*.test.mjs (27 pass); a scratch copy with a fake partner served rewritten links, 302'd /go to the real URLs and posted both events; PostHog's /i/v0/e/ answered 200 to the payload shape. |
||
|
|
61e296688e |
gateway: Codex's model list keeps codex-auto-review when the user picked models on the ChatGPT account, so auto-review runs on it again, not on the conversation's model at low (#1460)
10086gg reported that Codex's auto-review through magpie almost never used codex-auto-review. It ran on the conversation's own model at low effort, which costs more. Cause: codexModels narrows the ChatGPT backend's list to the models the user picked on the codex provider (CodexNativePicked). Hidden entries (visibility "hide") never reach magpie's catalog (parseCodexModels), so no one can pick them, and the narrowing always dropped them. codex-auto-review is one of those hidden entries. Codex 0.162 picks the reviewer this way (codex-rs/ext/guardian-reviewer/src/model.rs, select_review_model): 1. the entry's auto_review_model_override; 2. else codex-auto-review, if the list has it; 3. else the conversation's model, at low effort. So once the list was narrowed, every review fell to step 3. On a relay model it was charged to the relay; on a ChatGPT model it ran on that model. OpenCodex had the same bug: lidge-jun/opencodex#6712 recorded direct ChatGPT login as codex-auto-review/low and their proxy as Sol/low. Fix: the narrowing keeps hidden entries. No picker shows them, so the user's picks still decide what Codex's /model lists. A user who wants reviews on a relay model can still set Codex's auto-review model (#938), and that setting still wins (step 1). Which account pays changes for a user with picks whose conversation runs on a relay model: auto-review moves from the relay to the ChatGPT account's codex-auto-review. That is what Codex does without magpie. OpenAI's help article "Using Codex with your ChatGPT plan" says: "When you're signed in with a ChatGPT account, auto-review safety checks are free and don't count toward your plan's usage limits." New test TestCodexModelListPicksKeepHidden. It fails on the old code: after the picks only gpt-6-sol is listed, with no codex-auto-review. docs/subsystems/gateway-routing.md says this. Run: - gofmt -l internal/gateway - go vet -tags nogui ./internal/gateway, on darwin, linux and windows - go test -tags nogui ./... with a temp HOME and pinned caches: green Not run: a real Codex signed in to ChatGPT through the gateway. The reviewer choice was read from the Codex source. |
||
|
|
259c71078c |
docs: gateway routing says reasoning state goes through same-protocol translation as the vendor wrote it (#1445, XYenon)
What changed: gateway-routing.md gains the #1445 contract (sealed parts, the new IR events, each vendor's case, no cross-API envelope) and no longer says a translated Responses reply never carries sealed reasoning. Run: read against the code in the three commits before this one. |
||
|
|
793af76242 |
gui: Codex's subagents setting, unset, says the lead picks the model and only falls back to the main model, not just "same as model" (willz on Discord)
willz set Codex's "subagents" to 同主模型 (same as model), and a subagent
still ran on another model. Codex 0.162 lets the spawn_agent call's own
`model` argument win over `[agents] default_subagent_model`
(core/src/agent/child_config.rs:
requested_model.or(agent_default_subagent_model)). The default only
applies to a spawn that names no model, and the spawn_agent tool lists
up to 5 models the lead may name. So "same as model" was false whenever
the lead named a model.
This was reproduced with the real codex-cli 0.162.0 in a sandbox
HOME/CODEX_HOME, against a fake Responses server on port 3683 that logs
each request's model and x-openai-subagent header. The lead ran on
gpt-6.1-sol in every case:
a. lead names astra, default unset -> subagent on gpt-6-astra
b. lead names none, default unset -> subagent on gpt-6.1-sol
c. lead names astra, default sol -> subagent on gpt-6-astra
d. lead names none, default astra -> subagent on gpt-6-astra
magpie already holds every subagent to one model with the "subagent
model" setting (the gateway's codexSubagentPick,
|
||
|
|
9bb2a467e4 |
agent: Snow CLI is an agent magpie sets up: a magpie profile in ~/.snow, made the active one, that Snow App takes in with "Sync Snow CLI API config" (#1457)
Snow CLI (npm snow-ai, MIT, MayDay-wpf/snow-cli) keeps one profile per file under ~/.snow/profiles (or $SNOW_CONFIG_DIR), names the active one in active-profile.json, and copies it over config.json at every start, headless `snow --ask` included. Each profile is the whole snowcfg: base URL, key, request method and models. Snow App (MayDay-wpf/snow-app) reads ~/.snow/profiles/*.json when "Sync Snow CLI API config" is pressed. magpie writes profiles/magpie.json from the profile the user was on (their settings kept, Snow's OAuth sign-in left out): baseUrlMode base at the gateway's /v1, requestMethod chat, the agent's key, the model as advancedModel and basicModel, and the catalog's window and output (200000 and 64000 when not known, the output cut to the window). It makes that profile active and copies it to config.json. The profile the user was on, whether there was an active-profile.json at all, and a magpie.json of their own are stashed; Disconnect, `magpie snow default`, or picking a model of one of the user's profiles puts those back. A Snow from before profiles (config.json alone) gets the default.json Snow itself would make, so its next start doesn't take magpie's config for the user's. Check reports a base URL, key or request method moved off magpie's; Sync rewrites the profile on a port move. A WSL distro's ~/.snow is found and written the same way. Registered: agents.go, the WSL kinds, SNOW_CONFIG_DIR in agentenv, the npm update spec (snow-ai), the icon (Snow App's own, trimmed to 96px), README, docs/reference.md, docs/subsystems/agent-wiring.md, the site's agent list and start.html (en, zh, ja). Run: - go test -tags nogui ./... in a scratch HOME: 44 packages ok. New: TestSnow, TestSnowOwnProfile, TestSnowNoProfiles, TestSnowUsersMagpieProfile, TestSnowCheckSync, TestAgentSnowDefault; snow added to TestOwnProviderNamedAsMagpies, the WSL more-agents tests and TestMaxTokensWithinContextWindow. All fail before this commit (no agent "snow"). - go vet -tags nogui for darwin, linux and windows; gofmt -l clean. - Real Snow CLI 0.9.2 in a sandbox HOME against a sandbox magpie (`magpie serve` on 127.0.0.1:3571, a fake OpenAI upstream on 3561): `magpie snow fake/pro` made the magpie profile active, `snow --ask` answered through the gateway (POST /v1/chat/completions, model pro, logged as agent snow), and `magpie snow default` left profiles, active-profile.json and config.json byte-identical to before. - GUI: agent-layout, agent-connect, agent-models-picker, agent-field-names and models-add-and-icons in Chromium and WebKit; a Snow CLI row checked at 520-960px in en, zh, zh-TW, ja and de in both engines. No new GUI strings. |
||
|
|
d7a1b02032 |
redact: more kinds of personal data, each with its own switch: SSNs, passports, IBANs, birthdays, MAC addresses and serial numbers on by default; home-folder names, user@host, public IPs and cloud buckets off (lc on Discord)
lc asked in #feedback (message 1558300896142696549) for magpie's masking to cover more of what identifies a person or a machine. Under Settings > Privacy > Mask personal data, each kind now has its own Off/On (settings.redactKinds, redact.Options.Kinds). What each one masks: - US SSNs: dashed numbers, except ones never issued (000, 666 and 9xx areas) and well-known examples. Undashed ones only next to "SSN" or "social security". - Passport numbers, next to passport, Reisepass, 护照 or パスポート. - IBANs: compact or in groups of four, with the country's length and the mod-97 check. - Birthdays: a date only next to birthday, DOB, born, 生日 and the like. A date on its own stays. - MAC addresses, but not documentation examples or all-decimal groups. - Serial numbers, next to S/N, serial or 序列号. - The user name in /Users/x, /home/x and C:\Users\x. The name is masked and the path is kept. - User and host in a shell prompt or an ssh/scp/rsync target (user@host goes out as two placeholders, not as an email address), and on hostname/user lines whose value ends the line. Code such as `hostname = socket.gethostname()` is left alone. - Public IPv4 and IPv6 addresses. Private, loopback, link-local, CGNAT, documentation, multicast and well-known resolver addresses stay, and so do version numbers. - Cloud bucket names in s3://, gs://, oss://, cos://, abfss:// and storage URLs. The object path is kept. The last four are off by default. Agents send their working folder, the prompt and log lines in nearly every request, and the model then has to copy the placeholder exactly inside a path or URL. The first six are rare and sensitive, so they are on. Each placeholder is restored in replies, in streamed text and in tool-call JSON. Context rules run only in a window around their words (rule.matches), so masking with the defaults on 400KB of app.js takes 136ms (112ms before; 222ms with every kind on). Tests, run at this head: - gofmt -l is clean. go vet passes on darwin, GOOS=linux and GOOS=windows (-tags nogui) for internal/redact, gateway, gui and settings. - go test -tags nogui ./... under a temp HOME with pinned caches passed everywhere except internal/proc's TestNoCommandBypassesProc. That failure came from |
||
|
|
9db2ed3dc6 |
gateway: temperature, top_p and top_k are left out for the Claudes that refuse them, so Haiku 5.5 no longer answers auto mode's classifier "temperature is deprecated for this model" (#1454)
Claude Code's auto mode classifier asks at temperature 0, and magpie's
own classifiers do too. Through the aihubmix relay, claude-haiku-5-5
answered 400 "`temperature` is deprecated for this model." (and the same
for `top_p` and `top_k`). magpie relayed sampling parameters as they
came, and built them from a chat request's temperature or top_p.
samplingAsTaken, beside thinkingOffAsTaken in forwardOnce, so relayed and
built requests and retries all go through it, leaves the three out for
the models Anthropic documents as refusing them:
- Opus 4.7, 4.8, 5 and 5.5, Fable 5 and Mythos 5 refuse them at any
value.
- Sonnet 5 and 5.5 refuse anything but the default.
- Haiku 5.5 takes only temperature 1 and top_p 0.99, never both, and no
top_k.
Left out, each model samples at its default. The model is read as the
vendor names it, from the body or, for Bedrock and Vertex, the path.
Older Claudes (Haiku 4.5, Sonnet 4.6, Opus 4.6 and before), other
vendors' models and later lines go byte for byte as they came. A Claude
under a name these rules can't read, answering that a sampling parameter
is deprecated or not supported (samplingDeprecated), is asked again
without them, once.
aihubmix itself took every value for the other models and refused it
only on Haiku 5.5. The other models are left out by the docs' rule, for
direct keys and relays that pass the vendor's 400 on.
Verified:
- Tests:
- TestSamplingAsTheModelTakesIt covers each refusing model's
spellings, a Bedrock path, and byte-identical bodies for Haiku 4.5,
Sonnet 4.6/4.5, Opus 4.6/4.1, Claude 3.7, Sonnet/Haiku 6, deepseek,
glm, kimi and gpt.
- TestHaikuFiveFiveSamplingOnTheWire uses a fake vendor answering
with the relay's literal 400s. It covers the classifier relayed,
top_p/top_k, magpie's own classifier built from chat, Haiku 4.5
keeping temperature 0, and an unreadable name retried once.
- Without the forwardOnce call, three wire cases FAIL. Without the
retry, the unreadable-name case FAILs.
- Live, through this build's `magpie serve` under a sandbox HOME with
the aihubmix key, in the classifier's shape (temperature 0, stop
</block>, thinking disabled), all 200:
- claude-haiku-5-5 at default and max effort and with thinking
omitted;
- claude-haiku-4-5, claude-sonnet-5-5, claude-opus-5-5 and
claude-sonnet-5;
- chat to claude-haiku-5-5 at temperature 0 and at top_p 0.5.
Straight to aihubmix, Haiku 5.5 at temperature 0, top_p 0.5 or
top_k 5 gives the 400.
- gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gateway, and go test -tags nogui ./internal/gateway under a
temp HOME with pinned caches.
|
||
|
|
a9cb0ef988 |
gateway: Claude Sonnet 5.5 is sent thinking between_tools in place of disabled, and Opus 5.5, Fable and Mythos no thinking, so Claude Code's auto mode classifier no longer gets a 400 (#1454)
911Liam's auto mode, on claude-sonnet-5.5 through a relay, got 400 "To
turn thinking off on this model, send "thinking": {"type":
"between_tools"} instead of {"type": "disabled"}". Claude Code turns
thinking off for its classifier and side queries unless it knows the
model refuses that, and a model reached through a gateway can fall
outside what it knows. magpie forwarded the disabled as it came, and
turns thinking off itself too (an effort of none fitted, a budget that
doesn't fit, thinkingOffUnlessAsked for other vendors' models).
thinkingOffAsTaken, in forwardOnce next to adaptiveThinking, so that
relayed requests, count_tokens, magpie's own thinking-off and retries
all go through it, follows Anthropic's rules for each model. It reads
the model's name as the vendor gives it, from the body, or from the path
for Bedrock and Vertex.
- Sonnet 5.5: between_tools with no other field, and xhigh or max asked
as high (between_tools is a 400 above high).
- Opus 5.5, Fable 5.x and Mythos 5.x refuse disabled at every effort.
Thinking is left out, effort is low unless one was asked, and
classifierRoom is added to a reply limit below it, as Claude Code
itself does for these models.
- Opus 5 and Haiku 5.5: disabled is kept, with xhigh or max asked as
high.
- between_tools sent to any other Claude goes as disabled, or with no
thinking where disabled is refused too.
Other vendors' models, Sonnet 5, Opus 4.8 and older, and lines later than
these go byte for byte as they came. A Sonnet 5.5 under a name these
rules can't read is asked again with between_tools, once, on the 400
that asks for it (asksBetweenTools). A refusal of disabled at any effort
(thinkingOffRefused) is asked again with thinking left to the model,
beside alwaysThinks.
TestAdaptiveOnlyModelsNeverGetABudget's "disabled stays" case pinned
disabled for claude-opus-5.5, which the vendor refuses. It now checks an
older Claude keeps disabled and Opus 5.5 is sent none.
Verified:
- Tests:
- TestThinkingOffAsTheModelTakesIt and
TestThinkingOffLeavesOtherModelsAlone (deepseek, glm-5.3, kimi,
Sonnet 5, Opus 5 at high, Haiku 5.5, Opus 4.8 at max, Sonnet 4.6,
Haiku 4.5, Claude 3.7, dated Sonnet 5 and Sonnet 6 unchanged).
- TestClaudeFiveFiveThinkingOffOnTheWire: a fake vendor answers with
the reporter's literal 400, covering the classifier body,
count_tokens and the retry.
- Without the forwardOnce call, the wire test's Sonnet 5.5, Opus 5.5 and
count_tokens cases and the Opus 5.5 adaptive case FAIL. Without the
retry, its unreadable-name case FAILs.
- Live, through this build's `magpie serve` under a sandbox HOME with
the aihubmix relay key, in the classifier's shape (max_tokens 64,
temperature 0, stop </block>, thinking disabled):
- claude-sonnet-5-5 answers 200 at default and xhigh effort (sent
straight to aihubmix with disabled it gives the reporter's 400);
- count_tokens 200;
- claude-opus-5-5 200;
- claude-haiku-5-5 at max 200;
- claude-sonnet-5 200.
- gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gateway, and go test -tags nogui ./internal/gateway under a
temp HOME with pinned caches.
|
||
|
|
f2611b7154 |
accounts: import ChatGPT accounts from Cockpit Tools' and Sub2API's exports, several files at once, from the window or magpie accounts import; the box says the source tool is signed out (#1453)
wlj521 asked for cockpit-tools' import: several auth.json files at once.
magpie's window already imported Codex's auth.json and CLIProxyAPI's
files; this brings it the rest of what Cockpit Tools exports and a command
for it.
What changed:
- login_import.go reads Sub2API's export ({accounts: [{platform, type,
credentials}]}), so every Cockpit Tools export format comes in (its own,
auth.json, CPA, Sub2API). An API key, another vendor's account and an
entry with only an access token (a web session: it can't be renewed and
would stop within days) are refused with the reason.
- ImportLogins and ImportGoogleAccounts no longer skip one file of several
that holds no account: it is a failed row with its place
(ImportedAccount.File), which the window and the command name by file.
- `magpie accounts import <codex|claude|antigravity|factory> <file>...
[--yes]`: says first what importing does to the tool the file came
from, imports nothing without a yes, only reads the files, and lists
each account's outcome.
- The window's import box names Cockpit Tools and Sub2API and says
plainly that the source tool is signed out of the account and the file
is only read. Claude's box no longer claims a refresh it doesn't do.
zh, zh-TW, ja and de for every new string; the retired strings removed.
- docs: reference.md and providers-accounts.md describe the import.
Decision: keep the refresh on import. It checks the file and makes magpie
the token's one holder at a moment the user chose. Storing the token
as-is, as Cockpit Tools does, only delays the rotation conflict and makes
which side gets signed out a race.
Run:
- go test -tags nogui ./... under a sandbox HOME (pinned caches)
- TestImportCockpitExports red on the old login_import.go (Sub2API rows
unread, the garbage file passed over); TestAccountsImport red with the
confirmation removed by hand; login-import.test.cjs red on the old app.js
- node --test login-import, factory-key, i18n-keys, gui-ja, gui-de,
gui-zh-tw (Chromium and WebKit; en and zh, results at 380px)
- gofmt -l; go vet, GOOS=linux and GOOS=windows go vet -tags nogui on .
and ./internal/provider; darwin, linux and windows builds
- no live ~/.codex: fixtures and a fake token endpoint only
|
||
|
|
eb035e29e1 |
sessions: a session seen only through the gateway can be deleted: its row and recorded conversation go to magpie's trash, and Restore brings them back (lc on Discord)
lc ("只可列出?不可删除?agent claude code") saw Claude Code sessions named by
uuid under "No folder" at "0 B", with "These Claude Code sessions are read
only; magpie can list them, but cannot resume or delete them." Those rows are
gateway projections from the usage ledger: Claude Code ran with its own files
somewhere magpie can't see (another computer, a container, another config
folder), so nothing native won on the same agent+id. An agent with only such
rows was sent as not deletable, and every row was read_only, so the page had
no Delete at all.
What changed:
- sessions.DeleteGateway moves the session's recorded text folders
(gateway-conversations/<date>/<identity hash>) into
trash/sessions/gateway/<ts>-<hash>/files/<date> with a note marked gateway,
and records {agent, id, last} in gateway-sessions-hidden.json.
/api/sessions and /api/sessions/manage leave it out up to that last
request; a newer request lists it again. The usage ledger is untouched, so
Usage, /api/sessions/one and stats keep what it spent. A session with a
request in the last minute is refused as active.
- Restore moves the text back (skipping what expired or was cleared, refusing
rather than overwriting a same-day re-recording), checks each item is this
session's identity folder inside the store, and unhides it. Delete forever
keeps it hidden.
- The recording's promises hold in the trash: the hourly prune erases
trashed gateway text past 7 days, "Delete saved conversations…" erases it
too, and HasGatewayConversations counts it.
- The manage route marks an agent with gateway rows deletable and sends
those rows deletable, with gateway: true and the size of their recorded
text; the delete route sends gateway ids to DeleteGateway and native ones
to Delete as before.
- Sessions page: gateway rows group under "Seen through the gateway"
instead of "No folder", show "{size} recorded" only when something was
recorded (no "0 B"), and the note says why they can't be resumed and what
Delete takes and keeps. The delete dialog says the same for gateway rows
instead of "Their files are moved…"; the Trash marks them and notes the
7-day expiry. New strings in zh, zh-TW, ja and de.
- docs/subsystems/gateway-sessions.md describes the delete, hidden list,
restore, expiry and clear.
Verified:
- go test -tags nogui ./... (sandbox HOME) green; gofmt -l clean; go vet
./...; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/sessions
./internal/gui; go build, GOOS=linux -tags nogui and GOOS=windows builds.
- TestSessionsDeleteGatewaySession fails on the old code with "Claude Code
with only gateway sessions isn't deletable: [{Agent:claude
Deletable:false}]"; sessions-gateway-delete.test.cjs fails there too.
TestGatewayDeleteTrashExpires, TestGatewayPurgeKeepsItHidden,
TestGatewayDeleteNothingRecorded and TestGatewayRestoreRefusesForeignItems
cover expiry, purge, an unrecorded session and a forged note.
- GUI: sessions-gateway-delete.test.cjs in Chromium and WebKit, en, zh,
zh-TW, ja, de, at 1000 and 390px (in-app dialog, Cancel sends nothing,
click doesn't scroll, no left-border accents, no page overflow); all
sessions-*, gateway-conversations, checkbox-look, old-webkit,
sess-agent-strip, i18n-keys, gui-ja, gui-de and gui-zh-tw tests pass.
- Real try: magpie web from this tree on a sandbox HOME seeded with three
gateway-only Claude Code sessions (two recorded): deleted a recorded and an
unrecorded one, checked the store, trash and hidden list on disk, restored
the recorded one (its transcript reads again), purged the other (stays
hidden). That try found the Trash page breaking on an unrecorded session's
null items; DeleteGateway now writes [] (TestGatewayDeleteNothingRecorded
fails without it) and the page reads a missing list as empty.
|
||
|
|
83c963c466 |
gateway: a gateway MAGPIE_ADDR puts on the network asks callers from other machines, a container's host among them, for an enabled gateway key, as sharing does
What changed - lanGuard: a request whose peer isn't loopback (or that carries a forwarding header) is remote. While the gateway is shared, or MAGPIE_ADDR names a host other than loopback/localhost (OnNetwork: 0.0.0.0 in the Docker image, a server's address), a remote request is answered only with an enabled gateway key, on every route behind the guard; otherwise it is refused (403) as before. Before, a MAGPIE_ADDR on the network with sharing off took remote requests with any key. A remote request let in with a key is marked as shared-mode ones are, so quotas, quota cards, refresh and prices answer it. callerGuard follows the same condition. OpenToAnyone is replaced by OnNetwork. - Loopback is unchanged: any key still works on the gateway's own machine and inside the container (HEALTHCHECK included). - CLI keyNote and the console's Connect note no longer describe an open gateway; on the network they say other machines need a gateway key (`magpie gateway-key add <name>`). The console shows the Gateway keys block and network addresses when OnNetwork (gatewayJSON.onNetwork replaces open); the "Open to the network" strings are removed. - Docs: docker.html (en/zh/ja) and remote.html (en/zh/ja) say callers outside the container need a gateway key, how to make one, that sharing isn't needed for it, and what an upgrade means for agents that sent `magpie`; docs/reference.md and providers-accounts.md likewise. A MAGPIE_ADDR pinned to one interface's address now asks a key of this computer's agents calling that address too (documented). Tests - New TestNetworkGatewayGuardsEveryRoute: from 172.17.0.1 and 192.168.1.9 every registered route (model APIs, count_tokens, systemone, the Responses websocket GET, MCP, Codex backend and catalog, /v1/magpie/*, images, embeddings, rerank, videos, Gemini) gets 401 without a valid key; with one, models and quotas answer 200. - TestNetworkGatewayNeedsAKey (was TestExplicitOpenGatewayAccepts...), TestLANGuard, TestProxiedLoopbackNeedsTheKey, TestQuotasOverLAN, TestMCPProxyStaysHere, session route and remote prices tests, TestOnNetwork, serve_cli and gui public_url tests updated. With the old lanGuard restored, TestNetworkGatewayNeedsAKey, TestNetworkGatewayGuardsEveryRoute, TestLANGuard and TestProxiedLoopbackNeedsTheKey fail. Run - go test -tags nogui -count=1 ./internal/gateway ./internal/gui ./internal/provider . under a temp HOME: ok. - gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on those packages: clean. - GUI: public-url and gateway-caller-keys tests, Chromium and WebKit: 22/22. - Locally built image (OrbStack), -p 127.0.0.1:3481:3425: from the host, /v1/models with no key, `magpie` and another made-up key -> 401; count_tokens and /mcp/x -> 401; a key from `docker exec ... magpie gateway-key add Host` -> models 200, quotas 200; inside the container wget /v1/models -> 200; healthcheck exits 0. `web --addr 0.0.0.0:3430`: /api/state 401 without the web key, 200 with its cookie. |
||
|
|
c4476d5658 |
library: skills from GitHub are checked as the skills page opens, and one changed here is marked and asked about before an update replaces it (#1449)
YangZhiqiang98 asked (#1449) that the Library find which skills have updates and update them. magpie already checked skills from GitHub (a market install among them) by hand and could update them, but an update deleted the library's folder, so a skill the user had changed (by hand, through an agent's link, or in an agent's copy not yet taken in) was lost without a word, and nothing checked unless the user pressed Check. - A skill is "changed here" when its library folder no longer hashes to what was fetched (Finder's .DS_Store aside), or an agent's copy was edited since its mark and not yet taken in (editState, skill_changed.go). The view says so (SkillView.edited) and the row shows "Changed here". - UpdateSkill refuses such a skill with *EditedError unless told to replace it. The row's Update asks in the page first (Keep mine / Update; Update sends replace). Update N, the group's Update N and the CLI's update-all leave it as it is and say so. The CLI takes `magpie library skill update <name> --replace-edits`. - The version an update replaces is moved to the backups when it was changed, or when it can't be told (a skill with no hash from before). - View.checkDue: no check since magpie started, or none for 12 hours. The page then runs the check once by itself as the skills open, and says only what there is to update or add. Not checked, by design: skills the skills CLI manages (`npx skills update` updates them; magpie only groups them), linked local folders, skills imported from an agent with no source, and From-only skills have no remote; CC Switch-installed skills can still be updated by hand. Verified: - go test -tags nogui ./... (sandbox HOME); new TestUpdateKeepsASkillChangedHere, TestUpdateKeepsACopyEditedInAnAgent, TestUpdateKeepsWhatItCantTell, TestCheckDue, TestCheckSkillsMarksItDone, all from httptest. With editState forced to "not changed" the first three fail. - gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui on ./internal/library ./internal/gui ./internal/tui . - GUI: new skill-update-edited.test.cjs (Chromium and WebKit, 860 and 400px, en and zh; no scroll on click; fails with the row's ask removed), plus the 22 other library skill tests, gui-ja, gui-de, gui-zh-tw, i18n-keys and click-scroll: 262 pass. - Real use in a sandbox HOME with github.com/anthropics/skills: installed pdf and docx, the real check said both current; an edit through Claude Code's link was refused by `skill update pdf`, skipped by `skill update` (docx updated), replaced by `--replace-edits` with the edit in backups/<time>/library/skills/pdf; docx edited later shows edited, a .DS_Store doesn't. |
||
|
|
62d7cd7be3 |
sessions: recording gateway conversations is a setting card over the list, with what it keeps and where, and a labelled delete that shows only when text is kept (lee on Discord)
What changed:
|
||
|
|
c1c887798b |
provider, docs: a bare model id several providers serve goes by the Providers order, said and tested (MOMO on Discord)
MOMO's {"model":"glm-5.3"} was answered by opencode-go though a6api
serves glm-5.3 too, and they asked for a 409 or for the response to say
which provider was used. The pick was already deterministic, but
Resolve's comment said "exactly one provider" and no doc said what
happens.
Decision: keep serving bare ids, no 409. magpie writes only
provider/model ids into agents' configs (agent/route.go magpieModels),
so a bare id comes from a user's own config, and a 409 would break every
such client the day a second provider adds the model. The rule is now
written down and pinned:
- found groups on (the default): GroupFor takes the bare id to its found
group auto-<slug>, members in the Providers order, smart routing and
fail-over to the next provider; a conversation stays with the member
that answered it while its cache is worth it (affinity).
- found groups off: Resolve takes the first provider in the Providers
order that exposes it, alone.
- every reply already carries X-Magpie-Provider / X-Magpie-Model
(member.go), and the usage log has the provider.
What changed: Resolve's comment; gateway-routing.md model resolution
row; reference.md, the ways a model is named and the headers;
bare_slug_test.go: two providers serving glm-5.3, both modes: the first
in the Providers order answers every new conversation, reordering moves
new ones, an answered one stays in the found group, and a 503 from the
first falls over only in the found group. It passes on the old code
too: it pins behaviour that was already there, now documented.
Run: gofmt -l; go vet -tags nogui on darwin, linux, windows for provider
and gateway; go test -tags nogui ./internal/gateway ./internal/provider
in a sandbox HOME.
|