ac4af582301a4e8a29245dbba767eba31334ddf9
7089
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6679e963fd |
gateway: a screenshot sent to a ChatGPT account goes at the size Codex's own client sends it (ylorn on Discord)
ylorn's ChatGPT account dropped turns a PNG screenshot took past about 1 MiB (the commit before this tells that as too large). ylorn uses Pi's openai-codex through magpie, not Codex, and Codex's own client never sends a screenshot that size: it scales every inline image down first. Read in openai/codex at cc7ba336 (codex-rs/core/src/image_preparation.rs resize_image, codex-rs/utils/image/src/lib.rs): - detail none, auto or high: at most 2048 px a side and 2500 patches of 32 px (HIGH_DETAIL); "original": 6000 px and 10000 patches; "low" it refuses itself (DetailBased mode, the default; UnifiedBudget is a feature flag) - prompt_image_output_dimensions_for_limits: as it is if it fits, scaled to the longest side, then by area with the patch grid rounded down - resized with FilterType::Triangle; PNG written as PNG, JPEG as JPEG at quality 85, WebP lossless, GIF as PNG; an image that fits keeps its bytes; no byte cap other than a 1 GiB guard - Codex zstd-compresses request bodies to ChatGPT by default (enable_request_compression); magpie already reads those and sends upstream plain, which this doesn't change. codexImagesFit (codex_images.go) does the same in forwardOnce, for a ChatGPT (codex) account's Responses requests only: every data-URL input_image in a message's content or a tool output's output larger than Codex's limits for its detail is scaled to Codex's size with a separable triangle filter widened by the scale (as the image crate's) and written in its own format (JPEG q85, PNG, GIF as PNG). Only the image_url string's bytes are replaced, so the rest of the request is the same bytes for the prompt cache, and the last 64 results are kept so a conversation's screenshot isn't resized on every turn. An image that fits, "low" detail, a remote URL, an image past 80 Mpx, and WebP (which Go's standard library doesn't decode) go as they came. Other vendors, API keys and Chat requests are untouched. Codex's own requests come already sized, so this changes nothing for them. Tests (codex_images_test.go): - TestCodexImageSizeAsCodex: Codex's own test cases (2048x2048 → 1600x1600, 2050x2 → 2048x2, original 6401x100 → 6000x94, 4096x2048 kept, 64x32 kept) and a 3456x2234 screenshot → 1979x1280 (checked against Codex's formula in f64). - TestCodexScreenshotSizedAsCodex: still PNG, 1979x1280, its black and white halves and red band where they were, the rest of the body byte-identical. - TestCodexImagesSizedInEveryPlace: JPEG stays JPEG, a tool output's image is sized, "original" gets the larger budget. - TestCodexImagesThatFitGoAsTheyCame, TestCodexImagesOnlyForChatGPT. - TestCodexAccountGetsScreenshotAtCodexSize: an agent's /v1/responses turn of 2.2 MB reaches the fake ChatGPT backend as 657 KB at 1979x1280. Red with the call taken out of forwardOnce; the legibility checks go red with the filter's centre moved. Run: go test -tags nogui ./internal/gateway, gofmt -l, go vet -tags nogui with GOOS=darwin, linux and windows on ./internal/gateway. Not tried: ylorn's account and network, a real agent's screenshot through a real ChatGPT account after this change, WebP. |
||
|
|
a2b96139c9 |
gateway: a Codex request ChatGPT drops for its size is told as too large, not retried or rested (ylorn on Discord)
ylorn (Discord #general, v0.1.1179): through a ChatGPT account, every turn a PNG screenshot took past about 1 MiB was answered HTTP/2 503 content-type: text/plain server: cloudflare upstream connect error or disconnect/reset before headers. reset reason: remote connection failure also without magpie, and the same screenshot as a JPEG went through. magpie took that 503 as the backend's trouble: with two accounts on, the turn was asked of acct-1, then of acct-2 three more times, acct-1 rested for it, and the next turn moved to acct-2. The same bytes are dropped the same way on every account, so none of that could help, and the agent was handed a 503 it retries again with the same body. codexDropped (codex_dropped.go) makes a 503 whose body says "upstream connect error or disconnect/reset before headers", to a request of 1 MiB or more, the 413 it stands for, with a message saying the request was dropped for its size (in MiB), that magpie didn't retry it or rest the account, and to /compact or remove or shrink the images (a JPEG in place of a large PNG screenshot). It runs on a ChatGPT account's replies in forwardOnce (the accounts loop, any agent) and on the ChatGPT passthrough in codexUpstreamOn (Codex's own sign-in alone). A 413 already skips the other accounts of the same provider and rests nobody, and Codex doesn't retry a 4xx. The same 503 to a smaller request stays the 503 it is, retried as before. 1 MiB isn't the backend's limit for everyone: from here, on a Pro account, gpt-6-astra direct to chatgpt.com/backend-api/codex/responses answered 200 to bodies of 0.5 to 20 MiB, plain and zstd, and to 3456x2234 PNG screenshots up to 5.6 MiB. So nothing is refused before sending; only this drop, on a body this large, is taken as the request's. Tests (codex_dropped_test.go), with an httptest backend that answers ylorn's literal 503 (text/plain, Server: cloudflare) to bodies over 1 MiB: - TestCodexDroppedBigBodyIsTheRequests: two accounts, a 1.2 MiB turn is 413 with the message, asked of acct-1 once, nobody rests, and the next small turn goes to acct-1. On the old code: 503, asked [acct-1 acct-2 acct-2 acct-2], acct-1 rested, next turn on acct-2. - TestCodexDroppedBigBodyRelayed: Codex's sign-in alone, 413 with the message (old code: the 503 relayed). - TestCodexEdgeResetSmallBodyStays503: a small body's 503 is relayed. Run: go test -tags nogui ./internal/gateway (new tests red before, green after), gofmt -l, go vet -tags nogui with GOOS=darwin, linux and windows on ./internal/gateway. Not tried: ylorn's own network or account, where the drop happens. |
||
|
|
1cb136ec76 |
gui: every row's grip stands 4px inside its card's edge, as the Agents row's does (#1581, real-jacket)
On the Usage page a card's hover grip stood on the card's left border: its ::before sat at left -8px inside a 12px card padding, while the Agents and Providers rows' sits at -7px in 14px, 4px inside the list. Each grip copied its `left` while the box around it had its own padding. Measured in Chromium and WebKit (grip left minus the inner side of the nearest box drawing a border or a shadow) on the old CSS: - Usage card: 1px (the issue's 2px is from the border's outer side) - tray panel's agents: 2px; tray panel's Arrange rows: 3px - Routing groups: 3px in the window, 1px on the narrow browser page (whose rows there have 12px padding all round) - Agents, Providers: 4px; a group's members in its editor and an agent's model order are far inside (no edge beside them) Now: Usage -5px, panel agents -8px, panel Arrange -8px, Routing groups -7px, and the browser page's narrow Routing rows keep 14px on the left. Every one is 4px in, in both engines, every language, 980px and 420px. The grips still show only on hover. New test internal/gui/tests/grip-inset.test.cjs: for each grip kind (Agents, Providers, Usage, Routing groups, group members, model order, panel agents, panel Arrange), en/zh/zh-TW/ja/de, 980px window and 420px browser page, Chromium and WebKit: the grip is hidden away from the row, drawn on hover, and grip-left minus edge >= 4px. Run: - grip-inset.test.cjs on the old app.css/routing.css: 80 of 160 cases fail (Usage 1px, panel agents 2px, panel Arrange 3px, Routing 3px/1px); on the new: 162/162 pass. - node --test (both engines) agent-grip, fold-show-grip, provider-order, usage-arrange, group-arrange, group-member-drag, group-duplicate, group-bulk-remove, panel-arrange, codex-model-order, zhipu-team, mobile-web, phone-web, phone-rows, view-no-sideways, gui-de, gui-ja, gui-zh-tw, routing-group-fold, panel-usage, panel-fold, grip-inset: 383/383 pass. - go test -tags nogui ./internal/gui (temp HOME): ok. - GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gui: ok. Not run: the whole GUI suite. |
||
|
|
1c0eab7c84 |
gui, gateway: every search API takes a base URL of the user's own, under its key in Settings (#1580, xzhlksh)
The reporter has endpoints that answer as Tavily, Exa and others do, at
addresses that aren't the vendors', and Settings only took a key. The
saved SearchAPI already had a url, and the CLI's url= set it, but the
Settings row showed the field only for SearXNG and sent "" for the rest.
- Settings › Models › Web search: the add row has a base URL field on a
line of its own under the key, for every API, with the vendor's own
address as its placeholder (searchVendorJSON.base). Picking an API
already added fills in its saved URL, so Add with a new key alone keeps
it; Add with no key typed changes only the URL, the key kept (the key
placeholder says so). Strings in zh, zh-TW, ja, de.
- provider: check() also refuses a URL with a ?query or #fragment, since
the vendor's path goes after it.
- gateway: the key goes only to the URL set. Go drops Authorization on a
redirect to another host but keeps Brave's X-Subscription-Token and
Exa's x-api-key, so a search API's redirect to another host is not
followed; the error names where it was sent. The request still goes
through the gateway's client and so magpie's proxy settings.
- CLI: `magpie search add <api> <key>` keeps the url set before; `url=`
with nothing after it puts the vendor's own back (was: a new key alone
dropped the url).
- docs/subsystems/gateway-routing.md: "A search API's base URL";
gui-shell.md: the field.
- search-api.test.cjs: Settings is drawn twice (/api/state, then
/api/settings), so scrolling to the add row can hit a detached node
(WebKit, 1 in ~6 runs here); it retries the scroll.
magpie ships and lists no third-party search endpoint; the URL is only
the user's.
Tests (sandbox HOME, pinned caches):
- TestSearchAPIAtItsOwnBaseURL: an httptest fake at <fake>/relay/<vendor>/
gets tavily POST /relay/tavily/search with Bearer, exa POST
/relay/exa/search with x-api-key, brave GET
/relay/brave/res/v1/web/search with X-Subscription-Token, firecrawl
POST /relay/firecrawl/v2/search with Bearer. Passes on the old gateway
too: the backend already honoured a url.
- TestSearchKeyStaysAtItsBaseURL: with search_api.go put back, FAIL
"a key reached another host: exa-secret / brave-secret".
- TestSearchCLI: with search_cli.go put back, FAIL "a new key took the
base URL away"; with provider/search_api.go put back, FAIL
"url=https://x.example.com/?k=1 taken".
- TestSearchAPIBaseURLFromSettings: POST /api/settings/search-api saves,
keeps the key, refuses ftp/no-scheme/query URLs, lists vendor bases.
- search-api.test.cjs in Chromium and WebKit, en and zh, 980px and
420px: 8/8; with the old app.js, FAIL "Tavily takes a base URL"
(false !== true). WebKit 980px 10 runs in a row green after the retry.
search-first, search-mcp, searcher-pick, i18n-keys, gui-ja, gui-de,
gui-zh-tw, click-scroll with it: 45/45 in each engine.
- Screenshots at 980/420 in both engines checked by eye.
- go test -tags nogui -timeout 40m ./... on
|
||
|
|
93c5d846ca |
plugin: a plugin's requests to a host on the user's own network go direct, as magpie's own do (#1572, ggbdpq)
What changed: with a proxy set (magpie's, the environment's or the system's), the plugin host sent a plugin's requests for a host on the user's own network - a Remote magpie, an LLM relay on the NAS - through that proxy, which can't reach it (502 Bad Gateway) or resolve its name. Go's netproxy.Func leaves such a host direct since #982 (lan.go onLAN); host.js's proxyFor and its node:http2 sessions (#1035) were that rule's siblings without it. - host.js ports lan.go's rule: onLAN takes a private (10/8, 172.16/12, 192.168/16, fc00::/7), link-local, loopback or CGNAT (100.64/10) address, a .local name, or a name every address of which is one of those; looked up for 400 ms at most, kept a minute (256 names), a failed or slow lookup is "not on the network". It is asked only when the global proxy would be taken (after loopback, a provider's own proxy or "direct", and NO_PROXY), as Func asks it, so a user without a proxy pays no lookup and a provider's own proxy is still taken as is. IPv6 is compared on its bytes, so a v4-mapped address in hex form (::ffff:a00:1, how URL writes it) is judged as its IPv4 address. - http2.connect returns its session at once, so tunnel() now takes a promise of the proxy and connects when onLAN has answered: straight to the host for one on the user's network, through the CONNECT otherwise. Unlike the issue's patch, a LAN name that needs a lookup is covered on this path too. - The issue's patch was reviewed, not applied: its lanIP missed loopback and hex v4-mapped IPv6, it didn't strip a trailing dot, it never cleared its lookup timer, and it left HTTP/2 to LAN names proxied. New TestPluginLeavesTheUserNetworkDirect (real Bun, a proxy that keeps every target it is asked): a fetch to this computer's private address over http:// (absolute form) and https:// (CONNECT; a certificate for that address via NODE_EXTRA_CA_CERTS), to "localhost." (a name decided by what it resolves to), and an HTTP/2 session to the private address all reach the server directly; a public address (203.0.113.5) and a name that resolves nowhere (vendor.invalid) still go through the proxy. Run: the new test against the old host.js fails on all three fetches (proxy asked for each); with only the HTTP/2 check removed it fails on the session ("h2: proxyconnect tcp: 502 Bad Gateway"); with every host taken as LAN it fails on the public address and the vendor name. A bun check of lanIP over 24 addresses (both sides of every range) matched lan.go. go test ./internal/plugin ./internal/netproxy ok; full go test -tags nogui ./... ok in every package (the five whose build hit another session's go-build cache prune were rerun, all ok: ., agent, gateway, gui, library); gofmt -l clean; go vet -tags nogui internal/plugin on darwin, GOOS=linux and GOOS=windows clean. Not tried with a real NAS or Remote magpie behind a real proxy. |
||
|
|
5fa908c087 |
gateway, provider: Claude Desktop's requests to ModelScope go on its Responses API, which reports the cache and reasoning that its Chat API leaves out (#1578, sparrowbits)
What changed
- provider.ResponsesTellsCache: ModelScope's API-Inference (the
"modelscope" preset, or a provider whose Responses URL is
api-inference.modelscope.cn) with both a Chat and a Responses URL.
ResponsesFirst is true there for every model, so `usable` puts
Responses before Chat. A translated request (Claude Desktop / Claude
Code's /v1/messages, a Gemini client) goes to /responses, and
Provider.Native wires Pi, omp and droid to Responses. A Chat client's
request is still relayed on Chat, and Codex's on Responses, as before.
- forwardTranslated: when Responses is first only for the cache report,
a 404 there marks the model unfit on Responses and asks it on Chat. A
ModelScope model with no Responses route then works as it did before.
This fallback is scoped to ResponsesTellsCache.
- docs/subsystems/gateway-routing.md: the "One try" row names it.
Why
The reporter's usage.jsonl covers 202 Claude Desktop requests, all
/v1/messages -> /v1/chat/completions: 0 cache_read over 34.9M input
tokens, and reasoning 0/202. Codex on /v1/responses with the same model,
on the same day, read 94% from cache. Their direct calls show why.
ModelScope's /responses answers
input_tokens_details.cached_tokens = 12288 on the second identical
prompt. Its /chat/completions answers only prompt_tokens /
completion_tokens / total_tokens, though it is served from the same
cache. magpie already maps Chat's prompt_tokens_details.cached_tokens
(and prompt_cache_hit_tokens, cached_tokens, cache_read_input_tokens) to
cache_read_input_tokens (cUsage.usage). The new test
TestOtherChatAndResponsesKeepChat pins that. So the missing figure was
not a mapping gap: ModelScope's Chat API never sends one. The fix is to
ask on the API that does.
Scope: other presets with both Chat and Responses URLs keep Chat.
- DeepSeek, xAI, Zhipu, MiMo, Qianfan, Tencent TokenHub, Volcengine's
plans, OpenCode Zen/Go, Command Code, PipeLLM and CherryIn have an
Anthropic URL, so Claude-format requests are relayed on Messages as
they are.
- Groq's and Volcengine Ark's Chat APIs report
prompt_tokens_details.cached_tokens, and Groq's Responses API is a
partial beta.
- OpenAI keeps its existing OpenAI-model rule.
- Nothing is known of a custom relay's Responses API.
What was run
- New tests in internal/gateway/responses_tells_cache_test.go, against
an httptest fake that answers with the reporter's literal usage
bodies:
- TestModelScopeMessagesTellTheCache: streamed and whole Messages go
to /v1/responses, and the client gets cache_read_input_tokens 12288,
input_tokens 108 and output_tokens 32.
- TestModelScopeModelNotOnResponsesGoesToChat: a 404 on Responses
goes to Chat, and stays on Chat for the next request.
- TestOtherChatAndResponsesKeepChat
- TestModelScopeNativeIsResponses
- Broken by hand:
- Without the ResponsesTellsCache check in ResponsesFirst,
TestModelScopeMessagesTellTheCache fails ("Messages went to
[/v1/chat/completions], want /v1/responses"), and so do
TestModelScopeNativeIsResponses and the fallback test.
- Without the 404 fallback, TestModelScopeModelNotOnResponsesGoesToChat
fails with "404 ModelScope: Not Found".
- gofmt -l is clean. go vet, and GOOS=linux and GOOS=windows go vet
-tags nogui, pass on internal/gateway and internal/provider.
- Full suite: go test -tags nogui ./... under a temp HOME at base
|
||
|
|
f1001ec991 |
library, gui: each of an MCP server's tools has a switch, and the agents that can leave one out are told to (nf1qaz2w on Discord)
nf1qaz2w asked to turn single tools of a Library MCP server on and off.
|
||
|
|
d1ddb7defe |
catalog: a model no catalog lists by its id has what its maker's entry says of it — window, thinking, images, name — not just a price (#1565, ggbdpq)
What changed: #1520 prices the id an entry names as its canonical_model_id, but the capability tables only counted entries listed by an id, so the model behind the id was unknown all the same: gpt-5.6-cyber (OpenAI's gpt-daybreak-red-latest, canonical openai/gpt-5.6-cyber) had no window, reply limit, thinking, images or name — asked as given (WorkBuddy's shape) or behind a relay's prefix. An entry now votes for the canonical id it names too, when no catalog lists that id: one listed by its id keeps the answers it has. The per-entry vote moved into a closure (vote) whose branches are the ones it replaces, keyed the same for a listed id. Review (yetone's session): TestCanonicalOnlyIDCarriesItsMakerWord and the updated TestCanonicalIDIsNeverTakenForAnother fail on the previous catalog.go (window, reply limit, thinking, images and name all empty for gpt-5.6-cyber and claude-gpt-5.6-cyber; 0 and "" for claude-sonnet-4-0) and pass with it. The expectations were moved to the literal catalog: Daybreak Red's window is its input limit, 272000, not the 400000 context (as every listed model's is), and Cortecs's name is "Claude Sonnet 4 (latest)". A sweep of every listed and canonical id (plain, claude-, [1m]) through ContextOf, OutputOf, Thinks, SeesImages, NameOf, EffortsOf, Knows and PricedBy on the local models.dev cache, before and after: no answer for a listed id changed; the 23 canonical-only ids and their renames gained theirs. The full suite, gofmt and the cross-OS vets were run on the series. Author's run: the red/green above; go test -tags nogui ./internal/catalog ./internal/usage ./internal/provider green; go test -tags nogui ./... green but TestOffline (red on the baseline too) and TestSearchFollowsTheSearchersProxy (green alone); gofmt -l clean; go vet, GOOS=linux and GOOS=windows vet on internal/catalog clean. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
43b6959fcd |
catalog: a relay's rename of a model models.dev knows only as another entry's canonical_model_id is that model now (#1564, ggbdpq)
What changed: renamed, which takes a relay's prefix and a window mark off an id, knew only ids models.dev lists. A model no catalog lists by its id — OpenAI's gpt-5.6-cyber, served as gpt-daybreak-red-latest whose canonical_model_id is openai/gpt-5.6-cyber (23 such ids in today's api.json) — stayed unknown to the rename, so claude-gpt-5.6-cyber (a relay's, #1383) had no price, no window, no name and no capabilities, though #1520 prices the id when asked as given. The rename now reaches what models.dev knows as an entry's canonical_model_id, and a canonical id is never taken for another, as a listed one never is: cortecs's claude-sonnet-4 is claude-sonnet-4-0, and were a catalog to list a sonnet-4-0 of its own, Claude's model would not become it. Review (yetone's session): the two tests fail on the old catalog.go (PricedBy of the three renamed spellings false, ContextOf 0; Drift's 99, 32000 and "Drift Sonnet" for claude-sonnet-4-0) and pass with it. The 23 canonical-only ids were counted in the local models.dev cache (gpt-5.6-cyber only under openai's gpt-daybreak-red-latest, claude-sonnet-4-0 under cortecs and requesty). The cortecs fixture was made literal (name "Claude Sonnet 4 (latest)", pdf input, output 65000) and the Daybreak Red one given its input limit 272000. A sweep of every listed and canonical id, plain, with claude- and with [1m], through PricedBy, ContextOf, OutputOf, Thinks, SeesImages, NameOf, EffortsOf and Knows on the real catalog: no answer for a listed id changed; only canonical-only ids and their renames gained one. The full suite, gofmt and the cross-OS vets were run on the series. Author's run: the red/green above; go test -tags nogui ./internal/catalog ./internal/usage ./internal/provider green; gofmt -l clean. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
05cf7814eb |
gateway: a translated reply cut short reaches a client that asked for no stream as the error too (#1563, ggbdpq)
What changed: every translated request is asked of its upstream as a stream, and a client that asked for no stream gets its reply assembled from it. translate read that stream and rendered whatever came as the whole reply, so an Anthropic upstream that stopped with no stop_reason and no message_stop, or a Responses one with no response.completed, handed the client a truncated answer presented as finished — the same cut a streaming client is told of in its stream (errEndedShort). The read now watches for the upstream's last event the same way (upstreamEnds), and ends with the 502 "the reply ended before it was complete" instead: nothing has been sent, so the next candidate is asked, and the last one's error reaches the agent. An error the upstream said still reports itself; a stream that said its last event (stop_reason, message_stop, response.completed) is served as it came. Review (yetone's session): with the cut check disabled by hand TestNonStreamEndedShort fails (both subtests 200 with "Let me look at the"); restored, green. The 502 takes the same path as the read-error 502 beside it (cutMidReply): nothing written yet, retryable() lets the next candidate answer, and no account is rested for it as content. The full suite, gofmt and the cross-OS vets were run on the series. Author's run: TestNonStreamEndedShort (new; Anthropic and Responses cases) fails on the old code — both cuts came back 200 with finish_reason "stop"; with the change both come back 502 naming the cut, and a reply whose last event came is served 200 whole. gofmt -l clean; go vet and go build on darwin, linux, windows; go test -tags nogui -race -count=20 on the relay-stop tests; the full go test -tags nogui ./... (TestOffline and TestSearchFollowsTheSearchersProxy red on the clean baseline too). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
e435fe00f1 |
gateway: a translated Responses reply the upstream cut short ends in an error, not as if whole (#1562, ggbdpq)
What changed: streamTranslated ended a translated reply in "the reply ended before it was complete" when an Anthropic upstream's stream stopped with no stop_reason and no message_stop; a Responses upstream's stream that stopped with no terminal event (no response.completed, response.incomplete, response.failed) was still finished as if whole, and the agent's turn ended a few words in with nothing to say why — the same reply the passthrough already tells apart (sniff.whole, #370). It now ends in the same error, asked again in place where the upstream goes on from a prefill, as an Anthropic cut is. The event that ends a stream is read by its type as the passthrough reads it (upstreamEnds, was anthropicEnds, already lastEvent), so a response.completed carrying no status field still counts as the reply's last. Chat (may end without [DONE] and be whole) and Gemini stay as the passthrough treats them. Run (review, yetone's session): TestResponsesUpstreamEndedShort passes; with the Responses half of the end check taken out by hand it fails ("a cut reply finished as whole", finish_reason "stop", no error). TestRelayStream*, TestRelayStop* ok. The full suite, gofmt and the cross-OS vets are in the series' last commit. Author's run: the red/green above, -race -count=20 on the relay-stop tests, gofmt, go vet and go build on darwin, linux, windows, go test ./... (TestOffline red on the clean baseline too, offline machine). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
cf8a16cf56 |
provider: a provider's keys given the same name are two cards told another magpie, not one (#1561, ggbdpq)
What changed: cardKeys, which says which of a provider's keys the plan
and balance cards are read with, answered a map keyed by the display
name, so of two keys given the same name it held the last one alone.
Each key's card is read and kept by the key itself (keyTag), and the
Usage page shows two, so what CachedCards told another magpie after a
restart lost the first key's reading: one card where the page has two,
and withKeyReadings laid routing's reading of one key over the name
they shared and never reached the other's. cardKeys now answers one
entry per key, in the order requests try them.
Changed in review (yetone's session): with both keys of one name in
cardKeys, withKeyReadings found the first card of the name for each of
them, so the second key's reading went over the first key's card and
its own card still got none. Each card is now taken by one key, in the
order cardKeys gives them, the order PlanQuotas and KeyBalances make the
cards in; a card made for a key is taken too.
TestKeyReadingsReachBothCardsOfOneName pins it.
Run (review): TestCachedCardsKeepBothKeysOfOneName fails with
cards_kept.go from before the patch ("got [main $2.00]") and passes with
it; TestKeyReadingsReachBothCardsOfOneName fails with the per-card claim
taken out and passes with it. go test -tags nogui ./internal/provider:
one run of four failed with its output cut off, the other three (one at
-count=2) green; the full suite, gofmt and the cross-OS vets are in the
series' last commit.
Author's run: the red/green above, gofmt, go vet on darwin, linux and
windows, go build on all three, go test ./... (all ok but TestOffline,
offline machine).
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: yetone <yetoneful@gmail.com>
|
||
|
|
440fded2dc |
gateway: a turn stopped with its tool call out is answered on Google's APIs, not refused by them (#1560, ggbdpq)
What changed: a client replaying a conversation whose turn was interrupted with the tool call still out — the call in the history, no result for it — had every later turn refused by Google's APIs with 400 "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn", the conversation with it, however it was routed: a Google sign-in (Code Assist), Vertex AI, a custom provider's Gemini URL (#1346) and a model pinned to Gemini ( |
||
|
|
fa5ef88d63 |
gateway: a Chat client's sampling is asked again without it when the Claude it is translated to refuses it by a name magpie can't read (#1559, ggbdpq)
What changed: forwardTranslated's retry loop now answers the "`temperature` is deprecated for this model" refusal (#1454) the way passthrough's does: asked once more with temperature and top_p left out. samplingAsTaken drops the sampling up front only where the model's name on the wire is one claudeLine reads; a Chat or Responses client's request to a Claude behind a relay that spells it otherwise carried the sampling into a 400 that reached the client, where the same request relayed from an Anthropic client was asked again without it. Review (yetone's session): the new case fails on the old code (400 "`temperature` is deprecated for this model" reaching the Chat client) and passes with the retry. The retry is scoped to an Anthropic upstream, a 400 matching samplingDeprecated and a request that carried sampling, so it is asked at most once and before anything reached the client; no account is rested for it. The doc conflict with main's prefill line was resolved keeping main's line. The full suite, gofmt and the cross-OS vets were run on the series. Author's run: the new case "a name magpie can't read is asked again from chat" red then green; the sampling/thinking/prefill tests ok; go test -tags nogui ./... ok except internal/testenv TestOffline (offline machine, red on the baseline too); gofmt -l clean; go vet and go build on darwin, linux, windows. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
adbff63225 |
provider: Antigravity's -tiered Gemini ids take their model's thinking levels, so Pi and every other agent offer an effort for them (PapainTea on X)
gemini-3.6/3.7/3.8-flash-tiered is one id that thinks at the level the request asks, but the catalog gave it no Efforts (Antigravity's list has none, and models.dev doesn't know the id). Pi's models.json then had "reasoning": false and no thinkingLevelMap for "Gemini 3.8 Flash (Tiered)", so Pi offered no thinking level; OpenCode, Crush, Codex and the GUI picker read the same Efforts. A -tiered id now takes the levels of the family it is a tier of (gemini-3.8-flash: low, medium, high); one with no such family keeps none. Real use: through the dev gateway on the owner's Antigravity account, antigravity/gemini-3.8-flash-tiered with reasoning_effort low, medium and high thought 651, 3830 and 10071 tokens on one question. In a sandbox HOME with a copy of the owner's Antigravity provider and cached list, `magpie pi magpie/antigravity/gemini-3.8-flash-tiered` wrote reasoning true and thinkingLevelMap low/medium/high (others null); real pi 1.1.0 `--list-models` shows thinking "yes", and `pi -p --thinking low|medium|high` sent reasoning_effort low|medium|high (captured), and answered through the gateway. TestCollapseAntigravityModels, TestAntigravityLegacyPicks and TestAntigravityUnnamedModels fail without it. gofmt, GOOS=linux and GOOS=windows go vet, go test -tags nogui -count=1 ./... under a scratch HOME pass. |
||
|
|
90a5c57c89 |
agent: Claude Code's /model lists magpie's routing groups, so a group saved as its model is there to pick (#1575, yanjieee)
writePicker built settings.json's modelPicker from viaMagpie("claude")
but skipped every option in RoutingGroups, since the picker was first
written (
|
||
|
|
1d016ee3f3 |
provider, gui: Token Plan 企业版 shows its usage on the Usage page, read with the account's SecretId and SecretKey (#1574, undirectlookable)
#1574 asks for Tencent Cloud Token Plan's usage on the Usage page through TokenHub's cloud API (api/1823/132270). That API covers the enterprise plan only (Token Plan 企业版; the previous commit added its regions). The personal plan (api.lkeap.cloud.tencent.com/plan) has no usage API, only the console, so it has no card. The API takes the account's API key, a SecretId and SecretKey signed TC3-HMAC-SHA256, never the plan's sk- key. provider (tencent_usage.go): - A provider at /plan on tokenhub.tencentmaas.com (ap-guangzhou) or tokenhub-intl.tencentmaas.com (ap-singapore) with a SecretId and SecretKey gets a card per team plan in PlanQuotas (tencentPlanQuotas), each key and region asked once. - It asks DescribeTokenPlanList, then DescribeTokenPlan per plan (version 2026-03-22), all at tokenhub.tencentcloudapi.com. Where a reply leaves a part out, the list's copy of it is kept. - The window is TotalUsed of CycleQuota (else TotalQuota), in credits (专业套餐) or tokens (轻享套餐, enterprise-auto). It resets at TokenSummary.CycleEndTime. Without that, it counts months from StartTime and stops at ExpireTime. - The docs don't say whether TotalUsed is the cycle's or the package's. This reads it as the cycle's. - A plan that isn't enable shows its status beside the plan's name. - An AuthFailure or UnauthorizedOperation reply says to check the key and its CAM rights. No plan visible to the key says so (a sub-user sees only the plans it made). - The SecretId and SecretKey sit in the AccessKeyID and SecretAccessKey fields Volcengine's access key uses (#1427). They are stored, kept out of key-less backups and dropped from cached cards the same way. AccessKeyVendor tells the two vendors apart. gui: - The listing tells whose access key a provider or preset takes. presetAccessKey lists the regions that take one: Tencent Cloud's two Enterprise regions. - The editor names the fields SecretId and SecretKey, with Tencent's hint, and shows them only at those regions (or at an endpoint none of the regions has). - A SecretId with no SecretKey is refused only where the fields are shown. The new strings are in zh, zh-TW, ja and de. - docs/subsystems/providers-accounts.md and the GUI tests README describe it. Run: - TestTC3SignMatchesDoc pins the signing doc's worked example (payload hash 35e9c5b0…, Signature 10b1a37a…). - TestTencentPlanRegion, TestTencentPlanWindow and TestTencentPlanQuotas use the API docs' own response examples. The last is an httptest fake that rechecks each TC3 signature and the X-TC-* headers, and fails if the plan's key is ever sent. - TestProviderListTellsTencentAccessKey covers the listing, alongside TestVolc* and TestPlanQuotas. - Breaking the action's lowercasing in the signature, or dropping TokenSummary, turns them red. - GUI: tencent-access-key.test.cjs (new) 12/12 in Chromium and WebKit at 420px, en and zh. It goes red with the region hook or the vendor labels taken out. volc-access-key, tencent-cloud, i18n-keys, gui-ja and gui-de pass. - gofmt; go vet on darwin, linux and windows; the full go test ./... Not tried against the real API: we have no Tencent Cloud account. What is read is what the docs show, and the reporter is asked to try it. |
||
|
|
c05dd8b6fb |
provider: Tencent Cloud has Token Plan 企业版 as a region, Enterprise plan · China and · Global (#1574, undirectlookable)
#1574 asks for Tencent Cloud Token Plan's usage through TokenHub's DescribeTokenPlan API (api/1823/132270). That API covers Token Plan 企业版, the team plan, only. magpie's Tencent Cloud preset knew the personal plan (api.lkeap.cloud.tencent.com/plan) and TokenHub's pay as you go, not the enterprise plan, so a provider at it had nowhere to sit. The preset gains two regions, after the old three so imports and links are unchanged: - enterprise: https://tokenhub.tencentmaas.com/plan/v3 (chat completions and Responses) and /plan/anthropic, Guangzhou. - enterprise-intl: the same paths on tokenhub-intl.tencentmaas.com, Singapore. Both use the plan's docs (product/1823/130659, 131173 for the 轻享套餐, same endpoints) and the Token Plan console as the key page. Their model lists are the doc's tables for each site, with the three GLM models it says went away on 2026-10-09 left out, and without the deepseek/… ids. An entry imported at those endpoints, a magpie://import link with region=enterprise(-intl) and a provider moved there in the editor land on the region; TokenHub's pay as you go at the same hosts stays at its own. The site's import pages (en, zh, ja) list the two regions, and the region names are translated in zh, zh-TW, ja and de. Run: go test ./internal/provider (TestTencentCloud, TestTencentCloudEnterprisePlan, red before the regions), gofmt; GUI tencent-cloud.test.cjs in Chromium and WebKit, en and zh, 8/8. Not tried with a real enterprise plan key: we have no Tencent Cloud account. |
||
|
|
47269f448f |
usage, gateway, gui: the Requests card counts requests once, a try handed on to the next isn't a failure, and says how many were answered on a retry (小一 on Discord)
小一's Codex-on-credits ledger read "5,482 · 1,094 failed" while many rows said "2 tries/3 tries" and had been answered. "Failed" counted usage rows, not requests: besides each request's final row, the gateway writes a row for every try a vendor refused or turned away (hw.refused/hw.turnedAway), and each of those was counted as a call and a failure even when a later member answered. (Ordinary failovers write no row; 499 cancels and the agent's own client-side retries are separate requests.) In the owner's own usage.jsonl, 24 of the 71 "failed" rows were such refusals a later member answered. Now a request counts once, by how it ended: - usage.Record gains `tries` (final row, when the route took more than one) and `handed_on` (the row of a try that failed and handed the request on). Totals.count skips handed-on rows; a failure is a request whose agent got an error (LostRequest); one answered after a failed try is Totals.Retried (RetriedRequest), with a `retried=1` filter. - Logs written before this are read the same way: the log index marks a failed, non-rejected row followed by another of the same route id as handed on and raises the later row's tries (routeRows); the packed row and its snapshot carry both. - Panel card, Usage overview tile, ledger card, rankings and group rows, `magpie usage` and the TUI say "N answered on a retry"; the CSV adds `tries` and `handed_on` at the end. A row says "· handed on" (with why in its title) or "· N tries". - On the ledger's Requests card "N failed" and "N answered on a retry" are buttons that switch the list to the Failed / new Retried filter, and back when pressed again. The lines wrap rather than cut a button off (German). zh, zh-TW, ja, de strings added. - Docs: reference.md (counting, filter, CSV columns), gateway-routing.md. Run: - go test -tags nogui ./internal/usage ./internal/usageapi ./internal/tui ./internal/gateway . : ok. New TestRequestsCountedOnceWithTheirRetries (JSONL fixture: legacy refused row + 200, handed_on + 200 tries 3, 502 tries 2, plain 200, routeless 429 → 5 calls, 2 failed, 2 retried, across Ledger, QueryPage, Summarize, heatmap, filters, CSV) and TestRetriedRequestCountsOnce (group a refuses, b 500s, c answers → 1 call, 0 errors, 1 retried; a lone 400 → 1 error). - Broke each by hand (count without the HandedOn skip, gateway without HandedOn, log index without routeRows): each test went red; restored. - go test -tags nogui -timeout 40m ./... under the gotest lock, rebased on origin/main |
||
|
|
310991d78f |
gui: a group with measured replies and floors shows both, the measured speed first, "125 tok/s (1) · ≥50 tok/s (259)" (Fallmonkey on Discord)
A group's speed showed its measured speed when it had one and dropped its floors. With the commits before this one, a Codex model can have one measured reply and hundreds of floors, and "125 tok/s (1)" stood for all of them. Fallmonkey asked to see both. ledGroupSpeed now joins the two, the measured one first: "125 tok/s (1) · ≥50 tok/s (259)". Its tooltip has a line for each, and the measured line drops "the others tell no speed" when the others tell a floor (new strings in zh, zh-TW, ja and de). The Output speed card keeps the measured speed as its figure, so a narrow card isn't clipped, and puts the floor in its sub line. A ranking by speed still orders and bars a group by its measured speed, or by its floor when it has none. docs/reference.md says so. Tests: usage-speed-count.test.cjs adds floors to sol and a new measured-only group (astra, 62). It checks the joined text and the two tooltip lines, the card's figure and sub line, and the ranking order and bar, in en, zh, zh-TW, ja and de, in Chromium and WebKit, at 1400 and 560 px, with no clipping. It fails on the old app.js. Ran: usage-speed-count, usage-session-speed, usage-ledger-detail, usage-speed, reasoning-speed, usage-ledger-fit, usage-model-at-provider, routing-request-metrics, gui-ja, gui-de, gui-zh-tw and i18n-keys in both engines; go test ./internal/gui; gofmt -l; GOOS=linux/windows go vet. |
||
|
|
e5b82cf38a |
usage, gui: Codex rows tell the least they wrote at: a call in a turn of several over its whole time, a turn of one call that reasoned by its answer after the first token (Fallmonkey on Discord)
Codex's session rows told no floor. A call in a turn of several could be
timed from inside itself; the commit before this one times it from what
asked for it, before its first output item, to its last, as Claude Code's
is. So Codex joins usage.FloorAgents and app.js's LED_FLOOR_AGENTS, and
such a call tells its output over its whole time, by the same 1,000-token
rule. On 622 stripped recent rollouts only 4 of 1,367 such calls have
1,000 tokens or more, so the floors will be few, but they are true.
A Codex turn of one call that reasoned has its first token (the turn's
time_to_first_token_ms) but not its first text, so DecodeOf tells no
speed. Fallmonkey asked for its whole output, reasoning too, over the
time after the first token. That reads high: OpenAI's reasoning is
written before the first content, so it isn't in that time. On a gateway
reply of 496 tokens, 224 of them reasoning, 827 ms after a 10.2 s first
token, that is 600 tok/s against a measured answer speed of 415 (the
bug
|
||
|
|
5d1d2f66dd |
sessions: a Codex call in a turn of several is timed from what asked for it to its last output, not from its own tool's output (Fallmonkey on Discord)
An older Codex rollout (no token_usage_record) writes a call's token_count after the output of the tool that call ran. The call was timed from the last thing the model was given, which by then was its own tool's output, so its window was a millisecond or two: on 517 stripped copies of the owner's Aug/Sep rollouts gpt-5.6-sol's multi-call calls read p50 65,500 and up to 1,844,000 tok/s. A count written seconds after its tool's output gives the mid-range outliers (sol 972) Fallmonkey reported. Now a call begins to answer at its first output item (reasoning, a tool call, an assistant message). It is timed from what the model had last been given at that moment, and, when its own tool's output came before its usage line, it ends at its last output item rather than after the tool ran. Newer rollouts, whose token_usage_record comes before the tool's output, are timed as before: on 622 stripped recent rollouts every call reads the same (sol p50 44, max 82). On the older ones sol now reads p50 34, p99 53, max 54. A long output line (a large patch) is read by its head. The call cache goes to calls-v11 so cached calls are re-read. TestCallsCodexTimedFromTheAsk is built on a real 2026-09-06 rollout's shape with content stripped; on the old code it reads [15000 0 0 0] instead of [15000 29000 8000 9000], and with the long-line branch taken out it fails too. Ran: go test ./internal/sessions, gofmt -l, GOOS=linux/windows go vet. |
||
|
|
e2b3eb7406 |
agent: an npm -g agent under mise's Node says its version and updates with that Node's npm, not "can't tell how it was installed" (flp on Discord)
On Windows with Node managed by mise, the Agents page read "无法判断安装方式" for an agent installed with npm install -g. howInstalled decided from the binary's path, and a mise shim leads nowhere near node_modules: on a Mac or Linux it is a symlink to the mise binary; on Windows a copy of mise-shim.exe (exe mode, the default), a .cmd plus a bash script running `mise x --` (file), or a hard or symbolic link to mise.exe. A shim is now recognised (a link to mise, or a file in mise's shims folder: parent "mise", a .mode file, or MISE_DATA_DIR/shims) and mise is asked which program it runs, `mise which <cmd>` from the home folder; how it was installed is read from that program. On Windows mise names npm's extensionless sh script, so the .cmd beside it is used. The update runs that Node version's own npm with --prefix, then `mise reshim`: on Windows npm install -g makes no shim for a new command (seen on the box), mise's Unix npm wrapper reshims itself, so it is harmless there. Siblings: - asdf shims (scripts with "# asdf-plugin:" and `exec asdf exec`) are asked with `asdf which` the same way; asdf-nodejs's npm reshims itself and asdf has no Windows build. - proc.UserBinDirs on Windows also looks in mise's shims folder (MISE_DATA_DIR, else XDG_DATA_HOME\mise, which mise follows on Windows, else %LOCALAPPDATA%\mise) for an agent PATH doesn't reach. - Install side: npmIn accepts npm.exe beside node as well as npm.cmd. - WSL agents get no update path (CLI skips them) and wsl.go's probe already lists mise/asdf shims: unchanged. - MISE_DATA_DIR and ASDF_DIR join agentenv.Vars, so a test sandbox clears them (TestFolderVarsAreListed). Fixtures are real bytes: internal/agent/testdata/mise-windows from mise 2026.10.7 on the Windows box (file-mode snow.cmd and snow, .mode files, npm's snow.cmd/snow in the Node folder); the Mac layout and the asdf shim's text from mise 2026.10.7 and asdf 0.20.2 release binaries in a sandbox home. Run: - flp's own layout (where.exe claude: installs\node\24.20.0\claude, claude.cmd, shims\claude.exe; mise which claude names the extensionless script): TestMiseShimWindowsFiveAgents covers claude, pi, codex, opencode and codebuddy through shims\<cmd>.exe; run on the Windows box, red with the fix removed by hand, green restored. - go test -tags nogui ./internal/agent ./internal/proc -run 'Shim|HowInstalled|UpdateCLI|NpmIn|InstalledVersion'; with installedAt skipping the shim by hand TestMiseShimIsNodesNpm, TestUpdateCLIThroughMiseShim and TestAsdfShimIsNodesNpm go red, green again restored. - Real mise on the Mac (sandbox home, mise 2026.10.7, node 22.23.3, snow-ai): detection through the real shim and `mise which`, and a real update 0.9.1 -> 0.9.2 through UpdateCLI. - Real mise on Windows (the box, sandbox USERPROFILE/LOCALAPPDATA, mise 2026.10.7, node 22.23.3, snow-ai): the Windows test binary's unit tests (TestMiseShimWindows, TestHowInstalledWindowsShim, TestNpmIn) pass; a temporary test through the real shim in exe, file and hardlink modes found npm.cmd --prefix <node>, version 0.9.2; after npm install -g snow-ai@0.9.1 a real UpdateCLI took it to 0.9.2 and reshimmed; snow.exe ran 0.9.2. Symlink mode was not tried (needs developer mode); it is the link-to-mise case the Mac covers. flp's own machine was not tried. - go test -tags nogui -timeout 40m ./...; gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui ./... |
||
|
|
de1ba9f123 |
settings, gui: a masking rule can be edited in place, not only removed (nf1qaz2w on Discord)
nf1qaz2w on Discord: "自定义脱敏规则现在只有移除,能否增加一个编辑功能方便调整规则". Settings → Privacy listed each custom masking rule with Remove only, so changing a pattern meant removing it and typing it again at the end. Each rule's row now has Edit beside Remove. Edit opens the rule in its own row, where it stands, with its name, Prefix/Regex (the app's segs, no <select>) and match filled in, laid out like the add row; a narrow window puts the match, Save and Cancel on a line under the name and Prefix/Regex. Save (or Enter) sends that one rule to the new POST /api/settings/redact-rule with its index and its current value; editRedactRule tidies and checks it with redact.CheckRules as an added rule is, and refuses one that doesn't compile, matches the empty string, is left with no prefix or pattern, repeats another rule, or is no longer at that index (changed or removed meanwhile). A refusal is said in the row in red, what was typed kept, and every rule stays as it was. Cancel or Escape leaves the rule untouched and sends nothing. The gateway reads the rules from settings per request (redactionOptions), so the edit masks the next request. The two fixed refusals are translated (zh, zh-TW, ja, de); the other strings (Edit, Save, Cancel, Name, Prefix, Regex) were already there. docs/subsystems/gateway-routing.md now describes the user's own rules and the edit. Run: - TestRedactRuleEdit (internal/gui): a valid edit is saved in place and redact.Mask with the saved rules follows it; a bad regex, a pattern that matches nothing, a short prefix, an empty rule, a duplicate, an index out of range, a negative one and a stale "was" are each refused with the reason, the rules unchanged. With api.go from before this change it fails: "edit: 404 404 page not found". - internal/gui/tests/redact-rule-edit.test.cjs: Chromium and WebKit, en, zh, zh-TW, ja, de, 1100px and 420px (20 tests, all pass): Edit opens the rule in its place with its values, fields don't overlap and stay in the row, the page doesn't scroll sideways, no click moves the page, Cancel sends nothing, a refused regex is shown with the typed values kept, a good one is saved by Enter in the same place. With the old app.js it fails: no button.rule-edit (locator timeout). redact-rule-row.test.cjs and i18n-keys.test.cjs pass. - Whole GUI suite in both engines, under heavy machine load: 5647 of 5667 pass. Each failing file was run again alone: agent-expand-steady, azure-endpoint, balance-currencies, gateway-key-groups, library-desktop-skills, library-all, plain-names, purpose-filter and usage-ledger pass. skill-install-agents-all (chromium 420px "view:5,0") failed the same on the base commit and passes after rebasing onto |
||
|
|
afe0c59d2d |
gui: on a Mac window a popover that opens upward stops under the traffic lights, not over them (#1573, lyston11)
In a short Mac window, Pick (an agent's model list), the field picker (#pop) and every app menu (placeMenu) were held only 8px from the top when they opened upward or were held to the window's top, so they covered the traffic lights and header.top, which the system draws them over. popTop(pad) is now the highest a popover's top edge may go: 8px under header.top's measured bottom on a Mac window (so it follows --zoom), and 8px from the top everywhere else, as before. openAgentModels, placePop and placeMenu use it in place of pad for the top. placePop also holds #pop's max-height to the room between that edge and the foot when its CSS max-height doesn't fit, so a picker held to the top scrolls inside itself instead of running off the bottom (it already did run off before this change in a very short window; moving the edge down would have made that worse). Nothing else clamps a popover to the top: the remaining getBoundingClientRect placements (profiles in the panel, the heat-map tip, the rail tip) are kept inside their own card or panel. Run: - new internal/gui/tests/popover-mac-chrome.test.cjs: Chromium and WebKit, en and zh, MacIntel and Win32, 480px wide: 8/8 pass, 4 runs in a row. On the old app.js it fails (model list top 8 < 58 on Mac, the picker off the bottom on Windows). Breaking each placer by hand turns it red on its own: model list top 8, picker top 8, menu top 17. - related GUI tests, Chromium and WebKit, all pass: click-scroll, agent-models, agent-models-picker, -all-hidden, -loading, -only-picked, -redraw, agent-model-groups, menu-scroll, proto-menu-overflow, codex-app-menu-cap, desktop-model-menu, editor-short-window, removed-groups-menu-scroll, agent-start-pick, agent-leave-magpie, claude-picker-fold, header-zoom-fit, header-centre, text-size. - HOME=<scratch> go test -tags nogui ./internal/gui: ok. - GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gui: ok. |
||
|
|
f3c098da80 |
provider: TestGrokPluginSignInInstallsCLI sees the install under way before letting it finish
Red once on ubuntu CI (909d76747's run, about 1 in 60): StartPluginSignIn
returned State "waiting" with the plugin's URL, not "installing". The
fake installer finished at once, so the goroutine StartPluginSignIn
starts could install, ask the plugin to authorize (which only answers
once FAKE_GROK exists) and move the state on before StartPluginSignIn
read its own state back. The product is right: the state is whatever the
sign-in has reached. The test now holds the fake installer until it has
seen "installing", as the Devin siblings (install_test.go,
plugin_moved_test.go) already do; the hold is let go in a cleanup too, so
an early failure leaves no installer waiting. The uv_cwd error in the
same log is the plugin host outliving the test's removed TempDir, after
the failure, not its cause.
Ran: a 2s sleep injected before StartPluginSignIn's return: the old test
red ("started {... State:done ...}"), the new one green; plain -count=20
and -race -count=5 green; go test ./internal/provider; go vet and
GOOS=linux go vet; gofmt -l clean.
|
||
|
|
96d497e687 |
antigravity: a refused or failed model list says what magpie does next, and an account that couldn't refresh says so (#1553, AnxForever)
AnxForever's Google AI Pro account (loadCodeAssist: current tier
free-tier, paid tier g1-pro-tier, project aicode-consumers) gets
"Request contains an invalid argument." for fetchAvailableModels with
entitlement.userTier g1-pro-tier, and ends up with the catalog's
models. magpie already asks once more with {project} alone after that
refusal, but the log didn't say so, and when that second request also
failed nothing was logged at all: antigravityPoolModels kept the
account's last list silently whenever another account (here the
reporter's free one) succeeded.
What changed (logging only; the requests are unchanged):
- a refused tier's line now ends "; asking with <next> next" or
"; asking with none next";
- a failure of the request with no entitlement is logged with the
endpoint and project;
- the pool logs each enabled account whose refresh failed, with the
error and how many models it keeps from before.
Why the request is not changed: no authoritative source for the value
the official client puts in entitlement.user_tier for a paid account
was found. The Antigravity app is not installed on this Mac. The
extracted language-server schema (jkfujinami/antigravity-grpc-schemas,
model_configs.proto / entitlement.proto) confirms the field shape magpie
sends: FetchAvailableModelsRequest{project=1, request_id=2,
entitlement=9 {user_tier string}, location=3}; the LS also has
License{userTier, tierDisplayName, projectId, location} and
SelectLicense, so the tier it names may come with its own project or
location, but nothing public shows the values. Every open-source client
that serves Pro accounts sends {"project": ...} only, on
daily-cloudcode-pa: CLIProxyAPI (sdk/cliproxy/antigravity_models.go),
sub2api (backend/internal/pkg/antigravity/client.go),
Antigravity-Manager (src-tauri/src/modules/quota.rs, which notes the
list is the same for free and Pro accounts), syrtis. magpie's fallback
already sends exactly that, so a guessed tier value is not added.
TestAntigravityProInvalidTierAsksWithoutOne is built from the
reporter's log lines: the first fetch is
{entitlement:{userTier:g1-pro-tier}, project:aicode-consumers} and gets
400 INVALID_ARGUMENT, the second is {project:aicode-consumers} and its
list is used; then, with the second refused too, the account keeps its
3 models and both failures are in the log. Removing the pool's log
line turns it red.
Run: gofmt -l; go vet -tags nogui ./internal/provider (darwin,
GOOS=linux, GOOS=windows); go test -tags nogui -count=1 ./internal/provider;
go test -tags nogui -timeout 40m ./... under a temp HOME: every
package ok but internal/provider, where only
TestAccountDiscoveryOffReadsNoSignIn failed ("the watch didn't answer a
read: {}{}"). It fails the same way at every run from this agent's
checkout under .claude/worktrees, and passes at this same commit and at
origin/main from a checkout under the scratchpad, where the whole
internal/provider package passes too; it touches no Antigravity code.
Not verified: no Google AI Pro account was available. Whether the
reporter's second request ({project} only) succeeds or fails, and why,
is not known; this commit makes the next release's log say which.
|
||
|
|
9bb68615b0 |
gui: a scroll not the reader's made just before a click is put back, not kept as where the reader was (#1554)
skill-install-agents-all.test.cjs was red on main in Chromium at 420px (en, ja, de): the install picker's All chip, clicked, left the Library view 5px down. Cause: the browser tells the page of a scroll at the next frame. The test clicks while the Library view is still sliding in (view-in, translateY 5px), and Playwright's click scrolls the chip into view first; with the view 5px taller than it is high at 420px, that scroll takes the view to its 5px foot. The click came in before that scroll's event, so the click guard took its snapshot (held.chain, held.top) at 5px and every hold() after kept it there, the scroll event included. A real click can do the same: WebKit scrolls a field focused on the press, or code scrolls just before the click, and the scroll was adopted as the reader's. Fix (app.js, the click guard): before taking a click's snapshot, a view not scrolled by the reader (no purposeUntil window, no scrollbar drag) is put back where the reader left it (backToReader), as the scroll listener would have done a frame later. A click in quick turn after another still holds that one first, as before. The guard is shared by every view, so every picker and button is covered; the library picker needs no change of its own (the MCP editor's picker is in #modal, outside any view). Tests: - click-scroll.test.cjs: new "a scroll the page hears of after the click is still put back" (scrollTop += 40 and a click in one task). Red on the old app.js in Chromium and WebKit (expected 2020, actual 2060), green with the fix. - sessions-manage-paging.test.cjs scrolled with Playwright's scrollIntoViewIfNeeded and clicked Show more before the next frame, so it passed in Chromium only through this bug (the guard puts that scroll back a frame later; it was red in WebKit on main). It now scrolls with the reader's wheel; green in both engines. - docs/subsystems/gui-shell.md says a click is taken where the reader left the view. Run: skill-install-agents-all.test.cjs red before (en/ja/de 420px, "view:5,0"), green after in Chromium and WebKit, every language; click-scroll.test.cjs green in both engines; 306 GUI test files that assert on scrolling or touch the library/skills/MCP, then the other 253, both engines. Failures seen there were rerun alone: purpose-filter (WebKit, 1px, #1291) and search-api (WebKit zh, #1442) fail the same on the old app.js; the rest pass alone. No Go changed. |
||
|
|
1c746a7e85 |
testenv: the machine's proxy variables no longer stand in a test binary's first routed request (#1570, ggbdpq)
What changed:
- net/http reads HTTPS_PROXY and its siblings once per process, at its
first routed request. A test binary that lets the machine's stand froze
that read with the developer's shell: on a machine with https_proxy set,
whichever test reached net/http first (a plugin host's catalog read was
the earliest single one) fixed the machine's proxy into every later
route, and a test that set its own afterwards read the machine's —
TestSearchFollowsTheSearchersProxy's Auto ask follows ALL_PROXY alone
for exactly that reason, and its searcher went to a proxy that cannot
reach the test's servers (red in the full package run, green alone).
Offline's refused hosts were carried for real by the machine's proxy on
loopback, red-lining TestOffline the same way.
- testenv.ClearProxy unsets the eight variables. Isolate calls it, and so
does the gateway's own TestMain (the package isolates itself) and this
package's new TestMain. TestIsolate now sets a proxy variable and holds
Isolate to having cleared it.
Run: TestSearchFollowsTheSearchersProxy alone green, red with
TestClinePluginPinsDeepSeek run before it, green again with the fix
(TestClinePluginPinsDeepSeek|TestSearchFollowsTheSearchersProxy); without
ClearProxy the pair is red, TestOffline fails with "models.dev: <nil>"
(the request went through the machine's proxy) and TestIsolate fails with
"HTTPS_PROXY is still set"; both green with it. go test -tags nogui
./internal/testenv ./internal/gateway (the gateway package whole) green.
Review: reproduced on main (
|
||
|
|
c409693806 |
proc: a test's own signalGroup put back no longer races the kill loop still reading it (#1568, ggbdpq)
What changed:
- group.kill's retry loop outlives its caller: it keeps signalling a
process group every 5ms for up to 10s after the caller (a probe's
cmd.Cancel on exec's watchCtx goroutine) has gone. It read the package
var signalGroup on every pass, so a test that swaps the var for its own
and puts the old one back when it ends (TestProbeKillEndsWhatTheSignal-
Missed's cleanup) raced the loop's reads: go test -race ./internal/proc/
went red with "WARNING: DATA RACE" (write at probe_test.go:151, read at
tree_other.go:43), 5 of 5 runs.
- kill now takes the kill function once at its entry and the loop uses
that copy. In production nothing changes (the var is never written);
a test's swap is seen by every kill started after it, and a loop under
way finishes with the function it was started with, which is the one
that must answer whether the group is empty.
Run:
- go test -race -tags nogui -count=1 -run TestProbeKillEndsWhatTheSignalMissed
./internal/proc/: FAIL with DATA RACE without the change (1 warning,
5 of 5 runs), ok with it, and -race -count=20 ok.
- go test -race -tags nogui -count=1 and -count=1 ./internal/proc/ ok.
Nothing else in the tree reads or writes signalGroup (grep).
Review: on main (
|
||
|
|
671e2b44e6 |
backup: a backup file a BOM-writing tool saved over still opens (#1567, ggbdpq)
What changed: Open reads through a UTF-8 byte order mark in front of the
sealed JSON (edit.TrimBOM, the trim #1534 gives a file read some other
way than edit.Read). The backup file is written back through
edit.WriteAtomic, which keeps the mark the file at that path starts with,
so a backup a Windows editor's "UTF-8 with BOM" or PowerShell 5.1's
Set-Content put a mark on opens as it is, where it read as "not a magpie
backup" — and, in a sync, ranked as a file never to rebuild over.
Test: TestOpenReadsThroughABOM (backup.Open, three shapes: a marked
sealed backup opens with its bundle whole; a marked page that is no
backup is still ErrNotBackup; a marked backup cut short is still
ErrCorrupt, so a sync may still rebuild it) fails on the old code with
"a backup with a byte order mark: not a magpie backup" and passes now;
the backup and davsync packages' other tests pass unchanged.
Run: go test -tags nogui -count=1 ./internal/backup ./internal/davsync;
gofmt -l; go vet and go build on darwin, GOOS=linux -tags nogui and
GOOS=windows.
Review: reproduced on main (
|
||
|
|
dca04af14f |
edit: a comment at the start of a model group's line stays when the group is taken out (#1566, ggbdpq)
What changed: delItem read the "is the element alone on its line" check
from the comment-blanked copy, so a JSONC comment written before the
element on the same line (VS Code's chatLanguageModels.json carries the
user's notes beside their groups) counted as blank space, the delete took
the line from its start, and the comment went with the element. It reads
raw now, as delJSONBytes does for the same check on an object member, so
only the element (and its comma, or its line) goes.
Test: TestDelJSONItemKeepsACommentBeforeTheElement (edit.DelJSONItem,
three shapes) fails on the old code with "the comment before the element
went with it" and passes now; the edit package's other tests, among them
the CRLF and among-others deletes, pass unchanged.
Run: go test -tags nogui -count=1 ./internal/edit ./internal/agent; the
full go test -tags nogui ./... in a sandbox HOME (TestOffline red as on
the baseline; gateway's TestSearchFollowsTheSearchersProxy red once under
the full run, passes alone, no path from this diff); gofmt -l; go vet and
go build on darwin, GOOS=linux -tags nogui and GOOS=windows.
Review: the test fails on main (
|
||
|
|
8a881dc203 |
provider, agent: the sign-in watch tests count no reads of their own check, in both packages
TestAccountDiscoveryOffReadsNoSignIn (internal/provider) is the sibling |
||
|
|
909d767472 |
gui: with MAGPIE_PUBLIC_URL set, Gateway's Connect starts at it until the user picks an address, and magpie web shows it as the gateway's address (#1551, everpcpc)
everpcpc runs magpie web in Docker behind a reverse proxy with
MAGPIE_PUBLIC_URL=https://magpie.example.com. The page is opened from
other machines, yet Connect's Base URL, the copied shell/curl/Python/Node
snippets and the gateway's address on the Gateway page started at
http://127.0.0.1:3425. v0.1.1174 kept a picked address; the public one
still had to be picked once on every browser.
- /api/providers' gateway carries publicURL: MAGPIE_PUBLIC_URL when it is
among the addresses Connect offers (shared, or MAGPIE_ADDR on the
network). With no address kept in magpie.connectAddress, Connect starts
there, so the snippets and the gateway key picked for it follow. An
address the user picked, this computer's included, still wins.
- The option is labelled "Public address" instead of "Local network".
- /api/settings carries publicURL under the same condition, and Settings >
About lists it beside the local Gateway URL, which stays the address
agents here are pointed at.
- In magpie web, a page served to other machines, the Gateway page's
address and Settings' web-search MCP server show the public URL; in the
app they stay local. Agents' own config wiring is unchanged (#373).
- New strings in zh, zh-TW, ja, de; docs/reference.md says where it shows.
Run: public-url-default.test.cjs (new) on chromium and webkit, en, zh,
zh-TW, ja, de, at 1100 and 420 wide, 26 pass; on the old app.js 12 of 13
chromium cases fail. Making the public URL override a kept pick turns it
red too. TestPublicURLInConsole and the new TestPublicURLOnlyWhereOffered
pass. Sibling GUI tests (connect-address-kept, the gateway-key-* and
gateway-connect/caller-keys tests, api-key-theme, public-url, lan-docker,
phone-web, search-mcp, settings-sections/groups, gui-ja/de/zh-tw): 192
pass; phone-web failed once under the parallel run and passes alone on
both engines. gofmt, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gui, go test -tags nogui ./... under the queue lock: its one red
is TestAccountDiscoveryOffReadsNoSignIn (internal/provider, from
|
||
|
|
4ee491e7c7 |
provider: a routing group shared as text leaves out its rules by folder, which name the sharer's own paths
|
||
|
|
3f57024211 |
provider, gui: a routing group is shared as text and imported into another magpie (laincatx on X)
A group row's menu has Copy to share: the group as JSON marked "magpie": "routing-group" with a format version (provider.ShareGroup), holding its members as it names them, patterns, routing, rules, classifier and settings. A group holds provider/model ids only, so no key, account or address goes with it; derived matches and the found/hidden/off flags stay behind. The Routing page's Import (by New group) opens a box the text is pasted into, words or a code fence around it allowed. POST /api/groups/import (provider.ImportGroup) adds it under a free name, never over a group. A member whose provider the importer has is kept; else the same model under one of their providers (listed as used instead); else it is left out and listed, with the rules that send to it and its off/fast place; a classifier gone takes the intent rules and auto effort. Nothing is added when no member is left. Other text, a newer format or none is refused in the reader's language (provider.ShareError, code "share"). Run: - go test -tags nogui ./... (gateway failed once on a full disk, then passed alone); new TestSharedGroupRoundTrip/MissingMembers/BadText and TestGroupShareAndImport; the version check broken by hand turns them red - gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; go build - group-share.test.cjs in chromium and webkit, en/zh/zh-TW/ja/de, 420px; every group-*, settings-groups, filter-ime, panel-routing GUI test (210 pass); routing-* (550/557: webkit fold tests timed out only under --test-concurrency=6 and pass alone; a webkit routing-* run under the same load fails one test on origin/main too, a different one each run) - real use: the owner's 12 groups from a sandbox copy of providers.json each shared (no key in the text) and imported back whole |
||
|
|
ae70d8eac8 |
routing: a group's rule can hold by the folder the agent works in (Cario0x on X)
Cario0x on X asked to route by the project being worked on. A group's rule now has a "folders" condition: it matches when the request's working folder is one of the listed folders or inside one. It combines (AND) with the existing conditions: tokens, images, intent, time, agents and quota. - gateway/workdir.go reads the folder each agent states in its own request: - Claude Code: "Primary working directory", including "(was …)" after a move. - Codex: <environment_context><cwd>. - Pi: <cwd>. - OpenCode: <env> "Working directory". The last one stated wins. Assistant text and tool results are ignored. A request that states no folder matches no folder rule: unknown, never empty. - provider/rulefolder.go matches a folder only at a path boundary. - ~ is the home folder. - C:\x is the same folder as /mnt/c/x, and \\wsl$\Distro\x as /x. - Case is ignored on macOS and Windows, and always for a drive. - A rule's folder must be a whole path. Pause rules can't have folders. - The trace's RuleHit.Folder makes the Routing page say "The agent works in …". - GUI: an "in folder" condition in the group editor, hidden on pause rules. Strings in zh, zh-TW, ja and de. - CLI: `magpie group rule add … folders=~/oss,"~/My Project"`. The TUI shows the condition. - Docs: docs/subsystems/gateway-routing.md and site start.html (en, zh, ja). Fixtures are real requests from Claude Code 2.1.296, Codex 0.162.0 and Pi 1.1.0, run in a sandbox from a folder named "a&b <c> 中文" or "My Proj", with the sandbox path replaced. Run at this head: - go test ./... green. - gofmt -l clean. - go vet green for darwin, GOOS=linux -tags nogui and GOOS=windows. - GUI routing-folder.test.cjs: chromium and webkit, en, zh, zh-TW, ja and de, 1100px and 390px (no horizontal scroll). It fails on the old routing.js. - Related routing, group and i18n GUI tests: 85/85. - Full GUI suite: 5611/5631 under --test-concurrency=6. Rerun alone, every failure passes except: - skill-install-agents-all (chromium, 420px), which is red on origin/main too: #1554. - The menu-scroll track flake, which flakes on main as well: #1550. - e2e: a sandbox HOME, a dev build and fake upstreams, with real Claude Code 2.1.296 (`claude -p --model group/fd`). - From proj/acme/web, rule 1 matched and the request went to kb. - From proj/acme-old, no rule matched and the request went to ka. The trace and UI showed the folder. |
||
|
|
3964ea656c |
usage, gui: a group's speed says how many replies it is of, "125 tok/s (1)", and one with only floors says "≥100 tok/s (30)" (Fallmonkey on Discord)
Fallmonkey: the Usage ranking and the Output speed card showed
gpt-6.1-sol's tok/s from the one reply of its 260 that used no tool (the
only Codex turn its session file times) beside "260 requests", while
Claude Code, whose Requests rows say "≥N tok/s" by the dozen since
|
||
|
|
c702d9cfe1 |
provider tests: TestClaudeSavedAccountDir and the other sign-in tests wait up to 90s for the sign-in to end, not 2s (#1552)
waitDone gave a sign-in 100 x 20ms (about 2s) to leave "waiting". The
sign-ins it waits on that finish through the browser callback (Claude's
SavedAccountDir, AddsAnAccount and logout tests among them) run fake CLIs:
after the callback the fake `claude auth login` polls 50ms, forks
cat/echo/rm/kill, exits, and magpie then runs the fake's `auth status`
before it records the account. Alone that is a few hundred ms; under a full
`go test ./...` on a loaded Mac (where every new executable is also checked
on its first run) it passed 2s, and the test failed with "sign-in never
finished" after 3.45s. The paste-path tests didn't fail because
claudePaste itself waits up to a minute for the end.
waitDone now polls against a 90s wall-clock deadline: above every bound
the flows keep themselves (claudePaste's minute, claudeSignedIn's 15s), so
a flow that times out reports it in its own state; it still returns the
moment the state changes, and still fails a sign-in that never ends.
Reproduced by injecting the delay, not rerunning: with `sleep 2.5` added
to the fake before "Login successful.", TestClaudeSavedAccountDir failed
on the old waitDone ("sign-in never finished", 2.53s) and passed with the
new one, as did TestClaudeSignIn*, TestClaudeSavedAccountDir and the
logout test. The injection is not committed. No fake was left running
afterwards (ps); the fake's own loop already ends once its folder is gone
(
|
||
|
|
6f4fb883eb |
library, gui: an MCP server's tools are listed by name and description (nf1qaz2w on Discord)
nf1qaz2w on Discord: "mcp现在好像只能看到有几个工具,看不到具体的工具名和描述等, 能否支持下?" The Library's MCP check kept only len(tools) from tools/list. What changed: - internal/library/mcp_check.go: ServerHealth carries ToolList (json "toolList"): each tool's name and the first paragraph of its description, whitespace collapsed and cut at 500 runes (a tool with only a title gets the title); names cut at 128; at most 500 tools kept while Tools still counts all. tools/list is now asked through listTools, shared by the stdio, streamable HTTP and SSE checks: it follows nextCursor up to 10 pages, each page with a step budget of its own (the #1467 per-step timeout), and a page after the first that is refused ends the list there. Before, nextCursor was ignored and only the first page counted. - internal/gui/assets/library.js/.css: a server whose check listed tools shows a chevron on its "N tools" status; a click opens the list under the row (name in the code font, description under it, "N more not shown" when magpie kept fewer than the server has, and Check again). Clicking the count again shuts it. A server with no listed tools keeps the old click, which checks it again. The list stays while it is checked again, no editor opens, no left-border stripe, no native select. The click guard keeps the clicked status in place (a centred row gives up 1px as it grows). - i18n: "Click to see them", "Click to hide them", "{n} more not shown" in zh, zh-TW, ja, de. - docs/subsystems/library.md: the check's tool list and paging. There is no CLI/TUI output of a server's check, so nothing changed there. What was run: - go test ./internal/library: TestCheckKeepsToolNames runs the check on the tools/list reply @modelcontextprotocol/server-filesystem really gave (captured with npx, testdata/filesystem-tools-list.json, 14 tools, the longest description 457 chars); TestCheckToolPages (no description, title only, a 1000-char description cut, two pages by nextCursor, the JSON the page reads); TestCheckToolPagesEnd (a server that pages forever is asked 10 times). With the list not kept and paging off, the first two fail: "got {State:ok Tools:14 ToolList:[] ...}, want ok with 14 tools, each listed" and "...Tools:3 ToolList:[]..., want ok with 4 tools over 2 pages". - GUI: internal/gui/tests/library-mcp-tools.test.cjs, Chromium and WebKit, en/zh/zh-TW/ja/de, at 980 and 420 wide: 20/20 pass; against the old library.js it fails. library-*.test.cjs, mcp-signin, search-mcp, i18n-keys and click-scroll in both engines: 377/377 pass. - gofmt -l (nothing), go vet / GOOS=linux / GOOS=windows go vet -tags nogui on internal/library and internal/gui, go build for darwin, linux and windows (nogui). Full go test -tags nogui ./... under the queue lock: every package ok but internal/provider, where TestClaudeSavedAccountDir failed "sign-in never finished" (waitDone's 2s bound on a fake claude process under full-suite load); alone it passes 5/5. Not touched here. |
||
|
|
1c9747f611 |
usage: a Remote magpie provider's gateway keys each show their own limit, used and left, period and reset on the Usage page (#1547, PennyVibe)
A computer that uses another magpie through gateway keys that magpie gave it saw the other magpie's subscription cards, but not what each key may still spend there. What changed: - provider/remote_key_limits.go: each key of a remote-magpie provider gets a section on one card, "<remote>/~keys", read from the remote's existing GET /v1/magpie/limit asked with that key alone (the endpoint answers only the calling key, from access.Caller; nothing in the request picks another key, so a key never sees another's numbers). A window per cap (tokens, spend) named for its period (today / this week / this month / this cycle), used against the cap, with its reset; SubscriptionQuota.GatewayKey carries what is left, calls, the cycle's days, used up and unpriced calls. A key with no limit shows one "Limit: Unlimited" window. Kept for remoteCardsFor like the remote's cards; the card's refresh reads the named key again. - A failed read keeps the last numbers, dated (AsOf); with nothing read the section says why, never zero and never "no limit". A remote from before /v1/magpie/limit (404) says it is too old to tell. - GUI: the card is named "Gateway keys · <remote>" (main page and the tray panel), a line under each key says the cycle, calls and "used up", and the two new errors are said plainly; strings in zh, zh-TW, ja, de. - magpie quota (CLI) shows the same cards; a window with no cap now reads "Limit unlimited" there, not "Limit 0%" (quotaCell). - docs: providers-accounts (Allowance), gateway-routing (Remote magpie APIs, verification), reference (/v1/magpie/limit). Run: - New tests fail on the old code: TestRemoteMagpieKeyLimits (provider) and TestRemoteMagpieKeyLimitCards (gateway, a real Handler, real chat requests moving the numbers) with the key cards taken out of RemoteCards; usage-remote-key-limits.test.cjs on HEAD's app.js. TestKeyLimitTellsOnlyTheCaller guards what was already so (key A can't read key B by query, header or no key from the LAN), so it passes on both. TestQuotaCell's unlimited case reads "Limit 0%" on the old code. - provider, gateway -count=3; go test -tags nogui ./... (full suite). - GUI: the new test in chromium and webkit x en/zh/zh-TW/ja/de x 900/400px (20 pass); the whole GUI suite. - gofmt -l clean; go vet -tags nogui darwin, linux, windows. - Real two-magpie run, both this build, sandbox HOMEs, 127.0.0.1:38461 (remote) and :38471 (local); the upstream was a fake OpenAI server (fixed 175 tokens a reply). Remote keys laptop (1000 tokens/day), desk (5000/week), spare (no limit); local "office" Remote magpie with all three, routing rotate. After 17 chats through the local gateway, magpie quota on the local read laptop 1050/1000 (100%), desk 1050/5000 (21%), spare unlimited (in --json; the text line read "Limit 0%", which the quotaCell change above fixes), matching the remote's own gateway-key list; laptop's spent key was passed over (every chat 200). With the remote stopped each key said it couldn't be reached, never 0. Not run against a real vendor, nor a real magpie older than /v1/magpie/limit (unit-tested with a 404). |
||
|
|
612b759d21 |
agent: Claude Desktop installed on Windows and not yet opened is listed (#1482, edussss)
Claude Desktop was listed by its data folders (%APPDATA%\Claude, %LOCALAPPDATA%\Claude, the MSIX LocalCache), which it makes when first opened. desktopdir.Installed now also counts Squirrel's %LOCALAPPDATA%\AnthropicClaude\claude.exe and the MSIX's package folder; an AnthropicClaude folder left without claude.exe doesn't count. Run: TestClaudeDesktopInstalledNotOpened (red without Installed) on macOS and on the Windows box, the existing TestClaudeDesktop* tests, the full suite, gofmt -l, go vet -tags nogui on darwin, linux and windows. |
||
|
|
0b904a3e60 |
agent: on Windows an agent CLI in ~\.local\bin, npm's, Volta's, bun's folder or on the registry's PATH now is listed, though magpie started before it was installed (#1482, edussss)
Detected and cliBin asked exec.LookPath against magpie's own PATH only. On Windows that is the PATH magpie started with (proc.UserPath does nothing there; a self-update restarts with the same one), so Claude Code's native installer, which puts claude.exe in ~\.local\bin and adds that to the user's PATH in the registry, and an npm -g install, weren't seen by a running magpie. The sign-in already found the CLI through proc.FindTool (#839); binAt now does the same for Detected and cliBin, so the Agents page lists it and shows its version. On the Windows box the ssh session's PATH lacks ~\.local\bin although the registry has it. Run: TestClaudeFoundWhereWindowsInstallsPutIt (Windows-only) on the Windows box: passes with this change, all five cases red with the fallback disabled. go test of internal/agent on macOS, the full suite, gofmt -l, go vet -tags nogui on darwin, linux and windows. |
||
|
|
36839d503a |
agent: Claude Code kept in CLAUDE_CONFIG_DIR is listed on the Agents page, and a model picked for it goes to the settings.json it reads (#1482, edussss)
The Agents page looked for ~/.claude/settings.json alone, while the
sessions, the Library, the sign-in, the account import and the gateway's
Claude subscription all read $CLAUDE_CONFIG_DIR. A Claude Code whose
folder is elsewhere (CLAUDE_CONFIG_DIR set) wasn't listed when its CLI
wasn't on magpie's PATH either, and a pick, a tune and the gateway's
stand-in went to a ~/.claude it never reads. The sibling of CODEX_HOME
(
|
||
|
|
26816de2f9 |
library, agentplug: an agent a plugin adds is given the Library's instructions, MCP servers and skills where its agent.library says (AlmarionAI on X)
Agent plugins wired models and keys only: library.targetOf had no case
for them, so the Library's instructions, MCP servers and skills never
reached an agent a plugin adds, while the announcement said the
Library carries over.
An agent export can now say
library: { instructions, mcp, mcpFormat, skills }
each a path (~ and $VAR expanded, as config is). mcpFormat names the
agent whose MCP file it is shaped like (agentplug.MCPFormats: claude,
codex, gemini, opencode, cursor, zed, ... 18 of the library's
mcpFormats). A format outside the list, or an mcp without one, keeps
the plugin from loading. library.pluginTarget makes such an agent a
Target, so it is written as any agent is: magpie's marker block in the
instructions file, servers merged beside the user's own (their fields
kept), skills linked or copied, Applied recording only magpie's part,
backups kept. Takes refuses a place the plugin doesn't name, and says
which agent.library key would give it.
Docs: docs/subsystems/library.md and agent-wiring.md; plugins.html
(en, zh, ja) gets the library field and what magpie does with it.
Run:
- internal/library/agent_plugin_test.go: TestPluginAgentGetsTheLibrary,
TestPluginAgentWithoutAPlaceIsRefused, TestPluginAgentMCPFormat,
TestPluginMCPFormatsAreWritten. With targetOf's plugin case and the
check() validation taken out by hand, the first three go red.
- e2e: a nogui build in a scratchpad HOME (env -i, no live configs),
`magpie plugin add` of a throwaway toy agent plugin; `library
instructions set/agents`, `library mcp add/rm` wrote and took back
only magpie's block and server, the user's "mine" server, its "note"
field and other keys kept, backups made; with mcp dropped from the
plugin, `library mcp add ... agents=toy` is refused naming
agent.library.mcp.
- go test -tags nogui ./... (one unrelated FIFO flake in internal/agent,
fixed in the commit before), gofmt -l clean, go vet for GOOS=linux
and GOOS=windows clean. No GUI code changed.
|
||
|
|
5421f44689 |
agent: TestAccountDiscoveryOffAgentsReadNoSignIn counts no reads of its own check when the FIFO answers it twice
fifoWatch writes "{}" on every 200us loop that finds a reader still in
the FIFO, and notes each. Under a full `go test ./...` the test's own
sanity read got "{}{}" and failed ("the watch didn't answer a read"),
and the extra opens would have been counted as reads of sign-ins.
The check now takes one or more "{}", and only opens after it count.
Run: reproduced by opening the FIFO and sleeping 5ms before reading
(red on the old check, both ways); green with the fix, and -count=20
plain. Breaking the guarantee still fails: any open after the check
is reported.
|
||
|
|
5d88dd8427 |
lastgood: the same unreadable file kept aside a second earlier is not kept again
KeepBad only compared the bytes against copies named in the current
second, so the same bad file kept on either side of a second boundary
got two .bad-<time> copies. macOS CI went red on
|
||
|
|
6b8dc4cdd8 |
proc, agent: magpie finds an agent CLI under the Node nvm's default names, not the folder whose name sorts last (v9 after v22)
proc.UserPath added "the newest-looking" nvm Node to magpie's PATH, the
last folder of ~/.nvm/versions/node/*/bin in string order. That isn't
the Node a terminal gets, and string order puts v9.11.2 after v22.12.0
and v22.3.0 after v22.12.0. So magpie could find, run and update a
codex/claude/gemini under a Node the user's terminal doesn't use (found
while answering 悠悠哥 on Discord,
|
||
|
|
8c5b9f928d |
provider, agent, gui: subscription accounts can be turned off, and then no agent's sign-in is read (#1535, MaxHaiCom)
What changed: Settings → Privacy → Subscription accounts (On/Off), `magpie accounts discovery [on|off]` and MAGPIE_NO_ACCOUNTS=1 turn off account discovery. It stays on by default. While it is off, magpie reads none of the agents' sign-ins: ~/.claude/.credentials.json, .claude.json's account, ~/.codex/auth.json, Copilot's, Cursor's, Devin's, Kiro's, Gemini's, ZCode's, Command Code's and OpenCode's files. It runs no `security` / `secret-tool` for the Keychain or Secret Service, and asks no agent CLI who is signed in. It serves no subscription. API-key providers, middleware plugins and Pi extensions work as before. Why: the reporter runs magpie on machines where reading other tools' credentials isn't wanted. The owner delegated the call. How: settings.NoAccountDiscovery (kept per computer by KeepOwn) and settings.AccountDiscoveryOff(). The variable only ever turns discovery off. The gates sit at every reader (readAccountFile, discoveryOff) and at every route that reads or writes a sign-in, so a route that skips Accounts still reads nothing: - Accounts, All, Logins, usage, renewal, warm-up, session identities, check-ins; - switching, forgetting, SetLoginOn, StartSignIn, the imports; - moves onto plugins. The ones that write refuse with an error that names how to turn it back on. On the agent side, Agent.Source and OpenCode's auth.json are gated, and Codex wiring goes by magpie's stash instead of auth.json, so a toggle never rewires Codex. logins.json and plugin-auth.json are left untouched and serve again when discovery is turned back on. A change applies at once (ForgetAccounts). Docs: providers-accounts.md, README (en, zh-CN), and the site's CLI table (en, zh, ja). Run: - TestAccountDiscoveryOffReadsNoSignIn (provider) and TestAccountDiscoveryOffAgentsReadNoSignIn (agent). Every credential path is a FIFO that records each open, and security, secret-tool, claude, codex, cursor-agent, devin, kiro-cli, copilot and grok are fakes on PATH. Both fail with the gate removed: they show the opens and `security find-generic-password -s Claude Code-credentials`, among others. Both pass with the gate in place. - TestAccountDiscoverySetting and TestAccountsDiscoveryCmd. - account-discovery.test.cjs: chromium and webkit, 900 and 360 wide, en/zh/zh-TW/ja/de, 32/32. The neighbouring privacy, redact, settings-sections and i18n-keys GUI tests: 49/49. - The full `go test -tags nogui ./...`, gofmt -l, and go vet for darwin, linux and windows on the touched packages. Not tried: a real machine under fs_usage, and Linux and Windows at runtime. The FIFO tests are !windows. |
||
|
|
0192edf133 |
gui: a long Claude Code reply read from its session file shows the least it wrote at (≥98 tok/s), and a short one no longer says it wasn't streamed (Fallmonkey on Discord)
Claude Code's session file has no first token, only when the line that
asked for a reply and its last line were written, so every Claude Code and
Claude Desktop call that didn't go through the gateway showed no speed,
with "Not streamed" though it was streamed. A reply of 1,000 output tokens
or more over a second or more now shows its tokens over that whole time as
a floor (ledFloorSpeed, "≥" in the cell, "At least: …" in its tooltip and
the row's details); the wait for the first token is inside it, so the
speed after the first token is never under it. Gateway rows and timed
session rows are unchanged, and the period's speed counts timed calls only.
Only Claude Code's and Claude Desktop's rows tell one. The contributed
version gave every session-file row a floor; a Codex call in a turn of
several is timed from the last tool output before its token count, and in
a month of real rollouts (4,588 multi-call calls) 2,968 were timed from the
output of a tool that same call asked for, written before its count, so
the window begins inside the call and a floor from it could read high.
Those rows keep "—" with "The session file has no first token". OpenCode's
created→completed time isn't checked against real sessions, so it tells
none either.
Checked against the shape of real Claude Code files (read-only, 30 days,
~198k messages, 2,011 files incl. subagents): block lines are stamped at
each block's end (single-line 1,000+ token text replies read a median 110
tok/s, not the thousands a start stamp would give); no sidechain lines in
main files; no assistant line out of clock order; a message's later lines
keep the time its first was asked (Began), so the 15,779 tool results
written between one message's blocks don't shorten it. Floors shown: 23,518,
p50 102, p99 141, max 156 tok/s for claude-opus-5-5.
Run: usage-session-speed.test.cjs (now also a Codex multi-call row, a
Claude Desktop row, and a 560px window) in Chromium and WebKit, en and zh;
red with the agent check taken out ('≥500 tok/s' !== '—'). The related
suites (gui-de/ja/zh-tw, i18n-keys, ledger-*, usage-ledger*, usage-speed,
reasoning-speed, routing-burst-speed, usage-ttft-rounding,
usage-computers): 146/146 in both engines. go test -tags nogui ./...,
gofmt, and go vet for darwin/linux/windows on internal/gui.
Co-authored-by: Ted Li <tl2493@columbia.edu>
|