8a4cfe0e4e3e02f666f5ddbaff77dc68c2d6c2a7
577
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
b6cf5e3eab |
gui: magpie web keeps its sign-in when another service on the same address fills or clears the host's cookies, and a page opened without it says why and takes the key (#2033, 321sssrt-bit)
A browser keeps cookies per host, not per port. magpie web's sign-in cookie on http://<tailscale-ip>:3430 is the same host's as every other service on that IP's other ports, so one of them could take it away, and a bookmark then answered only "open the link magpie web printed when it started". Reproduced in Docker (linux/arm64, MAGPIE_WEB_KEY fixed, as the reporter runs it) with Chromium and WebKit on the old binary: - docker restart, recreate (an update), browser restart: still signed in (the key, its derivation and the 400-day cookie are fine); - another port on the same host setting ~400 cookies: Chromium evicts the sign-in (401), WebKit keeps it; - another port answering Clear-Site-Data: "cookies" (a sign-out often does): 401 in both; - the page opened by another name for the host (localhost vs IP): 401. Changed: - the sign-in cookie is sent with Priority=High, so Chrome evicts it last when the host's cookies overflow (with it, the flood case stays signed in); - every magpie_web_<port> cookie the browser sends is tried, so a stale one sent first no longer hides the right one; - an HTML page opened without the sign-in gets a page that says which case it is (no cookie sent for this address, or a cookie holding another key) and a field to paste MAGPIE_WEB_KEY into; POST /_magpie/sign-in sets the cookie and goes back to the page asked for (local paths only: no scheme, host, //, /\ or the sign-in itself). The key is never in the page. API calls get a plain 401 that now says the reason too, and the turn-away is logged with it. - docs/reference.md's Docker web section says how long a sign-in lasts and what can take it away. Run: - TestWebGuardBookmark (link cookie has Priority=High; stale cookie first still passes; both reasons; API 401; wrong key 401 with no cookie; right key 303 to /?view=usage with a 400-day cookie; external, //, /\, javascript:, empty, sign-in-path and CRLF back values all go to /). Broken by hand: the old guard fails it (link without Priority), dropping Priority alone fails it, reading only the first cookie fails it (stale cookie: 401). - The Docker matrix above again on the new binary: the flood keeps the sign-in in Chromium; Clear-Site-Data and the other name get the form, and the form signs in (wrong key turned away, right key back to /?view=usage, 200) in Chromium and WebKit; the log says "turned away ... no cookie sent". - go test -tags nogui ./internal/gui (ok, 173s), gofmt -l, go vet darwin, GOOS=linux -tags nogui, GOOS=windows. Not tried: the reporter's own browser and Tailscale address; which service on their host takes the cookie is not known. |
||
|
|
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>
|
||
|
|
591ed58b53 |
provider: Nous Portal is a vendor preset, Nous Research's API with a Portal key (#392, Vocllum, laojianzi)
Nous Research makes the Hermes models and serves them, with other makers' models, through Nous Portal. #392 was wrongly answered as a relay. A new preset, nous ("Nous Portal", KindVendor with Hosts, lobe-icons nousresearch icon), points chat completions at https://inference-api.nousresearch.com/v1. A Portal API key goes in as a Bearer, the way Hermes Agent's own nous-api provider uses NOUS_API_KEY. The model list is the Portal's /v1/models, which uses vendor/model ids. An entry another app has at that URL, such as Hermes Agent's base_url, now imports as the preset. The preset sets no Anthropic endpoint. The Portal's /v1/messages serves only its anthropic/* models (Hermes Agent's test_nous_portal_anthropic_wire.py), so Claude Code's requests are translated to chat completions for every model. It sets no Responses endpoint either, because none is documented. The preset is added to the README (en, zh), docs/reference.md, and the site's import pages and icon. Sources: - hermes-agent docs: integrations/nous-portal, integrations/providers, features/subscription-proxy. - hermes-agent source at 6e7b83a2: hermes_cli/auth_constants.py (DEFAULT_NOUS_INFERENCE_URL), plugins/model-providers/nous, cli-config.yaml.example ("nous-api - Nous Portal API key (requires: NOUS_API_KEY)"), agent/anthropic_endpoints.py, and tests/e2e/core/live/_helpers.py, whose live run calls the Portal with NOUS_API_KEY. Probed without a key: - /v1/models answers 200 with 423 models. - /v1/chat/completions with a bad Bearer answers 401 "Your API key is invalid, blocked or out of funds". - /v1/messages answers an Anthropic-shaped 401. Not tried: a real Portal key or a real request, since no key was available. Also not built: OAuth sign-in with the 1-hour token and its refresh (Hermes Agent's ~/.hermes/auth.json). Run: - TestNousPortalPreset fails without the preset (no preset "nous") and with an Anthropic endpoint added (endpoints: … "https://inference-api.nousresearch.com"). - go test -tags nogui of internal/provider, internal/gui and internal/catalog passes. - gofmt -l is clean. - go vet, GOOS=linux go vet and GOOS=windows go vet -tags nogui on ./internal/provider pass. - add-sheet and add-button GUI tests pass in Chromium and WebKit (6/6). |
||
|
|
916e30a4f8 |
docs: every file in ~/.config/magpie says what it is for (#2028, emo172)
#2028 asked to sort ~/.config/magpie into subfolders. It stays flat: backups, sync, Docker volume mounts and older magpies all find each file by its name there, and moving them would break each of those for a cosmetic gain. What the report really lacked is knowing what each file is, so the reference's Files section now lists every file magpie writes, grouped by what it holds (what you set, accounts and sign-ins, what magpie set on agents, the gateway and usage, the window's state, and ~/.cache/magpie), with which are written 0600 and what .lock and .bak files are. Each line was checked against the code that writes the file (the path helpers and their doc comments). Docs only; nothing was run. |
||
|
|
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. |
||
|
|
c48c49488d |
lessons: the review of 10-11 to 10-13; failed reads, locks, another app's values, guarantee tests, network-free tests, tags and commit bodies move to the code standards
The nightly fold of the review of 10-11 05:20 to 10-14 04:00 (602 commits, tags v0.1.1173 to v0.1.1228, 54 of 56 published). Moved to docs/code-standards.md, each seen a third day or more: - a failed read means unknown ( |
||
|
|
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.
|
||
|
|
5241de909a |
gateway: an image URL a caller sends is downloaded only from public addresses
An images request (/v1/images/edits, /v1/images/generations) may name a reference image by URL. For a model that takes the image as bytes (an images API's multipart edit, Gemini's own API, Code Assist), magpie downloaded the URL itself with the gateway's client, to any address and through any redirect, and sent what came to the vendor as the image. fetchPicture, the one place a caller's URL is downloaded (all three draw paths go through it), now uses publicClient (image_fetch_guard.go): - the host is resolved and every address must be public (publicAddr: not loopback, RFC 1918, fc00::/7, link-local incl. 169.254.169.254, CGNAT 100.64/10, unspecified, multicast, documentation/reserved ranges, Teredo, nor an IPv4-mapped, NAT64 or 6to4 form of one); - the request is pinned to the address checked (Host and TLS ServerName keep the name), so a name resolving differently later changes nothing; a direct dial is checked again in the dialer's Control on the address actually connected; - through a proxy (magpie's, the provider's, the system's) the proxy is chosen by the name and sent the pinned address (CONNECT or SOCKS); a plain http:// URL through an HTTP proxy is asked for by address in Host too, since Go writes the absolute URI from Host; - redirects (at most 5) go through the same transport; only http(s); no keep-alives; the existing 64 MB / stall / 5-minute limits stay; - what comes back must sniff as image/*, else 400 without the body. Policy: a request from this computer (local(): loopback, no proxy or tunnel headers, and not fromBrowser) keeps downloading from anywhere, since its sender reaches those addresses already and a local agent may serve images on localhost. Everyone else, a gateway key's holder included, is held to public addresses. Vendor-returned image URLs (FetchImage for b64_json, imagemcp, video content) are unchanged: they are the vendor's, not the caller's. No other gateway path downloads a caller's URL: chat/Responses/Anthropic/Gemini image URLs are passed on for the vendor to fetch. Documented in docs/subsystems/gateway-routing.md. Run: - go test -race -count=3 -run 'PublicAddr|EditImageURL|PrivateDialer' - broke by hand, each went red: old client in fetchPicture (all three e2e tests), no Unmap (::ffff:100.64.0.1), no pinning (proxy test sees the name), no resolve check (redirect to 192.168.1.10 through the proxy served), no dialer check, no image sniff, browser allowed - go test -tags nogui ./internal/gateway/... (full) - gofmt -l; go vet -tags nogui for darwin, GOOS=linux, GOOS=windows - not tried: an https:// image through a real HTTP or SOCKS proxy |
||
|
|
6d7b440924 |
gateway: a request's ms end with its reply, not with what magpie writes down after it (#1939)
bytecode-x's full-suite failures (Millis 3772 for a stream that ended at
~450 ms; Flow 377, so DecodeOf's flow*HeldShare < window told 0/0) came
from after the reply: serve took call.Millis at its very end, after the
answered bookkeeping. answered() saves sticks and servedCandidate's
provider.NoteServed rewrites the last-answer file, both on disk. With
timing stamps added between the last content byte and call.Millis, 12
CPU burners alone gave at most 7 ms of tail (420 samples); with three
dd+sync writers beside them the block between "before served" and
"after served" took 0.7-1.5 s, the whole of the tail, while the stream
itself had ended. A user's busy disk meets the same: a paced reply reads
as one held back and shows no speed, and its duration grows.
- serve keeps `ended`, the time the last try's reply ended (when its Try
is made), reset at each try; call.Millis is ended-start when a try was
made, as before otherwise (a lane turn-away). The handed-on records
of a refused try take try.Millis, the same end.
- decide_group's usage row is timed before servedCandidate, the same
sibling.
- ttft_test's paced fixture left a leading "~" on its first event (it
strips it only for i > 0), so those fixtures' first event was no SSE
event at all (bytecode-x's second point): it now strips it without a
gap.
- docs/subsystems/gui-shell.md says where a duration ends.
Run: TestSpeedEndsWithTheReply (new: holds sticksSaving for 2 s during a
paced reasoning stream; the request must still take >= 2 s, and its
Millis must not), TestReasoningSpeed*, TestBurstTellsNoSpeed,
TestCodexBackendBurstTellsNoSpeed, TestHiddenReasoning*, TestTTFT*;
full internal/gateway and internal/provider; gofmt -l; go vet darwin,
windows, linux -tags nogui.
Broken by hand: gateway.go's change reverted -> TestSpeedEndsWithTheReply
red ("the reply's ms 2001 count the 2s magpie took saving after it").
Not done: the bookkeeping itself still runs before serve returns, so a
client that waits for the response's end still waits for the disk;
moving those writes off the request path is a separate change. The
decide_group sibling has no test of its own.
|
||
|
|
af39ee4b5f |
gateway: a 402 for a usage limit rests the model out of quota, until the window renews (#1979)
Factory answers a Standard pool used up with 402 "You've reached your weekly standard usage limit (resets in 0h 19min). Switch to Droid Core ...". failure() read every 402 as out of credit, so the whole account rested a fixed 30 minutes: its Droid Core models (GLM-5.3, the reporter's fallback) were skipped with it, the "resets in" was ignored, and renewed() never lifted the rest when the window came back, since it lifts only failQuota or By=="window" rests (Ziqi-Cui, 09:16Z). - failure(): a 402 that matches usedUpWords and says nothing of money (creditWords, insufficient_quota) is failQuota. A payment 402, an empty one, Kiro's monthly count, Command Code's credits stay credit. - With failQuota the pooled check applies: Factory's Standard windows are scoped away from Core (built-in factoryQuota matches; the plugin's notModels/models through quotaOfPlugin), so only the model rests, and only until its window's end. - resetsAt also reads "resets in Xd Yh Zmin" (resetsAfter) when no windows are known, capped at longestWritten. - FactoryAllowanceForTest / PluginAllowanceForTest let the gateway test build both paths' allowances from their real payloads. Run: TestFactoryStandardOutLeavesCore (built-in and plugin:factory), TestPaymentRequiredReadByItsWords, TestResetsInWords; full internal/gateway (327s) and internal/provider ok; gofmt -l; go vet darwin, windows, linux -tags nogui. Broken by hand: the new failure() case removed -> both subtests red (account rested for credit, GLM resting); resetsAfter returning 0 -> TestResetsInWords red; quotaOfPlugin's notModels ignored -> plugin subtest red. Not tried: a live Factory account; Factory's Droid Core used-up wording is assumed to read like Standard's. |
||
|
|
d46fb1e590 |
gateway: a tool's strict an upstream refuses is asked again without it, and left out after (#1980)
OpenCode 2 sends "strict": false on every tool through @ai-sdk/openai-compatible. thonatos's custom provider turned it away with 400 "Unsupported Chat Completions API field: tools[0].function.strict", which magpie relayed, and OpenCode ended the session. The reporter's @ai-sdk/openai workaround worked only because magpie's Responses->Chat translation leaves strict out. What changed: in passthrough's retry loop, a 400 that names a tool's strict as unsupported, unknown, unrecognized, not permitted or extra_forbidden (toolStrictRefusal, strict_refused.go) is asked once more with strict deleted from Chat tools[].function and Responses tools[] (namespaces recursed), and marked for that provider and API (toolStrictRefused, markUnfit). The next request leaves it out before sending. An upstream that never refused it still gets strict, which the ChatGPT backend needs (#383, TestResponsesToolStrict unchanged). The fix is in the gateway, not in what magpie writes to opencode.json: any client's strict reaches the same refusal. What was run: - Real OpenCode 2.0.25 in a sandbox HOME against a gateway built at the old code and a fake upstream refusing strict: the reporter's exact error ("custom-provider: Unsupported Chat Completions API field: tools[0].function.strict", opencode rc=1). With this change: answered. - TestToolStrictLeftOutWhereRefused with the two recorded OpenCode 2.0.25 requests (Chat and Responses, 12 tools each): first request carries strict, the retry none, the next turn none at once (3 upstream requests), another provider still gets strict. - Broken by hand: without the retry branch both subtests get the 400; without the pre-send check, "next turn: 200, asked 4 times". - TestToolStrictRefusalWordings, with negatives (an invalid schema, an invalid type for strict, an unsupported 'store'). - gofmt -l; go vet darwin, linux -tags nogui, windows; go test -tags nogui ./internal/gateway -count=1 (ok, 324s). Not tried: the reporter's actual upstream vendor (not named in the issue); the Responses refusal wording is assumed to match the Chat one. A translated request (Chat->Responses) that an upstream refuses for strict isn't retried by this. |
||
|
|
ffd0778696 |
agent: an agent reaching magpie through a reverse proxy isn't drift, and a sync keeps the proxy's path (#1985)
davisjiahao put magpie behind a company nginx (https://ai.corp.example/magpie) and pointed their agents there with magpie's key. Every agent whose Check compares its URL exactly called that "unwired", offered Reconnect (which writes 127.0.0.1 back), and each start's sync replaced the origin but dropped the /magpie path. Decision: a URL that isn't magpie's is still magpie when it ends with magpie's path, the rest is an http/https address on another machine, and GET <rest>/ answers as the gateway's GET / ({"name":"magpie"}). Something else there (a relay CC Switch wrote) stays drift. Loopback on another port is magpie on an older port: drift, never probed. An unknown answer is not drift (as unreachable/proxied), so Reconnect isn't offered before the probe has answered. - reach.go: magpieAt / realMagpieProbe / reachesMagpie, probed in the background through the existing cache; answersAsMagpie shared with codex_proxy.go's realProxyProbe. offLoopback takes https too. - applied.go: wiringOff (the choke point for ~40 agents) accepts it; Codex's "bypassed" isn't told for a request to the host the config keeps magpie at, or one the gateway saw from it after. - claude.go (managed settings) and reasonix.go: their own exact checks. - codex.go: codexKeptGateway keeps https, default ports and a path prefix (#816's kept address, trusted by magpie's key); viaBase matches the kept codexURL, since at.host() falls back to loopback for https. - keptaway.go: awayPath keeps the path every URL at the away address had. - Port moves need nothing: Rewire/OnGateway re-set only unwired agents. - Picking a model in magpie still points the agent at this magpie (documented, unchanged). Run (sandbox HOME, worktree): - go test -tags nogui ./internal/agent: ok (297s) rebased on |
||
|
|
f64d9312ff |
site, docs: a Privacy page lists everything magpie sends and how to turn it off (#1986)
#1986 asked what the daily count sends, where the id lives and how to stop it. The answer was spread over one README paragraph and the reference. A new page, /docs/privacy (en, zh, ja), lists it from the code: - the daily PostHog batch (internal/stats): a whole example, the label rules for agents/providers/models, partner counts, the $process_person_profile:false flag; - every switch: Settings -> Privacy's two toggles, noStats/noUsageStats, DO_NOT_TRACK / MAGPIE_NO_STATS, noAutoUpdate (About -> Automatic updates), and that a change applies at the next hourly look; - the files: install-id (made at the first send, not at first run, as the issue said) and stats-sent in settings.Dir(), partner-counts.json in the cache folder, their paths per OS and portable, and deleting them; - what usemagpie.ai sees whatever the settings (update feed every 6h, notes, partner list with its 1-in-10 sampled count, /go links, the icon proxy) and the Cloudflare Web Analytics on the site's own pages; - public lists fetched (models.dev, open.er-api.com, npm, GitHub) and providers' quota reads with the user's own accounts; - OTLP export, off by default, its env vars; - why the count stays on by default in releases. Every docs page in all three languages gets a Privacy link in its nav and footer. README (en, zh) and start.html's "What does magpie send about me?" (en, zh, ja) link to the page. docs/reference.md's Files list gains install-id, stats-sent and partner-counts.json, and Counting users says when the id is made, the hourly try, and links the page. Checked against: internal/stats/stats.go, usage.go, provider/partner_events.go, settings (NoStats, NoUsageStats, NoAutoUpdate, UpdateEvery 360, otel.go), appdir, update, fx, catalog, site/worker.js, and the GUI's Settings tabs/labels in index.html, app.js and i18n.js (zh, ja). Run: Playwright (Chromium and WebKit) on all three pages at 1100 and 420 wide, light and dark: no horizontal scroll, no element past the viewport, no page errors (24/24), screenshots looked at for zh at 420 dark. Every href/anchor in site/public/docs resolves; relative links in README and reference resolve. node site/worker.test.mjs passes. Not run: the page on the deployed worker (the site deploys by hand with wrangler, so it is live at the next deploy); the language redirect for /docs/privacy was not exercised beyond the worker's existing tests. |
||
|
|
9e76fcdc68 |
plugin, cli, gui: a plugin's "password" question is typed unseen, as an API key is (#1982)
A sign-in method's prompts could only be "text" or "select", so a token a plugin asks for (the Qoder plugin's PAT sign-in, magpie-community/plugins#103) showed on screen as it was typed, in the app and in `magpie plugin login`. What changed: - internal/gui/assets/app.js renderPluginAsk: a prompt of type "password" gets a password field (masked), the same field an "api" method's key gets. A "text" prompt is unchanged. - internal/cli/plugins_cli.go askPrompt: on a terminal a "password" prompt is read with term.ReadPassword (no echo); piped in it is read as a line, as a script answers it, and an empty answer still goes to the plugin's validate, as a text one does. - internal/plugin/providers.go: the Prompt type lists "password". host.js passes the type through untouched, so nothing there changes. The TUI has no plugin sign-in. - Docs: docs/reference.md and site/public/docs (en, zh, ja) plugins.html say what "password" does and that it is magpie's own (OpenCode has text and select). The answer is only sent to /api/plugin-signin/prompt and the sign-in, as a text answer is; nothing logs or shows it. What was run: - TestAskPromptPasswordIsUnseen (internal/cli): with the password branch disabled by hand it fails with `password on a terminal = "typed-in-the-open", <nil>, hidden reads 0; want pt-secret read unseen`; restored it passes. - plugin-password-prompt.test.cjs: Chromium and WebKit, en/zh/zh-TW/ja/de, 1100 and 420 wide, 11/11 each. With app.js put back it fails with expected 'password', actual 'text'. plugin-signin and plugin-signed-out-account 16/16 in both engines; i18n-keys passes in both. - gofmt -l clean; go vet for darwin, GOOS=linux -tags nogui and GOOS=windows on internal/cli, internal/plugin, internal/gui; go test -tags nogui of those three packages in a sandbox HOME: ok. Not tried: a real Qoder PAT through the community plugin (its PR isn't merged), and the CLI on a real Windows console (term.ReadPassword is the same call `magpie plugin login` already uses for an API key). |
||
|
|
12ecb6d8e9 |
gateway: a gateway key held to a budget, models or accounts is told none of this magpie's accounts, only its own limit and routes (#1981)
321sssrt-bit shared magpie on the LAN with a gateway key held to a budget, and that key still read every account's quota and balance. A held key (heldKey: a budget, models or accounts) is someone else's to use, so it now gets 403 with code gateway_key_held (refuseHeld) on /v1/magpie/quotas, quotas/history, quotas/cards, POST quotas/refresh and /v1/magpie/concurrency. That holds from loopback as well as the LAN, the same as usageSummary already did. /v1/magpie/route tells it only the routes of its own requests. Route.callerKey is set by trace.beginFor at all five begin sites, so a route begun without it fails closed. It still reads its own limit at /v1/magpie/limit. Unrestricted keys and the local owner are unchanged. Client side (remote magpie): a 403 gateway_key_held drops the cards kept from before and shows only the key's own card, instead of "isn't shared". The cache is now keyed by provider and key (remoteCardsID), so a changed key never shows what the old one was told, and keepRemoteCards keeps a read only over one asked before it, so a slow pre-held answer can't bring cards back. Decided against letting an account-held key see its own accounts' cards: that would still show the host's account email and balance to the key's holder. Run: - New TestHeldKeyToldNoAccounts covers keys held by budget, models and accounts plus one held to nothing, from 127.0.0.1 and 192.168.1.9. Every route goes red with the refuseHeld calls or the route filter removed by hand. - New TestRemoteMagpieHeldKeyShowsOnlyItsOwnCard goes red with the errKeyHeld mapping removed. TestRemoteMagpieCardsKeptByKey goes red with the cache keyed by p.ID alone. - gofmt -l and go vet (darwin, linux -tags nogui, windows) are clean. - go test -tags nogui ./internal/gateway ./internal/provider -count=1 passes in a sandbox HOME. Not tried: two real machines over the LAN; the tests drive the handler with LAN remote addresses. An older client shows "isn't shared" (or its cached cards until they expire) against an updated host until it updates too. |
||
|
|
42216ea609 |
gateway, gui: one model out of its pool rests on that model's rows only, not on the account's other models (#1960, WardLu)
An Antigravity account out of its Claude & GPT pool (claude-opus-5.5
refused until Sunday) rests that model alone: the gateway keys the rest
by restID and still sends gemini-3.8-flash, in its own pool, to the
account. Routing's page didn't know a rest could be one model's: it
kept rests by key or account, so the stage marked the account's
gemini-3.8-flash row "quota used up · back at Sun 17:53", and the row
under Accounts and keys said the whole account was out.
- gateway: Rest.Model names the model a rest is for when it rests by
restID (a pool, a model not served, a paid model beside free ones);
"" for an account- or key-wide rest.
- routing.js: restModel reads it (or, for a kept request from before,
the model on the end of Rest.Key). The stage keeps a model's own rest
by key and model, so only that model's row rests; an answered try
ends the account's rest and its own model's. Accounts and keys keeps
an account's model rests apart from its own: the account isn't shown
as out, a line names the models resting with why and when, and Try
now lifts those rests. An account resting as a whole is as before.
- docs/subsystems/gateway-routing.md says so.
Run: routing-model-rest.test.cjs (new), Chromium and WebKit, 1100 and
420, en/zh/zh-TW/ja/de, 20/20; with the old routing.js it fails
("old@x.test: gemini-3.8-flash rests with Opus"). All 74 routing/rest
GUI test files in both engines (456 each, 0 fail).
TestPoolRefusalRestsTheModelOnly checks Rest.Model, set and read back.
go test ./internal/gateway ./internal/gui, gofmt -l, go vet
darwin/linux/windows (-tags nogui).
Not tried: the reporter's real Antigravity account in the app.
|
||
|
|
692a779d3d |
library: an instruction set can be kept in a file of your own, such as ~/.agents/AGENTS.md (新v学员 on Discord)
新v学员 keeps one user-level ~/.agents/AGENTS.md by hand and wants every agent to follow it. Only Factory Droid, omp and Cline CLI read that file natively; Codex, Claude Code, Gemini, OpenCode, Pi, Amp and the rest don't. Rather than teach magpie a new agent target, a set of shared instructions can now be kept in that file instead of a copy in the library, and the library writes it into every agent that is on, as it does any set. What changed: - InstrSet.File: a set kept in a file of the user's own. Its text is read from that file, Save writes to it (kept aside in the backups first, written atomically, never removed: emptied, it stays empty), and Remove lets go of the set without touching the file. - The file is refused when it is relative, a folder, an agent's own instructions or override file (magpie writes into those), a file holding magpie's marked block, inside the library, or another set's. A file not there yet is made on the first save. - The GUI checks the active linked file every 30s (KeepLinked) and writes a change made in an editor into the agents. - Carried by davsync or a backup, a linked set goes as its text; where the file is stays this computer's. Put back, the set keeps its file and the file gets the carried text, never emptied for a text not carried. A profile restored with no text doesn't empty it either. - GUI: New set has "Keep in a file…" (filled with ~/.agents/AGENTS.md); a linked set is tagged "Your file", says where it is kept, and warns when Droid or omp is on, as they read ~/.agents/AGENTS.md themselves and would get it twice. Strings in zh, zh-TW, ja and de. Run: - gofmt -l; go vet for darwin, linux/amd64 -tags nogui and windows/amd64 on ./internal/library ./internal/gui. - go test ./internal/library ./internal/gui -count=1: ok. - New TestLinkedSet, TestLinkRefused, TestLinkedSetCarried. Each was broken by hand and went red: putText writing a linked file like a library one, Collect not stripping File, Put not restoring it, SyncLinked not syncing, linkable not checking agents' own files. - library-linked-set.test.cjs in chromium and webkit, at 1100 and 420, in en, zh, zh-TW, ja, de: 22 pass; red with the file left out of create. library-instr-sets and i18n-keys still pass. Not done or tried: - No CLI to link a set (`magpie library instructions set <file>` still copies once), and the headless `magpie serve` doesn't watch the file: after an edit there, `magpie library sync` writes it out. - Not tried with real Droid or omp reading the same file. |
||
|
|
113672508a |
claude: a re-told conversation says whose Claude Code's "[Image: …]" notes are, so a text-only turn isn't read as carrying the history's images (#1751)
arvakme's request from Pi over /v1/chat/completions: a read tool's image in an
earlier turn, then a text-only question. Through the Claude subscription the
model quoted "[Image: source: …-magpie-claude-work-501/<uuid>/images/1.png]"
and said the message had an image attached.
Why: a new run is told the whole conversation in one message, and Claude Code
2.1.296 notes every image block of the message it is given in a note of its
own after the message, so after </current_turn>. Read from its binary: with
the session kept on disk (the shared work folder, where the bridge drops
--no-session-persistence for savedSession) it stores each base64 image to
<tmp>/<session>/images/N.png and the note names the path; with the session
off it still notes any image it scaled down ("[Image: original 3000x2000,
displayed at 2000x1333 …]"). So turning persistence off was not enough. Images
under url sources are not noted.
What changed: when the history has images, the current turn's opening says
the notes after it are the history's (or, when the turn has images too, the
history's first and then the turn's), in currentTurnOpen. A history with no
image is told exactly as before, and the history's own text is unchanged, so
its cached chunks are too. countImages is shared with start's log line.
Run against the real model (owner's Max account, its access token in a
sandbox CLAUDE_CONFIG_DIR, Claude Code 2.1.296 with the bridge's flags and
the stream-json message renderClaudePrompt makes from arvakme's request, a
120x60 red PNG):
- old prompt, session kept (as the bridge runs): sonnet-5-5 2 of 2 said an
image was attached and quoted the path; opus-5-5 2 of 2 quoted it and
offered to read the file. Old prompt with a 3000x2000 image and the session
off: 2 of 2 said attached (the size note).
- new prompt, session kept: sonnet-5-5 3 of 3 "no image attached", the note
named as the earlier image's; opus-5-5 2 of 2 the same; 3000x2000 history
image 2 of 2 the same; a new blue image in the turn after the red one in
the history: 2 of 2 "one image, blue", note 1 the history's, note 2 the
turn's.
The Anthropic request bodies were also captured from Claude Code against a
local fake API to see where the note lands (a text block after the turn).
TestClaudePromptSaysWhoseImageNotesAre builds arvakme's request through
parseChat; it fails on the old code (historyClose always) and with the mixed
case broken by hand. gofmt, go vet (darwin, GOOS=linux -tags nogui,
GOOS=windows), builds on all three and go test -tags nogui ./internal/gateway/
pass.
Not done: the original report's duplicates (18 image blocks for 10 images
from Codex) are a separate question; Codex desktop itself was not run.
|
||
|
|
ea1ba22c32 |
gateway, gui: Codex's composer predictions go where Settings › General says, Off among them (#1970)
pluo's Usage view showed Codex calls of kind composer_predictions at
133k-231k tokens each with no cache read: ChatGPT.app's Codex guesses the
user's next message with a hidden turn on a fork of the thread, on the
thread's own model, reading the whole conversation again each time. It
asks only when the thread's provider is "openai", so through Codex's own
ChatGPT sign-in (and a custom table pointed at magpie). The app's bundle
(fge) asks for {suggestion: string|null} and uses b.suggestion||null.
What changed:
- settings.CodexPredictions: "" as Codex sends it, "off", or a model id
(provider/model, group/<id>); anything else is refused on load.
- gateway: codexPredictionsTo + codexPrediction, wired beside the
descriptions at both entrypoints (gateway.go and codex_backend.go).
Off answers {"suggestion":null} from magpie and sends nothing (the
title Off path made generic as sentNowhere). A model's answer goes back
only as the object Codex asked for (predictionJSON: think tags and code
fences stripped, suggestion trimmed, blank = null). Plain text is never
taken as a suggestion, since Codex would put it in the user's composer
as their next message; it gives null and is recorded as a failure
("prediction: ...").
- usage: purpose "Prediction" for composer_predictions (purposes.js
regenerated).
- gui: POST /api/settings/codex-predictions, kept by the general save;
Settings › General row "Codex composer predictions" (Codex's own / Off /
magpie's models, the app's picker), hidden in gateway mode; Routing's
story for the kind says Codex's own switch (Settings › General › Show
predictions) and magpie's. i18n in zh, zh-TW, ja, de.
- docs: gateway-routing.md's Codex section, reference.md's gateway-mode
list. site/ docs left for the owner.
What was run:
- go test -tags nogui ./internal/gateway/ (full, -timeout 40m),
./internal/gui/ ./internal/settings/ ./internal/usage/: pass.
New: TestCodexPredictionsSetting (default to ChatGPT, off sent nowhere,
model routed, plain turn untouched, ledger kinds), TestNoPrediction,
TestCodexPredictionOnMagpie (/v1/responses and the backend path),
TestPredictionJSON; gui TestCodexPredictionsSetting.
- Broken by hand, each went red: backend wiring removed; plain text
accepted as a suggestion; the general save not keeping the setting;
the Routing story's kind check.
- Playwright codex-predictions.test.cjs: chromium + webkit, 1100 and 420
wide, en/zh/zh-TW/ja/de (20 pass). routing-kind (with the new kind),
codex-descriptions, codex-titles, i18n-keys, gateway-mode,
purpose-filter, routing-purpose-state, settings-general,
settings-sections, settings-search: pass.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows.
Not tried: the real ChatGPT.app's predictions against magpie (the
feature is gated server-side by /wham/predictions/config and isn't on for
the owner's account); the reply shape is from the app's bundle.
|
||
|
|
05edac2c36 |
daemon: the service's PATH has the Node a terminal gets, nvm's default among them (bookyue on Discord)
What changed: `magpie daemon install` now widens PATH before writing it into the systemd unit or launch agent, the way the app does when opened from the Dock (proc.UserPath): the version managers' and npm's folders that exist, nvm's default Node (not its newest), then the login shell's own PATH (proc.LoginPath), each after the folders the install's shell already had. When no node is found even then, the install says so. Why: the service has only the PATH written into it. With nvm loaded lazily, or an install run over ssh without a login shell, that PATH had no node, and plugins (and the MCP servers and agent CLIs they start) couldn't find it under systemd (bookyue, #feedback 838099). Run: gofmt -l; go vet darwin, linux -tags nogui, windows (daemon, cli); go test ./internal/daemon ./internal/cli -count=1 on macOS; the daemon test binary for linux/arm64 in debian:bookworm-slim (all pass). TestInstallFindsNvmNode uses the real widening with a sandbox HOME holding nvm v20 (default) and v22: the unit's PATH has v20's bin, not v22's, after the shell's own. With the widenPath() call removed by hand it fails (PATH is the shell's alone, Node() empty). Not run: a real systemd install with nvm since this change (the earlier container run, before it, covered install/restart/linger); not tried with fnm or volta, which UserPath handles the same way for the app. |
||
|
|
5617281f55 |
cli: magpie daemon install|uninstall|start|stop|restart|status keeps the gateway running as a service (HuanCheng on Discord)
What changed: a new internal/daemon package and `magpie daemon`, which run
`magpie serve` as the user's own service, with no window and no desktop
session.
- Linux: a systemd user unit at ~/.config/systemd/user/magpie.service
(Restart=on-failure), driven by systemctl --user. status reads
`systemctl --user show`, and says `sudo loginctl enable-linger $USER`
when the user doesn't linger. su/sudo without the user's bus, no
systemd, and WSL without systemd each get an error that says what to
do.
- macOS: a launch agent, com.yetone.magpie.serve (RunAtLoad, KeepAlive on
failure), loaded with launchctl bootstrap gui/$UID. Its log is
~/Library/Logs/magpie/serve.log.
- Windows and Android: refused, pointing to `magpie autostart on` (or to
WSL).
- The service carries PATH, the proxy variables, MAGPIE_*, the XDG folders
and the agents' folder variables from the install shell. The file is
0600 because a proxy can hold a password. It runs magpie by its PATH
name when that is the same file, so Homebrew's link survives updates.
It refuses a go-build binary and an AppTranslocation copy.
- Install is refused while `magpie autostart` is on: the tray app serves
the gateway too, and the two would crash-loop on the port.
- Docs: a reference.md section, and one sentence on the site's start page
(en, zh, ja).
Why: users on headless Linux boxes asked for a supported way to keep
`magpie serve` up across reboots instead of hand-written units. The
existing `magpie autostart` needs a desktop session (an XDG autostart
entry).
What was run:
- gofmt -l; go vet on darwin, GOOS=linux -tags nogui, and GOOS=windows.
- go test ./internal/daemon ./internal/cli on macOS, at origin/main
|
||
|
|
7d6358ff6b |
gateway: /v1/models can list each model by its bare id too, for apps moved from another proxy (love1sbug on X)
love1sbug moved from CLIProxyAPI: their clients ask for gpt-5.6-sol, and magpie's /v1/models gave only codex/gpt-5.6-sol. "Provider in model names" ( |
||
|
|
9b52fb504a |
gateway: Codex's web search on magpie's models answers, no longer 404 (anton on Discord)
anton on Discord (Linux): asked to look something up, Codex called its web.run tool, which posts to <base_url>/alpha/search, here http://127.0.0.1:3425/v1/alpha/search. magpie had no such route and answered 404, and Codex takes any failed web.run as fatal, so the turn ended. Why Codex sends it: since 0.143 (#29909) Codex offers web.run to a provider that sends x-openai-actor-authorization, as magpie's provider table does, on a model whose catalog entry says use_responses_lite, as a ChatGPT account's models do in magpie (codexcat copies Codex's own entry). The request is codex-api's SearchRequest (id, model, input, commands.search_query/open/click/find..., settings, max_output_tokens) and the reply is {encrypted_output, output, results}, output being what the model is shown. What changed: - POST /v1/alpha/search and /alpha/search are served (codex_search.go). - A ChatGPT account's model goes to the ChatGPT backend's /backend-api/codex/alpha/search, as the official client sends it: on the account's sign-in (codexSign, no SSE Accept), the model bare, the body otherwise as it came (through redaction), only Codex's own x-openai-*/x-codex-* headers kept (codexHeader: never magpie's token or the actor header). Its own paused sign-in is passed over, the key's account and model holds kept, and the next account is asked on a non-2xx; the backend's answer is relayed as it is. - Any other model's search_query/image_query (domains as site:) is searched by webSearch, as magpie searches for a model that can't. When nothing answers, or only open/click/find were asked, the reason goes back as a 200 with output, which the model reads, instead of a failure that ends the turn. A ChatGPT search that fails on every account falls back to the same, saying why. - On the Codex backend path a magpie model's /alpha/search is served the same, never relayed on Codex's own sign-in; one of Codex's own models goes through magpie's accounts when its turns would (codexAccounts), else is relayed as before. - docs/subsystems/gateway-routing.md names the route. What was run (worktree on origin/main, sandbox HOME, private GOCACHE): - New tests from Codex's own wire fixture (codex-api endpoint/search.rs): TestCodexWebRunSearchesOnChatGPTAccount (both paths; acct-1 429 -> acct-2, bare model, body kept, no magpie token/actor header, turn metadata kept), TestCodexWebRunChatGPTFailsSearchedByMagpie, TestCodexWebRunOnOtherModelSearchedByMagpie (no searcher hint, search API asked "OpenAI news site:openai.com", open-only, bad JSON 400, and a stub ChatGPT backend that fails the test if reached). - Broken by hand three ways, each red: without the /v1 route (404 as anton saw), without the codexBackend case (relayed to the backend on Codex's sign-in), without the ChatGPT forward (searched by magpie). - go test ./internal/gateway/ -timeout 30m, gofmt -l, go vet darwin, GOOS=linux go vet -tags nogui, GOOS=windows go vet. Not tried: the real codex binary against a sandbox magpie, nor a real ChatGPT account's /alpha/search; the shape is from Codex's source and its own test fixture. |
||
|
|
dc2f0da820 |
gateway, gui: Image recognition and Web search pick how hard their model thinks (MOMO on Discord)
MOMO asked on Discord, "外置模型能不能提供思考深度选项": the model that describes images (Image recognition, analyze_image) and the searcher's model (e.g. Antigravity's Gemini 3 Flash) had no reasoning level of their own to pick. Settings › Models now has a chip beside each of those two pickers. It opens the app's menu (openProtoMenu, no native select) and offers Default plus only the levels that model has (Efforts, weakest first; none shown when the model's levels aren't known, or the row is Off). The pick is saved as settings.visionEffort / searcherEffort, one of catalog.EffortRank or empty, and is checked on save. prefsKeep carries both, so saving another setting keeps them. Default keeps what magpie did before. Image recognition is still asked at the least level the model has (classifyEffort), and the searcher still gets no level. A picked level is fitted to the model's levels at call time (fitEffort), and only these two calls carry it (side_effort.go): - askVisionWith sends reasoning_effort. The image cache key includes the level, so changing the level reads the image again. - searchBody puts thinking (disabled for none, else enabled with budgetOf's budget) and output_config.effort (except for pre-adaptive Claude) on the searcher's Anthropic body. The gateway's translation turns that into each vendor's own form: adaptive or between_tools for new Claude, reasoning.effort for Responses, and thinkingLevel for Gemini 3 on Code Assist / Antigravity. - A picked level raises max_tokens by its budget (replyRoom), so the thinking doesn't eat the reply. - ownSearch and Kimi's search service are sent no level. A fallback searcher is sent the level fitted to its own model. docs/subsystems/gateway-routing.md: new "How hard a side model thinks". Tests: - TestVisionEffortPicked and TestVisionEffortOnAnthropic check the vision body. - TestSearcherEffortPicked checks the searcher body on new Claude, old Claude and Responses. - TestSearcherEffortOnGemini checks the searcher body through buildCodeAssist for antigravity. - TestSideEffortChecked covers settings validation. - side-effort.test.cjs covers the chips: levels shown, a pick saved, Default clears it, toggle and Escape, no scroll, fit in the row and the menu inside the window. It runs in Chromium and WebKit at 1100 and 420, in en/zh/zh-TW/ja/de. Run: - go test -tags nogui ./internal/gateway/ (full, -timeout 30m) on origin/main |
||
|
|
b2b015c584 |
provider: MLX-Serve's decision models classify routing groups through System One, separated from chat models by capabilities
MLX-Serve (github.com/ddalcu/mlx-serve) serves decision models (Clef, Clef-Flash, Kev, Laya, D1) at POST /v1/systemone (and /v1/decisions). Its /v1/models lists them alongside chat models, marking them with capabilities: ["decisions"]. Setting a routing group classifier to an mlx-serve decision model previously failed because the preset had no decision endpoint and magpie offered it as a chat model, which MLX-Serve rejected with 400. - The mlx-serve preset has a decision base, http://localhost:11234/v1. An existing MLX-Serve provider saved without decide gets its chat base as one, at whatever port it was given (as oMLX does). - mlxServeDecides joins listsDecisions. fetchDecide reads /v1/models and keeps models with the "decisions" capability under <id>.decisions, with the model's context window and input modalities. - DecidesModel takes them out of the agents' chat lists and offers them as deciders. Jev() is the first of them. A server with no decision model lists none, and no Jev alias is made up for it. - Provider test on a decision model asks System One rather than chat. Run: - TestMlxServeDecisionModels: fake MLX-Serve answers with real captured fields. Clef-Flash with capabilities: ["decisions"] is a decider, chat models reach agents, and RouteDecider plus AskSystemOne post to /v1/systemone. TestModels tests clef-flash-4bit via decide. Red without mlxServeDecides in listsDecisions. - TestListedMLXServeDecideTable: real captured response, vision modalities, `models` field fallback with omitted input_modalities, chat-only server, empty list, and invalid JSON. - TestMLXServeWithoutDecisionModels: no decision model means none, not Jev. - Real MLX-Serve on localhost:11234 in sandbox HOME with isolated config: provider add mlx-serve, provider refresh, provider test mlx-serve clef-flash-4bit (543 ms, decide OK), group add with classifier. - go test -tags nogui ./internal/provider/..., gofmt -l, GOOS=linux and GOOS=windows go vet, cross-OS builds. |
||
|
|
5e30d58fe4 |
usage: a request's row says the upstream's own stop reason on the Requests page, in /v1/magpie/usage/requests and in the CSV (#1927, Gluxggg)
What changed: the gateway has recorded why the upstream said each reply ended (Record.Stop: a Responses reply's "completed", Chat's "stop" or "tool_calls", Anthropic's "end_turn") since |
||
|
|
a65f2131dd |
gateway: a provider's model can be marked a video or image model in its editor (#1399, shen-joe)
shen-joe's relay serves a video model (agnes-video-2.5-flash), but its
/models list doesn't say "kind": "video". magpie only took a base-URL
provider's video models from that field, and its image models from that
field or from the model's name. So the model could never be asked at
/videos. They asked to tag video models, either in Settings or when
adding the provider.
What changed:
- settings.ModelKinds holds "image" or "video" by "<provider>/<model>".
RenamePerModel carries it along with the other Model* maps.
- provider/modelkind.go:
- MarksKinds: only a provider with its own base URL can be marked. A
subscription, another magpie and a decision API can't.
- ModelKind, KindModels and SetModelKind. A model can be marked if the
provider serves it, or if its fetched list has it (a video model is
left out of the chat list).
- SetModelPrefs takes a "kind" with the model's other prefs.
- gateway:
- Drawers adds the models marked image and drops the ones marked video.
- customVideomakers adds the models marked video and drops the ones
marked image.
- The 400 for a model that can't make videos now says where to mark it.
- GUI: the model chip's right-click menu gets "Makes: Auto/Image
model/Video model…" (an app menu, not a native select). The pick is
staged until Save, and a marked model shows a small image/video tag.
Strings are in zh, zh-TW, ja and de.
- docs/subsystems/gateway-routing.md describes it.
- settings_keep_test sets ModelKinds, so a Settings-page save is checked
to keep it (that guard test went red until it did).
Why per model, in the provider's editor: the kind belongs to one model
of one provider, like the per-model API pref already set there.
Settings → Image/Video only pick the default model. This also covers
their "tag it on the provider" alternative.
Not done: Agnes's own video API (polling at /agnesapi?video_id=, the
finished video in "url") isn't OpenAI's GET /videos/{id}. Marking the
model gets the request to its /videos, but the poll won't match until
there's a mode for it. I've asked the reporter for real responses.
Run:
- go test ./internal/provider ./internal/settings ./internal/gui
./internal/gateway: ok (gateway 1658s).
- TestCustomProviderVideoTheUserMarks, which goes red with the
KindModels loop in video.go removed.
- GUI model-kind.test.cjs, 16/16 (en/zh/ja/de, 900/420, Chromium and
WebKit). It goes red with the menu item removed.
- Sibling GUI tests: model-api-gemini, model-copy-id, model-api-preset,
model-test-one/as/why, provider-detect-models, provider-typed,
i18n-keys, gui-ja and gui-de.
- gofmt, plus linux and windows go vet -tags nogui.
- Not tried against Agnes's real API (no key).
|
||
|
|
3ccbe6bc15 |
plugins: a runtime for built-in plugins, and Plugins › Built-in to switch them (P0)
Lxxyx on X (https://x.com/Lxxyx_/status/2109506752656150974): magpie has too much in it. This is P0 of making magpie's parts plugins, as DeepSeek Harness does: a runtime, plugins.yml, and the first five built-in plugins the user can switch off. - internal/pluginrt: a registry (Register from init), a manifest (API caret range, Requires/Provides, Essential, InUse, Apply, Parts, Defaults) and Reconcile: the plugins no longer wanted, with whatever needs a service they provided, are disposed newest first; the wanted ones are applied once their services are there. A plugin that fails or panics is failed and the rest run. TestPluginsImportOnlyCore keeps the boundary: nothing outside plugins/ imports one, none imports another. - plugins.yml (appdir.Config()): default → preset (essentials | all) → the user's rows → in use. A new install is written Essentials, a magpie that ran here before (settings.RanBefore) All, so existing users keep everything. Writes are locked, whole and keep a .bak; a file that doesn't parse is an error, never empty, and is never written over. - plugins/groups, library, otel, sessions, warmups. In P0 a plugin off is the window's alone: its page, sections and rows (data-feature) leave the window; the gateway, TUI and CLI serve the same, nothing is deleted. One in use stays on. - The window: Plugins › Built-in, the first tab, a switch per plugin; GET/POST /api/plugins/builtin; boot.js says which are off before the first paint. CLI: magpie plugin builtin [on|off <id>], plugin preset, plugin dump [--json]. - docs/subsystems/plugin-runtime.md, gui-shell.md. Run: go test ./internal/pluginrt/ ./internal/settings/ ./internal/gui/; gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./.... GUI: builtins.test.cjs in Chromium and WebKit, 5 languages, 1100/800/420; list-sort, mobile-web, routing-keys-fold, routing-sessions pass. By hand under a sandbox HOME: a new install gets essentials, an existing one all, a broken plugins.yml is refused and kept, dump works. Full suite results after the rebase are in the push notes. |
||
|
|
f2b0780fa2 |
gateway: a held rule fails over within the member it chose, and a fallback outside it isn't kept for the turn (#1946, XcodeFish)
A group of coding-fast and coding-quality, its rule sending turns to coding-quality: when coding-quality's member failed mid-turn the request went to coding-fast's members before coding-quality's other one, and the turn then stayed on coding-fast. Within a turn the rule is held, and when affinity kept a member the rule's order wasn't applied at all (gateway.go and nestedRules skipped `hit.Held && aff.Kept`), so the failover order was the kept one, then the parent's own order. ruleOver (rules.go), used at the group's rule and every nested group's: - the kept one stays first while it is of the rule's member that goes first (the one it names, or a Then's while that is resting); the rule's other members follow it, ahead of the group's others; - one kept outside that member, which took over when it failed, isn't held: once a member of the rule's target is out of its rest, the next request of the turn goes back to it (Affinity.Why "rule"). While all of it rests, the fallback stays. No new option. docs/subsystems/gateway-routing.md says so. Run (before the rebase onto origin/main): go test -tags nogui -count=1 ./internal/gateway/: green but for TestKimiHeldBurstTellsNoSpeed at load average ~139 (passes 3 of 3 alone; filed as #1963, not on this path), gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway/. TestHeldRuleFailsOverWithinItsMember fails on the old code (tried [kq1 kf1], the reporter's order), and with the go-back part disabled by hand (round 3 kept on f1). After the rebase: gofmt, both vets, and go test -run 'Rule|Group|Affin|Nested|Stick|Turn|Classif|Decide|Pause' ./internal/gateway/ green. |
||
|
|
a894559e23 |
library: a project's skills and MCP servers reach Qoder, CodeBuddy, Droid, Cline and Command Code (eirc on Discord)
eirc could give Qoder and other agents skills and MCP servers only
user-wide; Library's project page didn't offer them. Each agent now gets
the project folder or file its own source or docs say it reads:
- Qoder, Qoder CN: skills in .qoder/skills, servers in
.qoder/settings.json's mcpServers (@qoder-ai/qodercli and
@qodercn-ai/qoderclicn 1.1.69: projectConfigDirName ".qoder",
getProjectSkillsDir = <config>/skills; docs.qoder.com/cli/mcp-reference).
- CodeBuddy Code: skills in .codebuddy/skills, servers in .mcp.json, or
mcp.json when the project has only that (2.164.0 reads the first of
[.mcp.json, mcp.json]).
- Droid: servers in .factory/mcp.json, skills in .agents/skills
(docs.factory.com).
- Cline: skills in .agents/skills (CLI 3.0.70 reads .clinerules, .cline
and .agents /skills).
- Command Code: skills in .commandcode/skills (commandcode.ai/docs/skills).
Left out, unconfirmed: Command Code's project MCP (.mcp.json in its own
transport shape, which would clash with Claude's), Copilot CLI's project
MCP, Zed's .zed/settings.json, WorkBuddy. docs/subsystems/library.md gets
a Projects row.
Run: go test -tags nogui ./internal/library (temp HOME, pinned module
cache); the three new tests in project_targets_test.go fail with the map
entries reverted ("magpie knows of no folder qoder reads a project's
skills from"), and the CodeBuddy mcp.json test fails with that fallback
turned off. gofmt -l clean; go vet -tags nogui on darwin, linux and
windows. No GUI asset changed (the page takes both from sync.go). Not
tried with the real Qoder, CodeBuddy or Droid CLIs.
|
||
|
|
110b204313 |
sessions: Pi's and omp's own calls reach Usage, here and in WSL (#1951, Elenoxe)
Pi in WSL on a provider of its own never reached the Usage page: the
call ledger had no reader for Pi's or omp's session files, so only what
went through magpie's gateway was counted, and Sessions showed tokens
that Usage didn't.
calls_pi.go reads them whole, as call_cache's wholeCallReaders does for
Kimi, from piFiles, ompFiles and wslFiles("pi","omp"):
- each assistant message is a call on its own provider and model, with
Pi's durationMs or omp's duration/ttft;
- "usage" / "model_usage" entries on the provider they name, and a
compaction's, branch summary's or tool result's usage on the model in
use, as Sessions counts them;
- a call through magpie's own entry (provider "magpie", "dial" before
the rename) is left to the gateway, which logged it already;
- a failed call (no usage) is none;
- a fork's copies of its parent's entries (written before its header's
time) are the parent's, and a call is keyed by entry id + time.
The fixtures are Pi 1.1.0's and omp 18.9.1's own files, written in a
sandbox HOME against a fake OpenAI-compatible relay (a run, a pi --fork
of it, a session whose calls failed before it went on through magpie);
the magpie lines are the owner's own Pi's, the reply text left out.
Run: go test -tags nogui -count=1 -timeout 45m ./internal/sessions
./internal/usage ./internal/cli ./internal/gui (green); gofmt -l; go vet
-tags nogui on darwin, GOOS=linux and GOOS=windows for internal/sessions.
Broken by hand: with the reader unregistered TestPiCalls finds 0 pi
calls and TestWSLSessionsListed says the distro's pi calls aren't
counted; without the magpie skip TestPiCalls/BesideReplies count the
gateway's calls; without the fork rule reading the fork's file alone
gives its parent's calls too.
Not tried: a real WSL distro (wslFiles is covered by the existing fake
distro), Windows paths at runtime, real "usage"/"model_usage"/
branch_summary entries beyond the fixtures. Grouping the Sessions
agent strip by WSL distro stays open in #1951.
|
||
|
|
a75fa9e54a |
gateway, provider: OpenRouter's image-only models draw on its /images API, not chat (#1116, fixes #1105)
OpenRouter answers a chat request for gpt-image-*, seedream, flux, qwen-image, grok-imagine and the like with 404 "Use the /api/v1/images endpoint instead", and viaFor sent every OpenRouter model to chat. Models catalog.ImagesAPI names now go to OpenRouter's POST /images, with reference images as input_references (image_url parts) and its media_type and prompt/completion token usage read back; a 404 there is returned as is rather than retried on chat. Gemini and gpt-5-image stay on chat. The provider Test probe asks the same endpoint. Run: go test -tags nogui ./internal/gateway/ ./internal/provider/ ./internal/catalog/, go vet (darwin, linux nogui, windows), gofmt. With the /images dispatch removed, both new gateway tests go red. The real case (owner's OpenRouter key, sandbox HOME, a throwaway test not committed): openai/gpt-image-1-mini at quality low drew one image, 200, usage 12/272, and with that image as a reference drew again, 200, usage 1035/272. The request shape matches OpenRouter's openapi.json ImageGenerationRequest. |
||
|
|
2362bfced3 |
redact: a placeholder the model rewrites ({{ PHONE_x }}, a dropped brace, another case) comes back as the value (shensmart on Discord)
shensmart, with personal data masked, saw {{PHONE_…}} left in the
model's replies. Every reply path already goes through redact.Writer
(serve, Codex's upstream, count_tokens, embeddings, image and video
prompts; plugin-served providers write into the same wrapped writer),
and an exact placeholder came back on all of them, split across
Anthropic, Chat Completions, Responses and Gemini SSE events alike. What
didn't come back is a placeholder the model wrote differently from how it
was given: Jinja-style {{ PHONE_x }}, {{PHONE_x} or {PHONE_x}, the bare
PHONE_x, or the hash in upper case. Restore matched only the exact form.
Restore now finds a placeholder's body (KIND_ and the 8 of the hash), in
any case, at a word boundary, and puts the value back when it names one
magpie made, taking with it the braces and spaces the model put around
it (both braces of a side, or one of each side; a lone { on one side is
the text's own). The 40-bit keyed hash means no other text matches.
For streams, partialTail also holds a tail like "{{ PH", "{{PHONE_x}"
(the second brace still to come) and a last word that starts like a kind
magpie has masked (PH, PHONE_b5pu), and Writer.event now looks for the
tail before restoring, so a placeholder whose closing brace is in the
next event is not put back with that brace left behind in the text.
Not changed: the values stay in memory only. The placeholder key is kept
in redact.key, so after a restart the same value gets the same
placeholder, and the agent's history holds the real value (it was put
back), so the next request brings it again; checked by masking, clearing
the map and key as a restart does, and masking the history again.
Writing the map to disk would keep every masked secret in one file.
Run: go test ./internal/redact ./internal/gateway (sandbox HOME), gofmt,
go vet and GOOS=linux/windows go vet on internal/redact.
TestRestoreRewrittenPlaceholder, TestWriterStreamRewrittenPlaceholder and
TestWriterStreamToolArgsRewritten fail on the old redact.go/writer.go;
with the old writer.go alone the stream test fails with "13987654321 }}"
(a stray brace); with wordTail turned off it fails with a bare
PHONE_zdx44tzn left in the text.
|
||
|
|
b8e23db45a |
backup, davsync: an import or a sync installs the plugins and names the subscriptions to sign in to (yapechan)
yapechan on Discord (Windows, Synology WebDAV): after an import or a WebDAV
sync no providers showed on the other computer; adding the same provider by
hand made the synced settings and usage apply. No error, a restart didn't
help.
Cause. A backup and a sync carry providers.json as stored. For a
subscription that is its model picks and settings alone (no endpoint, no
key), and sign-ins are never carried by design; allProviders lists such an
entry only once an account is signed in here. plugins.json was not carried
at all, so a provider served by a plugin (every moved subscription, any
plugin provider) had nothing to come from on the other side. The import
said "N added" and "Needs a key: , " (the picks entries have no name and no
key), and the sync said nothing. API-key providers do come over: tried with
a nogui build in two sandbox HOMEs (DeepSeek, a custom relay, Kimi Code all
listed after `magpie restore`). No Windows-only path issue found.
What changed:
- provider.Carried(keys): the plugins added from npm or git, on/off and
their options (without keys, options whose names look like a key are left
out, as secret headers are). Folder plugins and plugin-auth.json stay.
- backup.Bundle.Plugins (nil from an older magpie). Restore installs the
ones not here through provider.AddPlugins (plugin.Add, then Off and
Options, then HandOver once); it never removes or changes one already
here. A failed install is reported, not a failed restore.
- Result.SignIn / provider.NotSignedIn: the subscriptions brought with no
account here. NeedKey no longer lists picks-only entries (provider.OnlyPicks).
- davsync: the providers part's hash covers the plugins (unchanged for a
setup without any), take/bring carry them, bring installs (logged on
failure), and Status().SignIn names what to sign in to.
- CLI restore and `magpie webdav`/`s3` status print both; the GUI's import
result and the sync row show them (en, zh, zh-TW, ja, de).
- docs/reference.md says what a backup carries now.
Run:
- go test -tags nogui ./internal/provider ./internal/backup ./internal/davsync
./internal/cli ./internal/gui in a sandbox HOME.
- New tests fail with the change broken by hand: TestPluginsCarried
(installed-skip and the HandOver guard), TestNotSignedIn,
TestRestorePluginsAndSignIn ("Needs a key: [ Acme]" without OnlyPicks),
TestSyncPluginsAndSignIn (bring not installing, Status not naming),
sync-sign-in.test.cjs (the lines removed).
- sync-sign-in.test.cjs: Chromium and WebKit, en/zh/ja/de, 900 and 440px,
16/16; it also caught subNames throwing while providers was still null.
sync-*.test.cjs, s3-sync, i18n-keys, gui-ja, gui-de pass.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
Not tried: a real plugin install from a real sync (the installs are stubbed
in tests); a real Synology server.
|
||
|
|
cb003877f3 |
agent: a renamed provider's models follow it in Pi's, OmO's and Prime Agent's enabledModels (#1828, #1919)
The sibling of the StepCode fix before this, and of omp's (
|
||
|
|
b515538ad6 |
gateway: the model list names each model's service tiers for every client, so Cindy offers Fast where it is offered (#1914, tsuixl)
Cindy reads supportsFastMode from a model's service_tiers in /v1/models (a priority entry), and its import link asks /v1/models with no magpie header. The models handler gave service_tiers (codexTiers, the tiers Codex here is offered on each model, #1234) only to a magpie asking with X-Magpie-Drawers, so Cindy never showed Fast on GPT-6-Astra / GPT-6.1-Sol. Every client now gets them; a model with no tier says nothing, and the remote-magpie path is unchanged. The context ring showing "—" in the same report is not touched: per the reporter's own reading it is Cindy's Codex runtime wanting native metadata, which /v1/models already carries as context_window. Run: - TestModelsListTiersForEveryClient (new): a relay's gpt-6.1-sol lists priority, its glm-5 lists none, on a plain GET /v1/models. Red on the old handler ("" for gpt-6.1-sol), green now. - go test -tags nogui ./internal/gateway on every test in the 39 files that GET /v1/models plus every *Tier* and *Fast* test: ok (110s). - gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows. - Not tried in a real Cindy: whether Cindy's Fast then sends service_tier priority through its Codex runtime is left to the reporter on the next release. |