ae7dc10ae284f79042ddf8fcddbfb4becc3cdffe
849
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ae7dc10ae2 |
docker: the image is Debian 12 slim, so the Cursor and Devin CLIs magpie installs at sign-in run in it (#2834, bborn2)
magpie installs a subscription's CLI at sign-in with its vendor's `curl … | bash` (internal/provider/install.go: Cursor, Devin, Grok Build). The distroless image had no curl and no /usr/bin/env (the installers' shebang), so that install couldn't run there, and only Grok Build had a native fallback. bborn2 reported that a Cursor CLI installed by hand failed with "cannot execute: required file not found". The image is now debian:12-slim with ca-certificates and curl. It keeps the nonroot user at uid/gid 65532, HOME and XDG under /config, the healthcheck, and magpie on PATH. Size: 157MB against 82MB for origin/main's image, both built here on arm64. Running a feature magpie offers is worth the 75MB. Changed in review: dropped the branch's GOPROXY build arg, a separate goal. The comments in install.go and install_test.go that said the image has no curl now say "had". docs/reference.md and the site's Docker page (en, zh, ja) say Debian with bash and curl instead of distroless with busybox. Run, with OrbStack's docker: - docker build of this tree and of d783df46c's Dockerfile: 157MB vs 82MB. - docker run of the new image: health "healthy", user nonroot (id 65532). `curl https://cursor.com/install -fsS | bash` exit 0, then `~/.local/bin/cursor-agent --version` printed 2026.10.16-e3cb207. Devin's install.sh installed devin v3000.11.92 (its trailing `devin setup` said "Login canceled" with no terminal, as on any host). `devin --version` printed 3000.11.92. bash and `magpie version` run. - Old image: `which curl` finds none, and /usr/bin/env doesn't exist. - A volume written by the old image (file owned 65532) was read and written by the new image. - gofmt -l clean; go vet darwin, linux (nogui) and windows clean. - Full `go test -tags nogui -timeout 45m ./...`: every package ok except internal/agent and internal/gateway, which timed out at 45m mid-test (TestConnectSaysHow, TestLargeRequestEndpoints) under a load average of about 200 from parallel suites. This commit changes no code those packages build, only comments in internal/provider, which passed (992s), so they weren't rerun. Not tried: a Grok Build install inside the image, and a full in-magpie Cursor/Devin sign-in with a real account in the container. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d783df46cb |
plugin: a plugin's page adds items to a provider's and an agent's row menu (P6)
package.json's magpie.actions: [{id, menu, title, titles}] puts items in
the row menus magpie draws, after its own: a provider row's (right-click)
and an agent row's (its handle, or right-click). Picking one opens the
plugin's page and posts it {event: "action", data: {id, provider|agent:
{id, name}}}, nothing else of the row; the bridge's magpie.onAction(fn)
gets it, and an action picked before fn was given waits for it.
- plugin.Window reads them (page.go): menu one of ActionMenus (provider,
agent; a session's menu is left out, its title is user content), id
^[a-z0-9][a-z0-9-]{0,39}$, an id given twice is the first's, 8 at most,
none for a plugin with no page.
- /api/plugin-pages carries them on the page; a missing title is the
page's, in each language (pluginpage.go).
- pluginpages.js: magpie.actions(menu, context) gives the row menu's
items; openRowMenu draws a plugin's name as written (literal), not
through t().
- The Plugins page says which menus a plugin adds to (actionsLine),
translated in zh, zh-TW, ja and de.
- Docs: plugin-runtime.md's P6 section and verification; the site's
plugin docs (en, zh, ja) gain "Items in magpie's menus".
- The core's budget (TestCoreScriptBudget) is not raised (#2710): with
P6 the core came to 1,447,648 bytes, 648 over. pluginpages.js's header
now says P5's and P6's part in one paragraph and points to
plugin-runtime.md, which says it in full, and plugins.js's panels and
actions lines share whereLine: 1,446,845, 155 under.
Run:
- Full: this series (P5, the Plugins dot, the probe test, P6, and a
built-ins-on commit since dropped for main's own
|
||
|
|
b9f790d37b |
plugins: panels in magpie's pages, a page that replaces a built-in one, titles in the window's language, and a look that matches
P5 of the plugin runtime (docs/subsystems/plugin-runtime.md):
- Panels (magpie.panels): a plugin draws a frame into a slot of a
built-in page (a provider's editor, Settings, Usage); magpie.context
says where it is, and the frame is as tall as what it draws.
- A page can replace a built-in one (magpie.page.replaces); show() opens
it in that page's place, and the sidebar row goes to it.
- page.titles and a panel's titles name it in the window's language
({"zh": …}); a malformed map is dropped, the title kept
(TestWindowTitles).
- main's #2501 already names wails:// in the policy of a page in the
desktop window (through ownWindow), which is why the usage page drew as
bare HTML from v0.1.1259. TestPluginPageLoadsItsFilesInTheWindow loads
a page through ownWindow in a real WKWebView, which Playwright on http
can't; the subsystem page says how.
- The bridge adds magpie's look for what a page leaves unstyled, every
rule in :where() so any rule of the page's wins, and the theme's
colours as --magpie-* variables.
One commit: the panels, the replacing pages and the titles share hunks
in page.go, pluginpage.go, pluginpages.js and the docs, and couldn't be
split cleanly.
Run:
- Full: this series (P5, the Plugins dot, the probe test, P6, and a
built-ins-on commit since dropped for main's own
|
||
|
|
5380114da1 |
LESSONS: 10-17: runs recorded at another tree, "under load" reds left unowned, a body scan on every passing reply
Folds the review of 10-17 04:00 to 10-18 04:00 (77 commits, v0.1.1277 to v0.1.1283) into LESSONS.md, and moves two lessons seen a third day into docs/code-standards.md: - magpie's default never overrides a value the user set (10-05, 10-10, 10-17: 5a2414acd's Essentials to All, #2749), a row under "What a change contains"; - a checkout, worktree or log belongs to the session that made it (10-09, 10-12, 10-17: 7660399a1's worktree checked out by another session, 17557132c's log deleted), under Commits. New lessons, each seen once: - a named sibling left alone gets an issue ( |
||
|
|
b14784c03f |
gateway: a fallback too small for the request is asked once every account with room is out of its allowance (Kai on Discord)
Kai on Discord (0.1.1278): Claude Code to claude/claude-opus-5-5, the
Claude provider's two subscription accounts (Max, Pro) both at their
limit ("resets 5:58am", "resets Oct 18 at 3pm"), its Fallback
codex/gpt-6.1-sol. Routing said the second account's 429 had nobody left
to try, and Claude Code had the 429. The fallback was never in the
route's order.
Cause: roomy (
|
||
|
|
e44b9aef33 |
middleware: onProvider changes what one provider a request is tried on is sent
A JS gateway middleware can export onProvider(body, ctx). The gateway
calls it on each try, just before the body goes to that provider, with
ctx.provider = {id, name, account, model}: account is the subscription's
kind (claude, antigravity, …), absent for a key. Every try starts again
from the body onRequest left, so a change for one provider never reaches
another in a routing group. null and ctx.reject turn nothing away there.
A hook that throws or runs past 250ms leaves the try's body as it was.
A plugin could act only before routing until now, by the model name the
agent asked for. Claude Desktop asks for opaque aliases, so a plugin
couldn't tell which vendor a request was going to. The first user is
@magpie-community/middleware-antigravity-cloak: it changes only what an
Antigravity account is sent, so that Antigravity stops refusing Claude
Code's system prompt (xzplzpl on X). magpie itself still sends every
prompt as the agent wrote it.
- gwmw.To and gwmw.Tried; middleware.Run.Tried runs the hooks.
- serveAgent puts the runs on the request's context, and serve's
candidate loop calls triedOn before the Antigravity foresight, so it
judges the body that will be sent.
- Docs: gateway-middleware.md, reference.md, integrating.md, and the
hooks table and community list in site docs plugins.html (en, zh, ja).
Run:
- go test ./... -timeout 45m in a sandbox HOME (macOS, at
|
||
|
|
de671719a0 |
provider: a retired built-in's failed move is tried again in 10 minutes, not 6 hours
A failed move waited moveRetry (6h) before KeepRetiringMoved tried it again. That was fine while the built-in carried on serving the accounts. A retired built-in serves nothing, so a move that failed for a moment (npm out of reach, or the plugin listed in plugins.json but not installed yet, which the real-account run on 85b8f6d4d hit with Command Code: the first Move failed, the second worked) left the user's subscription unserved for up to 6 hours unless they pressed Move. - retryWait(id) is retiredRetry (10 minutes) for a retired built-in, and moveRetry otherwise. MoveRetiring and HandOver both use it (retryDue). - KeepRetiringMoved's next run is brought forward to when a retired built-in's failed move is due (nextRetiringRun, at least a minute), instead of always an hour. - docs/subsystems/provider-plugins.md says so. TestMoveCutShort now also checks: - a failed move 11 minutes old waits while the built-in serves it, and the next run is an hour; - once retired, the next run is 10 minutes, it isn't tried at once, and it is moved after retiredRetry. Broken by hand, each red: - retryWait returning moveRetry for a retired built-in: "a retired built-in after retiredRetry: map[]" - nextRetiringRun always an hour: "the next run after a retired built-in's failed move: 1h0m0s, not 10m0s" Run: go test -tags nogui ./internal/provider -run TestMoveCutShort: ok. What was run for the stack, at load ~300 (it was rebased from |
||
|
|
bd30b068d3 |
docs: every deprecated built-in is retired; AGENTS.md and gateway-routing say so
AGENTS.md: the table's subscriptions are retired, not moving; the plugin does everything, the built-ins' code is gone but for what the movers read; the "fix the built-in too" step is gone; the parity tests hold each plugin to what its built-in did. gateway-routing.md: no bridges to a vendor's own API are left, so the structured-output, tool-image and billing-line lists lose Cursor, Kiro, Qoder, Devin and Command Code; Kiro's image ordering is its plugin's. Run: docs only; the full suite runs at the stack's head. |
||
|
|
be62bcf79e |
provider: Command Code's built-in is retired; its plugin serves it
commandcode-plan joins retiredBuiltins (migrate.go): PluginServes is true
for it moved or not, and @magpie-community/opencode-commandcode-auth does
its sign-in, models, requests and usage.
Removed
- Sign-in: the StartSignIn case (startCommandCodeSignIn, the Studio
callback, cmdOrigins, cmdWhoamiWait, commandCodeCallback/Keep) and the
pasted-key branch (commandCodeKey, cmdSignedIn).
- Accounts: commandCodeAccount, cmdProvider, cmdSide, cmdLoginList,
switch/on/forget (switchCommandCodeLogin, setCommandCodeLoginOn,
forgetCommandCodeLogin, commandCodeAlsoOn), the Logins case, and the
per-login usage (cmdLoginQuota, cmdQuota, the perLogin fetch). The
Logins("") list keeps {CommandCodePlanID, nil} so its order holds.
- The Go plan's path: CommandCodeGenerate, cmdGoModels/cmdGoFetch/
cmdGoRefused, cmdModels, cmdFree/cmdMarkFree, cmdPlansSeen's built-in
users (cmdRemember, cmdPlanKnown, cmdPlanNow), CommandCodeOutputOf, and
the account's generate field.
- asksOwnBackend's Command Code case.
- Gateway: the cmdGenerate/serveCommandCode dispatch and countOn's
cmdGoing clause; internal/gateway/commandcode.go (the /alpha/generate
translator) deleted.
- Built-in-only tests: gateway commandcode_test.go and
commandcode_place_test.go, TestBillingLineLeftOutOnCommandCode;
provider commandcode_go_test.go, commandcode_go_models_test.go,
commandcode_free_test.go, TestCommandCodePlan,
TestCommandCodeSignInWhoamiDown, TestCommandCodeSignInAgainToRemovedOwn,
TestCommandCodeSignInPastedKey.
- Docs: Command Code out of gateway-routing.md's bridge lists (the
2xx check, structured output, tool images, the billing line).
Kept, and why
- The mover and what it reads: cmdAuth, cmdOwn, cmdWho, cmdLogin,
cmdSaved, cmdLogins (migrate_side.go, plugin_accounts.go).
- cmdAPI/cmdStudio (plugin_usage.go's moved card), cmdKeysURL
(pluginsignin_paste.go), the plan and credit readers (cmdPlans,
cmdPlanOf, cmdPlanName, cmdWindows, cmdLeft, cmdQuotaOf, cmdTime,
cmdSubscription, cmdKeyWindows, cmdKeyPlanID): the keyed preset
"commandcode", planquota.go, balance.go and qoder_usage.go use them.
- CommandCodeMaxOutput (models.go caps the plugin's "commandcode-plan"
models with it), estimatedMoved, chat.go's plugin host cases, the
gateway parity tests, and the PLUGIN-SERVED notice in
commandcode_plan.go, now in the retired wording.
Tests whose meaning changed
- TestLoopbackSignInsTakePastedAddress no longer starts Command Code's
built-in sign-in; the plugin's (TestLoopbackPorts) says its key is
posted, never pasted as an address.
- The Go plan's free-model marks (TestCommandCodeFreeModels) were the
built-in's alone; the keyed preset never marked them.
Run (worktree magpie-wt-rt-a, on top of 9a64c4025)
- gofmt -l internal: clean
- go vet -tags nogui ./... (darwin, GOOS=linux, GOOS=windows): clean
- staticcheck U1000 on ./internal/...: no declaration unused that wasn't
unused at HEAD
- go test -tags nogui -count=1 ./internal/provider/ -run
'CommandCode|commandcode|Migrat|Move|Moved|Retir|SignIn|AsksOwnBackend|
SideLogin|Logins|Unmoved|Paste|Loopback|Account|PlanQuota|Balance|
FetchNew|FetchingNew|LeftAlone|Identit|Order': ok (100s)
- same, -run 'Usage|Card|Quota|Discovery|Exposed|Models|Output': ok
- ./internal/gateway/ -run 'CommandCode|commandcode|Plugin|Parity|Moved|
BillingLine|Search|ShapeFallback|GroupFails|CountTokens|Count|Format|
ToolImage|Cursor|Connect': ok (117s)
- ./internal/cli/ ./internal/gui/ -run 'CommandCode|commandcode|Plugin|
Retired|Moved|SignIn|Login': ok
- Not run: whole packages, the full suite, the GUI node suite (the
machine is loaded; the parent runs those).
|
||
|
|
07a445f42b |
provider: Devin's built-in is retired; its plugin serves it
"devin" joins retiredBuiltins, as Zed (c0605abc2) and Grok (60ecd598c)
did. @magpie-community/opencode-devin-auth serves it, moved or not.
Removed:
- Sign-in: the PKCE localhost listen and callback branch in signin.go,
devinExchange/devinExchangeURL. The exchange is Codex's alone again.
- Accounts: devinAccount and devinProvider in the account list, and the
Logins, switch, on and forget cases (devinSide, devinLoginList,
switchDevinLogin, setDevinLoginOn, forgetDevinLogin, removeDevinHome,
addDevinLogin, devinAlsoOn). "devin" keeps its place in Logins("") with
a nil list.
- Usage: devin_usage.go whole (perLogin fetch, usageLogins, loginQuota).
devinUsageVersion moved to devin_images.go, which still uses it.
- asksOwnBackend's "devin".
- Gateway: attempt()'s serveDevin dispatch and the Devin translator
(serveDevin, askDevin, buildDevin, decodeDevin, the Gemini schema and
tool-description rewriting, the call-id helpers). gateway/devin.go is
now connect_pb.go and keeps only the protobuf and Connect framing that
cursor.go uses.
- Tests of the built-in alone: gateway devin_test, devin_gemini_schema,
devin_sampling and devin_tool_ids; provider devin_usage_test,
devin_cli_signed_out_test, TestDevinSignIn, TestDevinSeveralAccounts,
TestSignInInstallsMissingCLI, TestDevinSignInUnseen, the Devin case of
the required-tools test, and TestDevinSplitParallelCallsKeepTheirResults.
Kept, because the plugin, the devin agent or the move uses them:
- The mover, devinLogins, devinIdentity/devinStatus, DevinAuthAt,
devinCredentialsAt, newDevinHome, devinCommand/devinProxy.
- DevinFamilies, DevinVariant and models.go's p.ID == "devin" shaping
(the plugin's provider id is "devin" too). internal/agent/devin.go
reads the families.
- The installer's "devin" case: the plugin's sign-in installs the CLI.
- The PLUGIN-SERVED notices in devin.go, devin_accounts.go and
devin_images.go, reworded as retired.
Also fixed:
- cliIdentities no longer lists devinStatus. No look at the accounts
asks it now, so it stayed unsettled, and FetchNewBehind told every page
that lists were on their way (TestFetchingNewOnceStarted went red).
- 60ecd598c (Grok) left TestFetchingNewForgottenWhileListed red: its
hook was GrokExecutable in the account listing. It and
TestFetchNewListsAgainForAnAnswerWhileListing now hook kiroCLIDB,
which is read after Cursor's account. Retiring Kiro will need another
hook.
Tests whose meaning changed:
- TestSignInInstallFails and TestSignInCanceledWhileInstalling go
through StartPluginSignIn("devin"), the plugin's install of the CLI.
- TestDevinCLIGoesThroughItsProxy seeds both accounts in logins.json
instead of signing one in. The sign-in's proxy is covered by
TestPluginSignInGoesThroughItsProxy.
- TestLeftAloneRunsNoCLI no longer expects `devin auth status` when the
subscription is switched on.
- TestFetchingNewOnceStarted's unanswered CLI is Cursor's.
- devinRawID moved to anthropic_call_ids_test.go. A Devin call id is
checked as safeCallID("dv_", ...).
Run:
- gofmt -l internal: clean.
- go vet -tags nogui ./... on darwin, GOOS=linux and GOOS=windows: clean.
- staticcheck U1000 on provider and gateway: no Devin leftovers.
- go test -tags nogui -count=1 -run '^(every test in provider, cli and
gateway that names Devin|TestFetchNew.*|TestFetchingNew.*|
TestLeftAlone.*|.*Identit.*)$' ./internal/provider ./internal/cli
./internal/gateway: ok.
- -run 'Migrat|Move|Moved|Retir|SignIn|AsksOwnBackend|SideLogin|Logins|
Unmoved|Install|Proxy|Account' ./internal/provider: ok.
- -run 'Devin|Required|Split|CallID|Cursor|Connect|Parity|ToolImage|
Format|BillingLine' ./internal/gateway: ok.
- -run 'Devin|Plugin|Retired|Moved' ./internal/gui ./internal/agent: ok.
- Not run: the whole packages, the full suite, the GUI node suite (the
machine is loaded).
|
||
|
|
2927a161ef |
provider: Grok's built-in is retired; its plugin serves it
Grok ("grok") joins Zed in retiredBuiltins. It is served by
@magpie-community/opencode-grok-auth, moved or not.
Removed, the built-in's own paths:
- the sign-in (startGrokSignIn) and the per-account homes it made;
- the Logins/switch/on/forget cases and the alsoOn branch;
- grokAccount and the account list entry;
- the usage fetch (grokSubscriptionUsage, grokLoginUsage, the windows);
- the model list (grokModels, grokContextModels, the window labels);
- the token refresh, the headers, the version probe, and routing's usage
clearing.
grok_usage_test.go is deleted, along with the six built-in-only tests in
grok_test.go and the four in grok_accounts_test.go.
Kept, because something still uses them:
- grokLogins and readGrokCredential, for the mover (migrate_side.go);
- grokBody, for the plugin's request bodies;
- GrokHome, the CLI install (pluginRunsCLI) and GrokBase;
- the gateway's grok draw, video, search and namespace code. It asks
PluginProvider()=="grok" too.
Each remaining grok file has a PLUGIN-SERVED notice.
Fixes the retirement needed:
- movedAgent asks Moved again, not PluginServes. A retired Grok that is
not moved yet still records the CLI's own sign-in, so the move takes it.
TestMoveGrok fails without this: only the second account moved.
- In Logins(""), a retired built-in keeps its place, with no list. Grok's
and Zed's accounts list where the built-ins' stood. Without this,
TestAllLoginsMovedKeepTheirPlace fails ("[zed grok]").
Tests whose meaning changed:
- The gateway's grokSignedIn now serves Grok through the fake plugin
moved onto "grok". It proxies to provider.GrokBase, read per request
and refused unless loopback, so no test reaches the network. It names
127.0.0.1 in fetchPrivate, because the vendor's own host is now the
fake's.
- TestVideoContentAtPrivateAddressNotFetched clears that setting. Without
the clear it fails with "200 secret-bytes".
- TestGrokAccountDraws checks the plugin's Authorization only. The real
plugin's headers are the plugin repo's to test.
- The Grok cases in TestVideosRedacted and TestMediaRedactedErrors reach
their echo through GrokBase (grokEcho).
- TestVideoModelByItsBareName's chat model is the fake's fake-1.
- TestGrokPluginSearchesItself expects "grok", not grok-plugin.
- TestGrokHideOwnSignIn is removed: hiding the CLI's own sign-in was the
built-in's ForgetLogin.
- grok_accounts_test.go keeps test-only newGrokHome and addGrokLogin
fixtures for the mover's tests.
Run in the worktree:
- gofmt -l internal: empty.
- go vet -tags nogui ./... on darwin, GOOS=linux and GOOS=windows: clean.
- go test -tags nogui -count=1 -run
'Private|Grok|grok|CallerUsageVideos|GatewayKeyModelsHoldTheImageAndVideoLists|RemoteMagpie|Video|Redact'
./internal/gateway: ok.
- go test -tags nogui -count=1 -run
'Grok|grok|Migrat|Move|Moved|Retired|Retir|SignIn|AsksOwnBackend|SideLogin|Hide|OwnRow|Logins|Unmoved'
./internal/provider ./internal/cli: ok, ok.
- go test -tags nogui -count=1 -run 'Grok|grok|Plugin|Retired|Moved'
./internal/gui: ok.
Not run: the full suite, the GUI node suite, and a real Grok account.
The machine is under heavy load.
|
||
|
|
1357236917 | docs: the retired built-ins leave the gateway and account pages | ||
|
|
21252f6a2c |
provider: Zed's built-in is retired; its plugin serves it
The first built-in taken out (the owner, 10-16: 陆续把内置Provider下线掉, 一定要下线完毕). @magpie-community/opencode-zed-auth serves Zed for everyone now; built-in accounts not moved yet are moved by the hourly loop, or from the Providers list's line (the commit before). Removed: the built-in's sign-in (zed_signin.go and its loopback paste branch), usage (zed_usage.go), its login list, switch, forget and account cases, its own-backend case in asksOwnBackend, the gateway's serveZed and zed.go, internal/zed, and the tests of only those. Kept, because the mover and the plugin path use them: zed.go's credential and login readers (migrate_zed.go's move), zed_body.go (plugins.go), and Zed in accountIDs, side_logins, cards_kept, plugin_usage's movedCards, the gateway's estimatedMoved and the CLI's account names, which name the plugin's accounts too. Zed the editor as an agent (internal/agent, the library's MCP target) is untouched. Tests changed: TestMovedBuiltinQuiet is TestRetiredBuiltinQuiet (no Zed card, its sign-in refused, the move still offered with the account); TestZedMoveCarriesItsModels compares the models without internal/zed; TestLoopbackSignInsTakePastedAddress and asksOwnBackend's set lose Zed. AGENTS.md and gateway-routing.md no longer name Zed's built-in client. Run on this tree over af08ecb27's parent tree: - go test -tags nogui ./... -count=1 -timeout 90m: 64 packages ok, internal/gui red only in TestCoreScriptBudget (the Move line; the budget is raised in af08ecb27). Rebased onto it: go test -tags nogui ./internal/gui -count=1: ok. - Earlier on wt6 before the three fixes: provider red in TestAsksOwnBackendAgreesWithTheGatewayDispatch and TestLoopbackSignInsTakePastedAddress (Zed still named), fixed here. - gofmt -l internal: nothing; GOOS=linux and GOOS=windows go vet -tags nogui ./...: clean. - GUI: retired-move, plugin-move, deprecation-notice and deprecated-subscriptions, both engines, en and zh: 20 pass. |
||
|
|
0f1666b387 |
provider: a built-in can be retired, its plugin serving it moved or not, and its unmoved accounts get a Move line
The owner (10-16) wants every deprecated built-in taken out of magpie,
one at a time. This is the ground for that; it retires nothing yet.
- retiredBuiltins / BuiltinRetired(id) in migrate.go name a built-in
whose code is gone. Only an id with a mover can be retired.
- PluginServes(id) is Moved(id) or retired. Every gate that asked
Moved(id) asks it now: sign-in, Factory keys, usage, logins, cards,
forget, accounts, check-ins, plugin sign-in, the CLI's accounts and
providers, the GUI's account label.
- A retired row's move.state is plugin, and its id is in onPlugins
once the plugin is installed.
- /api/providers lists a retired subscription's built-in accounts that
haven't moved in `unmoved` (MoveCandidate, now with the failed move's
error and why). The GUI shows a quiet line over the Providers list
for each, with Move / Try again (unmovedLine), in en, zh, zh-TW, ja
and de.
- AGENTS.md and docs/subsystems/provider-plugins.md say what a retired
built-in is.
Run at 270aa1c9c with this change:
- go test -tags nogui ./... -count=1 -timeout 90m: 66 packages ok.
- gofmt -l internal: nothing. GOOS=linux and GOOS=windows
go vet -tags nogui ./...: clean.
- GUI, both engines, en and zh: retired-move (new, 4/4), plugin-move,
deprecation-notice, deprecated-subscriptions, plugin-move-unserved,
plugin-movable-review, i18n-keys: 39 pass.
- TestRetiredBuiltinIsThePlugins -count=20 (it picks a mover at random).
The Move line is the Providers list's own, not a page that could be a
plugin. It took the core's scripts to 1,427,218 bytes, which the budget
main raised in
|
||
|
|
45b8c725cf |
gateway: a legacy /responses/compact carrying another account's native compaction goes to that account, or is refused saying why (#2727, ggbdpq)
codexBackend's /responses/compact relayed to Codex's sign-in (or, with the sign-in paused, compactOn's account) before any seal check, so a compact whose input carries a compaction magpie recorded another account as the writer of reached an account that can't read it, and Codex got the backend's bare 400. Now sealedCompact judges it, as /responses already is (codexSealedFor -> serve, #2642): the writer on in magpie answers it, signed as the writer (codexUpstreamOn); a writer gone (signed out, lapsed, paused, switched off, kept from the model) is refused 400 with checkpointError's reason; the sign-in's own seal, a key's seal, a request naming its own chatgpt-account-id, and a sign-in state magpie can't read relay as before. Two Team seats of one email still read as one (the record holds the email). Review fix on top of ggbdpq's 781381f4: a gateway key held to some accounts (#905) was checked (compactSigninHeld) against the sign-in before the compact was handed to the writer, so a key held to me@ spent the writer biz@ (acct-2 asked, 200), and a key held to biz@ was refused 403 "goes through the account Codex is signed in to" though the compact would go to biz@. The hold is now asked of the account the compact goes to; a writer the key may not use gets 403 sealedCompactHeldError naming the writer, with nothing asked. The test's fake backend now records under a lock. Reviewed and run (reviewer, at this commit with the #2739 commit under it, on 89521b03d; rebased after onto origin/main, see the last line): - Each fix broken by hand, TestNativeCompactionCompactJudgesItsWriter: M0 codex_backend.go as on main: 3 subtests red (writer answers, gone refused, compactOn gone). M1 the key '#' skip dropped: "a seal a key wrote is not judged" red (400). M2 the chatgpt-account-id skip dropped: its subtest red (400). M3 the writer never relayed to: the healthy-writer subtest red (backend saw ""). M4 gone never refused: 2 red. M5 judged after compactOn's relay: the compactOn subtest red (backend saw acct-2). Each green with the code restored. - TestNativeCompactionCompactKeepsTheKeysAccounts (new) on ggbdpq's 781381f4: red both ways ("200, the backend saw acct-2" for a key held to me@; 403 "goes through the account Codex is signed in to" for a key held to biz@). Red again with the hold put back on the sign-in; green with this change. TestGatewayKeyAccountsHoldCodexCompact and TestGatewayKeyCompactOnCodexAPIKey still pass. - -race -count=3 on both tests: ok. - gofmt -l clean; go vet ./... and -tags nogui (darwin), GOOS=linux and GOOS=windows go vet -tags nogui ./...: clean; go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok. - Full suite, set -o pipefail, go test -tags nogui -count=1 -timeout 45m ./... at 519bcc843 (both changes, on |
||
|
|
0eab029ea7 |
provider: a ChatGPT account's turn is zstd-compressed with at most Codex's own 2 MiB window, not 8 MiB (#2739, pc418)
codexZstd (internal/provider/codex_zstd.go) set no window, so klauspost's
encoder declared its default 8 MiB (and, single-segment, up to the body
size below that) on every turn magpie re-compresses for the ChatGPT
backend: the accounts loop (forwardOnce), the native relay
(codexUpstreamOn) and warm-up all go through CodexCompressed. Codex's own
client never sends that: openai/codex ce0323f2
codex-rs/http-client/src/request.rs compresses with
zstd::stream::encode_all(Cursor, 3); zstd 0.13.3 (Codex's Cargo.lock)
copy_encode streams through Encoder::new(dest, 3) with the size unknown,
which libzstd 1.5.7 gives level 3's windowLog 21 (2 MiB). pc418's
15,173,526-byte image-heavy turn got 400 in the 8 MiB frame and 200 at
2 MiB; a later replay of the 8 MiB bytes was taken, so this matches the
client's envelope rather than proving a backend limit. Level and checksum
are unchanged. Cost: a large turn is bigger on the wire at 2 MiB with
SpeedDefault (pc418's turn 7.59 MB -> 12.44 MB; libzstd -3 gives 9.78 MB).
Reviewed and run (reviewer, at this commit on
|
||
|
|
5a2414acdd |
plugins: every built-in plugin starts on, a new install's too
The owner (10-17): "所有的内置插件默认都应该是开启的", "尤其对新用户来说…… 不然新用户都不知道有哪些功能". Since |
||
|
|
1e643ba7e1 |
provider: a model listed by its display name ("GPT-6 Sol") joins the group magpie found for gpt-6-sol (Chill on Discord)
Chill added a provider "Only through routing groups". Its Claude models
(tidy ids) were filed into the groups magpie found, but a model the relay
lists as "GPT-6 Sol" was not grouped with gpt-6-sol.
Cause: autoGroups buckets models by mergeKey, which is sameModel: it
lowercased and turned "_" into "-" but kept spaces. "gpt-6 sol" and
"gpt-6-sol" were two buckets of one provider each, so no group held
them, though the group id (Slug of the key) was auto-gpt-6-sol for both.
Siblings checked: AutoGroupOf (and AutoStandIn, reseat and group import's
Instead through it), GroupFor and groupNamed already compare by
Slug(sameModel(..)) and were right; setModelSame's "its own id" check and
the editor's Merge placeholder (MergeName) use sameModel raw and get the
same fix. Group Match patterns are the user's own globs, not a name
match, and are unchanged.
Fix: sameModel spells a run of spaces (a no-break one too), "_" and "-"
as one "-", after dropping the vendor's prefix. Every word still counts,
so gpt-6, gpt-6-mini, gpt-6-sol and gpt-6-sol-mini stay apart, as do a
:variant and a four-digit release. Two ids now merged already had the
same auto-… id, so no saved group id or agent config changes.
Not done on purpose: OpenAI's dashed date (gpt-4o-2024-08-06) is not
stripped. sameModel strips YYYYMMDD and Ark's YYMMDD, but keeps release
suffixes that are models of their own; an OpenAI dated id is a pinned
snapshot apart from the moving alias, and stripping it would change the
id of a group magpie has found for years (auto-gpt-4o-2024-08-06) that
agents and saved groups name. The test pins it apart.
Test: TestSameModelDisplayNameAsID (sameModel spellings, pairs that must
stay apart, and Chill's case end to end: provider x with gpt-6-sol and
gpt-6-mini, provider y Unlisted with "GPT-6 Sol", "GPT 6", "GPT-6 Sol
Mini"; auto-gpt-6-sol has x/gpt-6-sol and y/GPT-6 Sol, no other found
group forms, AutoGroupOf and GroupFor agree). With group.go put back it
fails: sameModel("GPT-6 Sol") = "gpt-6 sol", and auto-gpt-6-sol: [] false.
Docs: providers-accounts.md's Routing groups row says what the same
model is.
Run at this head (sandbox HOME, pinned caches): gofmt -l clean;
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
-tags nogui ./..., go build: ok.
Full suite: go test -timeout 45m ./... at
|
||
|
|
48aae83b82 |
gateway: what Jev is told of a turn is masked unless Jev itself may have it unmasked
A routing group whose every member the user set to go unmasked
(unredactedRoute, provider.SkipsRedaction) hands its rules the body as the
agent wrote it. That was right for the members, but a group's Jev is none
of them: askJev sent the message, and since the commit before also the
user's message before it and the reply, to a remote decision provider
unmasked. The chat-model classifier was not affected (it goes through
serve, which masks).
askJev now masks the state's three texts with maskedText (maskedState)
unless Jev's own provider skips redaction, and fails closed when the
masker can't serve, as redacted does. Found by the agent writing the
commit before, on reading unredactedRoute's callers.
TestJevIsToldTheTurnMaskedWhenTheGroupGoesUnmasked: both members
Unredacted on local addresses, mask personal data on, an email in the
message and the one before; no state value Jev gets holds it. Broken by
hand (the SkipsRedaction check made `false &&`): red, "previous_user_message
went to Jev unmasked". gateway-routing.md says it beside unredactedRoute.
Full suite at bf2018807 (
|
||
|
|
6b5501027d |
gateway: Jev is told the user's message before and the reply to it, so a short follow-up routes like its turn (@HirotaNagai on X)
A follow-up like "继续", "yes" or "fix that" was classified alone, so it routed as a trivial turn. The decision classifier (Jev's state and the chat-model classifier's prompt) now also gets previous_user_message and previous_assistant_reply, when present. - Taken from the same parsed request as the classified message, after the gateway masks it, so the new fields are masked the same way. The answer cache key includes them. - The reply is the text of the latest assistant message after the previous user message. Never thinking, tool calls, tool results or system prompts; a tool-only reply gives nothing. - Caps: the message keeps 3000+1000. The previous user message is cut to its first 750 and last 250; the reply keeps its last 1000. Together at most half the message's cap. - The intent, level and effort instructions name the keys only when they are present, as context, not the thing being judged. Tests: TestTurnBeforeEachProtocol, TestTurnBeforeCuts, TestJevIsToldWhatCameBefore, TestChatClassifierIsToldWhatCameBefore, TestClassifyKeepsAnAnswerPerTurnBefore, TestJevSeesTheTurnBefore. Each was broken by hand and went red (10 breaks: reply taking thinking or tool arguments or a tool result, searched past the user message, no caps, jevState dropping the keys, priorAsk naming both always, writePrior not called, rules.go not setting prev, a cache key without the turn before, privacy off in the end-to-end test). Run at |
||
|
|
6690caaaec |
gateway: auto mode's review isn't asked of another subscription's Claude model, and Claude Code's set model is judged where it goes
Claude Code 2.1.302 tells a session behind magpie "this session isn't eligible because your requests go through 127.0.0.1:3425" and points the gateway at code.claude.com/docs/en/auto-mode-classifier-billing. That page asks a gateway to forward the dangerous-tool-use-2026-09-03 beta and the top-level `safeguards` field, and to return `safeguard_results` (message_delta.delta in a stream) with tool-use ids unchanged; one that can't should have clients set CLAUDE_CODE_AUTO_MODE_SERVER=0. magpie already does this on every route Anthropic answers (Claude subscription bridge, api.anthropic.com, relays, Bedrock, Vertex) and writes the 0 when no reachable model is reviewed ( |
||
|
|
72ed518bca |
gateway: an account's own list of models no longer refuses a ChatGPT account's GPT Image (heyiwei5 on X)
heyiwei5 on X: a Codex routing group's agent asked Magpie Image for
codex/gpt-image-2 and was told 403 "model "codex/gpt-image-2" is set not
to be served by any account or key of Codex: each one's own list of
models leaves it out. Add it to an account's models in magpie
(Providers → the account's Models)". That advice can't be followed: an
account's own list (#474) is picked in the editor from the provider's
chat models, and a ChatGPT account's GPT Image (like a Grok
subscription's Grok Imagine and a WorkBuddy plan's image models) is
never among them. So any account list kept for some chat models turned
every drawing away.
drawOnAccounts now treats those accounts as not listing the image model
(asked after those that do) rather than barred, for providers whose image
models magpie names itself (listsCantName: drawsCodex, drawsGrok,
drawsWorkBuddy). A capped account is still held. A key's own list, which
is picked from models that include its image ones (a relay's
gpt-image-2), still bars them, as nonchat_keys_test checks. Videos don't
go through account lists for Grok, so nothing to change there.
Run:
- TestCodexDrawsPastAccountModelLists on origin/main
|
||
|
|
d432920f02 |
search: DeepSeek's Search API as a search API vendor (TJHHHH on Discord)
DeepSeek's own Search API (api-docs.deepseek.com/guides/search) can now be added as a search API, with a DeepSeek API key: - provider.SearchVendors: deepseek, at https://api.deepseek.com, keys at platform.deepseek.com/api_keys, offered after You.com. - askSearchAPI: POST /v1/tools/search, Bearer key (the default), body {query, count: searchHits}. The query is cut to the 128 characters the docs allow (a longer one is a 400); need_content stays false. - readSearchAPI reads its summary (the docs' text "for a model", ~600-800 chars) as the page's text, since content is empty without need_content; its snippet stands in when there is no summary, and its date (RFC 3339 or null) is the page's age. Other vendors' fields are read as before; summary and snippet are only fallbacks after content. - 402 (no balance) and 429 (5 QPS per account) already rest a key as out of credit and rate limited (searchRestFor); the test pins it for deepseek. - Siblings: CLI usage (main.go, search_cli.go's api list and empty-state hint), README.md, README.zh-CN.md, gateway-routing.md's path list. The GUI takes its vendors from SearchVendors (no vendor list in app.js or i18n), so no GUI file changes. Not tried against the real DeepSeek API (no key in this run); the fake is built from the docs' response shape, with null site_name/date and empty summary/content. Note DeepSeek bills direct API calls ($0.75 per 1,000 non-empty searches). Run (worktree on origin/main |
||
|
|
89521b03d6 |
cli, gateway: magpie cpu records the running magpie's CPU profile for 30s, for a report of high CPU (@LeiCheng42 on X)
@LeiCheng42 on X reports magpie using the most CPU while Codex runs. As with magpie heap ( |
||
|
|
2042123f43 |
provider: a provider switched off for a while stays in the groups magpie found, so agents on auto-<model> aren't rewritten to the one left (#2671)
timonwong (#2671, with the branch this is): a found group, auto-<model>,
was built from the providers that are on only, so switching off one of
its two providers took the group away. Every agent on group/auto-<model>
was reseated to the other provider's model (agent.Reseat → sameModel),
rules and groups naming it went 404, and switching the provider back on
brought the group back but not the agents' settings.
timonwong's change, ported as is (05927b833, 063fe15a2):
- models.go: entriesOf(of, off), and heldOffEntries(), the models of the
providers that are Ready and Off (a keyless one, a plugin not signed in,
finds no group), held per request like the other entries.
- group.go: foundGroups/foundFrom merge those back in the Providers order
before autoGroups, in groupsIn, DeleteGroup and RenameGroup. membersIn
already skips a switched-off member, and the Routing page already says
it as switched off (memberJSON.providerOff).
- A removed provider still leaves the group; NoAutoGroups and
ModelSameAs are honoured; a hidden found group stays hidden.
Side effect: a found group whose only usable member is left shows while
a provider is off, which is the point.
Reviewed line by line; nothing writes a user-set value, and Reseat now
has nothing to move for these agents, so there is nothing to restore when
the provider is on again.
Added here: TestReseatKeepsAFoundGroupWithAProviderOff (internal/agent:
Claude Code and Hermes on group/auto-gpt-5 are not moved when cop is
switched off, a model only cop served still is, the group resolves, and
switching cop on moves nobody) and TestFoundGroupMemberOfASwitchedOffProvider
(internal/gui: auto-x is on the Routing page with b/x said as switched
off). The docs row names the tests.
Red on bf931f82c's provider code (models.go and group.go from main): both
new tests, timonwong's TestFoundGroupWithAProviderOff (404 as in the
issue) and the updated TestProviderOff. Broken by hand (heldOffEntries
returning nil): the agent and gui tests and TestFoundGroupStaysWithAProviderOff
and TestFoundGroupRemovedWithAProviderOff go red.
Run at this change on
|
||
|
|
992f288e20 |
gateway: a Chat-only relay that refuses tools with reasoning and none too moves a group on (#2670, JJ-Lin)
JJ-Lin's analysis in #2670 found both causes and gave the mock upstream the tests use. A relay with a Chat URL alone answers tools with reasoning_effort with "use /v1/responses or set reasoning_effort to 'none'", and then refuses none ("Supported values are: 'low', ..."). - forwardTranslated: when none was #176's own and is refused naming the levels, offRefused is still remembered (it is true of the model), but the request isn't asked again at the lowest level (refused the same by the upstream's own word). The tools refusal is the answer. The #176 retry is gated on turnedAway(none) plus a per-request guard, so it can't loop. Before: the first request went [xhigh none low] and every later one [high], with the 400 going to the agent. - passthrough (a chat client's relayed request), the sibling: the same. It used to ask none on every request and hand back the confusing "'none' is not supported" error. - shapeRefused/retryable: a 400/422 that wrongEndpoint reads reaches the group only once the member has tried every API it has a URL for. The next member is now asked once, and this one doesn't rest (failShape). Before, the group stopped on it. - The agent's error still names the Responses URL the provider lacks (wrongAPINote via asksResponses). Reading supported_endpoint_types from /v1/models was left out: wrongAPINote already says what to set, and trying Responses on the Chat base unasked isn't clean. - docs/subsystems/gateway-routing.md says both. Plain chat without tools, and gpt-6-astra (where none is taken) are unchanged; TestToolsEffortNoneTaken pins both ([effort none] -> 200 three times in a row; no-tools [xhigh] -> 200). Tests (internal/gateway/tools_effort_none_test.go, JJ-Lin's mock): - TestToolsEffortNoneRefused: one Server, Codex xhigh/high/high asks [xhigh none], [high], [high]. Each answer is the tools refusal with the Responses-URL note. A chat client gets [high none], [high]. - TestGroupPassesOverToolsRefusedOnChat: group relay -> other. Three requests in a row are all 200 from other, tries[0] is failShape, no rest. Broken by hand: - fallback.go reverted: the group test is red (400 to the agent). - translated restore off: "request 1 asked [xhigh none low]". - passthrough check off: the chat client gets "'none' is not supported". - turnedAway gate off: "request 2 asked [high low]". Without the per-request guard too, it loops forever (seen, killed). Run on origin/main |
||
|
|
e183604f06 |
claude: a tool named with a dot comes back under the name the client declared (#2649)
tsy0716's client offers a tool named "spawn.agent". Through a Claude
subscription the reply's tool_use called "spawn_agent", a tool the client
never offered: Claude Code keeps only [A-Za-z0-9_-] of an MCP tool's name,
and magpie handed the call back under the name Claude Code used.
The MCP helper now offers each tool under bridgeToolName: a name Claude
Code keeps as it is (and at most 51, 64 with mcp__magpie__) is unchanged;
any other, or one ending as a changed name ends (_ and 12 hex digits), is
cut to 38 of [A-Za-z0-9_-] and given 12 hex digits of its SHA-256. So
"a.b" and "a_b" stay apart, and the name is the same in every run: a
resumed session, the history told to a new run (renderParts) and the
tool-choice line (toolChoiceAsk) name it as the run was offered it.
subscriptionRun.names maps it back to the declared name in toolStart (Claude
Code's streamed and whole messages, so every API the bridge serves) and in
mcpCall (what an agent like Cursor is told through onCall). A name Claude
Code already kept goes upstream exactly as before.
What was run:
- New TestClaudeToolNamesComeBackAsDeclared: tools "spawn.agent",
"fs/read", "has space", an 83-character name, "a.b" and "a_b", through
/v1/messages, chat/completions and responses, client stream on and off,
Claude Code's reply streamed and whole (12 cases); a fake Claude Code
that changes names as Claude Code does and calls every tool it was
offered. Checks the client gets exactly the declared names, and Claude
Code was offered six valid, unique names of at most 51; and the history
and tool-choice text use the offered name.
- Broken by hand: with the encoding taken out the test fails; with only
the decoding in toolStart taken out, every case fails ("the calls name
[a_b a_b_2e7336dc8eba fs_read_96379919f693 ...], want the declared").
- go test -run 'Claude|Bridge|MCP|Mcp|Tool' ./internal/gateway/
./internal/claudebridge/: ok.
- gofmt -l clean; go vet -tags nogui ./... on darwin, linux, windows: ok.
- Full suite at this head (8b1fad8f5 before the message change), as
recorded in the #2651 commit: ok but three timing reds outside this
change (#2719, #1889, and one fixed on main by
|
||
|
|
f550d3699c |
claude: a SOCKS proxy reaches Claude Code through magpie's HTTP bridge (#2651)
demystify0137's Claude account sits behind a socks5:// proxy. Every turn was answered 502 after minutes of retries, Claude Code failing each try as UnsupportedProxyProtocol: it is a Bun binary, and Bun takes only http:// and https:// proxies. magpie handed it the socks5:// URL as HTTPS_PROXY. Every Claude Code magpie runs for the subscription now gets its env from one helper, netproxy.EnvForBunWith, which sets the proxy as before and puts the loopback HTTP bridge (netproxy.Bridge, #1409) in place of a SOCKS URL: a turn (startRun), the model test (askClaude), /usage (claudeUsage), sign-in (startClaudeSignIn) and the sign-in check (claudeSignedIn). Where the bridge can't be used (it doesn't start, or Claude Code runs in WSL under NAT, which doesn't reach this computer's loopback) the request fails at once with that reason, instead of Claude Code retrying for minutes. Other CLIs magpie runs with a proxy (grok, devin, cursor-agent) aren't Bun (checked their binaries), and the settings.json env writer already leaves SOCKS out. What was run: - Real Claude Code 2.1.302 in a sandbox HOME with a fake API key, through a fake SOCKS5 proxy (temporary test, removed): raw socks5:// gave "API Error: Unable to connect to API (UnsupportedProxyProtocol)" with 0 SOCKS connections; bridged it reached Anthropic, 401 "Invalid API key", 7 SOCKS connections. - New tests TestEnvForBunWithBridgesTheProvidersSOCKS, TestClaudeCodeGivenTheBridgeForASOCKSProxy (turn, askClaude, claudeUsage), TestClaudeSignInBridgesASOCKSProxy. With proxied() put back to EnvWith both gateway and provider tests went red ("Claude Code was given the SOCKS proxy: https=socks5://127.0.0.1:1...", "login-proxy: Claude Code ran with HTTPS_PROXY=\"socks5://127.0.0.1:1\""). - gofmt -l clean; go vet -tags nogui ./... on darwin, GOOS=linux and GOOS=windows at 8b1fad8f5: ok. - Full suite at 8b1fad8f5 (this and #2649 on origin/main |
||
|
|
717b69f78a |
routing: a conversation held to its native compaction's account says so, not "the only account on" (#2639)
A turn carrying a native compaction goes only to the account that
sealed it, so the route's order has one account, and Routing's first
line read "{who} is the only account on for {model}". On #2639 that
read as the other account not serving the model. The route now names
the sealer (Route.Compaction, compactionWho), and Routing says the
conversation stays on it because only it can read the compaction, and
that a new conversation uses the others. Translated in zh, zh-TW, ja
and de.
Run on origin/main
|
||
|
|
04e8aa8f10 |
library: typing with an input method no longer moves the page (#2636)
In Library -> Instructions, typing Chinese through an input method made the
page jump up or down while a word was composed. The cause: the textarea's
autosize set height:auto to measure scrollHeight, so the page went short for
a moment and the browser clamped the view's scrollTop. Putting the height
back doesn't undo a clamp. app.js's scroll guard took the clamp for a scroll
the reader didn't make, and its scrollIntoView({block:"nearest"}) pulled a
textarea taller than the view to one of its edges. Every composition step is
an input, so this happened on every keystroke.
autosize (the only one in the GUI, used by a set's text, an agent's own
text, a skill's description and subagent boxes) now holds the textarea's
parent at its height while measuring, so the page never goes short.
What was run:
- New internal/gui/tests/library-ime-scroll.test.cjs covers en/zh, 980/560px,
a Default set's text and Cline's own text. Chromium composes through CDP
Input.imeSetComposition/insertText. WebKit gets synthetic
composition events and inputs.
- With the fix: 9/9 in both engines, before and after rebasing onto
|
||
|
|
17557132cb |
gui: in a narrow window the title bar's tools show their icons, then the title gives way; nothing lies over it (#2625, linusxiong)
Beside the sidebar, Library's, Plugins' and Settings' heads sit in the
title bar after the breadcrumb, between --tools-l (the crumb's right +
16) and the window's buttons, laid out flex-end. When the tools needed
more than that room they ran on to the left, over the crumb: at about
650pt with the sidebar, Library -> MCP servers had 「发现」 over
「MCP 服务器」's last character. The crumb never gave way to them.
app.js tools() now shares the room out, laying out and reading each
step in its one frame, the next only if the tools still run over:
1. the crumb whole (its natural width from its parts, the last one's
scrollWidth) and the tools with their words;
2. body.tools-tight: Library's Discover / Library folder / Backups and
Plugins' "Mirrors in China" show their icon (or switch) alone. Each
keeps its name as aria-label (a hidden span leaves the accessible
name) and its tooltip as before (the folder's path, the backups'
note and path, Discover's and the mirrors' sentences);
3. --crumb-max: the crumb drops its leading parts ("Work /"), a part
and its slash at a time, and last cuts the page's name at its end.
In the side-nav head the Library buttons and the mirror switch are
flex: none and Plugins' search keeps 120px, so what doesn't fit shows
as running over rather than shrinking out of sight. The views'
MutationObserver also asks tools() again, as a tab's own tools change
(Discover only on MCP servers and Skills) without the crumb resizing.
title-bar-tools.test.cjs (new): every Library tab, Plugins' three and
Settings, sidebar picked, window mode, at 560 (the window's least),
650, 760, 900, 1024 and 1280px, in zh, zh-TW, ja, de and en, Chromium
and WebKit. No tool lies over the shown title or another tool or out
of the bar, no label is cut, an icon-only tool has aria-label and
title, only leading crumb parts go and the page's name shows, whole
from 650px. Against the old assets (MAGPIE_GUI_ASSETS) it fails in all
five languages at 560px Library Instructions ("a tool lies over the
title"); with the change Chromium 5/5 and WebKit 5/5. Looked at
screenshots of zh Library MCP servers and Plugins Discover at 560, 650
and 760px.
docs/subsystems/gui-shell.md says how the title bar gives way.
Run with both #2623's and #2625's changes, on
|
||
|
|
7ea8aeaba7 |
gateway: DSML written with a run of pipes (<||DSML||invoke) is made the call too, not left as text (#2623, OKURBITO)
DeepSeek wrote its tool call as <||DSML||invoke name="get_weather">…
(two full-width pipes each side) and the reply reached the Responses
client as that markup: textCallAt only knew the one-pipe marks, so
nothing was held and parseTextCalls, whose regexes already read a run
of pipes, never ran. dsmlMark now finds a DSML tag's mark as the parse
regexes (dsmlTag) read one, with no list of spellings: <, spaces, / and
spaces for a close, a pipe, a run of pipes and spaces, DSML, and
another run that may be empty. A pipe is ASCII | or full-width |, in
any number and any mix of widths. textCallAt uses it to find a call
and to hold a mark still being written (down to a full-width pipe's
first bytes); cutMark uses it to trim a tag cut short at the end, once
the tag has begun its pipes, so a value ending "a < " keeps its "<".
Every route goes through these: textCallSee (translations),
textCallTidy (relayed Chat streams) and wholeTextCalls (whole Chat
replies). OKURBITO pointed out on the issue that a spelling table
leaves |||, ||, || and the like as text; this reads the class.
Tests (textcalls_pipes_test.go). Which cases were seen and which were
made up, as OKURBITO set out on the issue: one reply was written by a
model on its own in real use (deepseek-flash offered web_search:
<||DSML|| calls> … <||DSML|| invoke name="web_search"> …), kept
byte for byte as observedPipes; the issue's get_weather reply came from
asking the model to echo the markup; every other spelling (three pipes,
ASCII, widths that disagree, spaces after <, no pipes after DSML) is
constructed and has not been seen.
- TestTextWrittenDSMLDoublePipe: the observed reply, relayed Chat
streamed and whole, is a web_search call with its query and no DSML
left; the issue's reply through /v1/responses, streamed and whole, and
a whole Chat reply, is a get_weather call with {"city":"Beijing"} and
no message item.
- TestTextWrittenDSMLAnyPipes: | | || || || || ||| ||| "| |", each reply
sent one character per chunk: the call, wrapped with text before, a
space before invoke (the live <||DSML|| invoke), no parameters, cut
short, tags only with the last cut short, a tool not offered, a mark's
start at the end, pipes without DSML; each ends as the one-pipe reply.
- TestTextWrittenDSMLDoublePipeEveryCut: the reply split at every byte
boundary JSON allows is the same call; textCallAt holds each prefix of
the mark, a full-width pipe's first bytes too.
- TestTextWrittenDSMLMarkAsParsed: widths that disagree within a tag
and between its open and close, spaces after < and around /, no pipes
after DSML are each the call; a cut-short <parameter> value ending in
"a < " keeps it; "x < y and a <" stays text.
Fails without the change: with b7d9616d0's textcalls.go all four
FAIL, the observed reply among them ("text \"<||DSML||invoke …\" calls
map[] finish \"stop\"", "a message item beside the call"; MarkAsParsed's
widths that disagree, spaces after <, no pipes after DSML); the one-pipe
rows pass there. With an earlier draft of dsmlMark (a run of pipes,
none after <, one required after DSML) MarkAsParsed FAILs its
spaces-after-< and no-pipes-after-DSML rows; with cutMark's
has-begun-its-pipes guard taken out it FAILs the cut-short value ("a "
for "a < ").
Not tried against a real DeepSeek upstream: the fixtures are the
bytes OKURBITO posted. In the observed event the request offered only
a hosted web_search ({"type":"web_search"}), not a function; a call to
a tool the request didn't offer by name still goes on as text, as
before, and the test offers web_search as a function.
Run with both #2623's and #2625's changes, on
|
||
|
|
8233eadaec |
provider, gateway: a plugin's model served at priority has fast mode, whichever plugin (Lovest on Discord)
Since #2514 a plugin can say which tiers its vendor serves a model at
(serviceTiers). CanFast still returned true only for Cursor's plugin, so
no other plugin's models could be a group's fast member or an agent's
fast pick. The Routing and Agents pickers (gui/groups.go, agent/route.go
FastFor) and SetFastPick/SaveGroup all read CanFast, so they refused too.
Changes:
- CanFast: a plugin's model has fast mode when the plugin says it is
served at "priority", on its Chat or Responses API (pluginTierOn), where
the gateway sends service_tier. This holds for any plugin. Cursor's
fast flag and -fast sibling logic are kept below it, unchanged.
- UltraOn/CanUltra: such a model can also be picked Ultrafast when the
plugin says "ultrafast". Before, plugins were excluded outright.
- forwardTranslated: a plugin's request whose agent spoke Claude's API
carries fast mode as speed "fast", with no tier. It is now given tier
"priority" ("ultrafast" for an Ultrafast pick) when the model is served
at that tier. Before, Claude Code's fast pick on a tiered plugin went
out with no service_tier.
- The "no fast mode" error names plugins.
- docs/subsystems/provider-plugins.md says all of this.
Test: TestPluginTiersGiveFastMode (gateway, fake plugin with FAKE_TIERS):
- CanFast and CanUltra: fake-1 (priority+ultrafast) true/true,
fake-resp (ultrafast only) false/false, fake-claude (none) false/false.
- fake-claude is refused as a fast member and as a fast pick.
- A fast group member reaches the plugin's fetch as priority from Chat,
Responses and Anthropic.
- Claude Code's fast pick sends priority, its Ultrafast pick sends
ultrafast, and another agent's request sends none.
Broken by hand, each then restored green:
- CanFast's tier check off (the old behaviour): red on CanFast(fake-1),
CanUltra(fake-1) and the fast member being refused.
- forwardTranslated's Fast-to-tier off: red on the anthropic member, the
fast pick (nil, want priority) and the Ultrafast pick.
- UltraOn's plugin branch off: red on CanUltra(fake-1) and "no account
offers Ultrafast".
Existing TestPluginServiceTierReachesFetch, TestPluginModelServiceTiers*
and TestCursorPlugin* pass.
No GUI asset changed (the pickers only read canFast/UltraOK from Go), so
the GUI suite was not run.
Run:
- gofmt -l: clean.
- go vet: darwin, GOOS=linux -tags nogui, GOOS=windows -tags nogui.
- go test -tags nogui -timeout 90m ./... at 9f9bfc160+this: EXIT=0, 66
packages ok, none failed (agent 3928s, gateway 2739s, provider 785s).
The timeout is 90m because the load average was ~150-270, and 45m cut
agent and gateway short on this box earlier today.
- Rebased then onto
|
||
|
|
bf931f82c3 |
gateway: a Codex conversation compacted natively is held to its account only when native compaction is on, and told why when it can't go there (#2642, #2582)
ScarfQian (#2642, still on v0.1.1279): after a native compaction by one Codex account, routing to another answered 400 "only that key or account can read the compaction it sealed ... switched off, removed, or no longer serves". Three causes, one fix each: - #2582 (Dony2050, ump45nose's patch): one of Codex's own models asked on the backend path through magpie's accounts (codexAccounts) kept the compaction_trigger whatever the codex provider's native compaction setting, so every compaction was sealed by and recorded to one account. It is now decided as a magpie model's is: codexInputAs with nativeCompactionFor("codex/<model>"); off (the default) gives codexCompact's magpie1: summary, which any account reads, and records no writer. Unlike ump45nose's branch, /responses/compact and Codex's own single sign-in relay are left as they were: the legacy endpoint's body has no trigger for codexCompact to answer, and a lone sign-in has no other account to move to. - ggbdpq's fix (0ab41eba0, e1646488d, ported as is): a writer whose own model list has since dropped the model sat in planned.left, out of the candidates, so checkpointReaders never found it and refused although it was on. It is now taken back from planned.unlisted (plan, planLevel and the nested weighted plan), its row moved from left to order. sealedReaders, run before it for a sealed subagent task, narrows unlisted too (sibling). - A request carrying a recorded seal while only Codex's own sign-in is on was relayed as it came (codexAccounts false), so with the writer switched off the one account left was sent it. codexSealedFor routes it through serve, where checkpointReaders holds it to the writer. - checkpointError now says the reason magpie's settings give (checkpointGone: provider removed, account signed out, sign-in lapsed, paused while others are on, switched off, kept from the model in Names & levels, key off or gone, model disabled, or the model/group asked for not routing to it), the fix for that reason, and whether native compaction is on for the writer's provider now. The old catch-all sentence is gone. The seal is still treated as readable only by the account that wrote it, as #1099 and #2271 found; chestnutLeeeee's report that another account read one in a direct canary was not tried here (no real accounts). Tests (fake ChatGPT backend, sandbox HOME, nothing on the network): TestCodexOwnModelCompactionHonoursTheToggle (off: summary, no trigger upstream, no writer; on: native seal kept, writer recorded), TestNativeCompactionWriterGoneSaysWhy (spare switched off, own paused, Names & levels, signed out), ggbdpq's TestNativeCompactionWriterWhoseListLacksTheModel and ...ThroughAGroupWhoseListLacksTheModel. All four are red on |
||
|
|
5b12407e8e |
gateway: a custom tool a Responses upstream turns away is translated, not given back as a 400 (#2656)
DeepSeek's Responses API answers Codex's exec, a custom tool, with 400 "Unsupported custom tool: 'exec'. Only 'apply_patch' is supported." The relay (attempt -> passthrough) sent the tools as they came, so the translation that offers a custom tool as a function and gives its call back as a custom_tool_call never ran, and the 400 matched no word list, so a group's next member wasn't asked either. - passthrough: a 400/422 matching customToolRefusal, on a Responses body that offers a custom tool (tools, a namespace's, an input item's tools), marks the model (customToolRefused) and returns not done. - attempt: then, and on a marked model's later requests with a custom tool, the request is translated on the client's own API (ownAPI), so exec keeps its name and comes back as custom_tool_call. A Codex compaction (keepsCompaction) isn't translated and gets the refusal. - shapeRefused also takes customToolRefusal, so where the refusal does reach a group, the next member is asked and nobody rests. Not scoped to DeepSeek: any Responses relay (key, plugin) that says its custom tools are unsupported is handled the same; an upstream that never refused them still gets them as sent (tested). Tests: custom_tool_test.go, fixture from the reporter's literal error text and request. TestCustomToolTranslatedWhereRefused (stream and not), TestCustomToolRefusalInGroup (reporter's ordered group, next member asked 0 times), TestCustomToolRefusalWordings. Broken by hand: passthrough branch off -> both request tests 400 with the reporter's exact message; attempt pre-skip off -> next turn asked 4 times, not 3; shapeRefused addition off -> Wordings red. Run: - gofmt -l clean; go vet ./... (darwin), GOOS=linux and GOOS=windows go vet -tags nogui ./... clean, at the pushed head. - Full go test -tags nogui -timeout 45m ./... on |
||
|
|
85eef5d87a |
gui: quota refreshes stay centered and finish each turn without jumping (#2397)
chiperman's patch (df288db, #2397), landed here since external PRs are collaborators only. The card redraw replaced its refresh button on a background reading and again when the click finished, restarting its rotation and hover reveal and moving the Updated text; a fast reply also stopped the spin partway through a turn. Each account's control and its animation are kept through redraws, the reply is shown at once and the current 800ms turn finishes (at least one), Reduce Motion skips it, and the glyph sits on the text baseline in an inline grid instead of a pixel offset. Changed in landing: main had since given the tray panel's Allowances the same quotaRefresh (#panelQuota, #840). A kept button is reused only when its redraw took it out of the page, so a refresh started on the Usage page is never moved out of the panel (or back); the other place's copy of a turning control gets busy+spun and turns by itself until done() clears it. The panel's hover rule (.pq-card:hover) reveals it as the Usage card's does. quota-refresh-order's vm harness gets a document stub for that. app.js's budget goes from 1,250,000 to 1,269,000: with four comments shortened it is 1,250,904 here, the core's own code since the tray panel draws the same control, plus 1.5% as the budget's comment asks. Every core script together is still under coreScriptBudget, which is unchanged. Run, sandbox HOME, pinned GOMODCACHE/GOCACHE, load ~110-360 from other sessions' suites: - Full suite on |
||
|
|
252bc61ce9 |
agent: a caller key of the gateway's own in Claude Code's and Codex's config survives a model pick (#2545)
What changed: - writeTiers (claude.go) wrote env.ANTHROPIC_AUTH_TOKEN = wiredKey() on every model and tier pick, and putProvider beside the thread-provider tables (codex.go) wrote experimental_bearer_token = at.gwKey() the same way: a caller key of the gateway's own the user put in their place was written over, and it was never stashed, so no Disconnect brought it back. Both keep such a token now, as a sync keeps one (mergeKept, keyHolds of #2510): only a value the gateway would refuse is wired over. The sign-in field's own Set is unchanged, as that switch is the user's own. - The sharing key magpie itself made is never one of those: access.Default says a secret is the default key ConfigureLAN keeps, sharing on or off, and the two write points ask it before keeping what they hold. With sharing off the key stays enabled in the store, Authenticate still took it, and keyHolds held it for the user's — Rekey could no longer bring gateway.Token back (TestRekeyGivesWSLAgentTheSharingKey, deterministic red on the first cut of this patch, found in review). Claude has no WSL twin: the sharing key reaches it by an address beyond loopback (MAGPIE_ADDR), and a pick kept it the same way there, so TestClaudeSharingOffWiresGatewayTokenBack holds a sharing on, then off, to gateway.Token. - docs/subsystems/agent-wiring.md's sentence about a hand-set key said Check reports it; Check has taken one since #2510, and a pick keeps it now too, the sharing key excepted. Patch by ggbdpq (c809f7ad), the second cut after review: the first (835d3bf8) turned TestRekeyGivesWSLAgentTheSharingKey red, as the sharing key stays enabled with sharing off and was kept as the user's. Applied unchanged on |
||
|
|
cb05dc2d1b |
sessions: CodeBuddy Code's own sessions are listed on the Sessions page, resumed with codebuddy --resume and deletable (#2657, caozeal)
CodeBuddy Code keeps its sessions as WorkBuddy does, ~/.codebuddy/projects/<cwd>/<id>.jsonl. magpie read them for the calls ledger (#1779) but never listed them: allFiles() and Dirs() left them out, parserFor sent them to the Claude parser, and Deletable didn't name the agent. caozeal's branch (85cc186a2) adds them to allFiles, Dirs, parserFor (workbuddyLine) and Deletable, with the meta cwd fallback WorkBuddy has, and the ledger reads through the same list. On top of it: the resume command is `codebuddy --resume <id>` (its CLI's `-r, --resume [sessionId]`, read from @tencent-ai/codebuddy-code 2.168.2's dist/codebuddy.js; codebuddy is one of the package's three bins). The Sessions page's and Usage > Sessions' agent label come from the agent registry (CodeBuddy Code, codebuddy-color) and needed no change; a test now holds them. Fixtures are the real `codebuddy -p` runs already in internal/sessions/testdata/codebuddy (#1779). Tests: - TestCodeBuddy (caozeal's, extended): two sessions with their cwd, title and model tokens; the resume command on each OS's form; Deletable. - TestCodeBuddySessionsListedUnderTheirName (new, internal/gui): /api/sessions, /api/sessions/manage and /api/sessions/stats name them CodeBuddy Code with its icon, resume command and trash. - Broken by hand, each red: allFiles reverted and parserFor reverted ("want 2 CodeBuddy Code sessions, got 0" in both tests), resume reverted (resume ""), Deletable reverted ("not deletable", "offers no trash"). Run at |
||
|
|
7660399a12 |
gui: a provider's Claude model chip says the number Claude Desktop's menu shows beside it (#2578)
jerrychoi (#2578) has two providers serving the same Claude models, and Claude Desktop's menu tells them apart only by a 10-digit number. The provider editor now shows that number on the model's chip. From ggbdpq's patch (dcb00beb5), changed after reading desktop.go and Desktop 2.7032's app.asar: - Desktop renames a row to its own catalog's name ("Opus 5.5") only when the id resolves into that catalog, which is the magpie-<n>.anthropic.<model> form claudeLooking gives a Claude model with reasoning levels. Every other row is named by our display_name (which already says the provider) or by its own id, and its number never shows in the menu. The patch put a number on nearly every chip; DesktopNumber now returns one only for the .anthropic. form ("" for mythos-magpie-<n>, anthropic/magpie-<n>, own ids and groups). - The number shows only while Claude Desktop is installed, and only for a model Desktop is shown (CatalogFor("claude-desktop"), not the whole catalog, so a model hidden from Desktop gets none). - The numbers are worked out once per Providers page build, not once per provider. - The GUI test runs en and zh at 900px and en at 420px in both engines and checks the badge sits inside its chip. - docs/subsystems/agent-wiring.md says why the number is there. The badge reuses the muted .badge.ctx pill beside the context size. Its tooltip is in zh, zh-TW, ja and de (ggbdpq's strings). Broken by hand, each watched red then restored: - ggbdpq's DesktopNumber: TestDesktopNumber red for glm (mythos), glm (anthropic/magpie) and a group led by Claude; the GUI Go test red for m2. - the installed check removed: red "without Claude Desktop, claude-opus-5-5 says desktop ...". - provider.Catalog() in place of CatalogFor: red for the hidden haiku. - j.Desktop dropped: red for claude-opus-5-5. - app.js without the badge: model-desktop-number.test.cjs 0 passed. Run (macOS arm64, sandbox HOME, pinned GOMODCACHE/GOCACHE): - model-desktop-number.test.cjs 6/6 in chromium and webkit (en, zh at 900px, en at 420px); screenshots checked: zh at 900px shows "Opus 5.5 [number]" as a muted pill, Sonnet none. - Go, this tree, as 1160f2e7d before the bodies were reworded (with the #2576 commit, on origin/main |
||
|
|
b566745b8a |
gateway: the model list says each model's reasoning levels as plain names too, for Catwalk clients (#2576)
Clients of the Catwalk schema (Crush and kin) read reasoning_levels, a
flat array of names, to know which reasoning efforts a model takes, and
drop reasoning_effort from requests to a model that names none. magpie's
/v1/models said the levels only as objects (supported_reasoning_levels,
[{"effort":"low"},...]), which such a client reads as none (cyancity).
modelObject now also says reasoning_levels: the same e.Efforts in the same
order, [] when there are none, never null. The objects stay as they were.
Every row built by modelObject carries it: the provider/model rows,
routing groups, bare ids, /v1/models/{id}, deciders, and Claude Desktop's
and Claude Science's lists. Muse's list has its own shape and the
image/video rows say no levels, so neither changes. No gateway default
for thinking, no thinking/enable_thinking aliases and no
default_reasoning_effort, as decided on the issue. Docs: reference.md,
integrating.md and the site's integrate page (en, zh) name the field.
ggbdpq's patch (base
|
||
|
|
e085d6e926 |
cli, gateway: magpie heap writes the running magpie's Go heap profile, with its memory numbers
A user on X (FatimaHill74421) reports the macOS app at 3.95 GB physical
footprint after ~12h (v0.1.1273, after 8a1b5916f's #2278 fix), and a macOS
`sample` shows Go's frames as ???. `magpie heap [<file>]` asks the magpie
that serves the gateway for GET /v1/magpie/heap: runtime/pprof's heap
profile after a GC (gzipped protobuf, go tool pprof reads it), with
HeapAlloc, live heap, HeapInuse, HeapSys, StackSys, Sys, NumGC and the
goroutine count in X-Magpie-Heap-Stats. It writes <file>, else
magpie-heap-<date>-<time>.pb.gz here (0600, never over a file), and prints
the path, the pid and the numbers. --help writes nothing; an unknown flag,
"-" or a second file is refused before anything is asked.
The route answers only a loopback, unproxied caller with no browser marks
calling localhost or a loopback IP. heapRefused checks this in the handler
itself, so a gateway key never lets in another machine, a listed page,
Origin null, a localhost page or a rebound Host, and it holds where Handler
is served without lanGuard.
Run at
|
||
|
|
df341e7671 |
gateway: a member that answers a stream request with a whole reply is asked once, not again and again (#2455)
An upstream that answers stream:true with a whole JSON reply (a relay that doesn't speak SSE) fails as a 502 "did not stream". magpie read that 502 as a failure a moment may mend: the same-one retries (passing) asked it twice more, then a group's patience (busy, #1418) kept asking it until the budget was spent. The failure is the same however often it is asked. With production pauses that is about 7 requests and 60s at the default Patience, about 14 at 240s; the test's 1ms pauses let the 12 replan rounds run out first, 15 requests (ggbdpq's correction on the issue). busy() and passing() now leave a body that says didNotStream alone, and the four places that word the error (translate, streamTranslated, askTranslated, holdWriter.settle) share that constant. A group still moves on to the next member, whose API may stream; retryable() is unchanged. Patch by ggbdpq (f9e09ca7), applied on main with the docs sentence placed by hand (the hunk no longer applied). Run: - TestStreamlessMemberIsAskedOnce with both exclusions taken out: FAIL, whole and stream ("asked 15 times"); with only busy()'s: FAIL ("asked 13 times"); with only passing()'s: FAIL ("asked 3 times"). Restored: ok (asked once, the agent gets the 502 naming "did not stream"). - TestStreamlessMemberHandsOnToTheNextMember (b, which streams, answers after a): ok. - TestQuietNotAReplyLastFails, TestPatience*, TestStreamOverflow*, TestCodexOverflowInGroupNotAskedAgain, TestAgentGoneInTheRetryPause, TestRelayInputCap, TestOverflowGoesToAMemberWithRoom: ok. - Full suite, go test -tags nogui -timeout 45m ./... (set -o pipefail, sandbox HOME, load ~350) at 0224e826f (these four commits on |
||
|
|
ae98cda651 |
gateway: an inner group's own Patience waits out its busy members through an outer group (#2410)
serve read Patience only from the group the request named (g.Waits()). planLevel stamped a nested group's FirstToken (#2246) on its candidates but not its Patience, so an inner group's budget was never read through an outer one: an inner 4 min under an outer default gave up at 1 min, and an inner Off was still asked again for 60s. Each candidate carries the innermost Patience that is set on its way down (innerPatience, as innerFirstToken). waitsOf reads it as Group.Waits does, falling back to the asked group's when unset; PatienceOff keeps the member out of replan. replan counts each member's budget from waitFrom and asks again only those with budget left past the pause; the hold on the last failure lasts while any member's may (maxWaits), and the trace's Patience is the member's own. With no nested Patience set, every member's budget is g.Waits(), as before. Patch by ump45nose (61b1c17c); ggbdpq checked it against main on the issue. Review changes: the docs sentence was placed by hand (the docs hunk no longer applied), and the tests' budgets moved from inner 8s / outer 3s to 10s / 4s, so every round's pause ends 2s or more from a budget line (it was 1s from the 3s line), as a timing test leaves room on both sides. Run: - With fallback.go, gateway.go, patience.go and patience_test.go put back to main: TestNestedGroupPatienceThroughOuter FAIL ("a.n=2, want 3 — the inner group's 10s budget was not read"), TestNestedGroupPatienceInnerOff FAIL ("code=529 a.n=13 (want 529, 1 — no replan)"). With replan reading only the fallback budget: ThroughOuter FAIL the same. Restored: ok. - TestNestedGroupPatienceFallsBackToOuter, TestGroupWaitsOut*, TestPatienceIsUsedUp: ok. - Full suite, go test -tags nogui -timeout 45m ./... (set -o pipefail, sandbox HOME, load ~350) at 0224e826f (these four commits on |
||
|
|
08400f4ebd |
gateway: a byte cap after the stream has begun says request_too_large, so Pi compacts (#2533)
A vendor's 413 that came after the stream's headers had gone out (a keepalive sent while the vendor was quiet) reached Pi as a stream error of type api_error saying "413 Request Entity Too Large". Pi compacts only when the error's text says request_too_large (overflow.ts), so the turn stopped. A 413 before the headers was already typed request_too_large (writeErrorSaid, |
||
|
|
ebf3f48f7f |
usage: a reported call takes first_text_ms and flow_ms, so a reasoning reply tells its speed and a burst is held (#2637)
POST /v1/magpie/usage/requests turned away first_text_ms and flow_ms as
"not a field a reported record takes", so a reported reasoning reply was
timed from its first reasoning token and a burst-at-the-end reply was
never held. The ingest now takes both, validated like ttft_ms (whole
milliseconds, 0..ingestMaxMillis, null = unset), and checks:
- first_text_ms <= ms, and first_text_ms >= ttft_ms when both are set
(the first text is content too);
- flow_ms <= ms*10/8+1, since the gateway's flow is the tenth-to-nine-
tenths span scaled by 10/8 and can exceed ms.
The fields reach usage.jsonl through the Record, so DecodeOf, Row.Decode
(ThinkPace, HeldShare) and the Reported totals read them as they do the
gateway's own rows. docs/reference.md and gateway-sessions.md say so.
Tests: TestUsageIngestTellsSpeed posts the reporter's literal repro
(grok-4.7, out 307, reasoning 129, ms 5035, ttft 4632, first_text 4700:
178 tokens over 335ms), a burst held by flow_ms, an even reply told, and
a ThinkPace hold, and checks the totals. TestUsageIngestTimesChecked
covers each bound, its edge, null and absent fields.
Broken by hand: old code fails both tests (field refused); dropping
FirstText tells repro-1 0; dropping Flow tells the burst 601/4035;
removing the ttft check accepts first_text 299 < ttft 300; bounding flow
by ms rejects the valid 1501.
Run at
|
||
|
|
333c167575 |
routing: a rule can set the reasoning its model is asked for (#2633)
dengtongcai asked for a routing rule that picks both the model and the reasoning it is asked for (a quick question goes to a cheap model at low). A rule now has an output field, useEffort (low|medium|high|xhigh|max). When the rule matches, its member is asked for that effort. A member's own fixed effort still wins. Otherwise the rule beats the model's suffix, the turn's pick and the agent's pick. The existing effort condition is unchanged. - The value is fitted to the model's levels (max -> high on a model that tops out at high). A model with no Efforts is sent what the agent asked, untouched. Unset changes nothing. Failover members are not affected. - The trace records it: Rule.UseEffort and the try's RuleEffort (the second Try construction in the candidate loop was missing it). - Saving a group rejects an unknown value or one on a pause (cleanRules). The CLI takes use-effort=; the TUI and CLI lists show " at <effort>". - GUI: a chip after the rule's model, picked from the app menu (pickFrom, no native select), set/changed from the rule's menu. A pause clears it. Strings in zh, zh-TW, ja, de. - A Gemini-protocol client is left unchanged, as with every effort magpie sets. - Docs: docs/subsystems/gateway-routing.md; site docs intent and start (en, zh, ja). What was run, at d4c03a2c5 (rebased on |
||
|
|
df3734b959 |
proc: the login shell's variables count only when exported, and Codex's proxy detail names the variable it read (#2627)
ReneXiong: Codex showed the "proxied" drift, "through the proxy at
http://127.0.0.1:7890, set in HTTP_PROXY", while Codex went direct. The
value was fish's universal http_proxy from an old Clash setup, never
exported (`set -S` says "unexported"), so no program fish starts has it.
shellEnv asks fish beside the login shell (zsh), and shellProbe printed
"$http_proxy" in the shell itself, which expands unexported variables too;
mergeShellEnv then filled zsh's empty value with fish's.
Fix at the shared reader: every shell is now asked to run
/bin/sh -c 'printf ... "$PATH" "$CODEX_HOME" ...', the form nushell already
used (still with its ^). A child sees only exported variables, so each
value is what an agent started from that shell gets. This covers every
reader of the probe: Codex's proxy (codexEnv), Claude Code's provider
switches (claudeShellEnv), and agentenv.Vars such as CODEX_HOME and
CLAUDE_CONFIG_DIR that magpie takes into its own environment; an
unexported zsh or bash variable no longer counts either, which matches what
an agent run from that terminal sees. Proxy variables are still merged from
fish when the login shell has none: a fish user who exports one runs Codex
with it from fish, so taking proxies from the login shell only (the
report's other suggestion) would miss that case.
codexProxyFor named HTTP_PROXY (or HTTPS_PROXY, ALL_PROXY) for a value in
the lowercase variable. It now names the one it read, in both the reqwest
and respect_system_proxy paths, and the detail's NO_PROXY advice matches a
lowercase name too (and not "the system's proxy settings").
Other proxy readers checked: the daemon's carried env, wslrun's proxyVars,
netproxy and the plugin host read magpie's own environment, not a shell;
the WSL probe scripts ask for no proxy variable.
Tests: TestLoginEnvUnexportedNotCounted, a login shell with the reporter's
literal values unexported beside an exported NO_PROXY; TestShellEnvRealFish
now writes the reporter's literal fish_variables lines and checks that
http_proxy, https_proxy and all_proxy read empty;
TestCodexProxyNamesItsVariable. Broken by hand, each went red: the old
in-shell printf (unexported values read back, in the fake shell and in real
fish 3.7.1), and env() naming keys[0].
Run: go test ./internal/proc and the codex proxy tests on darwin;
TestShellEnvRealFish, TestShellEnvFishLogin and
TestLoginEnvUnexportedNotCounted on real fish 3.7.1 in an alpine container
(linux/arm64), green with the fix and red without it; gofmt -l clean; go vet
-tags nogui ./... for darwin, linux and windows; the full go test -tags
nogui -timeout 45m ./... under pipefail, both fixes together on
origin/main
|
||
|
|
ed0335f75c |
gateway: an assistant turn cut off before it said anything is left out of what a Chat upstream is sent (#2599)
timonwong (#2599): after the user stops a reply while the model is still thinking, the agent keeps a turn with no text and no calls and sends it again on every later turn. Translated (buildChat) or relayed, it reached the Chat upstream as {"role":"assistant","content":""} (reasoning_content alone, on DeepSeek), and DeepSeek and Kimi turned every request of the conversation away: "Invalid assistant message: content or tool_calls must be set". One rule, withoutSilentAssistants (chat.go), runs on both Chat routes: buildChat before pairToolMessages (Claude Code, Codex and Gemini clients, and the plugins fed by buildChat), and silentAssistantsOut in passthrough next to developerAsSystem (a Chat client's own body). An assistant message with no content or only blank text parts, and no tool_calls or function_call, is left out; the user messages it stood between join into one (texts with a blank line, else their parts in order), so no two user messages stand in a row. A prefill (prefix, partial, a Resume), a legacy function_call, a refusal and an audio reply stay. A relayed body without such a turn goes byte for byte. TestChatThinkingOnlyAssistantKeptOutside- Exchange pinned the old pass-through; it now expects the joined message. Built on ggbdpq's patch (cb438ebb on their fork) and its fake upstream, written again because the review found it missed shapes the issue names: - after a tool result it kept the empty turn ("a strict template wants the reply behind its tool message"), so the interruption mid tool loop still sent content "" and still got the 400. tool then user is what any agent sends when the user writes after a tool result; it is now left out. - the relay dropped an assistant with a legacy function_call or a refusal and empty content, and a client's own prefix/partial prefill; kept blank text-part arrays (still refused); joined only string users; re-marshalled with HTML escaping. - its Resume check compared a joinSplitCalls turn index with len(r.Messages)-1. Verified (sandbox HOME, pinned caches, go1.26.8 darwin/arm64, base origin/main |
||
|
|
ec64543952 |
claude: a switch gives a Claude subscription's run the agent's instructions as its system prompt, in place of Claude Code's
Every request through a Claude subscription is answered by the real
Claude Code, which sends its own system prompt, with the agent's
instructions in the run's first user message. Settings › Replies › Short
Claude system prompt (claudeLeanPrompt, off by default) starts the run
with --system-prompt-file holding the agent's instructions instead
(without a client Claude Code's billing line, plus the tool-choice
line), and the first message holds the conversation alone. The file is
under the distro's mount in WSL. A request with client cache marks
(#1717) is never lean. The mode is part of the run's identity, so a run
started in one mode never takes the other's turns. The row says the
risk: requests look less like Claude Code's own.
Measured with a real Claude subscription, Sonnet 5.5, Claude Code
2.1.301, off then on:
- chat client, ~600-token prompt, 2 tools, 3 turns: 10,048 -> 6,580
input tokens (-35%)
- claude -p as the client, Read and Bash, 4 requests: 85,453/85,471 ->
81,948/81,977 (-4%)
A fixed ~0.9-1.2K tokens a request.
Run at this head (rebased on
|
||
|
|
72d6103e28 |
gateway: a Chat tool in MCP's or another API's shape goes upstream as a Chat function tool (#2622)
jinyue806 (#2622): ZCode sends its tools on /v1/chat/completions in MCP's shape, {"name","description","inputSchema"}, with no type and no function object. magpie relayed them as they came, and SenseNova turned every request with tools away ("field Tools[0].Type invalid, should be set"; a flat {"type":"function","name":…} got "function cannot be empty"). A missing type is invalid Chat Completions for every upstream, not SenseNova only, and the translated routes were broken too: parseChat read no name from such a tool, so Messages and Responses upstreams were offered a tool named "". shapeChatTools puts a tool with its name at the top (no type, or type "function" without a function object) into {"type":"function","function": {name, description, parameters, strict}}, parameters taken from parameters, inputSchema or input_schema; other fields stay beside it. It runs right after liftMessageTools at the same two choke points: handle, for every Chat body before routing (relay, schema fixers, redaction, plugins), and parseChat, for a body that never came through handle. A tool that has its function, a hosted tool (any other type) and one with no name are left alone, and a request with nothing to shape is relayed byte for byte. Verified: - TestChatToolInAnotherShapeIsShaped sends the reporter's curl body with each of the four tool shapes from the report through the Chat relay, Messages and Responses. With shapeChatTools made a no-op by hand all 12 subtests FAIL: relayed as {"name":"f","inputSchema":{…}} as it came, and translated as {"name":"",…}. TestShapeChatToolsLeavesChatShape (byte for byte on Chat-shaped/hosted/nameless tools; strict and cache_control kept) FAILs on the same break. Both pass restored. - gofmt -l: clean. go vet -tags nogui ./... for darwin, linux, windows: ok. - Full suite at |