Commit Graph
3181 Commits
Author SHA1 Message Date
yetone 20c086d1f6 provider: a ClinePass API key's card shows its 5-hour, weekly and monthly limits and its credits (zRain on Discord) — a ClinePass added with a key had no usage card: we took GET /users/me/plan/usage-limits for a signed-in account's alone. AxonHub (looplj/axonhub, its Cline channel; verified there against a live account) reads it, /users/me and /users/{id}/balance with the channel's key as a Bearer, so magpie now does the same for a Cline key with no Balance URL of its own: windows 5 hours, Weekly and Month as the Cline plugin names them, percentUsed and resetsAt, and the balance in dollars (millionths). An account without ClinePass (usage-limits 404) shows its credits alone; a key Cline refuses says so on its card. Not tried with a real Cline key. TestClineKeyUsage fails without the change; go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. 2026-10-05 17:02:19 +08:00
yetone 1d92f52595 gui: Privacy's Mask personal data hides the accounts on screen too, and Privacy has the Hide accounts switch (inaction on Discord) — on another computer with privacy on, Usage still showed the email address, until Usage's own Hide accounts was found and turned on: it is kept on each computer, apart from the settings. Until Hide accounts is chosen on a computer it now follows Mask personal data; turning Mask personal data on turns it on as well (off leaves it as it is); and Settings › Privacy has a Hide accounts row bound to the same switch. A choice made with the button or the row is kept over the setting, so an address shown on purpose stays shown. privacy-hides-accounts.test.cjs (WebKit, en and zh) fails without the change; account-mask.test.cjs passes. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. 2026-10-05 17:01:41 +08:00
yetone 1d7eac3125 gui: every installed magpie on a config is one at a time, so a Mac restart can't put two birds in the menu bar (inaction on Discord) — the lock that keeps a second magpie from running (v0.1.879) was keyed by the config dir and the resolved executable, so two copies of the app each took their own: Open at login starting the copy it was turned on for while the Mac reopened the one last run (another magpie.app, or one run translocated from Downloads, whose path changes each launch), or Homebrew's, whose path has its version in it. Every magpie.app and Homebrew copy now shares the lock; a bare binary elsewhere (the owner's magpie-dev) still has its own. A second launch for the window opens the app by its bundle id (com.yetone.magpie) rather than its own path, so it reaches the running copy. TestOneMagpieAtATime fails without the change (the translocated and Homebrew copies had locks of their own). go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (TestProvidersAnswerWhileListsComeIn and TestUserPath timed out under load and pass alone). 2026-10-05 16:59:33 +08:00
yetone 46f03154ff gateway: a gateway key can be held to some models (#882, LCorleone) — a key could reach every model magpie serves. A key now keeps an optional list of models (caller-keys.json "models", none = every model, so older files read as before): <provider>/<model> or <provider>/*, matched against the provider that serves the call, so a bare model name is resolved first and OpenRouter's "anthropic/x" is not Anthropic's. Such a key sees only its models in /v1/models, /v1/models/{id} and the Anthropic (Claude Desktop) and Gemini lists, a routing group only when every member is its; asking for another, by id, bare name or through a group with a member it may not use, is refused before any provider is asked with a 403 in the API's own error shape (permission_error) that names the key and its models, logged as a rejected call like an over-limit key's 429; a fallback it may not use is skipped; embeddings, images and videos it names are held too. magpie's own calls for it (a web search, a picture described, Codex titles with the model Settings name) are marked in their context, not by a User-Agent a client could send, and go on. Set it with the new badge on the key's row in the Gateway page (the app's menu: All models, every model of a provider, each model; sent when the menu closes) or magpie gateway-key models <id> openai/gpt-5 anthropic/* (all takes it off); gateway-key list has a MODELS column. The app's menu, fitting neither below nor above its button, now goes on the roomier side and scrolls instead of running off the window. en/zh/ja/de. TestGatewayKeyModelsHoldAKey (lists, 403s by id, bare name and group, Anthropic shape, fallback skipped, magpie's own call, a free key) fails without the change; TestModelPatterns, TestKeyModelsKept, TestGatewayKeyModelsCLI, TestCallerKeyModelsRoutes pass; gateway-key-models.test.cjs (Chromium and WebKit, en and zh: no native select, menu inside a 420px window, picks sent on close, All models, no scroll, no left border, 560px fits) passes with gateway-connect-keys, gateway-key-limit, gateway-caller-keys and click-scroll. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. 2026-10-05 16:52:23 +08:00
yetone 4dab45e3ff gui, provider, gateway: a group's models are dragged into order, a group can be switched off, several models are added at once, and a page shows a scrollbar on the Mac (PAMI on Discord) — in a group's editor a model went up one step a click and only up; its number is now a handle (grip on hover) that drags it, Alt+↑/↓ moves it from the keyboard, and Up and Down stay beside it; a pattern's members follow the named ones. A group of the user's has a switch on its card: off, agents aren't offered it, a request to it is turned away with 404 "the routing group … is switched off", a group that has it in it goes on to its next member, a save from the editor leaves it off, and one that classifies for another can't be switched off (a found group is removed instead, as before). Each member already had its own switch. The editor's Add a model picker stays open: each model clicked is added and ticked, clicked again taken out, and each says the other groups it is in. Pages, dialogs and framed editors had their scrollbar hidden everywhere (width 0); on the Mac they now have a thin 8px thumb, elsewhere the 10px one other lists have. TestSwitchGroup, TestSwitchedOffGroup, group-member-drag, group-switch-add-many and view-scrollbar (WebKit, en and zh) fail without the change. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (TestProvidersAnswerWhileListsComeIn is flaky on origin/main as well). 2026-10-05 16:46:59 +08:00
yetone 1cf07610c2 gateway: a Remote magpie searches the web for its own models, and Settings may name it to search with (Player on Discord) — Claude Code's WebSearch on remoteMagpie/glm-5.3 was judged unsearchable here (its host is no search vendor's) and went to this magpie's searcher, another model, and Settings' Searcher never listed the remote's models. Its list now tells another magpie, of each model, how it searches (web_search: native, by the vendor, or magpie, with its own searcher); a web search offered to such a model goes on to it as offered (Chat's as web_search_options), and the remote magpie, with the models it searches natively for, is a searcher. A search run for another model is marked (X-Magpie-Searching) and the other magpie then lets only the model search, so two magpies naming each other never ask each other in turn. TestRemoteMagpieSearches fails without the change; go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (4 load-timeouts in agent/gui/provider pass alone). 2026-10-05 16:41:41 +08:00
yetone 8b7c4efbf8 gui: an average first token reads whole milliseconds under a second and one decimal above (John on Discord) — the Usage speed trend's tooltip read "258 token/秒 · 首字 761.9796610169492 毫秒": an average (ttft_ms over the replies timed) was shown unrounded. ledTook now rounds before it formats, so 762 ms, 1.2 s; the trend's tooltip, the ranking and the KPI all go through it. Speeds were already rounded. usage-ttft-rounding.test.cjs (WebKit, en and zh) fails without the change. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. 2026-10-05 16:33:42 +08:00
TryWorld f1f516cd73 fix(gateway): an account Antigravity turned away doesn't rest (#873)
* fix(gateway): an account Antigravity turned away doesn't rest

A 429 that is Antigravity refusing Claude Code's or its Agent SDK's
system instruction — "Resource has been exhausted (e.g. check quota)"
whatever quota the account has left (#666) — carries the word "quota",
so it was classified failQuota: the account rested 15 minutes and had
its usage asked of Google again, while it answers titles, background
requests and Codex normally.

Carry the fact the error path already works out from —
antigravityTurnsAway(request.System) and the CodeAssist agent, what the
8c652a83 hint is computed from — into the routing decision, the way
sharedPool and refused already carry an upstream routing fact through
error translation. The held attempt is marked on either failure path,
not only on a 429: the refusal also arrives as an in-stream error event,
which skips the 4xx branch and returns 200 while still failing the
attempt, and usedUpWords doesn't look at the status either. Where the
attempt then fails on that mark, the next member is asked first and
restAfterMarked is never called, as for a refusal — nobody rests and
nobody's usage is re-queried.

A 429 that really is the plan used up, with no such system prompt
asking, still rests the account and re-queries its usage, as it did
(#147, #530).

* fix(gateway): only the refusal leaves an Antigravity account alone

The mark was wider than the refusal it describes (yetone's review of
#873): it was set for any status >= 400, and for any failed stream,
whenever the system prompt was Claude Code's. A 500, 503 or 403 on such
a turn was therefore told as a refusal and never set the account aside,
and the account's 4xx handling below it was skipped for those requests.
The mark now goes on the refusal itself: a 429, or an in-stream error
event saying "Resource has been exhausted". The latter needs its own
predicate, since the Code Assist decoder keeps only the error's message
and leaves its status and code out of the event.

Two more of the review:

- the refused attempt now writes a usage.Record, as the hw.refused
  branch it is modelled on does, so these 429s stay in the ledger;
- the member's other Antigravity accounts are asked last rather than
  first, by matesLast, the inverse of matesFirst: they carry the same
  system prompt, so each is turned away just the same, and asking them
  first spent a round-trip apiece before the group reached a member
  that answers.

TestAntigravityTurnedAwayIsOnlyTheRefusal, ...StillLandsInTheLedger
and ...LeavesItsMatesForLast fail on the previous revision of this
branch for each of these reasons.

* fix(gateway): the refusal said inside a reply that isn't streamed

The mark was inside translate's `if stream` block, so a client that
doesn't ask for a stream — and a stream that isn't held — never set it:
the same "Resource has been exhausted" said as an in-stream error event
still rested the account 15 minutes on those requests.

A test for that path first: TestAntigravityTurnedAwaySaidInsideTheReply
drives a 200 that opens with the error event, and pairs it with an error
event of another kind, which still rests the account. The first half
failed on the previous commit for exactly this reason.

Both error paths now go through markAntigravityRefused, which decides
from what the failure said rather than repeating the four conditions at
each return: the Code Assist decoder keeps only the error's message, so
an in-stream refusal is recognised by its text, while a 429 is
recognised by its status as before.
2026-10-05 16:31:11 +08:00
kevin 6d5893d400 fix(rules): reject nan/inf and overflowing token lengths (#877)
* fix(rules): reject nan/inf and overflowing token lengths

ParseTokens used ParseFloat and cast straight to int. Values like
"nan", "inf" and "1e20" therefore became a huge negative (or other
nonsensical) token threshold instead of an error.

* fix(rules): reject tokens at the float64 MaxInt boundary

float64(MaxInt) rounds to 2^63, so n > float64(MaxInt) let the
boundary through and int(2^63) becomes MinInt on amd64.
2026-10-05 16:31:07 +08:00
yetone b525f27bfd provider: a custom provider's Balance field left empty is read from a Balance URL whose reply magpie knows (#881, Singrun) — new-api's /api/usage/token ($data.total_available / 500000) and /api/user/self ($data.quota / 500000), a sub2api panel's /api/v1/user/profile ($data.balance) and OpenAI-style /dashboard/billing/credit_grants ($total_available) each said "no balance path" with the field empty; the field typed still wins, any other URL still asks for it. The editor's field shows the one read as its placeholder, following the URL as it is typed. TestKnownBalanceFieldLeftEmpty fails without the change; balance-field-default.test.cjs (WebKit) passes. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (gui/proc/provider timing tests that failed under load pass alone). 2026-10-05 16:30:26 +08:00
yetone 387afd0779 gateway: Cursor Private Inference asking with another key of magpie's is shown its own model list (mamba on Discord) — after v0.1.980 its Reasoning control was still missing and models taken out on its row still listed: a key typed in its Open configuration or a model's settings ("magpie") overrides magpie-cursor-local, and its User-Agent (Cursor-CLI/…, cursor-agent-exec's default) made it the cursor agent, which is shown the plain list. cursor-agent talks to Cursor's backend only, so a Cursor User-Agent at the gateway is now taken as Cursor Private Inference's: its /models carries api_types and capabilities and follows its row's model picks, and its use is counted under it. Its notice now says to leave both the base URL and the key empty (or use magpie-cursor-local) and to quit the app, not only its window, as it keeps the model list it was first given. TestCursorLocalModels fails without the change. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. 2026-10-05 16:29:51 +08:00
yetone 602d4ec6cc agent: magpie's default compaction window gives way to one the user set in Claude Code (#876, hisiling)
On a non-Claude model magpie wrote CLAUDE_CODE_AUTO_COMPACT_WINDOW=272000 into ~/.claude/settings.json's env even when the user had set autoCompactWindow there, or modelSettings.<model>.autoCompactWindow (where /autocompact saves it). Claude Code takes the env first, so the user's own window was overridden: in a sandbox, autoCompactWindow 900000 showed 900k in /context, and 272k once the env was added. magpie now leaves the env out when the user set either one for the main model. A size the user typed in magpie, for every model or for a model or its provider, is still written, because the user chose it there.

Codex is unaffected. Codex's model_info.rs applies model_context_window and model_auto_compact_token_limit from config.toml over the catalog, and magpie never writes or removes either key.

TestClaudeCompactYieldsToOwnSetting fails without the change ("autoCompactWindow: "272000"; want """).
2026-10-05 16:24:23 +08:00
yetone 9139b19224 gui: the Update pill says "Downloading…" until the download has a percent, never "NaN%" (inaction on Discord) — /api/update leaves done out while it is 0 (omitempty), so the first reads of a download that had a total gave undefined/total = NaN and the pill flashed "Downloading… NaN%". downloadingText takes a missing done as 0 and shows a percent only when total is known and the result is a finite number (clamped to 0–100), else "Downloading…". update-download-percent.test.cjs (WebKit, en and zh: size known and nothing in → 0%, no size → Downloading…, then 50%; a MutationObserver checks the pill never said NaN/undefined/Infinity; the click doesn't scroll; no left border) fails without the change with 'Downloading… NaN%' / '正在下载… NaN%'. update-wait/hide/check/notes-ask and click-scroll tests pass. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. 2026-10-05 16:21:37 +08:00
wizzy-yangandmagpie-fix 07137b9f71 gui: a group's Save no longer leaves the Routing page blank (#884)
The click-hold that keeps what the reader clicked under the pointer holds its
place by scrolling, and makes room at the view's foot when the wanted scroll is
past the content. A group's editor is tall, and the reader scrolls down to its
Save: saving closes the editor, the page shrinks by its height, and the browser
clamps the scroll. What the hold then keeps is a parent that never moved in the
page — the screen moved only by that clamp — so it scrolled back to the old
place and padded the view with a blank view-room as tall as the editor. In a
window shorter than that room not one row of the page was in sight: the Routing
page looked blank while its DOM was intact.

Room is now only kept while some of the view stays in sight; when the whole of
what the reader was looking at is gone, the browser's own clamp stands.

routing-save-blank.test.cjs fails 2/2 on the old assets ("a blank room of
1355px in a 565px window") and passes 2/2 with this. click-scroll and the
group/routing regressions pass as on the baseline.

Co-authored-by: magpie-fix <fix@localhost>
2026-10-05 16:14:26 +08:00
yetone 2e57619ae0 test: TestAccountsOfAPlugin expects forgetting the account in use to put the other first — since 30d952cf (v0.1.976) forgetSideLogin no longer refuses the account a subscription uses first; magpie accounts forget goes through the same ForgetLogin, so a plugin's in-use account is forgotten and the remaining one becomes the one in use. Test-only; go vet and go test -tags nogui . ./internal/provider/... pass. 2026-10-05 15:39:43 +08:00
yetone 7118aaabcc gateway: Cursor Private Inference shows its Reasoning control for magpie's models (mamba on Discord) — its picker (cursor-agent-exec 3.23.12) keeps a /models row's capabilities only when they say the model calls tools, streams and writes text, and magpie's said neither, so every model was listed with no Reasoning control. The rows Cursor Private Inference is shown now carry supports_tool_use, supports_streaming, output_modalities [text], supports_reasoning and the model's levels (reasoning_effort), and a Claude served on Anthropic Messages is listed there alone, the only API Cursor sends a Claude's level (output_config.effort) on. Which levels it offers Cursor still decides from the id (Claude Opus/Sonnet 4.5+, GPT-5.x, Grok 4.x, Gemini); it has no Max toggle for a gateway's models. TestCursorLocalModels fails without the change. go vet, go build (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass but for TestAccountsOfAPlugin, which fails on main as well. 2026-10-05 15:38:44 +08:00
yetone 1aaac93b52 provider, gui: Compact at — where Codex and Claude Code compact a long conversation, set per provider or per model in its editor and to any size in Settings → Long conversations (#876, hisiling)
Until now the only choice was 272K for every model or Full window for every model. The 272K default stays as it is (e950eb08: OpenAI runs its own 1M models at 272K in Codex, and Chen saw 70–90s to a first token at 550K).

What changes:

- A provider's editor has Compact at beside Context window and Max output, in the same form: "500k" for all of its models, "deepseek-v4-flash=272k" for one, and empty to follow Settings. A size at or above a model's window means the whole window. The values are kept in settings.ModelCompacts.
- Settings → Long conversations takes a size of its own beside Compact at / Full window (settings.CompactAt).
- `magpie model compact` takes a size such as 500k.

Order: the model's own value, then its provider's "*", then Settings. Full window turns off only the Settings value. A group uses the smallest value among its members.

Where it applies:

- Codex's model_catalog is told the threshold as context_window, with the whole window as max_context_window.
- Claude Code's CLAUDE_CODE_AUTO_COMPACT_WINDOW follows the main model. A Claude model now takes its provider's value when one is set.
- The Codex list tag changes when the Settings size or Full window changes.

Tests:

- New: TestModelCompactsSetFromTheEditor, TestSetCompactAt, TestCodexCatalogCompactAt and TestClaudeCompactAt.
- TestSettingsSaveKeepsWhatItDoesNotSend now covers the two new fields.
- compact-at.test.cjs (WebKit, en/zh) checks the editor field (shown, refused, chips, saved) and the Settings size (posted, hidden under Full window, no scroll).
- go vet ./..., go test -tags nogui of the root package, provider, codexcat, agent, gui, gateway, settings and catalog under a temp HOME, and GOOS=linux/windows builds all pass.
2026-10-05 15:20:05 +08:00
yetone e77a373792 agent: every agent in a WSL distro under NAT is given the LAN sharing key, not "magpie" (whqtian on Discord) — v0.1.972 gave it to omp only, and OpenCode in WSL was still written "apiKey": "magpie" with Windows' address, which the gateway takes from loopback only. keyAt(gw) is the key for a gateway URL: the LAN sharing key when the URL isn't this machine's and sharing is on, else gateway.Token; OpenCode (and MiMo Code), Crush, Pi/omo, Codex, Claude Code, Kimi Code, Hermes, Grok, MiniMax Code, Droid, Morph, dsh, Qoder/Qoder CN and omp write it, their Checks compare against it (an old "magpie" there shows as drift), and ourKey still sees a LAN-keyed config as magpie's. TestGatewayKeyBeyondLoopback fails without the change. go vet ./..., go test -tags nogui ./internal/agent ./internal/gui ./internal/gateway ./internal/access ./internal/provider under a temp HOME, GOOS=linux/windows go build pass. 2026-10-05 15:19:09 +08:00
yetone 2c801b6f9a gui, proc: the Gateway card quits an older magpie serving the gateway and takes it over, or restarts the gateway (leslie_luo on Discord) — the card said an older magpie served the gateway and to quit it, with no way to tell which process that was. With an older magpie on the port it now has "Quit magpie {v} and take over": the process listening on the gateway's port is found (lsof on a Mac, /proc on Linux, Get-NetTCPConnection on Windows), its program path checked to be magpie's (magpie, magpie-*, dial, .exe/.old), asked to quit (SIGTERM, then SIGKILL after 5 s; TerminateProcess on Windows) and this magpie serves the gateway at once instead of within 15 s. Otherwise the card has "Restart gateway" ("Start gateway" when none runs); a magpie of this version or newer gets no button. Anything else on the port is never ended: a program that isn't magpie, one of another user or an administrator, one that won't quit, or a magpie a LaunchAgent/systemd unit/scheduled task starts again is said under the button with its path and pid, in en/zh/ja/de. TestGatewayFixQuitsOnlyAMagpie (copies of the test binary on a port of its own: one named other-server answering as magpie is left running, one named magpie is quit and the gateway is served here, then restarted) and gateway-takeover.test.cjs (WebKit and Chromium, en and zh, no scroll, no left border) fail without the change; TestListeningOn/TestIsMagpie pass on macOS and in a Linux container. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. 2026-10-05 15:05:31 +08:00
yetone 30d952cf0c provider: removing the account a subscription uses first puts the next one first, and Sign out… takes every account (歧路亡羊 on Discord) — Copilot's Sign out… stopped at "magpie uses wwjxhy first; put another account first" and kept the account 2026-10-05 15:02:17 +08:00
yetone 9fb51c7742 docs: a new README, in English and Chinese, that shows what magpie does
The old README was the whole manual in one file. Someone who opened the
repo saw a wall of config paths before seeing the app. The new one leads
with the app: a hero screenshot, six highlights, then a section for each
part (picking models, providers, routing groups and intent routing,
subscriptions and plugins, usage, sharing, the library), with the site's
light and dark screenshots in <picture> tags. A supported-agents list, a
three-step quick start and a CLI sample follow. README.zh-CN.md is the
same page in Chinese, with the Chinese screenshots where the site has
them.

The full manual moves, word for word, to docs/reference.md, with its two
relative links fixed. Both READMEs link to it, so no detail is lost.
2026-10-05 15:02:09 +08:00
yetone 322842c1c0 provider: ClinePass signed in through the Cline plugin shows the reasoning levels its API key does (zRain, Discord) — the plugin gives no levels of its own, and only a moved built-in borrowed its models' makers', so every plugin-served Cline model had none while the ClinePass built-in borrowed them. Cline's plugin now borrows as the built-in does. TestClinePluginBorrowsEfforts fails without the change. go vet, go build -tags nogui (darwin, GOOS=linux, GOOS=windows), go test -tags nogui ./... under a temp HOME pass. 2026-10-05 15:00:35 +08:00
cjyrainbow 9e77092173 gui: clarify search provider help (#878)
Explain manual-only relay selection and current searcher eligibility without a hard-coded provider list. Make quota and cost guidance apply to all search providers.

Update English, Chinese, Japanese, and German help while preserving existing ellipsis, hover titles, and search routing. Extend picker and help regression coverage.

Validation: 28 Chromium regression tests pass; picker/help tests pass three consecutive runs. WebKit is unverified due to missing host libraries. The separate search-api copy assertion has a pre-existing timing race reproduced on original and changed assets.
2026-10-05 14:59:02 +08:00
yetone 37ec725916 provider, gui: a removed subscription's one account can be signed out, a failed sign-out keeps its error on screen (#874); a custom provider's Max output has the usual sizes under it and More endpoints' labels stay on one line (#875)
#874: Sign out… on a removed built-in with a single account of magpie's always failed with "magpie uses a@x.com first; put another account first". It was the first account and there was no other to put first. Also, the ask closed whatever the answer was, so the error only flashed. forgetSideLogin now lets the first account go when no other account is left, so the subscription ends with none; with two or more it still asks for another to be put first. The ask now closes only when the sign-out succeeded. When it fails, it stays open with the error and its button enabled again. TestForgetOnlyFirstLogin fails on the old code (an antigravity row with one account; ForgetAccount drops it, logins.json keeps none; with two, ForgetLogin of the first still refuses and ForgetAccount takes both). removed-forget.test.cjs adds "a failed sign-out stays with its error", which fails on the old app.js.

#875: Max output now has 8K, 16K, 32K, 64K and 128K picks under it, the same as Context window. A click fills the field, a size typed in lights its pick, a per-model value lights none, and Save sends it. Under More endpoints, the label column is as wide as its longest label, so Anthropic 地址 / Responses 地址 no longer wraps a last 址 under the label. provider-output-picks.test.cjs (en and zh) fails on the old code. Item 3 (section headings) is left for the owner.

Tests: WebKit, en and zh: provider-output-picks, provider-max-output, removed-forget, provider-search, balance-fix, own-signin-remove, deprecated-subscriptions, click-scroll and fallback-more pass. Also passing: go vet; builds for darwin, GOOS=linux nogui and GOOS=windows; and go test -tags nogui -count=1 ./... under a temp HOME, where TestUserPath failed once waiting on the login shell and passed on a re-run.
2026-10-05 14:41:38 +08:00
yetone 31626c1543 agent: an omp in WSL under NAT gets the gateway's network key, and one bun installed is found and asked its version (whqtian on Discord: a WSL omp connected only once auth: none was swapped for the key by hand, and Kimi K3's max still read xhigh) — a distro not in mirrored networking reaches the gateway at Windows' address (172.23.80.1), where a request without a named key is turned away, yet magpie wrote auth: none there too. Its models.yml now carries the key the gateway is shared on the network with (access.LANSecret: the default LAN key, "" while nothing is shared or it is off) in place of auth: none; an omp on loopback stays keyless. The probe asked omp its version only when sh -l found it on PATH, but bun's and nvm's installers put theirs on PATH in ~/.bashrc, which sh -l doesn't read: the version stayed unknown and max was offered as xhigh, as for an omp older than 16.4.0. It now also looks in ~/.bun/bin, ~/.local/bin, ~/.npm-global/bin, ~/.volta/bin, pnpm's, nvm's, mise's and asdf's folders, and runs --version with the command's folder on PATH, where bun's #!/usr/bin/env bun finds bun. TestOmpKeyBeyondLoopback (NAT address shared or not, loopback, localhost) and TestWSLProbeFindsBunOmp (the probe script run with a bun-installed omp off PATH; fails on the old script: no bin, no version). go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but for TestSavedButSignedOutClaudeServed, which timed out once under load and passes 3 of 3 alone. 2026-10-05 14:40:49 +08:00
Junjie Zhou 4a97acf12a refactor(agent): separate Aside provider connection from model settings (#827)
* refactor(agent): connect Aside as a native provider with verified settings

* fix(agent): offer explicit offline Aside model and disconnect actions

Offer Save for next start after an initial runtime read failure, using a
structured API error instead of saved runtime state. Keep refusals and
failed readbacks on the live error path.

Add a separate offline disconnect confirmation that restores the checked
file plan, clears restore records and removes the provider last. Bind the
confirmation to its preview revision and roll back ordinary write failures.

Cover offline API and browser flows, cancellation, stale plans, missing
CLI, restore metadata and native provider spelling. Keep state file-only.
2026-10-05 14:37:44 +08:00
yetone 6e500cb520 provider, gui: a reset reminder, a notification before a long window renews with much of it unused or before resets expire (thedavidweng, #720)
thedavidweng asked to be told before an allowance resets, or a banked reset runs out, while it is still unused. magpie's notifications only said a window was nearly used up or a balance was low.

Settings › Usage now has a Reset reminder row: Off, 12 h, 24 h or 48 h before (settings.ResetReminder, 0 to 168 hours).

What it tells of, through the same watcher and notifications as the usage alerts (WatchQuotas, dueReminders):
- a window of a day or more (weekly, monthly) renewing within those hours with under 85% of it used. A 5-hour window renews too often to be news.
- an account's resets (Codex's, a GLM team plan's) expiring within those hours unused.

Each is told once per run, kept in usage-alerts.json as the alerts are. A failed or stale reading says nothing.

The notification reads, for example, 7 days: 55% left, renews tomorrow 14:30 — use it before then, and 2 resets unused, expiring tomorrow 14:30. zh, ja, de strings, there and in the row.

Turning it on asks the system's leave to notify and looks at once, as the alerts do.

Tests:
- TestDueReminders: once per run; a 5-hour window, one 90% used and one renewing later are left out; a longer lead takes the later one; resets told; a failed reading says nothing.
- TestReminderText (en, zh, ja, de).
- reset-reminder.test.cjs (WebKit, en and zh): the row, a pick saves it, another save keeps it, no click moves the page. It fails 2/2 on the old assets. usage-alert.test.cjs passes.
- go vet passes. The darwin, GOOS=linux nogui and GOOS=windows builds pass. go test -tags nogui -count=1 ./... passes under a temp HOME.
2026-10-05 14:36:41 +08:00
yetone 6fc0afe817 gui, provider: a model's price is set in the provider editor's Names & levels, beside its name, with its list price shown (ITea312, #819)
ITea312 couldn't find a way to price one model in the window. Only the provider's Price rate was there; a model's own price could be set only by `magpie model price` on the command line.

Each row of Names & levels now has Price, $ / 1M tokens, with four boxes:
- input, output, cache read and cache write;
- each shows the model's list price in grey (its vendor's on models.dev, else its maker's, before the price rate), so the official table is right there.

How a price is given:
- A part typed and the others left empty takes the list's for them.
- A model with no list price needs its input and output given.
- Every box emptied, or Restore default, gives it its list price again.

It is staged and made with the provider's Save, as names and levels are. Behind it:
- ModelPref gains Price and OwnPrice, set by SetModelPrice: the same check and store as the CLI, and the agents aren't told.
- modelJSON carries the price set and the list price.
- A price set here is counted as given, not multiplied by the price rate. The tooltip says so.
- zh, ja, de strings.

Two other changes:
- Names & levels drawn again keeps the place it was scrolled to: the taller rows had the list scroll, and Ask on one API jumped it back to the top.
- models.go: the Named field of bbb97297 is gofmt'd into the Entry block.

Tests:
- TestSetModelPrefsPrice; it doesn't build on the old code.
- model-price-edit.test.cjs (WebKit, en and zh) fails 2/2 on the old assets.
- provider-detect and provider-same-as read the Restore default tooltip's new words.
- model-*, models-*, provider-*, providers-*, name-suffix-where-named, gui-ja, gui-de and click-scroll pass on WebKit, except model-api-preset and provider-levels-scroll, which fail the same on origin/main.
- go vet passes. The darwin, GOOS=linux nogui and GOOS=windows builds pass. go test -tags nogui -count=1 ./... passes under a temp HOME.
2026-10-05 14:36:41 +08:00
yetone 2350ea7aa7 provider: moved ZCode users get plugin 0.1.9, where the gift's models are trial entries the user picks (plugins #21) — 0.1.8 spent a dual account's gift before its GLM Coding Plan for every model the gift served, so a user who meant to spend the plan had no say. 0.1.9 lists each live gift model again as <model>-Trial (GLM-5.3-Flash-Trial): that entry spends the gift and answers 429 locally when its bucket is spent or blocked, and a plain model always spends the coding plan. Reviewed line by line and run against a fake upstream (a coding-only account's trial entry is a local 400, a streamed trial request reaches zcode.z.ai with the raw model, a 1113 inside a 200 becomes 429 and keeps the entry off for a minute, a plain model still goes to api.z.ai); bun test (65 pass) and bun scripts/check.mjs zcode pass. go vet and go test -tags nogui ./internal/provider/ under a temp HOME pass. 2026-10-05 14:29:35 +08:00
Guuuu233andDavid Liu b06d8247b5 fix: keep Claude mid-turn text with tool results (#872)
Co-authored-by: David Liu <davidliu@MacBook-Pro.local>
2026-10-05 14:29:27 +08:00
zzzpyyy e957230629 fix: keep purpose-filtered routing state consistent (#784) 2026-10-05 14:26:23 +08:00
yetone e5981040dc gateway, gui: a request an aggregator passed on says which provider answered it behind it, "Upstream: DeepInfra" (leslie_luo on Discord: 像 CPA 那样指出实际供应商) — through OpenRouter a request was only "OpenRouter · deepseek/deepseek-chat", with no word of the provider (DeepInfra, StreamLake, Novita…) OpenRouter had sent it on to. OpenRouter names it in its replies, as tried with the owner's real key: Chat's body and every chunk of its stream have a top-level "provider", Messages' body has one and its stream's message_start a message.provider; its Responses replies and every reply's headers name none. The gateway now reads it (upstreamOf) from a body relayed as it came and from each event of one it translated, Chat, Messages or Responses, streamed or not, and keeps it on the request's try and route (upstream) and in the usage ledger (Record.Upstream; the CSV export's last column, searched as the rest). The Routing page's Requests list says Upstream: DeepInfra beside where it went, giving way after the provider's name when short of room, with its story saying the aggregator passed it on; a request's details on the Usage page have Upstream provider. A reply naming none says nothing. zh, ja, de strings. ClinePass and Cline weren't tried (no account); Vercel's gateway documents no such field in its replies, and a vendor whose reply has a top-level "provider" string is read the same way. In a sandbox magpie with the owner's real OpenRouter key: Chat, Messages and Responses (translated to Chat), streamed and not, all six said StreamLake in the trace, the ledger and on the Routing page. TestUpstreamRecorded (6 paths × streamed or not: the route, its try, Recent and the ledger) fails on the old code, TestUpstreamOf; routing-upstream.test.cjs (Chromium and WebKit, en and zh: the tag inside its row, the story, the Usage details, a click moves nothing, no left-border accent) fails on the old assets. ledger-hscroll, request-archive-usage, usage-ledger and usage-ledger-detail pass on WebKit; routing-served fails the same on origin/main (its swap wording). go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass but for TestTranslatedStreamKeepsClientAlive, which passes alone 5 times here and on origin/main. 2026-10-05 14:08:08 +08:00
yetone bbb9729748 gui, provider: where a model or routing group is named, it says what agents' lists will call it and offers dropping the suffix there; a group the user made counts as a name they set (#868)
The reporter's screenshot was Codex's model menu, where a long name plus " · Relay" or " · routing group" is cut off. Magpie can't widen an agent's menu. What it can do is shorten the label. Models can already be renamed (provider editor › Names & levels), groups have a Name, and Settings › Provider in model names (#335) can drop the suffix. The reporter found none of these.

Changes:
- The provider editor's Names & levels and a routing group's editor now each have the three choices: Off, Not on names I set, On.
- Each says what the agents' lists will show, e.g. "My Sol · Relay" or "Fast · routing group".
- The line follows the name as it is typed and the choice as it is picked.
- A pick posts settings/plain-names once and doesn't scroll.
- "Not on names I set" now covers routing groups the user made or changed (Entry.Named = !g.Auto) as well as renamed models, still only where the name is unique in the list. A group magpie found keeps its suffix.
- zh, ja, de strings.

Tests:
- TestPlainOwnNamesGroups fails on the old code.
- name-suffix-where-named.test.cjs (WebKit, en and zh) fails 4/4 on the old assets.
- group-fold.test.cjs: viewport raised to 1500 for the taller editor.
- Pass on WebKit: group-context, plain-names, provider-same-as, provider-levels-save, gui-ja, gui-de, click-scroll, agent-models, agent-model-groups, group-* and routing-*.
- Fail the same on origin/main: group-from-model-add at 600x420, provider-levels-scroll.
- go vet passes. The darwin, GOOS=linux nogui and GOOS=windows builds pass. go test -tags nogui -count=1 ./... passes under a temp HOME.
2026-10-05 14:03:51 +08:00
yetone af25cc6977 gateway: Codex's compaction on a magpie model goes on when the provider answers the summary 404 (#866) — a relay (flyapi) that serves the conversation turn by turn answered the summary request 404 "Upstream request failed", which went back to Codex as it came: "Error running remote compact task", a reconnect loop and the compaction aborted. Now a 404 is logged with the provider, model, base URL and message, and the summary is asked for again with the conversation as plain text in one message (no item ids, sealed reasoning or call ids for the relay to look up); when that fails too magpie compacts without a model — the user's messages (the latest 80k characters), the last reply and why — so Codex gets its compaction item and goes on. 401, 429, 500 go back as they came. Codex's base_instructions are untouched. TestCodexCompact404AsksAgainAsText and TestCodexCompact404CompactsLocally fail on the old code; TestCodexCompactOtherFailuresStay. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-05 14:02:09 +08:00
yetone a717902822 provider: a plugin's provider beside a provider of the user's own with its id is id-plugin, listed rather than hidden (lishouxian, #867) — a custom zenmux saved before @zenmux/pi-zenmux-oauth was installed took the id, so the plugin's ZenMux, once signed in (168 models), was skipped by allProviders and the sign-in ended in "signed in, but magpie can't list it"; and magpie provider rm zenmux hid the plugin's account rather than removing the custom entry. PluginID now gives id-plugin when a provider with an endpoint in providers.json has the id (customIDs, held per request like the rest), as it does for a built-in's or a preset's: the user's own keeps its id, models and agent/route references, the plugin's lists as zenmux-plugin, and rm zenmux removes the user's own. TestPluginIDBesideCustomProvider (fake plugin under bun) fails on the old code (PluginID(fakeco) = fakeco). go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-05 14:02:09 +08:00
yetone f082b8eb05 gui tests: routing-served reads the swap's story as 4a87b306 words it — the tooltip and the story now say "The vendor was asked for gpt-6-sol, but its reply says gpt-6-luna answered: likely another model" (zh 向服务商请求的是 gpt-6-sol,但回复说是 gpt-6-luna 作答,很可能换成了别的模型), reworded on purpose for vincentzhang, and the test still looked for the old "answered it: another model", so its en and zh cases failed on main. It now matches the new text, both models named in it. routing-served, remote-group-served, routing-shape, routing-proxy and routing-log-icons pass on WebKit, en and zh; go vet and go test -tags nogui ./internal/gui/ under a temp HOME pass. 2026-10-05 14:00:50 +08:00
yetone 116a85f270 gui tests: the Routing page's tests pick a day from the date bar, not the By request button (#860 flake) — remote-group-served's zh case timed out 2 in 9 after 5464a362, but it did so as often before it: under the same load old and new each passed 20 of 21 (18 of 18 run one at a time). The By request / By session buttons are .rt-day too, so .rt-day nth(1) could be the pressed By request button, which WebKit sometimes never calls stable, and the click timed out. remote-group-served and 11 other routing tests now click .rt-days .rt-day, as click-scroll and purpose-filter do. remote-group-served zh in WebKit: 18 of 18 under three loops at once; the 12 tests and purpose-filter, click-scroll pass on WebKit except routing-served, whose tooltip assertion fails the same on origin/main. go vet and go test -tags nogui ./internal/gui/ under a temp HOME pass. 2026-10-05 13:57:37 +08:00
kevin 2e8d1a5317 edit: keep a CRLF file's line endings when SetJSONItem adds or replaces an element (#869) 2026-10-05 13:56:48 +08:00
yetone 3b2df39db8 gui: the Routing page's magpie flies on to the member a request went to when it was sent at an effort the member isn't fixed at (uiots, #865: 路由页飞鸟停在 magpie 门口不飞向成员) — a row is keyed by its seat, whose fixed is the member's own effort, but a try's fixed is the effort it was sent at by force: the member's own, or one the agent asked in the model's id (a Claude Code tier at high). So a member following the group's effort, tried at high, had a try seat "id\0model:high" and a row seat "id\0model": play() found no row and skipped every flight, the magpie stood at magpie's door (or the canvas' origin) until the answer, and the row never said answering… / answered this request. A try's row is now looked up through tried() (tryseat): the exact seat, else the same key and model, else the key — in play() and in what each row says (trying, answered, gave). routing-try-fixed.test.cjs (WebKit, en and zh): a try with fixed "high" to a member with none — its row says answering… and the request is held at that row; it fails on the old routing.js. The other routing-*.test.cjs and panel-routing pass on WebKit (auto-reset, burst-speed and failed-open passed on rerun; routing-served fails the same on origin/main); Chromium doesn't launch on this machine. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./internal/gui/ under a temp HOME pass. 2026-10-05 13:44:03 +08:00
yetone 5464a362f6 usage: the Requests tab says how fast replies came, and fits the reporter's window; a wide window keeps Agents and Settings readable (huoranxuanyuan, #860)
The ledger kept each reply's duration, first-token time and output tokens, but the page only showed a duration. Speed is now shown in four places, measured as output tokens a second after the first token (usage.DecodeWindow, the same guard Routing's tok/s uses):
- Each row has a Speed column. It shows "—" for a reply that wasn't streamed, and the row's details say it too.
- A fifth KPI, Output speed, gives the period's speed with "first token in … on average".
- The trend has a Speed metric. Each model, provider or agent gets a mark at its speed for every hour or day, with a faint column for the hour's overall speed. The tooltip gives each one's tok/s and TTFT, and the ranking sorts fastest first.
- The ranking shows each one's tok/s and TTFT under the other metrics.
usage.Part (a series point's per-model, per-provider and per-agent sums) now carries timed, ttft_ms, decode_ms and decode_out for this.

Narrow window: the reporter's window is 975px wide (1220 at 125%). The table was 1222px in a 941px box, so the Status and Speed columns needed scrolling sideways. Where the table doesn't fit, it now leaves out Sent, Effort and the two cache columns. A line under the totals says those are in each row's details, and the details list them. The check runs again when the width changes or the table grows (a font arriving). At 975 the table now fits.

Wide window: at 1670px the Agents, Providers, Gateway, Library, Plugins and Settings rows stretched to 1636px. They now stop at 1200px and are centred. Routing, Usage and Sessions keep the full width.

zh, ja and de strings.

Tests:
- usage-speed.test.cjs (WebKit, en and zh) fails on the old code (no Speed column). At 975×778 it checks: the Speed column (75 tok/s, 10, "—"), the table fitting with no sideways bar, the hint, and Sent and Speed in the details. It also checks the KPI (72 tok/s, first token in 600 ms), the ranking's tok/s, the Speed trend (fastest first, a mark per model per hour), and Agents and Settings rows at most 1200 wide and centred at 1670.
- TestLedgerSeriesSpeed.
- usage-ledger, usage-ledger-detail and ledger-hscroll updated for the new column and details. ledger-hscroll now runs at 700px, still narrower than the tight table.

Results: usage-*, ledger-hscroll, agent-*, settings-*, click-scroll, gui-ja, gui-de, import-row, member-model-setting, routing-sessions, routing-columns and sessions-overview/toolbar pass on WebKit. remote-group-served's zh run timed out waiting for Routing's By request tab in 2 of 9 runs and passed in the rest. go vet, the builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass.
2026-10-05 13:32:38 +08:00
yetone c058ee1d87 devin: a moved Devin gets plugin 0.1.8, whose models take images as Devin tells its CLI (面条 on Discord: swe-2 takes images) — @magpie-community/opencode-devin-auth 0.1.7 listed swe-2, swe-1.7 and the like as text-only (models.dev doesn't know Devin's ids), so agents dropped their images; 0.1.8 asks GetCliModelConfigs, as the built-in already does (devin_images.go), and its declared list says what Devin said on 2026-10-05. The mover's min is 0.1.8, so keepMovedCurrent updates every moved user's plugin. With the owner's real Devin account, through the plugin: swe-2 and swe-1.7 described an inline image's colours, and provider.models listed them with image input, with the devin CLI and without it. go vet ./internal/..., builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-05 13:25:15 +08:00
yetone 4183f516bf agent, provider: a CLI whose --version fails isn't run again until it changes, and an npm CLI's version is read from its package (#864) — macOS put up 「已阻止恶意软件:未打开 "codex"」 each time magpie's window opened: the codex magpie finds was asked its version every ten minutes (the model list's client version) and again with the Agents page (a failure retried after ten minutes), and macOS stops a program XProtect flags with that alert on every start. proc.Version is the one way both ask now: an npm CLI (…/node_modules/@openai/codex/bin/codex.js) has its package.json's version read and isn't run at all; any other is run with --version, and a run that ran and said nothing, or couldn't start, isn't made again until the binary's path, size or mtime changes (a reinstall); one cut off by the timeout is. A CLI that answered is asked as before. TestCodexVersionNotRerun (a codex that exits 137 run once over three ten-minute refreshes; an npm codex's version read, not run) fails on the old code (run 3 times); TestVersionRunsOnce. TestUpdateCLI and the agent and provider tests pass. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but for TestClientGoneRecordedAsCanceled, which passes alone (-count=3). 2026-10-05 13:24:01 +08:00
Zhu Wang a77883ec91 fix(routing): label Codex background prompt suggestion groups (#859)
* fix(routing): label Codex background suggestion groups

* fix(routing): complete suggestion translations and regression coverage
2026-10-05 13:19:49 +08:00
yetone dad4b98729 gateway, gui: the Cline plugin's provider has ClinePass's Upstream tick too (ARNO on Discord: 这个功能可以也加到cline的插件里面吗) — "DeepSeek models only from DeepSeek's own API" was the built-in ClinePass's alone: the Cline plugin's provider (@magpie-community/opencode-cline-auth) is an account, whose editor had no such tick, whose save didn't keep pinUpstream and whose requests clinePin didn't touch. Now ClinePinnable is ClinePass, a cline.bot provider or the Cline plugin's; its editor shows the Upstream tick (one upstreamField for both editors), its save posts pinUpstream, the account keeps it (Save, allProviders), and a DeepSeek model's request reaches the plugin with "providerOptions":{"gateway":{"only":["deepseek"]}} on Chat and Anthropic Messages, as ClinePass's does. The plugin 0.1.3 has the same as an option of its own for OpenCode. TestClinePluginPinsDeepSeek (the fake plugin as cline, with a deepseek-v4-pro): unticked nothing is pinned; ticked and saved, the tick is kept and both DeepSeek requests are pinned, fake-1's not; it fails on the old code (not pinnable; the tick not kept). clinepass-pin.test.cjs: the plugin's editor shows the tick as saved and Save posts it off when unticked (WebKit, en and zh); it fails on the old app.js. model-first-pick, plugin-moved-signin, click-scroll, gui-ja and gui-de pass on WebKit. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-05 12:59:32 +08:00
yetone 4a87b30610 usage, gateway: a model the vendor spells with other separators isn't marked as another one (vincentzhang on Discord: 这个说明有点奇怪。看不明白。) — Volcengine Ark answers deepseek-v4.1-flash as deepseek-v4-1-flash, the dots written as hyphens, and the Usage page's Requests and the Routing page marked every such row amber 「实际 deepseek-v4-1-flash」, saying another model had answered, not the one asked for under a dated name. Swapped now compares the bare names without their separators (. - _ and spaces) and case, so deepseek-v4-1-flash, deepseek_v4_1_flash, GLM-4-6 for glm-4.6 and gpt-4-1-2025-04-14 for gpt-4.1 are the model asked for, while deepseek-v4-flash or deepseek-v4.1-pro for deepseek-v4.1-flash still are another. Rows and routes kept marked swapped before are read back as not swapped when the names differ only so (usage.SameSpelled, in rowChunk.row and Route.routedAgain). The tag's explanation says it in plainer words: asked for {sent}, the reply says {served} answered, likely another model; the same model under a dated name or spelled otherwise isn't marked (zh, ja, de). TestSwappedIgnoresSeparators fails on the old code; TestKeptRowSameSpelledNotSwapped, TestRouteKeptSpelledOtherwiseNotSwapped. usage-ledger (its expected title updated), remote-group-served, panel-routing, gui-ja and gui-de pass on WebKit. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass (TestCodexVersion timed out once under load and passes alone). 2026-10-05 12:49:59 +08:00
TechnoHouse 7d92013a15 claude: a tool the client's framework ran after a reply keeps the run, so the cache is read, not written again (#858)
Pi Team Bright runs team_sync itself after the model's reply and puts
it in the conversation as an assistant tool call and its result. The
request after that reply ends with a tool result. nextTurn took the last
assistant message (the framework's call) as the reply and refused any
request with a tool result after it. match found no parked run that owns
the call id, because no run made the call. The request then started a new
run and told it the whole conversation in one message, a prefix the cache
had never seen.

In one Pi user's usage on magpie 0.1.940 (2026-10-04 to 10-05), 14 of 17
turns after a reply and a framework team_sync read only the shared
19,500-token prefix and wrote the rest again: 2.99M cache-write tokens.
3 of 24 other turns after a reply did that.

A reply that ends a turn calls no tool. nextTurn now takes the last
assistant message without a tool call as the reply. Calls after it, and
results for those calls, go to the waiting run with the rest of the new
turn. A result for a call made before the reply still does not match, and
match still runs first for the run's own calls. With assistant messages
in the new turn, renderClaudeTurn labels each message Human: or
Assistant:, as renderClaudePrompt does for a new run. A turn of user
messages only is rendered as before.

TestClaudeRunKeptAfterTheClientsOwnToolCall and
TestClaudeTurnLabelsTheClientsOwnCall (claude_subscription_foreign_test.go)
fail on the old code and pass with -race. go vet passes. go test -tags
nogui ./... passes under a temporary HOME, except for tests that also
fail on main on the author's machine: TestPluginProxy,
TestPluginSOCKSProxy, and TestPluginModelListThroughAccountProxy fail
because local DNS resolves .invalid names, and the root and
internal/gui test binaries fail to link against the local macOS 27 SDK.
2026-10-05 12:46:22 +08:00
yetone 1d70277385 agent: Codex keeps an openai_base_url the user wrote by hand (sbtxdy, #856) — openai_base_url = "http://127.0.0.1:3425/backend-api/codex" written in ~/.codex/config.toml by hand, Codex on a model of its own and signed in to ChatGPT, was gone again each time magpie started (after every update): Sync's failover, which points Codex's own models at magpie while another of its ChatGPT accounts is on there and takes the base URL away when none is, took it for its own and removed it. Failover now marks the base URL it writes (codex.failover in the stash) and takes away only that one; one already there while failover is on is taken as its own, as a magpie from before the mark wrote it. Connecting Codex in magpie (Join), a magpie model, and disconnecting are as before. TestCodexHandWrittenBaseURLStays fails on the old code (Sync left only model = "gpt-5.5"); TestCodexOwnModelThroughMagpieWhileAccountsOn and the other TestCodex* pass. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass, but for TestClaudeAccountNamedAsItsLogin and TestClaudeIdentityServedWhileAsked (5 s timeouts under the full run's load), which pass run alone. 2026-10-05 12:45:16 +08:00
yetone 50d6c9a394 library: Claude Desktop's skills list shows again, each skill's updatedAt an ISO time (mingxitang, #863) — magpie wrote a skill's updatedAt in the kind lastUpdated had, milliseconds where it is a number, but Desktop's own entries are ISO times or null and listLocalSkills checks the whole list at once: one number and the skills page stayed loading (failed to pass validation). Now updatedAt is always an ISO time and lastUpdated keeps its own kind; an entry written as milliseconds before is written as the same moment in ISO at the next sync, its other keys as they were. TestClaudeDesktopSkills: the entry of a manifest with millisecond lastUpdated, and an old numeric entry fixed at a sync; it fails on the old code. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass (five timing tests under load 20 passed when run again). 2026-10-05 12:43:24 +08:00
Zhizhen He 69a7744a9f fix(agent): preserve Zed reply limits (#857)
Keep Zed's known input and output limits independent when building its
combined token budget. A 64K prompt limit no longer truncates a 128K reply.
Preserve the existing fallback reply cap when the input limit is unknown.

Cover larger reply limits, manual settings and synchronization, and
assert the prompt room left after Zed reserves its reply allowance.
2026-10-05 12:42:46 +08:00
kevin b78a1ce0b2 redact: hold a split placeholder of a long custom kind in a stream (#862) 2026-10-05 12:42:42 +08:00