6ba593de00583dfbfb2d2afa2fca8d1ee02c6e4a
5515
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6ba593de00 |
gui: a passing note in the main window takes no clicks
Since v0.1.2281 the window's footer takes no room and its status line
floats as a pill 18px over the window's foot, so a row at the page's foot
can sit under it. plugin-namesake's "ja 440" (chromium) pressed Install at
y 832-855 of an 860px window while "...をインストールしました" was showing
(class "status ok lift"), the press landed on the pill and the confirm
never opened: red twice at the v0.1.2281 head, green at its parent.
An ok or plain note in the window now has pointer-events: none, as a
toast: a press under it reaches the page. An error or warning keeps its
clicks, to be selected and copied as before. The panel is unchanged.
Tried first and dropped: 44px of bottom padding on the window's views so
the last row scrolls clear of the pill. It lifts Providers' sticky Add bar
36px off the window's foot (sticky at bottom -8px), so it was taken out.
Run (wsl-run, magpie-desktop, Playwright 1.62.0, chromium + webkit):
- window-no-footer (en, zh, zh-TW, ja, de; 1200/700/390; providers,
settings; panel), plugin-namesake, status-long, panel-open-once:
200 pass, 0 fail.
Broken by hand: the pointer-events rule removed, window-no-footer goes
red in both engines, 60 subtests "a press under a passing note reaches
the page".
Not tried: a real macOS, Windows or Linux app window; the whole GUI suite
at this head (the 22 files red at v0.1.2281 were red the same at its
parent apart from checkin-account, fixed in
|
||
|
|
06c2c35d13 |
claude: the interactive mode's start is waited for, and a hung one goes to -p (#4504)
derrors (Linux Docker, 2 vCPU, v0.1.2281): every new Claude Code run
failed "Claude Code has not answered magpie's initialize request in 10s"
and the turn was 502 after 6 tries, while -p runs on the same account
answered.
Cause: the claude-tui-helper answers the bridge's initialize only once
the interactive Claude Code shows its prompt (claudetui.ready, up to
45s), or as -p after it falls back. The bridge gave it the 10s of any
control request and then ended it, so a Claude Code slower than 10s to
start was killed before its own -p fallback could run, and nothing was
marked: each try started the interactive mode again.
Fix:
- startRun waits tuiInitWait (claudetui.ReadyWait + 2x controlWait, 65s)
for a TUI run's initialize, and gives up on the request's context.
- a helper that still answers nothing is ended, the machine is marked
(claudetui.MarkBroken), and start runs the turn again as -p.
- claudePrintWhy goes -p at once while the mark holds ("the interactive
mode failed to start lately"), so no helper is started.
- the mark counts failed starts in a row: 30m after one, doubled to a
day (brokenFor), so a machine where it never starts waits about once a
day. A start that shows its prompt removes the mark.
- the helper falls back at once when Claude Code asks how to sign in
(a container signed in for -p only, CLAUDE_CODE_OAUTH_TOKEN), which
it otherwise took for the prompt or waited 45s on.
Every other control request keeps its 10s; initialize is the only one
a TUI run is sent (cliControl's one other caller is setSafeguards,
and a run with safeguards or cache marks is -p).
Run (mote, at this tree):
- go test ./internal/claudetui/ (whole package) ok
- go test ./internal/gateway/ -run Claude ok
- GOOS=linux and GOOS=windows go vet ./internal/claudetui/
./internal/gateway/ ok; gofmt -l clean
- wsl-run (magpie-desktop, Ubuntu 24.04): go test ./internal/claudetui/
./internal/gateway/ -run 'TestShim|TestBroken|TestClaudeTUI|
TestClaudeEndedRunSaysWhy|TestClaudeUnloadable' ok
Broken by hand (each red, then restored):
- TUI initialize waits controlWait, no mark, no retry (the old code):
TestClaudeTUISlowStartAnswered 502 "Claude Code has not answered
magpie's initialize request in 10s", the reporter's message
- TUI initialize waits controlWait only: marked broken, red
- no MarkBroken in the bridge, or no retry in start:
TestClaudeTUIHungHelperGoesPrint 502
- no sign-in check: TestShimFallsBackToPrint/asks_to_sign_in timed out
- no clearBroken: TestShimStartClearsBroken red
- brokenFor not doubling: TestBrokenGrows red
Not tried: a real Claude Code in a headless container, or any real
account. Why derrors' Claude Code was slow or stuck is not known: the
sign-in screen is a guess from -p working where the interactive mode
didn't; the helper's line now logs the screen it stopped on. No full
suite.
|
||
|
|
11fc687c0e |
gui tests: checkin-account waits for the wheel's scroll to stop, not 100ms
After |
||
|
|
03d21ab8e1 |
gui: a page's read and the warm-up collect at GOGC 10, not 25 (#2278)
tightGCPercent goes from 25 to 10. This is the GOGC that underTightGC (the
warm-up's reads) and every /api/sessions* and /api/usage* answer
(held) run under; it is put back once the last read ends.
Profiled on mote (heap dumps at each 8 MB of live heap, plus a goroutine
dump). After v0.1.2280 the first start's reads already take turns, so the
peak is one build at a time over what the indexes keep. The live peak is
~280 MB, and at GOGC 25 Go let the heap grow ~70 MB past that before a
collection.
Bench: the mote sandbox HOME with the real history (13k sessions, ~720k
gateway calls), MAGPIE_NO_STATS=1, a poll of ten answers every 5 s,
75 s per run, footprint peak (phys_footprint_peak):
- cold start (no caches), 3 runs each:
- v0.1.2280: 397/390/392 MB, 162–168 s user CPU, slowest first answer
29.8–30.6 s
- this change: 352/350/352 MB, 197–200 s user CPU, slowest first answer
31.9–32.4 s
- start with caches, 2 runs each:
- v0.1.2280: 321/304 MB, 7.6 s user CPU
- this change: 271/275 MB, 10.3 s user CPU, mean answer 0.12 → 0.13 s
Tried and dropped:
- 10 only until the warm-up ends: cold 372–374 MB, warm 301–306 MB.
- 10 only inside usage's big builds (a holdBigBuild hook): cold
373–395 MB, warm 304–312 MB. The peaks are not all big builds.
- Warming the heatmap as a fifth warm-up step: cold 395–401 MB, the same.
The goroutine dump shows the page asks already take their turns.
Run on mote, first at
|
||
|
|
a6951cc63a |
provider: a GLM key read before keeps its card when a read of it fails (larchsis on X)
larchsis (X, Windows 11): two GLM Coding Plan keys, and only one usage card shows; after a restart both show at first, and the automatic refresh takes the second away again, with a manual refresh not bringing it back. Cause: a provider with several keys is never moved to the Coding Plan URL (LearnZhipuCoding moves only a one-key provider), so its keys are read with sure=false, where any failed read meant "no plan" and dropped the card unless keepLast had a kept reading. keepLast keeps one only for a passing failure, and Zhipu's /api/monitor answers its rate limits (1302 "并发数过高", 1303, ... 1399) with HTTP 200 in its envelope and Chinese words that `passing` doesn't match. So when both keys were read at once and one was limited, its card went until a read happened to pass. Fix: - readZhipuPlan says an envelope rate limit (zhipuCodeStatus 429, not 1113 out of credit) as "429 rate limited (code): msg", so keepLast serves the last good reading. - PlanQuotas' !sure branch keeps the card of a key that has a kept good reading (hadReading in quota_last.go), with its error when nothing can be served. A failed read of a key read before is unknown, not "no plan". A key never read that fails still has no card. This also covers the other sure=false sources (MiniMax, Command Code, Ollama). Test: TestZhipuSecondKeyKeepsItsCard (two keys, first read; second key 1302 after a restart keeps its kept windows; a 500 envelope keeps the card with its error; a never-read pay-as-you-go key gets no card). Broken by hand on mote: without `|| known` red at line 106; without the envelope 429 red at line 99; both restored green. Run (mote, at c5caef7bf on |
||
|
|
f1d5bedba6 |
provider: WorkBuddy plugin min 0.2.5, the filter's line with its newlines (plugins #540)
itspig (plugins #540, 2026-10-30) found v0.1.2278 with workbuddy 0.2.4 still passed WorkBuddy's content_filter refusal to the agent: the real chunk's content is "\nSorry, I can't respond to this question.\n", and 0.2.4 trimmed only the leading newline, so the line went on as an answer and the group's next member was never asked. workbuddy 0.2.5 (plugins b5cc782) trims both sides. - The workbuddy mover's min is 0.2.5 (npm view --prefer-online: 0.2.5). - TestDeepSeekRefusalAfterThinkingFailsOver gets a subtest with what 0.2.5 hands on from itspig's literal chunks (empty content and refusal on the reasoning chunk, extra_fields/function_call null, role on the content_filter chunk): the try fails as refused and b answers. Run on mote at this tree: go test ./internal/gateway -run TestDeepSeekRefusalAfterThinkingFailsOver -count=1 ok (3 subtests); go test ./internal/provider -run 'Mover|Moved|Workbuddy|WorkBuddy' ok; gofmt -l clean. Broken by hand: the new subtest fed 0.2.4's output (the line with its newlines left in the content_filter chunk) goes red. Not tried: a live WorkBuddy account; the full ./... suite. |
||
|
|
3eb5aa2add |
gui: the main window has no empty footer bar; a page runs to its foot
yogurt36_51912 on Discord (#feedback 1565833790914429069): in the main
window, with the sidebar, the bottom bar is empty and covers the content.
At origin/main
|
||
|
|
7f2acb9ffa |
gui: a first start's page asks and warm-up reads take turns (#2278)
On a first start with no sums on disk, the window asks the Sessions page's stats and overview and the Usage page's requests and heatmap while the warm-up reads the same history. A heap profile at a live 294 MB, 30.6 s in, had ~147 MB in those asks' handlers (QueryPage 102 MB, session stats 51 MB) beside ~42 MB in the warm-up's session scan. Each was a first read of the history held beside the others. Until the warm-up ends, each warm-up step and each ask of /api/sessions, /api/sessions/stats, /api/sessions/overview, /api/usage, /api/usage/requests and /api/usage/heatmap take one turn at a time (coldTurns). Each read comes after the one before it has kept what it read, so most find it kept. held's sessions.Ask still makes the warm-up read at full speed while a page waits. No page waits more than 2 minutes for its turn, so a stuck warm-up can't hold the pages. Once the warm-up is over, nothing waits. Tests don't take turns (coldTurnsTaken). Bench on mote (M5 Pro), a real 390k-call history, cold (no caches), poll.sh asking what an open window asks every 5 s, the poll loop killed between runs (advgcp2.sh); phys_footprint peak: before ( |
||
|
|
c59c547c5b |
claudetui: Claude Code's interactive mode on Windows, in a pseudo console
A Claude run on Windows was always claude -p, the entrypoint the plan counts at about twice the interactive mode's. The helper now starts Claude Code in a ConPTY there (child_windows.go): CreatePseudoConsole on two pipes, CreateProcess with the console attribute and STARTF_USESTDHANDLES with no handles. Without that flag a child takes the helper's own standard handles (the bridge's pipes) and draws into them, not the console. A .cmd claude is quoted by proc.Command as the -p run's. Ending closes the console, then kills after 3s; the -p fallback runs Claude Code as a child, as Windows has no exec. The pty code moved to child_unix.go unchanged, and tui.go has no build tag. Windows ends a run by killing its job, which no handler hears, so a turn's images folder is now removed once its message is sent, and a helper starting removes magpie-claude-images-* folders over an hour old (dropLeftImages). The gateway's gate lets Windows through (WSL stays -p), and the setting's text no longer says Windows is always -p (en, zh, zh-TW, ja, de). Doc updated. Run: - go test ./internal/claudetui on macOS (mote), Linux (magpie-desktop WSL2) and Windows 11 26200 (xiaomi-gpu): ok. The fake Claude Code on Windows is a claude.cmd, its console made raw with SetConsoleMode. New: TestDropLeftImages, and TestShimPastesImages checks the folder is gone after its message. - go test -run Claude ./internal/gateway on mote, and the TUI tests on Windows: ok. - i18n-keys and claude-tui-setting (chromium and webkit, en/zh/ja/de, 1100 and 420): 20 of 20 on the Windows box. On mote chromium passed and every webkit case timed out in browserType.launch, beside other sessions' GUI suites running for up to 20 hours (load 22). - go vet -tags nogui of claudetui, gateway and cli for darwin, linux and windows; gofmt -l clean. - Real account on xiaomi-gpu: a sandbox HOME gateway (port 3462) with the Claude Max account, real claude.exe 2.1.281, haiku-5-5. One tool call, two in one message, text then a call, and two image turns (twice): all right answers. 81 transcript rows, every one "entrypoint":"cli", no "-p" line in the log. Images noted as C:\Users\...\magpie-claude-images-*\image-N.png and no folder left. Killing the gateway ended its four resident helpers and claude.exe. The token wasn't refreshed; the copied credentials were deleted. (This ran before the 1809 check in start was added; the claudetui tests on Windows and GOOS=windows vet ran again after it: ok.) Broken by hand: STARTF_USESTDHANDLES removed, TestShimTurnsInteractive on Windows red (3 lines of 5 in 30s: the fake's drawing reached the shim's stdout). Not tried: an npm claude.cmd install with the real account (only the fake .cmd), Windows 10 before 1809 (no CreatePseudoConsole: the start checks for it and falls back to -p), a run ended mid-turn by the client on Windows. A stray "The system cannot find the path specified." showed once in the Windows test output; it wasn't on the shim's stderr, and three reruns didn't show it. |
||
|
|
c8f199695c |
gateway: DeepSeek's reasoning is held for a refusal after it; WorkBuddy plugin min 0.2.4 (plugins #540)
itspig (plugins #540): deepseek-v4.1-flash on WorkBuddy, through group/tiered, reasoned ~5s, said "Sorry, I can't respond to this question.", and ended finish_reason content_filter with 0 output tokens under a 200. The try was recorded done/200, none of the 15 members behind it was asked, and DeepSeek Harness failed "The model refused to complete the request". Two halves: - workbuddy 0.2.4 (plugins 4883f94) takes the filter's canned line out of a streamed chat that ends content_filter with nothing else said. - refusesAfterThinking now holds DeepSeek's reasoning too (as Claude's, GPT's and Gemini's), only while another candidate could answer: with it let through as it came, a refusal after it could never go to the next member. DeepSeek's own API documents finish_reason content_filter. The cost: in a group with a member behind it, DeepSeek's thinking reaches the agent once its text begins (kept alive meanwhile), as Claude's does; on the last candidate it streams as before. GLM, Kimi and others are unchanged. - The workbuddy mover's min is 0.2.4 (npm view --prefer-online: 0.2.4). Run on mote at this tree: go test ./internal/gateway -run 'TestDeepSeekRefusalAfterThinkingFailsOver|TestThinkingHeldFor| TestRefusalAfterThinkingFailsOver|TestThinkingStreams' ok; go test ./internal/provider ok; gofmt -l clean. The full ./... suite was started at this tree minus the one-line min and is still running; its result goes on plugins #540 (owner rule: tag without waiting). Broken by hand: without the deepseek prefix, TestDeepSeekRefusalAfterThinkingFailsOver/refused goes red (DeepSeek's reasoning reached the agent, b never asked) and TestThinkingHeldFor red for the three DeepSeek ids; /answered stays green. Not tried: a real WorkBuddy refusal (no prompt reproduces it on demand); the upstream's literal chunking isn't in the issue, so the fixture is built from its fields (reasoning, content_filter, 0 tokens). |
||
|
|
bca0d6d69a |
claudetui: a turn's images are pasted as files, not sent to claude -p
A request with images ran claude -p, and a turn with one ended the interactive run. The helper now writes each base64 image to image-N.<ext> (0600) in a magpie-claude-images-* temp folder and pastes its path alone, which Claude Code 2.1.314 reads into the message as [Image #N]; a path inside other words stays words. Claude Code reads the file after the paste returns, so the helper waits for [Image #N] past the last one before pasting the next piece. The folder is removed when the helper ends. Only an image known by its URL still goes to -p (urlImages), and tuiPromptMost counts words without images. Run: go test ./internal/claudetui ./internal/cli on mote and in WSL magpie-desktop, ok; go test -run 'TestClaudeTUI|TestSubscription| TestClaudePrint' ./internal/gateway on mote, ok; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build, gofmt -l, ok. Real account (Claude Code 2.1.314, haiku, sandbox HOME) through the sandbox gateway with tools: a red then a blue square in two turns, 3 of 3 answered red, blue; the transcript has image blocks in both user rows, entrypoint cli, and the second turn went on in the same run. Broken by hand: without the wait for [Image #N], TestShimPastesImages loses the second image. Not tried: an image over Claude Code's size limit; Linux with a real account. |
||
|
|
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
|