1ccacad63281094de8a3372d5a507d38f9969e5c
7507
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
861c2da147 |
provider: tests that a Claude usage ask on a read's own clock tick is answered (#1228)
What changed: three tests for c56eccab's generation counter, one per
place a Claude reading is kept against an ask: loginReading (LoginUsage),
SubscriptionUsage's whole-page cache, and claudeWindows' /usage run.
Each asks while the reading is under way and stores the ask's time as of
before the reading began, as Windows' ~15ms clock or a clock set back
reads it. TestLoginUsageClaudeAskedMeanwhile only failed on Windows, 3 in
5, because on macOS the two times never tie; these fail every time on the
old code. The claudeWindows test also ages the answered run past the 30s
floor and checks no run follows unasked.
Why: the patch came with no test of its own that fails on the old code
outside Windows.
Run (sandbox HOME, private GOCACHE, go1.26.8 darwin/arm64):
- with the three product files put back to origin/main: all three FAIL
("a reading from before the ask was kept", "cards read before the ask
were kept as fresh", "the ask wasn't answered: <nil>, 1 runs").
- broken by hand, one at a time: loginReading's check made always true
(login test red); SubscriptionUsage's reset dropped (page test red);
the successful run's entry without asked (claudeWindows "ran again
unasked: 3 runs"); markClaudeUsageAsked's Add removed (all three red);
RefreshUsage's markClaudeUsageAsked removed (existing
TestRefreshSavedClaudeUsage red).
- go test -tags nogui -count=3 -run 'AskedOnThe|AskedMeanwhile' passes.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
e21b1dbc16 |
gateway: a broken tool exchange a Chat or Zed client left is mended for a Messages upstream, as the Chat and Responses paths mend theirs
What changed: buildAnthropic (every request built for a Messages upstream: a Chat or Responses client's conversation translated, Zed's bridge) now runs its messages through pairToolBlocks, as buildChat's pairToolMessages (#554) and the relayed Responses path's pairToolItems (#1341) mend theirs. Anthropic refuses a tool_use the next message's tool_results don't answer ("`tool_use` ids were found without `tool_result` blocks immediately after") and a tool_result naming a call it never saw ("unexpected `tool_use_id` found in `tool_result` blocks"); an interrupted turn leaves the first behind, a client that dropped a call the second. A call left unanswered gets the synthetic result the other paths make; an answer to no call becomes a text block keeping what it said. A well-formed exchange is built exactly as it was (ids in their places, results in the order the client sent, text after them). TestZedToolResultSaysIsError's fixture carried a result for a call the request never made; it asserted the orphan went through as a tool_result, which the cloud refuses. It now goes out as the text it said, and the test says so. Run: - /tmp/sbx.sh test -tags nogui -count=1 -run 'TestMessages' ./internal/gateway/ with the pairing call taken out: 6 FAIL (trace "user assistant(A)", and the end-to-end one 400 "unexpected `tool_use_id` found in `tool_result` blocks"); with it back in, all pass - /tmp/sbx.sh test -tags nogui -count=1 ./internal/gateway/ — ok - gofmt -l (nothing), go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... (the trayimage_darwin.go -Wenum-conversion warning as on main), go build, GOOS=linux go build -tags nogui, GOOS=windows go build Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
44b5b2b96b |
provider: a Claude usage ask invalidates an older read even in the same clock tick
Refs #1228. The original test fails with "a reading from before the ask
was kept". A temporary diagnostic measured identical UnixNano values for
the read's start and the later ask; that diagnostic is not shipped.
What changed:
- Count both whole-page and manual-card Claude asks with a generation.
Advance it under subscription then login cache locks, so publication
cannot check the old generation and then commit after the ask.
- Capture the generation before launching LoginUsage/SubscriptionUsage;
reject an older account read or leave the cards due for another read.
- Record each Claude /usage run's ask generation. Keep timestamps, the
zero sentinel, floor, idle behavior, saved-account scope and fallbacks.
- Document ordering and lock ownership in the providers/accounts design.
No tests, routing.go, account files or dependency versions changed.
Run on upstream
|
||
|
|
d4c2512d2d |
usage: apps report their own calls with POST /v1/magpie/usage/requests, backfill included (#1874)
What changed
- POST /v1/magpie/usage/requests (internal/gateway/usage_ingest.go) takes
one record or an array, in usage.jsonl's shape:
- the post may carry up to 5000 records and 32 MiB;
- t, agent, provider, model and rid are required.
Each field is checked: unknown fields, quoted numbers, negative or absurd
counts, a status outside 100-599, a cost over 10000 USD, and a t more
than an hour ahead or before 2000-01-01T00:00:00Z. Any fault refuses the
whole post with a 400 that names error.index and error.param, and nothing
is written. A past t is otherwise taken as given, so history can be
backfilled. The reply gives accepted and skipped counts and each
record's index, rid and status.
- Access: lanGuard's rule (this machine, or another with a key while
shared, behind the Host check). A browser page also needs a key, since
corsGuard lets localhost pages and Origin null through. A held key is
refused.
- usage.IngestReported writes under usage.mu to the same file as
usage.Append. Rows carry source "reported" and no caller key. A rid
already reported is skipped, as is one repeated in the post. The set of
reported rids is read back from the log: one scan after a restart (lines
without the reported mark aren't parsed), then only what was appended.
- Pricing: a record with cost keeps it (Record.OwnCost, the rowOwnCost
flag; packed flags widened to uint16). Otherwise it is priced at
magpie's prices.
- Display:
- SourceReported is a source of its own: RequestPage.Reported,
?via=reported, and Ledger now honours via.
- The Requests tab gains a fourth cell "reported by apps", shown once
there are some, and a "Reported" badge (en, zh, zh-TW, ja, de).
- Nothing live: Record.IsReported keeps reported rows out of:
- a key's budget/spend limit (budget.counts);
- window holds, and the log start that decides whether a window can be
reckoned (logSnapshot.firstOwn);
- gateway sessions and Vias;
- Codex's sealed answers and remembered model.
There is no OTel span, rate limit, rest or alert for them.
- Docs: gateway-sessions.md, reference.md (with a curl), integrating.md,
site integrate.html (en, zh).
Why: the reporter's apps call vendors directly, and their usage (and
history) should show on the Usage page without becoming live traffic.
Run, in a worktree with sandbox HOME and a private GOCACHE
- gofmt -l: clean.
- go vet ./...: darwin, GOOS=linux -tags nogui, and GOOS=windows.
- go test internal/usage, usageapi, budget, gateway, gui: ok.
- -race -count=3 of the new usage/gateway tests: ok.
- GUI with playwright 1.62.0:
- usage-ledger-reported.test.cjs, 26/26 in chromium and webkit (5
languages, 1180 and 420 wide, light and dark);
- usage-ledger*.test.cjs, ledger-*.test.cjs, usage-sum-whole,
usage-unpriced-sum and i18n-keys: all pass.
- Timings with 200k reported rows (47 MB log, darwin):
- 40 posts of 5000 took 0.40 s (worst batch 18 ms);
- the first post after a restart took 0.45 s (rid rescan), a later one
1.6 ms;
- the cold index build took 2.1 s (as for gateway rows);
- page all took 27 ms warm, page 30d 39 ms, all via=reported 0.53 s;
- summary all took 215 ms, 30d 20 ms.
Broken by hand, each went red, then restored
- Go: dedupe against stored rids; the restart scan; CostAt ignoring own
cost; the block pricer overwriting own cost; the Reported split;
fromBrowser's key rule; skipping bad records instead of refusing; the
max-records and body limits; the ingest lock (race); both locks;
firstOwn -> first; the IsReported guards in windowHolds,
buildGatewaySessions, buildVias, budget.counts and loggedAnswers.
- GUI: the fourth cell, the --vias column count and the badge class.
Not shown red on its own: the remote-no-key and evil.example refusals come
from lanGuard and corsGuard before the handler, so breaking only the
handler's own check stays green. The codex_memory guard is not tested
alone: a reported row has no Requested there anyway. Not tried: a real
client against a live gateway, Windows/Linux runs of the tests, the full
GUI suite.
|
||
|
|
84cd81533e |
gateway: the client's comment points at where the ChatGPT backend's HTTP/1.1 rule now lives (#1700)
The previous #1700 commit deleted gateway/codex_http1.go and moved the rule into netproxy.HTTP1, which provider/codex_http1.go sets; the comment on the gateway's client still named the deleted file. Review of #1700 (no other change needed): every Codex request magpie makes goes through a netproxy.Dispatch transport, http.DefaultClient's (codexModels, warmCodex, accountJSON for /wham/usage and the reset credits, consumeCodexReset) or the gateway's s.client (turns, /models); the HTTP/1.1 clone keeps netproxy.Func, or the account's own proxy, and Clone deep-copies TLSClientConfig, so clearing NextProtos there leaves the base transport offering h2 to every other vendor. Run on 7485065d (the cherry-picked #1700, sandbox HOME, private GOCACHE): go test -tags nogui ./internal/netproxy ./internal/provider ./internal/gateway pass; -race on TestDispatchHTTP1, TestWith, TestCodexBackendOwnRequestsOverHTTP1, TestAccountProxy (provider and gateway) and TestCodexBackendOverHTTP1 pass. Broken by hand: with netproxy.HTTP1 left nil, TestCodexBackendOwnRequestsOverHTTP1 fails (all five requests "HTTP/2.0 (h2 offered)") and the gateway's TestCodexBackendOverHTTP1 fails ("asked over HTTP/2.0"); without the NextProtos reset TestDispatchHTTP1 fails ("malformed HTTP response", the server took h2 from the hello). gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean; linux and windows builds. Not reproduced: the reporter's PROTOCOL_ERROR itself. Co-authored-by: appointat <65004114+Appointat@users.noreply.github.com> |
||
|
|
4537e92093 |
mcpauth: an assigned method magpie can do is checked to sign in and renew, both ways round (#1490)
The previous commit refuses at registration a method the server assigns that magpie can't send. The owner asked on #1490 that an assignment magpie can do be shown still to work; no test did. One now does, for the code exchange and a renewal after the access token is refused: - asked none, assigned client_secret_basic with a secret; - asked none, assigned client_secret_post with a secret; - asked client_secret_post, assigned none with no secret (a public client), which sends no secret; - asked client_secret_basic (the only one listed), assigned post. The fake's registration took an assigned method only when its metadata listed it, so "none" assigned to a server listing only post was turned away as invalid_client_metadata; a method the server assigns is one it supports, so with Assign set it is taken. Run (sandbox HOME, private GOCACHE): the new test and TestSignInRefusesAssignedSecretJWT, TestSignInBySecretBasic; go test -race ./internal/mcpauth/... and ./internal/library (which signs in through the fake) pass. Broken by hand: with register ignoring the response's token_endpoint_auth_method the new test fails at the first case ("the token endpoint answered 400: invalid_grant"); without the previous commit's check TestSignInRefusesAssignedSecretJWT fails ("the sign-in page was opened for a client magpie can't authenticate as"). Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
c89a0f9d95 |
mcpauth: a server that registers magpie for a client authentication magpie can't do is said no at the registration
What changed: register took the registration response's token_endpoint_auth_method as it came. RFC 7591's response lets the server assign another of the methods it supports than the one asked for, and one assigned that magpie can't send (client_secret_jwt, private_key_jwt, tls_client_auth) opened the sign-in page all the same: the failure came at the code exchange, after the browser round trip, as "the token endpoint answered 400: invalid_grant", and every renewal would fail the same way. A method outside none, client_secret_post and client_secret_basic is now refused at the registration, before the browser is opened, with the request side's own wording. An assignment magpie can do (a server handing client_secret_basic and a secret for a client that asked none) still works as before. mcpauthtest.Fake gains Assign: a server that registers the client for another of the methods its metadata lists, giving a secret and taking the token endpoint's word for it. Without it set, the fake answers as it did. Run: - TestSignInRefusesAssignedSecretJWT (new) fails on the old register: "the sign-in page was opened for a client magpie can't authenticate as: http://127.0.0.1:…/oauth/authorize?…" — and passes now, Start saying the server registered magpie for client_secret_jwt, which magpie can't do. - go test -tags nogui -count=1 ./internal/mcpauth/... ok, every existing case unchanged; full go test -tags nogui ./... under a temp HOME ok except testenv's TestOffline, red the same on the untouched baseline (loopback proxy escapes this machine). - gofmt -l clean; go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet clean; go build, GOOS=linux go build -tags nogui, GOOS=windows go build ok. - Not tried against a real authorization server that assigns a method: none is known in the wild; this is the response-side half of #1490's class, set by RFC 7591. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> |
||
|
|
abdc4b113d |
netproxy, provider, gateway: every request to the ChatGPT backend goes over HTTP/1.1, magpie's own too, not only the gateway's turns (#1700)
|
||
|
|
d0e412e7a6 |
library: a checked MCP server's PWD is home too, and #1727's cwd test holds on macOS (#1727)
The previous commit starts the check's server in home. Its own test failed on macOS with that fix in: the child reported /private/var/folders/.../magpie-test-home-N and HOME was /var/folders/.../magpie-test-home-N, the same folder spelled through macOS's /var symlink, compared as strings. The test now compares the folders with os.SameFile. exec sets PWD to Dir by itself only when Env is nil, and the check sets Env, so the server ran in home with PWD still naming magpie's own folder; a shell-script server that reads $PWD would see the folder the fix moved it out of. The check now sets PWD=home with Dir (not on Windows, which doesn't use PWD, as exec does), before the server's own variables so one it sets still wins. The two subtests now give each run a home of its own (t.Setenv HOME and USERPROFILE) and move the process with t.Chdir, so the "needcwd" fake's ./logs goes with the test instead of staying in the package's shared test home, and nothing is left in another cwd when a subtest fails. The read-only-cwd subtest also checks that ./logs landed in home: Windows doesn't enforce a folder's read-only bit, so that is what makes it fail there without the fix. Run (sandbox HOME, private GOCACHE): TestCheckStdio -count=3 on macOS; the whole internal/library package. Broken by hand: without cmd.Dir both subtests fail (wrong folder; "mkdir logs: permission denied"); without the PWD line the cwd subtest fails on its PWD. On the Windows box (windows/amd64 test binary): TestCheckStdio passes, and without cmd.Dir both subtests fail there too (the server ran in the test's temp cwd, and ./logs wasn't in home). Co-authored-by: ump45nose <52391318+ump45nose@users.noreply.github.com> |
||
|
|
0154fe1135 |
library: start stdio MCP checks in the home directory (#1727)
A magpie started from a Windows shortcut keeps C:\Windows\system32 as its cwd. The Library check inherited that directory, so a server that writes into "." failed as exited (1) with no log. Agents start the same server from a project or home directory and succeed. Pin cmd.Dir to HOME for the check. |
||
|
|
f2c30a8859 |
usage: the tags over the Context curve's dots never print over each other either (#1549)
The previous commit keeps the axis labels apart. The tags over the dots
had the same fault: a setting one step from the advice printed its
"+3%" on "Leanest", and a setting one step from the costliest value
printed "+147%" on "+150%". The tags now go by the same rule, "Leanest"
first, then the setting now, then the costliest: one within 16% of the
axis of a tag that matters more and at about its height (20 of the
plot's 100 units) keeps its dot and tooltip but not its tag.
Run: context-tune's overlap test gains a row whose setting sits one step
from the advice, checks the tags' boxes as well as the axis labels', and
runs in German ("Sparsamste", the widest "Leanest") as well as English,
at 360 and 1100px. With the previous commit's context.js it fails in
chromium and webkit ('en 360px: tag "+150%" overlaps "+147%"'); with
this one it passes. The axis test alone failed on main before the
previous commit ('360px: "160K" overlaps "170K"'). context-tune,
compact-at and context-window: 80/80. 56 context/usage/language GUI
files in both engines: 652/654; the two reds are usage-ledger's route
export (passes 3 of 3 alone, filed as #1876) and, in an earlier run,
usage-sum-whole at 780px in German (#1864, noted there); neither reads
context.js.
Co-authored-by: ump45nose <52391318+ump45nose@users.noreply.github.com>
|
||
|
|
9f54b6428e |
usage: the Context tab's curve no longer draws the leanest value's label over the axis's first one when they sit a step apart (#1549, Ti800)
The axis labels the advice's value, the setting now and the range's two ends. One that sits within 16% of the axis of one that matters more (the advice first, then the setting now, then the ends) is left off, so two labels are never drawn over each other: 170K one step from 160K read as "1170K". |
||
|
|
38a07d890a |
gui: the line over each opened agent setting runs unbroken across label and value (#1169)
The label/value grid that keeps "In {agent}" on one line put 16px of
column-gap between the label's top border and the value's, so every
separator in the opened row had a 16px hole in it where one line ran
across before. The space between the columns is now the label's own
right padding (column at least 128px = the old 112px label + 16px gap),
so the two borders meet.
Run: agent-field-names' "one aligned line" test now also checks that
each value starts where its label's box ends. With the previous commit's
CSS it fails in all ten engine/language runs ("a gap between a label and
its value", valueLeft 16px past labelRight); with this one it passes.
The 45 GUI files that open an agent row plus gui-de/ja/zh-tw, chromium
and webkit: 701 tests; mobile-web's desktop screenshots match
|
||
|
|
7f90f3f0cf |
gui: an opened agent's labels stay on one line, the column as wide as its longest label (#1169, emo172)
The opened row's label column was a fixed 112px with nothing to stop a
label from wrapping, so "In {agent}" broke over two lines for long agent
names (Cursor Private Inference, DeepSeek Harness) and for wider UI
fonts, and pushed its row taller than the rest. The rows now share one
grid whose label column is minmax(112px, max-content) with nowrap, so
every label sits on one line and every value starts at the same x. Under
600px the rows still stack, label over value.
Run (by the maintainer, on origin/main
|
||
|
|
751e05d824 |
provider: moved Cursor users get plugin 0.2.10, which counts a Team's org-wide on-demand pool as the limit (#1868)
@magpie-community/opencode-cursor-auth 0.2.10 (magpie-community/plugins a885a16) gives a team member with no limit of their own a fixed On-demand window on the team's pool (pooledUsed / pooledLimit, the member's own spend beside it) instead of unlimited, the same change as the built-in's in the previous commit. keepMovedCurrent updates every moved user's plugin to it. Run: 0.2.10 checked on registry.npmjs.org (latest, its tarball holds the fix); go test -tags nogui ./internal/provider/ under a sandbox HOME (ok, TestMovedBuiltinsSayTheirPlugin included); gofmt -l and go vet on darwin, linux (nogui) and windows clean. |
||
|
|
9ddcee10ac |
provider: a Cursor Team member with no limit of their own spends the team's on-demand pool, shown and counted as the limit, not as unlimited (#1868)
PaSSw0rds' Team account (#1476) has on-demand turned on for the whole organization: spendLimitUsage has no individualLimit, pooledLimit "45120000" and pooledRemaining "38785730" are int64 strings, pooledUsed 6334270 a number, and GetHardLimit answers {"hardLimit": 451200} with or without a team id. cursorOnDemandOf read that as unlimited, as cursor-agent's own usage view does, so On-demand showed only the member's $198.55 at 0%, aside, and a spent team pool never counted the account used up; magpie would keep routing to it until Cursor refused. Now a team member with no individualLimit and a pooledLimit > 0 gets a fixed On-demand window on the pool: used = pooledUsed / pooledLimit, display "$63,342.70 / $451,200.00 (you: $198.55)", not aside. A hard limit that forbids on-demand still reads as disabled, and a team with no pool and a hard limit still as unlimited. Dollar figures group thousands (cursorDollars), as plugin 0.2.10 does. This is the built-in, for users who haven't moved to the plugin; moved users get the same from @magpie-community/opencode-cursor-auth 0.2.10 (next commit raises the mover's min). Run, under a sandbox HOME with pinned caches: go test -tags nogui ./internal/provider/ (ok); gofmt -l; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows (clean). Broken by hand: with the old cursor_usage.go, TestCursorOnDemandKeepsTheAccount/a_team's_org-wide_on-demand_pool_is_the_allowance fails (On-demand "$198.55", used 0, aside; the spent pool "used up false"); with a fix that puts the member's spend against the pool, it fails too. Built from the payloads quoted in #1476. Not tried against a real Team account. |
||
|
|
f31ae38aeb |
provider: Xiaomi MiMo is priced at xiaomi's list price, not its Token Plans' $0, and pay as you go looks only in xiaomi (#1873)
mengyianx found every pay-as-you-go MiMo call counted at $0.000: models.dev's xiaomi-token-plan-cn, -sgp and -ams list all nine models at cost 0 (the plan's per-token charge, not the model's price), the preset's catalog was "xiaomi-token-plan-cn, xiaomi" at every region, and catalog.PricedBy takes the first catalog with a cost field. makerCatalogs puts the plan catalog ahead of xiaomi too, so the maker fallback gave $0 as well. What changed: - membershipCatalogs (never read for a price) gains the three xiaomi-token-plan catalogs, as #1370 did for Kimi Code. That covers ListPrice, MakerPrice and PricedName through makerPriceCatalogs. kimiCodeMember now checks a list of Kimi Code's plans of its own (kimiCodePlans), so a Xiaomi provider isn't taken for Kimi Code and its ids aren't mapped to Kimi's. - Each Xiaomi region names its own catalog: plan-cn/sgp/ams "xiaomi-token-plan-<r>, xiaomi", pay as you go "xiaomi" alone. A plan user is priced at the API-equivalent price, the same meaning as #1370. - PricedBy is unchanged: a catalog that lists a model at $0 still prices it at $0 (nvidia, modelscope have truly free models). - docs/subsystems/providers-accounts.md says so. Providers saved before this: the preset's own catalog stays "xiaomi-token-plan-cn, xiaomi", the same string an existing provider saved with the old default holds. normalize already lets a catalog that equals the preset's or one of its regions' follow the region the provider is at (the Tencent Cloud mechanism), on every read, so an old default at pay-as-you-go reads as "xiaomi" and at Singapore as "xiaomi-token-plan-sgp, xiaomi"; nothing is written to providers.json until the user next saves it. Any other catalog the user typed is kept as typed, and is priced right anyway because the plan catalogs are out of pricing. The one value that can't be told apart is a bare "xiaomi" typed at a plan region (the issue's workaround, which was for pay as you go): it equals the pay-as-you-go region's catalog, so it reads as that plan's "xiaomi-token-plan-<r>, xiaomi". Its prices are identical either way; only the model-metadata lookup order differs. That is the existing rule for every preset with region catalogs, kept rather than special-cased. Siblings: scanned the models.dev cache (read only) for catalogs whose priced models are all or mostly $0. Of those, only kimi-code-plan-* and xiaomi-token-plan-* are named by any preset or region. stepfun's *-step-plan catalogs carry no cost at all, so they never shadowed a price. alibaba/minimax/zai/zhipuai/volcengine/tencent coding and token plan catalogs are all-$0 on models.dev but no preset uses them. Tests (internal/provider/xiaomi_price_test.go, fixture testdata/xiaomi_catalog.json cut from models.dev's real entries): - TestXiaomiListPrice: every region, the old default, a user's own catalogs: mimo-v2.6-flash $0.14/$0.28/$0.0028, mimo-v2.6-pro $0.435/$0.87/$0.0036; MakerPrice; EffectivePrice of a saved provider; a relay's own $0 model ahead of xiaomi stays $0; a Xiaomi provider is not a Kimi Code member. - TestXiaomiRegionCatalogs: each region resolves to its catalogs from the preset's, the old default and another region's; import links at each region; FromPreset; a user's catalog kept at two regions. Broken by hand, each red, then restored: - membershipCatalogs back to Kimi only: TestXiaomiListPrice FAIL, plan regions and MakerPrice at $0. - region catalogs removed: TestXiaomiRegionCatalogs FAIL (api with the old default stays [xiaomi-token-plan-cn xiaomi], imports at sgp/ams get cn's). - both: TestXiaomiListPrice FAIL, api with the old default at $0 (the reported bug). - kimiCodeMember on membershipCatalogs: FAIL "a Xiaomi Token Plan provider counts as a Kimi Code membership". - PricedBy's exact match skipping all-zero costs: FAIL "relay mimo-v2.6-flash: ... want its own $0". Run: gofmt -l (nothing); go vet ./... on darwin, GOOS=linux -tags nogui, GOOS=windows; go build on all three; go test -tags nogui -count=1 ./internal/provider ./internal/catalog ./internal/cli ./internal/gui ./internal/usage, all ok, in a sandbox HOME with pinned caches. Real use: built binaries before and after, sandbox HOME with a copy of the real models.dev cache and a providers.json holding the reporter's saved state. `magpie model price xiaomi/mimo-v2.6-flash` printed $0/$0 before and $0.14/$0.28 after; an old-default provider at Singapore went $0 -> $0.14/$0.28 and shows catalog "xiaomi-token-plan-sgp, xiaomi"; one with the user's "openrouter, xiaomi" kept it; providers.json was byte-identical afterwards. Not tried: a real MiMo key or call, the GUI editor's region switch, the full go test ./... suite. Co-authored-by: mengyianx <106875577+mengyianx@users.noreply.github.com> |
||
|
|
304b347a39 |
tests: the skills-only and leftover-folder tests keep AppData in each case's own home, so Hermes isn't found from another test on Windows (#1388)
The same class as 7743c52e5 (syncHome), in two tests that don't use it. On Windows Hermes keeps %LOCALAPPDATA%\hermes, and TestSkillsOnlyFolderIsNotInstalled and TestLeftoverFoldersAreNotInstalled left LOCALAPPDATA at the package's test home. The case's own home held only skills (or cache, log, skills), but the shared folder held what an earlier case or test had written there, so Hermes read as installed and both tests failed on the Windows box, before and after RaykieLee's series. ownAppData sets APPDATA and LOCALAPPDATA inside each case's home. Run: go test ./internal/agent on macOS green. Windows box: both red without this (main, and the series without it), green with it. Windows box (Windows 11 x64, amd64 test binary of the whole package, sandbox HOME/USERPROFILE/APPDATA/LOCALAPPDATA/TEMP): main plus the series' base fails 21 tests; with the whole series only TestInstallWithoutNodeParses (bash there is WSL's, whose default distro has no /bin/bash) and the two TestReasonixCLI* (no Go on the box) fail, both environmental and listed as untested by RaykieLee too. |
||
|
|
688c062edf |
tests: the Codex process-list stale tests skip Windows, where the row's copy is the daemon's last check, tested on every OS (#1388)
TestCodexStaleOnlyForMagpiesChange, TestCodexStaleCopiesSayWhichIsLeft and TestCodexDaemonHelperIsNoStaleCopy test copies told apart from the process list. StaleCopies lists no processes on Windows (a PowerShell run each look); there it returns codexDaemonBehind, the daemon as KeepCodexDaemonCurrent last found it. So the three failed on Windows. RaykieLee's f3e0672fd added Windows branches that seed codexDaemonSeen with the answer and assert it back, so on Windows the tests named for "only magpie's change" and "which copy is left" pass whatever those guarantees do; its keepCodexDaemon mock is never called there, and one branch leaves the seeded check behind for later tests. Taken instead: the three skip on Windows and say why, and TestCodexStaleOnWindowsIsTheDaemonsLastCheck drives the Windows path itself, through codexDaemonCheck with keepCodexDaemon faked: none before a check, none when not behind, the daemon (with its start) when behind, none after CodexDaemonRestarted, none when magpie restarted it, none once the check is older than three loops. It reads StaleCopies on Windows and codexDaemonBehind elsewhere, and resets codexDaemonSeen when done. Run: go test ./internal/agent on macOS green. Broken by hand, each red: codexDaemonBehind ignoring Restarted, ignoring the check's age, and CodexDaemonRestarted not clearing. Windows box (Windows 11 x64, amd64 test binary of the whole package, sandbox HOME/USERPROFILE/APPDATA/LOCALAPPDATA/TEMP): main plus the series' base fails 21 tests; with the whole series only TestInstallWithoutNodeParses (bash there is WSL's, whose default distro has no /bin/bash) and the two TestReasonixCLI* (no Go on the box) fail, both environmental and listed as untested by RaykieLee too. The three skip there and TestCodexStaleOnWindowsIsTheDaemonsLastCheck passes. Co-authored-by: RaykieLee <42793273+RaykieLee@users.noreply.github.com> |
||
|
|
9650cd50c1 |
tests: the Aside offline tests refuse a write the way each OS does, and read the record's mode as Windows reports it (#1388)
On Windows six Aside tests failed: a directory's mode is ignored there, so chmod 0500 on the record's folder refused nothing; os.Stat reports the 0600 record as 0666; and os.Symlink needs a right a test isn't given. RaykieLee's 448967806 made the file itself read-only instead, on every OS. That passes on Windows but turns four of the tests red on macOS and Linux: edit.WriteAtomic renames a temporary file over the record, and a rename over a 0400 file in a writable folder succeeds there, so nothing is refused (TestAsidePostReadFailuresNeverOfferOffline/save_record, TestAsideOfflineWriteFailureRollsBack, TestAsideDisconnectUnavailableOnlyAtInitialRead/record, TestAsideOfflineProviderWriteFailureRollsBackAllFiles; red at the branch's own tip too). This keeps its Windows half and the folder elsewhere: refuseWrites makes the folder unwritable on macOS and Linux, and the file read-only on Windows, where neither a write nor a rename replaces it. recordPerm wants 0666 on Windows. The provider-file test links its target with a symlink, or a hard link on Windows, and refuses the target the same way. Run: go test ./internal/agent on macOS green; with refuseWrites a no-op all four go red. Windows box (Windows 11 x64, amd64 test binary of the whole package, sandbox HOME/USERPROFILE/APPDATA/LOCALAPPDATA/TEMP): main plus the series' base fails 21 tests; with the whole series only TestInstallWithoutNodeParses (bash there is WSL's, whose default distro has no /bin/bash) and the two TestReasonixCLI* (no Go on the box) fail, both environmental and listed as untested by RaykieLee too. The six Aside tests are among the 21 and pass. Co-authored-by: RaykieLee <42793273+RaykieLee@users.noreply.github.com> |
||
|
|
5cb5b6b7ae | tests: syncHome scopes APPDATA and LOCALAPPDATA into the per-test home | ||
|
|
bac0ccb905 | tests: Zed's relative config dir falls back to its Windows default | ||
|
|
5415e5473b | tests: the Codex fixtures' Windows paths are quoted for TOML | ||
|
|
3b3dd47370 |
gui: the panel's usage rings are round on a 1x screen; the inner circle is 28px, so the band is a whole 3px a side (#1735, beansiayo)
A ring is .pq-dial (34px) with .pq-dial b (27px) over it. 34 - 27 is odd,
so the band was 3.5px a side and the inner circle sat on a half pixel. At
device scale 1 (an external 1080p display) each edge rounded its own way,
and the band came out 4, 3, 3 and 4 pixels left, right, above and below:
the slightly oval ring beansiayo saw. At 2x every edge falls on a whole
device pixel, which is why the built-in Retina screen looked fine.
parkavenue9639 found the cause and the fix: a 28px inner circle makes the
band a whole 3px.
quota-dial.test.cjs paints the band and the inner circle in flat colours
(sizes untouched), screenshots each ring in the panel and counts the
band's device pixels on each side of the inner circle, at device scale 1
and 2, Chromium and WebKit, en and zh.
Run: quota-dial.test.cjs on main's app.css fails all four (1x
{"left":4,"right":3,"top":3,"bottom":4}, the contributor's numbers); with
28px all four pass (1x 3/3/3/3, 2x 6/6/6/6). quota-pools, panel-usage,
quota-families and quota-curve pass (16). Screenshots looked at by eye.
Not tried on a real external 1x display.
Co-authored-by: parkavenue9639 <92194680+parkavenue9639@users.noreply.github.com>
|
||
|
|
743e330085 |
gateway: a system prompt or message that only quotes a compaction prompt is no longer taken for a compaction; the prompt must lead (#1635, jueda12)
What: compacting() looked for an agent's compaction prompt anywhere in the system prompt (strings.Contains) and its ask anywhere in the last user message. Minis puts the user's memory after its own prompt in every request, so a memory that held Minis's compaction line made every turn of that conversation a "compaction", routed to the compaction rule's model (28 requests in a row in the report, one with 4 tokens of chat). Now: - a compactSystems prompt counts only when it begins within compactLead (2048 bytes) of the system prompt's start: alone, or behind a short lead (Claude Code's billing header and identity line, which its Anthropic system blocks join with no separator, so a line-start check would miss it); - a compactAsks ask counts only when it begins within compactLead of a text part of the last user message (Claude Code 2.1.296 puts its ~420-byte "CRITICAL: Respond with TEXT ONLY" preamble first; Codex and Kimi start the part with it). Minis's END OF CONVERSATION TO COMPACT. follows the whole conversation in one part, so it counts only in a part that opens with Minis's own "Compact this conversation into a context summary:". - Kimi Code's own compaction system prompt (kimi-cli 1.52.0, soul/compaction.py COMPACTION_SYSTEM_PROMPT) is added, so Kimi stays found without relying on the ask's part alone. The approach (a leading window instead of the whole prompt) and the test TestCompactingIgnoresQuotedPromptInSystem are jueda12's. Their sample put the quote ~30 bytes into a short system prompt, which a leading window still takes, and no rule can tell that apart from a short real lead; the test puts the memory behind a long agent prompt, as Minis sends it. Run (go1.26.8, sandbox HOME, private GOCACHE): - the prompts were checked against the installed Claude Code 2.1.296 binary (the hnn preamble, then "Your task is to create a detailed summary…") and kimi-cli 1.52.0's compaction.py (prompt in its own part). - break checks: main's compacting.go -> TestCompactingIgnoresQuotedPromptInSystem FAIL (memory, claude code taken; kimi not taken) and TestCompactingAsksWhereTheAgentPutsThem FAIL (minis marker quoted, ask deep in a paste); leads() without the window -> the same, minus Minis; the Minis opens check dropped -> "minis marker quoted: taken for compacting". Restored: pass, with TestCompacting, TestCompactingMinis, TestRuleCompact, TestCompactionBrokeOffKeepsTheStick. Not run: a real Minis client (the reporter offered to check with the memory that still holds the line). Co-authored-by: jueda12 <180685381+jueda12@users.noreply.github.com> |
||
|
|
df29a511e6 |
gateway: Claude Desktop's model menu names a model as the agents' lists do, by the Provider in model names setting (#1746, marsxxl)
/v1/models for claude-desktop named every model by its own name alone, with its provider's id in parentheses only where two read the same (desktopNames, |
||
|
|
55213c1b4d |
agent: the Windows Codex app's version comes from its main Store package only, and agent tests never read the machine's AppX registry (#1334)
Review follow-up to 46e4107 (AwadYoo). What: - storeAppVersion counts only the main package (empty resource id). The Windows box's AppX registry key keeps a resource package that Get-AppxPackage no longer lists (Clipchamp.Clipchamp_4.6.10420.0_neutral_split.scale-125_… beside the installed 4.7.10020.0_x64__…). A stale entry like that is no sign the app is installed, and a newer-numbered one would win "newest". - internal/agent's TestMain stubs windowsStorePackages, as it already does for nodeModulesOf and the other machine readers (#1823's rule): on a Windows box with the Codex app installed, tests read nothing of it. - the doc comment for storeAppVersion had a blank line in the middle of it. It is joined, and windowsStorePackages has its own comment. Run (go1.26.8, sandbox HOME, private GOCACHE): - Windows box (Win 11 x64): installed the real Store app (winget 9PLM9XGG6VKS, "ChatGPT", OpenAI.Codex_26.1007.2314.0_x64__2p2nqsd0c76g0). A probe built from origin/main printed AppVersion="" HasApp=false; built from this series: AppVersion="26.1007.2314.0" HasApp=true, and CLI() ok=true App="26.1007.2314.0" with no codex CLI on PATH. - break checks: the resource-id filter put back to len(fields) < 3 -> TestCodexWindowsStoreAppVersion FAIL `Codex Store app: "27.0.0.0"`; AppVersion without the Store read -> FAIL `Codex Store app: ""`. Restored: pass on darwin and on the Windows box (test binary built with GOOS=windows GOARCH=amd64, run there with the real app installed). |
||
|
|
4697ff2324 |
agent: the Agents page shows the Windows Codex app's version, read from the Microsoft Store package registered for the user (#1334, laacmilan)
On Windows the Codex app is the Store package OpenAI.Codex
(C:\Program Files\WindowsApps\OpenAI.Codex_26.1002.7124.0_x64__2p2nqsd0c76g0
in the report), which magpie didn't read: only %LOCALAPPDATA%\Programs was
looked in. The version now comes from the package full names under the
current user's AppX repository key (HKCU\...\AppModel\Repository\Packages),
which needs no access to the protected WindowsApps folder and starts no
PowerShell. The newest OpenAI.Codex package with publisher id 2p2nqsd0c76g0
wins.
Test: TestCodexWindowsStoreAppVersion (picks the newest, skips a bad
version and another publisher, and a WSL twin shows none).
[Message rewritten at review to say what and why; the code is AwadYoo's. The
conflict with
|
||
|
|
bc2743f4b9 |
routing: a picked request goes back to live once it leaves the list, and the panel's stage has a place per provider (#1389, Creat55)
The reporter's two screenshots are the Routing window holding one request: at 13:42 the stage still showed a 13:22 Antigravity request, and at 15:58 it still showed a 13:42 qoder request while every request listed went to WorkBuddy's deepseek. A request picked in the list (or from the tray panel's row that opens the window on it) pins the stage. followListed lets a pin go when a filter leaves it out, but poll never did when the request dropped out of the 60 the page keeps, so the stage stayed on it for hours. poll now lets it go and follows live. The tray panel's mini stage (pDraw) had three places on the right, each a provider's account. A provider whose requests went from account to account filled all three, and the providers other sessions used were left off. A place is now a provider, naming the account its latest try went to, with how that went. A request under way when the page dropped it kept its panel dot waiting at its account until pUntil's 180 s limit, holding the dot, the place and one of four play slots. pPlay now ends it at the next trace update, as the window's play does through its rt(). The dot doesn't fly home red, since nothing failed. Run: - routing-pin-leaves.test.cjs (new): 5 languages, 420 and 1100 wide, chromium and webkit. On main it fails in every case with "the stage stayed on the picked request". - panel-routing-providers.test.cjs (new): 5 languages, chromium and webkit. On main it fails with three Qoder places. With only the pDraw part, it fails with "a dropped request still flies". - All 67 routing/panel/tray-bird GUI files: 429/429 in chromium and 428/429 in webkit. The one webkit red was routing-steady under --test-concurrency=4 (1.69 px), which is the known #1804. It passed 3/3 alone and 6/6 in parallel with and without this change. panel-routing's stage expectations are unchanged. Not tried: the reporter's real gateway traffic, and Windows. |
||
|
|
8accabf0d9 |
library: an MCP server off for every agent shown isn't started when magpie opens (#1597, xiaozhu1337)
The library page checks (starts) every server it counts as in use when it opens. inUse counted any agent id in the server's library record, and any project entry. The library keeps the agents it once gave a server to even when the page doesn't show them: one hidden on the Agents page, one no longer installed, one with no MCP of its own (skills only), and projects whose folder is gone. A server on only for those had every chip off on the page and was still started each time, which is what the reporter saw with ida-pro-mcp and windbg-mcp. inUse now counts only agents the page shows with MCP (mcpAgents), and project entries for shown agents with project MCP, in projects whose folder is there. Such a server shows "not checked" and a click checks it, as before. Its tooltip says no agent shown here has it on (new string in zh, zh-TW, ja, de), and one on for nobody keeps the old text. Siblings: inUse is the only thing that picks the servers checked on open (renderServers and paintHealth both call it). The Go side, library.CheckServers, checks only the names the GUI sends. The remove-all confirmation still counts every project, which is right for a removal. library-mcp-health's fixture agent now declares projectMCP, since its project-only server is meant to count as in use. Run: new library-mcp-unshown.test.cjs (5 languages, 420 and 980, chromium and webkit) fails on main with ida-pro-mcp, projgone, projhidden, skillonly and windbg-mcp in the first check. With the fix, all 34 library/MCP GUI test files pass in chromium and webkit (270 each), and go test ./internal/gui passes. Not tried: the reporter's Windows machine; which of the hidden, uninstalled or no-MCP cases they hit isn't confirmed. |
||
|
|
d13a4a1396 |
gui: Routing's story of a request keeps its logos as it is redrawn, so they no longer blink
The owner: in "How the request at … was routed" the provider logos "会不
停地闪烁". renderSteps made every line and logo afresh whenever the story
changed, which is on every new request and at each step of a live one,
so with an agent at work the logos were made again and again, and WebKit
draws a mask logo made afresh as nothing for a moment.
A line whose text, kind, model and logos are unchanged is now kept as it
is, and a changed line takes the logos of the lines it replaces
(keepIcons), so only what changed is made.
Run: routing-log-icons.test.cjs's new case walks a live request through
three steps (trying, 429 and trying the next, done) and checks the why
line and every logo are the same nodes after: chromium and webkit, en,
zh, zh-TW, ja, de, 14/14 with the old cases; the 10 new cases fail on
origin/main
|
||
|
|
6746655a8c |
gui: a Library row's agent chips fan out like a hand of cards, by translate alone
The owner: hovering an MCP server's row, the agent icons came out with "一点都不丝滑优雅精致美观,应该像翻起扑克牌一样丝滑优雅". The fan grew every chip's margin at once while a spacer before them shrank, so the row was laid out again on every frame and all the cards moved as one block. The chips are now laid out fanned for good and drawn stacked by sliding each one by translate (--k, the chips to its right, set in agentChips). Hovering only clears translate: the compositor moves the cards, the strip, All and the name beside them never move, and the cards are dealt one after another (a stagger of at most 120ms in all), the one with the furthest to go first, so none passes over another; they go back together, quicker. Transform stays free for the press. Reduced motion fans at once. Run: library-chip-fan.test.cjs (new), chromium and webkit, en, zh, zh-TW, ja, de, with and without reduced motion: 22/22; 0/22 on origin/main |
||
|
|
841af36bfc |
gateway: models the user disabled are refused on every route, and leave every list (#1867)
oxsean asked for one place to turn a model (claude-fable-5) off for good:
not reached by a direct request, an old session, a routing group member,
a fallback, a sub-agent, count_tokens or a decision model.
What changed:
- settings.DisabledModels: patterns, an exact id or a glob (* any run, /
included; ? one), matched ignoring case against provider/model, the
bare id and its last segment (provider/disabled.go). Empty by default,
so nothing changes for anyone who doesn't set it.
- Lists: buildEntries (entriesOff) leaves a disabled model out of the
catalog, so /v1/models, agents' model files and pickers, Codex's list
and every group go without it; membersIn skips it as a member, Deciders
as a decision model; codexModels drops Codex's own disabled slugs and
codexListTag changes so Codex refetches.
- Requests (gateway/disabled.go): 403 "model <id> is disabled in magpie"
in each API's error shape, at #882's choke points: serve (idOff),
perKeyBarred (no candidate: group next member, provider Fallback),
count_tokens and Gemini :countTokens, serveSystemOne,
serveDecisionGroup and postDecide, draw/video/embeddings, and
codexBackend for Codex's own bare models. A group with a member left
goes on without it; one with none left is refused naming them. A bare
id the catalog no longer has is refused as disabled, not 404. A Codex
sub-agent pick onto a disabled model stays on its lead's model.
- An unreadable settings.json is never "none disabled": the list read
last stays; with none read, every request is refused; nothing is
written over the file.
- CLI: magpie model disable <model|glob>..., enable ..., disabled
(list-disabled).
- GUI: Settings > Models > Disabled models: each pattern with the models
it matches now and Enable; Disable... opens the model picker, which
also takes a typed glob. Says only requests through magpie are covered.
POST /api/settings/disabled-models; POST /api/settings keeps the list.
Strings in zh, zh-TW, ja, de.
- docs/subsystems/gateway-routing.md: Disabled models section.
What was run (worktree at origin/main
|
||
|
|
f94809d23e |
agent: Claude Code isn't handed 272000 for a routing group made only of Claude models (#1741, yanjieee)
writeCompact gives a Claude model its own window (no
CLAUDE_CODE_AUTO_COMPACT_WINDOW unless the user set a threshold), but
claudeModel looks only at the id's last part, so group/auto-claude-opus-5-5
or any group of Claude [1m] models was told magpie's default 272000.
provider.ClaudeGroup is true when every member of a group (nested groups
flattened, by the listed name or the wire name, Bedrock names included)
is a Claude model; writeCompact now treats such a group as it treats a
Claude model. A group with another vendor's model keeps 272000. A
threshold set on a member's provider still comes first (CompactSet), and
the user's own env, autoCompactWindow and modelSettings are untouched.
Siblings: only Claude Code has a Claude exemption. Codex (codexcat
work.Working, route.go/models.go CompactFor) applies the working window
to every model, so has no group misread. claudeOutput's claudeModel uses
are about output tokens and are left as they are. Part (b), per-model
modelSettings windows, is tracked separately.
Run: TestClaudeGroupCompactWindow (new) fails on the old writeCompact
("a group of Claude models: 272000"), passes now, with a user-owned env
500000 and autoCompactWindow 900000 kept; go test ./internal/agent
./internal/provider; gofmt -l; go vet darwin, linux -tags nogui, windows.
Not tried in a real Claude Code session.
|
||
|
|
9be1bc4562 |
gui: Settings' menu-bar allowance picker lists a key's plan and balance as one row, not two "Command Code" rows ticked together (#1658, MizuIro-H)
|
||
|
|
22ec7b14ff |
gui tests: key-balance-card watches for the card's flash rather than polling for it, which a busy WebKit missed under reduced motion
The test runs with reducedMotion "reduce", where app.css cuts every
animation to .01ms: the flash class panelQuotaFocus puts on the Command
Code card is removed on animationend a frame later (instrumented:
animationstart and animationend both at 43ms, elapsedTime 0.00001). A
waitForFunction poll landing outside that frame timed out at 5s. On
origin/main
|
||
|
|
73ce9765f1 |
proc: EndProbes returns once a killed probe's whole group is gone, so an exit right after can't leave a missed child running (#1278)
JJ-Lin's fault injection on #1278: when the first signal to a probe's group missed a process being forked, group.kill went on signalling it from a goroutine nobody waited for, and the probe counted as ended as soon as the first signal went out. EndProbes returned in ~0.2ms; magpie then exiting (or Exec'ing the new version) ended that goroutine, and the missed child lived on with PPID 1. group.kill now returns a channel closed once none of the group is left (or killFor has passed). A probe's Cancel marks its kill as begun and counts the probe ended only when that channel closes. EndProbes waits up to endWait for each kill to begin (a probe that already answered has none, as before) and then for the group to be empty, bounded by killFor plus a second. Every exit path goes through EndProbes: the GUI's OnShutdown, the CLI's return and signal handler, and update.Reexec. Windows: the job's TerminateJobObject takes no new process once it is ending, and a probe is killed alone with TerminateProcess, so there was no background loop to outlive; kill returns a closed channel there. The known Windows gap that a shim's children aren't in a job for probes is unchanged. Run: - TestEndProbesThenExitLeavesNothing (new) re-runs the test binary as a magpie whose group signals miss for 300ms, which calls EndProbes and os.Exit(0) at once. On the old code it fails 3/3 on darwin: "what the probe started (pid N) outlived magpie's exit after EndProbes". - darwin: go test -race ./internal/proc ok; -race -count=10 of the probe/EndProbes tests ok. - linux (docker golang:1.26.8 --init, GOTOOLCHAIN=local): -race -count=5 of the probe/tree tests ok. Without --init the container's PID 1 reaps nothing and every group test fails on zombies, on old code too. - Windows box: new TestEndProbesWindows (ping probe ended, EndProbes ~0ms) passes 3/3; the rest of the package passes except TestNoCommandBypassesProc, which walks ../.. and found other checkouts in C:\Users\yeton since the binary ran outside a tree. - gofmt -l, go vet (darwin), GOOS=linux vet -tags nogui, GOOS=windows vet. |
||
|
|
1f0ff81dfc |
agent: Grok App's own route picked in magpie is taken, and Disconnect can put one back; a sync that isn't connected writes nothing (#1625)
Follow-up to fjrtdk's commit before this one, which this keeps: magpie never names itself as Grok App's route. - Set refused every own route (errGrokAppRoute) while Options still offered them, so the picker showed choices that only errored. It also broke Disconnect: when unwire leaves no route (Use set it to magpie, nothing stashed), Disconnect sets connect.was's route back through Set, got the error and stopped half done. An own route now takes magpie's channel out and is written as [models] default, the way picking another provider leaves magpie on other agents. That route can't be magpie, so the App's sign-in is never touched. - Sync ran rememberRoute/releaseRoute before checking for the channel, so every user with Grok App installed but not connected got stash entries. Now it returns before them unless the channel is there or the route is still magpie (an older magpie's takeover to put back). - Check again warns when the route is magpie and the channel is gone, which that commit dropped. - The notice uses the App's own labels (Settings › Account, Use; ja 「使う」, de Einstellungen › Konto / Verwenden, from grok-app 0.2.40's settings.nav.account and prov.useThis) and says a chat can pick magpie's models in its model picker (composer_prefs_set, which doesn't move the route). - Sibling: rtk init has no grok agent for Grok Build either (rtk 311ebcb agents: claude codex copilot cursor droid gemini hermes opencode pi trae vibe antigravity), so Grok Build is in rtkNoHook too. Run: gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows clean; go test ./internal/gateway ./internal/agent ./internal/library -count=1 pass; node --test i18n-keys and agent-notice-lang pass. Broken by hand: that commit's grokapp.go fails TestGrokAppOwnRouteStays, TestGrokAppDisconnectPutsTheRouteBack and TestGrokAppSyncUnconnected; dropping the Check branch fails TestGrokAppSyncUnconnected; dropping rtkNoHook["grok"] fails TestRTKNoHookGrokBuild. Not tried: the Grok App GUI itself; the config format and behaviour are from grok-app 0.2.40's source. Co-authored-by: fjrtdk <fjrtdk@gmail.com> |
||
|
|
ea3d480edf | agent: Grok App keeps its own route; magpie is a custom provider under Accounts, and the Library writes instructions, MCP and skills on agent-home (#1625) | ||
|
|
8d2a1f7cfe |
docs: list Ante and AstrBot in both README agent lists, which missed them the way they missed StepCode (#1526)
Checked every Name: of an agent in internal/agent against the README list after the StepCode commit before it: Ante ( |
||
|
|
cb6242572d |
docs: list StepCode in both README agent lists
Add StepCode beside Pi and oh-my-pi in the English and Simplified Chinese supported-agent lists, matching the existing implementation and reference documentation from
|
||
|
|
1e080cc7e7 |
gateway: the saved Anthropic-to-Responses body carries the image's detail auto that the commit before it sends (#1474)
TestUpstreamBodiesUnchanged (
|
||
|
|
bbc7ee0a96 | gateway: an image Claude Code sends to a Responses provider carries detail auto, so a strict upstream (vLLM) no longer refuses it with 400 (#1474, zacharyxz) | ||
|
|
b3805203d8 |
gateway: drawing reads a relay's whole model list for which key serves an image model, and a key's 404 about the model asks the next key (#1657)
What: Provider.Serves now reads a new catalog.LiveAll (the fetched list
with image and video models kept) instead of live(), which drops Draws and
Films models. The draw key loop and the custom video path move on to the
next key when a key answers 404 whose body says the model isn't served
(keyLacksModel = 404 + modelRefused's wording); any other 404 still stops.
Why: wangru8080's analysis on #1657. A relay whose per-key lists name
gpt-image-2 under one key only still had drawing try a key that lacks it:
Serves read a list with the image model filtered out, so every key looked
unlisted, and that key's 404 "Model ... is not supported by any configured
account in this group" ended the loop instead of asking the next key.
Embeddings already move on any error short of the last key.
Run (sandbox HOME, private GOCACHE, worktree at origin/main
|
||
|
|
125dad5cbb |
gateway: a codex provider used only through routing groups keeps the ChatGPT account's own models out of Codex's list (#1602)
With Codex signed in to ChatGPT, Codex asks magpie's /backend-api/codex/models
for its list, and codexModels passes the backend's own models through,
narrowed only by the codex provider's picks (CodexNativePicked) and the
Agents page's hides (CodexNativeHidden, built from Catalog()). A provider
set to "Only through routing groups" (Provider.Unlisted) has none of its
models in Catalog(), so neither filter saw them: all of the account's
models stayed in Codex's picker, and the Agents page had no Codex group to
hide. Every other agent's list is Catalog-based and already left them out.
provider.CodexNativeUnlisted says which of the account's models are kept
out of agents' lists: every one when the codex provider is Unlisted, and by
slug those a group with Unlists names. codexModels drops them (hidden
entries such as codex-auto-review stay, as with picks; a Codex reached for
failover alone keeps them, as it is handed no groups), spawnChoices drops
the same ones from spawn_agent's list, and CodexListTag carries them so
Codex refetches. gateway-routing.md says so.
Test: TestCodexModelListUnlistedForGroups (a group unlisting gpt-5.5 takes
gpt-5.5 alone; the provider Unlisted takes gpt-6-sol and gpt-5.5 and keeps
codex-auto-review; ETag changes; spawn_agent offers neither; own-only keeps
them). With codex_backend.go and codex_spawn_models.go reverted it fails on
all three checks. Not tried with a real ChatGPT sign-in and Codex app.
Run (sandbox HOME, private GOCACHE, worktree at origin/main
|
||
|
|
dc2e1cc124 |
gateway: MiniMax's and Volcengine Ark's refusals of thinking turned off are asked again with it left to the model (#1141)
thinkingOffUnlessAsked turns thinking off on a Messages request for a
non-Claude model that doesn't mention it (Claude Desktop's model_validation
probe, its health probe, title generation). MiniMax-M3.1-Flash-Preview and
Ark's glm-5.3 / glm-5.3-flash refuse that with 400, in wordings neither
alwaysThinks, mandatoryReasoning nor thinkingOffRefused matched, so the 400
went back to the client and Desktop wouldn't switch to the model.
alwaysThinks now matches the reporters' literal messages, narrowly:
- MiniMax: `requires adaptive thinking; thinking.type="disabled" (including
reasoning.effort=none) is not allowed (2013)`
- Ark: "thinking.type `disabled` is not supported by this model"
Both retry sites use it: the relayed Messages path (withoutThinkingOff,
gateway.go) and the translated Chat/Responses path (thinkingBackOn).
Tests: TestAnthropicPassthroughMiniMaxArkThinkingOffRefused (each vendor's
body: omitted thinking succeeds after one retry without thinking; adaptive
goes once, as sent; another 400 of MiniMax's own 2013 and a near Ark
wording "top_k is not supported by this model" are not retried), and
TestTranslatedThinkingOffRefused now runs the GLM, MiniMax and Ark wordings.
With the regex change reverted both fail (400 handed back). The JSON
envelopes around the reporters' messages are assumed (Anthropic's error
shape); not tried against the live MiniMax or Ark endpoints.
Run (sandbox HOME, private GOCACHE, worktree at origin/main
|
||
|
|
0d39515b14 |
gui: Connect's Shell and curl snippets can be for Windows or macOS · Linux, whichever machine runs them (#1514)
FourLeafTec on #1514: at home on Windows, but mostly running things on a Linux server over ssh, and Connect only ever wrote the snippets for the machine magpie runs on (PowerShell + curl.exe on Windows, bash elsewhere). What changes - Beside the snippet language, the Shell and curl tabs get a two-way segmented control, Windows | macOS · Linux. It starts as the host's OS (also when Local network / Public address is picked: those say where the gateway is reached, not where the snippet is pasted), and the pick is kept in localStorage (magpie.snipOS), next to magpie.lang. The Shell tab is named PowerShell or Shell after it. Python and Node show no switch. - Quoting is now right for any key a user brings (ownSecret allows every ASCII symbol): POSIX values and headers go in '...' with ' as '\'' when they hold ' " $ ` \ !, the -d body escapes its own ', and a URL with brackets (a [1m] model id) is quoted and gets -g. PowerShell values go in '...' with ' doubled when they hold $ ` "; a header holding " goes to curl.exe after --% on one line, quoted as the C runtime reads it, since Windows PowerShell 5.1 split such a header in two (seen on the box). A %NAME% of a defined variable in such a key is still expanded there; noted in the code. - Translations for the control's label in zh, zh-TW, ja, de. What was run - New internal/gui/tests/connect-snippet-shell.test.cjs: Chromium and WebKit x en/zh/zh-TW/ja/de x 1100/390 px, 20/20 pass. It picks a LAN address on a Win32 page, checks the PowerShell form, switches to macOS · Linux (the control's position and the page's scroll unchanged), runs the export snippet in bash and zsh and the curl snippet against an echo server in the test (the key with ' " $ ! ` \ arrives whole, body parses), reloads (pick kept), switches back (--% form), Python shows no switch, a Mac page starts on macOS · Linux, and no horizontal overflow. With the old app.js it fails: "Expected values to be strictly equal" on the PowerShell env snippet ($env:OPENAI_API_KEY="k'ey"$HOME..." was unquoted), and there is no .snip-os control at all. - On the Windows box (Windows PowerShell 5.1.26100; no pwsh there or on the Mac): the snippets the GUI made for OpenAI, Anthropic and Gemini, each as $env: and curl.exe, with three keys (sk-magpie-key-abc123, k'ey"$HOME!`x\y, ab\"cd%PATH%\), run with powershell -File against a TcpListener echo server started and stopped by the script. Plain and symbol keys arrive whole in the header and $env:, with the body as POST; the third shows the %PATH% limit above. Before the --% form, the symbol key's header was cut at the " and the request went out as a GET. - Related GUI tests in both engines (click-scroll, connect-address-kept, gateway-*, phone-*, public-url*, omp-profile-connect, i18n-keys): all pass except mobile-web's "desktop matches origin/main" for the gateway view (415 px), the new control itself; screenshots looked at. - go test ./internal/gui/ in a sandbox HOME: ok. |
||
|
|
aa1b04c324 |
provider: moved Cursor users get plugin 0.2.9 and WorkBuddy users 0.1.18 (magpie-community/plugins#55, #18)
Cursor 0.2.9: a default model whose own branch stops short of the asked effort goes to its nearest effort, so the id and its parameters agree. WorkBuddy 0.1.18: WorkBuddy 5.6+ keeps its desktop sign-in encrypted; the plugin now says so and points to the browser sign-in, instead of "isn't signed in" and a 502. Both versions checked on registry.npmjs.org (dist-tags latest). Run: gofmt -l, go vet (darwin, linux -tags nogui, windows) and go test ./internal/provider -run 'Mov|Plugin|Migrat|Hand'. |
||
|
|
1eea68e0cd |
gui: Plugins' "Unofficial, on GitHub" has its kinds to pick and a field of its own to narrow it
The owner: 这里应该有分类以及搜索框方便用户筛选. The section lists every
repository tagged magpie-plugin, 31 on the dev instance today, as one
long grid, and the page's only search ("Search plugins and npm…") sits
at the top and also asks npm.
Once more than six repositories are tagged, the section's head has:
- its kinds as a segmented control (All · 31, Provider · 27,
Middleware · 3, Agent · 1): only kinds that have repositories, each
counting what the field leaves, and none when one kind is all there is;
- a field that narrows by name, author or description as it is typed,
with Escape to clear it;
- "No plugin on GitHub matches" with Show all when nothing is left.
Both narrow what the page's search has already found. Only the section
is drawn again as they change. The section, its field and the page's
body are made once and kept in the page, as the page's own field is
(#1055), so an answer that redraws the page while someone types (npm's)
keeps the field's focus and every key. Strings in zh, zh-TW, ja and de.
Run:
- plugin-github-filter.test.cjs (new), built on the dev instance's real
/api/plugins/github answer: chromium and webkit, en/zh/zh-TW/ja/de,
980px and 440px, 22/22. Putting back drawBody's replaceChildren turns
the field-keeps-its-focus check red.
- Every other plugin-* GUI test, plus i18n-keys and nav-sub-unroll, in
both engines: all green. plugin-github went 0/18 at first, because two
fields matched its `.pm-find input`; with the six-repository threshold
its four repositories show the plain grid, and it is 18/18.
- Looked at in dark WebKit at 1200px and light Chromium at 440px.
|
||
|
|
97dfed0f3e |
library: a site's well-known kit of skills is one group, by the lock's sourceBaseUrl (#1862)
WardLu (#1862): skills that `npx skills add` got from a site's /.well-known/agent-skills/ index were one group per skill. That was Feishu's lark-base, lark-doc and lark-sheets, and Fish Audio's fish-audio-api and fish-audio-sdk. readSkillLock grouped them by each skill's own sourceUrl (".../lark-base.tar.gz", ".../fish-audio-api/skill.md"). Now a lock entry with sourceType "well-known" is grouped by its sourceBaseUrl, read as host/path (wellKnownBase/siteOf): - the user, query and trailing slash are dropped, and the host is lower-cased without "www."; - so Feishu's three are open.feishu.cn/lark-cli/skills/regular and Fish Audio's two are docs.fish.audio; - a kit on the same host with a different base URL stays apart. Hosts are not merged. Fallbacks: - an older lock with no sourceBaseUrl takes the part of its sourceUrl before /.well-known/; - an entry with neither is grouped by its sourceUrl, as before. Two things this new key would otherwise get wrong: - Group again (RegroupSkills) tried every owner/repo-shaped key on GitHub. A kit one folder down a site (docs.example.com/kit) has that shape, so a key whose owner has a dot is skipped now. GitHub owners have no dot. - the heading's link sent a key with no path ("docs.fish.audio") to github.com. repoURL now opens it at https://docs.fish.audio. Run: - go test ./internal/library (all pass). New TestWellKnownKitGrouped uses the issue's base and source URLs for 3 Feishu + 2 Fish Audio skills, plus another kit on open.feishu.cn, an entry with no base, and a docs.example.com/kit kit that Group again must not fetch. - With the well-known branch disabled it fails, with the reporter's five one-skill groups. - With the dot check removed it fails on a GitHub fetch. - new TestWellKnownBase: a table of base and source forms. - skill-repo-groups.test.cjs now has a docs.fish.audio group that opens the site. It fails with origin/main's assets, which say "on GitHub". It and skill-regroup/skill-groups pass in chromium and webkit. - gofmt -l; go vet for darwin, linux -tags nogui and windows on internal/library. Not run: the reporter's real ~/.agents/.skill-lock.json. The issue quotes only these three fields of it. A row's own link still isn't its sourceUrl. |