OpenAI bills gpt-6-astra, gpt-6.1-sol and gpt-6-luna over 272K input at 2× input and cache and 1.5× output, for the whole request. A price now has tiers: `magpie model price <m> 10,50,1,12.5 --tier 272k 20,75,2,25` (--tier can repeat). A tier applies when input + cache reads + cache writes is over its size, so 272,000 is not over and 272,001 is. The built-in prices take tiers only where models.dev lists one (cost.tiers of type "context"), and it does list one for those three. The ledger, each request and OTLP are costed at the tier the call reached. Session and day totals sum many calls, so they stay at the base price.
Anthropic bills a cache write kept for an hour at 2× input and one kept for 5 minutes at 1.25×. Its usage reports which is which in cache_creation.ephemeral_5m/1h_input_tokens. The gateway (API and Claude subscription) and Claude Code's transcripts now keep that split. A price's fifth part is the 1-hour write. When it isn't given, it is 2× input: that is Anthropic's rule, and only Anthropic reports 1-hour writes. Claude list prices carry the 2× too. cache_write_tokens is still the total, and the usage CSV adds cache_write_5m_tokens and cache_write_1h_tokens at the end. The app shows the split on a request's Cache and on the usage tooltips. Old prices and old records, which have no 1-hour part, read as before. The sessions cache (18) and the call cache (calls-v8) are re-read once.
In the GUI, the price boxes were number inputs and dropped what they didn't parse ("0,25"). They are now decimal text boxes that take both "0.25" and "0,25". A model's price row has a 1-hour box (empty means 2× input) and a quiet Long-context price row. That row shows the list's tier greyed in, or sits behind a link when the list has none. A bad size is refused by name. en/zh/ja/de.
Tests:
- New: TestPriceTiers, TestCostSplit, TestPriceJSON, TestModelPriceTiers, TestModelPriceTierCmd, TestAnthropicCacheWriteSplit and TestClaudeCacheWriteSplit. The ledger CSV test expects the new columns.
- model-price-tiers.test.cjs is new; model-price-edit and provider-price-rate are updated. All of them fail against the old assets and pass in WebKit. Chromium couldn't be launched here.
- go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass.
Picker. In a group's Add a model picker, a model already in the group as a member with fixed reasoning (deepseek/deepseek-v4-pro:max) was not ticked. Clicking it added deepseek/deepseek-v4-pro a second time. The picker matched members by their exact id. A model is now matched by the member it is in the group as, itself or with an effort. That member is ticked, and a click takes it out, together with its fast/off/rules entries, as for any member. A member that a pattern put in still gets the warning. The note naming the other groups a model is in (since v0.1.989) is cut off by its ellipsis when there are several groups, so it now shows in full on hover (title).
Groups filter. With many routing groups one was hard to find. A filter now sits over the list, beside Select and New group, whenever there are two groups or more. It keeps the groups that match every word typed, against the name, the id, a member's id and its provider and model names, and a pattern. The keyboard stays in the box as the list is redrawn. Escape clears it, and when nothing matches the list says so. The group being edited stays listed whatever the filter. Select's "all" picks only the groups shown. A move (Alt+↑/↓ or the menu) goes past the card listed next to it. en/zh/ja/de.
Tested in a sandbox HOME with magpie web (this build, port 3511, no gateway): five groups over DeepSeek, Kimi and GLM. "kimi" kept Main, Long context reasoning heavy and Backup. In Main's picker, deepseek-v4-pro (in Main as :max) and kimi-k3 were ticked, and each note named the other groups, whole in its title.
group-pick-filter.test.cjs is new (WebKit and Chromium, en and zh). It covers the tick and the click out for a:two:max with no duplicate saved, the note's tooltip, the filter by model name, id, every word and name, none matching, Escape, the keyboard kept, no scroll, no select and no left border. It fails without the change. With only the picker matching put back, it fails on "a member with its effort is not ticked".
The group-*, routing-effort*, routing-manual, routing-save*, routing-steady, routing-compact, click-scroll, claude-picker-fold and agent-model-groups tests pass in WebKit (77). go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. internal/gateway failed once in the full run under load and passed alone.
`magpie provider set <id> header.anthropic-beta=…` replaced the betas each request carried: provider.Sign wrote the user's headers over what the gateway had set, so Claude Code's own betas (claude-code-…, interleaved thinking, 1M context's context-1m-2025-08-07 for a [1m] model) and fast mode's were dropped, and a name typed in another case went out as a second anthropic-beta line beside the gateway's. anthropic-beta is now a list header (provider.ListHeader): Sign merges the user's value into the request's (provider.MergeList: the request's items first, then the user's, each once, empty ones left out, one line under the name as typed). Every other header of the user's still replaces magpie's, as before. The gateway then fits the merged list as it fits the agent's (fitUserBetas, after Sign): a beta the provider has refused (400 Unexpected value(s) `x` for the `anthropic-beta` header) is left out from the retry and from then on, the user's own as well as the agent's; one it takes is always sent. magpie adds no 1M beta of its own: Claude Code 2.1.289 itself sends context-1m-2025-08-07 for a [1m] model to any base URL (its long_context beta is asked when the model matches /\[1m\]/ and is among those kept for third-party endpoints), magpie writes 1M models into Claude Code marked [1m], and the gateway passes it on. Per-endpoint header sets were left out: one set of headers rides on every request to a key+URL provider. docs/reference.md says how header.* works and that anthropic-beta adds. TestSignMergesListHeaders (internal/provider: merged in order, deduped, the request's line not kept beside it, another header still replaced) and TestUserBetasMergeWithTheAgents (internal/gateway: a relay that refuses one of the agent's betas and one of the user's gets the agent's then the user's, both refused ones dropped on the retry and not sent again) are new and fail without the change; TestUserBetasAlone (the user's betas sent on a request with none) passes either way. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (internal/provider failed once under load in the first full run and passed in the second).
361 imported hundreds of keys into one provider, and its Accounts list drew a row for each (sk-o…d3a2, Make first, Remove), filling the screen. A list of more than 8 keys now shows the first five and "All {n} keys" ("{n} in use · {m} failing"). Opened, it shows a filter over the name, the masked key and the state ("off", "resting", the reason: rate limited, sign-in required…), at most 50 rows with "{n} more — type to narrow them down", and Show fewer; Escape clears the filter, then closes. Above the rows, keys can be removed at once: those turned off, those failing for good (the gateway rests them for a refused sign-in or no credit), or, with something typed, those the filter matches. The first click asks ("Remove {n} keys? Click again"); the second posts keys/remove-many (provider.RemoveKeys: one save; the first key's place goes to the next key that is on and stays; removing every key in use is refused). Dragging or Alt+↑/↓ on a shown row sends every key's place, the folded ones where they were: provider/arrange needs the full order. Several keys pasted into a provider's API key field (one a line, or comma/space separated, de-duplicated, empties dropped) are kept comma separated and counted ("3 keys"). On save the first is the key and the others are added to its accounts (AddKeys; keys it has already are passed over), and a probe asks with the first. Paste several in Add another key (0b11514c) already did this on an existing provider. Round-robin was already there: with more than one key on, the editor's Routing has Rotate (轮流) beside Smart, Order, Least used, Pace and Weight. en/zh/ja/de.
TestRemoveKeys (internal/provider) and TestProviderSaveSplitsKeysAndRemovesMany (internal/gui: a new provider saved with "sk-a, sk-b, sk-c, sk-b", saved again with one new key, one key alone, keys/remove-many) are new and fail without the change. provider-many-keys.test.cjs, also new, uses 300 keys in Chromium and WebKit, en and zh. It checks that five rows are drawn folded and 50 opened, the filter by masked end and by name keeps the focus, the armed second click posts the three refused keys, Alt+↑ sends all 300 in order, and the API key field counts a pasted list. It also checks that nothing scrolls, there is no <select> and no left border. It fails on the unchanged assets. key-import, account-arrange, key-weight, key-weight-fit, account-models, account-cap, account-mask, nokey-editor and factory-key pass in WebKit; click-scroll passes alone (it failed once under parallel load). go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (TestClientGoneRecordedAsCanceled and TestUserPath failed under load and pass alone).
Saving a routing group took about 2.4s on a machine with 20 providers and
95 models. The save is not slow: the state it answers with is. groupsState
asks every group for its members and every model for its facts, and the
held middleware let only GET share one build of the catalog
(provider.Hold), so each of those look-ups built it again — 20 builds in
one save here, each reading every provider's files and every agent's
sign-in.
The Routing page's own 25s trace long-poll is a GET, so it usually holds
the catalog and the save costs ~140ms. Whenever it is not in flight — the
first save after the page loads, or between two polls — the save falls
back to the full 2.4s.
A write shares the build now. It is safe because every write drops what is
held as it happens: provider.store ends in catalog.Touched, and
catalog.Forget is Changed (provider/hold.go), while settings.Save calls
catalog.Forget itself. So a save still answers with the state after the
write, never the one before it, and the request leaves nothing held for
the next. Reads are unchanged.
TestSaveSharesOneCatalogBuild counts the builds one save makes
(provider.AllBuilt: 20 before, 2 after) and checks the answer is the state
just written — the group saved, renamed, deleted. TestAgentWriteAnsweredAs
Written covers the one path a write does not drop the catalog on,
agent.Apply (it writes an agent's config and never calls
catalog.Touched): the field it wrote is in the answer that POST returns.
POST /api/groups/save, the same group of 6 members (5 of them groups),
same config, same machine: 2452, 2659, 2388, 2333, 2308ms before
(median 2388ms), 1650, 138, 127, 124, 137ms after (median 137ms; the first
is the cold start). go vet, go build and go build -tags nogui pass.
TestGatewayFixQuitsOnlyAMagpie and TestPurposeAssetMatchesUsage fail on
unmodified main here too (a running magpie on the port, a stale generated
catalog), so they are not this change's.
Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com>
* backup: pin the #880 subscription sign-in policy with a test
A backup must not carry a subscription's sign-in: it is the sign-in of an
agent on one machine, so a bundle that carried one would sign the agent in
on the machine it was put on. #880 asked for that and was closed as
intentional. Nothing pinned it, so this adds the test that does.
Both stores, both credential policies, and the asymmetry the report tripped
over together: a subscription moved onto its plugin still has a row in
providers.json, and the row travels so the receiving machine offers the
subscription at all — the credential behind it does not. A user-typed key
is the control, so the policy cannot be read as "nothing credential-shaped
syncs", and Restore is checked for leaving this machine's sign-ins alone.
scopedKeys has no case for "providers" and falls through to the whole-
bundle bit. That fall-through is deliberately not pinned: scopedKeys is
called once, with "settings", so there is nothing observable to assert,
and a test that did would go red for a good reason the day the case is
added. The tests around it pass either way; the reason is written down.
Co-authored-by: multica-agent <github@multica.ai>
* backup: say what the #880 sign-in tests actually guarantee
Review of 974ca819 found no blocking problem but two comments that
pinned more than they could back up.
carried() claimed that a credential absent from a bundle's marshalled
bytes cannot be inside a sealed backup either. That is false, and it was
measured rather than argued: Seal marshals the whole Bundle in one
json.Marshal, but a []byte field is base64 in those bytes, and a Collect
that copies plugin-auth.json into b.Icons["auth-state.bin"] seals the
whole plugin store while every one of these tests stays green. The probe
is still the right one for what the policy is about, which is a
credential arriving as plain text, so the comment now says that and
records the two limits that keep it honest: a literal check misses JSON
escaping, and a Seal that grew a wire type of its own would decouple
carried() from the bytes it claims to describe.
TestRestoreLeavesLocalSignInsAlone compared the two sign-in stores byte
for byte. Byte equality is file identity, not policy, and re-indenting
logins.json — same accounts, same credentials, same counts — turned it
red. It now compares the sign-ins: who is signed in, and the credential
behind each, canonicalised, in a fixed order. An incidental reformat
cannot fail it, and a restore that really did take the sign-ins over
still does, which a probe that overwrote both stores confirms.
Also notes that TestCollectCarriesTheRowOfAMovedSubscription does not
compare Headers, and where that coverage does live.
Co-authored-by: multica-agent <github@multica.ai>
* backup: apply the #901 maintainer's four review changes
Drops the two line-number references in favour of the function names
Seal and scopedKeys("settings"), which do not go stale when the file
moves: Seal does the single json.Marshal of the Bundle (backup.go:252)
and the scopedKeys("settings") call is inside Restore (backup.go:401),
so both attributions check out.
Renames the four plugin fixtures that named a vendor they never used.
fixtureGrok* are written under movedProviderID ("opencode-zen") and
fixtureGeminiKey under "opencode-copilot"; both are OpenCode plugin
providers, so the names now say plugin. The built-in codex and claude
fixtures are left alone — those agents really do own those logins.
Removes TestScopedKeysFallsBackToTheWholeBundleBit and
TestScopedKeysPrefersAPartsOwnMarker with setScopedMarker. They are
about part-scoped key markers, not about the sign-in policy this file
states, and the file header no longer leans on them.
Closes the Icons blind spot instead of documenting it away. carried()
only ever saw plain text, and Bundle.Icons is map[string][]byte, so a
Collect copying plugin-auth.json into b.Icons["auth-state.bin"] put
the whole plugin store in a sealed backup with every assertion green.
whereSignInIs searches the decoded value of every Icons entry as well
as the marshalled bytes, and names the layer in the failure. Both the
keyless and keyed subtests now go red under that mutation, where they
previously passed.
Test-only: one file, no production code.
---------
Co-authored-by: multica-agent <github@multica.ai>
GLM-5.3-Flash on a local vLLM, used from Codex Desktop through magpie's Responses endpoint, wrote its calls into its text as GLM's template does: <tool_call>exec<arg_key>input</arg_key><arg_value>…</arg_value></tool_call>. magpie held text from <tool_call> on but read only Hermes' JSON after it, so the block went to Codex as text and the turn ended. parseTextCalls now reads GLM's form when what follows <tool_call> is not JSON: the tool's name, then each <arg_key>/<arg_value> pair, a value that is JSON (number, object, list, boolean) taken as JSON, else the string it says. As before, every block must name a tool the request offered, else the whole reply stays the text it was. It works wherever the text is read for calls: Chat's relay, the translated Chat, Responses and Anthropic paths, streamed and whole, and a plugin's model; a Responses custom tool (Codex's exec) becomes a custom_tool_call carrying the input.
Tested end to end in a sandbox HOME: a fake vLLM streaming GLM's markup split mid-tag, added as a provider, magpie serve on a spare port, and a Responses client offering exec as a custom tool and update_plan: streamed and whole, the reply came back as the text before the block and a custom_tool_call exec whose input is the code. TestGLMTextCallCustomTool (stream split mid-tag, streamed and whole), TestGLMTextCallFunctionTool (JSON values kept, two calls), TestGLMTextCallChatAndMessages and TestPluginGLMTextCall are new and fail without the change; TestGLMTextCallUnofferedLeftAsText (an unoffered tool stays text) passes with and without it. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (TestClientGoneRecordedAsCanceled fails now and then on main without this change too).
In WSL, with only magpie tui and Cursor's subscription, Claude Code said ECONNREFUSED. The terminal set agents to the gateway but never served it, and nothing listened at 127.0.0.1:3425 unless the app, magpie web or magpie serve ran.
magpie tui now serves the gateway in its own process while it is open, as the app does, whenever no magpie answers at its address. One that does (the app, magpie web, magpie serve) keeps it. The terminal looks every 15s and takes the gateway up once that one is gone.
The status line says "● gateway <url> · served while magpie tui is open" when it has nothing else to say, or "✗ gateway not running: <why>" when the port couldn't be had. On quitting after serving, it says the gateway stopped with it and what serves it otherwise. The usage text and docs/reference.md say so too.
Tested in a sandbox HOME on port 3486 with a real DeepSeek key: magpie tui alone answered /v1/models; Claude Code (sandbox HOME) set to deepseek/deepseek-flash ran a Bash tool turn through it; the status line showed the gateway; q printed the note and freed the port.
TestTUIServesTheGatewayWhenNoneDoes (serves, status, lets go at quit) and TestTUILeavesTheGatewayToAnotherAndTakesItUp (leaves another magpie's gateway alone, takes it up once it is gone) are new and pass 3x under -race; they don't build without the change.
go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass.
The Claude subscription often showed as signed out over the last few days. Claude's refresh tokens are single-use. Once one is refreshed, every other copy holding the old one is dead: the next refresh with it fails with invalid_grant, and Claude Code then empties its sign-in. Two places kept an old copy.
1. A switch saved the outgoing account from magpie's credential cache, which can be up to 10s old. If Claude Code refreshed in that window, the saved login held the spent refresh token. Switching back then signed the account out. The switch now forgets the cache and reads the credential fresh.
2. The gateway keeps idle Claude Code runs in an account's own folder (CLAUDE_CONFIG_DIR) for up to an hour, each holding that account's token in memory. Once the account is handed to Claude Code's own home, both sides refresh the same token, and the loser is signed out. A switch now tells the gateway (provider.ClaudeHandedOver), which ends that account's idle runs. Runs in a home of their own are left alone.
TestClaudeSwitchSavesTheFreshCredential (the refreshed token is saved, and the gateway is told) fails without the change. TestClaudeHandOverLetsGoOfTheAccountsRuns (only the account's idle runs in its folder are closed, matched case-insensitively; -race) does not build without it.
go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. TestClaudeRunEndsWhenTheClientLeaves failed once under load, then passed 5/5 alone and with the whole package.
Running() answers whether a process whose command line matches a pattern is
alive, by asking pgrep -f. Windows has no pgrep, so it answered no for every
pattern — and every one of its 25 call sites is the advice an agent's own
lists need after magpie changed what that agent reads at start ("Codex builds
its model list at start-up — restart the Codex app", "New dsh sessions start
on this; one already open keeps its model until you pick another in it"), each
inside a Notice closure, so nothing else rides on the answer. On Windows that
advice was never given: the Agents page wrote the file, said nothing, and a
model picked in magpie looked like it had done nothing at all until the agent
was restarted by hand.
claudeRunning and Pencil's own check already answer yes where a machine can't
be asked (#353, and Pencil's detect), which is why only the other 23 call
sites were silenced; Running now says the same for the same reason, so the one
path every agent's Notice goes through stops disagreeing with the two that
worked around it. No pattern is no question, and still answers no: nothing
asks it, but a caller that passed none isn't told a process is there.
Asked the machine for real would mean a second pattern set: the pgrep-style
patterns don't describe Windows at all — `(^|/)codex( |$)` does not match
C:\…\OpenAI\Codex\bin\…\codex.exe, and `(^|/)dsh( |$)` does not match
"C:\…\DeepSeek Harness.exe" "…\dsh\…". Cost was not the reason either way:
Notice runs only after a pick or a connect/disconnect (gui/api.go:688, :857;
main.go:410, :440), never from GET /api/state and never per render.
Windows only: the pgrep branch is untouched, so the answer elsewhere is what
it was. Nothing else changes — every other caller (connectinfo.go's Stale,
which sizes how many copies are out of date) uses the lowercase running var
and its own GOOS check, not this.
TestDshRunningOnWindows and TestDshAndCodexAdviceOnWindows fail without the
change (the first: "a pattern that may match was answered no"; the second:
"dsh says nothing about an open session") and pass with it, run under the
Windows job's own selector: that job compiles the whole suite but executes
only `go test ./internal/agent -run '^Test(Dsh|KeepDsh)'`, so both are named
TestDsh… to be among the tests a real Windows actually runs, rather than
skipping on Linux and macOS and never being selected on Windows. go vet
./internal/agent passes and go build passes for linux, windows and darwin
(darwin with -tags nogui). go test -tags nogui ./... has the same failures it
has on 1534382 untouched: the seven TestAside* and
TestCodexStaleOnlyForMagpiesChange and TestSuffixModesReachAgentFiles in
internal/agent, the skills tests in internal/library ("A required privilege
is not held by the client" — symlinks need Developer Mode),
TestPurposeAssetMatchesUsage (the generated catalog is stale) and
TestGatewayFixQuitsOnlyAMagpie in internal/gui,
TestSweepBridgeProjectsTakesOnlyTheBridgesFolders in internal/gateway,
TestBunThroughBridge in internal/netproxy, and the internal/plugin and
internal/provider timeouts — each reproduced on 1534382.
Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com>
* gui: a group's members say what each can do, images included
A routing group's editor said of a member its name, its provider and the
reasoning it is sent at, and nothing of whether it sees images — a group
mixing members that see with ones that don't gave no way to tell one from
another, and which member a picture would reach was found out by sending one.
Each member now carries the same chips the Gateway page's model list sums a
model up in (modelInfo): its reasoning levels, whether it sees images and the
window it holds. The group's own models API carries Images and ImageSet for
them (internal/gui/groups.go), and the chips' look is shared with the Gateway
list's.
A member whose list says nothing of images is said to be unknown, not "text
only": magpie counts it text-only for a describer (gateway.blindTo), which is
not its list saying it takes none. For the same reason the group's own line —
"Accepts images (every model in it does)" — said something a group no longer
is: since #756 one member that sees is enough, so it reads "one of its models
does" now, in English, Chinese, Japanese and German.
group-member-info.test.cjs (new) checks three members — one that sees, one its
list says takes none, one nothing was read of — for their chips, their
tooltip's words in both languages, and that the row still switches off and
removes. Routing view regressions pass as on the baseline.
Validation:
- node --test --test-concurrency=1 internal/gui/tests/group-member-info.test.cjs
- group-arrange, routing-manual, group-member-off, group-context, group-fold,
group-patterns, group-bulk-remove, group-member-fast, group-found-off,
agent-model-groups, member-model-setting, group-from-model-add, click-scroll:
32 pass, 2 fail — both the 600x420 group-from-model-add cases, which fail
identically on the unmodified 9e77092.
# Conflicts:
# internal/gui/assets/routing.js
* gui: test that a group's models carry what they take
The chips the Routing editor draws a member with read the served catalog
entry: whether agents are told it takes images, whether anything said so
either way, its reasoning levels and the window it holds. The first is the
same expression the gateway decides by when it describes an image for a
model that can't see one (blindTo reads Entry.Images), so the editor cannot
say a member sees images that the gateway would describe them for. A model
whose list says nothing is carried as unknown, not as text only.
Covers: one that sees, one its list says takes none, one nothing was read
of, and one the user answered for themselves (settings.ModelImages).
* gui: carry a member's unknown images as a flag, not an absent key
Review of the chips: `imageSet` was omitempty on both structs, so a model
magpie knows nothing about went out without the key, not with `false` —
`m.imageSet === false` never held, and such a model still read "Text only",
which is what the chips set out to avoid. The browser test passed only
because its fixture wrote `imageSet: false`, which groupsState() never
produces.
`imagesUnknown` is the flag now, sent only when true: a model magpie has an
answer for carries no such key at all, and the page reads `=== true`. The
name is apart from the Gateway page's `imageSet` on purpose — there it means
the user answered for the model themselves (provider.ImageOverride), and
modelInfo is shared by both pages.
The fixture now writes what groupsState() emits: `images` and
`imagesUnknown` left out where they are false. A Go test holds the wire
shape (`TestGroupModelImagesOnTheWire`), and with the fixture as it now is
the browser test fails 2/2 on the old check ("a member nothing was read of
says unknown, not text only: Reasoning levels: none known").
Validation: go vet ./... and go build ./... pass; go test ./internal/gui/
fails only TestSetPortMovesTheGateway and TestPurposeAssetMatchesUsage,
which fail identically on the unmodified 9e77092; the routing and group
browser regressions are 34 pass, 2 fail — both the 600x420
group-from-model-add cases, which fail identically on the baseline.
---------
Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com>
group-from-model-add.test.cjs failed 2/2 at 600x420 on both engines, and had
for a while: it asked that every label sit beside its field, but under 760px
the editor is one column on purpose (routing.css), so the label is above its
field there. It now asks for that where the editor is one column, and keeps
asking for beside where it is two.
The other half was the click: the error Add answers with comes in at the foot
of the page, and in the one column editor it covers Add until the view is
scrolled to its end. The test wheels down until the button is under the
pointer, which is not yet the end of the page, and then clicked the place it
had found before the error arrived. It now scrolls to the end of the page
first, and finds the button again before each press.
Both engines, both languages, both viewports: 8/8 pass (was 6/8), and the
routing and group regressions are 34/34 on each engine (were 41 pass / 2 fail
on Chromium and 40 pass / 3 fail on WebKit).
Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com>
With Dock on "Hide", magpie runs as an Accessory app. A full-screen
window's title bar comes down only with the menu bar, and an Accessory app
has none, so the full-screen main window had no close, minimize or
full-screen button, and only Esc left full screen.
magpie now joins the Dock as a window starts entering full screen, from a
native NSWindowWillEnterFullScreenNotification observer: Wails hands that
event to Go later, and switching once the window is full screen doesn't
bring the title bar back. dock counts a full-screen main window (inDock),
so reopening the app or changing the Dock setting during full screen keeps
magpie in the Dock, and WindowDidExitFullScreen applies the setting again.
TestFullscreenKeepsDock checks inDock; it doesn't compile on main. On
macOS 27.0.1 with Dock on "Hide", main stays out of the Dock in full screen
with no title bar; this branch joins the Dock with the title bar and its
buttons, and leaves it after the green button, View > Toggle Full Screen
or Esc.
Fixes#763
* gateway: a Chat upstream gets a mended tool exchange — Kimi turns a broken one away 400 ("tool_call_id is not found"): a turn's tool results all go ahead of its own text, in the calls' order; a result whose call is gone gets a synthetic call (unknown_tool) so it survives; an unanswered call gets a synthetic error result; a thinking-only assistant turn, which an aborted stream leaves behind, is dropped
* gateway: a translated reply whose stream the upstream cuts off mid-way goes on instead of failing — the same conversation is asked again with what the client already has of the reply sent back as its last message, for the model to go on from (vk-relay dropping Kimi K3 and DeepSeek streams mid-reply: "API Error: Server error mid-response"). The reply so far goes back with its reasoning for models that read reasoning_content back (Kimi, DeepSeek), a full echo of it is dropped, and the continuation's fresh thinking isn't shown again; the client waits with keepalives between tries, up to two. A reply a tool call of has begun can't be prefilled, and a refusal isn't asked again: both end with the error in the stream, as they used to. A stream's own error event mid-reply ends its read at once rather than waiting on a vendor that keeps the connection open. TestStreamCutMidReplyContinues (reply goes on, one message), TestStreamCutContinuationEchoDropped, TestStreamCutAfterToolCallEndsAsBefore, TestStreamCutContinuesOnlySoLong, TestStreamCutMidThinkingContinues(WithoutReasoning), TestStreamErrorMidReplyContinuesAtOnce and TestContinuationUnecho cover it; TestStreamErrorKeptOpenFailsOverAtOnce and the severed-stream tests pass unchanged. go vet ./internal/gateway, go build (darwin, GOOS=linux, GOOS=windows), go test of gateway, provider, catalog and imagemcp pass.
* gateway: a Chat upstream's mended tool exchange — an orphaned or late result reaches the model as a user message, the Responses path's policy, so no call is made up and no id is used twice; an empty assistant is dropped only inside a pending exchange, where it would break adjacency, and passes through outside one; a second answer to a call is dropped, the first stands; the session replay harness gives way to fixed fixtures
* gateway: a cut reply is asked to go on only where the upstream goes on from a prefill — a trailing assistant message isn't one on most Chat APIs: the model answers it again from the start, reworded, and the client, an exact echo alone dropped, kept its part and the re-answer spliced as one reply with no error to tell (api.deepseek.com did so 5 times in 6). It goes on only where the prefill is real: an Anthropic Messages upstream natively (a model that turns one away answers 400 and the reply ends as it used to; the newest Claude among them), a Chat one in its vendor's own mode — DeepSeek's prefix, asked of its /beta endpoint with "prefix": true on the message, Kimi's "partial": true — a relay on this machine or the LAN serving one of their models taken to front the vendor, as geminiCompat takes one to front Gemini; everywhere else the reply ends with the error, as it used to, for the agent to try the turn again. reasoning_content goes back with the prefill by the same decision (reasoningBack named any kimi model on any host); the prefill's trailing whitespace, which Anthropic turns the request away for, is trimmed, the client having it already; and the tries' usages are summed into the reply's, the client's and the ledger's, where only the last try's was kept while the vendor billed each (a cut try's is only what it said before the cut). New tests: a re-answering upstream is never asked to go on (the client reads the error, not the garble), DeepSeek's /beta prefix mode and Kimi's partial on the wire, an Anthropic upstream's native prefill (text, thinking-only, whitespace trimmed, a refused prefill ending as it used to), the tries' usages summed, chatPrefill and prefillHow themselves. go vet, builds (darwin, nogui) and go test -count=1 -race ./internal/gateway pass (2146; gui's TestSetPortMovesTheGateway fails on main too).
* tests: three environment- and drift-broken suites pass again — port: a moved gateway finishes the connections it has (Relisten's handover), so answers() pooled a keep-alive one from its start-up polls and the old port answered from it forever; it now dials with keep-alive off, asking what the test means to: does the old port take NEW connections. plugin: TestBunIsGivenTheSystemsRoots read the shell's ambient NODE_EXTRA_CA_CERTS as the user's own (it wins by design); the test sets its own. accounts: forgetting the account in use puts the one left first since 30d952cf, which updated the provider and GUI tests but not accounts_plugin_cli_test.go; it now expects that. All three failed on upstream/main on a machine with a proxy CA configured; the full nogui suite passes.
* fix(agent): give magpie's provider table the actor-authorization header
Codex offers its built-in image tool (image_gen.imagegen) — and the other
OpenAI-provider tools — only to a provider it reads as the OpenAI actor:
ModelProviderInfo::uses_openai_actor_authorization(), i.e. a provider that
does not require OpenAI auth but carries x-openai-actor-authorization.
magpie writes [model_providers.magpie] but carried neither signal, so a
Codex on magpie was never given the tool and could not draw through a
Codex backend such as sub2api's.
Write http_headers = { "x-openai-actor-authorization" = "magpie" } into
that table. magpie does not forward the header upstream: codexHeader
rejects anything naming "authorization".
Test: TestCodexMagpieProviderCarriesActorAuthorization.
* gateway/provider: let a Responses-only relay (Codex backend, sub2api) draw
A provider added as 'OpenAI Responses' only (what a Codex backend such as
sub2api speaks) has no chat base, so Drawers() returned nil before ever
looking at the vendor's list, draw() refused with 'can't draw', and
drawImages() posted to an empty base. The vendor's own /v1/models does list
its image models (sub2api serves gpt-image-2.5), and they are meant to be
picked in Settings → Images.
- Drawers: a Responses-only provider draws when it has any OpenAI-shaped
base, not only a chat one.
- draw: refuse only when neither Chat nor Responses is set.
- drawImages: fall back to the Responses base when there is no chat base.
- List: the add form's 'Fetch models' keeps the vendor's image models so
one can be picked while the provider is added.
Tests: TestResponsesOnlyProviderDraws, TestListOffersImageModels.
* fix: route Codex native images through its turn provider
---------
Co-authored-by: yetone <yetoneful@gmail.com>