fdf5e2c65f71f4e7d91c3660456f0ee490a79bcd
5504
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fdf5e2c65f |
cli: claude-tui-helper ends on a signal its own way, not of magpie's handler
magpie's process-wide handler (endProbesOnSignal) re-raises SIGTERM. In claude-tui-helper it killed the helper (exit -15) before the shim's own handler could stop its Claude Code and remove what it wrote, so a run the gateway aborted left them behind. The helper's command now lets go of those signals (leaveSignals) before claudetui.Run. Run: go test ./internal/claudetui ./internal/cli on mote (macOS) and in WSL magpie-desktop (-tags nogui), ok; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build on mote, ok. Broken by hand: without leaveSignals, SIGTERM to a real helper in the sandbox gateway exited -15 and left its temp folder; with it, exit 1 and the folder removed (termimg.py). Not tried: SIGHUP from a closed terminal. |
||
|
|
cac606be1a |
provider: Cursor's mover min is 0.2.33, free credit on the card (CryptoSarom on X)
CryptoSarom on X: magpie didn't read Cursor's bonus credit or the limits
on spending it. The plugin (magpie-community/plugins 00de68a,
@magpie-community/opencode-cursor-auth 0.2.33, on npm) now shows two
things on the Usage card, both aside so they never stop routing:
- the plan's bonus, from GetCurrentPeriodUsage planUsage.bonusSpend and
remainingBonus, as "+$X on us" (the IDE's "free usage on us" line);
- each active credit grant, from DashboardService/
GetUsageLimitStatusAndActiveGrants activeGrants: spent / total, its
expiry, and the models (allowed_model_ids, tags, selections) or
clients (allowed_client_types) it covers.
A pool spent while a grant that cursor-agent ("cli") can use still has
money left no longer stops the models that grant covers. The field
names come from Cursor's own schemas, in the IDE's workbench bundle and
cursor-agent 2026.10.01, and from real replies on the owner's account.
This commit raises keepMovedCurrent's min so moved users get it.
Run:
- plugins: bun test packages/cursor on mote, 79 pass 0 fail
(credit/usage/included-only), and the full suite before that;
bun scripts/check.mjs cursor.
- the real account's card through 0.2.33, in a sandbox HOME, read only.
- here: gofmt -l internal/provider (clean), and
mote-run go test ./internal/provider/ -timeout 45m: ok (98.5s) at base
|
||
|
|
9d4a4bfd3f |
gateway: a late Claude Code call tells the client after 500ms, not 1s
In Claude Code's interactive mode a call of a client's tool waits callFirst for its message in the transcript before the call tells the client itself. Measured on a real account (a probe build logging the time from the MCP call to the transcript's tool_use), a message written before its call was read 118 to 162ms after the call came in, 8 calls of 8. 500ms leaves it room and halves what a late message costs. Run: go test -race -count=3 -run 'TestClaudeTUI|TestSubscription' ./internal/gateway on mote, ok. Real account (claude-haiku-5-5, sandbox HOME, interactive TUI): 9 runs of the one/two/text scenarios, all ok, every call told once with its own id; 1 took the late path, none fell back to -p. Not tried: sonnet/opus, Linux. |
||
|
|
e647a1fd54 |
plugins: an npm registry of the user's own is used for installs and lookups (timwangdev on X)
timwangdev asked on X for plugins to take a custom npm registry. Zero-config
first: Registry() (internal/plugin/registry.go) takes, in order, the one set
in magpie (settings npmRegistry: `magpie plugin registry <url>|default`, or
Plugins › Discover's new npm registry row), BUN_CONFIG_REGISTRY /
NPM_CONFIG_REGISTRY / npm_config_registry in magpie's environment, then the
login shell's (cached probe only, proc.LoginEnvKnown, never waits on a
shell), install.registry in the plugins folder's or the user's .bunfig.toml,
registry= in the plugins folder's or ~/.npmrc, then the 国内镜像 switch's
npmmirror, then npm's own. The switch no longer puts npmmirror over a
registry the user named: before, bun was handed BUN_CONFIG_REGISTRY=npmmirror
whenever it was on, over the user's .npmrc. bun is told the registry only
where it wouldn't find it itself (magpie's setting, the shell's, the
switch's). magpie's own npm questions (latest version for the market,
Update and the hourly check, README, search) go to the same registry, a
package's @scope:registry= to that scope's, with the .npmrc's
//host/path/:_authToken (${VAR} expanded, longest prefix) sent to that host
alone, dropped on a redirect to another host, never logged or shown.
Download counts stay npm's. Only http(s) with a host, no userinfo, query
or fragment is taken; anything else is refused and not saved, and a bad
value hand-written into settings.json is passed over. /api/plugins says
which registry is in use and where it came from.
The GUI row is in registry.js, imported when Discover draws it, so the
core script budget isn't raised (plugins.js is 292 bytes smaller than
before, one long comment there condensed).
Left out: bunfig [install.scopes] for magpie's own lookups (bun reads them
for installs), .npmrc _auth and username/password, NPM_CONFIG_USERCONFIG
and npm's global npmrc, and internal/agent/cliupdate.go's agent CLI update
lookups, which still ask npm's own.
Run (mote and wsl-run). First at this change on
|
||
|
|
45de2ddb96 |
provider: a provider the user counts free goes first under Free first (jiabubu on Discord)
jiabubu asked on Discord #help for a way to mark a provider, model or key
as free, so that Free first routing spends it first. Their example is
ModelScope, which has a free daily quota. Until now routes.Seat.Free
came only from the vendor catalog's Free flag, and there was no way for
the user to set it.
Provider.CountFree ("Free for me" in the provider editor's Advanced fold,
`magpie provider set <id> free=yes|no` in the CLI) makes FreeModel true
for every model of that provider. Routing therefore treats it like a
vendor's free model: Free first uses it before paid ones, and Cheapest
first weighs it at nothing, because PriceAt, which only routing reads,
returns 0 for a free model. Prices shown (ListPrice and the model list)
and the costs Usage counts (EffectivePrice) are unchanged. The mark says
what to spend first, not what a call cost, and a quota that runs out
still bills at the listed price. Key and account (subscription)
providers both carry it, through withPicks, the account literal and the
copy merge.
Tests:
- internal/gateway TestFreeFirstSpendsTheProviderTheUserCountsFree:
- a Free first group [paidv/m, mine/m] sends its first call to mine
once mine is marked, and the trace row says Free;
- EffectivePrice is still the listed 3/15;
- Cheapest picks mine first;
- unmarked, paidv goes first again.
- internal/gui TestProviderSaveKeepsCountFree: the preset and typed-in
providers save the mark and clear it, and /api/providers reports it.
- internal/cli TestProviderSetFree: free=yes and free=no work; the value
shows in `provider <id>`; free=maybe, an empty value and --help are
refused and change nothing.
- GUI internal/gui/tests/provider-count-free.test.cjs covers the
ModelScope preset, a custom provider saved with the mark, and a Codex
account. It runs chromium and webkit, in en, zh, zh-TW, ja and de, at
widths 900 and 440. It checks the Advanced fold, the check and save
POST bodies, that the row fits with no sideways scroll, and that each
string has a translation in I18N.
Core script budget: rebased on
|
||
|
|
c799934e1b |
claude: the gateway logs why a run is -p
Finding why the real-account runs went -p (the previous two commits'
end-to-end) took reading a run's stderr by hand: the bridge keeps Claude
Code's stderr for an error only, and claudeTUI said nothing of why it
chose -p.
claudeTUI's conditions move into claudePrintWhy, which names the one
that held ("Claude Code in WSL", "a JSON schema", "the interactive mode
is turned off", ...), and claudeTUI logs "claude: this run is -p: <why>"
(not in the tests' binary, claudeTUIRuns off). lockedWriter logs the
helper's "claude-tui: ...; this run is -p" line (a failed start, an
untrusted folder, the 30-minute mark) as "claude: ...". The rest of
Claude Code's stderr is kept as before and not logged.
Run:
- mote: go test -count=1 -run TestClaudeTUI ./internal/gateway ok:
TestClaudeTUIChosen now checks each case's reason,
TestClaudeTUIFallbackLogged the helper's line logged and nothing else.
go vet ./internal/gateway on darwin, linux, windows; gofmt -l clean.
- Real account, sandbox HOME, a gateway on this build: before the trust
fix, the helper's line is what named the cause ("Claude Code ended
before it showed its prompt (exit status 1): B").
Broken by hand: the log in lockedWriter taken out:
TestClaudeTUIFallbackLogged red (logged "").
Not tried: the log on Linux.
|
||
|
|
123d72be68 |
claude: a call Claude Code makes before writing its message is the reply
In the interactive mode the bridge learns of a call from the session's
transcript. Claude Code sometimes writes the message holding a client's
tool_use only after that MCP call returns (4 of 8 real runs before this).
The call waits on the client, and the client waits for the call it was
never told of: a deadlock until the run's timeout.
mcpCall now hands each call to run.onCall, which readOutput sets for a
TUI run. If callFirst (1s) after the call it isn't in the transcript yet
and still waits, the call itself becomes the reply: a message with one
tool_use and stop tool_use, with the MCP helper's id, name and arguments
(the id is the transcript's, from _meta "claudecode/toolUseId"). The
message written after such calls is the late one: its rows aren't told
again (lateID), a call in it not yet told is told by its own turn
(written), and its usage is counted in the next reply. Such a reply has
no words or thinking; the model's text before its call is lost to the
client. -p runs don't set onCall and are unchanged.
docs/subsystems/claude-subscription-bridge.md has the paragraph.
Run:
- mote: go test -count=1 -race -run TestClaudeTUI ./internal/gateway ok
at this tree; earlier, -race -count=5 of the new tests ok.
- TestClaudeTUICallBeforeItsMessage (output 47 = late 40 + answer 7),
TestClaudeTUICallAfterItsMessage (told once, output 7),
TestClaudeTUIParallelCallsBeforeTheirMessage (written after both, and
between).
- mote: go vet ./internal/gateway on darwin, linux, windows; gofmt -l
clean. go test -timeout 45m ./internal/gateway ./internal/claudetui
./internal/claudebridge ok before the previous commit's rebase
(gateway 522s); a run with all three commits is going.
- Real account, sandbox HOME, a gateway running this build, haiku: "two
calls in one message" logged "Claude Code called get_secret before
writing its message; the call is the reply" for both calls, and the
client got red then blue as two replies and the answer naming both
secrets. One call, and words then a call: answered from the
transcript. Every row "entrypoint":"cli".
Broken by hand: onCall never called: the three tests red ("deadlock").
lateID never set: the late message told again, red.
Not tried: sonnet or opus in the real run (haiku only); a call whose
client takes longer than the run's timeout.
|
||
|
|
faaba45236 |
claudetui: the folder-trust question is answered Yes only once Yes is drawn
The real-account end-to-end through a running gateway found every interactive run going to -p. The gateway's working folder (magpie-claude-work-<uid>) wasn't yet trusted under the account's config dir, so Claude Code 2.1.314 asked whether to trust it, with "No, exit" chosen. The helper pressed down and then, 300ms later, Enter without looking. Its down was lost when sent as the question was first drawn (the question is drawn again on No), Enter chose "No, exit", and Claude Code ended with status 1 (screen: "B"). The start failure marked the interactive mode broken for 30 minutes and every run went to -p, so v0.1.2266's default did nothing on a fresh account. ready() now reads the choice as the last of "❯ No, exit" / "❯ Yes, I trust" drawn, presses down (at most once a second) while No is chosen, and Enter only on a Yes that stayed drawn for 300ms (trustSettle). The test's fake asks as the real one does: words placed by cursor moves, No chosen first, keys in its first 150ms lost, and drawn again on No; Enter on No exits 1. Run: - By hand: real Claude Code 2.1.314 in a PTY in the gateway's folder, sandbox HOME with a real account's config dir: the question opens on No; a down sent at once is undone by the redraw, one sent 0.3s or 1.5s in moves to Yes. - mote: go test -count=3 -run TestShim ./internal/claudetui ok; go test ./internal/claudetui ok; go vet ./internal/claudetui on darwin, linux, windows; gofmt -l clean. - Real account, sandbox HOME, a gateway running this build (and the next commit's), haiku: a tool call, two calls in one message, words then a call: all answered, every transcript row "entrypoint":"cli", no broken mark. Broken by hand: the old ready() with the new fake: TestShimTrustsWhenTold red, "Claude Code ended before it showed its prompt (exit status 1)", the real failure. Not tried: Linux with a real Claude Code; a Claude Code version whose question words differ (it then waits out 45s and goes -p, marked). |
||
|
|
fa5e86cf2b |
agents: Kimi Code and Kimi Code Desktop requests show their own name and icon, not the raw id and the cube (jiabubu)
jiabubu on Discord (magpie 0.1.2245, Windows, Kimi Code 2.4.1, Kimi Code
Desktop 1.2.1.0): the Routing page's request list drew Kimi Code's
requests as the grey cube and "kimi-code-cli", and Kimi Code Desktop's as
the cube and "kimi-code-desktop".
The request list, Usage and Sessions already take a client's name and
icon from one table, /api/state's clients (agent.Clients). The drift was
in usage.AgentOf: Kimi Code 2.x sends "kimi-code-cli/…", which matched
neither the kimi agent's "kimicli" prefix nor its "kimi-code" alias, and
Kimi Code Desktop ("kimi-code-desktop/…", its bundle's clientName) had
no entry at all, so both kept their raw product names.
- kimi's UA list takes kimi-code-cli.
- Kimi Code Desktop is a client of its own (agents.go's others). It runs
Kimi Code's engine on ~/.kimi-code, so it is set up through Kimi
Code's row. Its icon is the app's own: the 128px entry of build/icon.ico
in KimiCode-1.2.1-win-x64.exe, the installer winget's
MoonshotAI.KimiCodeDesktop 1.2.1 points to on code.kimi.com (sha256
75111cb6…c312, as the manifest says). Nothing was drawn by hand.
- app.js's pngIcons names it (comment shortened, app.js 5 bytes smaller,
budget untouched); app.css's tile rule names it, as icon-tile measures
it solid to its edges.
- Old records re-resolve through AgentOf, so earlier kimi-code-cli
requests read as Kimi Code too.
Guard: TestEveryClientHasNameAndIcon checks that every client has a
name and an icon file app.js's icon() really loads (a PNG only if
pngIcons names it), and that the ids the gateway records by more than a
User-Agent (claude-desktop, claude-science, cursor-local, codex, magpie)
and kimi / kimi-code-desktop are all clients. The cube is allowed only
for the six clients with no logo yet (ante, pencil, openpencil, newmax,
kirocrew, raft), filed as #4487. routing-client-icons.test.cjs draws the
request list from a history fixture and checks names, data-icon, and that
the desktop PNG loads.
Run (mote unless said):
- Red on the old code: TestAgentOf (got "kimi-code-cli" want "kimi"),
TestEveryClientHasNameAndIcon (kimi-code-desktop not among the
clients); routing-client-icons in Chromium on the old app.js
(0/2, the desktop row is the cube).
- Broken by hand: pngIcons without the entry makes the guard fail ("a PNG
app.js's pngIcons doesn't name, so it is drawn as the cube").
- go test ./internal/agent ./internal/usage ./internal/usageapi: ok.
./internal/gui: ok except the ten real-window AppKit tests killed at
their deadline on mote (#4125, #2645). ok with those skipped, after
the rebase.
- go vet (darwin), GOOS=linux -tags nogui and GOOS=windows vet of
internal/agent and internal/gui: ok. gofmt -l: nothing.
- routing-client-icons: Chromium 2/2 on mote, WebKit 2/2 on Linux
(wsl-run; WebKit launch hangs on mote, #4125).
- routing-*, i18n-keys, icon-tile, mono-icon-redraw and
models-add-and-icons in Chromium on mote and WebKit on Linux: i18n-keys
green. icon-tile caught the missing tile entry (fixed here). The other
Routing reds are still being compared against a fresh origin/main copy
in both engines (running at push time). Any that turns out to be ours
gets a follow-up commit.
Not tried: a real Kimi Code 2.4.1 or Kimi Code Desktop 1.2.1 against
magpie (the UA strings come from their bundles: appName kimi-code-cli,
clientName kimi-code-desktop). Only the Windows installer's icon was
read; the macOS app's wasn't compared. Full Go suite to follow the tag.
|
||
|
|
8ee75adbfe |
gui: the Gateway card's state sits centred on its title's line
The owner, on the Gateway page's status card: "这里没有水平对齐". The
state ("运行中", 11px) sat on the 15px title's baseline. A smaller run of
CJK text on a shared baseline reads as dropped below it: the title's ink
ran rows 40-61 of the screenshot and the state's 42-61, so the state's
middle was about a pixel low. .gw .name is now a flex row with
align-items: center and an 8px gap (as .mask-act .name already is). The
state keeps its ellipsis for long text (min-width: 0).
gateway-card.test.cjs now measures the title text's middle against the
state's and allows 0.25px.
Run:
- gateway-card.test.cjs, chromium on mote: 10 of 10 ok. WebKit on mote
hangs at browserType.launch right now (a bare webkit.launch timed out
at 60s, load ~30), so it ran on the Linux box (magpie-desktop): 10 of
10 ok.
- Broken by hand: the old app.css with the new test, both engines, 5
languages, 2 widths: 20 of 20 red, "the state's middle is 0.5px off
the title's".
- All 30 gateway GUI files at once on the Linux box, both engines: 299
ok, 1 red. The red was gateway-caller-keys webkit en:138, the
sideways-scroll read right after setViewportSize. That is #3797, now
commented on. It passed 3 of 3 alone on this branch and on origin/main
|
||
|
|
333e7f573b |
gateway: gateway keys are dragged into the order you want, kept with the keys (alextjy on Discord)
alextjy asked on Discord whether gateway keys can be reordered. They could not: the Gateway page listed them in the order caller-keys.json held them, and nothing changed that order. - access: a "move-key" action puts one key at a place in the list, under the same file lock as every other key change. Nothing else about the key changes, and the sharing key's mirror in settings is left alone (its pointer would otherwise land on another key). - GUI: the Gateway page's key rows are dragged the way search APIs' rows are (shared dragRows, a grip shown on hover only, Alt+Up/Down, the existing "Drag to reorder" title). A refused move puts the list back from the server. New strings in zh, zh-TW, ja and de. - CLI: `magpie gateway-key move <id> <place>` (from 1); list already prints the stored order. - Usage > Requests: the key filter lists keys in the user's order, removed keys after. The Overview stays a ranking by use. Run (worktree at |
||
|
|
74f812eaf0 |
release: the mirror waits up to five hours for magpie-releases, not one (#4488)
On 10-30, magpie-releases' macOS jobs waited about an hour for a
hosted runner while several tags queued. v0.1.2262's build published
all 16 assets at 19:36:52, 62 minutes after its tag. mirror-release
had given up at 19:35:35 ("never published v0.1.2262 with 16 assets"),
so v0.1.2261 and v0.1.2262 never reached this repo's Releases page
until their failed jobs were rerun by hand.
The wait now runs 600 tries 30 s apart (300 min), and the job's
timeout is 330 minutes, under GitHub's 360. A build that really failed
still ends in the same error, only later. Following the magpie-releases
run's own state would end such a wait sooner; #4488 stays open for it.
Run: actionlint .github/workflows/release.yml ok. Not run: a real
release through it (the next tag runs it).
|
||
|
|
2ac423f4f2 |
kimi: a Kimi Code plan model is told always_thinking, dynamically_loaded_tools and its default effort, as Kimi's list says (jiabubu)
jiabubu on Discord (Kimi Code 2.2.0, Windows): Kimi Code's own provider
gives K2.8 Preview and K3.1 Pro the capabilities thinking,
always_thinking, image_in, video_in, tool_use and
dynamically_loaded_tools; through magpie they had thinking, image_in and
tool_use, so Kimi Code offered a thinking switch the models refuse to
turn off, and started K2.8 on high where Kimi's own starts it on max.
Kimi Code 2.4.1's managed provider (packages/oauth managed-kimi-code.ts,
capabilitiesForModel) derives them from /coding/v1/models:
supports_thinking_type "only" -> thinking + always_thinking,
supports_dynamic_tools -> dynamically_loaded_tools, supports_video_in ->
video_in, think_efforts.default_effort -> the default. magpie now reads
the same fields (flat, or nested reasoning.type, tools.dynamic_load,
reasoning.effort.default) into catalog.Model (AlwaysThinks,
DynamicTools, DefaultEffort; kimiFacts), carries them through
provider.Entry and the agent's model list, and the new Kimi Code's table
gets always_thinking, dynamically_loaded_tools and default_effort at the
vendor's default (else high, as before). Only Kimi's list sends these
fields, so another vendor's model is written as before; kimi-cli, which
refuses unknown words, gets none. A routing group has none of them.
default_effort is now recorded in the stash as magpie's (kimiOwn), so a
level the user picked stays while the model has it. A table with high
and no record is read as the high magpie wrote before it kept one, and
becomes the vendor's default (max on K2.8, high on K3/K3.1).
Left out:
- video_in: with type="kimi" Kimi Code uploads a video to
{base_url}/files (purpose=video) and sends the ms:// id. The gateway
has no /files route, and the id belongs to the account that stored it.
Filed as #4485.
- dynamically_loaded_tools works (Kimi Code's tool select is behind
KIMI_CODE_EXPERIMENTAL_TOOL_SELECT): the loaded tools' system message
is lifted into the request's tools (liftMessageTools, #2322), so they
stay callable (TestKimiCodeLoadedToolsReachKimi), but each load
restarts Kimi's prompt cache. Filed as #4486.
- max_output_size: Kimi's own provider writes none; magpie keeps writing
the model's known reply cap (32768 on K2.8 per models.dev), unchanged.
This also covers #3399 (K3.1 offered thinking off): Kimi's list says
"only" for both K3.1 models.
Real list: tests read Kimi's /coding/v1/models reply of 2026-10-31
(internal/catalog/testdata/kimi-code-cn-models-2026-10-31.json, read
with the owner's kimi-code-cn key, no key in the file).
Run (mote, at this commit on origin/main b62fa332f; the agent-wiring.md
line was added after the run, docs only):
- go test -tags nogui -count=1 -timeout 45m ./... : 79 packages ok;
internal/proc (TestNoCommandBypassesProc) and internal/sqlitedb
(TestOnlyThisPackageReachesSQLite) red on a Go module cache my e2e
sandbox had left inside the run folder (vendor files under
e2e-kimi/sb/home/go/pkg/mod); with it removed both ok.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... ok; gofmt -l clean.
- Real Kimi Code 2.4.1 (npm) in a sandbox HOME/KIMI_CODE_HOME on mote,
with a sandbox magpie serve (MAGPIE_ADDR 127.0.0.1:34652), the
kimi-code-cn preset pointed at a fake upstream that serves the real
list: magpie wrote the six tables (K2.8: thinking, always_thinking,
image_in, tool_use, dynamically_loaded_tools, support_efforts low/high/
max, default_effort max; K2.7 Highspeed without
dynamically_loaded_tools), Kimi Code took the config, and `kimi -p`
reached the upstream with thinking enabled and reasoning_effort max
(K2.8) and high (K3.1 Pro).
- Rebased onto 43966a53f..f2eb56c6b (claude, GUI budget, usage; none of
them touch these files) as f5a82f215, then again at this head:
internal/agent, internal/catalog, internal/provider ok, internal/gateway
-run 'Kimi|MessageTools|Lift' ok. The full suite was not rerun there.
Broken by hand, each red then green:
- kimiFacts not called: TestFetchKimiCodeFacts and
TestKimiCodePlanCapabilities red.
- fields not carried in route.go / entryFor: TestKimiCodePlanCapabilities
red.
- the unrecorded-high rule off: TestKimiCodeOldHighBecomesTheVendorsDefault
red.
- always_thinking without the !legacy guard: the kimi-cli case red.
Not tried: the TUI picker by eye (that the thinking switch is gone);
tool select with a real MCP server and the experimental flag; Windows
(the reporter's system; nothing here is OS-specific); a real Kimi
upstream through magpie (the list was real, the chat was a fake).
|
||
|
|
43966a53fb |
claude: a subscription's run is Claude Code's interactive mode, -p only as the fallback
The owner (10-31): a Claude subscription ran `claude -p`, whose
requests Anthropic labels sdk-cli and counts at about twice the
interactive mode's cli (anthropics/claude-code#97074). Running the real
interactive Claude Code is what its terms describe and uses the plan as
a person does. Wanted inside magpie, on by default, with a way off.
`magpie claude-tui-helper <claude> <-p args>` (internal/claudetui)
stands where `claude -p` stood and speaks the same stream-json. It
turns the -p arguments into the interactive mode's (no -p, no
--dangerously-skip-permissions: --permission-mode default with only
mcp__magpie, and the WebSearch -p was given, allowed; --no-chrome;
--session-id or the --resume given), starts Claude Code in a
pseudo-terminal of its own (no tmux), pastes each message into its
prompt and presses Enter, and tells the session's transcript back as
-p's lines: whole assistant messages, an API error as the turn's error
result with its rate_limit_info, turn_duration as the result. Nothing
sets CLAUDE_CODE_ENTRYPOINT, and the user's ~/.claude and
~/.claude.json are never written. The folder-trust question is
answered only for magpie's own folder or a saved account's config
directory (MAGPIE_CLAUDE_TUI_TRUST).
A Claude Code that doesn't start or show its prompt in 45s becomes
`claude -p` on the same pid, its input still unread, so the turn is
answered all the same; that is remembered for 30 minutes
(<cache>/magpie/claude-tui-broken). An untrusted folder goes to -p
without the mark.
claudeTUI keeps -p for Windows and WSL, Settings › Models › Replies ›
Claude Code's interactive mode Off (claudePrintMode), safeguards,
client cache marks, a JSON schema, images and a first message over
400KB. A TUI run ends instead of taking an image turn, a rewind or an
effort change, and letGo doesn't take one back. The gateway's tests
run with claudeTUIRuns off: their binary has no claude-tui-helper.
docs/subsystems/claude-subscription-bridge.md has the section.
The core's scripts grow 725 bytes with the setting's row;
coreScriptBudget is raised to the exact size, 1,537,356, with no room
added.
Run (rebased on
|
||
|
|
1850fa3402 |
gui: the core's budget takes the 45 bytes b62fa332f added to app.js
|
||
|
|
f2eb56c6bb |
usage: a first start pairs the history a few weeks at a time, not at once (#2278)
With no sums on disk (a first install, or a version that counts rows
otherwise), the page's cells, the heatmap's days and Codex's effort
before the cut were built from one pairing of the whole history. Every
gateway block was priced, every session row's message id went into one
set, and every call into one match map. On the owner's history that
was ~212 MB of the warm-up's 341 MB in use and the cold start's peak.
coldSpans builds them as a day's start advances them (pageAdvance),
14 days at a time. A span pairs the chunks with a row from heatReach
before it to heatReach after. Each chunk's oldest row is kept by its
serial. A gateway block not priced yet is priced by a pricer of the
span alone, and its rows go back to the pool after the span. The
recent days are then paired as on any kept start.
The page's cells come out in another order (by span, then chunk), so
TestSettledCountedAsVersioned now sorts them before it hashes. The
sorted hash is the same for a pairing at once and in spans, so
settledCountVersion stays. Tests that count a pairing of every chunk
use pairAtOnce (coldSpan 0).
Run on mote at the pushed head (rebased on
|
||
|
|
b62fa332f3 |
provider: Send requests unmasked for subscriptions and plugin providers too (isee1_1)
isee1_1 on Discord uses a community translation plugin as a provider and asked why "Send requests unmasked" (请求不脱敏) isn't offered for it. |
||
|
|
14b451c117 |
site: the MCP hub's docs are the MCP router's, and the old links redirect
The feature is called the MCP router now (the commit before). The docs pages move to mcp-router.html in en, zh and ja, their wording follows (MCP router / MCP 路由 / MCP ルーター, `magpie library mcp router on|off`), and every docs page's link and canonical/hreflang URL points at the new path. The worker answers /docs/mcp-hub, /docs/zh/mcp-hub and /docs/ja/mcp-hub (with or without .html or a trailing slash) with a 301 to the new page, keeping the query, so links already shared still open. The plugins pages' link to the router page (Search1API's tools, from the rebase) follows too. Run at e2583df31 (this stack on |
||
|
|
7bc602236b |
library: the MCP hub is called the MCP router
The owner asked why it was a "hub". Composio calls the same thing a Tool Router; "router" says what it does (one server that routes each call to the right one), and "gateway" is taken by magpie's LLM gateway. Only the words change: MCP router / MCP 路由 / MCP 路由 / MCP ルーター / MCP-Router, "Router address", and the CLI's `magpie library mcp router on|off`, where `hub` still works. The URL /mcp/magpie/hub, the mcpHub setting, the servers/hub API and the Go names stay, so nothing a user or an agent config holds changes. docs/subsystems/mcp-hub.md moves to mcp-router.md and the pages that link it follow. #4382's new words follow too: "Through the MCP router", "Not through the router" and their hints in every language, and the CLI's `magpie library mcp router <name> shared|direct` (`hub` works there too; library_hub_test.go says router for direct, hub for shared). Run at e2583df31 (this stack on |
||
|
|
b78b1de003 |
library: magpie-image is behind the MCP hub, saving into the calling agent's project
magpie-image was the one MCP server the hub left out, because it saves what it makes on disk and needs to know whose project that is. The hub now serves its tools like any other server's and tells it where the caller works: 1. the hub answers a tools/call as SSE and asks the agent roots/list on that stream (3s), as Claude Code answers; 2. else Codex's _meta x-codex-turn-metadata.workspaces (git repos only); 3. else the Codex thread's cwd from its session file (sessions.CodexThreadCwd), only with session consent; 4. else none, and the image goes to ~/Pictures/Magpie as before. The hub passes `magpie/roots` and `magpie/client` in the call's _meta; imagemcp saves into the first root and names the agent on its usage row. Its result carries `magpie/model`, which the hub's own usage row takes, so the row says which image model drew it. A WSL agent keeps magpie-image as its own entry (the hub can't reach a path inside the distro). docs/subsystems/mcp-hub.md (mcp-router.md after the next commit), gateway-routing.md and gateway-sessions.md say so. It is rebased on #4382 ( |
||
|
|
d77da5bff3 |
claude bridge: a caller elsewhere whose environment is a message is told the last one given is where tools run
packinggoods on Discord, again after v0.1.2093: a Mac Claude Code through a Windows magpie's Claude subscription still has its commands wrapped in PowerShell. The bridge's run is the real Claude Code on the Windows box, and it puts its own environment (Platform: win32, its shell, a temp folder) in a <system-reminder> at the start of the run's first message. |
||
|
|
2570efb5f7 |
gateway: an image the picked model can't describe is described by the next model that sees (kelvinjason11 on X)
kelvinjason11 on X: "图片识别好像只支持一个模型识别 没有fallback". When
the describer (Settings' Image recognition model, or AutoVision's pick)
failed, the turn failed with it, though other models that see were there.
Now describeWith asks the pick first, always. When it fails for any reason
but the client's own cancel, magpie asks the next model that sees: the
first ready one of seersRanked, AutoVision's own order (ready, then
Claude account, Codex, API key, other, then cost), leaving out each model
already tried and each one that turned an image away (sightRefused). At
most 3 models (visionTries), and all of them within visionWaitMost
together: each try gets what is left of it, not a fresh visionTimeout.
- The text header names the model that described the image
("as other/bigeye describes it"), not the pick.
- The Routing row of the stand-in carries Instead, Why and Picked
(describingInstead, the same fields web search's searchingInstead
sets), and the Routing page says in every language that the pick
couldn't describe it, why, and which model did instead.
- When none answers, the error is the first failure as before, then
"nor could X, asked in its place: why" for each other model tried.
- Spent/allowance: each try goes through serve as before, so autoSpent
and spentModel judge every stand-in the same as they judged the pick.
- vision_mcp's describe_image tool gets the same fallback.
Cache (s.sights): a description is kept under the pick and the image,
whichever model described it, with the describer's name beside it. The
same image sent again asks no one, the stand-in's text is reused, and
its header still names the stand-in. A new image asks the pick first
again, so a pick that comes back is used at once. Failures are not kept.
Settings' text ("When the model in use can't see images, this one
describes them to it") is left as it is: the pick is still asked first
for every image.
Tests (internal/gateway/vision_fallback_test.go):
- TestPickedDescriberThatFailsGivesWayToTheNextThatSees
- TestAutoDescriberThatFailsGivesWayToTheNext
- TestNoDescriberAnswersNamesEach
- TestPickedDescriberThatAnswersIsTheOnlyOneAsked
- TestCanceledDescriptionAsksNoOther
TestDescriberThatCantSeeIsntAskedToDescribe now expects the next model
that sees to describe in place of a text-only pick, not a 502.
GUI: internal/gui/tests/vision-instead.test.cjs (every language, 1100
and 520 wide).
Run on mote at 45739f15b (this tree, on origin/main
|
||
|
|
74f1df8694 |
gui tests: agent-open-terminal's first load gets a minute too (#4470)
agent-open-terminal ( |
||
|
|
62c8d21ee5 |
gui tests: account-arrange acts once the allowances are drawn (#4468)
account-arrange's "account dragging uses the routing order in every mode"
was red alone in WebKit at
|
||
|
|
c124f87e2e |
gui tests: Settings rows are held once the last settings read is drawn (#4469)
images-library-way opened Settings › Models and waited for the Image
generation row, then screenshotted it. A page opened on Settings reads
/api/settings twice (go('settings')'s own read and load()'s), and each
answer draws the tab again, so when the second answer came late the row
it had waited on was replaced while Playwright held it: "element was
detached from the DOM" / a screenshot of a redrawn element (zh-TW 1100
in Chromium). The app's double draw is by design; the test was wrong to
hold the first one. It now waits with reader.cjs's watchSettingsReads and
settingsDrawn, as the other Settings files do, before taking the row.
proxy-test opens Settings › Network the same way and presses its Test
button after the first draw: it gets the same wait at both gotos.
What was run (WSL magpie-desktop, Playwright 1.62.0):
- By hand: the second /api/settings answer held 1.5s and a marker set on
the row first waited on. origin/main's images-library-way: zh-TW 1100
and 420 red, "the row held for the screenshot is the one drawn last";
this file 6 of 6 green, Chromium.
- images-library-way.test.cjs and proxy-test.test.cjs, Chromium and
WebKit, every language each file covers: images-library-way 62 of 62, proxy-test 22 of 22 green at load ~210 (nav-timeout green on this tree).
Not tried: the whole GUI suite; mote (#4125) or Windows.
|
||
|
|
ce8b67de37 |
gui tests: a page's first load gets a minute, not a click's 5s (#4470)
claude-switch-only set page.setDefaultTimeout(5000) and then called page.goto with no timeout of its own, so Playwright held the first load of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a busy box (a whole-suite run at load 130-160) that load took longer and goto timed out. The same pattern is in 988 GUI test files (1174 pages): every one of them now also sets setDefaultNavigationTimeout(60000) on the same page, right after its default, so goto, reload and waitForURL wait on the load itself with room, while clicks and waits keep their short bar. group-from-model-add's own 20s navigation bar is raised to the same minute. claude-switch-only also gives its first provider row (drawn from the page's first reads) a minute before clicking it. nav-timeout.test.cjs (no browser) reads every GUI test file and names each page given a default under a minute without a navigation timeout of at least a minute, so a new file can't bring the pattern back. What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from other sessions): - node --check on every file in internal/gui/tests: all parse. - nav-timeout.test.cjs against origin/main's test files: red (names the 1174 pages); against this tree: its only reds were my own probe copies of the old files, since removed. - By hand: claude-switch-only with app.js served 7s late (a busy box's first load), --test-name-pattern "1100 en": origin/main's file 4 of 4 red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green. - claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420: 32 of 32. group-from-model-add, usage-access-key-card and i18n-keys: green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red on a 5s waitForFunction at line 115 (a wait after load, not the navigation), at load ~230. Not tried: the whole GUI suite (about 1000 files; the change is one mechanical line per page), Windows or mote (mote's browsers, #4125). |
||
|
|
ef0a5c673a |
gateway: a web search is left out of a request relayed to a provider that runs none (mxmllln)
mxmllln (Discord #feedback, magpie 0.1.2219, Codex Desktop 0.166.0-alpha.5.1 with remote_compaction_v2): a thread on commandcode/deepseek/deepseek-v4- flash-vision-exp with 52 function calls and 8 web searches (magpie ran them for the model through gpt-6.1-sol) failed compaction with Command Code's 400 "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'", and every later message too. Cause: a Responses turn that offers web_search to a provider that runs no search is translated for magpie's search, and the translation leaves the web_search_call items out (searchedForIt, searchRoundsBack). A request that offers no web_search is relayed as Codex sent it, items and all: magpie's summary request for a compaction_trigger (tools: []), the summary request Codex makes itself (#1270), a turn with search off. Command Code's Provider API turns the Responses request into chat for DeepSeek, a web_search_call becomes an assistant tool call nothing answers, and DeepSeek refuses it. pairToolItems pairs function and custom calls only. Fix: the relay of a Responses request leaves the web_search_call items out when the provider doesn't search for that model (searchesModel), as the translation does. Kept as they were: a provider that searches itself (Codex and Copilot accounts, OpenAI, Command Code's gpt-6-luna etc. on Responses), a relay Codex's turns go to as sent (codexAsSent), and a native compaction (keepsCompaction). The item holds only the query and the page URLs, never what the pages said, so there is no result text to pair it with; the reply after it says what was found. Other routes checked: the Responses -> Chat and -> Messages translations already drop the item (or, for Claude's signed thinking, pair it with a result through searchRoundsBack); Chat and Anthropic clients send no web_search_call; magpie's plain-text summary retry (plainCompact) reads no web_search_call. count_tokens is Anthropic-only. Tests: search_relay_history_test.go. A fake Command Code that refuses a deepseek request holding a web_search_call with DeepSeek's message, the history built from searchedHistory (a real ChatGPT backend web_search_call, 2026-10-09) plus a function call and its output: compaction_trigger, Codex's own summary request and a turn with search off each answer 200, nothing sent holds a web_search_call, the call and output stay. gpt-6-luna on the same provider still gets its search. Unit test for withoutSearchCalls. Run (mote-run, at this tree): - go test ./internal/gateway -run 'TestSearchedThread|TestWithoutSearchCalls' -v: ok - go test ./internal/gateway -run 'Search|Compact|Compaction|Pair|ToolRun|WithoutSearch': ok - gofmt -l internal/gateway: clean Broken by hand: with the withoutSearchCalls call taken out of attempt, all three TestSearchedThreadCompactsOnARelayThatDoesntSearch subtests fail. Not tried: a real Command Code account (none here), Codex Desktop on Windows, the reporter's thread. Full suite and Linux/Windows vet run after the push. |
||
|
|
86fef947e8 |
gateway: a 200 stream ended with finish_reason "error" fails over (#2471)
What changed: a vendor that ends its 200 stream with finish_reason
"error" - WorkBuddy's and a DeepSeek harness's word for a turn it failed
rather than finished - had the chunk taken for content: the held stream
went to the agent, the try stood as a 200 success, and the group's next
member was never asked. streamEvent now reads the word as the failure it
says, held for the next candidate as an error event before content is;
in the candidate walk the try fails as an empty reply's or a cut-short
summary's does (#1221, #2274): the next is asked, and nobody rests, as
the reply's shape failed, not the account. Content already passed to the
agent can't be taken back, and is not touched.
Run: TestFinishReasonErrorFailsOver (new) red on
|
||
|
|
d965a239f5 |
gateway: a litellm relay's "'priority' is not supported for 'service_tier'" is asked again without the tier (#3978)
What changed: refusedOptional's recognizer (unsupportedOptionalField) gains
valueRejectedForField, for a vendor that names the field after the value it
turned away: litellm's "'priority' is not supported for 'service_tier' on
this model", handed to the agent as a plain 400 today, on both shapes the
relay sends — the bare prose (0.1.1330) and the backend's JSON embedded in
litellm's message (0.1.1829, unwrapped by the existing structure-first
walk). The name after "for" is what separates the field's refusal from a
value's ("... is not supported with this model"), which still reaches the
client as it came.
Both readers of refusedOptional take it, so the tier is dropped, the
request is asked again, and the provider isn't sent it again: a relayed
Chat or Responses request that carries the field (#393's path), and the
agent's own request on a provider the user added by its address (OwnTier),
which forwards the tier on purpose (chat.go, responses.go) and asks again
without one that turns the field away.
Run: TestRefusedOptionalNamesOnlyUnsupportedFields gains two rows (the
prose and the JSON-embedded shape, each under the direct, litellm and
openrouter wrappers) and TestServiceTierRefusedForTheValueRetried (a fake
upstream answering the issue's body) fails without the change — turn 1:
400 after 1 calls, want 2 — and passes with it: two tries, the second
without the tier, and the provider marked unfit for it. The value rows
(unsupported-value, tier-value) stay nil/pass. gofmt -l clean; go vet,
GOOS=linux go vet -tags nogui, GOOS=windows go vet ./... pass; go build,
GOOS=linux go build -tags nogui, GOOS=windows go build pass. In
go test -tags nogui ./... every package passes but three tests that fail
the same way on the unmodified base (
|
||
|
|
460687ff57 |
gateway: Azure's "invalid encrypted summary" reads as foreign reasoning (#3994)
What changed: a Codex thread the ChatGPT backend served, resumed on a
relay in front of an Azure OpenAI deployment, is refused there with
{"error":{"message":"invalid encrypted summary",...}} - wording the
foreignReasoning table didn't read, so withoutReasoning was never tried
and the 400 reached Codex on every turn of the thread. The refusal is
spelled with spaces, says summary instead of content, and names no item,
so none of the table's branches took it. An alternative
invalid[ _]encrypted[ _](summary|content) now sits beside
invalid_encrypted_content; the named-item reader (unreadableItem) is
untouched, as this refusal names none, which withoutReasoning already
covers by leaving out the whole reasoning set. The ChatGPT-backend
reader (withoutUnreadable) shares the table and takes the same turn.
Run (base
|
||
|
|
7da972969b |
provider, gui: a listing's budgets add up, and one provider's fetch models no longer re-lists past them (#4065)
What changed
The budgets a listing of the plugins' providers is made of added up past
the budgets its callers set: the host let one provider spend listWait
(20s) on its models hook plus the wait for a due renewal (RENEW_WAIT,
15s) before it, and a provider with two accounts spent them back to
back. One provider could be allowed 35s (40s with a second account) —
past the 30s refreshDeadline the background refresh asks under and past
the editor's own 20s — so pressing Fetch models, or a refresh, died with
a bare "context deadline exceeded" while no vendor had failed: every
provider is asked side by side, and the sum of the budgets was the only
thing over.
Now the host's own bounds hold by construction:
- host.js info(): the wait for a due renewal (fresh) spends the models
hook's own budget — the hook is given what is left of listWait, and
the renewal wait can no longer be added on top of it.
- host.js providers(): a provider's accounts are listed side by side
(the first no longer waited for before the rest), so one provider
costs one listWait, not one per account.
- gui/providers.go, case "models": the editor's budget is 30s, the same
the host bounds one providers RPC with, instead of 20s — shorter than
even one provider's worst case under the old arithmetic.
A provider whose renewal is slow then lists late (its hook given up on
alone, said so in listError as any other stuck listing) instead of
taking the whole listing past the caller's deadline (#4065).
Run
- TestProviderListCoversAccountsSideBySide, two accounts whose hooks
each take 3s under a 4.5s caller budget: with the product files at
the base (
|
||
|
|
50816ce024 |
library: turning RTK off matches the hook Claude's settings actually holds (#2879)
What changed: taking RTK out of Claude Code now drops its hook entries
from hooks.PostToolUse and hooks.SessionStart in ~/.claude/settings.json
beside hooks.PreToolUse, matching the same "rtk hook claude" mark.
Why: magpie says Claude Code has RTK by searching the settings file
whole for "rtk hook claude", but its remover only looked under
hooks.PreToolUse. rtk 1.0.1's installer writes that command under
hooks.PostToolUse too, when the user's rtk pipeline has after_tool rules
(rtk:posthook; src/hooks/init/claude.rs), and rtk's own uninstaller
sweeps PreToolUse, PostToolUse and SessionStart alike. With an entry
under another event, switching RTK off in the Library removed the
PreToolUse entry, found the command still in the file, and failed with
"rtk's hook is still in Claude" — the reported bug: the row stayed on
and the hook had to be taken out by hand. The user's own hooks under
those events are kept, as the PreToolUse ones already were.
Run: go test ./internal/library/ (ok, 75.6s); the new
TestRTKRemoveClaudeOtherEvents fails on the base with "rtk's hook is
still in Claude Code" and passes with the fix; gofmt -l clean; go vet
clean on darwin, linux and windows; the package builds on all three.
Review (magpie): checked against rtk v1.0.1's own claude.rs, which
writes and sweeps PreToolUse, PostToolUse and SessionStart; the other
agents' single key is unchanged. Run on the Mac mini: go test
./internal/library -count=1 ok; TestRTK* on the Windows box ok. Broken
by hand: rtk.go at the base - TestRTKRemoveClaudeOtherEvents red
("rtk's hook is still in Claude Code"). Not tried: the reporter's ask
to roll the switch back in the UI when a removal fails.
Generated-by: GLM-5.3-Flash (ZCode)
|
||
|
|
a5ccf3f23f |
plugins: an update of an unfixed git source re-resolves the branch, not the lock's old commit (#2954)
What changed - Before Bun resolves a git plugin's spec, the branches and tags of its repository are fetched into the bare clone Bun keeps in its install cache (refreshGitCache in gitrev.go): best-effort before install's bun add (a remote that can't be reached leaves the install to what the cache has), an error before reinstall's bun update (an update that didn't happen is not reported as done). - When bun update exits 0 but the plugin is still behind the commit the update checks saw the repository at, reinstall says so instead of claiming the update. - A spec that names a commit (#<sha>) is left alone: nothing is resolved for one, and its pin stands. - docs/subsystems/provider-plugins.md: this git update path. Why A plugin added from an unfixed git+https://... URL could not be updated (#2954): plugins/package.json named no commit, but Bun resolves a git spec through its own bare clone of the repository in the install cache, whose refs stay at the first install - a fetch there moves FETCH_HEAD, not the clone's refs/heads. Every resolve after the first, bun update as much as a bun add after a remove, therefore named the old commit again, bun.lock re-recorded it (name@git+...#bb961b2...), and the update said it had installed while node_modules kept 0.1.3. The lock is the record of that resolution, not its cause. Verified with Bun 1.4.2 (the version magpie runs) against a local git+file:// repository: after the branch moved, bun update my-plugin answered "no changes" and exited 0, and so did bun install with the lock entry dropped, bun update --force and bun install --force; with the clone's refs fetched, the same bun update installed the branch's commit now. Run go test ./internal/plugin/ -count=1 (ok; new: TestGitUpdateInstallsTheBran chsCommitNow and TestGitUpdateKeepsACommitPin on the bun on PATH against a local git+file:// repository, TestGitUpdateSaysWhenItDidnt with the fake bun keeping the lock's commit, TestRefFixed, TestSameRepoAndCloneOrigin) go test ./internal/cli/ ./internal/provider/ -count=1 (ok) gofmt -l (clean); go vet ./internal/plugin/ on darwin, linux and windows (ok); builds of darwin and of windows (CGO_ENABLED=0 -tags production, as the Makefile cross-compiles it) and of the 79 Linux packages that don't need Linux GTK cgo (the GUI and cli are built natively per machine, as the Makefile says). Review (magpie): patch sha256 checked against the issue; read whole. Run at the batch head on the Mac mini: go test ./internal/plugin -count=1 ok, the real-Bun git e2e among them (not skipped); on the Windows box TestGitUpdate* pass. Broken by hand: store.go at the base - TestGitUpdateInstallsTheBranchsCommitNow ("still at 1.0.0, want 2.0.0") and TestGitUpdateSaysWhenItDidnt red; only install()'s refresh removed - "installed again: 2.0.0, want 3.0.0". Not tried: a real plugin from a real GitHub branch. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
0fcb3acb3f |
gateway: the 24MB CR test reads a mended line (#4256)
TestCRTidyTwentyFourMBLine's "one call mended" case never mended
anything. Its line ended its output array with a trailing comma, so the
JSON could not be read and crTidy passed it as it came. Its want was
strings.Replace(line, `x\ry`, `xy`), but on the wire the escape is
`x\\ry`, so the Replace changed nothing either. Both sides equalled the
input, and the subtest passed while timing a failed parse.
The fixture now joins its items without the trailing comma. The mended
case reads the output back: the line is still one data line, fc_1's
arguments are {"a":"xy"}, and every text item is there. The healthy case
is still compared byte for byte.
Run on mote (macOS), go test -tags nogui -count=1 -v -run
TestCRTidyTwentyFourMBLine ./internal/gateway/:
- the healthy 24MB line ~25ms, the mended one ~280ms (a whole decode and
marshal, only on glm-5.3-flash* lines that carry a \r escape);
- with crTidy.responses' item mend turned off by hand, the mended case
is red ("arguments ... want {"a":"xy"}"); it was green on the old
fixture.
|
||
|
|
dd279e9314 |
gateway: the CR a glm-5.3-flash* replica stitches into tool-call arguments
Yetone's review of the two earlier rounds (#4256): the cure changed healthy replies and cost the relay hot path. This one keeps to the routes the defect was seen on, and holds a cut escape the way the encoders do: - The cure runs only on glm-5.3-flash* routes (glmFlash, the way grokModel scopes its rule): a relay installs crTidy for those models alone, translate sets Request.CR the way it sets Request.Grok, and the encoder wrapper crEncoder and the whole-reply pass crResult hang off that flag. Another model's reply goes as it came, healthy or not. - The relay's mends wait per call (crTidy.calls, by Chat's tool_calls index, Messages' block index, Responses' item id), so a \r\n cut across two fragments arrives as the pair it is; a \r the next fragment does not answer with \n is the defect, and goes. A line's end is looked for in the new bytes of a read alone, and a region without the escape is said from where it lies: a 24MB line in 32KB reads costs a scan (23ms here; the round-2 way took 2.45s). - The events whose delta is an argument are read from the event's own type or shape: a text delta that only mentions the arguments' event names stands, \r and all. - A custom tool's raw input (Codex's apply_patch) is read as bytes: the CRLF pair is the line ending it says, a lone CR goes. - The encoders' dropper is said at a call's end: a lone \r goes, a bare \ is said as it came (crEncoder.say). Refs #4256 (kept open for the reporter) Run: go test -tags nogui ./internal/gateway/... (ok). The healthy split-CRLF relays of all three protocols, the custom input's, the text delta's and the scope's tests fail on the round-2 branch and pass here; unwiring the flag reds the cure tests again. Landed by yetone on origin/main |
||
|
|
f45c3c96b6 |
usage: a day's first start advances the kept sums from the last cut, not a pairing of all history (#2278)
The page's cells, the heatmap's days and Codex's effort before the last
days are kept on disk (page-v1.json, heat-v1.json, effort-v1.json) under
a key that names the cut, today minus two days at midnight. The cut moves
each midnight, so each user's first start of a day found none of them,
and paired the whole history again three times. On the 240k-row bench
history that peak was 506-538 MB, against 235-325 MB for a start of the
same day.
Each file now also holds the cut and since its sums were counted at.
When the current key misses, the file's sums still stand if the key at
their own cut is the same: the chunks are split again at that cut, named
as heatSettledKey names them, and compared with the file's key. Then
only the chunks of the days since that cut are paired. The rows between
the two cuts are added to the kept sums, and the sum is written under
the current key. The heatmap also drops days before a since that moved
forward a week. A full pairing is left for a first install, a raised
version, or a settled chunk that changed.
settled_version_test blanks a page's cut and since, as it blanks its key
and at. They say when the cells were counted, not how, so
settledCountVersion stays at 1. Files written before this commit have no
cut, so the first day change after the upgrade still pairs everything
once.
Run at 9cd9cfed0 (rebased on
|
||
|
|
cfb06e11c3 |
site: PostHog goes through usemagpie.ai/r/, and downloads are counted
A blocker that knows posthog.com dropped every count of the pages, so the snippet's api_host is now this site's /r/: relay passes the library and its config on to PostHog's assets host and the rest to its ingestion host, with the visitor's address as X-Forwarded-For (PostHog's country) and without the site's cookies. ui_host stays PostHog's. Downloads weren't in PostHog at all: /download/* and install.sh are now counted server-side, as "magpie site download" (link, file, country, browser or command) and "magpie site install script", each under an id of its own like the partner counts. A HEAD, or a file the release doesn't have, isn't counted. The privacy pages (en, zh, ja) say both. Run: node --test site/worker.test.mjs site/install.test.mjs site/stable.test.mjs on mote, 48 pass. Broken by hand (no X-Forwarded-For, the Cookie passed on, the download count off): the relay and download tests went red. A Playwright page with the snippet and every posthog.com request aborted (a blocker): Chromium on mote and WebKit on xiaomi-gpu (mote's WebKit wouldn't launch at load 28) sent $pageview, $autocapture, $snapshot, $$heatmap and $web_vitals through /r/ alone, nothing blocked; under GPC nothing was fetched. |
||
|
|
e2d7d1f54a |
gateway: a body still arriving at the 2m cut-off is answered 408, and its read ends
heatonz on Discord (Hermes Agent to magpie v0.1.2237 in Docker): about
half the requests to a nested group were stopped after 2m0s "without
routing it to any provider". The held report's one wait was "body 2m0s
(under way)", and 7 handler goroutines sat in net/http body.Read under
waitedBody, idleBody and readSized.
The body read has its own idle limit: 60s with no byte, renewed on each
byte (idleBody), which answers 408. That limit never fired, so bytes were
still coming in gaps under 60s, and the time added up to unroutedMost
in the "body" wait. The watch then answered 504 and blamed routing, and the
handler kept reading the body after the answer until the body ended or
went idle.
Now, when the cut-off lands while the body is being read:
- the answer is 408, saying the body was still arriving from the client,
how much of it had come and when the last byte did; OpenAI's and
Anthropic's SDKs send a 408 again at once;
- the read ends with the answer (deadline now, waitedBody refuses further
reads), so the connection closes with it;
- the held report says "stopped it with 408" and has a "body read: X of
Y, the last Ns ago" line, which tells a trickle from a stall.
Not changed: the 60s idle limit. The report shows it never fired, so a
shorter one would not have been sure to catch this case, and an
upload that keeps progressing is the client's, not magpie's. The 2m bound stays,
so a trickling client can't hold a handler forever.
Run (mote, at this head on
|
||
|
|
f03ed8c26e |
agents: Open in terminal on a Mac's Agents row (coolmantou)
coolmantou on Discord asked to start an agent from magpie's Agents list.
In the Mac app's window, an agent row's menu (openRowMenu, the one the
grip and a right-click open) now has "Open in terminal". This includes a
row under Not set up. Clicking it posts POST /api/agents/open with only
{agent: id}. The server finds that exact id in agent.Detected() (not
agent.Find's prefix match) and builds the line itself: the agent's
Launch() where it has one (agy, Claude Science, Cursor local), otherwise
its program's path, single-quoted (BinPath, new in internal/agent).
openTerminal then opens that line with the user's Session terminal
choice. The command never comes from the page. Other systems, the web
build, WSL agents and desktop apps with no program are refused, and
their rows have no item (agentJSON.terminal). The tray panel's rows don't
have the item either. The label is "Open in terminal", not "Terminal",
because the user's terminal can be iTerm or Ghostty. The string is in
en, zh, zh-TW, ja and de. Windows and Linux are #4474.
The core budget had 39 bytes left on main, so no budget was raised.
Instead:
- the item says nothing on success; the terminal opening is the answer,
and a failure goes to statusErr;
- the omp roles' comment above OMP_UNSET was cut to what OMP_UNSET's
values don't already say.
app.js is now 22 bytes under main's size.
Run:
- go test ./internal/gui ./internal/agent on mote (macOS) and in
magpie-desktop (Linux, -tags nogui), both ok.
- TestAgentOpenRunsOnlyTheAgent puts claude in a folder named
"it's a' $(touch made1) `touch made2`; touch made3 #". It posts the
ids "claude; touch made4", "claude'$(touch made5)'" and "cl"; none
of them opens anything. It then runs the line made for claude
through /bin/sh and checks that only the program ran.
- After the rebase onto origin/main
|
||
|
|
505d9f6a21 |
provider: Kiro's mover min is 0.1.22 (plugins#538)
opencode-kiro-auth 0.1.22 sends xhigh and max as Kiro's own effort levels on a model whose catalog lists them with adaptive thinking (additionalModelRequestFields, as Kiro IDE sends them), and puts a trailing system message (Claude Code's environment context) in a turn before the question instead of into it. npm view --prefer-online gives 0.1.22. Run (on mote): gofmt -l internal/provider clean; go vet ./internal/provider for darwin, linux and windows; go test ./internal/provider -count=1: ok. Not run: the full suite. Two other sessions' full suites were running on mote, and this change is the min string alone. |
||
|
|
261117363e |
plugin host: a sign-in again joins its account when an older plugin named it another way (#4473)
officeace-auth 0.1.14 to 0.1.17 kept an account as accountId = the masked
phone ("189****8051") and uid = the Huawei domain id. The CodeArts
plugin's OfficeAce card (plugins#522) names a new sign-in by the domain
id, uid the same. settle joined a new sign-in to an old record only on an
equal account id, so signing in again added a second row (fakeco#xxxxxx)
and left the old one "Sign-in required", holding the user's name, proxy
and gateway keys.
settle now also joins two records with the same uid when one of them is
named by that uid (renamedBy): then the uid is the account's own id. The
joined record keeps the old record's accountId, since the user's name,
proxy and gateway keys are kept by it (#4416), as the CodeArts plugin's
renewals already keep a stored accountId.
The issue suggested joining on any equal uid. That is not safe: Kiro
keeps how an account was signed in to as its uid ("google"), so two
different Google sign-ins share one. The test signs in two such accounts
and checks they stay apart; with a uid-only rule they were joined.
Not covered: a re-sign-in where neither record is named by its uid (a
WorkBuddy nickname changed at the vendor) still adds a row; nothing in
the records proves those are one account.
Run:
- Reproduced first on origin/main's host.js: TestPluginReSignInJoinsAnOldIDShape,
with the old record as officeace-auth 0.1.14's callback and
credential.mjs write it (read from the npm tarball), was red: the
sign-in again went to "fakeco#9oncv2" beside the old record.
- Broken by hand: renamedBy on uid alone -> red (two Google accounts of
uid "google" joined); joined without keeping the old accountId -> red
(accountId became the domain id). Green with the fix, and
TestPluginSameNameOtherUID (#413) still green.
- Full go test ./... -timeout 45m on mote was still running at push
(pushed without waiting, per the owner's rule); a red it shows that
isn't on origin/main gets its own issue.
Not tried: a real Huawei Cloud sign-in in a running magpie; the CodeArts
plugin with the OfficeAce card is not on npm yet (plugins#522 is open).
|
||
|
|
06d36d4142 |
gateway: Stays: Session spreads new sessions over the accounts (connor_yang)
connor_yang on Discord: three sessions on one provider's three accounts,
Stays: Session (整个会话), ended up on two accounts. Under Smart routing a
conversation nobody had answered yet went wherever routing put first,
whatever other sessions were on; only In turn counted the sessions each
account holds (leastHeld, #946).
Kept for the whole session (Stays: Session or Strict) under a routing that
picks by what is left (Smart, Least used first, Weekly pace;
spreadsSessions), a new conversation now goes to the key, account or
group member the fewest other conversations of the last 30 minutes are on.
It passes over one routing keeps new conversations off (readyForNew:
resting, an aside key, a fallback while the provider's own model leads,
one used past lowShare), counts leads only, and keeps routing's order on a
tie. A Claude Code subagent's first request goes to its lead's account
(withLead), not to another as a session of its own. An answered
conversation is kept as before, and resting, spent and the rest/quota
fallback are unchanged. In order, By weight, Free first, Speed first,
Cheapest, Manual and plugin routings keep their order. Docs: reference,
gateway-routing, site start.html (en, zh, ja).
Run (mote, at this head on
|
||
|
|
2604d68db0 |
routing: the live card stays on the request it tells of while others come at once
qiang2040 on Discord ("狂闪", a screen recording): with Codex
conversations sending at once on group/glm-5.3-flash-free and
group/deepseek-v4.1-flash, the Routing page's top card (head, story,
context window) jumped to the newest request on every trace update,
and to "magpie hasn't routed this request yet" for each new one.
told() picks the request the card tells of: it stays on the one it
shows until that one is done, then goes to the newest, and a newer
request routing hasn't picked for yet doesn't take it from one that
was routed. play(), resume(), the live poll and rebuild() use it;
requests that come meanwhile still fly on the stage, without a caption
of their own. Pinned, replay and day views are unchanged.
Run:
- routing-concurrent-hold.test.cjs (new; two conversations interleaved,
every frame's head watched; en, zh, zh-TW, ja, de): red on the old
code in Chromium (mote); green on this code in Chromium (mote and
WSL) and WebKit (WSL).
- Broken by hand: told() returning newest() -> 6 of 6 red in Chromium
and WebKit (WSL), "the card stays on 101 while it is under way".
- routing-* and panel-routing* in both engines on WSL, against a base
worktree at origin/main: the reds are the same on base. row-swap is
red 3/3 on base too (#3799); live-patch's folded sample caught a
count-up mid-way once (129K vs 130K, the right request; #2174); the
rest are WSL WebKit reds under #4121.
- go test ./... -timeout 45m on mote: 80 packages ok; internal/gui's
10 real-window AppKit tests were killed at their deadlines (mote's
pboard/launchd state, #4125; also #2645, #1936). This change is
JavaScript only.
- The whole GUI suite (node --test, both engines) is still running on
WSL at push time; reds it shows that aren't on file get issues.
- At the pushed head (rebased on
|
||
|
|
59bdd4dbc3 |
routing: a group's pattern members can be put in order by hand (usrname1833)
In a routing group, members a pattern added followed the catalog's
order. The editor gave them no grip or Up/Down, and the gateway tried
them in that order. Now every row gets the same grip, Alt+arrow and
Up/Down that named members have. Matched rows still have no Remove,
since the pattern decides those.
The order is stored as Group.Placed, keyed by provider/model as Members
spells them. It is nil while the order equals the default (named, then
matched in catalog order), so existing groups.json files don't change.
Read (withMatches -> placedIn): members follow Placed. A model matched
since goes after them, and one no longer matched drops out. The gateway
tries members in the order the group is read, so it follows the editor.
Saved (SaveGroup -> placedOver): Members orders the named members, and
Placed (sent, or the stored one when a save doesn't send it) places the
matched ones. A save that doesn't know Placed (card routing, the CLI's
models+=, TUI, import) keeps the matched where they were, and a model it
names newly goes after the last named one. A provider rename, fold,
group rename and RenameMember carry Placed along.
Run:
- go test -timeout 45m -count=1 ./... on mote: 80 packages ok.
internal/gui fails 10 AppKit window tests at 30s (TestDockJoinLeadsCommandTab,
TestPanelCloseHidesIt, TestMainWindowCorners, ...). On a fresh origin/main
|
||
|
|
a45a0f1c5d |
signin: Settings can keep sign-in pages out of the default browser (max2020)
max2020 on Discord signs in from a separate, fingerprint browser so the vendor never sees their default one. Every waiting sign-in already shows its link with Copy link (since |
||
|
|
3b5dccd527 |
accounts: a plugin account goes by its usage's name, not its id (#4416)
A Huawei Cloud CodeArts account is kept by its accountId, an IAM id (iam::<domain>:user:<name>), and every list showed that id while its quota card showed the masked phone the plugin's usage() names it by. Display only: an account now reads as the name the user gave it, else the `user` its plugin's last usage read gave (PluginUserOf: the in-memory read, else quotas.json), else its id. The id stays the key everything is kept by; nothing stored changes or migrates. A read that fails keeps the last good name; nothing read yet is the id, never blank. One rule in provider (AccountShown, AccountShownOf, AccountLabelOf), used by every list: cards' Alias (Usage page, tray panel, /v1/magpie/quotas, magpie quota), magpie accounts, magpie providers, the TUI's Providers rows and quota titles, usageapi's Account filter, the quota alert. The GUI gets it as /api/providers' accountUsers (accountShownOf in app.js): the editor's account rows (the id in the tooltip), the per-account proxy lines, Routing's userShown, the Providers search, Hide accounts. app.js's account lookups share one helper, so the core stays in its budget (1,536,561 of 1,536,586), with no room added. Run: - go test ./... -timeout 45m on mote at |
||
|
|
0621e70fb9 |
routing: leave a provider out of the groups magpie finds
chenxiang0010 on Discord asked to keep a provider or a model out of the auto-created routing groups. A model could already be kept out (remove its found group; magpie keeps it removed), but a provider could only be turned off per group or everywhere. Now Routing -> Groups, under "Find groups on their own", has "Leave out a provider..." (app menu, saved when it closes) and `magpie group auto skip <provider>...|none`. The providers chosen (providers.json autoGroupSkip) join no found group; a group the user made or changed keeps them, a found group left with one provider goes away, and a request for it is served by AutoStandIn from a provider still in, and agents on it are reseated (agent.Reseat). A rename carries the id along. en, zh, zh-TW, ja, de. Run at 383947fce (this change on origin/main |
||
|
|
31728e29a8 |
routing: the German connection-check note names {agent} as often as the English one
The sibling of ec5571d6f's ja fix: da3c5e0c0's de string for "{agent}
checked that magpie answers ..." had a third {agent} too, so gui-de's "de
has every zh string, with its placeholders and tags" was red on main. "Das
Modell dieser Prüfung wählt {agent} selbst" now reads "wählt es selbst";
the sentence opens with {agent} already. zh and zh-TW had two.
Run: wsl-run gui-de, gui-ja, gui-zh-tw, i18n-keys: 13/13; gui-de alone
before this change: red, this test. Found in the whole GUI suite run
after v0.1.2228 (
|
||
|
|
65c7924108 |
cli: TestProviderAddressMovesALocalServer adds LM Studio in a folder of its own
The test added lmstudio in the package's shared config folder, so a
second run (-count=2 and up) found it there, added "LM Studio 2"
instead, and read the old provider back at localhost🔢 red on
origin/main
|
||
|
|
380032cda1 |
providers: Send requests unmasked is the user's switch at any address, with a caution while on for one not local (AcMilan)
AcMilan (Discord) runs a vLLM at http://llm.corp.lan:8000, and the editor never offered "Send requests unmasked": the switch showed only for a localhost, *.local or private-IP address. Asked, he said the choice should be the user's for each provider. provider.SkipsRedaction is now: Unredacted, no signed-in account, not another magpie, and at least one address. Nothing is looked up on the request path. The editor shows the row for every provider but an account or remote magpie. While it is ticked, an amber caution under it names an address not on this computer or the local network (awayHost). A name of the user's own DNS is asked about, only while ticked, through POST /api/local-hosts (provider.LocalHost -> netproxy.LocalName: every address loopback, private or link-local, 400ms lookup, kept 1 minute). That answer only words the caution. CLI help and `provider show` say the same. The 'away' i18n line is in zh, zh-TW, ja and de. To stay inside the core script budget, a few nearby editor comments were cut down (no raise). Run (logs in the worktree's logs/): - Full Go suite on mote at base |