f5083e80416bf4cf91defaa2003e33de0ca8d5aa
521
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f5083e8041 |
gui: a gateway key's account menu says a provider none of whose accounts is picked is used, and how to keep the key off it (#2077, KKKKKKKEM)
A key held to some accounts (#905) is held to the accounts of the providers its list names; a provider it names none of is used on every account. The menu showed that provider's accounts unticked like any other, so the reporter unticked every Codex account, ticked the rest, and was surprised that the key's remote magpie still listed and served Codex's models. The rule stays as #905 set it (a key held to one Codex seat keeps its other providers). The menu now notes each account of such a provider "Used: no <provider> account is picked", and the badge's tooltip says a key is kept off a provider by picking only other providers' models. en, zh, zh-TW, ja, de. Verified: - gateway-key-accounts.test.cjs (chromium + webkit, en + zh) checks the note on OpenAI's key under a key held to a Relay account, Relay's unpicked account still noting its provider, the tooltip, and a key held to no account showing neither. With the old keys.js it fails: expected 'Used: no OpenAI account is picked', actual 'OpenAI' (and the zh equivalent). - gateway-key-*, gateway-keys-off, i18n-keys, gui-zh-tw, gui-ja, gui-de in chromium and webkit: 62/62. - The menu at 420px in German (chromium) and Chinese (webkit): no horizontal overflow, the note wraps inside the menu. Not run: the whole GUI suite. |
||
|
|
d53a51cdfe |
gateway: the key's own limit on a remote magpie still rests the whole remote, and #2077's case is tested across two gateways (#2077, KKKKKKKEM)
#2077: server B used server A's magpie as a Remote magpie provider. A's Claude Code hit its session limit and answered 429; B rested its one key to A until the reset, so a request for A's Qoder model was refused on B with Claude Code's 429 ("... (out of its allowance: not asked again before 10:55)") and never asked of A. |
||
|
|
c8b4ac7755 |
fix(catalog): honor models.dev reasoning toggles (#1294)
* catalog: honor reasoning toggles as off effort Include none when models.dev reports both a reasoning toggle and effort levels. Keep toggle-only entries level-less, and leave effort-only entries unchanged. Validation: go test ./... with GOFLAGS=-tags=nogui; all packages pass. The new catalog regression failed before the fix and passes after it. No vendor API request was made locally. * catalog: limit reasoning off to DeepSeek * catalog: include verified Kimi reasoning toggles * fix(catalog): keep off effort provider scoped |
||
|
|
dae2618ade |
gui: make the Routing context lazy and align wide cards (#1354)
* gui: make the Routing context lazy and align wide cards (#1354) Rebuild the context and wide-layout change on main |
||
|
|
9f8ad6edb8 |
gateway: the model's text between a batch's tool calls goes ahead of the batch's first call, so OpenCode Go stops answering "No tool output found" (#2100, eugene1003)
What: joinToolRuns (responses.go), which mends a relayed Responses
request's tool runs in attempt before every destination, now moves an
assistant message the model wrote between its own calls, before the run's
first result, to just ahead of the run's first call, together with the
reasoning items right before it (so a reasoning item keeps the item that
followed it). The reporter's Codex rollout was
[text, call_A, text, call_B, out_A, out_B]; it reaches the upstream as
[text, text, call_A, call_B, out_A, out_B]. Reasoning alone between calls,
hosted calls and anything carrying a call_id stay where they were (#1752's
review note), and V2 (text after out_A, between whole exchanges) and V3
(calls together) go byte for byte.
Why: magpie relays deepseek-v4.1-flash at OpenCode Go to its /responses
(models.dev names no SDK for it, so every API may be tried, and #1822's
turn shows Go's DeepSeek answering there). Go builds a chat form in which
an assistant message after a call opens a new assistant message, so the
first one's tool_calls were followed by no tool message: 400 "No tool
output found for tool call call_aaaa1111" - the same text joinToolRuns'
comment already lists for Go. The translation to a Chat upstream was
already right on main (joinSplitCalls + mergeTurns join the step into one
assistant message); TestTextBetweenABatchsCallsStaysInItsStep now guards
it with the reporter's shape. Native ChatGPT sign-ins don't go through
joinToolRuns. Moved plugins get the relayed body after attempt, so they
get the change too; no plugin translator was touched.
Run:
- TestRelayedTextBetweenABatchsCallsIsAnswered (V1-V4, fake upstream that
checks the exchange as Go does) and the new TestJoinToolRunsOnlyMoves...
cases fail on origin/main
|
||
|
|
5654c8187c |
agent: while Claude Desktop is on magpie, Explore inherits Desktop's mythos-magpie model instead of being capped to Opus (#2087, NeuroPaw)
Claude Desktop lists models with effort levels as mythos-magpie-* so its
effort picker shows. Claude Code 2.1.295's built-in Explore (model:
"inherit") caps its inherited model at Opus when the session model's family
ranks above Opus (pge/BHn: {inheritCap:"opus"}), so an Explore with no model
of its own went to Desktop's Opus default, a different route. Claude Code
skips that cap when CLAUDE_CODE_DISABLE_EXPLORE_INHERIT_CAP is set.
magpie now writes CLAUDE_CODE_DISABLE_EXPLORE_INHERIT_CAP="1" into Claude
Code's settings env while this machine's Desktop is on magpie (writeExplore
in claudeIn: Desktop alone, model picks and Sync), and removes it when
Desktop is taken off, only if it is still magpie's own "1". A value the user
had (an empty one too) or changed later stays. The stash key
claude.explore_inherit_cap marks magpie's value. WSL twins don't get it.
Checked in the installed Claude Code 2.1.295 binary (read only): the env is
read in pge() before the cap, and it is not in the set host-managed sessions
(CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST, Desktop's Code tab) drop from settings
env (eu: oV, N$, F$, hdt model list, ... none hold it), so Desktop's Code
tab honours it. Renaming the alias was not chosen: Desktop's effort picker
needs it. The settings file is shared, so a terminal Claude Code session on
a real Fable model also inherits without the cap while Desktop is on.
Patch by NeuroPaw (1b480ef3), applied unchanged.
Run (sandbox HOME, pinned GOMODCACHE, private GOCACHE):
- TestClaudeDesktopExploreInheritCap, TestClaudeDesktopExploreKeepsUserValue
pass. Broken by hand four ways, each a real FAIL: no write ("value "",
present false; want "1", true"), overwriting the user's value ("user's
Explore value "0" lost: "1""), never removing ("value "1" ... want "",
false"), removing a value that isn't magpie's ("user's Explore value "0"
lost: """).
- go test -tags nogui ./internal/agent (1337s, load ~260) and
./internal/agentenv: ok. An earlier run of internal/agent hit the default
10m timeout under that load; with -timeout 45m it passed.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
internal/agent; GOOS=linux -tags nogui and GOOS=windows go build.
Not tried: a real Claude Desktop Code session with the built magpie; the
full go test ./... suite.
Co-authored-by: NeuroPaw <link_xin@163.com>
|
||
|
|
caa5367336 |
gateway: a remote magpie's quota, credit or rate refusal rests only that model, not the whole remote (bigsteven on Discord)
A Remote magpie provider (LAN share) serves every model through one key. When it answered 429 "usage limit … resets in 3 hours" for one model, the key rested whole for those 3 hours. A group then never moved on to the remote's other models that still had quota, and the user had to ask again by hand. The remote magpie rests its own providers' models itself, so one model out of quota there says nothing of its others. remoteModelRest: on a Remote magpie provider, failQuota, failCredit and failRate rest c.restID() (the model) in restAfterMarked and rateRest. A refused key or an unreachable computer still rests the whole remote. Run: - TestRemoteMagpieQuotaRestsTheModel, against a fake remote whose codex model answers 429 quota, glm 429 rate, and kimi OK. A direct request, then two groups. It fails with remoteModelRest taken out. - go test -tags nogui -count=1 -timeout 30m ./internal/gateway: ok. - gofmt -l is clean. go vet passes on darwin, GOOS=linux -tags nogui and GOOS=windows. Not tried: two real computers on a LAN share. |
||
|
|
c77d198a81 |
gateway: a Google account's Code Assist 404 for a model rests that model, not the account (Packing1 on Discord)
Google's fetchAvailableModels lists models the account's plan doesn't serve (Argon on Google AI Pro). Asked for one, Code Assist answers 404 NOT_FOUND "Requested entity was not found." Its endpoint is the same for every model, so what is missing is the model, but the 404 counted as failOther and rested the whole Antigravity / Gemini CLI account, taking its other models down with it. codeAssistModelMissing (built-in antigravity/gemini accounts only, not a plugin) makes that 404 "unserved": only that model rests on that account, and the request moves on to the next candidate. Run: - TestCodeAssistMissingModelRestsTheModel. It fails with the check taken out, because the account rests. - go test -tags nogui -count=1 -timeout 30m ./internal/gateway: ok. - gofmt -l is clean. go vet passes on darwin, GOOS=linux -tags nogui and GOOS=windows. Not tried: a real Google AI Pro account, or the real 404 body. The fixture's body follows Google's documented NOT_FOUND error shape. |
||
|
|
79f64f028e |
gateway: Claude Code's advisor goes to a relayed Claude upstream under the upstream's own model name, or is left out (JackChou on Discord)
Claude Code (2.1.299, seen against a fake server in a sandbox HOME) declares
the advisor as Anthropic's server tool {"type":"advisor_20260301",
"name":"advisor","model":"claude/claude-opus-5-5"} with the beta
advisor-tool-2026-03-01. The model is magpie's id, which no vendor knows,
so a relayed Messages request carrying it was refused whole.
passthrough now runs advisorTools on Anthropic upstreams. An advisor model
that is one of the same provider's Claude models goes as that upstream's
own name for it (the wires, as the request's own model). So does a bare
Claude id that names no provider, and the [1m] mark is dropped. An advisor
the upstream can't run (another provider's model, a group, a model that
isn't Claude), and every advisor when the request's own model isn't
Claude, is left out. If no tools are left, tools and tool_choice go too.
Translated routes already drop server tools (anthropic.go). The Claude
subscription's bridge declares only magpie's tools, so it never has an
advisor. Nothing is sent to Anthropic with a user's token.
Claude Code's own gate: without CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL=1
it sends no advisor for a model with no advisor rank in its catalog ("Switch
to a public model alias (opus, sonnet, fable)"). That is unchanged here.
Run: TestAdvisorModelAsTheUpstreamNamesIt (same provider, [1m], bare
Claude id kept, another provider left out, vendor model left out, other
tools kept). It fails with advisorTools taken out of passthrough.
gofmt -l clean. go vet for darwin, GOOS=linux -tags nogui and GOOS=windows
on ./internal/gateway. go test -tags nogui ./... under a sandbox HOME at
load ~90: every package passed except agent and gateway, which hit the
10m timeout, and TestCopilotSecretToolUsername (its two 5s secret-tool
waits ran out under that load). Rerun with -timeout 30m, gateway, agent
and provider all pass.
Not tried: a real Anthropic or relay upstream, and a running magpie with
real Claude Code end to end.
|
||
|
|
88ce2cdd4c |
gateway: a web search's query is masked before it goes to a search API, Kimi Code's or WorkBuddy's search (lc on Discord)
lc on Discord: "mcp 搜索出去的脱敏了吗?" A searcher model is asked through serve, which masks its request, and the image and vision MCPs go through the masked routes too. But the search APIs (Tavily, Brave, Exa, Firecrawl, SearXNG, ...), a Kimi Code plan's search service and WorkBuddy's search were sent the query as it came. A model's own web_search writes its query from a request already masked, but an agent's call to the search MCP carries the query as the agent's model wrote it, with the values put back, so a secret or phone number in it went out as written. maskedQuery masks the query, as Settings say, where it leaves magpie for each of those three (a plan the user set to go unmasked, SkipsRedaction, keeps it), and searchMCPRun puts the values back in what it returns to the agent. Scoped by where the value goes (the query field of a search service's request), not by a key's name. Run: TestSearchQueryMasked; each of the four changes removed alone turns it red (search API, Kimi, WorkBuddy asked the phone number; the agent got the placeholder back). -run 'Search|Redact|Kimi|WorkBuddy|MCP' over internal/gateway (sandbox HOME); gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows. docs/subsystems/gateway-routing.md says it. Not tried: a real search API or a real agent's MCP call. |
||
|
|
2fbbd16945 |
gateway, gui: routing history keeps the last two levels of the folder an agent works in, and By session, the stage and the panel name it (#1068, emo172)
Routes now carry Folder: the last two levels of the working directory the agent states (Claude Code's "Primary working directory", Codex's <cwd>, Pi, OpenCode), cut by shortFolder before the route is stored, so no full path reaches the routing history, /api, or the GUI. It is kept in the routing history for as long as the history itself (30 days / 200 MB). A request that states no folder (title, side calls) takes the folder its session (or parent session) last stated; the per-session map is capped at 512 entries. GUI: By session headings read "Agent · folder · title", their tooltip and every request row's tooltip (page and tray panel) name the folder, the stage's agent subtitle lists the last level of each folder when an agent works in more than one, and the panel's agent node tooltip lists them. Run: - TestShortFolder (unix, trailing slash, C:\, D:\, UNC, CJK with spaces) and TestRouteKeepsItsFolderShort (real Handler, fake upstream: session inheritance, a moved Windows path, nothing of the full path in the marshalled routes, saveRoute -> History round trip), TestTurnDone. Broke it by hand: without the session lookup the title request has no folder; with the folder unshortened the full path shows. Both go red. - routing-session-folder.test.cjs: chromium + webkit x en, zh, zh-TW, ja, de x 1100 and 420 px, 20/20. Red on the old routing.js and with the stage's live routes left out. - GUI suites routing-*, panel-routing*, purpose-filter, reasoning-speed, gui-de/ja/zh-tw, click-scroll, number-units: 951/951. - gofmt -l clean; go vet darwin, linux (nogui), windows; builds for all three. go test -tags nogui ./...: all ok except internal/gateway, which hit go test's default 10m timeout at 611s on a loaded machine (#2108); alone with -timeout 30m it passes in 356s. - Real use: nogui build in a sandbox HOME, fake upstream, real Claude Code 2.1.299 (claude -p) run from .../workspace/magpie and .../src/dial: the day's routing jsonl has folder "workspace/magpie" and "src/dial" and no part of the sandbox path above them. Not tried: title/side requests' inheritance end to end with a real agent (claude -p made none), Codex, OpenCode and Pi with real binaries, Windows. |
||
|
|
d9ca84a2f4 |
gateway: built-in TLS, magpie serve/web/daemon install --tls-cert --tls-key, reloaded on renewal (RoderickZH)
magpie serve, magpie web and magpie daemon install take --tls-cert <file> --tls-key <file> (or MAGPIE_TLS_CERT / MAGPIE_TLS_KEY). The gateway and the web UI on its listener then serve HTTPS to other computers. Without them nothing changes. - Half a pair, a file that doesn't parse, or a flag with no value is refused at start with a message naming the missing flag. - The pair is re-read when either file's mtime or size changes (certbot renewal), with no restart. A renewal that doesn't parse keeps the certificate already served and is logged once. - Other computers get HTTPS only. Plain HTTP from them gets net/http's 400 "Client sent an HTTP request to an HTTPS server". - This computer (loopback, or a peer address equal to the local one) may still use plain http on the same port. Its connections are sniffed on their own goroutine (a first byte of 0x16 is TLS) for up to 10s, so a silent client holds nobody else up. gateway.URL() stays http://127.0.0.1:<port>, which agents, MCP servers, ServedBy, the healthcheck and daemon status all use, and no certificate covers loopback. - WSL NAT and containers count as other computers. - ALPN is http/1.1 only (hijacked connections and websockets need it), with TLS 1.2 as the minimum. - Printed links, LAN addresses, publicURL, the serve/web banners and daemon install show https:// for other computers' addresses. - The DNS-rebinding Host checks (foreignPage, rebound, the MCP loopbackHost) don't depend on the scheme and are unchanged. - daemon install carries MAGPIE_TLS_* into the unit or plist. A reinstall or `daemon web on` that names no certificate keeps the installed pair, and --no-tls removes it. - Docs: reference.md gets an HTTPS section that names Caddy as the alternative, gateway-routing.md gets a TLS row, and docker.html (en, zh, ja) gets the env rows. What was run: - New tests: internal/gateway/tls_test.go (others HTTPS-only, this computer both, a silent local client holds no other, renewed certificate served, CheckTLS, addresses, Relisten keeps TLS), internal/cli/tls_cli_test.go and daemon TestInstallCarriesTLS (linux and darwin, paths with space, %, & and "). - Each was broken by hand and went red: no wrap in listen, no reload, a synchronous sniff, a bad renewal dropping the certificate, http in publicURL or the pinned LANURLs, the carried entries removed, and keepTLS as a no-op. - Real use under a sandbox HOME, with a self-signed pair, on 0.0.0.0:3461: - Half a pair, a garbage certificate, a flag with no value, and the env set to half a pair each exit 1 with the message. - curl -k https://127.0.0.1 and https://<LAN IP>/v1/models with a key: 200. Plain http on loopback: 200. - The cert files were swapped for a second pair while it ran. openssl s_client then showed the new CN and serial, and curl --cacert with the new pair got 200. A junk key file then kept the second pair, logged once. - From the Windows box over the LAN: plain http got 400; https with the key got 200, and without it 401. - magpie web --addr 0.0.0.0:3462: https network links. From Windows, http got 400 and https with the key got 303. - gofmt -l clean. go vet passed on darwin, GOOS=linux -tags nogui and GOOS=windows. - go test -tags nogui for ./internal/cli, ./internal/daemon, and the TLS tests of ./internal/gateway and ./internal/gui: all pass at the rebased head. - Two reds in the full suite (`go test -tags nogui ./...`) are the same on origin/main f074996d9; both are filed: - TestGatewayHeldByAContainer failed 2 of 5 there (#2107). - The gateway package runs past go test's default 10m under load: 1208s on main and 1221s here, both passing with -timeout 40m (#2108). |
||
|
|
579de3baa0 |
agent: enabledModels lose a deselected model's entries after the catalog sync (#2055)
misaka9981: models deselected in a provider's editor left magpie's provider in Pi's models.json, but their magpie/<provider>/<model> entries stayed in settings.json's enabledModels, and Pi warned "No models match pattern" for each at every start. Pi's resolver (model-resolver.js resolveModelScope, 1.1.0) only warns, never prunes. After the sync writes magpie's provider block, an enabledModels entry that names one of magpie's models outright (no glob; a thinking level read off) whose model the block no longer has is taken out. As the entry may be the user's own, it is remembered in stash.json (<agent>.scope.gone) and goes back on the list's end once the model is offered again; a provider rename moves the remembered entries too and a disconnect forgets them. Globs, entries on other providers and on models still offered stay, in order, comments kept. A list left with nothing is removed (never written []) and made again when its entries come back, with the model picked meanwhile; a list the user removed isn't made again. When the agent's model list can't be read, nothing is taken out. The same holds for the siblings with such a list: OmO and Prime Agent (piLike), StepCode (config.toml; its wiring state's last scope follows, so a disconnect still puts the user's list back) and omp (config.yml's plain entries; folder-scoped entries are left alone). Run: - TestPiEnabledModelsLoseDeselected (pi, omo, prime-agent) with the reporter's provider and four models, beside the user's own entries (another provider at a level, a magpie glob, a model still offered at a level): deselect, select again, rename. TestPiEnabledModelsEmptiedAndBack: emptied and back; removed by the user stays removed; other providers' and globs' file byte for byte; an unreadable models.json prunes nothing. TestStepCodeAndOmpEnabledModelsLoseDeselected, StepCode's disconnect putting the original list back included. - TestPiEnabledModelsFollowRename and TestStepCodeEnabledModelsFollowRename keep a magpie/deepseekx/flash entry to show a rename leaves a name sharing a prefix alone; deepseekx is now a real provider there, as the sync would otherwise (rightly) take an entry naming nothing out. - Broken by hand, each red: Pi's, StepCode's and omp's Sync hook off; the put-back off; the rename of remembered entries off. - Real Pi 1.1.0 (@earendil-works/pi-coding-agent) under a sandbox HOME, `pi -p`: the stale exact entries gave the reporter's warnings; the list as pruned gave none. - gofmt -l clean; go vet darwin, linux -tags nogui, windows; go test -tags nogui ./... green on origin/main |
||
|
|
353464f161 |
gateway: a translated Anthropic or Responses reply that said nothing and counted no token is asked again, then fails, not completed (#2086, tensornull)
tensornull's Codex turn on an Anthropic-compatible proxy (baseAPI anthropic, claude-opus-5-5) ended as response.completed after 21s with no output: the route had status 200, no usage, no served model, no ttft. Codex took it as its turn's end (last_agent_message null) and didn't ask again. No usage and no served model mean the proxy never sent a message_start Claude would have (it counts the prompt and names the model), yet the stream said it ended (message_stop or a stop_reason), so 320af9858's replyEnds read it as whole and errEndedShort didn't apply. Now a reply from an Anthropic or Responses upstream (repliesCounted) that said nothing (no text, call, search or image) and counted no token at all (uncounted) is the empty reply #667 already handles for Gemini: asked again in place, then failed with "an empty reply (the model answered nothing; try again)", which Codex retries. Same in streamTranslated and the unstreamed translate path, for Responses, Messages and Chat clients. Claude's own empty end_turn (after a tool's result) counts its prompt and still completes, as does a Responses reply with usage and no output. Not changed: a reply passed through in its own protocol (Codex asking a Responses provider, Claude Code an Anthropic one) isn't read for this; the passthrough has no empty-reply rule at all, Gemini's included. Verified: - New stream_uncounted_test.go. TestUncountedEmptyReplyFails (message_stop only; pings then message_stop; message_start with no usage then a stop_reason; zero usage), TestUncountedResponsesReplyFails and TestUncountedEmptyReplyFailsEveryClient (Chat streamed, Responses and Chat unstreamed) all FAIL on the old code ("ended response.completed \"completed\", want response.failed", "status 200, want the empty reply's failure") and pass with the change. TestCountedEmptyReplyStillCompletes and the #1933 tests (TestWellFormedStreamsStillComplete, TestMalformed*) pass. - The full go test -tags nogui ./internal/gateway run failed only TestCodexHeadersReachKeyedRelay and TestStandaloneNativeAccounts, whose fake Codex backends answered response.completed with output [] and no usage, which the real backend never sends; their fakes now count tokens, and both pass. Run in a sandbox HOME with pinned caches; gofmt -l; go vet ./internal/gateway for darwin, GOOS=linux -tags nogui and GOOS=windows; GOOS=linux go build -tags nogui and GOOS=windows go build. - Not tried: the reporter's proxy or its real bytes (the report has none); the fixtures are the shapes its route record allows. Not run: the full go test ./... (only internal/gateway changed). |
||
|
|
e710c5accd |
gateway: the built-in Kiro tells Kiro where to cache the prompt (magpie-community/plugins#110)
plugins#110 ("kiro cli cache 率为 0"): a Kiro subscription read nothing
from its prompt cache. Kiro's generateAssistantResponse takes Bedrock's
cachePoint {"type":"default"} on a userInputMessage (the CodeWhisperer
streaming model in aws/amazon-q-developer-cli; Kiro CLI 2.27's model list
carries PromptCaching with up to 4 checkpoints), but neither the plugin
nor the built-in ever sent one. The plugin's fix is kiro 0.1.10
(plugins 386a2ba); this is the same for users who haven't moved.
buildKiro now marks the first message when there is a system prompt
(which it folds into that message) and the current message, the two
places buildAnthropic marks for Anthropic. gateway-routing.md says how
each Kiro path places them.
Run: gofmt -l (clean); go vet on darwin, GOOS=linux GOARCH=amd64 -tags
nogui and GOOS=windows for internal/gateway and internal/provider; go
test -count=1 ./internal/gateway ./internal/provider (ok; both isolate
HOME in TestMain). TestBuildKiroMarksTheCache fails with the current
message's mark taken out by hand, and passes with it back.
Not tried: a real Kiro account (none signed in here), so whether Kiro
then reports cache reads is for the reporter to confirm; kirocc#83 notes
Kiro often sends a metadataEvent with no token counts.
|
||
|
|
33da86c71a |
provider: removing a plugin sets its providers' model picks in providers.json aside, and adding it again puts them back (#2057, dawn1095)
A plugin's provider leaves a record in providers.json once the user picks its models: its id and nothing of its own (OnlyPicks). Removing the plugin left those records behind. Nothing listed them, `magpie provider rm` couldn't reach them, and a sync or backup asked for a sign-in to them on every run. RemovePlugin now finds the ids the plugin's providers are stored under (PluginID of each provider plugin.Listed gives for its spec), and moves the records with those ids that hold only picks into providers.json's new pluginLeft, under the plugin's package name. Left alone: - any record with an endpoint or a key (the user's own provider, whatever its id); - a built-in's ids (accountIDs) and "magpie"; - an id another installed plugin serves too; - everything, when the plugins' listing isn't known (no cache and no plugin-providers.json): unknown is not "none is the user's". provider.AddPlugin (CLI, GUI, backup restore) puts the set-aside records back, each one whose id has no record now; one the user has given to a provider since stays aside. plugin.Listed is new: the cached listing, or plugin-providers.json. Run: - plugin_left_test.go, four tests with user-owned records beside the plugin's (a user "zap" with an endpoint next to the plugin's zap-plugin, a hand-made "mine", a built-in's picks, another plugin's and a shared id). Each guarantee broken by hand turned its test red: no set-aside, no OnlyPicks check, no other-plugin exclusion, no unknown-listing guard, take-back over the user's record, no take-back. - go test ./... in a sandbox HOME; gofmt -l; go vet darwin, linux (-tags nogui), windows. Not done: records left by plugins removed before this change stay where they are; turning a plugin off (not removing it) sets nothing aside; `magpie provider rm` still can't name such a leftover. The move flow (installPlugin) still adds through plugin.Add, since its own migration owns those records. Not tried with a real plugin removal in the GUI. |
||
|
|
3a7d0314a9 |
usage: a window's Pace as a number on its card, and in the menu bar when asked (fflake33)
fflake33 on Discord asked for the pace as a figure, "+12%" or "−8%"
against an even pace through the window, on the Usage cards and in the
menu bar.
- provider: QuotaWindow.Pace(readAt, now) is the share used (0-100) less
the share of the window gone by, from Bounds (reset less span; a
month's window a calendar month); none for an unlimited window, one
whose span or reset isn't known, or outside it. WithWindowStarts sets
startsAt on copies of the cards for the GUI (the caches' cards are
left alone); /api/usage/quotas and its refresh send it.
- Usage page: "Pace +20%" on the reset line after the wait (quotaPace,
paceLine), its sign turned with the meter in Left mode, amber while
more is used than an even pace would have, what it means in its
tooltip. Past cycles and windows with no known start show none.
- Menu bar: Settings > Menu bar pace (settings.TrayPace, off by default;
hidden on Windows, whose tray shows no text) puts " +12%" beside each
figure ("42% −14%", at most 10 runes, trayRowMax) and "pace −14%" in
the tooltip. KeepOwn keeps it device-local like the other tray
settings; the Settings save keeps it (prefsKeep).
- Strings in en, zh, zh-TW, ja, de. gui-shell.md says it.
Run:
- go test -tags nogui ./internal/provider ./internal/gui ./internal/settings
./internal/usage: ok; ./internal/davsync: ok (now covers TrayPace;
red with TrayPace taken out of KeepOwn). go test ./internal/gui -run
Tray (darwin, with the tray image tests): ok.
- New TestWindowPace, TestWithWindowStarts (input not mutated),
TestTrayUsagePace (off unchanged, used and left, rows, tooltip).
- quota-pace.test.cjs, chromium and webkit: 4 pass; cards in en, zh,
zh-TW, ja, de at 1100 and 420px, used and left, amber, tooltips, no
sideways scroll, a click moves nothing; the Settings row in all five
at both widths, On posts trayPace, a currency save keeps it, no
scroll; hidden with no card and on Windows, shown on Linux. Red with
paceLine not called, with trayPace out of prefsKeep, and with the
Left-mode sign not turned.
- gui-de, gui-ja, gui-zh-tw, i18n-keys: 12 pass; tray-bird 6, quota-holds
2, quota-read-at 4 pass.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean.
Not tried: the real menu bar on a Mac or Linux tray.
|
||
|
|
f074996d93 |
provider, gateway, gui: a model with none of its levels ticked is sent no reasoning field, on every route and in a routing group (yuexian7)
yuexian7 on Discord: models.dev lists their model as reasoning, and the
vendor answers any reasoning parameter with 422 while the same request
without it works. In a routing group they couldn't set an effort per
model, and the model editor refused to untick the last level ("Keep at
least one level"). The learned refusals (
|
||
|
|
c4f4aaaa97 |
gateway: Claude's bridge no longer passes hook notices and token counts on as the user's message (#2060)
Through the Claude subscription bridge, the inner Claude Code kept saying
"The user sent a new message while you were working:" followed by a hook's
additional context, a bare <total_tokens>... line or nothing at all. The
outer agent sends these after a tool result, and saidWithResults took every
text block after a result as words the user typed mid-turn and queued them
into the inner session.
Captured from a real Claude Code 2.1.296 with PreToolUse/PostToolUse hooks
against a local mock: after a tool_result it sends a {role:"system"}
message whose one text block joins "PreToolUse:Bash hook additional
context: ...", "PostToolUse:Bash hook additional context: ...", optionally
"The user sent a new message while you were working:\n<words>\n\nThis is how
Claude Code surfaces messages ...", and "<total_tokens>N tokens left
</total_tokens>". Older clients put the same in <system-reminder> blocks;
the reporter's had an empty reminder too, which is why some of their
"messages" were empty.
- saidWithResults takes only the user's words out of a mid-turn block
(midTurnSaid, up to the client's own tail, a reminder's end, the token
count or the next hook notice), skips the rest of a system or developer
message, and drops a text that is an agent notice (agentNotice: empty
once reminder tags are stripped, a hook notice of the known kinds, a
token count, or one of the injected leads prompt.go already knows).
- renderParts, the sibling that labels text after a result as
[user message] in the prompt for a fresh run, closes the result instead
for an agent notice.
- docs/subsystems/claude-subscription-bridge.md says so.
Run:
- Fixtures are the literal 2.1.296 bytes and the reporter's
(claude_hook_notice_test.go): nothing queued for hooks and token counts;
only "also tell me the date" queued when the user did write; the
rendered prompt has no [user message]. A "Stop hook is broken: fix it"
typed by the user still goes on.
- With the old condition put back and the renderParts change off, the
three new tests fail; restored, they pass.
- gofmt -l internal/: clean. go vet ./internal/gateway on darwin,
GOOS=linux -tags nogui, GOOS=windows (set -o pipefail): clean.
- go test -count=1 -timeout 30m ./internal/gateway: ok (667s).
- Not tried end to end through the bridge with a real Claude subscription.
|
||
|
|
aa6a0d6b20 |
library: one skill over 200 MB is left out, not the whole repository (#2062)
mikubaka88/CCFA-Skills couldn't be installed at all: "the skills in ... are
too big to install (over 200 MB)". The repository is over the 200 MB
tarball cap, so fetchSkillFiles fetched it file by file, and that refused
the whole repository once the files summed past 200 MB. One skill,
ccf-paper-writer, is 297 MB on its own (exemplar paper PDFs, llava-4d.pdf
alone 46.8 MB); the other 16 are small.
The 200 MB limit per skill stays: a skill is copied into every agent that
gets one as a copy, and treeOf stops comparing at 256 MB, so a 297 MB skill
can't be told current or edited. What changes is that one such skill no
longer blocks the rest:
- fetchSkillFiles sums each skill's files (the deepest skill folder a file
is under) and leaves out a skill over maxFetch; its files are never
asked for. Only when every skill is over it does it fail as before.
- The left-out skills reach ProbeSkills as Probe.Left (path, size), kept
per temp folder and taken once (tookLeftOut).
- The GUI's probe names each under the list ("{name} is too big to
install: 283 MB, over the 200 MB a skill may be"), or in place of "No
skills there" when nothing else is left; zh, zh-TW, ja, de. The TUI says
it in its flash.
- docs/subsystems/library.md says how a big repository is fetched.
Run:
- Real: probe of mikubaka88/CCFA-Skills under a sandbox HOME lists 16
skills and leaves out ccf-paper-writer (296736735 bytes). Not installed
into a real agent.
- gofmt -l internal/: clean. go vet ./internal/gateway ./internal/library
./internal/tui on darwin, GOOS=linux -tags nogui, GOOS=windows (set -o
pipefail): clean.
- go test -count=1 ./internal/library ./internal/tui: ok.
- TestOneSkillTooBigLeavesTheOthers (new): fails with the per-skill
leave-out turned off by hand, passes with it.
TestTooBigRepositoryChecksWhatArrives now makes every skill too big.
- skill-too-big.test.cjs (new), chromium and webkit, en 980 and zh,
zh-TW, ja 440, de 420, plus every-skill-too-big: 14/14; red (0/7 in
chromium) with client.js at origin/main. skill-*.test.cjs 190/190 and
library-*.test.cjs 484/484 in both engines.
|
||
|
|
e855272cf0 |
gui: a refused allow list names the address magpie sees the page from, with Add <addr> (Mathresearcher)
Settings > Share on local network > Allowed addresses refused a list that would shut out the page itself with a fixed sentence and no address (Mathresearcher on Discord). The server already names it (KeepsOut in gateway/allow.go, "that allow list would shut out <addr>, the address this page is open from"); allowSays now carries it into the message in every language, and a one-click "Add <addr>" button saves the list with it added. The address is the connection's own (peerAddr: RemoteAddr, unmapped, zone dropped); X-Forwarded-For and the like are never trusted, and loopback and the machine's own addresses always pass. Behind Docker Desktop or rootless Docker every client shows as Docker's own address (192.168.65.x), the host reaching a container shows as the bridge gateway (172.17.0.1), and a proxy in another container shows as that container. So the button's tooltip says that behind Docker or a reverse proxy this is the proxy's address, and adding it lets in everyone who comes through that proxy. Run: - allow-ips.test.cjs, chromium and webkit: 14 pass. The subtest checks the refusal names 203.0.113.50, the button's text and tooltip fit, a click posts ["172.16.0.0/12","203.0.113.50"], lists the rows, takes the button away and doesn't scroll. With the old app.js put back it fails (TimeoutError; chromium 5 pass, 2 fail). - gui-de, gui-ja, gui-zh-tw, i18n-keys: 12 pass. - gofmt -l (clean), go vet darwin, GOOS=linux -tags nogui, GOOS=windows: clean. go test -tags nogui ./internal/gui -run Allow: ok. Not tried: a real Docker or reverse-proxy setup. |
||
|
|
2eee900dc9 |
agent: eight more syncs keep what the user set on magpie's block (#2030's siblings)
|
||
|
|
ccffdadb8a |
gateway: /v1/audio/transcriptions passes speech-to-text through to the provider (#2053, niyoh120)
niyoh120 asked for an OpenAI-style speech-to-text endpoint so a client's voice input can go through magpie like its chat does. magpie had no /v1/audio route, so the request 404ed. What changed: - POST /v1/audio/transcriptions and /v1/audio/translations (and the /audio/... spellings) route through the same core as embeddings and rerank. embeddings.go's routing is pulled out into serveRetrieval, so disabled models, key access, groups, pause rules, account holds, failover, redaction and usage records are shared rather than copied. - transcribe.go reads the multipart form only to find `model` (as provider/model) and `prompt`. The form goes to the provider byte for byte; it is rebuilt part by part, under the same boundary, only when the model name is rewritten or the prompt was masked. The audio part is always copied as sent. - Only providers with an OpenAI-style base are tried; an Anthropic-only provider gets a 400 saying so. A body that isn't multipart, a form with no model, or one that doesn't parse gets a 400 and nothing is sent. - The vendor's answer type passes through (response_format text/srt/vtt stays text/plain). Usage records output tokens from usage.output_tokens. - The 404 message, the info api list, remote magpie's suffix list, the CORS and LAN tests, docs/reference.md, gateway-routing.md and the remote docs (en, zh, ja) name the new paths. What was run, at 9c36c3a0 (this change rebased on |
||
|
|
a0ebe0032d |
plugin: a listed plugin whose package is gone is installed again, and bun's installs run one at a time (#2002)
anganing (Windows 11, v0.1.1229): after an auto-update, every switched-on plugin said "no such plugin: …\node_modules\@magpie-community\opencode-grok-auth" at each start. For the github: plugins the path was the spec itself (node_modules\github:owner\repo), so package.json no longer listed them. Removing a plugin and adding it again was the only way out. - InstallMissing installs again each listed plugin (switched off or not) whose package isn't in plugins/, from its own spec. KeepUpdated runs it 30s after start and then hourly, before CheckUpdates. Nothing did this before: CheckUpdates skips a plugin with no installed version. - installMu serialises every bun command that changes plugins/: install (including the first package.json it writes), reinstall's bun update, and Remove's and add's bun remove. At start KeepUpdated (30s) and keepMovedCurrent (20s) each run bun add with no lock. On the Windows box, three concurrent bun add runs (Bun 1.4.3) in one folder kept only one writer's package.json change. A git plugin's dependency dropped that way leaves Name() unresolved, which is the reporter's github rows. The exact sequence that emptied the reporter's node_modules wasn't reproduced. Bun 1.4.2 -> 1.4.3, magpie v0.1.1205 -> v0.1.1227 with the same plugins, and a package.json reset all left the folders in place. So this repairs the state and closes the one race found. It isn't proven to be the trigger. Run: - go test ./internal/plugin ./internal/provider -count=1: ok. - The new tests -count=3 on macOS, and on the Windows box as a cross-built test binary: ok. - Broke each fix by hand (lock a no-op; InstallMissing returns early): TestBunCommandsOneAtATime fails with "another bun is running here", and TestMissingPluginsInstalledAgain gets 0, want 2. - Real use on the Windows box, sandbox HOME, port 3561, real Bun 1.4.3: deleted opencode-grok-auth and opencode-qoder-auth from node_modules and started serve built from this commit. The host logged the reporter's exact "no such plugin" for both. At +30s it logged "installed 1 missing plugins again" and both folders were back. After the restart, no plugin failed to load. - gofmt -l internal/: clean. go vet for darwin, linux -tags nogui and windows (plugin, provider, gateway), and GOOS=windows go build ./...: ok. |
||
|
|
8cb0946fbe |
gateway: a Factory usage-limit 402 that arrives before the account's windows are read rests only that model once they are (#2036, Ziqi-Cui)
#1979 rests only the model when Factory answers 402 "You've reached your weekly standard usage limit" and the account's windows say Standard's pool is the one used up. Before the windows are read (just after a start, or after a reading failed) nothing tells the pool from the account, so the whole account rested, Droid Core's models with it, until the reset the refusal named, often days. Such a rest now starts narrowWhenRead in the background: it waits for a reading (provider.AwaitAllowance, up to a minute), and if the reading says the model's pool is the one used up, moves the rest to the model alone (restID) with the same end. No reading in time, a reading that says the whole account, or a rest lifted or made again meanwhile leaves the account's rest as it is. CodeAlex52's patch (c623610) waited for the reading inside the request for up to 10s. That holds the failover the client is waiting on, so the wait is off the request instead: the request has failed over already, and the rest's scope only matters to later ones. The gateway's TestMain turns the wait off so no test's goroutine asks a fake upstream after the test ends; the tests that need it swap it in and wait on narrowing. Run: TestFactoryStandardOutLeavesCore's new unread case (built-in and plugin windows) and TestResetsInWords' no-reading case; the unread case fails with the narrowing removed; -race -count=3 on both; full go test -tags nogui ./internal/gateway in a sandbox HOME; gofmt -l clean; go vet darwin, linux nogui, windows nogui. docs/subsystems/gateway-routing.md's 402 paragraph says so. |
||
|
|
2076943915 |
plugin: a plugin declares its own switches, shown in its provider's editor and read by the plugin (#2038, Vocllum)
Vocllum asked that a plugin can offer the user generic on/off options
without magpie knowing what each one is for. A plugin now declares them
on its auth hook, beside checkin:
auth.options: [{ key, label, description?, default?, confirm? }]
and reads the user's values through input.magpie.option(provider, key)
or input.magpie.options(provider). Each call reads the current values,
so a change reaches the plugin without a restart. magpie only keeps the
value and hands it over: nothing is scheduled or run when an option
changes. The check-in switch (settings.pluginCheckins) and the check-in
plugins are unchanged.
- host.js: optionsOf keeps a key matching [a-z0-9_-]{1,40} with a
non-empty label, drops repeats, caps the label at 60 characters and
the description and confirm at 300, takes default only when it is
true, and keeps at most 16. The values come at init and through
setProviderOptions.
- Go: plugin.Option, Provider.Options, OptionOn and SetProviderOptions
(sent only to a host that is running). settings.PluginOptions is kept
by the plugin's provider id, then the key. POST
/api/settings/plugin-option {provider, key, on} checks the key the same
way and hands the values to the host. The generic settings save keeps
them, as it keeps PluginCheckins. /api/providers' plugins[].options
carry each option's resolved `on`.
- GUI: a "Plugin options" field in a plugin provider's editor. Each
option is a segs Off/On beside the plugin's label and description, put
in with textContent. A confirm text is asked through confirmAction
before turning an option on. Changes wait for Save, which posts each
one before the provider. Strings are added for zh, zh-TW, ja and de.
- Docs: provider-plugins.md (a new section), reference.md, gui-shell.md
and the tests README.
Run:
- TestPluginOptions (a real host with testdata/options). Red with the
old host.js (no options listed) and red with setProviderOptions turned
into a no-op (the plugin still reads the old value).
- TestPluginOptionSetting and TestSettingsSaveKeepsWhatItDoesNotSend.
Both red with the generic save's PluginOptions line removed.
- plugin-options.test.cjs: 22/22 in Chromium and WebKit, at 1100 and 420
wide, in en, zh, zh-TW, ja and de. Red on the old app.js (no field).
The screenshots were looked at: long text wraps and the page has no
sideways scroll at 420.
- provider-concurrency, plugin-signin, plugin-checkin, provider-price-rate
and plugin-move-unserved: 68/68.
- go test ./internal/plugin/... ./internal/settings/... ./internal/gui/...
./internal/provider/..., gofmt -l, and go vet on darwin, linux
(-tags nogui) and windows.
Not tried with a real community plugin, since none declares options yet.
The check-in row doesn't take a plugin-declared label or hint; it is
left as it was.
|
||
|
|
8da304767a |
gui: Library is a plugin's page, its script, style and words in plugins/library
P2 of docs/subsystems/plugin-runtime.md, the second page after Sessions.
- library.js and library.css move to assets/plugins/library/ (client.js,
library.css). The script registers with the kernel
(magpie.plugin("library")) and adds its page to the "page" slot. Its
hooks: open and relang load, redraw, close (its modal), dirty, discard.
What it set up at load (list scroll and resize, the modal's backdrop
and Escape, beforeunload, the stuck header, a quiet reload on focus)
runs in mount.
- app.js calls those through magpie.call instead of window.loadLibrary,
redrawLibrary, closeLibraryModal, libraryDirty and discardLibrary. It
no longer lists library in its title map, hide loop or OPEN_VIEWS; the
kernel's pages are in them.
- index.html: <main id="view-library"> goes, the kernel makes it.
library.css keeps its place in the cascade.
- The 560 strings only Library says move from i18n.js to
plugins/library/i18n.js (4 languages). i18n.js: 18826 → 16584 lines.
- plugins/library/library.go lists the client files.
- Tests that read i18n.js for a Library string read strings.cjs (i18n.js
and the plugins'): 8 library tests and mcp-editor-cancel,
mcp-oauth-app, mcp-signin-health. font-cascade, win-fonts and
assets_revalidate_test.go name the new paths.
- "Check again" stays in i18n.js: Library said it alone when the words
were split, and
|
||
|
|
1eaf1e890a |
gui: Sessions is a plugin's page, its script, styles and words under assets/plugins/sessions (P2)
The first page of P2 to leave app.js's core. sessions.js and sessions.css
move to assets/plugins/sessions/ (client.js, sessions.css). The page
registers through the kernel as magpie.plugin("sessions"): mount takes its
<main>, which the kernel now makes, open and relang read it again, and
reveal is the Usage page's way in. window.loadSessionsPage and
window.openSessionOnPage are gone. app.js reaches the page only through
magpie.call, and show() takes a page's title from its part. The plugin's
manifest lists i18n.js, sessions.css and client.js.
Words: the kernel's magpie.strings(dict) adds a plugin's words to I18N.
A key that is already there is logged and not taken, since the later one
would silently win. The 65 keys only the Sessions page says (own-keys over
every asset, Go and index.html) move, as written, from i18n.js to
plugins/sessions/i18n.js. tests/strings.cjs reads i18n.js and every
plugin's i18n.js as the page has them. gui-de/ja/zh-tw use it, and
i18n-keys now checks that no key is said twice across files and that a
plugin's words are in every language. TestBuiltinClientsLoaded takes a
.css entry as a <link> in <head>, and a script between kernel.js and
app.js.
Docs: plugin-runtime.md (Words, Pages moved out: Sessions), gui-shell.md,
gateway-sessions.md.
Run:
- go test ./internal/gui/ ./internal/pluginrt/ ./internal/gateway/: ok.
- gofmt clean. go vet darwin, GOOS=linux -tags nogui and GOOS=windows on
gui, pluginrt and plugins: clean.
- GUI, in both chromium and webkit, 40 files, all green:
- the sessions-* and sess-* tests, session-identity, routing-sessions,
account-mask-sessions, usage-session*, gateway-conversations;
- plugin-kernel, the plugin-move* tests, font-cascade, win-fonts;
- i18n-keys, gui-de, gui-ja, gui-zh-tw.
- session-terminal's red under parallel load is the same on origin/main
|
||
|
|
2d8f2a86a5 |
sessions: Kimi Code sessions open as a transcript (#2056)
infinitr0us: a Kimi Code session on the Sessions page had no transcript
to open. HasTranscript now lists kimi, and kimiTranscript reads the
session's main wire.jsonl:
- protocol 1.4/1.5: turn.prompt and turn.steer (a prompt not from the
user, a skill's activation or a background task's news, is folded as
context), and the loop events content.part (text, think), tool.call
and tool.result, a result named for its call. These are there for
every session, finished or running; agent.message.appended (1.5, only
at a turn's end) and the timed context.append_message records say the
same again and are passed over.
- kimi-cli imports (1.0, and the head of a ses_* session Kimi Code
reopened): the untimed context.append_message records, with an
assistant's toolCalls in both shapes (name/arguments and OpenAI's
function.{name,arguments}).
Search and markdown export read the same parts.
Run:
- TestKimiCodeTranscript on the #1607 reporter's wire files in testdata
(1.4, a cancelled 1.4, an early 1.5 started by a skill, a failed 1.5,
a kimi-cli import), and TestKimiCodeTranscriptOrder on a synthetic
file in the same record shapes, exact part order plus SearchSession.
- Broken by hand: kimi out of HasTranscript fails both tests; reading
the timed context.append_message records fails both (user/text 9,
not 3).
- A nogui build's `magpie web` under a sandbox HOME, KIMI_CODE_HOME on
the reporter's whole zip (8 sessions, the July subagent session and
a reopened ses_* among them): all 8 listed with a transcript;
/api/sessions/transcript gave 105, 13 and 205 parts for June, the
reopened ses_* and July; the markdown export worked.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows;
go test -tags nogui ./internal/sessions/ ./internal/gui/.
Not tried: a live Kimi Code session on this machine (none here; the kimi
installed is kimi-cli 1.52.0), the GUI's look of the transcript, WSL.
A subagent's own wire file isn't shown; the main agent's is.
|
||
|
|
75cbc7e1e5 |
provider: a subscription switched off or removed makes no background requests, no claude auth status every minute (Riko on Discord)
Riko switched Claude off in Providers, and magpie still ran `claude auth status --json` about every minute. Off only kept the gateway from routing to it. Every page and request lists accounts, which re-asked the CLI, and the background loops went on reading allowances, renewing, switching, warming, checking in and fetching lists. The same held for each sibling with a CLI or account check: Cursor (`cursor-agent about`), Devin (`devin auth status`) and the rest. What changed: - left_alone.go: leftAlone(id), true for a provider that is Off or Hidden (account removed). - account.go claudeIdentity and cli_identity.go get (Cursor, Devin): the CLI isn't asked; what it said last (memory or cli-identity.json) is served, so the account stays listed to switch on again. - subscription_usage.go: claude, cursor and grok are checked as hidden before their account is looked up (the look-up ran the CLI). - login_usage.go loginUsageAt, keepalive.go RenewLogins, codex_switch.go NextLogin, codex_warmup.go keepWarm: leftAlone where only accountRemoved (or nothing) was checked. - models.go newDue: a provider that is off has no list fetched. - checkin.go: each check-in account knows its card's provider; the loop skips one that is left alone, a press still checks it in (minimax, trae, qoder, workbuddy, plugin check-ins set it). - docs/subsystems/providers-accounts.md says so. Not covered: KeepPluginsListed lists every plugin at once in the host. A Cursor switched off that was never asked who is signed in isn't listed until switched on. What was run: - TestLeftAloneRunsNoCLI: fake claude, cursor-agent and devin on PATH log each run; with claude and cursor off and devin removed, All, Hidden, fetchSubscriptionUsage, LoginUsage, RenewLogins, SwitchWhenSpent and FetchNew run three times over stale caches and no CLI is run; switched back on, all three are asked again. - Break check: with the source changes reverted it fails with "switched off or removed, the CLIs were run: [claude_auth_status_--json cursor-agent_about_--format_json devin_auth_status ...]"; with only the claude gate removed only claude is logged, with only cliIdentity's only cursor and devin. - go test -tags nogui -timeout 45m ./internal/provider ./internal/gateway: ok (399s, 1271s). - gofmt -l: clean. go vet (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean, under set -o pipefail. |
||
|
|
c9af654b26 |
gateway: Kimi Code takes a Claude Code session that loaded a deferred tool, and DeepSeek one that dropped a tool (#2042, davisjiahao)
Claude Code's deferred tools (ToolSearch, MCP tools that come and go) put blocks of their own in a message: tool_addition (its tool a tool_reference naming the tool, or a tool_definition), tool_removal, and tool_reference. magpie relays an Anthropic body as it is, so they reached vendors' Anthropic endpoints. Checked against the real endpoints on 2026-10-14 (a Kimi Code CN key, a DeepSeek key; shapes read from Claude Code 2.1.296's own builder): - Kimi Code refuses any of them, in any role and either tool shape, with a whole-request 400 "Invalid request Error" that names nothing; a tool_reference inside a tool_result passes. - DeepSeek takes a tool_addition naming a tool, but refuses one defining it, a tool_removal and a message's tool_reference: 422 "messages[1]. content: unknown variant `tool_removal`, expected one of ...". What changed: - withoutDeferredTools (anthropic_shapes.go) drops those message blocks and a message they leave empty. The tools stay in the request's tools, and ToolSearch's answer (a tool_reference inside a tool_result) stays. - Kimi (isKimi) is never sent them: its 400 says nothing to learn from. - Any provider that refuses one in DeepSeek's words is marked (shapeDeferred, refuseShapes) and asked again at once without them, and not sent them again while magpie runs. The shape-retry loop in forward now reads a 422 as well as a 400 (refuseShapes and refuseBetas only act on wording they recognise). - Anthropic and every provider that takes them get them as Claude Code wrote them. Kimi's bare "Invalid request Error" is not added to shapeWords: it names no field, and with the blocks gone there is nothing left for it to cover. - docs/subsystems/gateway-routing.md: a paragraph on the above. Builds on lu123bing's fork branch (c4a0564), widened from Kimi to the learned refusal after the DeepSeek check; this keeps a tool_addition naming a tool for providers that take it. Run: - TestKimiIsSentNoDeferredToolBlocks (the reporter's literal body plus Claude Code's real shapes, through Handler) and TestDeferredToolBlocksRefusedOnceLeftOut (DeepSeek's literal 422, learned once; a provider that takes them keeps getting them). - Break checks, each red: without the Kimi drop, 5 subtests "status 400: Kimi Code: Invalid request Error"; with the loop on 400 only, and without the mark, "status 422: DeepSeek: ... unknown variant `tool_removal`". Restored: green. - Real use: a nogui build served from a sandbox HOME on 127.0.0.1:35211 with copies of the Kimi Code CN and DeepSeek providers. The reporter's body to kimi-for-coding now reaches Kimi's account check (403, the test key's plan has lapsed) instead of the 400; a tool_removal to DeepSeek reaches its balance check (402) instead of the 422. A full successful Kimi turn wasn't possible on this key. - gofmt -l clean; go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet on internal/gateway; go test -tags nogui ./internal/gateway/ in a sandbox HOME: ok (1516s). An earlier run of the same suite, with five other gateway.test binaries running on the machine, ended FAIL after 1484s; its output was cut to the last 30 lines, which held no test name, so the failing test is not known. Co-authored-by: lu123bing <12312702@mail.sustech.edu.cn> |
||
|
|
a5d72a095b |
gateway, gui, cli: a search API's keys take turns, a refused one rests, and each Tavily key shows what it has used (SlouchyQuill)
SlouchyQuill on Discord asked for a Tavily key pool after dsh-tavily-pool: several keys, each key's quota shown, keys rotated. Before this, the comma-separated keys (#1477) always started from the key that last answered, so one key took every search until it was refused, a refused key kept no rest of its own, and nothing showed what a key had left. What changed: - Turns (internal/gateway/search_keys.go). Searches take turns over the keys by default (round robin, a counter per vendor). pick=order (CLI) or In order (Settings) always starts from the first key; the pick is saved in SearchAPI.Pick. - Rests. A refused key rests: 401/403 for 10m ("turned away"), 402 for 1h ("out of credit"), 429 for its Retry-After held to 30s-10m (1m without one). 432/433 count as out of credit from Tavily only; from any other vendor they rest as a rate limit. A resting key is asked after the others, soonest back first, so failover is kept, and it wakes when it answers. Rests are keyed by a hash of the key. - Quota (internal/gateway/search_quota.go). Each Tavily key's quota is read from GET /usage with that key. The fixture is the documented reply from docs.tavily.com. The key's own limit is used when it has one; otherwise its plan's plan_limit/plan_usage, which the account's keys share. A failed read, or a reply missing those fields, says unknown and why, never 0. A read is kept 2m unless asked fresh. A key found used up with no pay-as-you-go credit rests 1h; a later read with credit wakes it. - Keys never appear in full. The vendor's error has the key masked (tvly-…abcd), and errors name "key N (tvly-…abcd)". - GUI. Settings › Models › Web search adds a "Keys of <API>" row under an API with several keys or with Tavily's: In turn / In order, each key masked with what it has used and why it is asked last, and Check again. There is an API for it (POST /api/settings/search-quota), and 13 strings in zh, zh-TW, ja and de. - CLI. `magpie search` lists the pick and each Tavily key's quota, read fresh; `magpie search add … pick=turns|order`. - Docs. gateway-routing.md has a new section "A search API's keys"; both READMEs have a line on web search. What was run: - go test -tags nogui ./internal/gateway ./internal/provider ./internal/cli ./internal/gui: ok. After the last rebase, provider and cli again, and gateway -race -run Search. - New tests: TestReadTavilyUsage, TestSearchKeysTakeTurnsRoundRobin, TestSearchKeyRefusedRests, TestSearchRestFor, TestSearchQuotas and TestSearchKeyNeverInFull. Each guarantee was broken by hand and its tests went red: - turns pinned to the first key: RoundRobin and RefusedRests; - rests ignored: TestSearchAPIKeysTakeTurns, RefusedRests and TestSearchQuotas; - key masking removed: NeverInFull; - a failed read reported as known: TestSearchQuotas. - gofmt -l; go vet -tags nogui for darwin, linux and windows on the four packages. - GUI: search-keys.test.cjs covers en, zh, zh-TW, ja and de × Chromium and WebKit × 1100 and 420px: 20/20. Without the new .search-keys .val wrap rule, de at 420px fails ("Erneut prüfen" went past the window's edge). - search-api, search-first, search-instead, search-mcp, searcher-pick, settings-search, provider-search, gui-de, gui-ja and i18n-keys: 56/56 in each engine. - Full suite in Chromium (concurrency 6, load ~40): 4498/4504. The files that failed (gateway-key-groups, rest-try-now, routing-wb-restricted, text-size, usage-sum-whole) were rerun alone. All pass except usage-sum-whole, which fails now and then on an origin/main worktree too under the same load (#1864, #2023; rest-try-now and routing-wb-restricted are #1905). None of them touch search. - Real Tavily API with two invalid keys: /search returns 401 {"detail":{"error":"Unauthorized: missing or invalid API key."}}, which counts as a refusal. Both keys rest 10m as turned away, the error names them only masked, and both quotas read "unknown · 401". Checked through a test and through the nogui CLI binary in a sandbox HOME. Not tried: a valid key's /usage against the real API. No Tavily key was at hand, so the quota parsing is checked against the documented bytes only. |
||
|
|
1555cddfa0 |
agent: with Claude Desktop on magpie, Claude Code runs each model at its own window, not the least of them all (#2025, 6.1sol)
Claude Desktop's Code tab runs Claude Code on ~/.claude/settings.json with every model Desktop lists. Claude Code takes one window (CLAUDE_CODE_MAX_CONTEXT_TOKENS) for every model it doesn't know, and magpie told it the least of Desktop's (#1458), so one small model held a 500K or 1M one to its 131K. Now, while Desktop is on magpie, magpie tells Claude Code the largest window of Desktop's models and of Claude Code's own main and tier models, and holds each model below it to its own with modelSettings.<id>.autoCompactWindow (claudePlan, claude_budget.go). CLAUDE_CODE_AUTO_COMPACT_WINDOW would take precedence over those, so in this mode magpie's working window goes in the top-level autoCompactWindow instead, and an entry is written only where a model's window or threshold differs from what it would run at without one. Claude models (and groups of them) are left out as before. magpie's entries and top-level value are stashed and go when Desktop leaves magpie. The user's own entries, top-level value and variables are never written over: an entry of theirs past its model's window (or "auto") holds the largest to that window, and with a CLAUDE_CODE_AUTO_COMPACT_WINDOW of theirs the least window is told as before. Desktop off is unchanged. Verified with real Claude Code 2.1.296 in a sandbox CLAUDE_CONFIG_DIR, on a settings.json written through magpie's editor: /context shows 256k for mythos-magpie-2's entry, 131k for magpie/v/gpt-6.1-sol (dotted key, with and without [1m]), and the top-level 272k for a model without an entry, under a 1M MAX_CONTEXT_TOKENS. Tests: TestClaudePlan and TestBudgetPath (new), and TestClaudeDesktopContextWindow / TestClaudeDesktopAloneContextWindow rewritten (largest window, per-model entries, Full window, the user's entry and top-level kept, Desktop off removing only magpie's). They fail on the old claude.go (256000 told), and with the skip of the user's entries removed from claudePlan. Run: go test ./internal/agent (full), gofmt -l, go vet for darwin, GOOS=linux -tags nogui and GOOS=windows. |
||
|
|
f71155591e |
provider: a provider at a vendor's own endpoint is priced from that endpoint's models.dev catalog (#2052, mengyianx)
A custom provider added by its address alone, with no catalog named, was priced only by the model's maker. Qwen3.8-27B, whose maker (Alibaba) sells no such model on any of its seven models.dev catalogs, read "no price is known for it" even at AMD's own endpoint, where models.dev's amd lists it at $0, a price. - catalog: models.dev's provider "api" is read; AtEndpoint names the catalogs at a base URL (trailing slash and case ignored). - provider: EndpointCatalog is the one catalog models.dev lists at one of a key's provider's endpoints (an Anthropic base, kept as its root, also with /v1), used by ListPrice when the provider has no catalog of its own. Never for a subscription's account, never when two catalogs share the address (minimax / minimax-coding-plan), never a plan's catalog (an id with -plan, or membershipCatalogs), whose $0 is the membership's. A user's price and a named catalog still come first; a relay's endpoint matches nothing and its model stays unpriced (no reseller guess). - cli: `magpie model price p/m` with no price gives the two commands that set one (p/m and */m); a price from an endpoint's catalog names it. - gui: the Catalog field's hint says it also sets list prices (en, zh, zh-TW, ja, de). - docs: reference.md's "What a model costs", providers-accounts.md row. What was run: - Reporter's exact case, built binary (go build -tags nogui), sandbox HOME with a copy of this machine's models.dev cache (2026-10-14, same amd entry as the report), providers 001 (relay), 002 and amd at https://developer.amd.com.cn/radeon/api/v1: 001/gpt-5.5 $5/$30, tiers, as before 001/Qwen3.8-27B no price, now with the two commands to set one 002/Qwen3.8-27B $0/$0, "what models.dev's amd lists at its endpoint" amd/Qwen3.8-27B $0/$0 The two suggested commands were run and took effect. - TestEndpointCatalogPrices / TestEndpointCatalogOnlyItsOwn, fixture testdata/endpoint_catalog.json trimmed from the real models.dev cache. Break checks, each FAILs with the case named: ListPrice not using EndpointCatalog -> 002/amd/001 at AMD unpriced, EffectivePrice(002, Qwen3.8-27B) unpriced plan exclusion removed -> "a plan's endpoint: EndpointCatalog() = alibaba-coding-plan", qwen3.5-plus at $0 instead of $0.4/$2.4 single-match rule removed -> "an endpoint two catalogs share: EndpointCatalog() = minimax" Account check removed -> "a subscription's account ... = amd" Anthropic /v1 match removed -> thinkingmachines unmatched - GUI: internal/gui/tests/catalog-hint.test.cjs, chromium and webkit, en zh zh-TW ja de, widths 1100 and 420: 20/20 pass, plus i18n-keys; with the old app.js/i18n.js it fails "one hint names list prices". - go test -tags nogui -timeout 45m ./internal/catalog ./internal/provider ./internal/cli: ok (provider 244s, cli 125s, catalog 3s). gofmt -l clean; go vet (darwin), GOOS=linux go vet -tags nogui and GOOS=windows go vet -tags nogui on those packages: clean. |
||
|
|
8f34bbcd11 |
library: Grok Build and Grok App can be given hooks (#1790)
The Hooks tab said "Grok App has no hooks magpie can write" and RTK said
"No rtk hook". RTK stays correct for now (rtk init has no Grok agent), but
the hooks message was wrong: the Grok CLI keeps hooks as [[hooks.<Event>]]
array tables in its config.toml, which Grok App reads from agent-home on a
custom route. Hindsight already ships three hooks into both configs.
Add grok and grok-app to hookAgents with a TOML hook spec. A hook is written
as a [[hooks.<Event>]] table with a [[hooks.<Event>.hooks]] child, the same
find/claim/drop logic as a JSON agent's: the block text is recorded entry by
entry, so only a block still exactly as magpie wrote it is ever taken out,
and the user's own blocks around it stay as they are. Portable events map to
Stop / PostToolUse / PreToolUse / UserPromptSubmit / SessionStart; a tool
matcher uses Grok's own tool names (run_terminal_command, search_replace).
Grok Build and Grok App run the one CLI, so a grok:<Event> own event goes to
both (sameHookFamily).
edit gains WriteTOMLFile and SplitLines so the library can round-trip a
config's lines through the same validating write the other TOML editors use.
Verification (branch grokapp-hooks):
- TestHooksGrokConfigTables fails on the pre-change code with a real FAIL
("Grok Build has no hooks magpie can write"); passes with the change.
Broke the matcher map, the drop and the event map by hand; each break is
caught by the test.
- go test ./internal/library ./internal/edit: 811 passed (was 828 before the
two new grok cases and the hookAgents additions).
- gofmt -l clean; go vet on mac, GOOS=linux -tags nogui, and GOOS=windows all
clean; go build, GOOS=linux go build -tags nogui and GOOS=windows go build
all succeed.
- go test -tags nogui ./... has three pre-existing failures on base
|
||
|
|
4fbb75c3a8 |
gateway: Codex's 507 "exceeded request buffer limit" is asked again and told as a 503, not relayed as it came (#2034, sparrowu93)
sparrowu93's pi, on a ChatGPT account, stopped on "Codex: 507 Insufficient Storage: exceeded request buffer limit while retrying upstream". That text is Envoy's (ChatGPT's front): its first try at the backend failed, and the body was more than it buffers to try again. It is the same backend failure as #1628's 503 "reset before headers", which magpie already asks again for without resting anybody, only for a body the front couldn't retry itself. magpie relayed the 507 as it came; pi's _isRetryableError (pi-coding-agent 0.73.0, agent-session.js) matches 503 but not 507 or these words, so the turn just ended. codexDropped now reads that 507 (by Envoy's words alone, any size, since the 507 itself says the body was large) the way it reads the large request's 503: the accounts loop asks the next account and the last one again, nobody rests, and the agent is told a 503 with Envoy's words and what may help (/compact, fewer or smaller images). The relayed path (codexUpstreamOn, Codex's own sign-in) asks again the same way: the two share edgeMayDrop/edgeSaidDrop. A 507 in other words is relayed as it came. gateway-routing.md says so. Run: - New TestCodexUnbufferedAskedAgain, TestCodexUnbufferedTold503, TestCodexUnbufferedRelayed, TestCodexOther507Stays, with the reporter's literal Envoy text as the fixture. On the old code the first three fail: "status 507, want 200 pong: {...\"message\":\"Codex: 507 Insufficient Storage: exceeded request buffer limit while retrying upstream\"...}" (the reporter's message byte for byte), and "507 once: 507 ... tried [acct-1]". With edgeSaidDrop matching every 507, TestCodexOther507Stays fails. Restored, all pass, with #1628's TestCodexReset* tests. - go test -tags nogui ./internal/gateway/ (sandbox HOME, pinned caches), gofmt -l, go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet (with and without nogui) on internal/gateway. Not tried: a real 507 from ChatGPT (it needs the backend to fail a request over Envoy's buffer, which can't be made to happen on purpose). |
||
|
|
ea3ea11729 |
gateway: an image request to a routing group moves on to the next member when one answers 5xx (#2005, tianxia3111)
/v1/images/generations sent to a routing:"order" group only ever drew on the member the model resolved to; a 502 from it went straight back to the caller even though the group had other members that could draw. draw.go: when the asked model names a group (group/<id>, or a bare id whose group holds the resolved member), drawingTries lists the members in planGroup's order and the request moves on with chat's retryable rule (5xx, 429, auth and quota refusals). A request the caller got wrong (plain 400) still stops at once. Pause rules and a gateway key's model holds apply per group as in chat. Drawing still rests no account. The recent call records the skipped members as Fallback, and the final error says "(tried first: ...)", as embeddings do. video.go: /v1/videos had the same single-member path. Its start logic moved into startVideo, and videosCreate walks the same tries; a member that can't make videos moves on too. Run: TestImageGroupMovesOnToTheNextMember and TestVideoGroupMovesOnToTheNextMember go red (502) with either loop forced to stop after the first member, and the image test goes red with the retryable check removed. go test -tags nogui ./... (full suite), gofmt -l, go vet for darwin, GOOS=linux and GOOS=windows on internal/gateway. Not tried against the reporter's real providers. |
||
|
|
56fcd1dc27 |
usage: each account picks a recorded allowance cycle beside its curve, meters and legend following it (#2009, NorethSea)
Let each account choose completed cycles beside its allowance curve. The meters, sampling dates, plot and legend follow that cycle. Missing readings stay unknown, and current account actions and whole-window estimates are not presented as historical data. Fixed-deadline refills preserve cycle boundaries alongside natural and early resets. Keep the upstream whole-window estimate for the current view; no separate price endpoint or duplicate estimation is added. Verified on the integrated tree based on origin/main |
||
|
|
59a8aec5df |
agent: Claude Code's /model takes models added in magpie again when the picker magpie wrote has lost its mark (#2046, cjyrainbow)
cjyrainbow's WSL Claude Code (Ubuntu) kept an old /model list: a model added in magpie was in the gateway's /v1/models but not in modelPicker. settings.json held the picker magpie wrote (every row "… · via magpie"), but stash.json had no claude@wsl:Ubuntu.model_picker mark for it, so writePicker took it for the user's own and never wrote it again. An older magpie's stash lost keys (concurrent writes / a stash that didn't parse, fixed in |
||
|
|
3aa22f9d9c |
gateway: a translated Responses reply keeps the web search that ran, with its query and sources (#2044, BussanQ)
What changed: responsesEncoder.event gets a KSearch case and
renderResponses a Search case. Both emit a completed web_search_call
item (ws_ id, action.type "search", query plus queries, and the
nonempty source URLs in action.sources) through the shared
responsesSearchItem. The stream adds the item, sends
response.web_search_call.completed {item_id, output_index} and
output_item.done, and the same item stays in the terminal response's
output, in order with text, reasoning and client tool calls.
Why: a search magpie ran for a model that can't search (searchRounds),
or one decoded from an upstream Responses or Anthropic reply, reached
the client only as answer text. Anthropic clients already got
server_tool_use / web_search_tool_result; Responses clients (bqAgent)
had no record that a search ran or what it found. No earlier progress
events or url_citation offsets are invented.
From BussanQ's reference commit b1a4e7b, reviewed line by line and
applied onto origin/main. Added on review:
TestResponsesSearchItemReplayed (the item sent back as the next input,
as Codex does, parses and leaves the turn's messages unchanged) and a
docs line saying so.
What was run (sandbox HOME, pinned caches, go1.26.8):
- go test -tags nogui -count=1 ./internal/gateway -run
'TestResponsesSearch.*|TestWebSearchForAModelThatCannot|
TestSearchToldAsAnthropics|TestWebSearchAskedOfEachAPI|
TestAnthropicServerToolLeftOut|TestParallelToolCallIDs|
TestResponsesStreamToolThenHiddenThinking': ok
- Break check: origin/main's responses.go put back with the new tests:
TestResponsesSearchResults "search output lost or reordered: got
[message message function_call]", TestResponsesSearchDecodedResults
"decoded provider search missing", TestResponsesSearchFollowedByFailure
"completed search or subsequent error lost", and
TestWebSearchForAModelThatCannot "delegated search missing from
Responses output" all FAIL; pass with the change restored.
- go test -tags nogui ./internal/gateway (whole package)
- gofmt -l; go vet -tags nogui for darwin, GOOS=linux, GOOS=windows
Not run: a live provider; the full repository suite.
Co-authored-by: BussanQ <bussanq@gmail.com>
|
||
|
|
bf25842714 |
gateway: a provider's own cap on how long a key that keeps failing rests (#2008, Gaudi-XIX)
A key that keeps failing doubles its rest from a minute up to 10 minutes, and one rate limited again as soon as its rest is over up to 30; both caps were fixed, so a free key down for hours was asked again every 10 or 30 minutes all the while. `magpie provider rest-cap <id> 4h` (Provider.RestCap, minutes, at most MaxQuotaRest, 8 days) sets where both ladders stop for that provider's keys and accounts (RestCapOr in restAfterMarked's default branch and in rateRest); `default` gives back the gateway's own. A time the vendor names still stands over it. Unset, nothing differs. It is kept by the editor's save, the account copy and normalize. Run: go test -tags nogui ./internal/provider ./internal/gateway ./internal/cli ./internal/gui (temp HOME). Broken by hand: both ladders back on the fixed caps fail TestOwnRestCap (rate-long #6: 30m, want 32m); the GUI keep removed fails TestSaveKeepsQuotaResetAt. Not tried against a real vendor's outage. |
||
|
|
064cffdbfd |
gateway: a key out of a daily allowance rests until the time of day it comes back (#2008, Gaudi-XIX)
A free tier's "You've reached today's free-model token quota" says nothing of when it is back, so it rested 15 minutes (or the provider's own quota-rest), and was asked again all day. A vendor Retry-After over an hour was cut to the hour, and that hour then stood over the user's own longer rest. - Provider.QuotaResetAt: "08:00" on this computer's clock, or "00:00+08:00" on the vendor's. `magpie provider quota-rest <id> until 08:00` sets it; a number of minutes set after it replaces it, and default clears both. normalize drops one that isn't a time of day. It is kept by the editor's save and the account copy. - restAfterMarked's quota branch rests until its next occurrence (OwnQuotaRest). A time the vendor names, or a window's end, still stands over it; a Retry-After stands unless it was cut to longestWait while the user's own rest is longer. - Defaults are unchanged: nothing set, nothing differs. Run: go test -tags nogui ./internal/provider ./internal/gateway ./internal/cli ./internal/gui (temp HOME). Broken by hand, each fails: OwnQuotaRest replaced by QuotaRestFor (TestQuotaRestsUntilTheTimeOfDaySet, 3 asserts), the Retry-After guard removed (the 7200 case), the GUI keep removed (TestSaveKeepsQuotaResetAt), default not clearing it (TestQuotaRestUntil). Not tried against a real free-tier vendor. |
||
|
|
77f90fd84f |
gateway: a plugin whose config hook says searches: true is sent the client's web_search as sent (#2027, yudaleng)
A plugin in front of Anthropic's or OpenAI's own API (a CPA or sub2api relay whose quota the plugin reads) had no way to say its upstream runs the hosted web search tool: searchesItself returned at once for any signed-in account, letting only Codex and Grok through, so Claude Code's WebSearch and Codex's web_search always went through magpie's own search. Now a plugin's config hook can set `searches: true` on its provider, as it sets `decide` (#1514). The host passes it through (plugin.Provider.Searches), pluginProvider sets the provider's Searches, and searchesItself honours it for a plugin's provider only, on Anthropic or Responses and only where the plugin has a model on that API, the same rule a custom provider's "Searches the web by itself" has (#359). Another sign-in's Searches is never read; Codex and Grok are unchanged. As with a relay, searchRank leaves it out, so magpie never picks it to search for other models; Settings can name it by hand. Documented in docs/subsystems/provider-plugins.md and the plugin guide (site/public/docs plugins.html, en/zh/ja). Verified: - TestPluginSaidToSearch (new, gateway, through the real fake plugin on bun and New().Handler()): with FAKE_SEARCHES the plugin's upstream gets web_search_20250305; without it, it gets no search tool; Chat doesn't search and searchRank is -1 either way. - Broken by hand, each red: search.go reverted, plugins.go reverted, host.js reverted (each "searches by itself on Anthropic: false"); with the searchesItself assertion disabled and search.go reverted, the wire check fails "said to search true, the plugin was sent []". - TestMovedGrokSearchesItself, TestGrokPluginSearchesItself, TestWebSearch* pass. - go test -tags nogui ./internal/plugin ./internal/provider ok, and ./internal/gateway (see the run noted on #2027) under a sandbox HOME with pinned caches; gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on the three packages clean. - Not tried with a real CPA/sub2api plugin. |
||
|
|
1a7aa76b4b |
mcpauth: an MCP sign-in canceled while its token is being fetched no longer saves the late token or replaces the server's sign-in (#1750, ggbdpq)
Cancel set the flow canceled, but a callback already trading its code
went on to write mcp-signins.json and call Changed when the token came
back, so a sign-in the user had ended was saved, and an existing
sign-in to that server was replaced. The callback's write now happens
under the flow's lock only while the flow is live (flow.keep), so
Cancel or the timeout and the commit can't both win; a commit that wins
still tells the agents before the flow says done.
ggbdpq's patch (46440adc), cherry-picked unchanged.
Run (reviewer): TestCanceledMCPCallbackDoesNotSave (real discovery,
registration, PKCE and loopback callback against mcpauthtest, the token
reply held until Cancel) fails on the old mcpauth.go in both cases
("saved credentials", "redistributed credentials 1 times") and passes
with it, -race -count=5; go test -race ./internal/mcpauth/... ok.
Not tried with a real MCP server's OAuth.
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
|
||
|
|
509328ccb0 |
provider: a Codex reset spent while an allowance read is in flight is never undone by that read, even on Windows' coarse clock (#1754, ggbdpq)
Allowances took time.Now() when its background read began, and
forgetAllowance stamped the reset with time.Now(); a reading was dropped
only when the reset was After the start. On Windows two events in one
clock tick get the same time, so a read begun before a spent reset could
put the account's 100% back right after it. Reads and resets are now
ordered by a generation counter under usedCache's lock.
ggbdpq's patch (e07232ef), cherry-picked unchanged.
Run (reviewer): TestResetAllowanceKnownAtOnce, Windows test binary on
the Windows box (sandbox USERPROFILE/APPDATA), -count=10: old code FAIL
4 of 10 ("routing reads 100 used (known true), want 0"), this change
PASS 10 of 10. macOS -race -count=20 of the Allowance/Renewed tests ok.
Full provider package, gofmt, linux and windows vet: see the push.
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
|
||
|
|
17d4283a5a |
library, gui: a hook has a description in any language, shown under its name (#2011, emo172)
A hook's name is letters, digits, - and _ (checkName), so a Chinese user had to translate "auto-format-queue" back in their head; 编辑后格式化 was refused. Hook now has an optional Description: one line (whitespace and line breaks folded into single spaces) of at most 200 characters, kept in library.json only and never written into an agent's hooks file. The Hooks tab shows it under the name; the editor has a Description field (maxlength 200) under Name. The library's text fields no longer save or close on an Enter or Escape that only ends an input method's composition (isComposing / keyCode 229), which a Chinese description would hit. Strings in zh, zh-TW, ja and de; docs/subsystems/library.md says it. The reporter's other option, non-ASCII names, wasn't taken: the description says more than a name can, and names stay one rule across servers, skills and hooks. Run: TestHookDescription (kept through a save, an agents change and a rename, read by the page, no agent file has it, 201 characters refused, 200 kept) fails with the folding and the length check removed. library-hooks.test.cjs (a description under the name, none for a hook without, the field's placeholder and hint, an IME Enter posts nothing, Save posts the description) fails on the old library.js and with the IME guard removed. library-*, gui-de, gui-ja, gui-zh-tw, i18n-keys and click-scroll pass in Chromium and WebKit (263/263 each). go test -tags nogui ./internal/library ./internal/gui under a temp HOME, gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/library pass. |
||
|
|
2dcc51417e |
plugins: the window gets a plugin kernel, and the Gateway page is the first page a plugin draws (P1)
P1 of docs/subsystems/plugin-runtime.md. P0 ( |
||
|
|
a0dc89e5cf |
agent: a proxy on this machine with a route of its own reaches magpie too, and a pick in Claude Code keeps it (#1985)
|
||
|
|
47ec2a969f |
provider: a Sub2API Claude account comes in by its email_address, with its account and organization (#1975)
KKKKKKKEM's Sub2API export of a Claude OAuth account was refused, "the
file doesn't say which Claude account this is": sub2apiEntry read only
credentials.email, and Sub2API keeps a Claude account's email under
Anthropic's own name, email_address. Its CreateAccountModal stores the
token Sub2API was given whole as credentials ({...tokenInfo}: access_token,
refresh_token, expires_at, scope, org_uuid, account_uuid, email_address)
and the uuids and email again in extra (useAccountOAuth's
buildExtraInfo); read in Wei-Shaw/sub2api's source.
The siblings in the same export now come in too:
- email_address in credentials or extra (and extra.email);
- scope, OAuth's space-separated string, as Claude Code's scopes instead
of the four magpie assumes when a file says none (importScopes, shared
with loginEntry's scopes);
- account_uuid and org_uuid as the oauthAccount's accountUuid and
organizationUuid, so sameLogin tells two Team seats of one email apart
as it does for a sign-in in magpie, and the session identity has its
account id.
A ChatGPT Sub2API account already read email, id_token and
chatgpt_account_id, Sub2API's names for them (useOpenAIOAuth's
buildCredentials). The Google importer reads no Sub2API shape, and CC
Switch's import is of API-key providers, with no account email.
docs/subsystems/providers-accounts.md says which fields are read.
Run:
- TestImportSub2APIClaudeAccounts imports the reporter's file as filed
(tokens put back) and a Sub2API-shaped export with two Team seats of one
email. Old code: "got #1:failed,#2:failed,#3:failed … the file doesn't
say which Claude account this is". With only the reporter's one-line
fix (credentials email_address): "#3:failed", the seat whose email is
only in extra. With org_uuid not kept: "sk-ant-ort01-a kept as
team@example.com org \"\"". With scope not read: the seat kept the four
default scopes.
- gofmt -l, go vet (darwin), GOOS=linux go vet -tags nogui, GOOS=windows
go vet on internal/provider: clean.
- go test -tags nogui ./internal/provider -count=1: ok (130s).
Not tried: a real Sub2API export or account; `magpie accounts import`
itself, which on macOS writes the active Claude sign-in to the Keychain.
It calls the same ImportLogins.
|
||
|
|
db0af71864 |
gui: the menu bar can show today's or the last 7 days' tokens and cost (#1984)
Settings → Usage → "In the menu bar" lists two more rows after the
subscriptions: "Tokens and cost today" and "Tokens and cost, last 7 days",
ticked and saved as a card is (ids "usage:today", "usage:7d" in
trayUsages; provider ids are [a-z0-9-], so the prefix can't collide). They
show beside the allowances or alone.
- trayusage.go: a total is a card built from usage.SummarizeTop(p, 0)'s
Totals (the Usage page's own cached numbers, Input+Output as its
tokensOf counts them): tokens over cost, in the currency Settings picks,
"+" when some requests had no known price. On the Mac it is a Plain cell
(no vendor logo; the bird beside it says whose it is); on Windows/Linux
the tray's text label and tooltip ("Today in magpie / 1.2M tokens (912K
in · 318K out) / ≈$3.40+ / 152 requests…"). Quotas aren't fetched when
only totals are picked.
- Clicked, a total opens the Usage page's Overview at its period
(quotaView → ?view=usage&tab=usage&period=…, read and dropped from the
URL) or the panel's Usage tab at that period (panelUseFocus).
- Only today and 7d: the Usage page has no 3-day window, and a menu-bar
number nobody can open in magpie at the same span would disagree with it.
- The pill names a lone total, and counts a mix as "{n} shown" rather than
calling it subscriptions. Strings in en/zh/zh-TW/ja/de.
- docs/reference.md and gui-shell.md say so.
Run:
- go test -tags nogui ./internal/gui/ (sandbox HOME): ok. The new
TestTrayTotals/BesideCards/TrayCount went red with each piece broken by
hand (no Plain, no text branch, no quotaView branch, 3d accepted).
- tray-totals.test.cjs (new) plus tray-usages, tray-inuse,
proto-menu-overflow (updated for the two rows), i18n-keys, panel-usage,
allowance-open-read, tray-cell-click: 46/46 in Chromium and WebKit, five
languages, 1100 and 420 wide. tray-totals fails 5/5 against the old
app.js.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- The Mac cell image rendered and looked at (bird, "1.2M" over "$3.40").
Not tried: a real macOS menu bar, nor a Windows or Linux tray; the tray
tooltip is English, as the existing tray tooltips are.
|