49f207c7845d372f65dd7909991c2c7cd9a2fb87
1914
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
49f207c784 |
agents: DS Bot, wired in the DSH home it runs on
DS Bot (github.com/Fei2411/DS-Bot, Apache-2.0, dsbot.app) is a DSH plugin and an Electron app built on it. The app ships its own DSH (0.2.2-rc.1 in 0.3.0) and runs it with DSH_HOME at a data folder of its own, booting the profile ds-bot, and never reads ~/.dsh: magpie's dsh row didn't reach it. It is a row of its own now, ds-bot (dsbot.go), wired by dsh's code on its folder (dshOn, split out of dshAt): magpie's routes and start in profiles/ds-bot/cordis.patch.yml, the key in that folder's .env and .credentials.yaml. The folder is $DS_BOT_HOME, else locations.json's dataDir in the app's userData ($DS_BOT_SHELL_DATA, else <config>/DS Bot, or the legacy DeepSeek Bot), else ~/.ds-bot, as the app's first-run.mjs and legacy.mjs choose it. A locations.json that can't be read or names no folder is unknown: nothing is read or written. The routes there list the models shown for DS Bot on the Agents page (dshListFor), and the serving round fills a profile the app makes there as it does ~/.dsh's (dshHomesRounds). Found by DS Bot.app (io.github.fei2411.dsbot) or its Windows per-user install (guid from its electron-builder.yml). Three notices, translated into zh, zh-TW, ja and de. DS_BOT_HOME and DS_BOT_SHELL_DATA are in agentenv's sandbox list. Run: - go test ./internal/agent/ ./internal/agentenv/ ./internal/gui/ ./internal/cli/ ./internal/appdir/ on mote: ok but internal/gui TestMainWindowCorners/macOS_26_SDK, red on mote's macOS 27 whatever the change (#3949). - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... on mote: ok. gofmt -l: clean. - node --test i18n-keys, i18n-en-no-cjk, agent-notice-lang (chromium), and agent-notice-lang in webkit: all pass but i18n-keys "a plugin's words are its own", red on main for three plugin words (#5332, #5426, #5482). - Real DS Bot 0.3.0 (DS-Bot-0.3.0-mac-arm64.zip) on mote, all in a sandbox HOME with DS_BOT_HOME, DS_BOT_SHELL_DATA and DS_BOT_WORKSPACE under it: a magpie built from this tree (nogui), MAGPIE_ADDR 127.0.0.1:3572, a fake OpenAI upstream on 3571 added as a provider. `magpie ds-bot magpie/fake/m1` before the app was ever opened wrote the profile; the app's first start kept it (agent-default-model still magpie's) and added its own files beside it. Its Chief Bot offered "Magpie: m1 · fake, m2 · fake"; picking m1 and sending "ping" over CDP went through magpie to the fake (POST /v1/chat/completions model m1, stream) and "pong from fake" showed. `magpie ds-bot default` then took every magpie entry out and the .env with it. Only my own pids (app, serve, fake) were stopped. Broken by hand, each red, then put back: - dsbot's desktopApps entry out: TestDsBotWired (not detected). - dshListFor always "dsh": TestDsBotOwnModels. - dshHomesRounds without DS Bot's home: TestDsBotProfileMadeWhileServing. - a bad locations.json taken for ~/.ds-bot: TestDsBotDataFolder. On the old code the tests don't build (no ds-bot row at all). Not tried: the Windows app (install path and registry guid read from its electron-builder.yml, not from an installed copy); Linux (its AppImage and deb aren't looked for; the data folder its first start makes finds it); a real vendor behind magpie; a default Bot model set in DS Bot (the notice says it wins, per its models.js). Not done: usage gives DS Bot no User-Agent of its own (its DSH's requests likely count as dsh's), and the Sessions page doesn't read its data folder's sessions. Reported-by: rnhung |
||
|
|
9ed0f1fa49 |
agents: Claude Code's prompt cache lifetime is picked in its settings
Linka (Discord) asked to set Claude Code's prompt cache TTL from magpie. Until now only Usage › Context's "Tuned for you" card wrote it, and that card offers nothing when the value is already the cheapest it found. Claude Code's opened row and settings sheet now have two rows under its own Long conversations: "Prompt cache · main conversation" and "Prompt cache · subagents". Each opens the app menu with Claude Code's default, 5 min and 1 hour. They write the keys the card writes, promptCacheTtl and subagentPromptCacheTtl in Claude Code's settings.json (agent.ClaudeCacheSet, POST /api/settings/claude-cache). Default takes the key out. A pick is the user's own: it forgets the card's stash, so the card's Undo leaves it. A variable that comes before the setting (FORCE_PROMPT_CACHING_5M, CLAUDE_CODE_PROMPT_CACHE_TTL, CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL, in settings.json's env or magpie's own) disables the row and names the variable, and the route refuses it, so a value the user set by hand is never written over. The names were checked in Claude Code 2.1.316's binary. Its resolver checks FORCE_PROMPT_CACHING_5M, then the env var, then the setting (enum "5m"/"1h"), then an agent's experimental.cacheTtl, then ENABLE_PROMPT_CACHING_1H. With nothing set, the main conversation gets 1h on a subscription within its limits and subagents get 5m. Run (mote, at this tree on |
||
|
|
30a0bfe889 |
gateway, provider, cli: search APIs marked mix are asked together, their pages merged (#2845)
A search asked the search APIs in order and gave the model the first one's pages. On #2845's 80-query benchmark no single API was best on both sets. The deduplicated union of two or three APIs' pages scored higher than the best single API and lost no query (60-query set: 108 to 114-117 of 120, sign test p <= 0.03). Off by default. When two or more search APIs are marked mix (SearchAPI.Mix), they are asked first, at once (askSearchAPIsTogether). Each uses its own keys and timeouts, as when it is asked alone (askSearchAPIKeys). Their pages go to the model in turn: each API's first page in the saved order, then each one's second. A page an earlier API already gave is left out by its address (pageKey). One that fails or finds nothing leaves the others' pages. When none finds anything, the APIs not mixed are asked in order. With fewer than two mixed APIs on and ready, a search runs in order as before. No text says which API found a page, so what a vendor sees reads as before. MixSearchAPIs marks the vendors named (two or more, set up, each once) and clears the rest; none clears all. SetSearchAPI keeps the mark, as it keeps off, since Settings sends an edit without it. Backup copies the whole entry, so the mark carries over. CLI: magpie search mix <api>,<api>, magpie search mix off, and magpie search lists a mixed one as mix. docs/subsystems/gateway-routing.md has a section on it. Ported from mdwsk88's 2966cce77 and reviewed line by line. What changed from it: - The cap follows the search's count (#5545, the commit before this): searchMixMost is 2 x the count a search asks for, at most 20 (searchHitsMost). The default stays 12 pages, as in the patch. TestSearchAPIsMixedCapped is a table over count settings and named counts. - The CLI keeps both search count and search mix. - No Settings toggle. The mode stays CLI-only, by the UI-restraint rule; the docs say so. Run (mote-run): - go test -count=1 -run "Search|Mix" ./internal/gateway/: ok; -race -run "TestSearchAPIsMixed|TestMixSearchAPIs": ok. - go test ./internal/provider/ ./internal/backup/: ok; ./internal/cli/ -run "TestSearchCLI|TestEveryRoute": ok. Broken by hand: with apiSearch's mixed branch turned off, TestSearchAPIsMixedAskedTogether fails (only the first API's pages) and TestSearchAPIsMixedCapped fails ("count set 0, named 0: 6 pages, want 12"). Restored, both pass. Not tried: a real search with two vendors' live keys. The tests use fake search APIs. Co-authored-by: mdwsk88 <11055210+mdwsk88@users.noreply.github.com> Reported-by: mdwsk88 (dawei on Discord) |
||
|
|
4e0e8e7933 |
gateway, settings, gui, cli: the results a search is answered with can be set, 1 to 20 (#5545)
Claude Code's WebSearch and Codex's web_search never name a count, so magpie answered every such search with searchHits, 6 pages (#5545, mdwsk88: more pages for research-heavy work, fewer to save context). settings.SearchCount holds the count. 0 means the default, 6 (SearchCountDefault), and the most is 20 (SearchCountMost), the most Brave and Tavily return. Save refuses a value out of range, so nothing is written. Settings.SearchPages reads it. The gateway's searchCount falls back to it when a search names no count. The web_search MCP tool still answers a named count with that count, and its schema's default says the count set. It reaches every search API (Brave, Tavily, Exa, You, the plugins' searchers), as a named count already did. - Settings › Models › Web search: "Results per search", segments 3, 6, 10, 15 and 20, plus a count set by hand in settings.json. POST /api/settings/search-count sets it alone. settingsapi.Apply keeps it as it keeps search-all, so a save of the Settings form doesn't put it back. - CLI: magpie search count says the count; magpie search count <n> sets it; magpie search count default puts 6 back. A bad value is refused and nothing is written. - docs/subsystems/gateway-routing.md says it. - New strings are in zh, zh-TW, ja and de. Run at this tree (mote-run, macOS): - go test -count=1: internal/settings, settingsapi, cli, gateway (TestSearchMCPCount, TestSearchCountReachesEveryAPI, TestSearchCountSetting), and gui (TestSettingsSearchCountSetOnItsOwn, and TestSettingsSaveKeepsWhatItDoesNotSend with SearchCount set): ok. internal/gateway whole: ok with -timeout 45m (847s). internal/gui whole: ok but TestMainWindowCorners/macOS_26_SDK (#3949, mote is on macOS 27). The first cli run was red on TestEveryRouteHasACommandOrIsNamed: the new route had no CLI entry. cliForRoute maps it to search count now. - Broken by hand: searchCount returning searchHits again makes TestSearchCountSetting fail ("set 11: a search naming no count asks for 6, want 11"). Restored, it passes. - GUI: node --test --test-concurrency=4 over routing-*, usage-*, ledger-*, panel-*, call-*, search-*, searcher-*, settings-*, i18n-* and gui-* (Chromium and WebKit; the files cover en, zh, zh-TW, ja and de), with #2398 and #5545 in one tree: 4961 of 5016 ok. The 55 reds are in 12 files. i18n-keys' "a plugin's words are its own" names other files' strings (#5327, #5426, #5482). The other 11 files were run alone at dc49feca9 (this tree without either change) and at this tree: 52 and 51 reds, the same tests. The one apart is usage-focus-steady, which flakes (#3501). Each is filed: #5392, #3414, #5048, #3799, #3415, #3954, #4627, #4628, #5223, #1529. routing-canceled-row.test.cjs: 10 of 10. With the .rt-req.gone rule taken out, its dot is the answered green rgb(24, 154, 88) and it fails. Restored, it passes. - Not tried: a real Claude Code WebSearch through this tree with a live search API key. The tests use fake search APIs. Co-authored-by: mdwsk88 <11055210+mdwsk88@users.noreply.github.com> Reported-by: mdwsk88 (dawei on Discord) |
||
|
|
8de63c8b5a |
gateway, usage, gui, otlp: a request its agent canceled is no failure (#2398)
An agent that cancels its request before it is answered is logged 499 "the agent canceled the request": a person stops the reply, or sends the next message while it is coming and Claude Desktop cancels it and asks again, or Codex takes a subagent's report (#2398). The gateway already says nobody failed (no rest, no reroute: TestCanceledRequestRestsNobody), but Record.Failed is a status >= 400 or an error, so every page counted it as a failure: the Requests card's "N failed" and success share, its Failed filter, the CSV's error column, the Routing page's "errors your agent saw", the Context page's error rate, the failed colour in the Requests list, Routing and Recent calls, and the OTLP export's error status. A Claude Desktop session on 2026-10-27 had four, each a message sent mid-reply; #2398 had 91 of a day's 92 failures. usage.CanceledBy tells the agent's cancel (499 with AgentCanceled) from magpie's own limit on a request it asked of itself, logged 499 too and still a failure (#2318). The cancel is logged with an error type of its own, agent_canceled (usage.CanceledErrType, set in failedWith), so the record says what it was and nothing guesses it from a 499, as #2398 asked. Record.Canceled reads the type, and a record logged before it by its status and message, so the old log reads the same with nothing migrated. A middleware's usage rows carry the type, so a module can tell the cancel from magpie's own limit, which its rows (no error text) couldn't. Record.Failed leaves the cancel out; Totals counts it apart (Canceled, in count and plus); RetriedRequest and the first-token and speed sums ask Answered, so a canceled request is timed nowhere, as before; Codex's memory of the last model still skips it. Routes and Recent calls say canceled (set as a route is done and as a day's history is read, so old days read the same); the Routing totals and the Context page's errors leave it out. Ledger rows say canceled, and the pages show it muted, in neither the failed nor the answered colour: the Requests list and its detail ("499 · canceled"), the Requests card ("N canceled", the success share of the requests not canceled), the overview tile, the Routing page (a "gone" outcome, no speed) and Recent calls (muted). New strings are in zh, zh-TW, ja and de. The OTLP export: the records the gateway gives its observers for a request and its try carry the type too (canceledAs), and a root span's error.type follows Record.Failed, so a canceled request's span and its try's go with status code 499, no error and no error.type. TestOTelWaterfallFailureAndCancellation's canceled case held two failed spans (the try the vendor refused as the agent left is recorded canceled, as the request is); it now holds neither failed, both 499 and no error.type. That change to the test is the point of this one. mdwsk88's patch (aea0027fd) ran its tests at |
||
|
|
ff2a06c349 |
gui, tune: Tuned for you weighs a model magpie routes at its provider's price, not by its name (#3435)
Tune weighed a call's tokens by its model's name alone (tune.WeightsFor):
an id starting "claude" at Anthropic's ratios (read 0.1, write 1.25, an
hour's write 2), any other at generic ones (an hour's write at a
5-minute one's price). Claude Code is given magpie's models as
provider/model ids (copilot/claude-opus-5-5, anthropic/claude-opus-5-5),
which the name rule took for no Claude model. So a Claude model on an
Anthropic-billed provider was weighed with its hour costing no more than
5 minutes, and none was weighed at the price the usage pages count.
The replay now takes its weights from a tune.Weigh (CompactOpts.Weigh,
and CacheTTL's third argument), per stream; nil weighs as before. Tuned
for you passes pricedWeights: an id with a provider resolves as the
gateway resolves it (provider.Resolve after ClaudeRead) and is weighed
at that provider's EffectivePriceIn, so a Claude model on Copilot has
its hour at the 5-minute write Copilot bills (the previous commit) and
one on Anthropic at 2x. A model Claude Code named itself keeps its
maker's weights, as does a price with no cache read or write. The
compaction advice is weighed the same way. docs/subsystems/agent-wiring.md
says so.
Run on mote (go1.26.8, macOS) at
|
||
|
|
6ac1e04244 |
provider: a Claude model on Copilot has its 1-hour cache write priced as Copilot bills it, at the 5-minute write (#3435)
Copilot bills a cache write at one price however long it is kept. Its copilot_usage counts a 1-hour write as the cache_write a 5-minute one is, and GitHub's "Models and pricing for GitHub Copilot" (docs.github.com/en/copilot/reference/copilot-billing/models-and-pricing) lists one "Cache write" price per Claude model, no 1-hour tier (Opus 5.5: input $4, cached input $0.20, cache write $5, output $20). magpie gave every Claude model's list price Anthropic's 1-hour write, 2x input (catalog.OneHourFor), so copilot/claude-opus-5.5 was priced at $8 per million for an hour's write where Copilot bills $5: on the reporter's request, $0.125456 against Copilot's own $0.078443. A Copilot price (tariffOf, cacheWritesAlike) now has no 1-hour write of its own, so an hour's write is billed as a 5-minute one (catalog.Price.OneHour), its tiers alike, copied as they may be the catalog's. This holds for a call read after Copilot was signed out too (tariffOf's unknown-provider path, MakerPrice), which the reporter's patch left at 2x. A price the user gave for a Copilot model keeps the 1-hour write they gave, and one they left out isn't filled with 2x input (userPrice, so UserBasePriceIn reads it alike). Every other provider is as before: Anthropic, Bedrock, Vertex and relays bill the hour at 2x, so the rule is scoped to Copilot's id, not taken off every non-Anthropic provider. Usage rows are priced as they are read (Record.CostAt), so calls already recorded read at the new price too. docs/reference.md and ModelPrice's comment say so. Run on mote (go1.26.8, macOS) at |
||
|
|
04d99d7cea |
gateway: a relayed MCP call is passed on as the key's check read it
mcpKeyGuard ( |
||
|
|
d55881730d |
gateway: a key can be held to some MCP servers and tools
wakaka on Discord (#help, 11-06) asked for gateway keys limited to some MCP servers and tools, as keys already are to models (#882). A key's MCP list (caller-keys.json "mcp") holds entries "server" (every tool of it) or "server/tool"; "-" alone is no MCP server; an empty list is every server, as before. A key issued under another is held to its issuer's list too. Every MCP route checks it: - magpie's own servers (web search, vision, image, Magpie Browser, plugin tools) through serveMCP: initialize/tools/list/tools/call are refused or filtered per server and tool, and /v1/magpie/key-limits names "mcp"; - the Library hub ("magpie"): only the backing servers and tools the key may use are listed, and a call by name or by fallback is refused; - /mcp/<name> and /mcp/run/<name>: the server is refused, tools/list is filtered in JSON and SSE replies, tools/call refused; a reply the filter can't read (an encoded body) is a 502, never passed through. GUI: "MCP servers" in the key row's menu opens the app's own picker (no native select) with All, No MCP server, each server and its tools (GET /api/caller-keys/mcp lists magpie's own servers and the Library's). A key held to some shows a badge saying which, that opens the same list; a free key shows nothing more in its row, on hover either. A hover badge was tried first: it pushed the row past 560px (gateway-caller-keys) and squeezed the masked key under a drag at 420px (gateway-key-arrange). CLI: magpie gateway-key mcp <id> github fs/read_file | none | all. zh, zh-TW, ja, de strings; docs/reference.md and the gateway-routing and library subsystem pages. Not covered: a model's own built-in web search (a vendor tool, not MCP). GET /api/caller-keys/mcp is named in the CLI parity test's notYet (its list is what `magpie gateway-key mcp` takes; TestEveryRouteHasACommandOrIsNamed caught it at the rebased head). Run on mote (mote-run), at the pushed head: - go test ./internal/access ./internal/cli ./internal/gui ./internal/library ./internal/gateway at a9c40186d (this change on |
||
|
|
a9667daad5 |
codex: CC Switch's OpenAI mirror's threads follow OpenAI, and OpenAI's follow the mirror
Chris on Discord (the Codex app on a Mac): "Model provider mismatch. This chat uses OpenAI, but your current provider is OpenAI. Switch to OpenAI to continue." The Codex app names a provider by its table's name. CC Switch's OpenAI mirror ([model_providers.custom], name "OpenAI", requires_openai_auth, no base_url) is named OpenAI as the built-in openai is, and Codex up to 0.167 resumes a thread only on the provider id it is on now (app-server config_manager.rs load_for_resume and check_thread_model_provider_for_input: ModelProviderMismatch; 0.168.0-alpha drops that check). magpie left the mirror out of every thread move: bringBeside skipped it as the provider it took down, lendOwn skipped it at the top, and bringOfficial took only cc-switch-official. So a thread on the mirror stayed refused with Codex on OpenAI beside magpie, and OpenAI's threads with Codex on the mirror. Both are the ChatGPT account's threads, so they follow whichever of the two Codex is on: - bringOfficial moves every mirror table's threads to the provider Codex is on with magpie (openai or magpie), unless the mirror is at the top, a profile names it, or it is the provider magpie took down (stash codex.provider); - bringBeside takes that one, recorded, and giveBeside gives its threads back at the Disconnect that puts the mirror back on top; - lendOwn moves OpenAI's threads to a mirror at the top, and giveLent back once Codex is on OpenAI. Existing threads: each sync moves them, "custom" in place (OpenAI's length), a paginated one by its row, any age; others' ids the last 30 days with a copy kept, as before. Config.toml and the provider ids magpie writes are unchanged. Run: real codex 0.167.0 in a sandbox CODEX_HOME, `codex exec resume` of a thread on custom with Codex on openai: "This chat uses custom, but your current provider is openai" (modelProviderMismatch), resumed past the check after the relabel to openai; the reverse (custom at the top, thread on openai) refused the same way. mote (go 1.26.8): go test -count=1 ./internal/agent/ ./internal/sessions/ ok (408s, 58s); go vet ./internal/agent/ native, GOOS=windows, GOOS=linux ok; gofmt -l clean. Broken by hand: the three old exclusions back, all three new tests red (thread left on custom / on openai); bringOfficial without the stash skip, TestCodexMirrorAtTopJoinsWithItsThreads red (the mirror's thread left on openai after the Disconnect). Not tried: the Codex desktop app itself (not on any test box), and Chris's config.toml wasn't seen, so which way round his threads were is inferred from the two ids that name "OpenAI". A thread on a mirror with a profile naming it stays; after the Disconnect, OpenAI's own threads stay on OpenAI as before. Reported-by: Chris (Discord) |
||
|
|
8cbaeecae9 |
providers: errors=pass sends a vendor's error to the agent as it came, asked once
ne9ko9 on Discord wants errors handled explicitly, not by inference, and a mode that passes them straight through. A custom or API-key provider (no account, an endpoint of its own, not a subscription) now takes `passErrors` in its config: "magpie handles" (the default, unchanged) or "Pass through". Nothing sets it but the user, and an edit that doesn't send it keeps the saved value. With it on, for that provider: - no rewriting: on the client's own API, upstream's status, Content-Type and bytes go out (passError); on another API, the client's shape is built with the vendor's own type, message and raw code and param (a numeric code stays a number). Retry-After and *ratelimit* headers go with it; - no too-long inference, no busy words, no 413 hint, no policy rewording (settle never runs: the try is passing); - no gateway retry: forward()'s Retries loop, refit, firstWait, the loop's re-asks, reloop, empties retry and streamTranslated's cont.again all stop; - no fallback and no rest: the candidate loop's one choke point, newHoldWriter(…, !pass && …), lets the try pass, so nothing after it is tried, and restAfterMarked answers By "off". magpie's own file-id re-ask (dsRetryGone) still runs, as it fixes magpie's own upload, not the vendor's answer. CLI: `magpie provider set <id> errors=pass|magpie`; a bad value is refused and keeps the old one; an account is refused. `provider show` says "errors pass". GUI: Edit → Advanced → Errors, a quiet app-menu picker (openProtoMenu, no native select) with "magpie handles" and "Pass through", shown only where takesPassErrors; zh, zh-TW, ja, de. It is drawn by passerrors.js, imported when the editor draws the row (old-webkit's lazy list names it), and app.js pays for its few lines by two comments cut, so app.js is smaller than before and TestCoreScriptBudget's numbers are unchanged. Tests: - internal/gateway/pass_errors_test.go: TestPassErrorsAskedOnce (503, 429, 404 with numeric codes, alone and as a group's first member: exact bytes and status, asked once, the second member never asked, no rest), TestPassErrorsNotInferred (a too-long 400 byte-for-byte), TestPassErrorsOtherAPI (Anthropic 403 code 20031 to a Chat client, streamed and not). - internal/provider/pass_errors_test.go, internal/cli/errors_cli_test.go. - internal/gui/tests/provider-pass-errors.test.cjs: every language, 1100 and 420 wide, Chromium and WebKit. Run, through mote-run at this commit: - go test -count=1 -timeout 45m ./internal/gateway ./internal/provider ./internal/cli ./internal/gui (at the parent 19c45d5d4's tree): gateway, provider, cli ok; gui red only in TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949). TestCoreScriptBudget ok. - Rebased on |
||
|
|
f9a88c4fbe |
wsl: a distro's Pi from fnm, mise or an npmrc prefix is found, past a Windows one on PATH
千里不再 on Discord: Pi installed in WSL wasn't detected. The WSL probe runs `sh -lc`, which reads ~/.profile but not ~/.bashrc, where fnm's installer puts its PATH, so `command -v pi` missed it and wslbin had no fnm folder. A Pi not run yet has no ~/.pi either, so nothing found it (and for fnm users who had run it, its version was lost). Also, WSL appends Windows' PATH, so a Pi npm installed on Windows answered `command -v pi` with a /mnt/c path; that stopped the `|| wslbin` fallback and parseProbe then dropped it as a Windows command (#406), so the distro's own Pi was hidden. Now wslcmd takes `command -v` only when it isn't on a Windows drive (/mnt/X or any drive /proc/mounts lists), else walks PATH past Windows drives, else wslbin. wslbin gains the folders proc.UserBinDirs has here: fnm (aliases/default, then the highest version; FNM_DIR, ~/.local/share/fnm, ~/.fnm), mise's installs (highest), ~/.npmrc's prefix, ~/.npm/bin, cargo, deno, Homebrew. Every WSL kind goes through it, not only Pi. Run: - mote: GOOS=windows/linux/darwin go vet ./internal/agent; go test -run "TestWSL|TestOmo|TestPi" ./internal/agent ok. gofmt -l clean. - wsl-run (magpie-desktop, Ubuntu 24.04): same tests ok. - Real WSL: in magpie-desktop, a scratch HOME with the real fnm installer, `fnm install 22`, `npm i -g @mariozechner/pi-coding-agent` (pi 0.73.1), never run. Old probe: no bin:pi. New probe: `bin:pi .../fnm/aliases/default/bin/pi`, `ver:pi 0.73.1`, pi@wsl listed; a fnm codex was found past a /mnt/c one. Real home still finds codex, pi and claude (3.9s). Through proc.CommandContext on Windows (win-run) with Detect agents in WSL on, the probe runs (#4872 gates only when it is off). Broken by hand: origin/main's wsl.go with the new tests: all four subtests of TestWSLProbeFindsNodeManagersBins and TestWSLProbeLooksPastWindowsCommand red. Not tried: the reporter's own install (method unknown; fnm with a never-run Pi is the case reproduced). Asking bash -i for ~/.bashrc's PATH was tried and dropped: under timeout(1) an interactive bash stops itself (state T) on WSL and outlived its timeout. Reported-by: 千里不再 (Discord) |
||
|
|
1fd0bb9670 |
update: a download whose HTTP/2 transfer broke off tries again over HTTP/1.1
biubiu8802 on X (tweet 2118719081872540038): behind their proxy every
update failed with "download broke off, a network problem", while the
same proxy carried ordinary downloads. Confirmed in the code: download()
retried up to 5 times with Range, but each try went through
netproxy.Dispatch over HTTP/2 again; Dispatch moves a host to HTTP/1.1
only on a TLS record error (recordError: bad record MAC and kin), and
"unexpected EOF" or a stream reset is not one. So a proxy that cuts
HTTP/2 streams part way cut every try the same way.
- netproxy: OverHTTP1(ctx) sends every request under ctx through
Dispatch's HTTP/1.1 copy (route.h1), kept through With.
BrokeOff(err) says a transfer broke off (net.Error, unexpected EOF,
HTTP/2 stream error / GOAWAY / lost connection, a reset; not a
context that ended). AgainOverHTTP1 runs a download once more over
HTTP/1.1 after such a failure.
- update: the tries after a broken one go over HTTP/1.1, and still
resume with Range from the bytes kept.
- Siblings, the other big downloads through Dispatch's client: the
masking model and pf-serve (pii.fetch, one more try over HTTP/1.1
from what is on the .part file), Bun's zip (plugin getURLFrom),
Claude Code's binary (claudecode.download) and the Grok CLI
(grokDownload) each try once more over HTTP/1.1.
- docs/subsystems/providers-accounts.md names it.
Run (mote, Go 1.26.8, at this tree, base
|
||
|
|
80ae904c23 |
routing: routing groups get a page of their own, beside Routing
The owner asked for the groups to leave the Routing page (11-06): under the live stage and every request they were a long scroll down, and New group with them. The design was reviewed before this was built. - New page, Routing groups (#view-groups), drawn by the routing plugin's same script (routingPage), so the editor, its dirty/discard and every group action are unchanged. Toolbar: filter, "N groups · M on", Templates, Import, Select, and New group as the filled button. The list is right under it, and a Settings section under the list holds Found groups (with Exclude providers…) and Names in agents' lists. - No Export button: each group already has its own Copy to share. - Routing keeps the live stage and the requests. A request's group opens the groups page at its row. - The sidebar has a Routing groups tab right after Routing (from 1024 points). The header's row has no room for one: at 860px the extra tab pushed the logo out (brand.test). There the tab is hidden, Routing's tab is lit for both pages (markNav), and Routing's head has a "Routing groups ›" button, hidden beside the sidebar. - Every way in now goes to the groups page: the guide's Open routing groups, the panel's and the provider editor's Make a routing group (window/main?view=groups&newgroup=…). mainView still takes view=routing&newgroup from an older panel. - Words: "Routing groups", "Open routing groups", "Once saved, make a group of them in Routing groups.", and the editor's names note now says the setting is under the list, in zh, zh-TW, ja and de. "Open Routing" stays for the Agents page's button. - Docs: providers-accounts, gateway-routing, plugin-runtime, gui-shell and reference say "Routing groups page" where they mean the groups. - Core budget: the core's scripts are 1,533,774 of 1,533,802, paid for by three show()/setGatewayMode comments cut in app.js. No raise. Tests: routing-groups-page.test.cjs (new) covers the page in Chromium and WebKit, en/zh/zh-TW/ja/de, at 1280, 640 (window) and 420 (web): no groups on Routing, the tab or the head's button by width, the lit tab, toolbar order, New group primary and in sight, list then Settings, no sideways scroll, no native select, no left-border accent; a request's group to its row; quotas redrawn with an open editor left alone. The trace tests (routing-compact, -pause-folder, -rule-models, -folder) open Routing, then show the groups; routing-editor-foot and name-suffix-where-named scroll by wheel, as the scroll guard lets a reader; builtins expects the groups tab beside the sidebar only. Removed: routing-groups-jump (the head's "Routing groups ↓" that scrolled down to them, gone with them), routing-pointer-pin and routing-steady (the groups kept in place under requests streaming in above them: no request is above them now). Their guarantee that what redraws leaves an open editor and its typing alone is routing-groups-page's quotas case; Routing's own lists keep their keepInView. The groups page's jump: a request's group, or a pool's "Several keys" chip, opened the groups page and scrolled the row to the centre, and the next frame show()'s backAfterLoad put the page back where the reader last left it, then brought the focused segment in by "nearest": in WebKit the pool sat half under the window's foot (routing-mode-goes, 9 of its 10 WebKit cases). goRouting now jumps at once on a page it opens and marks it arrived(). The wheel in routing-many-keys turns over the keys: at the page's foot, now shorter, the mouse rested over the requests list (.rt-reqs, overscroll-behavior: contain), which took every wheel up, and the test stopped with 2 keys in sight. That is #4082's cause. routing-days-fit's fixture has 12 requests, a day that fills the window, since the day bar held needs room under it. Run on mote (macOS 27, load 25 to 65), Playwright 1.62.0: - Go: go vet, gofmt -l and go test ./... at the rebased head ( |
||
|
|
dbaeaec124 |
claude-desktop: a model picked for two tiers is listed for the second too, so that tier isn't left empty (#5534)
Claude Desktop keys a profile's inferenceModels by name and reads one tier
off an entry: for each tier, the entry tagged with it (isFamilyDefault
first) names ANTHROPIC_DEFAULT_<TIER>_MODEL for the Code tab's Claude
Code (JNn/WNn in 4.16336's app.asar, FPn in 4.23118's). desktopTierOf
tags a model picked for two tiers with the first only, so the second had
no model. dawei picked copilot/claude-sonnet-5.5 for sonnet and haiku
(Copilot has no Haiku 5.5); Desktop spawned Claude Code with
ANTHROPIC_DEFAULT_HAIKU_MODEL empty, and its small tasks (WebFetch page
summaries) ran on the session's copilot/claude-opus-5.5 at 94-244 s each.
Now:
- desktopSharedTiers: each tier whose pick an earlier tier already has.
- DesktopInferenceModels lists such a model once more per later tier,
after the rows (the first row, which a new session starts on, stays
first), tagged with the tier and isFamilyDefault, with the row's 1M
fields and its label plus " · <tier>".
- desktopTierAlias names it in the form claudeLooking gives the model
under a number made of its id and the tier (magpie-<n>.anthropic.<model>,
mythos-magpie-<n>, or anthropic/magpie-<n> for a model listed by its own
id). aliased reads that number back to the model, so the gateway serves
it as the pick (desktopTierAsked), and a session saved on it is still
served after the picks change.
- desktopRunsAs (previous commit) gives it behavesAs where Claude Code
doesn't know the id.
- agent: CLAUDE_CODE_MODEL_CAPABILITIES and the modelSettings budgets
carry the extra ids too (gateway.DesktopTierAliases).
- docs/subsystems/gateway-routing.md and agent-wiring.md say so.
Not changed: /v1/models still tags one row per model (Desktop reads no
/v1/models while the list is written); the Providers page's Desktop
number is the first id's. Desktop's menu shows the extra entry
("Claude Sonnet 5.5 · Copilot · haiku"); the list has no hidden entries.
Ported from mdwsk88's desktop-tier-shared-pick (817edde09), reviewed line
by line. Added here: TestDesktopTierSharedPick's "every tier" (one model
for opus, sonnet, haiku and fable: three extra entries, every name
distinct, each tier tagged once, each id read back and its tool-less
small task served on the pick while the session is on another model)
and "own id" (a Claude model with no reasoning levels, listed by its own
id: the later tier is anthropic/magpie-<n> with behavesAs that model).
Run on mote (go1.26.8):
- TestDesktopTierSharedPick (4 subtests), TestDesktopGroupPickRunsAsItsModel,
TestClaudeDesktopModelsSharedTier, TestClaudeCapabilitiesDesktopSharedTier:
ok. Broken by hand, each red:
- desktopSharedTiers looping over no tier (the old behaviour): all four
subtests ("haiku has no entry"), and both agent tests;
- aliased not reading a tier's number back: all four subtests
("magpie-2213721611.anthropic.claude-sonnet-5-5 read back as ...").
- go test -run 'Desktop|Claude|Alias|Tier' ./internal/gateway
./internal/agent: ok. go vet darwin, linux (-tags nogui), windows,
go build ./...: ok. gofmt -l: nothing.
- Desktop's own code: the list this commit gives for opus m1, sonnet and
haiku claude-sonnet-5-5, fable m1, run through JNn/WNn taken verbatim
from Desktop 4.16336's app.asar in node: HAIKU =
magpie-2213721611.anthropic.claude-sonnet-5-5, FABLE =
mythos-magpie-7663130977, OPUS and SONNET as before. The same list
without the extra entries (the old one): HAIKU and FABLE "".
Not tried: a real Claude Desktop reading the list and starting Claude
Code; the Playwright suites (no GUI file changed). The full suite runs
after the push.
Reported-by: dawei (Discord)
Co-authored-by: mdwsk88 <11055210+mdwsk88@users.noreply.github.com>
|
||
|
|
428ec17a9d |
claude-desktop: a routing group picked for a tier runs as the Claude model leading it (behavesAs) (#5534)
A routing group is listed to Claude Desktop by its mythos-magpie-<n>,
never as the Claude model its first member is (claudeLooking), so the
Code tab's Claude Code doesn't know it by that id. A pick's
inferenceModels entry got behavesAs only when the pick wasn't a Claude
model (claudeModel), which a group led by one is: the entry had no
behavesAs, and Claude Code ran the tier with its generic prompt and
defaults (seen with auto/claude-sonnet-5-5 picked for haiku).
desktopRunsAs decides by the id the entry is listed by: nothing where
Claude Code knows a Claude model by that id (magpie-<n>.anthropic.<model>
or the model's own id), the Claude model the entry is where it is listed
by mythos-magpie-<n> or anthropic/magpie-<n>, else the tier's newest
Claude model, as before. DesktopBehavesAs follows, so Claude Code's
modelSettings tell the group its own window (claudeBudget.behaves).
Ported from mdwsk88's desktop-tier-shared-pick (eb802f763), reviewed line
by line, unchanged.
Run on mote (go1.26.8), at this commit and the next together:
- TestDesktopGroupPickRunsAsItsModel ok; with desktopRunsAs's mythos/alias
branch taken out by hand it is red ("the group, shown as
mythos-magpie-4305132155, runs as <nil>; want claude-sonnet-5-5"), as is
the next commit's own-id subtest.
- go test -run 'Desktop|Claude|Alias|Tier' ./internal/gateway
./internal/agent: ok. go vet darwin, linux (-tags nogui), windows on
both packages, go build ./...: ok. gofmt -l: nothing.
Reported-by: dawei (Discord)
Co-authored-by: mdwsk88 <11055210+mdwsk88@users.noreply.github.com>
|
||
|
|
25b201eb67 |
library: the Skills and MCP headings keep Select and put the rest under ⋯
ryanpascal on Discord: the Library › Skills heading had too many buttons, up to a dozen beside the sort. The heading now shows the sort, Select, Clean up and Update n when they apply, and a ⋯ (the app's row menu, openRowMenu) holding Check for updates, Update all, Group again, Collapse all / Expand all, Turn all on, Turn all off, By agent, Manage n in magpie and Remove all, in that order with separators. The MCP servers heading does the same with Turn all on, Turn all off, By agent and Remove all. A busy action stays in sight on the bar (Checking…, Grouping…, Updating…), so the wait is seen. Each menu item is the old button: its words, its title, greyed when it was, its click; Remove all is red as it was. No new words: ⋯ is the core's "More". barMore builds the menu from the buttons as they are when ⋯ is pressed, so a count or a greyed state is never stale; a hidden button is left out and the ⋯ itself is hidden when nothing is left. The tests that pressed these buttons on the bar (by-agent, every-skill, github-token, library-gone-agents, library-null-agents, library-servers-bulk, remove-all-skills, skill-fold-all, skill-git-source, skill-handover, skill-new-in-repo, skill-regroup) now open ⋯ and press the item. docs/subsystems/library.md says where the buttons are. Run (mote, through mote-run): - node --test library-bar-more.test.cjs: 22 pass (en, zh, zh-TW, ja, de at 420 and 1180 px, Chromium and WebKit): nothing moved is on the bar, ⋯'s label, one line at 1180, the menu's items and order in each language, the menu inside the window, a second ⋯ closes it, Turn all off's sheet, Check for updates posting once, the MCP heading's menu, no sideways scroll. - the 12 updated files plus library-bar-more: 176 pass before the usage fix below, the 22 reds all library-bar-more's (its second ⋯ click eaten, the cause fixed in the commit before this; then the wide window's tabs, which are the side nav's, fixed in the test). - skill-manual, list-sort, skill-gone, skill-update-edited, skill-how, library-hooks, library-pick-remove, library-row-remove, menu-first-second, i18n-keys, i18n-en-no-cjk: 127 pass, 1 fail, the "a plugin's words are its own" red that origin/main |
||
|
|
adcb69107c |
library: a skill set to disable-model-invocation is marked Manual only
sunset3279 on Discord asked to see which skills set
disable-model-invocation: true in their SKILL.md, the ones Claude Code
runs only when the user types /name. parseMeta reads the field into
meta.Manual; the library's rows (SkillView.Manual) and the agents' own
(FoundSkill.Manual) carry it, and the page puts a quiet "Manual only"
tag after the name, its tooltip naming /name and the field. A front
matter that doesn't parse, or a value that isn't a bool, is not known
to be manual: no tag. Translated in zh, zh-TW, ja and de.
Run (mote, through mote-run):
- go test -run 'TestSkillManualFromFrontMatter|TestSkillsFromFolder|TestFoundInLibraryFolder' ./internal/library: ok
- node --test internal/gui/tests/skill-manual.test.cjs: 22 pass, 0 fail
(en, zh, zh-TW, ja, de at 420 and 1180 px, Chromium and WebKit)
- go test ./internal/library: ok (692s)
- go vet ./internal/library for darwin, windows and linux (nogui): ok
- node --test i18n-keys and i18n-en-no-cjk: 7 pass, 1 fail. The fail is
"a plugin's words are its own", the same three entries on origin/main
|
||
|
|
361da10ee9 |
web: the page's API answers its own origin only, not a page on another port or a sibling subdomain
With browser access on (Settings > Browser access, or magpie web), the
sign-in cookie magpie_web_<port> is SameSite=Lax, which a browser sends
with any same-site request: another port of 127.0.0.1 or of the LAN
address, or a sibling name behind the same reverse proxy. apiFramed
refused Origin null, frames and cross-site, but not same-site, and /api
decodes JSON from any Content-Type. So such a page could POST a stdio MCP
server to /api/library/servers/save (text/plain, no-cors) and start it
with /api/library/mcp/check: code run as the user.
webOwnPage (in webHandler, behind webGuard, /api/ only) now judges every
write (all methods but GET/HEAD/OPTIONS) with net/http's
CrossOriginProtection: Sec-Fetch-Site same-origin or none passes, any
other value is refused; from a browser without Sec-Fetch-Site, Origin must
be absent or name the request's Host (or MAGPIE_PUBLIC_URL, for a proxy
that rewrites Host). Any /api request, a GET too, whose Sec-Fetch-Site is
same-site or cross-site is refused, so no GET route with a side effect
(GET /api/import/{id} reads once and deletes) is another page's to call,
without auditing each one. A Sec-Fetch-Site same-origin with an Origin
that doesn't match the Host passes: the browser compared the origins
itself, and nginx's default proxy_set_header Host $proxy_host would
otherwise break every write behind it. The desktop window's /api is served
in-process over no port with no cookie, so it isn't wrapped and its
headers are unchanged. No Content-Type rule: every write the page makes
goes through api() as application/json, but multipart and text/plain are
both CORS-safelisted, so the rule would add nothing the origin check
doesn't already give.
Run on mote at
|
||
|
|
e1eeeed734 |
browser: the extension's key connects Magpie Browser and nothing else; own needs this computer; a key turned off closes its browser
|
||
|
|
6f5d48ea0f |
remote magpie: a moved remote is looked for again, and is sent its key only after it proves it holds it
|
||
|
|
f4068ccc25 |
proc: with Detect agents in WSL off, no wsl.exe is started on any path (#4872)
With Settings' Detect agents in WSL off (noWSLAgents), every Claude request still reached wsl.exe: wslReady (wslClaudeStandIn, wslCodexStandIn) and wslClaudeClassifier listed the running distros without asking wslLooks, the gate #1264 put on wslAgents, wslHomes and WSLRunning. wslrun's Up, In and running weren't gated either (only Find was). On a computer without WSL, Windows' inbox wsl.exe answers each ask with a window offering to install WSL, one per request. The fix is at the one choke point every command magpie starts goes through (TestNoCommandBypassesProc): proc.Command and CommandContext (and so ProbeContext, wslrun.Tool.Command/Probe, the Claude TUI helper's ConPTY start, which checks cmd.Err) refuse wsl.exe by any name or path (wsl, WSL.EXE, C:\Windows\System32\wsl.exe) with proc.ErrWSLOff while the setting is off, as a probe of an app's own program is refused. The paths that reach it: agent's wslRun/wslExec (lists, probes, links, chmod, reach), wslrun.Run/Find/In/Up/Stop, library's cmdvars, mcp_wsl, mcp_check and rtk_wsl, claudetui's wslread, the gateway's Claude Code in WSL. The settings read is settings.Shared() and only for a wsl name. Not gated: the Sessions page's resume line for a WSL session (a string a terminal runs on the user's click), whose sessions aren't listed with detection off. skygunner/vincent's stand-in fix is kept as well, so the stand-in and classifier return before taking wsl's lock or recording a failed list. Run: - mote-run: go vet ./internal/proc ./internal/agent ./internal/wslrun; GOOS=windows go vet of proc, agent, wslrun, claudetui, library, gateway; GOOS=linux go vet of proc, agent, wslrun, claudetui: clean. go test -count=1 ./internal/proc ./internal/wslrun ./internal/claudetui: ok; -run 'WSL|Wsl|Dsh' ./internal/agent ./internal/library ./internal/sessions: ok. gofmt -l: nothing. - win-run on xiaomi-gpu (Windows 11, real wsl.exe present): the four new tests plus TestWSLDetectionOff, TestWSLClaudeStandIn, TestWSLCodexStandIn, TestNoCommandBypassesProc: ok; -v shows each new test PASS; go test ./internal/proc ./internal/wslrun whole: ok. TestWSLRunnerRefusedWhenOff runs agent's real wslRun there. Broken by hand (wslOff's check made `if false && …`, agent/wsl.go at origin/main, new tests kept), on mote: TestWSLOffStartsNoWSL red for every name and maker, TestRunRefusedWhenOff "Run ran wsl.exe: exit status 1", TestWSLRunnerRefusedWhenOff red, TestWSLStandInAsksNothing WhenOff red with three "-l --running -q" asks. Not tried: the reporter's own Windows without WSL (the install window itself); the full suite runs after the push under the suite lock. Reported-by: 陌离 (Discord) Co-authored-by: vincent <vincent@users.noreply.github.com> |
||
|
|
2000ae4398 |
antigravity: each model's window reaches the app through its catalog; the notice names what a gateway turns off (YujunT46308)
YujunT46308 on X: wired through magpie, Antigravity 2.29.0 showed a
200K window for every model, and after a restart it lost /boost,
/teamwork, /plugin and /generative_ui.
The window. The app's backend (Resources/bin/language_server) resolves
models from models.list, then models.listSource (a remote catalog,
fetched with the gateway key), then <url>/v1/models, then its built-in
catalog. From /v1/models it reads the id alone; a model its catalog
doesn't know gets its family's defaults, maxTokens 200000. No field of
the OpenAI list (context_window, context_length, max_input_tokens) is
read. magpie now points models.listSource at
<gateway>/v1/models?format=antigravity, which answers {"list": [...]}
in the app's own fields (modelId, displayName, maxTokens,
maxOutputTokens, supportsImages, supportsThinking) for the models the
key may use. A field magpie doesn't know is left out. The user's own
listSource is stashed with their gateway and put back; Sync adds the
catalog to a file wired before, at the gateway's current address.
The picker now shows magpie's names, so NoNames is off for it.
The Google features. Not fixable on this route: on a gateway the app
uses no Google sign-in and its backend calls neither cloud_code_endpoint
nor api_server_url (headless run below), and Google's docs say a gateway
and a Google Account can't be used at once. The experiments and
commands Google's servers turn on for a signed-in account are off while
it is on magpie. No key in settings.json keeps both. The notice shown on
connecting (GUI toast, CLI) now names what is lost and that turning it
off gives it back, in en, zh, zh-TW, ja, de.
Run (mote, at this head unless said):
- go test -tags nogui ./internal/agent ./internal/gateway -run Antigravity:
ok. Broken by hand: the listSource writes taken out ->
TestAntigravityGateway, TestAntigravityCatalogSource,
TestAntigravitySyncAddsCatalog red; the ?format branch taken out ->
TestAntigravityCatalog red.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui,
GOOS=windows go build: ok.
- GUI (Chromium and WebKit): i18n-keys, i18n-en-no-cjk,
agent-notice-lang, about-notices, gui-de, gui-ja, gui-zh-tw,
name-suffix-no-names at the pre-rebase tree (only i18n.js differs in
the GUI): all pass except i18n-keys "a plugin's words are its own",
red the same on origin/main
|
||
|
|
18a9a2d883 |
remote magpie: a remote that can't be reached is not looked for on the network, which sent its key to every neighbour
|
||
|
|
06c4582cca |
remote magpie: a list changed on the other magpie reaches this one's agents at once
KaCli (Discord) runs two magpies: the server's is the gateway, and the
local one has it as a Remote magpie and writes its models into dsh. A
route or group changed on the server reached the local dsh only on the
next 10-minute fetch (#2135's RemoteMagpieEvery). The server knows when
its list changes (filememo), so it now says so.
- Server: GET /v1/models with X-Magpie-List-Wait: <secs> and
If-None-Match answers the list with an ETag once it differs from that
tag. It answers 304 at the end of the wait (at most 50s, under a
proxy's 60s) or as the gateway stops. The list is looked at again on
each magpie write and on each change another process makes to its
files (filememo.Written). It is the list's own route, so the key,
lanGuard, corsGuard and a key's models judge it as before. The wait is
exempt from holdCatalog, and each look holds the catalog for itself.
Without the header the answer is the same as before, with no ETag.
- Client: KeepRemoteListsFollowed (started beside KeepListsFresh) keeps
one long-poll per Remote magpie. On a new tag it fetches the list
through the same RefetchTaking, so catalog.Touched rewrites the
agents' configs. A magpie from before answers at once with no ETag; it
is left to the 10m schedule and asked again after an hour. A Remote
magpie whose user set its list to "off" is not followed. The schedule
stays as the fallback.
Run (on mote, through mote-run):
- gofmt -l clean; go vet ./...; GOOS=linux go vet -tags nogui ./...;
GOOS=windows go vet ./...; go build ./..., GOOS=linux -tags nogui and
GOOS=windows builds: all ok.
- go test -tags nogui -count=1 ./internal/gateway ./internal/provider
./internal/catalog ./internal/filememo: all ok (gateway 863s, provider 152s, catalog, filememo).
- After the rebase on
|
||
|
|
650bf84128 |
docker: a daily tag that moves once a day, for Renovate
magpie releases many times a day, and YaoFur on X runs the image with
Renovate, which opened a PR on every tag ("改成每天凌晨更新一次").
Releases stay as fast as they are. ghcr.io/yetone/magpie:daily is new:
.github/workflows/docker-daily.yml points it at :latest's image once a
day, at 20:00 UTC (04:00 in China), by digest, as docker-stable.yml does
for :stable. It never builds, and touches no other tag; a click on Run
workflow moves it too. A Renovate user follows daily with its digest
pinned and gets at most one PR a day; stable is still there for one a
week.
The docs name it: the Tags row and the Updates line of the Docker page in
en, zh and ja, and the Docker section of docs/reference.md.
site/docker-tags.test.mjs holds that the three languages name the same
floating tags with daily among them, that a workflow writes each tag the
docs name, and that daily has one daily schedule, copies latest and
builds nothing.
The desktop app is unchanged: it already checks every 6 hours by
default, and Settings > About offers Check every 24 h and the Stable
channel (one a week).
Run (mote): node --test site/*.test.mjs, 90 of 90 ok; without the
workflow and the docs, two of docker-tags' three tests are red.
actionlint on docker-daily.yml and docker-stable.yml: clean. No Go file
changed; go test ./... -timeout 45m runs on the Linux box (wsl-run) at
this tree, since mote had another session's full suite running.
Not tried: the workflow itself before this push; it is run once with
workflow_dispatch right after it.
|
||
|
|
1f439ecc5e |
gateway keys: a limit can count only some models or providers (zola_xynb)
zola_xynb on X asked for a cap per model or per provider under one gateway key. A key limit can now name models (access.Limit.Models, "<provider>/<model>" or "<provider>/*"), so one key can have, for example, a month of $20 on openai/* next to a month for the whole key. Limits without models still cover the whole key, as before. - budget: sums are kept per window and scope, and count a ledger row only when its provider/model matches (any of the model's ids). reserve holds a request to a scoped limit only when the model it names is served there. windowsOf keeps every scope's sums, so the ledger is not read again on each request. - gateway: keyLimited puts the key's spent scopes on the caller (withSpent), count_tokens included. A direct request for a spent model gets a 429 with Retry-After and no X-Magpie-Limit-Reset, so a remote magpie rests only that model. A routing group, a provider's fallback and embedding/image/video/decision groups skip spent members (groupKeeps, allowedCandidates) and get a 429 only when none is left. System One, count_tokens and magpie's own calls for the key are held too. Model lists are unchanged. A refusal turned away before routing now records its ErrType in the ledger. - CLI: magpie gateway-key limit <id> add month --cost 20 --model openai/* (--model repeatable, --models a,b). - GUI: the key limit editor has a Models field that opens the app menu (multi-pick: All models, every model of a provider, each model). It has no <select> and no new screen. The badge, line and tabs name the models. Strings are in every language. - docs: reference.md and subsystems/gateway-routing.md. Run at d52725d32 (this change on |
||
|
|
3cbb7e0429 |
plugin host: a plugin's redirect to another origin is sent none of its key headers (#5508)
Bun follows any redirect anywhere and, on a hop to another origin, drops only Authorization and Cookie. Checked on Bun 1.4.2 before the change: x-api-key, x-goog-api-key and a custom header reached a second local server on each of 301, 302, 303, 307 and 308. So a vendor (or anything answering at its URL) that redirected elsewhere got a plugin's key headers, and an https vendor's redirect to http was followed. host.js now applies provider.KeepsCredentials' rule ( |
||
|
|
483b131ef0 |
browser: magpie in Docker uses the host's own browser, through a key the page hands out
noahhrreion ran magpie in a container and its Magpie Browser never
connected. The host's Chrome dials ws://127.0.0.1:3425/v1/magpie/browser/
extension, which reaches the container from the bridge (172.17.0.1). That
is not loopback, so the gateway refused it (403). The browser MCP also
refused every caller from elsewhere, and the hub marked the browser
HereOnly. The extension's folder under the container's HOME can't be
loaded by the host's browser either.
Nothing is opened to the network without a key:
- The extension takes a gateway key: its popup has a Gateway key field,
and config.js carries KEY (extension 0.1.7). From another computer the
extension connects only with ?key= of a gateway key that is on, and
only from the extension's own Origin (checked first). Loopback is
unchanged, and a page's origin, null, a keyless call or a rebound Host
are all still refused (TestBrowserExtensionOnlyFromItsOrigin).
- A browser that connects with a key belongs to that key. Sessions are
tagged key:<id>/... (browserOwner, keyedSession), and a remote caller's
session is forced to its own key's whatever it names. The relay filters
every lookup (forSession, all, choose) through browserConn.serves. The
browser MCP admits a remote caller only with a gateway key; a web page
is refused as before.
- The key the page makes is recorded as this magpie's own browser's: its
id goes in settings.Dir()/browser-key, written temp-and-rename. This
goes by where the key came from, not by its name. A browser connecting
with it serves this computer's sessions too, so agents inside the
container use it as they would one on loopback. A record that can't be
read names no key, so no keyed browser is this computer's.
- Router: magpie mcp browser is HubServer.Keyed. A visitor from
elsewhere gets it only with a key (HubVisitor.Key), and hubCall names
its session key:<id>/..., so it reaches only that key's browser.
- GUI: a page whose browser can't reach magpie's folders (InContainer, or
a page from another computer) is "away". The Magpie Browser sheet's
button then reads Download the extension. It does a POST to
/api/library/browser/extension with the page's origin, which answers a
zip pointed at that origin (3430 passes the gateway's routes on) and
holding the recorded key's secret. The key is made the first time and
reused while it is on. The steps (unzip, chrome://extensions, Developer
mode, Load unpacked) are shown in every language. It is a POST so that
a link from another site can't mint a key.
- Docs: reference.md (Docker), subsystems/library.md and mcp-router.md,
and site docker.html in en, zh and ja.
Run, at this tree rebased on origin/main
|
||
|
|
77bda84a6f |
library: a check offers the skills a git repository or folder added since
refeccd (Discord): skills added from a repository or a folder only had
the existing ones updated; ones the source added later never reached
the library. GitHub sources already had this (findNew); git repositories
on other hosts and folders on this machine did not, and a folder install
didn't even remember the folder it came from.
- git: when ls-remote gives the ref a head, findNewGit reads the fetch
the check shares and offers skills under newBase that the library
doesn't have and hasn't offered. Once per head while its finds are
kept (gitLooked). The address is kept as the library has it (.git and
all), so an Add lands on the same repo@ref key.
- folder: an install from a folder now records "folder:<path>" in
SeenSkills (offered), which is how the library knows where to look
again. findNewFolder reads it as Add from folder does and skips a
folder the library links, has offered, or has a skill by that name of.
- A check never adds or writes a skill: each is offered with Add and
Ignore, as GitHub's are. A skill the user removed or set aside isn't
offered again, and a folder edit is never written over.
- View.CheckFolders shows Check for updates with only linked skills and
makes checkDue true; its title says it looks in folders too. A find's
row shows its folder (pathLink) or git address. The old head note
("on GitHub beside skills you have…") is gone; the new title is in all
five languages.
- docs/subsystems/library.md says so.
Old data: a folder added before this kept no folder: key, so it is
looked in only after the user adds from that folder once more (the
picker then lists the new skills, and the install records the folder).
Run (mote, at
|
||
|
|
7d196b6797 |
gateway: what a proxy says of the caller reaches no vendor, ChatGPT backend or MCP server
Behind Tailscale Serve, a Cloudflare Tunnel or another reverse proxy, the request magpie gets carries what the proxy says of the caller: Tailscale-User-Login, -Name and -Profile-Pic (the user's email, name and picture), True-Client-IP, X-Forwarded-*, Cf-*. The native route dropped X-Forwarded-*, Forwarded, Cf-*, X-Real-Ip and Via, but not True-Client-IP or any Tailscale-*, even though lanGuard itself reads True-Client-IP and Tailscale-User-Login as forwarded (forwardHeaders). The Codex passthrough and relay to the ChatGPT backend (copyHeaders) and the MCP proxy dropped none of them. proxyIdentity names them once: every forwardHeaders entry; any X-Forwarded-*, Cf-* and Tailscale-*; Forwarded, Via, X-Real-Ip, True-Client-Ip, X-Client-Ip and X-Original-Forwarded-For. nativeHeaderDropped, copyHeaders and the MCP proxy's header loop all skip them. The caller's other headers still go on. Checked and left as they are: a provider's PassHeaders (names the user chose), Codex's allow-listed codexHeader, the Codex websocket's headers and passOnCaller. Tests: TestNativeAnyDropsProxyIdentity (native route, under MAGPIE_TRUST_PROXY) and TestPassthroughDropsProxyIdentity (Codex relay through copyHeaders, and /mcp/<server>). Each sends twelve identity headers and checks that none arrive and that X-Custom still does. Broken by hand: with native.go, codex_backend.go and mcp.go at their parent, both tests are red. The native vendor was told True-Client-IP and the three Tailscale-User-* headers. The ChatGPT backend and the MCP server were told all twelve. Run on mote at the pushed head 883690a0b (this commit and the one before, on origin/main |
||
|
|
c57a5f7f58 |
gateway: a vendor's redirect to another origin is sent no provider key
Go's http.Client follows up to 10 redirects to any host, https to http included, and on a hop to another domain drops only Authorization, Cookie and WWW-Authenticate. So a vendor (or anything answering at its URL) that redirected elsewhere got x-api-key, x-goog-api-key, api-key and a provider's own headers sent there; Authorization too when only the port differed, and all of them in the clear on an https to http hop on the same host. The class is fixed where the requests leave: - provider.KeepsCredentials is a CheckRedirect that follows a redirect only to the request's own origin (scheme, host, port; or http to https on the same host and default ports), at most 10, and gives any other 3xx back as the answer (http.ErrUseLastResponse). - provider.Keyed(c) is a copy of c with c's own CheckRedirect, then KeepsCredentials. Provider.do, the choke point of every p.Do, sends through it, and every http.DefaultClient.Do in internal/provider that carries a credential is Keyed(http.DefaultClient).Do. A copy per call, since netproxy.Install sets the default client's transport at run time. Left alone: Grok's public download, Antigravity's version URL and cline.go's unsigned read. - the gateway's client (s.client, every vendor call), the Codex relay's and the Codex websocket's take KeepsCredentials, and so does chatgpt_api's siwcClient. The native route needs nothing more: the vendor's 3xx comes back to the caller as it came, Location included, and the caller decides. Translated routes don't follow either, rather than following with credentials stripped: it is the rule search_api.go had already (#1580), no vendor magpie speaks to was found redirecting its API to another origin, a stripped request elsewhere would only fail with a confusing 401, and the vendor-URL downloads (video, images) are fetched unsigned through vendorClient, so they are not affected. Tests: TestRedirectKeepsTheKeyAtItsOrigin (307 and 302 elsewhere with Authorization, x-api-key, x-goog-api-key, api-key and a custom header; a same-origin redirect followed with every key; three clients), TestRedirectNeverDowngrades (an https vendor's redirect to http on its own host and port), TestSameOrigin, TestKeyedKeepsTheClientsRule, TestNativeRedirectKeepsTheKey (Anthropic and Gemini providers with an own header) and TestChatRedirectKeepsTheKey. Broken by hand: with Provider.do back on client.Do and s.client without CheckRedirect, the thief got every key header, /away answered 200, the https vendor's /plain was followed (400 from the TLS port spoken to in http), the native route's claudeish and gem answered the thief's {"stolen":true} with Authorization, X-Api-Key and X-Relay-Secret sent there, and the chat route sent Api-Key, Authorization and X-Relay-Secret to it. TestSameOrigin and TestKeyedKeepsTheClientsRule don't depend on the wiring and passed. Run on mote at the pushed head 883690a0b (this commit and the next, on origin/main |
||
|
|
cd77c725d2 |
check-in: a plugin's failed with a later until waits for it (plugins#503, plugins#793)
A plugin's check-in can answer failed with an until hours away: ZCode
rate limits a claim read, and its plugin (plugins#793) says when to ask
again. magpie asked any failed again after 30 minutes whatever the until
said, the half hour that kept the limit on (#503: "gift plans to claim:
Too Many Requests" 180 times over four days). A review probe on
origin/main
|
||
|
|
19c45d5d4e |
gateway: a vendor's error on the client's own API keeps its status, type, code and fields
ne9ko9 on Discord: an error from a vendor that speaks the client's own API was rebuilt from its status. writeVendorError (via writeErrorSaid) set the type from the status, kept only a string code and param, and dropped every field magpie doesn't know (a numeric code, request_id, extra). That happened in the native relay's error branch (gateway.go), passthrough, translate's and streamTranslated's. Now writeVendorErrorFrom checks the upstream's error shape. When it is the client's own (Chat/Responses to Chat/Responses, Anthropic to Anthropic, Gemini to Gemini) and the body is a JSON error object with a string message, the vendor's status, Content-Type and bytes go to the client, except error.message. Only the message is magpie's: the provider's name before the vendor's words, as before. A describer asking for another model, the Claude sign-in's rewording (claude_signin.go) and the agent read which provider said it there, so taking the name out broke them. The message also carries a note where magpie has one (an account's Explain, a region, the wrong endpoint), a busy relay said so (saysBusy) and a 413's byte-limit hint. A prompt too long for the model (tooLong) is said as the client's API says it: status 400 and type/code, or Gemini's code/status, so the agent compacts. setErrorField splices each change in place, so every other byte is the vendor's. A non-JSON body, or one from another API, is rebuilt as before. For the vendor's message untouched too, the next commit's errors=pass sends the body byte-for-byte. Tests (internal/gateway/kept_error_test.go): - TestSameAPIErrorKeptAsSent: literal bodies with numeric codes (1214, 20031) and extra fields (extra, details, request_id, param) on Chat, Anthropic (403) and Responses. Exact bytes and status. - TestSameAPIOverflowKeepsTheRest: a Zhipu-like 1261 overflow keeps extra and request_id, with code context_length_exceeded. - TestOtherAPIErrorRebuilt: an Anthropic client to a Chat vendor. - TestSetErrorField. Run: - Broken by hand: the new gateway tests copied onto origin/main |
||
|
|
251cce2059 |
usage: a click on All N accounts folds that provider's accounts under it (justfreefall on X)
justfreefall on X (CODEX (2), "既然已经有汇总信息了,能不能出个按钮把下面两个折叠?"): the All N accounts strip already sums the accounts, so its accounts can go. The strip gets the per-account card's own chevron (quota-acct-fold, aria-expanded, Fold/Unfold title, no new strings). A click on the strip or the chevron, or Enter/Space on the chevron, folds that provider's account cards in the Usage page and in the tray panel's Allowances; again unfolds. Default open. Kept per provider in localStorage magpie.usageAllFolded beside the other view choices, and a storage event redraws the other window. The head's "Show ..." button stays in its room, hidden and inert, so the strip does not move under the pointer. A menu-bar cell that asks for one folded account unfolds them first (focusQuotaCard). quotaall.js reads the choice on first use, so loading it touches no app.js global (usage-merge runs it in a bare vm). Core script budget: not raised. app.js +35 bytes, met by shortening comments. Run (mote, macOS 27, unless said): - go test -tags nogui ./internal/gui/: ok at the rebased head (130s); Budget tests again after the last edit: ok. gofmt -l: clean. - usage-all-fold.test.cjs (new): 10/10, chromium + webkit x en zh zh-TW ja de, window 440x520 and panel 360x760. Broken by hand: with main's assets it is red (no .quota-all-fold). - usage-merge, usage-all-fold, tray-cell-click, quota-caption-contrast, old-webkit after the last edit: all ok except tray-cell-click 4/4, red the same at origin/main |
||
|
|
37c1bc043b |
agent: a group whose members all serve Responses, one best there, is asked on Responses
zyh6036 on X: several subscriptions that all serve the Responses API were asked on Chat once they were put in a routing group. Pi, OmO, omp, StepCode, droid, dsh, Hermes, Grok CLI and the live agents ask each model on the one API catalog.Model.APIs names, and a group had Responses only when every member's Native was Responses (allResponses, #1594). A relay that serves Chat and Responses, best on Chat (no Base URL API given, not OpenAI's own host), counts as Chat there, so one such member put the whole group on Chat, and the gateway then translated Chat to Responses for the ChatGPT, Copilot GPT or Responses-relay members. Found groups (auto-<slug>) hit this without the user doing anything: a new relay that also lists gpt-5.5 moved auto/gpt-5.5 from openai-responses to Chat (pi_api_test shows it). provider.GroupAPI now gives Responses when one member is best on Responses and every other takes a Responses request as it is (Responses among the APIs it relays), or translates every request anyway (a Claude Code subscription). So no member is translated that Chat would have relayed, and the ones best on Responses are relayed, not translated from Chat. The gateway already relays a /v1/responses request to each member that serves it (usable), so nothing changes there. Mixed groups: a member that Responses doesn't reach (a Chat-only key, a Messages-only Claude) keeps the group on Chat, where that member is relayed; picking Responses there would translate it on every turn. A Messages-only group stays on Chat as before (#1594's reason: a Claude member's thinking is known by its own model id, not the group's). An agent plugin's connect is told a group's native_endpoints now (provider.GroupEndpoints: the APIs every member relays), where it had none. /v1/models still leaves them out for a group: TestRemoteMagpieNativeAPI holds that a remote magpie sends a group's request on in the client's API for the other side to pick per member. No setting added: the group's API follows from its members. Run (mote, through mote-run): - go test ./... -timeout 45m at 65780f04f on |
||
|
|
64b563cee8 |
gateway: the MCP router keeps Magpie Browser, the image server and other routers to this computer
A gateway key from another computer (LAN, tunnel, or a proxy here) or a web page could reach, through /mcp/magpie/hub, servers that act as this computer's user: - Magpie Browser, which /mcp/magpie/browser itself refuses to such a caller, so a LAN key could drive the user's signed-in browser; - magpie's image server, which draws with this magpie's own token, past the key's model, account and spend holds; - another magpie's router, which passes calls on to its own browser. These are now HereOnly (keepsSession or isSelf in the library) and are neither listed nor run for an away caller. The check sits both in the gateway (hubServersOf, hubTools) and in the library (visitorServers, Call), so a call by name is refused too. A held key (nativeHeld) from another computer also no longer gets programs run here (stdio commands, plugins), only HTTP servers elsewhere. Local callers are unchanged. The mcp-router subsystem page says both rules. Run on mote (macOS 27) at this tree, base |
||
|
|
fe61503e60 |
provider: a Remote magpie whose computer took another address is found on the network
luckymanjc (Discord) uses computer A's magpie from computer B over the
LAN. A's router hands it a new DHCP address after a boot, and B's Remote
magpie, saved at the old one, reached nothing until the address was
typed in again.
When B can't connect to a Remote magpie at all (a dial error, not an
answer), the list fetch (models.go) and the gateway's request (forward
in gateway.go) now call provider.SeekMoved (remote_moved.go). It dials
every address of the old one's /24 and of up to four of B's own private
/24s at A's port (500ms each, 128 at once). The first that lists
/v1/models 200 for the provider's key, and whose list this magpie didn't
make (magpie_via), is A: a LAN caller always needs a gateway key, so
another magpie answers 401. That address is saved as the provider's and
the request is made again there. A name or a public address is never
looked around, an address the user changed meanwhile stands, and a
provider is looked for once a minute at most, callers at once sharing
one look.
Run:
- mote-run go test -count=1 -run 'TestRemoteMagpie|TestLANNeighbours|TestDialable|TestRemoteSelf' ./internal/provider ./internal/gateway: ok
- mote-run go vet, GOOS=windows and GOOS=linux go vet of both packages: ok; gofmt -l clean
- Live: A was a real magpie on mote (10.0.0.121:3511), B a -tags nogui
build in WSL magpie-desktop (127.0.0.1:3522), sandbox HOMEs. B's
provider was saved at the dead 10.0.0.250:3511. B's start fetch found
A ("found at 10.0.0.121:3511, saved there") and a chat answered 200 in
4.2s. Then, with B running, the address was set dead again: a request
to office/group/rot found A and answered 200 in 4.4s, saved at .121.
Broken by hand, each red: the gateway hook off (502), the fetch hook off
(fetch error), the self check off (saved at this magpie itself).
Not tried: a real Windows A; a mDNS name (.local) that changed address
(left to the name); A on a different /24 than B. On Linux a dial to a
dead LAN address took ~54s (no route to host) before the look starts;
not changed here.
Reported-by: luckymanjc. (Discord)
|
||
|
|
49c9491b73 |
update: the Windows app asks where to install, the first time
The Windows exe opened from Downloads (or the Desktop, or temp)
installed itself into %LOCALAPPDATA%\Programs\magpie without a word.
Now, the first time, with nothing installed yet, Windows' task dialog
asks "Install magpie in this folder?". It shows the folder and offers
Install, Change… and Cancel, in the tray's language (en, zh, zh-TW,
ja, de).
- Change… opens the system folder picker. A picked folder gets
"magpie" added unless it is already named that (update.InstallDir).
- A folder other than the default is recorded at HKCU\Software\magpie
InstallLocation. So the next exe downloaded replaces the copy there
in place and asks nothing (installed(), forwards()).
- Cancel runs the exe where it is, as a portable copy, and nothing is
recorded.
- Uninstall forgets the record (update.ForgetInstallDir, a new System
step).
- The shortcut, App Paths, autostart, magpie://, the PATH entry and
self-update already take the running exe's folder, so they follow
the choice.
Program Files and other folders only an administrator can write to
are refused in the dialog (update.Installable test-writes and maps a
permission error to ErrNeedsAdmin). They are not elevated into.
magpie installs per user (HKCU Run, the user's PATH), and its
self-update replaces the exe without elevation (CanElevate is false on
Windows). So an admin folder would make every update fail, or would
need a UAC prompt on each one. A downloads folder is refused too.
Refusing is the simplest correct choice: it costs a user nothing they
had before, and keeps updates silent. Any folders the test-write made
are removed again.
Docs: gui-shell.md, "Where Windows installs magpie".
Run (mote, at this head on origin/main
|
||
|
|
f9e6061b85 |
claude: claude-magpie runs Claude Code through magpie, a plain claude left on the user's account
baranwang on X (11-06): `claude` stays on the user's own Claude account, `claude-magpie` goes through magpie, and nothing is switched back and forth. `claude-magpie` runs `magpie claude run [args…]`. That writes a settings file of magpie's own, <config>/claude-launch/settings.json, connected as Connect connects Claude Code (the gateway, its key, the shared LAN key when sharing is on, the model, the tiers) and starts `claude --settings <file> args…`. Claude Code puts a --settings file's env and model over the user's settings.json, a claude.ai sign-in and the shell's variables (tried on 2.1.318), so ~/.claude/settings.json is never rewritten. ANTHROPIC_API_KEY and the cloud switches (Bedrock, Vertex…) are blanked in the file, so neither the user's file nor the shell can take a request past magpie. The file is the agent `claude#launch`, listed nowhere: the Agents page, Check and Notice see only the user's file. It is set again when the gateway moved or its key changed. - /model in a claude-magpie session saves to the user's settings.json (Claude Code never writes a --settings file). After the session a magpie model picked there moves into the launch file, for the next claude-magpie, and the user's file gets its model back. A Claude alias (sonnet) stays. - Claude Code's own one-time `opus` -> `opus[1m]` rewrite of the user's file (migration_opus_to_opus1m), which the launch file's 1M opus tier sets off, is undone the same way. Found in the end-to-end run below. - claude runs as a child so that can happen: on Unix a stopped child stops magpie too (^Z, fg; proc.WaitFollowingStops reaps it with WUNTRACED, as cmd.Wait can't see a stop), and claude's exit code is magpie's. On Windows magpie ignores Ctrl+C while claude has it. - The command: a launcher beside the `magpie` command. Settings › Command line (AddCLI) writes it; `magpie claude launcher [add|remove]` adds it for a command put there before. It is a `#!/bin/sh` exec of magpie's stable path, or on Windows a .cmd running "%~dp0magpie". A file by that name without "written by magpie" is never written over. - Docs: agent-wiring.md, and the start page in en/zh/ja. Run at this commit (rebased on origin/main |
||
|
|
11df525f06 |
gateway: only the vendors seen to hide an overflow have a bare failure told as too long (#5486)
NEKO-CwC asked, after v0.1.3141, why a custom API-key Responses relay's 400/413/422 is still turned into context_length_exceeded when the relay never said so. It shouldn't be. tooLongUnsaid read any provider's 400/413/422 that said nothing of length, for a request 1.2 times past the model's window, as "prompt is too long". That rule came from three vendors' refusals in |
||
|
|
e8df78f33e |
routing: a dsh fork's requests are named by the reply its client was given (#5491)
dsh's chat and messages routes send no session id, so Routing and Context found a dsh session by the hash of the conversation's opening. A fork repeats its source's opening, so every request the fork made showed under the source, and the fork's name never appeared. Flandern1211's patch, ported: - The gateway keeps the id of the reply it gave the client (Route.ResponseID). It is set from clientResponseID in the same update that marks the route done, so a poll that sees Done also sees the id, with no race against the usage ledger. When magpie translates, it is the id after translation, e.g. chatcmpl-…, not the upstream's msg_…. - sessions reads dsh's replayState.response.responseId into Session.ResponseIDs. Only main files are read, only replies served by the gateway, and only the fork's own replies after its session/end-seed (seedLength for version 1). - Routing (pricedRoutes) and Context (joinConvs) look up a finished request by its reply id first, then by its opening. A request logged before this keeps the opening's session. Changed from the patch: - A reply id names a session over the opening only when the opening is that session's own, or a session it was forked from, or the opening is unknown. Vendors' ids can repeat: an encoder keeps the upstream's id, and Ollama's is chatcmpl-<0..999>. Without the guard, two unrelated conversations could swap names. Session.ForkOf comes from the fork header's parentSession, isSeeded and delegationDepth 0, which is how dsh's buildForkSeed writes it. ownerOf walks that chain, so a fork of a fork works too. - Poll cost: dsh never writes down some reply ids (a title call, a refused turn). Under the patch, each such id made Routing list every session again every 2s, for as long as the route was on the page. Now an id is waited for only up to a minute (convsKept) after its request ended (looseKeys). After that the regular one-minute rebuild covers it. - A page whose loose routes carry only a reply id still builds the map (looseRoute). - The patch's synthetic fork headers gain parentSession, as dsh writes them. - docs/subsystems/gateway-routing.md describes the reply-id join. Tests: - TestDshForkNamedByTheReplyTheGatewayGave sends dsh 0.2.0-rc.2's real captured completions request (testdata/dsh-gateway) through gateway.New() twice, to an Anthropic-only upstream, so the reply is translated. It writes the source's real session file with the first client id, and a fork shaped like dsh's buildForkSeed output with the second. It then checks that pricedRoutes and contextOf put each request under its own session, and an old route without an id under the source. - TestDshForkOfARealSessionListsItsOwnReplies forks the real fixture session: the fork lists only its own reply and ForkOf, the source keeps [c1]. - TestDshReplyIDOfAnotherConversationNamesNoOne covers the guard. - TestRoutingWaitsForAReplyIDOnlyAWhile covers the poll bound. - The patch's own tests: TestDoneRouteKeepsTheClientResponseID (json and stream), TestDshResponseIDs*, TestRoutingTellsAForkByItsReply, TestContextTellsAForkByItsReply. Run on mote (mote-run), at this tree on origin/main |
||
|
|
b020ae1022 |
agent: Claude Desktop 4.23118.0's gateway window still has no Chinese (xwoffice)
xwoffice on Discord: "Claude Desktop 接入以后界面会变成英文 取消了又恢复成中文".
Nothing changes in behaviour; this records that the cause is still
Desktop's, in the newest release too.
On magpie, Desktop runs in its 3p mode, whose window is its bundled UI.
Read from Desktop 4.23118.0 (darwin RELEASES.json currentRelease,
published 11-05, downloaded and unpacked, not run):
- Resources/ion-dist.asar's i18n has en-US de-DE fr-FR ko-KR ja-JP es-419
es-ES it-IT hi-IN pt-BR id-ID, no zh. Its supported list in
assets/v1/shared-99 and shared-67 is the same 11, and the window maps
navigator.languages onto them, else en-US, then calls
electronIntl.requestLocaleChange with that pick on mount.
- app.asar's resources/frame/shell/i18n/frame-shell has the same 11.
- app.asar's resources/i18n has zh-Hans and zh-Hant, for the signed-in
(claude.ai) window only. So disconnecting brings Chinese back.
magpie carries the signed-in "locale" into Claude-3p/config.json
(desktopCarryLocale), but Desktop writes its own pick over it at every
start. Nothing magpie can write keeps Chinese there, and magpie doesn't
patch Anthropic's signed app. Chinese readers are told so on the
Agents row and in the switch-on notice since v0.1.2123 (
|
||
|
|
ff415f39cb |
gateway: a compaction refused for an input kind it doesn't take is asked again as text (#5181, #5259)
Command Code's /responses takes messages, function calls, their outputs and reasoning only. A Codex subagent's compaction carries agent_message, custom_tool_call and compaction_trigger items, and Command Code answered 400 unsupported_input_item (param input). codexCompact didn't count that as a reason to ask again with the conversation as text, so the 400 went back to Codex three times and compactFails held the conversation for 5 minutes. inputKindRefused now asks again as text on unsupported_input_item or "unknown item type" (Grok's 422) in a 400, 422 or 502 (another magpie in front wraps it), or in a stream's error / response.failed event. A 401, 403 or 429 with the same words still goes back as it came. itemText reads an agent_message as the user's turn, so the subagent's task and follow-ups are in the text summary and in the local one. No plugin change: the Command Code plugin passes /responses through, and the fallback covers it direct, through a remote magpie and in a stream. Run (mote): - go test -run 'TestCodexCompact|TestCodexCompacts|AgentMessage' ./internal/gateway: ok - go test -timeout 45m -count=1 ./internal/gateway: ok (809.6s) - gofmt -l clean; go vet ./internal/gateway native, GOOS=linux -tags nogui and GOOS=windows: ok Broken by hand: - origin/main's codex_backend.go: every AsksAgainAsText subtest red (400 / 502 back to Codex). - agent_message case removed: the text lacks the subagent's task. - status guard loosened: the 401/403/429 test red. Not tried: a real Command Code account (the keys on this machine are answered 401), the reporters' own sessions; why the compaction reached /responses rather than chat is not confirmed. Reported-by: Mmx233 <36563672+Mmx233@users.noreply.github.com> Reported-by: Edward4226 <Edward4226@users.noreply.github.com> Reported-by: mahiro233 (Discord) Co-authored-by: Mmx233 <36563672+Mmx233@users.noreply.github.com> |
||
|
|
0ad0f42411 |
gateway: Ollama's options reach no Chat upstream, so Hermes Agent's requests to Mistral are not turned away (lijiho96940561 on X)
Hermes Agent pointed at magpie (provider "custom", base URL on this
machine) probes the server as Ollama: detect_local_server_type GETs
/api/tags, which magpie answers in Ollama's shape for VS Code's Copilot,
and the body has "models", so it is "ollama". agent_init_ollama.py then
asks /api/show for the model's context and the custom profile sends it as
extra_body {"options": {"num_ctx": N}} on every chat request
(plugins/model-providers/custom/__init__.py, NousResearch/hermes-agent
90d6b98f). magpie relayed that top-level options to Mistral as it came,
and Mistral's chat API forbids extra fields: 422 extra_forbidden on
["body","options"] for every request. Mistral's own request model
(mistralai/client-python d3da3bd, ChatCompletionRequest) has no options;
it does take reasoning_effort "medium", the other field Hermes adds.
|
||
|
|
4c8e1cfdfc |
providers: a Remote magpie's MCP servers go to the Library only when switched on, and follow its rename
treeman_26897 (Discord) on v0.1.3127's bridge MCP auto-discovery: - Renamed (name and id), a Remote magpie's auto-added MCP server went: adoptBridges keyed it on the provider id, and after provider.Rename that id is gone, so the server was taken out as the provider's. Now RemoteHub carries the provider's Was, and adoptBridges moves the server's bridge, bridgesOn and bridgesOffered from an id it had to the id it has (one that another provider has now stays that one's). The server keeps its name. - The add dialog had only the address and key. A new Remote magpie's editor has a Name and an ID under the key; blank, they are the preset's as before (provider.Add numbers them when taken), and the ID follows the name until one is typed. - Adding its MCP servers is opt-in: a switch, "Add its MCP servers to the Library", in the add dialog (off) and in a saved one's editor. It lives in library.json (bridgesOn); /api/providers says it as libraryMCP and the save takes it (library.SetRemoteMCP). On asks the remote at once (provider.AskRemoteHub) when no model list is fetched on that save; off takes its server out. Only one switched on is asked (bridgeWanted). A server auto-added before this (no bridgesOn) is kept, and its switch shows on. A server removed in the Library turns its switch off; the provider gone takes its switch with it. Run (mote, at this tree): - go test ./internal/library ./internal/provider ./internal/gui: library ok; provider ok but TestRenewLoginsKeepsClaudeReading (#5481, red the same at the base); gui ok but TestMainWindowCorners (#3949). The first gui run had TestCoreScriptBudget red (app.js over by ~1.2KB); the new code was made compact and seven editor comment blocks cut to one line each. Rebased on |
||
|
|
ee91d86ea0 |
provider: a custom provider can be held to HTTP/1.1, and a TLS record error on HTTP/2 moves its host there
kepner_53726 (Discord, magpie 0.1.2926): a custom Anthropic provider at a
company intranet gateway failed 124 turns in 3 days mid-stream with "tls:
bad record MAC" / "received record with version eaf1", each a 200 with 0
output tokens, until a restart; a plain Go 1.26.8 client to the gateway held.
Cause: none found in magpie. The bytes are read by stdlib crypto/tls, and
every conn wrapper on the path only passes them through, so a record whose
MAC fails was mangled before it reached us: by the gateway or a box between
(the system proxy route, a TLS-inspecting middlebox). HTTP/2 meets it far
more than one-off clients do: one long-lived connection carries every
stream, plus magpie's health pings (netproxy.HTTP2Health), so a gateway
that interleaves its writes racily breaks it.
- Provider.HTTP1 ("HTTP version" row, "HTTP/1.1 only" tick, under the
editor's Advanced; shown for a provider of the user's own at an https://
address, the same set InsecureTLS takes). Via adds netproxy.WithHTTP1 for
its own base URLs' hosts; Dispatch sends those over its HTTP/1.1 copy.
Another host, and a request made for another provider (With), keep HTTP/2.
Save refuses it on a preset's; a save that leaves the key out keeps it.
- With no setting: a TLS record error read on an HTTP/2 reply (h2Watch) or
round trip marks the host:port, and Dispatch speaks HTTP/1.1 to it for 6
hours. Go's transport already drops the broken connection. Zero-config
default otherwise unchanged.
- Advanced opens by itself when the tick is set. No note under the row
(the core script budget, not raised).
Run (mote, at
|
||
|
|
1ccad582d8 |
library: a skill the user has in ~/.agents/skills under another folder or with other files is not given a second time
math_milian (Discord #feedback, 11-06) still saw skills twice after |
||
|
|
cd9c52c16e |
library: a Remote magpie's MCP router is a Library server of its own
With another magpie as a provider (preset remote-magpie), its router's
MCP servers took adding that same magpie again under Library -> MCP.
Now the gateway's info (GET /v1) says "mcp_hub": true to a caller it
serves MCP to while its router is on with a server that isn't itself
another magpie's router. A fetch of a Remote magpie's models asks that
info with the provider's key, only while the library would still give
it a server, and the library then adds one: named for the provider,
http at <root>/mcp/magpie/hub with Authorization: Bearer <key>, kept to
this computer (local), on for the agents given the hub's entry.
- Offered once (bridgesOffered in library.json): removed or switched
off by the user, it stays so until the provider is removed and added
again.
- A server the user already has at that magpie's router (same origin,
the router's path) is the one; none is added beside it.
- The provider removed takes its server out (adoptBridges, at Sync and
the View read); providers.json unreadable takes nothing out; the
provider's address or key changed changes the server's; edited to
another address or key it becomes the user's own (keptBridge).
- No loop: every dial to a URL under /mcp/magpie/hub carries
X-Magpie-Router, and a request with it is given no such server,
neither listed (library Tools, gateway hubServersOf) nor run (Call,
hubToolNamed). A server carried in by sync is never a bridge.
- No GUI change: it is a server row as any other.
Run (mote, at base
|
||
|
|
dd2be65656 |
gateway: a Responses request translated to Mistral carries its thinking as parts, not reasoning_content (#4906)
Codex on /v1/responses with a DeepSeek-named model served at Mistral (preset mistral or api.mistral.ai, here deepseek-v4-1-flash-1017) broke after its first tool call: the Chat build replays an earlier turn's thinking in reasoning_content for any model whose name says DeepSeek, wherever it is served (chatReplaysReasoning keys on the name), and Mistral answers that field with 422 extra_forbidden. The #494 fix converted it to Mistral's typed thinking part (mistralThinking) only on the Chat passthrough route, so /v1/chat/completions on the same provider answered 200 while every follow-up on /v1/responses was refused. forwardTranslated now runs mistralThinking on the body built for a Mistral upstream, with the same gate the relayed route uses. Other upstreams keep the #1462 replay (a DeepSeek at DeepSeek still gets reasoning_content), and the relayed route is unchanged. MystryMocha's nit: a whitespace-only thinking (the " " placeholder the replay gives a tool turn with no reasoning item) is now dropped instead of being sent as a blank thinking part. This applies to the relayed route too; Mistral accepts the dropped field (MystryMocha's raw table). Ported from skygunner's 29b0ea308 (branch fix/4906-mistral-translated-reasoning), on origin/main |