Claude Pro's menu bar card drew its 5-hour and 7-day windows as two
small stacked numbers, and the user wanted one of them alone. Settings ›
Usage › Menu bar windows (under Allowances in the menu bar) lists a pill
per ticked subscription with two or more windows ("Claude Code · All
windows"), opening the app's menu: All windows, then each window. The
choice is settings.TrayWindows, by provider id (every account of it, the
in-use "|*" card too) and by window kind from the span ("5h", "1d", "7d",
"month", "15m", "name:<name>" when the span is unknown), so a vendor
reordering windows changes nothing. Unset shows every window as before;
a pick whose windows are all gone shows every window again, never an
empty card. Only the bar's rows and the Linux label are filtered; the
tooltip still says every window. One row draws at mpRowFont's 11pt
single-row size. Hidden on Windows (its tray shows no text). Per
computer through KeepOwn. The GUI learns kinds from trayKind on
/api/usage/quotas (withTrayKinds; model and aside windows get none). The
row's code is a lazily imported traywindows.js, so the core script
budget is not raised (app.js +4 lines for the call and the prefs keep).
Run:
- mote (macOS): go test -run 'TrayWindow|TrayUsage|WithTrayKinds|
CoreScriptBudget|AppScript|TrayImage' ./internal/gui/ ok;
./internal/settings/ ok; davsync TestSync ok. TestTrayImageOneWindow
draws through AppKit: Claude's card one line ("42%"), both windows two;
the PNGs were looked at.
- mote: gofmt -l empty; go vet ./..., GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./... ok; go build, GOOS=linux go build
-tags nogui, GOOS=windows go build ok.
- magpie-desktop (Linux VM), --test-concurrency=1, BROWSER=chromium and
webkit: tray-windows (en, zh, zh-TW, ja, de; picking All; hidden on
Windows / single-window / no cards; 360px narrow), i18n-keys,
old-webkit, tray-usages, tray-logos, tray-cost, quota-pace: 43/43 each.
After rebasing on ec5571d6f: the focused Go run above, davsync and vet of
the touched packages ok on mote; tray-windows, i18n-keys, old-webkit,
tray-usages 27/27 in chromium and webkit on the Linux VM.
Broken by hand: the row filter in trayCardText off -> TestTrayWindowsPicked
and TestTrayImageOneWindow red; trayWindows out of prefsKeep ->
tray-windows.test.cjs red in every language. Restored, green.
Not run: the full Go suite (owner: ship each verified fix at once; mote
was at load 20-27 under another session's full GUI suite) and the whole
GUI suite. The GUI ran on the Linux VM because mote's browsers crash or
hang under that load (#4125; TestTrayCellClickReleasedPanel is red the
same way on origin/main c84c3e1c0 there).
Not tried: the live app's real menu bar with a signed-in Claude account
(the AppKit drawer was exercised in-process instead); Linux tray label
on a real desktop.
oreoft on Discord: Codex Desktop on a Claude model (Responses translated
to Messages) on a Bedrock-backed line. After a turn with reasoning and a
web_search_call, the next turn got 400 "messages.N.content.1: thinking or
redacted_thinking blocks in the latest assistant message cannot be
modified", Codex retried it ~6 times, then "stream disconnected".
Cause: on a line that doesn't search by itself, magpie runs the search
(searchRounds). Claude writes the reply as two messages: [thinking A,
text, web_search tool_use], then after magpie's tool_result [thinking B,
answer]. Codex keeps only the items: reasoning A, message,
web_search_call, reasoning B, message. parseResponses dropped the
web_search_call, so the next turn sent one message [thinking A, text,
thinking B, answer]. Each block kept its exact text and signature
(claudeseal), but B had moved, which Bedrock checks and direct Anthropic
lets pass.
Fix: parseResponses keeps a web_search_call as a Search part.
searchRoundsBack splits an assistant run that holds Claude's signed (or
redacted) thinking at each search into magpie's web_search call (named as
searchTool names it) and a result with the query and the pages found,
since what the search said was never kept. The latest assistant message
is then [thinking B, answer], as Claude wrote it. A search with no
Claude thinking beside it is left out, as before, and a history with no
web_search_call is untouched (direct Anthropic with valid signatures and
no search: same body as before).
Run:
- TestClaudeThinkingAroundMagpieSearchGoesBackAsWritten (new): a strict
fake Messages upstream refuses, with Bedrock's words, a latest
assistant message whose thinking blocks aren't one it wrote at the
same places. The test runs Codex's two turns through /v1/responses with
a fake Tavily, streamed and not. TestSearchWithoutClaudeThinkingStaysOut
(new). Both pass, with the focused Search/Codex tool-loop tests, on mote.
- Broken by hand (claudeSigned always false, i.e. the old drop): red with
"400 (refused 2) messages.1.content.1: thinking ... cannot be
modified", the reporter's error, after Codex-style retries.
- Full suite go test -tags nogui -count=1 -timeout 45m ./... on the Linux
box (mote had three other full suites running): every package ok except
internal/agent's TestInstalledVersion, TestGrokInstalled,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI and TestOmpDetectedWithPiDir.
These are #4033 and #3548, red at main on that box, in a package this
change doesn't touch. After the rebase onto acdc85ac8: internal/gateway
vet and tests again on the Linux box, ok (1293s). go vet of
internal/gateway for darwin, linux and windows on mote; gofmt clean.
Not tried: a real Bedrock-backed Claude line or a real Codex Desktop.
Anthropic's search run by the upstream itself (server_tool_use, a relay
told to search) isn't told to Codex as web_search_call, so it isn't
covered here. The rebuilt tool_result holds the query and URLs, not
the page text the model saw.
zytszone on X runs one magpie's gateway for a whole department, whose
people can't be given the admin's app. Each now opens the gateway's /me
at the address they reach it at, types the gateway key they were given,
and sees that key's own name, limits and what is spent of them, its
usage over today, 7 and 30 days with its most used models, the models
it may use, and copy-ready setup for Claude Code (settings.json env),
Codex (config.toml provider, /v1, responses), any OpenAI-compatible
client and a curl test. The base URL is the address the page was
opened at, never 127.0.0.1; the key is a placeholder until "Put my key
in the setup" is ticked. Strings in en, zh, zh-TW, ja and de.
- GET /me (keypage.html, embedded) is the same bytes for everyone and
holds no data, so lanGuard serves exactly GET/HEAD /me (no escaped
path) to another machine without a key, after the allow list, the
rebinding check and the not-shared 403, which still apply. Its CSP
loads nothing from elsewhere, posts no form and forbids framing.
- GET /v1/magpie/me (keyInfo) answers access.Caller's own key only. No
key, a wrong one, one turned off and magpie's own token are 401
alike; ?key= is refused 400 so a key never sits in an address or a
log. It names no account, other key, provider or secret; its models
are /v1/models' for that key (keyAllowed), none for a read-only key.
The page sends the key as Authorization to its own origin with
credentials omitted and keeps it in sessionStorage only.
- Both are in readOnlyRoutes, /me in clientPrefixes (magpie web's page
port), and Gateway -> Gateway keys shows the page's address
(MAGPIE_PUBLIC_URL, else the LAN address offered) with a Copy, while
shared and with a key. Docs: gateway-routing.md, reference.md.
Run:
- mote: go build -tags nogui ./...; go vet -tags nogui gateway+gui;
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway;
go test -tags nogui -count=1 ./internal/gateway ./internal/gui: ok
(gateway 732s). gofmt -l clean. Rebased onto 18b63fe5f after that;
there: build, vet, and the KeyPage, read-only, client path, page
port, LAN guard, caller usage and core script budget tests ok.
- Key page Go tests, through the real lanGuard(Handler()) chain, from
the network and from loopback: the key sees its own name, usage, top
model, limits and allowed models and nothing of Bob, Bob's secret,
the upstream key or magpie's token; no key, wrong key, turned-off key
(Bearer and x-api-key), magpie's Token, ?key=, Origin null, an
evil.localhost page, a foreign origin with a good key and a rebound
Host all get nothing; the page opens without a key, not on POST,
/me/x or /%6De, and not while unshared; a read-only key gets no
models.
- GUI, key-page.test.cjs: Chromium on mote and WebKit on the Linux box
(magpie-desktop), 390px, all five languages, 24 of 24; i18n-keys ok.
The 46 Gateway/caller-key GUI files and i18n-keys on the Linux box,
both engines: 645 pass, 11 red at concurrency 4. Serially 6 stay red,
and the same tests are red on origin/main a0cb8b646 there:
api-key-theme "system", gateway-key-limit webkit en/zh,
connect-snippet-shell, gateway-key-models (#4120), phone-rows (#4218).
Broken by hand, each red then restored: lanGuard's /me exemption
removed (page 401); the KeyID check removed (no key/wrong/off/Token got
data); keyAllowed dropped (Alice saw plan/m2); the RawPath check dropped
(/%6De served); the ?key refusal dropped (200 with Alice's data).
Not tried: a real Claude Code or Codex pointed at a shared gateway with
the page's snippets; WebKit on macOS (every WebKit launch on mote hangs
right now, for every session, a bare launch included); the whole GUI
suite and a full go test ./... (one suite per machine; mote is running
other sessions' suites).
Claude Desktop's auto mode classifier marks its transcript blocks with
native cache_control but sends none of magpie's private headers, so
serveSubscription took the default parse and the marks were dropped.
And even a request that opted in lost its older boundaries:
renderCachedParts ended a block only where a mark still stood, so a
mark that moved on with the conversation's growth let the block it
used to end merge into the next marked one. Anthropic's prefix check
looks back over block boundaries, not into them: the boundary gone,
each classifier turn found none of the last one's write and wrote the
whole transcript again (about 170k tokens a turn at the reporter's
site).
A part that came from one of the client's own content blocks now ends
its rendered block whether or not it still carries a mark; only the
mark's presence adds cache_control. A classifier-shaped Messages body
carrying cache_control is parsed for its marks like an opted-in
client's. Plain-string messages still merge into history chunks, so a
retained prefix reaches as far back as it did.
Changed from ggbdpq's patch: the classifier never asked for its marks
through X-Magpie-Cache-Marks, so a set the bridge can't keep (a TTL
order Anthropic refuses, more than four marks) now goes the default
way, as before, instead of being refused with a 400 that the old code
never gave. TestClaudeClientCacheClassifierBadMarksServedAsBefore
holds it. The bridge doc says so.
Run (mote, macOS):
- Red on origin/main (the reporter's offline repro, renamed beside the
other client-cache tests): client_marks 6 -> 6 blocks with 307
reusable bytes, as the issue reports; the classifier's marks dropped
without the header.
- go test -tags nogui -count=1 -run 'TestClaudeClientCache|TestAudit|
TestClaude|TestAutoMode|TestServerReview' ./internal/gateway: ok.
- Broken by hand: the fallback removed, the new bad-marks test red
("refused before run startup: 400 ... a ttl='1h' cache_control block
must not come after a ttl='5m'"); restored, green.
- gofmt -l clean. go vet (darwin, GOOS=windows, GOOS=linux) ok on
gateway and provider. Full suite at b80d1ba7b (this commit, on the
#2937 one, rebased on ddb1701fe): go test -tags nogui -count=1
-timeout 45m ./... , 81 packages ok, no FAIL (gateway 755s). Other
sessions' suites ran on mote at the same time (load ~20 to 30).
- Rebased on 2f65a33aa (gateway.go and providers-accounts.md changed
upstream, in unrelated lines): gateway, provider, plugin and library
rerun with -count=1 -timeout 45m, all ok.
- Then rebased on a0cb8b646 (Ark web search, gateway.go): go vet and
-run 'TestClaude|TestAutoMode|TestExtraBody|TestHeaders|TestAudit|
TestServerReview|Ark|Search' on gateway and provider at the pushed
head, ok.
Not tried: a real Claude subscription A/B of the classifier's cache
reads (it would spend ~170k tokens a turn on the owner's live account);
the gain rests on the offline repro's block counts.
Fixes#3835
Co-authored-by: yetone <yetoneful@gmail.com>
Claude Code's subagents send their lead's x-claude-code-session-id, so
an extraBody of {"prompt_cache_key": "${sessionId}"} put every subagent
of a conversation on one key, more traffic than a relay keeps on one
machine: the reporter's subagent turns read 0 or only the shared
~22K system prefix after full hits on the turn before.
${subagentId} is now the request's x-claude-code-agent-id (subOf),
which a subagent's turns send and the conversation's own never do: ""
for the lead. "${sessionId}:${subagentId}" gives the lead one key and
each subagent its own. It is opt-in: a value without it goes out byte
for byte as before, Test and Detect fill it with "", and other agents
get "" (never the literal). Conversation carries it (Session, Thread,
Subagent) and Conversation.expand fills it, so a provider's Headers
take it too, as they take the other two; ggbdpq's patch left a header
naming it to go out as written, which the providers doc says never
happens to a placeholder.
The default prompt_cache_key magpie fills (ownCacheKey, cacheKeyOf)
stays per conversation; the subagent is not folded in. The one
measurement on the default path (tingxueren on this issue: 452 Claude
Code requests, 98.21% weighted hit with a conversation-level key) shows
no overload, the overload was seen on two pooled relays, and folding
would move every default user's keys unasked. The placeholder covers
the reporter's case; the default can be revisited with data.
Patch by ggbdpq (branch hunt50-e-sessionid-cache, b25c8ab82), rebased;
headers added here.
Run (mote, macOS):
- go test -run 'TestExtraBody|TestWithExtraBody|TestHeaders|TestOwnCacheKey|Conversation'
./internal/gateway ./internal/provider: ok both.
- Red on origin/main's product code with the new tests:
TestExtraBodySubagentId "the lead's key \"sess-1:${subagentId}\"",
TestHeadersCarryTheSubagent "X-Route \"sess-1/${subagentId}\"".
- Broken by hand: Subagent: subOf(in) dropped in forwardOnce,
TestExtraBodySubagentId red ("a subagent's key \"sess-1:\"").
- gofmt -l clean. go vet (darwin, GOOS=windows, GOOS=linux) ok on
gateway and provider. Full suite at b80d1ba7b (this commit with the
#3835 one on top, rebased on ddb1701fe), mote: go test -tags nogui
-count=1 -timeout 45m ./... , 81 packages ok, no FAIL (gateway 755s,
provider 253s). Other sessions' suites ran on mote at the same time
(load ~20 to 30).
- Rebased on 2f65a33aa (gateway.go and providers-accounts.md changed
upstream, in unrelated lines): gateway, provider, plugin and library
rerun with -count=1 -timeout 45m, all ok.
- Then rebased on a0cb8b646 (Ark web search, gateway.go): go vet and
-run 'TestClaude|TestAutoMode|TestExtraBody|TestHeaders|TestAudit|
TestServerReview|Ark|Search' on gateway and provider at the pushed
head, ok.
Not tried: a real pooled relay; no GUI hint names ${subagentId} (the
editor's hint text and its translations are unchanged; the providers
doc names it).
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
chenxiang0010 (Discord #general) asked for a tools plugin's tools, Search1API's
(@magpie-community/tools-search1api), to be in magpie's aggregated MCP server.
Until now plugin tools were served only at /mcp/magpie/tools, wired by hand;
the hub listed Library servers only.
Now each plugin that is on and gives tools becomes a Library server once the
plugin host has noted its tools (plugin-tools.json, new plugin.ToolsNoted):
- named by the plugin's short name (search1api, search1api-plugin beside a
user's server of that name), `plugin` set, `local`, its URL the new
/mcp/magpie/tools/<short> (gateway ToolsMCPOne), which serves that
plugin's tools alone by their own names;
- added with the hub on, it is on for the agents given the hub's entry, so
their hub lists search1api__search etc. at once; with the hub off it is on
for none until switched on. Per agent and per tool it is switched like any
server;
- the hub lists and runs its tools in process (gateway.PluginToolsOf,
RunPluginToolOf, under the Plugin tools gate); with the hub off an agent is
given the per-plugin URL at the address it reaches the gateway (through),
with a key from another machine;
- offered once (pluginsOffered): removed by the user, it comes back only when
the plugin is removed and added again. The plugin removed takes the server
out; turned off it stays and lists nothing; an unreadable plugins.json
changes nothing (plugin.ReadList). Edited in the Library's editor, which
doesn't send `plugin`, it stays the plugin's.
Docs: docs/subsystems/plugin-tools.md, mcp-hub.md, site docs plugins (en, zh, ja).
Run (mote; full suite at this change on origin/main 024393fbb, then rebased on
acdc85ac8, whose 5 commits touch internal/plugin/page.go and a gateway test;
library, gateway and plugin focused runs again at the pushed head: ok):
- go test -tags nogui ./internal/library ./internal/gateway ./internal/plugin
-run 'PluginTool|Hub|ToolsMCP|ServingGates|OwnMCPRejects|Tool': ok.
- TestReadOnlyKeyEveryRoute also covers the new route.
- New tests: TestPluginToolsInHub, TestPluginToolsServerComesAndGoes,
TestPluginToolsServerThroughAnotherAddress (library), TestToolsMCPOnePlugin
(gateway).
- go vet (darwin, GOOS=linux, GOOS=windows) on the three packages; go build: ok.
gofmt -l: clean.
- Full suite, go test -tags nogui -count=1 -timeout 45m ./... (log kept):
80 packages ok, internal/gateway red on TestReadOnlyKeyEveryRoute: the new
route wasn't classified for read-only keys. Added to readOnlyRefused's
list in the test (a read-only key is refused there, as at
/mcp/magpie/tools); internal/gateway whole package again: ok (846s).
- Real run, sandbox HOME on mote, built binary, MAGPIE_ADDR on a free port:
`magpie plugin add @magpie-community/tools-search1api` (latest from npm),
`magpie serve`. library.json got the search1api server (plugin, local,
url .../mcp/magpie/tools/search1api, pluginsOffered); the per-plugin
endpoint listed search, news, ask, crawl, sitemap, trending, send_feedback;
with the hub on, /mcp/magpie/hub listed search1api__search ... and
search1api__search answered isError "Sign in with `magpie plugin login
search1api`, configure apiKey ..." from the plugin.
Broken by hand (each red, then restored):
- hub ignoring plugin servers (backend path): TestPluginToolsInHub red
("claude's hub tools [fake/a fake/b fake/c]").
- adoptPlugins returning false at once: both library tests red ("no server
for the plugin").
- through's plugin branch off: TestPluginToolsServerThroughAnotherAddress red.
- the ToolsMCPOne route removed: TestToolsMCPOnePlugin red (404).
Not tried: a signed-in Search1API account (none here), so no search went
through; a real agent (Claude Code, Codex) calling the hub; WSL/remote
agents through another address (unit test only); the GUI's Library page
showing the server (no GUI file changed, GUI suite not run).
In switch-only mode, Claude Code asks Anthropic directly, so magpie learns
the active account is out only from a `claude -p /usage` read. That read was
due 5 to 15 minutes (claudeUsageWait) after the last one, and
KeepOnAnAccountWithRoom looked at Claude's sign-in only every 5 minutes.
Codex already had a 1-minute near-out cadence; Claude had none. mydosu's
account read 4% left at 12:16:15, which is under Smart's 98% threshold, so
it was rightly not moved then. It burnt through within the 5-minute gap,
and Claude Code refused for about 1.5 minutes until a hand switch, while
the other account had 100% left.
Changed:
- While Claude has an account to move to, the loop looks at its sign-in
every claudeLookEvery (1 min) between the full looks (claudeLookDue).
- Near out (an all-model window at 90% or more, codexNearShare), the
active account's /usage is due a minute after the last read instead of
at its 5-15 minute wait (claudeWaitOf).
- When Claude Code writes its own rate_limit refusal ("You've hit your …
limit": error "rate_limit", isApiErrorMessage) into a session in
~/.claude/projects/*/*.jsonl, the next look reads /usage at once and
marks the reading stale (StaleAllowance). Only the bytes appended since
the last scan are read (at most 1MB per session per scan). The first
scan only marks where the sessions end. The refusal is a cue for the
read, not a switch by itself: the transcript doesn't say which account
was refused.
- Cost per minute: Logins("claude") plus leftAlone. With a spare, also a
stat of each session file and a read of the appended bytes. /usage runs
every minute only while the account is near out and in use, or after a
refusal (30s floor still applies).
Run:
- New tests: TestClaudeNearOutIsReadEveryMinute,
TestClaudeRefusalInSessionReadsAtOnce, TestScanClaudeLimits,
TestKeepOnAnAccountWithRoomLooksAtClaudeNearOut. Pass under -race
-count=3 on mote, with TestClaudeSwitchOnly* and TestClaudeUsage*.
- Broken by hand, each red: no near-out wait ->
TestClaudeNearOutIsReadEveryMinute ("switched to \"\""); no refusal due
-> TestClaudeRefusalInSessionReadsAtOnce; no in-between look in the loop
-> TestKeepOnAnAccountWithRoomLooksAtClaudeNearOut (still on pro@x.com
at its 1-minute deadline).
- Windows (xiaomi-gpu, win-run): the new and Claude tests pass. The whole
internal/provider package has 13 reds there, and all 13 fail the same way
run alone at origin/main d99e213f5: #2808 (keychain, SavedButSignedOut),
#4115 (CodexDaemonEnv, CodexListTag), and #4446, filed now
(TestCodexSignInKnown, TestGitOnDisk*).
- mote at eaa2eeb29 (this commit on fa427216a): gofmt -l clean; go vet
(nogui, GOOS=linux nogui, GOOS=windows); go build for darwin, linux and
windows; go test -tags nogui -count=1 -timeout 45m ./... exit 0, every
package ok (gateway 672s, agent 268s, provider 173s).
- Rebased on 4 commits (gateway, plugin, provider/codex_models; none
touch these files), at the pushed tree on mote: go vet (nogui, linux,
windows), darwin and windows builds, internal/provider ok (213s) and
internal/gateway ok (716s).
Not tried: a real Claude account running out, and a real Claude Code
session on Windows writing its refusal. The refusal line's format was
checked read-only against real local transcripts. No UI added.
jorbenzhu on Discord: after every update and restart the panel is back in
the middle of the screen. It is the main window: after an update magpie
starts again with `magpie gui <tab>`, and Wails opens a window centred
unless told otherwise. Its size and maximised state were kept; its place
never was (gui-shell.md said "The window's position is not kept"), so
nothing was lost on upgrade, there was nothing to restore. The tray's
panel opens under the tray icon on the Mac and Windows, and where the
click was on Linux, so it is not what moved.
Now settings.WindowAt keeps the window's top left corner (system
coordinates across every screen), per machine like Window (KeepOwn, and
the Settings page's save carries it over). keepAt saves it once a move or
resize has rested 500ms, unless the window is maximised, full screen,
minimised or hidden; settings.Save writes through temp and rename, and an
unreadable settings file is left alone. On the first show placeMain puts
it back (putBack): openAt picks the screen holding most of the window and
moves it fully onto that screen's work area; when no screen holds any of
it (a monitor gone) or the screens or the file can't be read, it stays
centred. Under Wayland a window can't place itself, so nothing is kept or
restored there unless GDK_BACKEND is x11 (keepsPlace).
Run:
- mote, at 3f8f1d88b (on d99e213f5): go test -timeout 45m -count=1 ./...
80 packages ok; internal/gui red only in its 10 real-window AppKit
tests (TestDockJoinLeadsCommandTab, TestPanelCloseHidesIt,
TestPanelJoinsFullScreenSpaces, TestPluginPageLoadsItsFilesInTheWindow,
TestDockReopenKeepsTheWindowsSpace, TestMainWindowCorners,
TestMainWindowRightToLeft, TestHandoverLeavesTheMenuBarIconForTheNextMagpie,
TestTrayCellClickReleasedPanel, TestCoveredWindowStaysUp), each killed
at its deadline. The same 10 fail the same way on origin/main
fa427216a: mote has no console session (#4125).
- mote, after rebasing onto 024393fbb (two gateway commits, none of
these files): internal/gui (less the 10 above), internal/settings and
internal/gateway: ok.
- mote: gofmt -l; go vet ./internal/gui ./internal/settings; GOOS=linux
go vet -tags nogui ./...; GOOS=windows go vet ./...; go build, and
GOOS=windows / GOOS=linux -tags nogui builds: clean.
- Windows (win-run) and Linux (wsl-run, -tags gtk3): TestOpenAt,
TestSettleAt, TestKeepsPlace, TestOpenSize, TestSettle*,
TestSettingsSaveKeeps*, TestWindowMaximisedKeptAndOwn: ok.
Broken by hand (each red, then restored):
- api.go not carrying WindowAt over a Settings save:
TestSettingsSaveKeepsWhatItDoesNotSend red ("WindowAt: [] after a save
of the Settings page, was [-1440 120]").
- KeepOwn not keeping WindowAt: TestWindowMaximisedKeptAndOwn red.
- openAt without the clamp and the gone-screen check: TestOpenAt red in
7 of 12 cases.
Real app, Linux X11 (magpie-desktop, Xvfb 1920x1080 + xfwm4, sandbox
HOME/XDG dirs, MAGPIE_ADDR 127.0.0.1:3447, gtk3 build of this tree):
first start centred (630,240 in X terms); xdotool moved it to 200,150 and
settings.json got windowAt; restarted, it opened at 200,150; windowAt
[5000,4000] (a gone monitor) opened centred; [1700,900] opened at
[1260,480], flush with the bottom right (660x600 + GTK's 26px shadow).
Not tried: the real app on macOS (mote has no console session, #4125)
and on Windows (a sandbox magpie.exe rewrites HKCU\Software\Classes\magpie,
which points at another session's build there). Wayland is not restored
by design. Multi-monitor setups with mixed scaling were not tried on real
hardware; openAt's cases cover a second screen left of and right of the
main one.
Refs yetone/magpie#2532 (the Responses-to-Responses translation case).
An offered web_search can select translation even for a Responses upstream.
Keep system/developer items in place instead of lifting initial Plan
instructions and demoting a later Default update to a user reminder.
Other APIs and the Claude bridge retain their existing cache mapping.
Update the gateway routing reference and cover search continuation rounds.
Verification on macOS arm64 with Go 1.26.10, isolated HOME and pinned caches:
- New tests on unmodified cc04ce68c1 plus
test changes fail with real assertions in
TestResponsesInstructionRolesThroughSearch (developer/system),
TestResponsesInstructionsOtherAPIsUnchanged and
TestCodexSearchAnsweredOnResponses.
- Those patched tests, TestCodexLaterDeveloperMessageKeepsTheSystem and
TestSearchOfferedStaysOnTheClientsAPI pass, also with -race.
- gofmt and diff checks pass.
- Native, Linux/nogui and Windows vet and builds pass.
- go test -tags nogui ./... fails in the unchanged internal/agent package:
TestRunningNeedsNoPs cannot find its sleep 314.159 process. The complete
internal/gateway suite passes (427.556s), as do the other packages.
- The patched executable against an isolated local capture upstream keeps
Plan and Default as developer messages in minimal and full histories
with web_search offered; real configuration hashes remain unchanged.
Not run: paid real-upstream acceptance, native Linux/Windows runtime tests,
or browser GUI tests (no GUI assets changed).
The unrelated agent failure was traced to macOS pgrep returning exit 3,
"Regular expression evaluation error (illegal byte sequence)", under the
inherited locale. The same local sleep process is found with LC_ALL=C.
TestRunningNeedsNoPs fails 20/20 under -race with the inherited locale and
passes 20/20 with LC_ALL=C (3.848s). No agent code or timeout was changed.
A full-suite recheck with LC_ALL=C is running at commit time; retain the
initial failure and publish as a draft until that recheck completes.
Adapted when landing: a blank line before the next heading in
docs/subsystems/gateway-routing.md. Cherry-picked by ggbdpq (gua2100).
Review and run record (landed by the maintainer's agent; gua2100 brought
both fixes from Discord, rebased onto main):
- External code, read line by line: no network, dependency, workflow or
credential change; Codex base_instructions/identity untouched.
- Base origin/main d99e213f5. Full checks on mote (macOS, Go 1.26.8,
sandbox HOME) at 31f025634, whose tree is the one pushed (only messages reworded since): gofmt, go vet darwin, linux,
windows, builds for all three: rc=0. go test -tags nogui -count=1
-timeout 45m ./...: 79 packages ok, internal/gateway ok (855s); two reds
in untouched packages, both filed before: internal/plugin
TestGatewayHookMixedPiPackage (#2865, "starting plugins: context deadline
exceeded") and internal/update TestRelaunchOpenTriedAgain (#3881). Run
alone at the same tree both pass (plugin 97s; update -count=3).
- Broken by hand: the #3739 regex reverted, so both Kimi tests fail (400
handed back). The #2532 product files reverted (six files), so all three
tests fail. The mergeTurns role guard removed fails (5 input messages,
want 7).
- Real binary on mote, sandbox HOME, a fake upstream that records requests:
at d99e213f5, wrke1990's literal #2532 body sends Plan in instructions
and Default as a user <system-reminder>; at HEAD both developer items
keep their role and place. #3739's curl body (and zfsdream96's ZCode
shape, output_config effort max, no thinking) is a 400 at d99e213f5; at
HEAD it is a 200 after one retry without thinking, and the next
request goes without disabled.
- Rebased onto fa427216a (responses.go stream deltas, landed meanwhile;
no conflict). At the rebased pushed tree: gofmt, go vet and
go test -count=1 ./internal/gateway ok (580s) on mote. The full suite
was not rerun after that rebase.
- Not covered: the search reroute's re-parse when a fallback changes
whether the target is Responses (breaking it leaves the tests green;
no route found that reaches it). Not tried: the real Kimi Code
endpoint and its kimi-code-cn preset (a custom Anthropic provider with
Kimi's literal 400 was used), a real Codex session against a paid
upstream, Windows/Linux runtime. #3739's second symptom (k3 losing
thinking when output_config.effort is asked) is not addressed.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
danzi002 on Discord: with requires_openai_auth = false on Codex's provider,
switching the Codex account in magpie still restarted the Codex app's
app-server and said the app and daemon were left on the old account.
Codex's provider with no requires_openai_auth = true goes by no ChatGPT
account: codex-rs ModelProviderInfo::account_state answers no account, and
resolve_provider_auth sends the table's key, never auth.json. So which
account auth.json holds is nothing a running Codex uses.
- provider.CodexNoAccount (set to agent.codexNoAccount): the config's top
model_provider is not openai, has a [model_providers] table, and the table
doesn't say requires_openai_auth = true. A profile, the built-in provider,
no table or an unreadable config count as false (may use the account).
- codexAppStep forgets a switch (and a spent switch) while it holds, so the
app-server is left running; a route change still restarts it.
- CodexAppStale / CodexDaemonStale say nothing, and `magpie accounts`'
switch line says nothing needs restarting.
- Kept: route-change restarts (model_provider, openai_base_url,
model_catalog_json, base_url, catalog hash: read only as the app-server
starts) and the daemon's model-list restarts; and switch restarts when
magpie writes requires_openai_auth = true (ChatGPT sign-in with room).
Run (mote-run; full suite at this change on e0ad48641):
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./..., go build for darwin/linux(nogui)/windows: ok.
- go test -tags nogui -timeout 45m ./...: 81 packages ok, no FAIL.
- New tests: TestCodexNoAccountSwitchRestartsNothing (provider),
TestCodexNoAccountFollowsRequiresOpenAIAuth and
TestCodexNoAccountOfEachConfig (agent).
- Broken by hand: codexNoAccount returning false in provider made
TestCodexNoAccountSwitchRestartsNothing red (ended the app-servers);
agent's codexNoAccount returning false made both agent tests red.
- Real codex-cli 0.165.0 in a sandbox CODEX_HOME with a provider table at
requires_openai_auth = false: app-server account/read and getAuthStatus
answered no account before and after auth.json was switched from a@x to
b@x, and `codex exec` against a loopback capture server sent
`Authorization: Bearer <the table's key>` with no chatgpt-account-id for
both accounts.
After rebasing onto origin/main (2 commits: gateway desktop probe,
usage purposes): go vet ./... and go test of internal/agent, provider,
cli, usage and gateway at the pushed head: ok.
Not tried: the real Codex desktop app (macOS or the Windows MSIX) through
a switch; a daemon with live sessions through a switch; the GUI suite
(no GUI asset changed; the switch notice reads CodexAppStale).
Also: the check follows a Desktop model switch made after the last turn.
cybercaius (#help): with gpt-6.1-sol on AnyRouter chosen in the
conversation, the Routing page showed "Claude Desktop requested
deepseek/deepseek-flash" while the answer came from gpt-6.1-sol. The route
was right; the row was not explained.
Those rows are Desktop's own connection check ({"max_tokens":1, content
"."}, app.asar 2.7032 lWt/YT). Desktop names its model itself: the
shortest listed id with haiku, else sonnet, else opus, else the FIRST
listed model. magpie lists no Claude-named ids to it, so the check names
the first one (deepseek-flash), whatever the conversation is on, and
magpie sends it to the model chosen in Desktop's menu (desktopChosen).
- The check is recorded with kind connection_check (KindDesktopCheck,
usage purposeKinds "Connection check", purposes.js regenerated). The
Routing page tags the row "Connection check" next to the requested id
and its story says the id is the one Desktop named from its list, not
the conversation's model, and where magpie sent it. zh/zh-TW/ja/de.
The requested id itself stays what Desktop sent.
- desktopChosen: a turn sent after cowork_account_settings.json was last
written wins over the menus (newer of the two). Before, the last
session's model came first whenever any menu still held it, so the Code
tab switched off DeepSeek with Cowork left on it kept the check on
DeepSeek. desktopPicked now carries when that turn was sent (the
file's mtime once read).
The two 400s were AnyRouter's own (the reporter says so); not changed.
Run (at 0013f990c, this tree before its rebase on e0ad48641 and the
version stamp v0.1.2208 -> v0.1.2212 in comments/doc):
- mote: go test -tags nogui -timeout 45m -count=1 ./... : 81 ok, exit 0.
- mote: go vet ./internal/gateway ./internal/usage for darwin, linux
(nogui) and windows: ok. gofmt clean. go generate ./internal/usage
gives the same purposes.js as committed.
- GUI: routing-desktop-check (new; en, zh, zh-TW, ja, de), routing-kind,
i18n-keys: chromium on mote ok; WebKit could not launch on mote (90+
hung pw_run.sh launches from other sessions), so both engines ran on
the Linux box (wsl-run): 14/14 ok.
- Whole GUI suite (wsl-run, concurrency 4) still running at push; reds
so far are in account-arrange, account-models and agent-expand-steady,
files this change does not reach. Checked against main after.
Broken by hand:
- call.Kind = KindDesktopCheck turned off: TestClaudeDesktopProbeAsksNoClassifier
red ('recorded as kind "" (unmarked)').
- the connection_check story removed from client.js: routing-desktop-check red.
- old desktop.go: the new "Code tab switched off the last session's
model" case red; the at.After check turned off: red too.
Not tried: a real Claude Desktop. Whether Desktop sends a check on each
model switch, and whether its composer switch writes the menu file, are
read from its bundle, not seen live. AnyRouter's 400s not looked into.
387e8572a gave a gateway hook origin "magpie-key" for the sharing key
magpie made itself, wherever it came from. But that key isn't only the
owner's agents': Gateway keys lists it (as "Magpie") with a Copy button
(copyCallerKeyBtn in plugins/gateway/keys.js), the connect section
offers it for another computer (selectConnectKey). A friend on the LAN handed it would
have read as "magpie-key", and plugins#526's switch would still have
served them the owner's memories.
Now it is "magpie-key" only from this computer (ownComputer), where
magpie writes it into agents (agent.keyAt): loopback (a WSL distro on
the WSL network is mapped to it by lanGuard), one of this computer's
own addresses (an agent calling MAGPIE_ADDR beyond loopback, ownAddr),
or a WSL distro's NAT network calling this computer's network address
(WSLNets). Never with forwarding headers, a trusted proxy's included,
nor through magpie web's page port. From anywhere else the key reads
"gateway-key", as every other key does.
docs/subsystems/gateway-request-hooks.md says so; plugins#530 and the
#526 comment are corrected to match.
Tests: TestAsyncGatewayOrigin (real Bun host) adds the sharing key from
this computer's own address and a WSL NAT address (magpie-key), and
from 10.0.0.1, through a proxy and through a trusted proxy
(gateway-key); 387e8572a's "magpie-key from 10.0.0.1" case now wants
gateway-key.
Run (on mote, at this tree):
- go test -timeout 45m ./... at 387e8572a plus this change: 80
packages ok (gateway 662s; access and plugin cached, unchanged since
387e8572a's full run); internal/gui red only in the same 10 real-window
AppKit tests as 387e8572a's run, which fail the same way on origin/main
48edbcb67 on mote: #4125, #2645.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/gateway.
Broken by hand (each subtest red, the rest green): ownComputer dropped
from gatewayOrigin (387e8572a's rule): elsewhere, proxied and
trusted-proxy red; ownAddr dropped: own-address red; the forwarded check
dropped: trusted-proxy red; the WSL-net check dropped: wsl-nat red.
Not tried: a real WSL distro under NAT or a MAGPIE_ADDR beyond loopback
sending the sharing key to a real plugin (the peer addresses are stubbed
through ownAddr and WSLNets); a magpie in a container, whose host's
agents reach it from the container's gateway address and read as
gateway-key.
A gateway hook's ctx.origin was "gateway-key" both for the sharing key
magpie makes and writes into this computer's own agents (a WSL distro
under NAT, MAGPIE_ADDR beyond loopback) and for a named key the owner
made for a friend. A plugin couldn't tell them apart: plugins PR #526
(nowledge-mem)'s "Agents using a Magpie key" switch would have put the
owner's memories into a friend's requests.
Now access.Authenticate marks the default sharing key (Identity.Default:
the key marked lan, the one LANKeyID names, or an older magpie's
settings-only key, as access.Default tells it), and gatewayOrigin
returns "magpie-key" for it. Every other key, on loopback too, stays
"gateway-key": one the owner made, a value a user brought, or a
sk-magpie- key that didn't authenticate. magpie has no "this named key
is mine" mark, so none of those is treated as the owner's.
Why a new value and not a new field: every consumer in
magpie-community/plugins (agent-office's track.mjs, powercontext, and
#526) compares origin to "local" only, and treats anything else, an
unknown value included, as not local. None compares to "gateway-key" in
code. So "magpie-key" lands in their not-local branch, where the
sharing key already was: no plugin gains or loses a request it serves.
host.js passes the context through untouched. A plugin that wants the
owner's agents checks one value.
docs/subsystems/gateway-request-hooks.md says what each value is. Not
changed: the plugins repo has no type or doc for origin; #526's own
README and switch are its author's to scope (asked on the PR).
Tests:
- TestAuthenticateTellsTheDefaultKey (access): the ConfigureLAN key, a
key named by LANKeyID only, and the legacy settings key read Default;
a made key and a user-brought value don't.
- TestAsyncGatewayOrigin (gateway, real Bun host): the sharing key from
10.0.0.1 and from loopback reaches onRequest and onResponse as
magpie-key; a friend's own-value key as gateway-key.
Run (on mote, at this tree):
- go test -timeout 45m ./...: 80 packages ok (access, gateway 760s,
plugin among them); internal/gui red only in its real-window AppKit
tests (TestDockJoinLeadsCommandTab, TestPanelCloseHidesIt,
TestMainWindowCorners and 7 more, each killed at its deadline). Three
of them run at a fresh origin/main 48edbcb67 on mote fail the same
way: #4125 (mote's AppKit tests hang) and #2645.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet of access,
gateway and plugin.
Broken by hand: origin/main's middleware.go put back, the two magpie-key
subtests red ("request origin=gateway-key, want magpie-key"); Default
forced false in Authenticate, TestAuthenticateTellsTheDefaultKey red in
its first two subtests.
Not tried: a real plugin in the GUI app with a WSL agent sending the
sharing key; npm-published plugins outside magpie-community weren't
searched.
lml0664 on Discord: Library > RTK offered a fixed few agents, even on the
latest magpie. RTK 1.1.0 (rtk-ai/rtk, Latest, 2026-10-25) has `rtk init`
agents claude, cursor, trae, windsurf, cline, kilocode, antigravity, kimi,
pi, hermes, droid, vibe, omp, plus --codex/--gemini/--opencode/--copilot.
Every one with a global hook that magpie has an agent for was already on
the page except Factory's Droid, which is added now:
- droid: rtk's own `rtk init -g --agent droid`, given Droid's folder as
FACTORY_HOME_OVERRIDE (magpie's droid agent honours it). rtk writes its
Execute group (`rtk hook droid`) into the root hooks.json, or into
settings.json's hooks.PreToolUse when Droid's hooks already live there
(src/hooks/init/droid.rs), so ReadRTK and switching off look at all
three files rtk may use (hooks.json, hooks/hooks.json, settings.json)
and leave the user's own hooks and settings. rtk before 0.44 has no
Droid agent, so it is blocked with "needs RTK 0.44 or newer".
- dropHook no longer slices key[:-1] for a top-level key (hooks.json's
"PreToolUse"); before, it would have panicked.
Listed with the switch off and their own reason (rtkNoHook and the page's
rtkNoHookWhy, in zh, zh-TW, ja and de too):
- Qoder, Qoder CN: rtk 1.1.0 has no Qoder agent (`--agent qoder` is an
invalid value), rtk-ai/rtk#1327 (PR #1721 open).
- Cline: `rtk init --agent cline` only writes a .clinerules in the
current project asking the model to type rtk, no hook (#3841).
- Kimi Code: Kimi's hooks can't rewrite a command; rtk writes only one
project's AGENTS.md and refuses -g ("Kimi AI is project-scoped").
RTK's Trae, Windsurf, Kilo Code and Mistral Vibe have no magpie agent.
Run:
- go test -tags nogui ./internal/library -run TestRTK on mote: ok
(TestRTKDroid home/override, TestRTKDroidSettingsHooks,
TestRTKNoHookQoderClineKimi new, sandbox HOME, fake rtk).
- Red on old code: rtk.go at HEAD^ -> TestRTKDroid, ...SettingsHooks and
...NoHookQoderClineKimi red. Broken by hand: version gate at 0.43, the
settings.json entry dropped -> red; FACTORY_HOME_OVERRIDE not passed ->
TestRTKDroid/home red. client.js at HEAD^ -> library-rtk-nohook red
(Qoder's reason was the generic one).
- Real rtk 1.1.0 (release tarball, sha256 checked against checksums.txt)
on mote in a sandbox HOME through SetRTK/ReadRTK: plain ~/.factory,
settings.json with the user's own Execute hook (kept, rtk's taken out)
and FACTORY_HOME_OVERRIDE: on, seen on, off, seen off. Real rtk also
refuses --agent qoder and -g --agent kimi, and cline writes .clinerules.
- Full suite on mote, go test -count=1 -timeout 45m ./...: 80 packages
ok; internal/gui red only in its 10 real-window AppKit tests (#4125).
- GOOS=linux and GOOS=windows go vet ./internal/library: ok. gofmt clean.
- GUI on the WSL box (mote's browsers crash at launch, #4125):
library-rtk-nohook (chromium+webkit, en+zh) and i18n-keys 10/10; all 45
library-*.test.cjs files 810/824, the 14 reds (library-chip-fan webkit,
library-items webkit, library-mcp-tools chromium ja 420) are the same
at origin/main cf9ea977c and are #4120.
Not tried: a real Droid session running the hook; the whole GUI suite
(only the Library files); Windows (Droid's folder there is the same code
path; no run).
omp gave a model served on Gemini's API the provider's openai-completions,
so the gateway translated Chat for it. ompProviderAt now writes such a
model as OmO does: api google-generative-ai, baseUrl <gateway>/v1beta.
Checked in omp's source (pi-ai providers/google.ts, 16.0.0, 16.3.5,
18.9.1, 18.14.0): it posts to baseUrl/models/<id>:streamGenerateContent
?alt=sse with x-goog-api-key, and throws only when the key is empty. The
issue's claim that auth: none breaks it is wrong: under auth: none omp's
model registry hands the client its no-auth key "N/A" (kNoAuth), which
loopback takes, so the provider stays keyless; a WSL omp under NAT sends
its apiKey there as before. Unlike pi-ai, omp's Google client takes a
custom fetch, so the Raft reason Pi stays on Chat doesn't apply.
Thinking: a Gemini 3+ model gets mode google-level (thinkingLevel; xhigh
and max go as HIGH, pi-catalog model-thinking.ts), a Gemini 1.x/2.x one
mode budget, since 2.5 refuses a level; omp sends that as
thinkingBudget -1 (custom models.yml has no effortBudgets).
Run:
- TestOmpGeminiModelsAskedOnGeminisAPI, TestOmpGeminiMode (new), and
TestOmp*/TestPi* on mote: ok.
- Broken by hand (Gemini case taken out): the new test is red on api,
baseUrl and thinking mode for gem/gemini-3-flash, gem/gemini-2.5-pro and
hybrid/gemini-3-flash; TestOmpGeminiMode doesn't build on the old code.
- go vet ./internal/agent for darwin, linux, windows: ok; gofmt clean.
- Real omp 18.14.0 (Bun 1.4.4) in a sandbox HOME on mote: magpie built
from this tree, `magpie provider add gem gemini=<fake>/v1beta`, `magpie
serve`, `magpie omp gem/gemini-3-flash`, then `omp -p`. omp answered
with the fake upstream's text through the gateway's /v1beta. Pointed
straight at a fake server, omp sent POST
/v1beta/models/gem/gemini-3-flash:streamGenerateContent?alt=sse with
x-goog-api-key: N/A and User-Agent: omp, and thinkingConfig.thinkingLevel
HIGH for --thinking high (MINIMAL for off).
- Full suite (go test -timeout 45m -count=1 ./...) on mote at c9b5fbb04
(origin/main cf9ea977c): every package ok except internal/gui, whose ten
real-window AppKit tests (panel, dock, tray, titlebar, plugin page) were
killed at their 20-80s deadlines, #2645 and #4125 (mote's AppKit/launchd
hang). This change touches no GUI code.
Not tried: a real Gemini account (the upstream was a fake); a Gemini 2.5
model through omp; a WSL omp.
xgddm88 on X: after turning Claude Desktop on in magpie (to use DeepSeek
V4.1 Flash), Desktop started with none of the earlier projects or chats.
Cause, from Desktop 2.7032's app.asar (index.pre.js, read only): in
third-party mode Desktop calls app.setPath("userData", …"Claude-3p")
("[custom-3p] userData mkdir"), so it runs in a profile of its own. The
signed-in (1P) chats, projects and Code sessions stay in
~/Library/Application Support/Claude. They are not deleted, only not
shown, and come back when Desktop is off magpie. magpie writes nothing
in Claude/ but deploymentMode, and only reads its config.json for the
language. There is no supported way to show 1P history in 3P mode.
So magpie says it before the switch is touched, and after:
- the Agents row, not connected: "Not connected · on magpie, Claude
Desktop opens a separate profile: chats and projects from your
Anthropic sign-in stay, and are back when you turn it off"
(CONNECT_BEFORE);
- the opened row, once connected (CONNECT_COST);
- the notice after On and after Off (noticeClaudedesktop3/4).
In en, zh, zh-TW, ja and de. agent-wiring.md says where Desktop's
history is and that Opus beside DeepSeek comes from a Claude
subscription added in magpie.
Run (worktree at cf9ea977c):
- gofmt -l internal/: nothing.
- mote: go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet
-tags nogui ./..., go build ./..., go test -timeout 45m
./internal/agent ./internal/gui: vets and build ok, internal/agent
ok; internal/gui red in 10 real-window AppKit tests (dock, panel,
tray, main window), each at its 20-40s deadline. Four of them, run
at origin/main cf9ea977c on mote, fail the same way; that is mote's
window server (#4125, #2645), not this change, which touches no Go
in internal/gui.
- GUI, Chromium on mote and WebKit on Linux (wsl-run; mote's WebKit
launches hang behind ~48 stuck pw_run.sh from other runs):
desktop-history (10+10 pass), and i18n-keys, agent-connect,
agent-failover, desktop-longest, desktop-tiers, desktop-model-menu,
desktop-subagent-model (36 pass in each engine).
Broken by hand:
- Notice without the new sentences: TestClaudeDesktopKeepsTheSignedInHistory
fails on the On and the Off notice.
- desktopOn writing Claude/config.json: the test fails, "on changed
…/Claude/config.json".
- connectLine without the CONNECT_BEFORE line: desktop-history fails
10 of 10 ("Not connected · Claude Desktop uses its own settings").
Not tried: a real Claude Desktop launched on magpie (sandbox and live
were both left alone); leaving disableDeploymentModeChooser unset so
Desktop's login screen offers Claude.ai sign-in beside magpie (unverified,
unchanged); Windows' Claude-3p path in a real app; WebKit on macOS.
ji233 on Discord: droid warned at session start that "ultrafast/gpt-6.1-sol
appears to be an OpenAI model, but is configured with provider
generic-chat-completion-api". magpie wrote every model on a Chat provider
as generic-chat-completion-api, whatever its name.
droid's own rule, read from its bundle (droid 0.231.0, xs and g2): a
custom model's "model" matching /\bgpt[-_.]?\d/i, /codex/i or
/\bo[1-9](?:[-_.]|$)/i on any provider but openai is warned about as
OpenAI's; then one matching /claude|haiku|sonnet|opus/i on neither
anthropic nor bedrock-converse as Claude's. droid first looks the name up
among its own models; every OpenAI one there matches the patterns except
gpt-image/gpt-transcribe, so the patterns alone are used (droidWants).
Such a model now goes on the provider droid asks for (openai on the
gateway's /v1, anthropic on its root), and the gateway translates
(Responses->Chat: TestResponsesClientChatUpstream; groups on Responses
as for Codex). Other models keep their native API as before.
A provider, displayName, maxContextLimit, maxOutputTokens or
noImageSupport the user changed in one of magpie's entries stays through
a sync and a new pick: what magpie last wrote is stashed
(droid:<path>:wrote), a value other than it is the user's. Keys magpie
doesn't write stay too (droid's index aside). baseUrl follows the
entry's provider; apiKey is wiring, put back at every sync. With no
record (entries an older magpie wrote, which each sync wrote over
anyway), magpie's values are taken, so ji233's entries move to openai on
the next sync. Disconnect forgets the record. Doc: agent-wiring.md.
Run (mote):
- go test ./internal/agent -run TestDroid: ok. Red on the old droid.go
(TestDroidWantsItsOwnRule, TestDroidProviderByName,
TestDroidKeepsAnEntryEditedByHand all FAIL); with droidMerge forced
to magpie's values, TestDroidKeepsAnEntryEditedByHand FAILs.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/agent ok.
- go test -count=1 -timeout 45m ./... at 5be7d8ab7 (on 133493488): 79
packages ok; internal/gui's real-window AppKit tests killed at their
deadline (TestPanelCloseHidesIt and TestTrayCellClickReleasedPanel
fail the same on origin/main b4cb946f9 on mote: #4125, #2645), and
internal/update TestRelaunchOpenTriedAgain's TempDir cleanup (#3881;
passes -count=3 alone at this head, and alone on b4cb946f9).
After rebasing on b4cb946f9: go test ./internal/agent ok.
- Real droid 0.231.0 in a sandbox HOME on mote, no sign-in, against a
sandbox `magpie serve` built from this tree with a Chat-only provider
"ultrafast" (gpt-6.1-sol, claude-opus-4-7, kimi-k2.5) on a fake
upstream: `magpie droid magpie/ultrafast/gpt-6.1-sol` wrote openai /
anthropic / generic-chat-completion-api; `droid exec -m
custom:magpie/ultrafast/<m> "say pong"` answered PONG for all three
through /v1/responses, /v1/messages and /v1/chat/completions, the
upstream got Chat each time, and no "appears to be" warning was in
droid's sessions. The same droid on generic-chat-completion-api for
gpt-6.1-sol stored the warning in its session; on openai it didn't.
Not tried: droid's interactive TUI (exec only); a real vendor upstream
(fake Chat upstream only); Windows/WSL droid; droid's built-in-name
lookup cases the patterns miss (gpt-image-*, gpt-transcribe).
PaulT on Discord: after v0.1.2175's creditLadder (30m, 2h, 8h, 1d, 3d,
7d), a restart of magpie lifted an out-of-credit key's rest and started
its ladder over at 30 minutes, as restingUntil is memory only.
No rest was kept anywhere before (restingUntil, affinity.json and the
provider's served file hold nothing of it), so the ladder's rests now go
to rests.json beside providers.json (rest_store.go):
- saveRests writes every ladder rest (Why credit, By credit, Failures
> 0) with its until, rung and asking state, through a temp file renamed
over it, whenever one is set or dropped: restAfterMarked, clearRest
(an answer), Unrest / UnrestAll (Try now), a probe's lift and a slow
rest taking an ended ladder rest's place. Unchanged sets aren't
written again.
- loadRests reads it once per file as ListenAndServe starts. A rest still
running rests out what is left; an ended one keeps its rung, as it does
in memory, so the next refusal climbs on; one ended over restsKeep (35
days) ago starts over; a key no longer in providers.json (id or
id#keyid) is let go; a rest this process has already wins. A rests.json
that can't be read or parsed, or a providers.json that can't be read,
adds no rest; the next change writes the file anew.
The rung decays as at runtime: only an answer or Try now starts it over,
and both now reach the file.
Run (mote-run; first on origin/main 3bce283df, then rebased on 9e73f69af):
- go test -run 'TestKeyCredit|TestKeyOutOfCredit|TestCreditLadder' and
-run 'Credit|Rest|Quota|Unrest|Afford|Balance' ./internal/gateway: ok.
- go vet ./internal/gateway native, GOOS=linux -tags nogui, GOOS=windows: ok.
- gofmt -l: clean for these files (internal/agent/pi_api_test.go is
unformatted on origin/main already).
- at 79af00916 (on 9e73f69af), alone on mote: go vet ./... native,
GOOS=linux -tags nogui and GOOS=windows ok; go test -count=1 -timeout
45m ./...: 80 packages ok, internal/gateway ok (532s); internal/gui red
only on its ten real-window AppKit tests, each `signal: killed` at its
deadline (TestDockJoinLeadsCommandTab, TestPanelCloseHidesIt,
TestPanelJoinsFullScreenSpaces, TestPluginPageLoadsItsFilesInTheWindow,
TestDockReopenKeepsTheWindowsSpace, TestMainWindowCorners,
TestMainWindowRightToLeft, TestHandoverLeavesTheMenuBarIconForTheNextMagpie,
TestTrayCellClickReleasedPanel, TestCoveredWindowStaysUp). The same ten
are red run alone at origin/main 9e73f69af; #4125 names them.
- rebased on 133493488 (two #2278 commits in internal/sessions and the
GUI's Sessions, no gateway change): go vet ./internal/gateway
./internal/sessions ./internal/gui and go test ./internal/gateway
./internal/sessions ok at the pushed head.
Broken by hand, each red:
- loadRests reading nothing: TestKeyCreditRestOutlivesRestart "after a
restart the key rests no more" (the old behaviour), and
TestKeyCreditRestFileCorrupt.
- the removed-key check off: TestKeyCreditRestFileForgets "a removed key
rests after a restart".
- clearRest not saving: "after an answer and a restart: failures 3".
Not tried: a real magpie restart with a real out-of-credit key (the tests
restart by clearing memory and reading the file as ListenAndServe does);
a handover where the old magpie writes after the new one read. Only the
key ladder is kept; other rests (rate limits, quotas, accounts) still end
with the process.
A provider can have up to 8 rate windows: days, a span that may cross
midnight (on this computer's clock), and a rate. Inside a window a call
costs the base price times the rate. The base is the user's model price
as set, or the list price times PriceRate with the vendor's own peak
(DeepSeek, Command Code, OpenCode Go) already in it. The author gave
this order as the spec: a 0.8 window on a shared DeepSeek key takes 0.8
off the peak price at peak. The editor's hint says not to set the
official peak hours again as a window, in every language.
Each call is priced at its own time on the Usage page and its CSV, in
the Requests tab's rows, and against a gateway key's cost limit. The
Sessions page, group templates and the model list written into an
agent's own config use the base price. /v1/models prices at now.
Ported from YangHonghang's 2c9d459ff (rate-windows-2463-v2). The Go
pricing, its tests and the translations are theirs. Changed here:
- No budget raised. Their commit raised appScriptBudget and
coreScriptBudget; core_budget_test.go is main's again. The editor's
window rows, time menus, validation and hint moved to ratewindows.js,
which app.js imports when the field is drawn (as signsheets.js is).
The sliding-thumb and modalDepth comments were cut down to make room.
The core is 1,535,528 of 1,536,586 and app.js 1,312,242 of 1,315,316.
Until the script has loaded, a save leaves rateWindows out, and the
server keeps the saved ones.
- Their unrelated TestAssetsHaveNoConflictMarkers is dropped (one
commit, one goal).
- The row badge shows only for a provider with windows. Before, every
provider with a price rate alone got a new ×badge. Its title is
shorter, and so are its translations.
- AgentPricer (agent model files: Pi, omp, OpenCode cost) uses the base
price. Nothing rewrites those files when a window opens or closes, so
a price taken at Sync stayed on outside the window.
- internal/budget gets a TestMain through testenv, so the new test
runs in a home of its own.
- old-webkit's list of lazily loaded scripts names ratewindows.js.
- The draft keeps each window as a shallow copy, and a day chip
replaces its days array, so the saved provider is never changed.
- The GUI test waits for the lazy script's hint, not a fixed 300ms.
It also checks the peak note in each language.
Run first on 2f5a3f1c0, then again after rebasing on 70d9996c5,
8acb0d3a7 and d609729cf. The rebase onto 70d9996c5 met main's ruleedit.js in
old-webkit's list, and both are listed.
- gofmt -l internal: clean at 8acb0d3a7 (129578c3d gofmt'd main's
pi_api_test.go).
- mote, on 8acb0d3a7: go vet on usage, provider and gui
ok; GOOS=linux and GOOS=windows go vet -tags nogui ./... ok.
go test -tags nogui for internal/usage, provider, gui, budget and
sessions: ok. The five internal/agent tests that are red on WSL
(below) pass on mote there. On d609729cf (a one-line mover min in
internal/provider), internal/provider again: ok.
- On 2f5a3f1c0: internal/provider, usage, budget and sessions, and the
gui RateNow|PriceRate|CoreScript|Budget tests, each under TZ=UTC,
Asia/Shanghai and America/Los_Angeles: all ok.
- wsl-run (magpie-desktop, Playwright chromium and webkit) on
70d9996c5: provider-rate-windows, old-webkit, i18n-keys,
provider-price-rate, provider-advanced-fold, agent-hides-editor,
key-box-once, provider-many-keys, nokey-editor and
editor-short-window: 200/200. On 2f5a3f1c0 the first five and
model-price-edit: 132/132. On mote the same files hit WebKit launch
timeouts (180s) under another session's full GUI suite (load 30), and
that run was stopped.
- Full suite, wsl-run (mote was running another session's full suite),
go test -tags nogui -count=1 -timeout 45m ./... at 6e534f546 (this
change on 70d9996c5): every package ok except internal/agent.
internal/agent fails TestInstalledVersion, TestGrokInstalled,
TestCursorFolderFromTheEditorIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath. This change doesn't touch internal/agent. At
origin/main 8acb0d3a7 on the same box, TestInstalledVersion,
TestGrokInstalled and TestOmpDetectedWithPiDir fail too: a fake CLI
in /tmp exec'd with "Invalid argument". That is #4033 and #3548
(WSL2 binfmt interop).
- Broken by hand, red each time:
- Pricer without the window: TestPricerRateWindows,
TestBlockRowsTakeTheirRateWindow, TestCostLimitCountsTheRateWindow.
- Block rows without atWindow: TestBlockRowsTakeTheirRateWindow.
- AgentPricer at now: TestAgentPricerLeavesTheRateWindowOut.
- Badge for a price rate alone: TestRateNowOf.
- Peak note removed: provider-rate-windows, 10 of 10 chromium
layouts.
- ratewindows.js not in old-webkit's list: old-webkit.
Not tried:
- A real relay billed by the hour.
- The real desktop app (WebKitGTK, WKWebView).
- The full GUI suite (mote was running another session's).
Known limits:
- No rate is stored per record, so changing the windows reprices
history, as a changed PriceRate does.
- Windows follow this computer's zone, with no zone of their own.
- The Sessions page uses the base price.
Co-authored-by: YangHonghang <honghang.yang@qq.com>
Rollkey8 on X found DeepSeek in Codex through magpie duller than
DeepSeek's DSH. A real Codex 0.165.0 -> magpie -> api.deepseek.com
recording lost nothing in translation; what differed was the catalog
entry magpie writes for the model. DeepSeek's own Codex setup
(cdn.deepseek.com/api-docs/codex-deepseek-setup-en.sh) writes a
models.json for deepseek-flash and deepseek-v4-pro, and a DeepSeek
model's entry now takes its non-prompt fields from it:
- shell_type "shell_command" (Codex 0.165 reads it as unified_exec, its
only shell tool, per openai_models.rs's serde alias; a Codex before
that had a one-shot shell_command tool, which is what DeepSeek picks)
- support_verbosity true, default_verbosity "low" (text.verbosity low
is sent)
- default_reasoning_summary "none": reasoning.summary "auto" is no
longer sent; DeepSeek streams its reasoning as text
- multi_agent_version "v2" where magpie had none
- supports_image_detail_original on a model whose entry takes images
A DeepSeek model is deepseek-v4*/-flash/-pro/-chat/-reasoner after any
provider or relay prefix (codexcat.deepSeek); a routing group or an
R1-distill isn't one. Every other vendor's entry is unchanged.
default_reasoning_summary is tagged keep:"unset", so a value the user
put by hand in another model's entry stays through Keep, as it did
before magpie wrote the key anywhere.
Not taken, and why:
- base_instructions / model_messages: magpie never rewrites a model's
Codex prompt (owner's rule).
- auto_compact_token_limit null: magpie's 272K Long conversations
default came from a DeepSeek-flash latency report (e950eb080, ~550K
turns waited 70-90s for a first token); Full window, or the model's
Compact at, gives the whole 1M, and a model_auto_compact_token_limit
the user set still comes first.
- supports_search_tool false on v4-pro: kept true for #258.
- reasoning levels: the provider's, as for every model.
- comp_hash, max_context_window (same as the window), web_search
(config.toml, not the catalog).
- v4-pro's images: DeepSeek's pricing page, its live /models and
models.dev all say text only, and magpie's own entry (/v1/models)
says text. Codex's catalog lists it with image only when Settings ›
Vision describes images for text-only models (codexListed's
described()), by design.
Also adds the agent-wiring.md row "Codex: DeepSeek models".
What was run, at this tree (as daf576653, the same tree before the
gofmt commit was split out under it):
- TestCodexCatalogDeepSeekAsDeepSeekSays and
TestCodexCatalogKeepsUsersSummary: red on the old codexcat.go (both
FAIL with it stashed), green on the new.
- go test ./internal/codexcat ./internal/provider -run 'Codex|DeepSeek'
on mote: ok.
- gofmt -l: clean. On mote: go vet ./..., GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go
build -tags nogui, GOOS=windows go build: all ok.
- Full suite on mote, go test -count=1 -timeout 45m ./..., alone on
the box: 79 packages ok; internal/gui red only in its 10 real-window
AppKit tests, each killed at its deadline, which is #4125 (mote's
AppKit hang; recorded there).
- Real use: Codex 0.165.0 in a sandbox HOME against a magpie built
from this tree with the owner's DeepSeek provider copied in (deleted
after). The written catalog has shell_command for both models. A
multi-step task on deepseek-v4-pro (write a module and unittest file,
run the tests, fix, report) ran to the end, tests pass. Through a
recording proxy the requests carry text.verbosity "low", reasoning
{effort: high} with no summary, and the same tools as before
(exec_command, write_stdin, apply_patch, ...).
Not tried: a Codex older than 0.165, where shell_command is a tool of
its own; deepseek-flash in a real run (only v4-pro); a blind side by
side against DSH on answer quality.
A user on X wanted to spend GCP credit on Claude through Vertex AI. Claude
Code does it with CLAUDE_CODE_USE_VERTEX, ANTHROPIC_VERTEX_PROJECT_ID and
CLOUD_ML_REGION, but magpie's Vertex provider only spoke Gemini. Now a
Vertex provider with just a project and a region serves claude-* ids
(claude-sonnet-5-5, claude-sonnet-4-5@20250929, ...) on every client
protocol: Chat, Responses, Anthropic Messages and Gemini.
The request shape follows the AnthropicVertex SDK bundled in Claude Code
2.1.314 and Google's Vertex docs for Claude:
- a message goes to .../publishers/anthropic/models/{model}:streamRawPredict
when it streams and :rawPredict when it doesn't, with model taken out of
the body;
- a count goes to .../publishers/anthropic/models/count-tokens:rawPredict
with the model kept;
- the body gets anthropic_version "vertex-2023-10-16" when it has none;
- no ?beta=true query; the bearer is the existing Google OAuth token;
- the advanced-tool-use-2025-11-20 beta goes as tool-search-tool-2025-10-19,
as Claude Code sends it to Vertex (the Bedrock rename table, now for
Vertex too; Bedrock's refused betas stay Bedrock only).
How:
- provider: VertexClaude(model) and VertexClaudeRequest(path, body).
Base(Anthropic) is the Vertex project base, so a Vertex provider speaks
chat, anthropic and gemini; ListedAPIs gives a Claude id Anthropic only,
so the model id alone picks the publisher. No GUI change.
- gateway: forwardOnce, the one place every Anthropic upstream request
passes, rewrites path and body for Vertex. Gemini's effort mapping
(none -> minimal, xhigh -> high) skips Claude. countTokens takes any
provider with an Anthropic base.
- provider Test stays on Gemini (Claude needs Model Garden enablement);
TestModels asks a Claude id on rawPredict with max_tokens 16.
- preset lists claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5 and
claude-fable-5-1 at global. Docs: reference.md, providers-accounts.md,
gateway-routing.md.
Run (darwin, mote):
- gofmt -l: nothing. go build ./...: ok.
- go vet ./... ok; GOOS=linux go vet -tags nogui ./... ok;
GOOS=windows go vet ./... ok.
- go test -tags nogui -count=1 -timeout 45m before the rebase:
internal/provider ok 100s, internal/gateway ok 497s, internal/gui ok 58s,
internal/cli ok 33s, internal/tui ok 9s.
- After rebasing on origin/main (36 new commits, six in provider/gateway):
internal/provider ok 112s and internal/gateway ok 578s again, at the
rebased tree (d53336d9e before this message was written), gofmt clean.
- New tests: TestVertexClaudeModel (gateway, fake Vertex server: chat,
anthropic, responses streamed and not, two id forms, a Gemini client,
effort xhigh and none, Claude Code's ?beta=true with the tool-search
beta, count_tokens, a Gemini model still on streamGenerateContent),
TestVertexClaudeModels and TestVertexClaudeRequest (provider).
- GUI (no asset changed; files the provider list reaches):
vertex-editor and i18n-keys in Chromium on mote, 18/18. WebKit on mote
fails to launch at all (180s launch timeout under load), so WebKit ran
on the Linux box (wsl-run): vertex-editor 14/14 in four of five
runs. The first run had 13/14 with one failure whose name was lost
(log not kept, my fault); three runs with logs kept since were 0 fail,
so it isn't named or filed. No GUI asset changed here.
Broken by hand, each red, then restored:
- forwardOnce rewrite off: 502 on every Claude request.
- vertexEffort exclusion removed: xhigh reaches Vertex as high.
- beta rename off for Vertex: beta arrives unrenamed.
- countTokens back to c.p.Anthropic: the count goes to streamRawPredict.
- ListedAPIs Claude branch removed: the model is asked on gemini.
Not tried:
- No real GCP project was available: no real Vertex request, no Model
Garden enablement, no real Claude Code session against Vertex through
magpie. The shape is checked against the SDK and docs only.
- Claude is listed at global only; regional availability per model isn't
listed.
- Whether Vertex accepts a 1h cache_control TTL is unverified.
A group member answered 400 "内容太长了,请精简输入或开启新对话" once a
turn passed ~730K on a model it declares at 1M. tooLongRe's Chinese only
matched wordings that name 上下文, so the try was filed as a plain
failure that rested the member, and the group's other members were never
asked. Reported by MYCF711 (Discord, issue #4420).
tooLongRe gets a third line for Chinese that names what was sent (内容,
输入, 文本, 提示词/prompt, 问题, 对话, 消息) beside its length: "…太长/过长/
超长", "…超过/超出…长度/token/字数", "输入长度/token…超过", and
"字数太多/过多". Tied to: the reporter's vendor, z.ai's 1261 "Prompt 超长",
iFlytek Spark's 10907 "token数量超过上限。对话历史+问题的字数太多,需要精简
输入". Left out on purpose: bare "超出最大长度" (a field's length), bare
"token数量超过上限" (a day's allowance is said so too), "输出过长" (the
reply), and "请求体过大" (a 413 byte limit, already handled by status).
paceWords gets Chinese pace words (速率, 频繁, 频率, 限流, 并发, 每秒/
分钟/小时/天/日, 稍后再试/重试), so "内容太长,已达到速率限制" is a rate
limit, not a size. rateWords gains 过于频繁/速率 and quotaWords 频繁/速率,
so such a 400 is asked of the next account and such a 429 is failRate.
Tests:
- TestEveryVendorsOverflow: 8 Chinese rows (red on the old code, each).
- TestChineseNotTooLong (new): pace-with-size, a field's length, the
reply's length, a day's token cap and plain errors aren't overflows; the
pace 400 is retryable.
- TestChineseInputTooLongGoesToTheNextMember (new): two-member group, the
reporter's literal words, raw and \u-escaped: member b answers, failOverflow,
nobody rests (red on the old code: a 1, b 0, 400 to the agent).
- docs/subsystems/gateway-routing.md names the new wordings.
Run (mote, via mote-run, at this tree):
- go test ./internal/gateway -count=1 -timeout 45m: ok 500.9s
- go vet ./internal/gateway, GOOS=linux and GOOS=windows: clean; gofmt -l clean
- Broken by hand: old gateway.go/routing.go/fallback.go with the new
tests: all three tests red (11 failures). paceWords alone reverted:
TestChineseNotTooLong red on 4 pace messages and the retryable check.
Not tried: the reporter's real vendor (unknown which member it is), nor a
real z.ai or iFlytek account; the wordings come from their docs. Only
internal/gateway was run, not the whole repo; the change is inside that
package's classifiers.
Since 7eb7fa540 (#3282, v0.1.2042) a model served on Gemini's API,
an Antigravity sign-in's gemini-3.8-flash among them, was written into
Pi's models.json as api "google-generative-ai" at the gateway's /v1beta.
Raft (slock, @botiverse/raft-daemon 1.0.17) runs Pi's SDK, pi-ai 0.83.0,
on Pi's own agent folder (PI_CODING_AGENT_DIR, else ~/.pi/agent:
ModelRuntime.create's modelsPath) and gives every request its own fetch
(installProviderHttpClient). pi-ai's Google adapter throws before
sending when a fetch is given ("Custom fetch is not supported by the
Google Generative AI adapter", api/google-generative-ai.js; the same in
pi-ai 1.4.0), so every Gemini model failed in Raft.
Per-request fetch is a feature of Pi's SDK, so the file Pi's folder holds
can't count on google-generative-ai. piAsked now drops the Gemini API for
"pi" as it did for StepCode, whose rule moves there from stepcodeProvider:
the model stays on the provider's openai-completions, which the gateway
translates, as before v0.1.2042. piOffered reads the same entry, so Pi
offers the levels Chat has. OmO's and Prime Agent's folders are their own
and keep google-generative-ai. A sync rewrites magpie's model list, so
files written since v0.1.2042 are corrected without the user editing them.
Run (mote, at this tree on origin/main 8f0d21a00):
- go test -tags nogui ./internal/agent -run
'TestPiGoogle|TestPiFolder|TestPrimeAgent|TestStepcode|TestStepCode|TestAside'
-count=1: ok.
- Broken by hand (piAsked back to StepCode alone):
TestPiGooglePluginModels/pi and TestPiFolderKeepsGeminiOnChatForRaft red.
- Raft's pi-ai 0.83.0 from npm, a request with a fetch of its own (as
Raft's daemon gives) against a local fake gateway: the old entry
(google-generative-ai, /v1beta) ends "Custom fetch is not supported by
the Google Generative AI adapter", the reporter's error; the new one
(openai-completions, /v1) reaches /v1/chat/completions and gets the
reply.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui,
GOOS=windows go build: ok.
- Full suite (go test -tags nogui ./... -timeout 45m): started on mote
at this tree; pushed before it ends, per the owner's ship-at-once rule.
Its result goes on the commit's thread when it ends.
Not tried: the real Raft app (it needs a slock account), and a real
Antigravity account through it. Aside also runs Pi's SDK, on a folder
of its own; its source isn't public, so whether it passes a fetch is
not known, and it keeps google-generative-ai.
cyoking1 on X (tweet 2116084357731701020): every Claude model through
the GitHub Copilot plugin answered 404. pluginFetch took the loader's
baseURL first, and Copilot's loader says https://api.githubcopilot.com
for every model, while its Claude models are @ai-sdk/anthropic rows
whose own api.url is https://api.githubcopilot.com/v1 (models.dev).
magpie's /v1 is taken off the path, so the request went to
https://api.githubcopilot.com/messages.
pluginRequestBase now sends an Anthropic model whose own URL ends in
/v1 under the loader's base + /v1 when that base doesn't end in it,
as OpenCode's own Copilot provider does (packages/core/src/plugin/
provider/github-copilot.ts: `${loaded.baseURL}/v1` for messages
models). That covers every plugin, and Copilot Enterprise's
copilot-api.<host>. Unchanged: a base already ending in /v1 (zcode,
minimax, commandcode, zed), a model whose own URL has no /v1 (Kiro's
BASE), and every non-Anthropic model (Copilot's GPT on its bare base).
Every @ai-sdk/anthropic api.url in models.dev ends in /v1.
Run:
- Real account (owner's Copilot sign-in, token from the OAuth refresh):
POST api.githubcopilot.com/messages claude-sonnet-5 -> 404
"404 page not found"; /v1/messages -> 200 with a reply.
- TestPluginAnthropicBaseKeepsV1 (new): green; broken by hand (the
/v1 append commented out) it is red on the copilot, trailing-slash
and enterprise cases.
- mote: go test -count=1 ./internal/provider ./internal/plugin ok;
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
go vet ./... clean; go build, GOOS=linux -tags nogui and GOOS=windows
builds ok; gofmt -l empty.
- Full suite (-timeout 45m) started on mote at this head; pushed
before it ends per the ship-at-once rule; reds get their own issues.
Not tried: a whole magpie gateway with the Copilot plugin signed in
end to end; the fix was checked at the base it computes and the real
endpoint by hand.
A request whose User-Agent names only an HTTP library or an SDK (curl,
Bun, node-fetch, undici, python-httpx, requests, aiohttp, Go-http-client,
okhttp, the OpenAI/Anthropic SDKs, …) or nothing at all got a Context
scorecard of its own, as if it were an agent (theforeveriris on X: "Bun",
"curl", "python-httpx" cards). usage.IsLibrary names those clients;
contextOfRecs folds them and "other" into one "Scripts" card at read
time, so older history reads the same way, and the card's meta line and
tooltip list the libraries by count. The cached day records are not
changed. No setting: it works as is. The Usage page's Agents list still
shows each library by name, with its Hide and Count-as-agent controls.
i18n for zh, zh-TW, ja, de. Existing context.js comments were condensed
so TestCoreScriptBudget holds without a raise (core scripts -28 bytes).
Run, at this head (rebased on 40af66027):
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
(mote) for usage and gui; earlier the whole tree on all three, exit 0.
- mote: go test -count=1 -tags nogui -timeout 45m ./internal/usage
./internal/gui: ok, ok.
- Windows box: context-scripts + i18n-keys 26/26 (chromium, webkit,
5 languages, 360 and 1100px). Before the rebase, every reachable file
(context-*, compact-one-value, group-context, routing-context-fold,
routing-ctx-fold, routing-ctx-still, i18n-keys, gui-de/ja/zh-tw,
header-relang): 333/349; the 16 reds are routing-ctx-still, red the
same on origin/main 40af66027 on that box, listed in #4124.
Broken by hand: IsLibrary false and no fold -> TestIsLibrary and
TestContextScriptsAreOneCard red (cards python-httpx, claude, Bun, ...);
the JS label/clients removed -> context-scripts.test.cjs 0/22.
Not tried: a real app run with real curl/Bun traffic; Linux WebKitGTK;
GUI files on mote (its browsers were busy with another suite).
davisjiahao (#1985): Claude Code pointed by hand at a proxy in front of
magpie, magpie's key kept (a company's nginx, or a compliance proxy on
this machine every request must go through), is kept there once magpie
has answered at the proxy (surelyMagpie). That answer comes from a probe
a read starts in the background and never waits for, and every write to
Claude Code reads routed() first: in a magpie just started, the CLI's,
the first write found no answer yet and took the proxy for a relay of
the user's own. surelyMagpie's comment says a write waits for the
answer; none did. Codex's account failover does (codexProxyOK).
From the CLI, with the proxy (relay.py, answering GET / as magpie's
gateway does) taking 0.3s or 1.5s to answer, as one across a VPN can;
the same on 40b5c2da and on d970371e (#3480):
magpie claude fakeco/fake-3: ANTHROPIC_BASE_URL went from the proxy
(http://127.0.0.1:<port>/corp-relay) to magpie's own
127.0.0.1:<port>, and the haiku tier the user gave fakeco/fake-2
went to fake-3
magpie provider add …, whose sync rewrites Claude Code's lists: the
CLAUDE_CODE_AUTO_MODE_SERVER=0 magpie wrote went
magpie claude haiku fakeco/fake-3: "pick a model through magpie for
Claude Code first; haiku can then have its own"
magpie claude default (Disconnect): said "disconnected from magpie,
back to what it had before" and left the proxy, magpie's key and
magpie's tiers (fake-1 on all four) in, so its "opus" still named
fakeco/fake-1 through magpie; the endpoint and key the user had
before magpie (https://own.example/api, sk-own-user) were gone from
the stash
With the proxy answering at once, the probe a read started came back
first, and all of these held. magpie web's start held in my runs too
(0s and 1.5s first starts, a 1.5s restart): its sync runs after the
catalog's fetch and the vendors' lists (FetchNew).
Now every write to Claude Code (each field's Set, Sync, Unwire) asks
first (claudeAsk): where claudeProxied would ask the address (proxyBase,
not the gateway's own address, claudeKeyed) and magpie hasn't answered
there yet, magpieAsked asks it now and waits (probedNow, the probe's 3s
timeout). An answer had before, at any age, is what the write goes by,
as the reads do. Follow is left as it is: it writes nothing until
routed, and runs again as the Agents page is drawn. Reads still never
wait (TestReverseProxyTriedFirst).
Before and after, for a write while ANTHROPIC_BASE_URL is such an
address and magpie hasn't answered there in this process:
before: taken as a relay, as above
after: the address is asked (GET /) and the write waits for the
answer, then goes as it does with the answer in: a proxy to magpie
kept, a relay pointed away from
Not changed: an address sent a key of the user's own is never asked
(#3480); the reads; a write once the answer is in.
Cost: the first write of a process waits for one GET / at such an
address. The read before it has usually asked already, in the
background; this doesn't wait for that probe but asks again, as
codexProxyOK does (the proxy got 2 GET / where it got 1). A proxy that
doesn't answer holds that write up to the probe's 3s.
Left as it is: what Apply and Disconnect read before the write (was,
before) still sees the address unasked. After the CLI's Disconnect
behind the proxy at 1.5s, the record for reconnecting
(claude.reconnect) kept the model alone, without the haiku tier the
user gave fakeco/fake-2 in magpie, which the same Disconnect on
magpie's own address keeps.
TestClaudeFirstWriteAsksTheProxy: an nginx and a local proxy, magpie
just started, nothing asked yet (coldMagpie): a pick, a Sync, a tier,
Disconnect. With claudeAsk asking nothing, all 8 are red, each on what
it is there for (the pick wrote http://127.0.0.1:3425 over the proxy
and haiku went to fake/m3; the sync took out the review; "pick a model
through magpie for Claude Code first"; Disconnect left the proxy with
"magpie" and magpie's haiku tier). With Unwire's ask alone taken out,
the two Disconnects are red.
Verified at 57ae956b: the runs above, after, at 0.3s and 1.5s: every
case held, and Disconnect put back https://own.example/api and
sk-own-user with nothing of magpie's left. Both hand breaks as above.
go test -race -count=3 of the proxy, Codex proxy, review and sign-in
tests: ok. The agent package with magpieProbe made to panic: no test
reached it. gofmt clean; go vet ./internal/agent/ for linux, darwin and
windows: exit 0. go test ./...: 63 packages ok, 7 red with this box's
own reds alone: the proc.Look tick tests (#3141:
TestInstalledVersion, TestCursorFolderFromTheEditorIsNotTheCLI,
TestOmpDetectedWithPiDir, TestZedAppPath), the Reasonix fixture builds
(a /tmp/.git that isn't magpie's), graftcp's
(TestCallbackGoesPastTheAgentsProxy,
TestClaudeToolCallbackOnANonLoopbackAddress,
TestGatewayHeldByAContainer, TestGatewayFixQuitsOnlyAMagpie), umask
077's (TestWriteAtomicReadOnlyHardLink, TestProgram/first) and Bun
1.3.11's (TestBunProxyLoginWithReservedCharacters, #3397).
Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
077; agent, provider, library and gateway with an empty .git above
TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
changed tests in agent, provider, gateway and gui; the timing tests
-count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
at umask 077 and two Reasonix tests under an empty .git; on Linux
(wsl-run) TestProgram at umask 077 with the old program.go. With
each fix's code taken back to main's, the Gemini imageConfig tests,
TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
plugin-github-hooks, plugins-more-discover, plugin-namesake were
red. Broken by hand: claudeKeyed always true (both
OwnEndpointNeverAsked tests red), claudeAsk a no-op
(TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
(the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
plugin-card-update, plugin-github, plugin-move*, segs-glide,
tray-totals, update-*), and run again side by side they fail the
same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
there). They are click-scroll guards ("the click must not scroll
the page"), varying by language from run to run (#4385).
copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
too. In Chromium on mote, Chromium segfaulted partway through files
(#4125): context-map, context-scroll-end and context-tune fail the
same on origin/main 0911a65e7, so the batch's own files
(plugin-namesake, update-auto, plugins-more-discover,
plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
whose five reds were #4362's (Antigravity turned-away and
TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
the rebase on 244d80e23 the five pass, and gofmt, the three vets
and the targeted runs above were run again: ok. In Linux the
sign-in, copilot, plugin-github*, plugins-more-discover,
plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
#1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
gui, gateway, provider and plugin, TestCoreScriptBudget (core
1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
update-mirror, plugin-namesake, plugins-more-discover,
plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
zhangt2333 (#3480): magpie sent GET / (Go-http-client/1.1) about every
30s to the ANTHROPIC_BASE_URL in ~/.claude/settings.json of a Claude
Code it never connected, with nothing shown and nothing to turn it off.
Every read of Claude Code the Agents page makes (/api/state, /api/drift
each 15s) goes through routed(), which asked a base URL that can be
another way to magpie (proxyBase: an address on another machine, or one
on loopback with a path of its own) whether it answers as magpie, for
#1985's reverse proxy, whatever key Claude Code sends there. One read
pass asked it about 65 times; the probe cache sends that as one GET once
its answer is older than 20s (reachAge), every 30s on the page's poll.
The address is now asked only while what Claude Code sends is for magpie
(claudeProxied, claudeKeyed): a key the gateway takes (keyHolds, as
Check already asks of ANTHROPIC_AUTH_TOKEN), or none where it keeps its
claude.ai sign-in through magpie (claude.login, on a Claude Code magpie
wired, wired_at, which Disconnect forgets, where the gateway takes any
key). With a key of the user's own, the base URL is their endpoint, and
nothing asks it: the reads (routed), a pick (gwAt), Check (its managed
settings' and settings.json's URL), and a request's stand-ins
(claudeStandInAt, now given the place, and claudeClassifierIn), a WSL
distro's Claude Code's too. Check says such a Claude Code's address as
it is, unasked (whatsOff: wiringOff's words, without its probe; an
administrator's in managed settings too): with a model named as one of
magpie's there, as a relay can name its own, "Claude Code's
ANTHROPIC_BASE_URL (settings.json) is <its endpoint>, not magpie's
gateway at <the gateway>", or "is gone" with none, which main said of
it too once the address had answered as not magpie. #1985's proxy keeps
magpie's key, so it is asked and kept as before.
The key, not a record of what magpie wrote: wired_at is from 10-08
(#1218), so a Claude Code connected before it and not picked since has
none, and a Claude Code magpie wired and then moved to a relay of the
user's own (CC Switch, its own key) would still have that relay asked.
The claude.ai sign-in can lean on it: it came with it (#1218), and its
setting, on a routed Claude Code only, stamps it.
Before and after, for a read, a pick or a request's stand-in while
ANTHROPIC_BASE_URL is not the gateway's and proxyBase takes it:
before: GET <base>/ in the background, at most every 20s
after: the same while Claude Code sends a key the gateway takes or
keeps its claude.ai sign-in through magpie; otherwise never, and the
address is not magpie's
Changed with it: a Claude Code pointed by hand at a proxy to magpie with
a key of its own, drift on main too (its key "was changed"; now its
address), is no longer taken as routed there, so a pick writes magpie's
address and key, keeping its own for Disconnect, where it kept the
proxy.
Not changed: the other agents ask an address only from magpie's own
entry in their config, or once on one of magpie's models (T3 Code's
wired, Gemini CLI's isMagpie(model), Hermes's onMagpie and
providers.magpie, dsh's usesMagpie), so none asks one of the user's own.
A Claude Code magpie wired keeping its claude.ai sign-in, then moved by
hand to an endpoint of the user's own with an ANTHROPIC_API_KEY alone
and not disconnected, is still asked, as before: magpie reads no
ANTHROPIC_API_KEY of Claude Code's.
Cost: a never-connected Claude Code with its own key at such an address,
the case this reaches: a read pass took 5.5 to 6.0ms on origin/main and
9.4 to 9.8ms with this (three runs each, taking turns, 200 passes, at
load 46 to 50; the key's read and access.Authenticate at ~65 calls a
pass), on the 15s drift poll. A connected Claude Code (the gateway's
address) and one on Anthropic's own endpoint (no base URL) never get
there.
docs/subsystems/agent-wiring.md (Drift) says it.
What was run (tree c7f75f7a, on origin/main 74dcf40a, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
magpie web --no-open, built -tags nogui from origin/main and from
this, each in a sandbox HOME of its own (env -i), with a settings.json
on a local relay that logs what it gets
(http://127.0.0.1:<port>/corp-relay, a key of its own) and listens
before magpie starts, /api/drift read every 5s:
model opus, 120s: main, GET /corp-relay/ (Go-http-client/1.1) every
20s from the first read, 6 in all; this, none. Neither touched
settings.json.
model fakeco/fake-1 (a provider magpie has), 60s: main, 3 GETs;
this, none. Both said "Claude Code's ANTHROPIC_BASE_URL
(settings.json) is http://127.0.0.1:<port>/corp-relay, not magpie's
gateway at http://127.0.0.1:<port>" from the first read.
Run once more with magpie up before the relay listened: main 5 GETs
and 2, its first ask made before then, this none, the rest the
same.
magpie claude fakeco/fake-1, then its ANTHROPIC_BASE_URL moved by hand
to the relay answering GET / as magpie, magpie's key kept, 60s: both
asked it every 20s, 3 GETs, no drift. Both wrote settings.json again
at start with every key and value the same (a label's "·", which the
hand edit had escaped, now as is). Run once more with magpie up
before the relay listened: both drifted "… is <the relay>, not
magpie's gateway …" on the first read and took
CLAUDE_CODE_AUTO_MODE_SERVER out of settings.json, then asked it
every 20s with no drift, the address kept; main does it the same, not
this change.
TestClaudeOwnEndpointNeverAsked (nginx: its own key in
ANTHROPIC_AUTH_TOKEN; local: in ANTHROPIC_API_KEY) and
TestWSLClaudeOwnEndpointNeverAsked: pass. Broken by hand, each red:
claudeProxied without claudeKeyed: "never connected: asked
[https://relay.example/anthropichttps://relay.example/anthropic …]"
(and the WSL test)
Check's addresses asked whatever the key (keyed true): "a model of
magpie's name: asked [https://relay.example/anthropic]"
Check's address unsaid without magpie's key: "its own key, a model
of magpie's name: … ANTHROPIC_AUTH_TOKEN (settings.json) was
changed, so magpie's gateway won't take its requests" (nginx), "… is
gone, so Claude Code sends magpie its claude.ai sign-in …" (local)
the administrator's address asked whatever the key: "its own key, an
administrator's proxy: … ANTHROPIC_BASE_URL (settings.json) is
https://relay.example/anthropic, not magpie's gateway …"
claudeStandInAt, then claudeClassifierIn, on surelyMagpie alone:
"never connected: asked [https://relay.example/anthropic]" (and the
WSL test)
claudeKeyed with no claude.ai branch: "the claude.ai sign-in at the
proxy: drift … ANTHROPIC_BASE_URL (settings.json) is <the proxy>,
not magpie's gateway …" (and the WSL test)
its claude.ai branch without wired_at: local only, "asked after
Disconnect: [https://relay.example/anthropic …]"
its claude.ai branch on this machine's stash keys: the WSL test
alone, the same as with no claude.ai branch
agent-wiring.md's reverse proxy checks (TestReverseProxy…,
TestClaudeBehindLocalProxyKeepsIt, …), Drift, the sign-in's and
TestKeptAddress: ok, but for TestWSLColdPlaceOpensNothing (e54a7d50,
#3896: a stopped distro's rows read none of its files), red at
origin/main and with this change alike (#3924): the same eight looks
under .hermes/profiles, none under .claude
gofmt -l of every .go file: nothing. GOOS=linux, windows and darwin
go vet -tags nogui ./..., GOOS=windows go vet ./...: exit 0.
GOOS=linux and darwin go build -tags nogui ./..., GOOS=windows go
build ./...: exit 0. Untagged linux vet and build stop at pkg-config
(no libsoup-3.0 or gio-unix-2.0 here)
full suite, go test -tags nogui -count=1 -timeout 45m ./... (8m19s,
load 42 at its start, Bun 1.4.2 on PATH): 68 packages ok, reds in 8:
internal/agent TestInstalledVersion,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir (#3141); the two Reasonix tests (#3641);
TestCodexDriftReached (#3398); TestWSLColdPlaceOpensNothing (#3924,
above)
internal/edit TestWriteAtomicReadOnlyHardLink and internal/testenv
TestProgram, umask 077 (#3640)
internal/gateway TestPluginToldWhereTheAgentWorks (#3675)
internal/gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie (#3649)
internal/proc TestEnvOfChild (#3906)
internal/provider: "fatal error: close of synctest channel from
outside bubble" in TestUnreadLoginsWriteErrorsKeepCredentials
(#3632), which ends the package's run
internal/tui TestTUIFetchesSubscriptionModels/agent (#3919)
On origin/main 1a804859, where #3924's fix is in, with this commit
cherry-picked (a scratch worktree, not this tree): go test
./internal/agent has the reds 1a804859 has alone, #3141's, #3398's
and #3641's, and TestWSLColdPlaceOpensNothing passes.
TestCopilotFolderFromAnIDEPluginIsNotTheCLI, TestInstalledVersion and
TestZedAppPath come and go here: -count=5, 12 of 15 red with this
and 11 of 15 at 1a804859.
Not tried: macOS, Windows, a real WSL distro (its Claude Code's stash
keys are only tested), Claude Code itself sending through the relay, a
company's real proxy.
Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
077; agent, provider, library and gateway with an empty .git above
TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
changed tests in agent, provider, gateway and gui; the timing tests
-count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
at umask 077 and two Reasonix tests under an empty .git; on Linux
(wsl-run) TestProgram at umask 077 with the old program.go. With
each fix's code taken back to main's, the Gemini imageConfig tests,
TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
plugin-github-hooks, plugins-more-discover, plugin-namesake were
red. Broken by hand: claudeKeyed always true (both
OwnEndpointNeverAsked tests red), claudeAsk a no-op
(TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
(the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
plugin-card-update, plugin-github, plugin-move*, segs-glide,
tray-totals, update-*), and run again side by side they fail the
same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
there). They are click-scroll guards ("the click must not scroll
the page"), varying by language from run to run (#4385).
copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
too. In Chromium on mote, Chromium segfaulted partway through files
(#4125): context-map, context-scroll-end and context-tune fail the
same on origin/main 0911a65e7, so the batch's own files
(plugin-namesake, update-auto, plugins-more-discover,
plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
whose five reds were #4362's (Antigravity turned-away and
TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
the rebase on 244d80e23 the five pass, and gofmt, the three vets
and the targeted runs above were run again: ok. In Linux the
sign-in, copilot, plugin-github*, plugins-more-discover,
plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
#1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
gui, gateway, provider and plugin, TestCoreScriptBudget (core
1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
update-mirror, plugin-namesake, plugins-more-discover,
plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
TestPluginToldWhereTheAgentWorks was red on any machine with an empty
.git above its temp folder. GitOnDisk took the first .git it met going
up as a repository, and on this box /tmp/.git is an empty folder (owned
by nobody), so every folder under /tmp read "yes". git passes such a
folder over and goes on up: git rev-parse under it says "not a git
repository".
GitOnDisk now reads each .git on the way as git's own search does
(repo_discovery_find_dir in git 2.56's setup.c), through GitAt:
- A folder counts when git takes it for a repository (is_git_directory):
a HEAD git takes (a link into refs/, "ref: refs/...", or a commit's
id), and objects and refs folders, in the folder its commondir names
for a linked worktree. Any other folder, an empty one say, is passed
over and the walk goes on up.
- A file counts when it is "gitdir: <folder>" naming such a folder,
relative to the .git's own folder (a linked worktree's, a
submodule's). Any other file, one over git's 1 MB, or one that is
neither file nor folder is "no": git stops there with "not a git
repository" (a worktree whose repository has gone) or "invalid
gitfile format". (git 2.34 passed a .git that is neither file nor
folder over; 2.55 and 2.56, CI's, stop at it.)
- A .git it can't read is unknown, and the header is left off. git
passes such a folder over and stops at such a file, but either way
it can't tell an empty .git from a repository it isn't let into
(another user's, through a shared magpie), and a failed read is
unknown here.
A bare repository kept as a folder's .git (git init --bare .git) is
still "yes": git finds one there, though no work tree. Not mirrored:
the filesystem boundary, GIT_CEILING_DIRECTORIES and safe.directory's
ownership check. Cost: the same one stat per folder on the way up; at
a .git, a read of HEAD (255 bytes at most) and stats of commondir,
objects and refs.
What a user sees: a request to a plugin provider from an agent that
doesn't say whether its folder is a repository (Codex, Pi) was told
"yes" for a project under a stray empty .git, under a worktree whose
repository was deleted, or under a .git file that names nothing. The
community ZCode plugin then tells the model "- <git label>: yes" and
Command Code's sends isGitRepo: true, so the model may run git commands
that fail with "not a git repository". They are now told "no", and
with a .git on the way magpie can't read, nothing (ZCode's plugin
leaves the line out, Command Code's sends false). Claude Code's and
OpenCode's requests say it themselves and are passed on as they say it,
so nothing changes for them; Claude Code 2.1.310's own check takes any
.git, an empty one too.
The only caller of GitOnDisk is tellWorkPlace (workdir.go), which needs
no change. The library's skill groups had the same first-.git walk:
gitRepoOf took the first .git within four folders of a linked skill for
its checkout, so an empty one between a skill and its clone left the
skill in no group, and gave one imported from there no From. gitRepoOf
now asks provider.GitAt, passes such a .git over to the clone's, and
reads the origin from the folder GitAt names (a linked worktree's
common one), which replaces gitdirConfig. gitdirConfig also took
"gitdir:" with no space after it, or with spaces around the line,
which git doesn't take; such a .git now traces to nothing, as git finds
nothing there. Checkouts git made are traced as before; the test's
fake ones had only a config and now have a HEAD, objects and refs.
Every other .git folder in the Go code is one a walk skips when it
copies, hashes or checks a skill (carry.go, skillcheck.go, skills.go,
skill_edits.go), or the one magpie removes from its own fetch of a
skill (skillgit.go), not a decision about a repository. The Claude
bridge's claudeWorkDir takes the temp folder for one in no repository;
Claude Code decides that for itself, and its git status is off for
every run (CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS), so it stays.
TestPluginToldWhereTheAgentWorks gets a real repository for "in a
repository" (HEAD, objects, refs; an empty .git was all it had) and a
case under an empty .git in its own temp folder, so it fails without
this on any machine. Its "not in one" cases, and the new provider
tests' "no" ones, still need no repository above the temp folder, as
the test did before. TestGitOnDiskIsWhatGitFinds lays out each kind of
.git by hand; TestGitOnDiskAgreesWithGit asks git rev-parse
--git-common-dir in each of those folders and in ones git made (init,
worktree add, a worktree whose record was removed, --separate-git-dir,
init --bare .git), for yes or no and where;
TestGitOnDiskUnreadIsUnknown locks a .git folder and a worktree's .git
file. provider-plugins.md and library.md say the same.
What was run (tree 9a4504d9, on origin/main 56602426, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077, git 2.34.1, with
the box's empty /tmp/.git above the tests' temp folders:
- TestPluginToldWhereTheAgentWorks -count=5, Bun 1.4.2: 5 of 5 ok.
TestGitOnDisk* and TestSkillRepo*, -count=3: 15 of 15 ok. The same
and TestPluginToldWhereTheAgentWorks, -race -count=2: 12 of 12, no
race. internal/library and internal/provider whole: ok.
- 56602426's workplace.go and skill_from.go put back under the new
tests: TestPluginToldWhereTheAgentWorks red 5 of 5, at
plugin_workdir_test.go:125 both "not in one" and "not in one, under
an empty .git": the plugin was told git "yes", want "no";
TestSkillRepoTraced red, "write-a-prd: repo "", want
"mattpocock/skills"".
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
vet for windows, go build -tags nogui for linux and darwin and go
build for windows: exit 0 each. go vet and go build without the tag
on linux: exit 1 (no libsoup-3.0 or gio-unix-2.0 here).
- go test -tags nogui -count=1 -timeout 45m ./... (Bun 1.4.2, log
kept; 8m37s, load 32 at its start): 73 packages ok, and 14 tests red
in 4 packages, none of them this commit's tests or what they cover.
internal/gateway ran to its end (504s), so
TestPluginToldWhereTheAgentWorks passed in it; internal/library and
internal/provider ok. The reds: agent TestCodexDriftReached and
TestCodexBehindReverseProxy (#3398); TestInstalledVersion,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath (#3141);
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641: go build's own VCS
stamping meets the same /tmp/.git, which this doesn't change); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask
077, #3640); gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie (#3649).
This commit is 595b361c rebased: the same internal/ patch-id, and
the same row in docs/subsystems/library.md, put in by git's 3-way
merge, as main's 33ccc618 (#2794) rewrote the Skills row, a line of its
context three rows above. The rest is what was run for 595b361c, at
tree d56bed31 on origin/main 098ac969, the same code (not this tree):
- main's GitOnDisk and gitRepoOf under the new tests (098ac969's
workplace.go and skill_from.go put back):
TestPluginToldWhereTheAgentWorks -count=5, Bun 1.4.2: red 5 of 5,
"not in one" and "not in one, under an empty .git" told git "yes".
With TMPDIR=/var/tmp/3675-clean, no .git above it: red 5 of 5 on the
new case alone. TestSkillRepoTraced: red, write-a-prd: repo "", want
"mattpocock/skills".
- Broken by hand, one at a time in workplace.go, each red in the
GitOnDisk tests on what it breaks, and green again restored:
any .git folder taken, main's rule for folders: "yes" under an
empty .git, a zeroed HEAD and a HEAD alone, and for a locked .git
a gitfile naming no repository, or not a gitfile, walked past:
"yes" from the repository above it
HEAD's content not read: "yes" for the zeroed HEAD; objects and
refs not looked for: "yes" for a HEAD alone
a HEAD at a commit not taken, or commondir not read: "no" for both
linked worktrees; a worktree's own folder named, not its common
one: the repository at .../worktrees/wt where git finds .../.git
a HEAD linked into refs/ refused: "no"; a relative gitdir read
from magpie's folder: "no" for the submodule; no 1 MB cap: "yes"
ENOTDIR taken for a failed read: unknown for a gitfile naming a
file; a .git it can't read walked past: "no" for both locked ones
Not tried: CI's git 2.55.0 (ubuntu) and 2.56.0 (macOS, Windows) under
TestGitOnDiskAgreesWithGit, which met git 2.34.1 alone; macOS and
Windows at all (Windows CI only compiles the tests); a real ZCode or
Command Code plugin end to end; a shared magpie told another user's
folder; the Library page itself.
Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
077; agent, provider, library and gateway with an empty .git above
TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
changed tests in agent, provider, gateway and gui; the timing tests
-count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
at umask 077 and two Reasonix tests under an empty .git; on Linux
(wsl-run) TestProgram at umask 077 with the old program.go. With
each fix's code taken back to main's, the Gemini imageConfig tests,
TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
plugin-github-hooks, plugins-more-discover, plugin-namesake were
red. Broken by hand: claudeKeyed always true (both
OwnEndpointNeverAsked tests red), claudeAsk a no-op
(TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
(the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
plugin-card-update, plugin-github, plugin-move*, segs-glide,
tray-totals, update-*), and run again side by side they fail the
same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
there). They are click-scroll guards ("the click must not scroll
the page"), varying by language from run to run (#4385).
copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
too. In Chromium on mote, Chromium segfaulted partway through files
(#4125): context-map, context-scroll-end and context-tune fail the
same on origin/main 0911a65e7, so the batch's own files
(plugin-namesake, update-auto, plugins-more-discover,
plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
whose five reds were #4362's (Antigravity turned-away and
TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
the rebase on 244d80e23 the five pass, and gofmt, the three vets
and the targeted runs above were run again: ok. In Linux the
sign-in, copilot, plugin-github*, plugins-more-discover,
plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
#1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
gui, gateway, provider and plugin, TestCoreScriptBudget (core
1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
update-mirror, plugin-namesake, plugins-more-discover,
plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
GuoJinguang's relay (#3820) has a Chat URL beside its Gemini one, and
their generateContent asking imageSize 4K went to its chat completions,
which drew 1024x1024. A Gemini client's request asked for one body is
translated (attempt: a Gemini API is always asked streamed), and with
relay off and no ownAPI it goes to the first API usable gives, Chat
where the provider has one. That default is meant (uaSetup in
user_agent_test.go), and the previous commit leaves it: there the
request reaches the Gemini URL only with the model's API set to Gemini.
Now one that asks an image's size or shape, a generationConfig holding
an imageConfig object, sets ownAPI on that rule, as a web search does
and as DashScope's request asked for one body does: it is translated
on the provider's Gemini API, the only one that takes the field, and
the previous commit carries the field there. Every other request
routes as before, so one without imageConfig still goes to Chat at a
provider with both. gateway-routing.md's One try says so.
What moves: a request asked for one body that carries imageConfig, at a
provider with both URLs and the model's API left on Auto, is asked on
its Gemini URL instead of its Chat URL. If that Gemini API turns the
model away in words magpie reads as the wrong API (wrongEndpoint), the
request is asked on Chat and the refusal remembered, as for any
translated request; any other refusal, such as a bare 404 for a model it
doesn't have, goes to the client, as it does today for the same client's
streamed requests, which are relayed there. What a translation drops
(safetySettings, topK and the rest parseGemini doesn't read) is dropped
on Gemini as it was on Chat.
Left as on main, as the previous commit says: a provider with no
Gemini URL has nowhere to send it (#3935), the images API sends
its size to Gemini as an aspect ratio (#3936), and a translated
Gemini request drops the rest of what parseGemini doesn't read
(#3937).
What was run (tree d7ae85a2, on origin/main 0c17aac2, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- TestGeminiImageConfigGoesToTheGeminiAPIBesideChat, new: the previous
commit's five generationConfigs, generateContent, at a provider with
both URLs on one fake relay. The three with imageConfig are asked at
/v1beta/models/gemini-3-pro-image-preview:streamGenerateContent with
it, the two without at /v1/chat/completions. With
TestGeminiImageConfigReachesTheGeminiAPI and ReachesCodeAssist,
-count=5: 15 of 15 pass; -race -count=5: 15 of 15, no race.
- the new test on the previous commit's tree (2b421ece): red, the
three with imageConfig "the relay was asked at /v1/chat/completions,
want /v1beta/models/gemini-3-pro-image-preview:streamGenerateContent".
- broken by hand, each alone:
- the rule never setting ownAPI: the same 3 lines red;
- the rule setting ownAPI for every request: the two without
imageConfig red, "the relay was asked at
/v1beta/models/gemini-3-pro-image-preview:streamGenerateContent,
want /v1/chat/completions".
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
vet for windows, go build -tags nogui for linux and darwin and go
build for windows: exit 0 each. go vet and go build without the tag
on linux: exit 1 (no libsoup-3.0 or gio-unix-2.0 here).
- go test -tags nogui -count=1 -timeout 45m ./... (Bun 1.4.2, log
kept; 8m37s, load 34 at its start): 72 packages ok, and 14 tests red
in 5 packages, none of them this commit's tests or what they cover.
internal/gateway ran to its end (506s), so the three passed in it.
The reds: agent
TestCodexDriftReached (#3398); TestInstalledVersion,
TestHowInstalled, TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir (#3141);
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask 077,
#3640); gateway TestPluginToldWhereTheAgentWorks (#3675); gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649).
This commit is 44a63bd5 rebased: the same internal/ patch-id, and the
One try row of docs/subsystems/gateway-routing.md merged by hand, its
sentence unchanged. The rest is what was run for 44a63bd5, at tree
82a169ba on origin/main f8cd964a, the same code (not this tree):
- a probe at that tree, not kept, one server asked twice with
imageConfig: the Gemini API answering 400 "Model does not support
this protocol" (a wrongEndpoint wording): asked on Gemini, then on
Chat, 200 from Chat, and the second ask on Chat alone; answering a
bare 404 "models/... is not found for API version v1beta": the 404
to the client both times, Chat not asked, as for a streamed request
there, with or without imageConfig (relayed, also probed)
Not tried: the reporter's relay, or any real Gemini API; the relay
here is a fake. Not known: whether some relay's Gemini API lacks a
model its Chat API serves, the case where this commit turns a picture
at the default size into that 404.
Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
077; agent, provider, library and gateway with an empty .git above
TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
changed tests in agent, provider, gateway and gui; the timing tests
-count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
at umask 077 and two Reasonix tests under an empty .git; on Linux
(wsl-run) TestProgram at umask 077 with the old program.go. With
each fix's code taken back to main's, the Gemini imageConfig tests,
TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
plugin-github-hooks, plugins-more-discover, plugin-namesake were
red. Broken by hand: claudeKeyed always true (both
OwnEndpointNeverAsked tests red), claudeAsk a no-op
(TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
(the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
plugin-card-update, plugin-github, plugin-move*, segs-glide,
tray-totals, update-*), and run again side by side they fail the
same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
there). They are click-scroll guards ("the click must not scroll
the page"), varying by language from run to run (#4385).
copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
too. In Chromium on mote, Chromium segfaulted partway through files
(#4125): context-map, context-scroll-end and context-tune fail the
same on origin/main 0911a65e7, so the batch's own files
(plugin-namesake, update-auto, plugins-more-discover,
plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
whose five reds were #4362's (Antigravity turned-away and
TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
the rebase on 244d80e23 the five pass, and gofmt, the three vets
and the targeted runs above were run again: ok. In Linux the
sign-in, copilot, plugin-github*, plugins-more-discover,
plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
#1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
gui, gateway, provider and plugin, TestCoreScriptBudget (core
1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
update-mirror, plugin-namesake, plugins-more-discover,
plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
GuoJinguang (#3820): a Gemini client's generateContent asking a
gemini-*-image-preview model for generationConfig.imageConfig
{"imageSize":"4K"} drew 1024x1024 through magpie, where the same
request straight to their relay drew 4096x4096. The picture came, at
the model's default size, and nothing said the size had been dropped.
parseGemini didn't read imageConfig, so wherever magpie builds a Gemini
client's request again it was gone: a request asked for one body to a
Gemini API that isn't Vertex AI (always translated, since attempt asks
a Gemini API streamGenerateContent and reads the stream back into one
body), and every request to Code Assist or Antigravity, which go in
their envelope. A streamed request to a Gemini API, and a Gemini
client's request to Vertex AI, streamed or not, is relayed as it came
(passthrough) and kept it.
The reporter's request went to the relay's chat completions instead.
Their provider has a Chat URL beside its Gemini one, and attempt turns
relay off for a Gemini request asked for one body without ownAPI, so
it goes to the first API usable gives: Chat, as Speaks puts a custom
provider's Gemini last. That default is meant (uaSetup in
user_agent_test.go: "Gemini's own wire, which a provider on Chat too
isn't asked on"), and Chat has no field for imageConfig.
Now parseGemini keeps generationConfig.imageConfig as the client sent
it (Request.ImageConfig, raw as Metadata and ClientMetadata are, so
Vertex AI's own fields beside imageSize and aspectRatio go on too), and
buildCodeAssistSent, which every translation to a Gemini API goes
through, writes it into generationConfig: the Gemini API (buildGemini),
Vertex AI (buildVertex), and Code Assist and Antigravity in their
envelope. A request that asked for none is sent none. Chat, Responses
and Messages are left as they were: I found no vendor documenting a
field for it there, so none is made up. gateway-routing.md says where
imageConfig goes.
At a provider with both URLs, a request asked for one body reaches the
Gemini URL, and its imageConfig with it, when the user picks Gemini as
the API the model is asked on in the provider editor (SetModelAPI,
tested below). The next commit sends one that carries imageConfig
there by default.
Left as on main, each in its own issue:
- a Gemini client's image request to a provider with no Gemini URL
(the Google Gemini preset's OpenAI-compatible endpoint, OpenRouter,
another magpie, a relay saved with a Chat URL alone) carries no
imageConfig, asks no modalities, and reads no image back from chat
(#3935);
- /v1/images/generations and /v1/images/edits send a size to a Gemini
image model as an aspect ratio only (drawGemini, drawChat), and to
Code Assist only in words (drawCodeAssist), so nothing above 1K can
be asked there; a Gemini client's request never takes that path
(#3936);
- the rest of what a translated Gemini request drops: safetySettings,
topK, seed, responseModalities, and the newer responseFormat
(Google's next spelling of the same ask), among the fields
parseGemini doesn't read (#3937).
This commit's tree (2b421ece, on origin/main 0c17aac2) wasn't run on
its own. It is 85b532c6 rebased, with the same internal/ patch-id and
the same gateway-routing.md line, which applied as is. Its two tests
ran at the next commit's tree, -count=5 and -race -count=5, and in the
full suite there. What was run for 85b532c6, at tree de27856c on
origin/main f8cd964a, the same code (not this tree), with go1.26.8,
linux/amd64, Linux 5.15, outside graftcp, umask 077:
- TestGeminiImageConfigReachesTheGeminiAPI, new: a fake relay records
each request. Five generationConfigs (imageSize 4K, the reporter's;
aspectRatio 16:9 and imageSize 2K beside a thinkingConfig; the
snake_case image_config; none; temperature alone), at a provider
with the Gemini URL alone (generateContent and streamed), with a Chat
URL too (streamed), and with a Chat URL too and the model's API set
to Gemini (generateContent): 4 of 4 subtests ok
- TestGeminiImageConfigReachesCodeAssist, new: the same five to an
Antigravity sign-in's gemini-3.1-flash-image, generateContent and
streamed, read in request.generationConfig: ok
- both on f8cd964a, the test file alone: red. The Gemini URL alone and
the set-to-Gemini subtests, 3 asks each: "asked {...}:
/v1beta/models/gemini-3-pro-image-preview:streamGenerateContent was
sent "": ...", no imageConfig; Code Assist, both methods, 3 asks
each: "sent "": ..."; the two streamed subtests pass, the relay
having kept it
- broken by hand in a scratch worktree at that tree, each alone:
- parseGemini not reading it: the same 12 lines red
- buildCodeAssistSent not writing it: the same 12 lines red
- buildCodeAssistSent writing it when none was asked: 8 lines red,
"asked for none: ... was sent null" and "sent null"
- both, -race -count=5: ok
- go test -tags nogui -count=1 -timeout 45m -v ./internal/gateway,
Bun 1.4.2: 5402 passed with their subtests, 3 skipped, 1 red,
TestPluginToldWhereTheAgentWorks (#3675)
- tools/vetset.sh: gofmt -l clean; vet for linux, windows and darwin
with -tags nogui, windows vet, and the three builds exit 0; untagged
linux vet and build exit 1 at pkg-config (no GTK headers here)
- the full suite ran once, at 44a63bd5's tree; de27856c is covered by
the gateway package and the vet set above
Not tried: the reporter's relay, or any real Gemini API, Vertex AI or
Antigravity image model; the upstreams are fakes that record the body.
Whether a relay's Gemini API passes imageConfig on to Google is the
relay's.
Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
077; agent, provider, library and gateway with an empty .git above
TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
changed tests in agent, provider, gateway and gui; the timing tests
-count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
at umask 077 and two Reasonix tests under an empty .git; on Linux
(wsl-run) TestProgram at umask 077 with the old program.go. With
each fix's code taken back to main's, the Gemini imageConfig tests,
TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
plugin-github-hooks, plugins-more-discover, plugin-namesake were
red. Broken by hand: claudeKeyed always true (both
OwnEndpointNeverAsked tests red), claudeAsk a no-op
(TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
(the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
plugin-card-update, plugin-github, plugin-move*, segs-glide,
tray-totals, update-*), and run again side by side they fail the
same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
there). They are click-scroll guards ("the click must not scroll
the page"), varying by language from run to run (#4385).
copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
too. In Chromium on mote, Chromium segfaulted partway through files
(#4125): context-map, context-scroll-end and context-tune fail the
same on origin/main 0911a65e7, so the batch's own files
(plugin-namesake, update-auto, plugins-more-discover,
plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
whose five reds were #4362's (Antigravity turned-away and
TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
the rebase on 244d80e23 the five pass, and gofmt, the three vets
and the targeted runs above were run again: ok. In Linux the
sign-in, copilot, plugin-github*, plugins-more-discover,
plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
#1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
gui, gateway, provider and plugin, TestCoreScriptBudget (core
1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
update-mirror, plugin-namesake, plugins-more-discover,
plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
MengXiangxi (#3821): a GitHub repository tagged magpie-plugin whose
package.json has magpie.hooks and no main, exports or index.js, a gateway
request hook alone that installs and runs, never showed in the Plugins
page's "Unofficial, on GitHub". readTagged read the magpie block's
middleware, agent and page but not hooks, so such a package was taken for
a provider: the file #1327's check looks for in the repository was its
entry as Bun resolves it, index.js, which it hasn't, and the 404 left it
out without a word. An inert index.js, as the reporter tried, lists it,
as a provider.
readTagged reads magpie.hooks. A package with hooks, no main or exports,
and none of middleware, agent or page is of kind "hooks", and the
file #1327's check looks for is its hooks file, so one whose hooks file
isn't committed (a dist built only to publish) is still left out, as a
middleware's is. The Plugins page picks "hooks" out with middleware, as
both run in the gateway (kindOf), and its chip says Request hook, as an
installed one's row does, through the word kindChip takes since the
previous commit. docs/subsystems/gateway-request-hooks.md says so. Not
changed: a raw 404 that GitHub's cache answers just after a push is
still kept for that push in this process (the reporter's second
point, #4067).
plugins.js grows 51 bytes for it. With the previous commit the core's
scripts are 24 bytes under main's, 1,527,948 of 1,528,076.
What was run (tree 79884772, on origin/main 56602426, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, the Go tests at umask 077:
- TestTaggedHooksAlone, new. IvanXxxxyyuffff/magpie-system-prompt-file's
package.json as it is (a repository the report names) is kept, of kind
hooks, with its spec, package and version 0.3.0, and its hooks file is
the file asked for, never an index.js. someone/hooks-gone, whose hooks
file is only in a dist it doesn't commit, is left out. With
TestTaggedRepos*, -count=50: 350 of 350 pass; -race -count=20: 140 of
140, no race.
- plugin-github-hooks.test.cjs, new. Seven repositories of
/api/plugins/github's real answer of 2026-10-27 (two providers, three
middleware, two of hooks alone): each of hooks alone has the gateway's
chip saying Request hook and is picked out under Middleware, in
English, Chinese, Traditional Chinese, Japanese and German at 980px and
420px. Chromium and WebKit, 3 runs: 22 of 22 each run.
- Broken by hand, each red:
- no kind made of magpie.hooks, as on main: TestTaggedHooksAlone,
hooks alone not kept.
- the kind made but the file looked for still the entry, index.js:
the same.
- the hooks file not looked for: TestTaggedHooksAlone, the hooks file
not among the files asked for.
- kindOf without hooks, so a Provider: plugin-github-hooks 0 of 22.
- the card's chip not given its word: 0 of 22.
- TestCoreScriptBudget: ok.
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
vet for windows, go build -tags nogui for linux and darwin and go
build for windows: exit 0 each. go vet and go build without the tag
on linux: exit 1 (no libsoup-3.0 or gio-unix-2.0 here).
- The Plugins page's GUI files near the change, 24 with the new one and
i18n-keys, each run by itself in Chromium and in WebKit: 42 of 48 runs
green. The other 6 are red the same at 56602426, each file run the
same way, and none is in what this changes:
- i18n-keys, both engines: "a plugin's words are its own", for
plugins/routing/i18n.js "masking…", which internal/masking/masking.go
says too (#4053).
- builtins, WebKit: Plugins › Built-in, the Observability switch's
click times out, the stuck Plugins header (.lib-head.pm-head.stuck)
over it taking the pointer.
- plugin-github, WebKit: de 440, a click scrolls #view-plugins, 74 to
139 (65 to 119 at 56602426; #3218 has the same check red in
Chromium).
- plugin-github-wait, Chromium: de 440, Try again moves #view-plugins
by 2.
- plugin-release, WebKit: en and zh read "Serves Zed\n" for "Serves
Zed".
- go test -tags nogui -count=1 -timeout 45m ./... (Bun 1.4.2, log
kept; 8m48s, load 32 at its start): 71 packages ok, internal/plugin
among them, and 16 tests red in 6 packages, none of them this
commit's tests or what they cover (internal/gui's are its gateway
tests): agent TestCodexDriftReached (#3398); TestInstalledVersion,
TestHowInstalled, TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath (#3141); TestReasonixCLIRequiresSupportedNativeVersion
and TestReasonixCLIRecoversAfterProbeTimeout (#3641); davsync
TestSyncTeraCloudStillSeesOtherWrites (#3420); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask
077, #3640); gateway TestPluginToldWhereTheAgentWorks (the
/tmp/.git of #3675); gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie (#3649).
The rest is what was run for 31a99237, at tree 2dd21699 on origin/main
508911e4, the same Go change (github.go has since taken e4ccf67b's
search timeout, in askTagged, not readTagged; 31a99237's plugins.js
named the card's chip by hand, not through kindChip, and had three
lines of comment this leaves out; not this tree):
- Real use: magpie web built at 508911e4 and at that change's code
(529f07e5, the same but for the new GUI file), each in a sandbox HOME,
asked real GitHub for /api/plugins/github. 508911e4 listed 163 and left
IvanXxxxyyuffff/magpie-system-prompt-file out. That change listed 164,
it and MengXiangxi/magpie-openviking (which now has the inert index.js)
of kind hooks. cyberElar/magpie-x-search (#1327's, a command only) was
left out by both.
Not tried: macOS and Windows; the real app's window (no display here, the
page in Playwright's browsers only).
Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
077; agent, provider, library and gateway with an empty .git above
TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
changed tests in agent, provider, gateway and gui; the timing tests
-count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
at umask 077 and two Reasonix tests under an empty .git; on Linux
(wsl-run) TestProgram at umask 077 with the old program.go. With
each fix's code taken back to main's, the Gemini imageConfig tests,
TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
plugin-github-hooks, plugins-more-discover, plugin-namesake were
red. Broken by hand: claudeKeyed always true (both
OwnEndpointNeverAsked tests red), claudeAsk a no-op
(TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
(the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
plugin-card-update, plugin-github, plugin-move*, segs-glide,
tray-totals, update-*), and run again side by side they fail the
same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
there). They are click-scroll guards ("the click must not scroll
the page"), varying by language from run to run (#4385).
copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
too. In Chromium on mote, Chromium segfaulted partway through files
(#4125): context-map, context-scroll-end and context-tune fail the
same on origin/main 0911a65e7, so the batch's own files
(plugin-namesake, update-auto, plugins-more-discover,
plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
whose five reds were #4362's (Antigravity turned-away and
TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
the rebase on 244d80e23 the five pass, and gofmt, the three vets
and the targeted runs above were run again: ok. In Linux the
sign-in, copilot, plugin-github*, plugins-more-discover,
plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
#1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
gui, gateway, provider and plugin, TestCoreScriptBudget (core
1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
update-mirror, plugin-namesake, plugins-more-discover,
plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
SenseTime Raccoon answers an account whose token throughput is used up
with 429 {"error":{"code":"user_model_rate_limited","message":"您的模型请
求频率超限,请稍后重试","type":"rate_limit_error"}} and no Retry-After.
Its words read as a short rate limit, so the lone account was asked again
by the same-one retries (passing: 1, 2, 4s) and then by the plain
provider's patience (busy/replan: 2, 4, 8, 16s): eight asks in ~38s,
each one resending the whole ~88k-token request into the bucket it was
waiting on (cycocyco's numbers in plugins#512).
A 429 whose error.code is in wallCodes (only user_model_rate_limited) is
now neither passing nor busy. It still reads as failRate and rests as one
(a minute, doubled each time it comes back, up to 30 min, rateRest), so a
group's next member or the provider's next account is asked, and a lone
one hands the agent the vendor's error after one ask. The code is matched
at error.code only, not as words anywhere in the body. Other rate limits,
the same Chinese words under another code included, are retried as
before. The plugin passes the vendor's body through unchanged, so this is
the place for it.
Run (mote, at this change on origin/main 244d80e23):
- go test ./internal/gateway -run 'TestTokenWall|TestRateLimitIsWaitedOut|TestShortReset|TestLastOneLeft|TestGroup': ok
- gofmt -l internal cmd: clean; GOOS=linux go vet -tags nogui ./... and
GOOS=windows go vet ./...: ok
- go test -timeout 45m -count=1 ./...: every package ok except
internal/gui, whose ten real-window AppKit tests (dock, panel, tray,
titlebar, plugin page) were killed at their deadlines, mote's known
state (#4125, #2645); this change touches no GUI code.
Rebased on origin/main 88e6fb9cf: go test -timeout 45m ./internal/gateway
./internal/usage: ok. Rebased again on 88e6fb9cf (routing.go's credit
rests changed, not the rate path): go test ./internal/gateway -run
'TestTokenWall|TestRateLimitIsWaitedOut|TestShortReset|TestLastOneLeft|
TestGroup|Rest|Credit': ok; the whole package not rerun there.
Broken by hand: with both !walled(body) guards taken out,
TestTokenWallIsNotRetriedInPlace is red (passes, busy) and
TestTokenWallFailsFast is red with "429 after 16 tries".
Not tried: the real Raccoon API (no account here), nor the reporter's
Hermes on Windows.
士奇 on Discord (Simplified Chinese GUI, the third report of this): with
routing groups off, Hermes Agent's and WorkBuddy's model lists had the
ChatGPT subscription's GPT models. With routing groups on, they were gone.
Cause: the user's group names those models and lists itself alone
(Group.Unlists, the routing plugin's option for that, #1783). While the
group is on, catalogKeeping drops what it names from Catalog(), and every
agent's list starts from Catalog(). With groups gated off the group's
Unlists goes away, so the models came back. a3ee00c05 kept them for the
Codex agent only; its body said other agents still didn't see them.
Fix, at the one point every agent's list starts from: catalogOf(agent)
keeps a signed-in subscription's own models (SubscriptionKept: no group
entry, Provider.Account set, the provider not kept for routing groups)
for every agent, so a group is added on top of what agents had. A client
that is no agent ("" on /v1/models) still gets the group alone, as #1783
asked. Provider.Unlisted ("Only through routing groups") still hides the
provider's models from agents other than Codex. Unlisted() no longer names
a kept subscription model, so the picker's note doesn't call it kept for
groups.
Siblings: every agent writer reaches catalogOf through CatalogFor and
ListedFor. Two gateway lookups read Catalog() directly and now use the
agent's catalog (CatalogOf): /v1/models/{id} and Claude Desktop/Science's
alias lookup. agent.go and codex.go read Catalog() only for error text or
a fallback and are left alone. The routing plugin's hint for that option
says, in every language, that a signed-in subscription's models stay in
agents' lists.
Test: TestSubscriptionModelsStayInEveryAgentsListWithGroupOn signs in a
ChatGPT account in a sandbox and switches on a group naming its 5 models
that lists itself alone. For every agent that lists the group (68,
including hermes, workbuddy, claude and codex), the agent's list and
CatalogFor have the models, and a picker offering the group offers them.
Catalog() and CatalogFor("") still don't. With the provider set to
Unlisted, Hermes doesn't list them. TestCodexOwnModelsListedOnlyThroughGroups
now expects Claude Code to keep the models under a group alone.
Run (on mote):
- Broken by hand: catalogOf reverted to a3ee00c05's Codex-only version.
The new test went red with 340 errors across 68 agents, e.g.
"codex/gpt-5.5 not in hermes's list map[group/mygpt:true]", and the
same for workbuddy, claude and claude-desktop. Green with the fix back.
- gofmt -l; go vet on darwin, linux (nogui) and windows; builds: clean.
- go test -timeout 45m ./... at 035d87b80 (this change on 4a4a90c23,
before a test comment was reworded): every package ok except
- internal/gui TestMainWindowCorners/macOS_26_SDK: #3949, red on
origin/main accb951ab on mote too (macOS 27);
- internal/provider TestClaudeAccountServesModelsListedSinceItsFetch:
#3174 (red in a full run, green alone). 5 of 5 green alone and
green in a whole internal/provider run at that head.
- At this commit on b26fa0903: gofmt -l on the
changed Go files, go vet of provider, gateway and gui on darwin, linux
(nogui) and windows: clean. internal/provider whole: ok.
internal/gui and internal/gateway with -run
"Codex|Group|Subscription|Unlist|Catalog|AgentModel": gui ok; gateway
red on TestAntigravityTurnsCodexsGPT5ThreadAwayOnce and
TestCodexSpentGrokFailingIsTold, both red the same way on origin/main
b26fa0903 (3 of 3) and filed as #4362.
- GUI files the change reaches, on b26fa0903: agent-model*, group-unlists and
i18n-keys: every Chromium case and i18n-keys pass (46); every WebKit
case timed out launching the browser (180s, #4125: WebKit doesn't start
on mote right now). The same files at 035d87b80 passed in both engines
but i18n-keys, whose one red (the new test quoted a routing-plugin
word) is fixed here.
- Rebased on 101775657 (main had moved models.go and gateway.go): gofmt,
go build for darwin, linux (nogui) and windows, go vet of provider,
gateway and gui on all three: clean. go test -run
"Codex|Group|Subscription|Unlist|Catalog|AgentModel" ./internal/gui
./internal/provider and -run "Model|Desktop|Alias|Catalog"
./internal/gateway: ok.
- The whole GUI suite (1004 files) at fd50ed116 was still running when
this was pushed (mote shared with other sessions' suites). Reds it
shows get their own issue unless already red on main.
Not tried: no live ChatGPT account and no real GUI app run (the test signs
in a sandbox account). No separate gateway test for /v1/models/{id} or the
Desktop alias lookup. Provider.Unlisted stays honoured, on purpose.
PaulT on Discord #feedback: an OpenAI API-key provider answering 402 out
of credit showed "Resting · 402 out of credit · back at 04:10 PM" and was
asked again every 30 minutes, refused the same each time. 1534474c8 gave
ChatGPT accounts a rest until their credits are back; keys still had the
flat 30-minute creditRest.
An API key (Account == nil) whose vendor says it is out of money now
climbs creditLadder: 30m, 2h, 8h, 24h, 3d, then 7d each time after.
Refused again while it still rests (the lone key, asked all the same)
keeps its rung; a rest that ended and is refused again goes a rung up.
"Try now" (Unrest) and an answer (servedCandidate) start it over at 30m.
It covers what failure() already calls failCredit: a bare 402, OpenAI's
insufficient_quota (its billing errors are 429s with type
insufficient_quota and codes credit_balance_exhausted,
organization_/project_spend_limit_exceeded,
organization_usage_limit_exceeded, per
developers.openai.com/api/docs/guides/error-codes), DeepSeek's
"Insufficient Balance" 402, Anthropic's "credit balance is too low" 400,
Zhipu's 余额不足 and WorkBuddy's exhausted 429.
What stays as before: a refusal that names when it is back (resets_at,
a reset header) rests till then, capped at longestMonthly. A 402 that can
pass soon or for a smaller request rests creditRest flat and never climbs:
one with Retry-After (OpenRouter's openrouter_in_flight_budget, per
openrouter.ai/docs/api-reference/errors), OpenRouter's "can only afford" /
"fewer max_tokens", and "try again in N" / "N 分钟后" (creditSoon).
Subscription accounts other than ChatGPT's keep 30m flat, and another
computer's magpie rests the model only, flat (TestCreditLadderIsKeysOnly).
Run (mote-run; first at this change on origin/main d31710c71):
- go test -count=1 -timeout 45m ./internal/gateway ./internal/gui: internal/gateway red only on TestAntigravityTurnsCodexsGPT5ThreadAwayOnce,
TestAntigravityTurnedAwayIsForeseen, ...LastIsNoQuota, ...InsideTheReplyLast
and TestCodexSpentGrokFailingIsTold, each red the same on origin/main
d31710c71 (#4362), and TestBurstTellsNoSpeed under load (#2719);
internal/gui red only on the real-window AppKit tests killed at their
20-40s deadline under mote's load (TestDockJoinLeadsCommandTab,
TestPanelCloseHidesIt, TestMainWindowCorners, TestCoveredWindowStaysUp,
TestTrayCellClickReleasedPanel and others: #2645, #4125, #1936, #3178);
the same five red at origin/main d31710c71 alone; TestBurstTellsNoSpeed
passed alone on both; TestCoreScriptBudget passed
- earlier, -run 'Credit|Rest|Quota|...' ./internal/gateway: red only on
TestAntigravityTurnedAwayLastIsNoQuota, red the same on origin/main
d31710c71, filed as #4362.
- rebased on 764a032f6 (c37b8b659's remote-magpie quota change among
it; the routing doc line conflicted and was merged by hand): go vet
./internal/gateway native, GOOS=linux, GOOS=windows ok; -run
'Credit|Rest|Quota|Remote|Magpie|Unrest|Codex|Spent|Broke|Balance|Afford'
./internal/gateway red only on #4362's tests. Then rebased again on
the 20 commits after it (46fb0c1b9) with no conflict; there go vet
./internal/gateway and the three new tests pass.
- gofmt -l clean; go vet ./internal/gateway native, GOOS=linux and
GOOS=windows.
- The full go test ./... is still to come: mote was running other
sessions' full suites. Any red it shows gets an issue.
Broken by hand, each red:
- the credit branch in restAfterMarked off: "refusal 2: rests 30m0s ...
want 2h0m0s".
- the rung climb after an ended rest (else if had) off: red.
- creditSoon off: OpenRouter's "can only afford" climbs ("failures 1 ...
want flat").
Not tried: PaulT's own 402 body (not known; the test holds OpenAI's
documented bodies and the vendors' bodies magpie's tests already had).
No real out-of-credit key was asked. A key's balance reading doesn't
lift its rest early; "Try now" does. The ladder is in memory, so a
restart of magpie starts it over at 30 minutes.
shuizhuyu asked for a global shortcut to switch accounts. v0.1.2143's
Quick panel shortcut opens the tray panel, but the panel had no account
switch: switchable() returned null there, because the panel reads no
provider list (a fresh /api/providers reads every sign-in, seconds after
a start, #1519).
Now a Claude Code or Codex not connected has an "account" line in its
opened panel row (switchEntry, the window's Switch accounts only menu).
The line is drawn from the list kept from the last read
(GET /api/providers?last=1, no keychain read; panelAccounts in app.js),
read fresh only when nothing is kept. Opening the menu does one fresh
read and opens on what it says. Manage accounts… and a lapsed pick open
the window's Providers (window/main?view=providers). The provider and
login actions now keep their answer as the last list (keepProviders), so
a switch made in the window or the panel is in the next kept read.
app.js stays under its budget with no raise: my own comments and two
older ones (the usage accounts note, the sidebar note) were cut down.
Run:
- GUI, Windows box (xiaomi-gpu, win-run), Chromium + WebKit: 31 files
(panel-*, panel-switch-accounts, agent-switch-accounts, switch-only,
claude-switch-only, keep-login, agent-failover, agent-row-disclose,
getting-started, click-scroll, i18n-keys, gui-zh-tw, gui-ja, gui-de):
503 of 503 pass. Not the whole GUI suite.
- mote: no browser could launch there (pboard down, #4125; every WebKit
and later Chromium launch timed out at 180s), so the GUI runs there
were cut short. agent-panel-name-width, red there in both engines, is
red on origin/main too (#4304, #4203), and this change doesn't draw
the closed rows it measures.
- mote: go vet ./internal/gui; go test -run 'TestKeptProvidersFollowActions|
TestLastKnownProviders|Budget|TestProvider' ./internal/gui ok (includes
TestCoreScriptBudget). gofmt -l clean. GOOS=windows go vet ./... ok.
GOOS=linux go vet ./... fails only in wails/v3 pkg/application (cgo
off when cross-compiling), the same on origin/main 32f5c3369 (#4406).
At the pushed head (rebased on origin/main 32f5c3369, whose switchEntry
now leaves setup-token logins out of the menu; kept): the Go run above
again ok, TestCoreScriptBudget at the new 1,536,586 included, app.js
1,314,856 of 1,315,316; on the Windows box, panel-switch-accounts,
agent-switch-accounts, switch-only, claude-switch-only, keep-login,
agent-failover, i18n-keys, panel-fold and panel-effort: 178 of 178.
Broken by hand:
- panel-switch-accounts on origin/main's assets: 12 of 12 red in
Chromium (no account line).
- Panel always reading fresh (laziness removed): 11 of 12 red.
- keepProviders removed from the provider action:
TestKeptProvidersFollowActions red.
Not tried: real Claude Code or Codex accounts; the real Wails panel
opened by the shortcut; the login/{action} keep has no test of its own.
ferock (Discord) asked to see calls to magpie's MCP tools, such as
magpie-image's generate_image, generate_video and generation_result, in
Routing > Requests.
Each tools/call to magpie's own MCP servers (image, vision, web search,
tools and the Library hub) is now a row of the request log. The row has
Source and Kind "mcp", the tool as its model, the server as its host,
how long the call took, and its error if it failed. The provider and
model it shows are those of the model requests the call made, collected
through the request's context in appendUsage. generation_result names
the model of the job it answers. The stdio Magpie Image server reports
each call it answered to the gateway as "magpie/toolCalled". That report
carries the tool, ms, model and error, never the prompt.
The arguments are never stored at all, so there is nothing to mask. The
rows go down the probe lane: they are listed, but no total, host list,
budget or key limit counts them. The model requests a call made are rows
of their own.
In the GUI the row reuses the Requests list. It gets a muted "MCP" badge
with a tooltip, the server beside the provider, and a Succeeded/Failed
status. The Purpose filter gains "MCP tool" in every language. There is
no new page, no <select> and no left border.
The core scripts went over their budget with the new purpose.
genpurposes now writes purposes.js as compact JSON, which makes the core
448 bytes smaller than main in all, and coreScriptBudget is lowered to
the new total, 1,538,975. No room is added.
Run on mote, at the rebased head:
- gofmt -l: clean. go vet -tags nogui ./... with GOOS darwin, linux
and windows: ok.
- go test -tags nogui -timeout 45m: ./internal/usage, ./internal/imagemcp,
./internal/usageapi and ./internal/gui ok. internal/budget has no test
files. ./internal/gateway (805s): every test ok except five Antigravity
and Codex/Grok tests. They fail the same on a clean origin/main
3bebc3839 and are filed as #4362.
- GUI, the usage-ledger*, routing-request*, purpose*, i18n* and
gui-zh/ja/de files (25). On mote, Chromium: 32 of 32 ok; WebKit
could not launch (10 other sessions' suites on mote). On Linux
(wsl-run), both engines: 335 of 355 ok. The 20 reds are
routing-request-model, usage-ledger, -ttft, -chart and
-open-settled, which fail the same at the parent 1534474c8 (#4120).
usage-ledger-mcp, purpose-filter and i18n-keys are ok in both.
The whole GUI suite runs after the push, and each red it finds gets
an issue.
- At the pushed head, rebased on 0804f2d97: ./internal/gui (the
budget and purpose asset tests among them), ./internal/usage,
./internal/imagemcp and ./internal/usageapi ok, and ./internal/gateway
-run "MCP|Purpose|Probe" ok.
- usage-ledger-mcp.test.cjs covers 5 languages, widths 1180 and 420,
light and dark, with no sideways scroll.
Broken by hand. Each break went red:
- sawHost's MCP skip removed: TestMCPCallRowsListedNotCounted (the hosts
list had magpie-image).
- Row/Record.IsProbe's MCP case removed: the same test (3 calls counted),
and TestMCPCallCountsInNoKeyLimit (Calls: 1).
- The callMCPTool hook removed: TestMCPToolCallIsARequestRow and its
siblings (no rows).
- The appendUsage hook removed: the row had no provider or model.
- imagemcp's report removed: TestToolCallsAreReported.
- The gateway's magpie/toolCalled case removed:
TestMCPCalledFromStdioIsARow.
budget's in-memory counts() now skips these rows too. Breaking only that
stays green, because budget.Of reads the file through usage.Visit, which
already skips probes, and limits count tokens and cost.
Not tried:
- no real agent calling a real vendor's drawing;
- no test run on Windows or Linux;
- the page not checked in the real app or in WebKitGTK.
A generate call that answers while its drawing still runs has no model on
its row. The generation_result row that follows names it.
chenjiangzi asked for Tencent Cloud's WSA SearchPro (元宝搜索). It is added
as vendor "wsa", following Doubao Search (dca3e2d71), from Tencent's
own docs:
- API-key method (cloud.tencent.com/document/product/1806/130615):
POST https://api.wsa.cloud.tencent.com/SearchPro with
Authorization: Bearer <key> and a JSON body {"Query", "Cnt": 10}.
Keys come from console.cloud.tencent.com/wsapi/index (KeysURL).
- SearchPro (121811): Response.Pages is an array of JSON strings, each
with title, url, date, passage and content. The text is passage, or
content when passage is empty or only the title. Tags are stripped.
- Errors (121818/121820, 130615): HTTP 200 with Response.Error{Code,
Message}. AuthFailure*, UnauthorizedOperation and ResourceNotFound are
turned away (403); ResourceUnavailable (欠费), LimitExceeded and
ResourceInsufficient are out of credit (402); RequestLimitExceeded* is
rate limited (429); others are plain errors, with the key masked.
The fixtures in testdata are the docs' two example replies. 130615's is
shown with its quotes escaped twice, which isn't JSON; they were
unescaped once and nothing else changed. The GUI's picker is built from
SearchVendors, so no GUI file changes. README (en, zh), the CLI help and
gateway-routing.md name it.
Run on mote (mote-run), at the rebased head:
- go test -run 'SearchAPI|WSASearch|Volcengine|Search' ./internal/gateway/
./internal/gui/
./internal/provider/ ./internal/cli/: ok
- go vet -tags nogui darwin/linux/windows: ok; gofmt -l clean
- GUI (no GUI file changes; the picker reads SearchVendors):
search-api.test.cjs in Chromium 4/4 ok. Its WebKit cases and
searcher-pick timed out at browserType.launch (180s) on mote,
where ~57 WebKit pw_run launches from several sessions hang. Not
a result about this change; WebKit not run.
Broken by hand, each made TestWSASearchAPI red: the wsaSearchError call
removed, and Cnt dropped from the body.
Not tried: the real API. No WSA key was available, so the request,
reply and error mapping rest on Tencent's docs only. The full go test
./... is to follow.
chenjiangzi set Tavily's url to https://api.tavily.com/search, and magpie
appended /search again. Each vendor now names the paths magpie puts after
its base (SearchVendor.Paths). A url that already ends in one of them,
with or without a trailing slash and in any case, is cut back to its base.
This happens when it is saved (SetSearchAPI) and again when it is read
(SearchAPI.Base), so an entry saved before this change works too, and so
does Tavily's quota URL built on the same base. Every vendor is covered:
tavily, brave, exa, firecrawl, you (both paths), deepseek, volcengine,
searxng, and wsa in the next commit. A path of the user's own
(/my-search) is left alone. The url= help and gateway-routing.md say so.
Run on mote (mote-run), at the rebased head:
- go test -run 'SearchAPI|WSASearch|Volcengine|Search' ./internal/gateway/
./internal/gui/
./internal/provider/ ./internal/cli/: ok
- go vet -tags nogui for darwin, GOOS=linux and GOOS=windows on
provider, gateway, cli (and gui on darwin): ok; gofmt -l clean
- GUI (no GUI file changes; the picker reads SearchVendors):
search-api.test.cjs in Chromium 4/4 ok. Its WebKit cases and
searcher-pick timed out at browserType.launch (180s) on mote,
where ~57 WebKit pw_run launches from several sessions hang. Not
a result about this change; WebKit not run.
Broken by hand: ownBase returning the URL unchanged made
TestSearchAPIBaseURLWithItsPath red ("asked /relay/tavily/search/search,
want /relay/tavily/search").
Not tried: a real Tavily request; the full go test ./... (to follow).
sfss5362 on X asked "支持 CLAUDE_CODE_OAUTH_TOKEN 吗". It didn't work
before: cleanClaudeEnv strips the variable everywhere, and the import
flow needs a refresh token and an email.
A Claude account can now be added from the token `claude setup-token`
prints. In the window: the sign-in's "Use a setup-token instead…" and
the accounts list's "Add an account by setup-token…", which post to
POST /api/signin/claude-token.
The token is kept in logins.json as {"setupToken":…}. The real Claude
Code gets it in CLAUDE_CODE_OAUTH_TOKEN, and only for runs in that
account's own config directory (inClaudeDir via
provider.ClaudeDirToken). It never goes on the command line or into a
log. magpie never asks Anthropic anything with it. The bridge, the
sdk-cli entrypoint and the weighting are unchanged.
What such a token can't do: it has the inference scope only.
- Claude Code's `auth status` gives no email or plan. The account is
named "Claude setup-token <6 hex of its hash>".
- Its /usage prints the API cost view. /usage is never run for it, so
its allowance is unknown (errClaudeSetupToken, which `passing` keeps
as saying nothing about the account), not zero. Windows heard on
real replies still fill it in.
- Its config directory holds no .credentials.json, so Claude Code has
no sign-in to fall back to if the token is refused.
- Claude Code itself is never signed in to it. addLogin, switchLogin,
putClaudeLogin, SetKeepLoginAs, NextLogin and signInToFirst all pass
it over. Its row shows Remove and "magpie only", and the switch menu
leaves it out.
New strings are in zh, zh-TW, ja and de. Docs: providers-accounts.md
and claude-subscription-bridge.md.
Run:
- mote: gofmt -l (clean); go vet ./internal/...; GOOS=linux go vet
-tags nogui and GOOS=windows go vet of provider, gateway and gui; go
build ./...
- mote: go test of provider and gateway, -run on SetupToken, Claude
usage, warm-up, saved, account, logins, switch and keep-login: ok.
- New tests, with a fake claude binary in a sandbox HOME:
- TestClaudeSetupTokenAccount, TestClaudeSetupTokenSignsClaudeCodeInToNothing,
TestClaudeSetupTokenAllowanceUnknown and TestCheckClaudeSetupToken
in provider;
- TestClaudeSetupTokenReachesItsOwnRunsOnly in gateway: the token
reaches only its account's run, not "" or another dir, even with
the shell's CLAUDE_CODE_OAUTH_TOKEN=leaked, and never in args;
- claude-setup-token.test.cjs: Chromium on mote and WebKit on
xiaomi-gpu, each in en, zh, zh-TW, ja and de.
- GUI files the change reaches (signin-link, signin-web-blocked,
signin-closes-sheet, revoked-signin-account, account-eye,
account-row-line, i18n-keys and the new one): 73/73 on xiaomi-gpu
Chromium.
- On mote, 33 account, sign-in and i18n files had 96 reds. mote was
overloaded by another session's full GUI suite. Six of those files
fail 58 of 64 the same way at origin/main dafe4af82 there, and pass
on xiaomi-gpu. WebKit on mote timed out on the untouched
copilot-ghe.test.cjs too.
Size: app.js was 2,885 bytes over its budget after the rebase. The
new comments were cut, and the budgets were raised to the measured sizes
(app.js 1,317,705, core 1,539,423) with no room added, as
core_budget_test.go says. After the rebase onto origin/main 969868ccd,
these were run on mote at this head: TestCoreScriptBudget and the
SetupToken tests ok, and claude-setup-token plus i18n-keys in Chromium
9/9.
Broken by hand (each went red):
- without the token line in inClaudeDir, the gateway test;
- with addLogin allowed to sign Claude Code in, two provider tests;
- with /usage run for a token account, AllowanceUnknown ("told no
allowance").
- With switchLogin's guard removed, the tests stay green, because
putClaudeLogin still refuses.
Not tried: a real setup-token against Anthropic. The full Go and GUI
suites will be run after the push.
CyberCaius pasted
https://github.com/volcengine/mcp-server#subdirectory=server/mcp_server_askecho_search_infinity
(Volcengine's askecho web search) into the Library's MCP search. The
fragment was dropped, the MCP Registry was asked for "mcp-server" and
"volcengine", nothing it lists is there, so the page offered only a
blank command named "server".
A GitHub address naming a folder (#subdirectory=, /tree/<ref>/…,
/blob/<ref>/…/file) is now read before the registry: the folder's
pyproject.toml names the program ([project.scripts]) and its README's
"env": {…} examples the keys. It is offered as a normal market card:
uvx --from git+https://github.com/o/r[@ref]#subdirectory=<path> <program>,
with the keys asked for in the install sheet. Of several keys none is
required (askecho takes an API key, or an access key and secret); one
alone is. A bare repository is read that way only when the registry
has nothing at it. A pypi.org/project/ page, or a one-word search
naming mcp (with - _ or .) that the registry lists nothing by, asks
PyPI's JSON API and offers uvx <package> with its description's keys.
Claude Desktop is already wired for local Library servers
(claude_desktop_config.json); the test installs it there.
Run (mote):
- go test ./internal/library -run 'TestMarket|TestParseRepoAt|TestEnvInputs': ok
- go test ./internal/library rebased on ceef9e943 (AnySearch d05482bab in): ok; the push then rebased onto 70a0c387c (agent, cli only), not run again
- Full suite go test -timeout 45m ./... at d29414c1a (rebased only onto
origin/main since): 78 ok; reds in internal/gateway (Antigravity
turned-away x4, TestCodexSpentGrokFailingIsTold) and internal/gui
(AppKit real-window tests). Same reds on fresh origin/main ceef9e943,
filed as #4362, #2645, #4125, #1936, #3178, #3949.
- GOOS=linux/windows/darwin go vet ./internal/library: ok; gofmt clean.
- Broken by hand: MarketServers back on searchRegistryAt/searchRegistry,
TestMarketServerInRepoFolder, ...RepoFolderPage and ...OnPyPI red.
- Real use: the search against live GitHub and PyPI returns the uvx
command and the three keys; the command itself, run with uvx and a
fake key, answered initialize and listed web_search.
- Fixtures are the real pyproject.toml, README.md and PyPI entry, in
testdata/askecho; tests reach no network.
Not tried: a real search with a real Volcengine key; Claude Desktop
launching it (Desktop needs uvx and git on its PATH, as for the
featured fetch/git/time servers); Node servers in a folder (still the
blank form); a word search like "askecho" (no index has it). No GUI
change.
Pi set up by hand on a provider of its own named magpie (magpie/<model>
at the gateway) read as connected in magpie: every catalog change wrote
magpie's list over that provider, RenameProvider rewrote its refs, Drift
offered Reconnect, and Disconnect took the provider out.
0911a65e7 (yyddbds, MiMo) already holds a ListOnly agent's sync until
it is Wired; that still let a hand-written config that names a magpie
model (JFunfunfun's Pi) read as Wired. Both gates now apply.
Its test's last case said a magpie model picked by hand on MiMo's own
magpie provider connects it; that is JFunfunfun's case, so it now
stays the user's until connected in magpie (listonly_test.go, and the
doc's ListOnly line says so).
An agent whose magpie is a provider of its own config (Spelled, not
Native) is now connected only when magpie set it up (setUp): a field in
applied.json, the new applied.Kept that Keep leaves instead of deleting
the record, or the <id>.connect.was stash Connect has written since
10-03. Otherwise (handWired) it isn't Wired, has no Drift, and
SyncCatalog, RenameProvider and renameRefs skip it; Disconnect is a
no-op as it is for any unwired agent. Connecting it in magpie takes it
on as before; Disconnect after that skips putting back "was" values
that were themselves magpie's (dsh errored on them). RenameLegacy
records the dial/ -> magpie/ values it writes, and moveEfforts (the
Cursor/Antigravity effort ids, at start-up) leaves a hand-written
magpie/<ref> alone. Aside keeps its own
key-based ownership. OpenCode's own-gateway-provider test now connects
through Apply as `magpie opencode` does.
Run (on mote, at this head, rebased on f2c6831a3): go test -tags nogui
-count=1 ./internal/agent ./internal/cli ./internal/library
./internal/gui; go vet darwin/linux/windows of internal/agent and
internal/cli; gofmt -l. internal/agent again after the ListOnly test
change: ok. Pushed on ceef9e943, whose five commits since touch usage,
sessions, library, provider movers and gui only.
New tests: TestPiHandWiredMagpieProviderIsTheirs (pi's literal
settings.json/models.json in a sandbox HOME, files byte-identical after
SyncCatalog, RenameProvider and Disconnect), TestPiConnectedBefore-
StaysConnected (applied record, gone model, connect.was, applied then
Keep), TestHandWiredMagpieProviderSiblings (29 Spelled agents). All fail
on the old code.
Tests that wrote a connected agent's files by hand (Pi, OpenCode,
Hermes, omp, dsh, the Kilo plugin, Cursor efforts, and the cli's
save-then-sync test) now also mark it as Connect leaves it
(setUpInMagpie, the connect.was stash); without it they read as
hand-written, which is what this change is about.
Broken by hand, each red: the Sync gate, the rename gates, the Drift
gate, Keep deleting the record, the was-skip in Disconnect, the
moveEfforts gate (TestMoveCursorEfforts' hand-wired case).
Not tried: a real pi binary against the gateway. Users connected
between 09-23 and 10-03 who pressed Keep (record deleted before this)
read as not connected; one Connect brings them back and pi keeps
working meanwhile. Agents without Spelled (Claude Code, Codex, Gemini
and others) decide by their own checks and are unchanged.
CyberCaius on Discord: Usage's Claude Code filter listed Claude Desktop's
sessions. Desktop's Code tab runs Claude Code, which keeps the session in
~/.claude/projects like a terminal one; only each line's `entrypoint`
(claude-desktop, claude-desktop-3p) tells them apart. The calls were
counted under Desktop already (desktopEntrypoint), but the session, its
stats rows and its summary were Claude Code's, and the gateway's own
record of the session ("claude-desktop|<id>") wasn't matched with it, so
it could be listed twice.
The parse now keeps the entrypoint (state.Entry, on both the ccWhere fast
path and the full parse; cacheVersion 29) and a Code tab session gets
Session.App "claude-desktop". Its Agent, key claude:<id>, resume and
transcript stay Claude Code's. Stats rows and the summary use the app,
GatewayKeys and MergeExternal know the claude-desktop|<id> pair, the GUI
names it Claude Desktop, and Usage › Sessions filters by app || agent.
Run at the pushed tip (the AnySearch commit after this one, on
e8d42c02d): go test ./internal/sessions ./internal/library ok (mote);
go vet darwin, linux -tags nogui, windows over ./internal/... VET-OK;
i18n-keys ok; usage-sessions-desktop-app.test.cjs (new) 4/4 chromium +
webkit, en + zh, on the Linux box (on mote its webkit.launch timed out at
load ~40, before any page code).
This commit alone, before the last rebase (8bd8f50d5 on 1534474c8):
go test ./internal/sessions ok and the new GUI test 4/4 (mote).
Run at 7ec95b5dd (both commits on 1534474c8):
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
(mote): VET-OK.
- Full go test -tags nogui ./... -timeout 45m on the Linux box (wsl-run).
Red only where origin/main eadeb89c4 is red on the same box, each filed:
internal/agent install detection (#4033, #3548), internal/gateway
Antigravity turned-away and TestCodexSpentGrokFailingIsTold (#4362);
internal/cli TestAgentFieldNameShowsIt and
TestEveryAgentFieldNameWritesNothing red in the full run, ok alone at
this tip (#4247).
- GUI: i18n-keys and gui-de/ja/zh-tw ok on mote; the other sessions-*
and usage-* files hadn't finished on mote when pushed.
- The whole GUI suite has not finished: a WSL run at the tip was about
half way (2226 ok) when this was pushed, with reds only in files these
changes don't reach (routing key models, panel name width, LAN
addresses, Codex composer, Copilot GHE, gateway key limits, ...);
they'll be checked against origin/main and filed on their own.
Earlier, before the rebase (da5f1e5bd on ffa07395e): full go test
-tags nogui ./... on mote, 80 packages ok.
Broken by hand, each red: stats not using appsOf (usage agent stays
claude); the Entry in claudeFull; the Entry in ccWhere (the test's first
line is an attachment so the fast path is taken); MergeExternal without
the App pair (3 sessions become 4); page.js's byAgent on agent only (GUI
test times out).
Not tried: a real Code tab transcript (none on this machine; fixtures are
written from the field names only). A Code tab that sends the plain
magpie key through settings.json env would be recorded by the gateway as
claude, not looked at. NativeIDs for claude-desktop doesn't read Claude
Code's files yet: #4333.
Steven's ESP32 desk display polls magpie (Docker, on his LAN) every 15s
on GET /v1/magpie/quotas and /v1/magpie/usage and never sends a model
request. Only a key held to nothing was told the usage summary, so the
key kept in the device's flash had to be one that could spend every
account.
A gateway key can now be read-only (access.Key.ReadOnly):
- `magpie gateway-key add <name> --read-only`, `magpie gateway-key access
<id> [read-only|full]` (`gateway-key --help` lists it; `list` has an
ACCESS column), and "Make read-only" / "Give full access" in the key's
menu in Gateway -> Gateway keys, with a "Read only" tag on its row.
- readOnlyGuard (internal/gateway/readonly.go), after callerGuard and
before withCaller/keyLimited, judges the pattern ServeMux.Handler routes
the request to. A read-only key is answered GET /, /v1, the quotas,
their history and cards, the usage summary and its requests, its limit
and the concurrency. Every other route is refused with 403
gateway_key_read_only: every model route, count_tokens, the Responses
WebSocket's upgrade, every MCP server, Codex's and Gemini's backends,
/v1/models and the Ollama routes, the catch-all, the trace and route,
debug profiles, and every write (usage ingest, quotas refresh). It is
default deny, so a route added later is refused until it is classified.
- The key is held to nothing else, so heldKey leaves it alone: it reads the
usage summary and every account's quotas, as a key held to nothing does.
None of those routes holds a key's secret.
- The sharing key can't be made read-only, since magpie gives it to its own
agents (LANSecret). Update refuses it, and the GUI item is off with why.
Older versions: a magpie from before this commit doesn't know `readOnly`
and treats such a key as a full one, so downgrading magpie widens the key.
Tests:
- TestReadOnlyKeyEveryRoute (internal/gateway/readonly_test.go) takes the
patterns from the router itself (routes() records each HandleFunc). It
fails when a pattern is in neither readOnlyRoutes nor its refused list.
It sends every refused pattern, by each method it takes, from
192.168.1.9 and from loopback, plus a WebSocket upgrade and an unclean
chat path, and expects 403 gateway_key_read_only with the upstream never
reached. It checks that every allowed route answers, that no body holds
any key's secret or the upstream key, that the usage summary names the
other key's use, and that a full key and a key made full again still
reach the model.
- TestReadOnlyKey (access) covers add-key and access-key on and off,
Authenticate, List, and the sharing key refused.
- TestGatewayKeyCLIReadOnly covers --read-only before and after the name
and beside --key, access, the list column, bad values, and --help.
- gateway-key-readonly.test.cjs runs Chromium and WebKit, 1100 and 420px,
in en/zh/zh-TW/ja/de. It covers the tag, both menu items and what they
post, the status line, the sharing key's item off with its why, no
scroll on click, no sideways scroll, no select, and no left stripe.
gateway-card.test.cjs now expects the menu's 4th item.
- TestClientPathCoversHandler takes the patterns from routes() instead of
parsing Handler's source, which moved into routes().
Broken by hand:
- readOnlyGuard passing everything: TestReadOnlyKeyEveryRoute red (103
lines, /v1/models 200 onward).
- A new `POST /v1/new-thing` route in routes(): red, "in neither
readOnlyRoutes nor readOnlyRefused".
- The GUI item not off for the sharing key: gateway-key-readonly red 10 of
10 in Chromium.
Run at the pushed head (on origin/main 0911a65e7), on mote: TestReadOnly*,
TestHeldKey*, TestClientPathCoversHandler, TestGatewayKey*, TestCaller*
in access, cli and gateway ok; TestCoreScriptBudget ok; on Linux
(wsl-run, both engines) gateway-key-readonly, gateway-card, i18n-keys,
gateway-caller-keys and gateway-key-quotas 68/68.
Full Go suite on mote (macOS) at the same change on origin/main
dca3e2d71 (94630237d), -timeout 45m: 78 packages ok; internal/gateway
red only on the four TestAntigravityTurned* and
TestCodexSpentGrokFailingIsTold (red the same at origin/main, #4362);
internal/gui red only on ten AppKit window tests that hit their 30s
bar while mote's launchd throttled every app launch (#4125).
Run on mote (macOS) on origin/main dca3e2d71:
- go test ./internal/access ./internal/cli ./internal/gateway: access ok;
cli red only on TestLibraryMCPHub's TempDir cleanup (#4140); gateway
red only on the four TestAntigravityTurned* and
TestCodexSpentGrokFailingIsTold, red the same at origin/main (#4362).
TestReadOnly*, TestHeldKey*, TestClientPathCoversHandler,
TestGatewayKeyCLIReadOnly pass.
- TestCoreScriptBudget ok (no budget raised). gofmt clean; go vet
darwin (access, cli, gateway), GOOS=windows ./... and GOOS=linux
-tags nogui ./... clean.
- GUI, earlier at 807048470 on mote: gateway-key-readonly,
gateway-key-quotas, i18n-keys, gateway-card, api-key-theme,
gateway-connect-keys and gateway-caller-keys 34/34 in both engines.
At this tree mote's WebKit hung at launch for every test (#4125), so
the 43 gateway-*/key-*/api-key-*/caller-*/menu-*/i18n-* files ran on
Linux (wsl-run, both engines): 501 of 514. The reds in api-key-theme,
gateway-key-limit, gateway-key-models, key-replace and menu-input-scroll
are red the same at origin/main e8d42c02d (#4120, #3523, #4081, #4126,
#3402); gateway-keys-empty's WebKit wait was red 1 in ~13 runs here and
0 in 4 at main, filed as #4383 (this change doesn't touch its path).
- Full Go suite on Linux (wsl-run, at 807048470 with this change): reds
only where Linux can't build the GUI (no gtk4/webkitgtk) and in
internal/agent's install tests (#4033) and the gateway reds above,
each red the same at origin/main dca3e2d71; plus
TestClientPathCoversHandler, which parsed Handler's source and is now
read from routes() (fixed here).
Not tried: a real ESP32 or Docker magpie; a remote client against a
running gateway (only httptest through lanGuard/Handler); the Windows
test runs (vet only); the whole GUI suite (mote's WebKit hung, #4125).
yyddbds on Discord: in Xiaomi MiMo they added a custom provider pointing
at magpie and picked a few models by hand. MiMo's switch on the Agents
page was off, yet after an update the provider held every one of
magpie's models. SyncCatalog runs at each start and update and on every
catalog change, and MiMo Code's Sync (openCodeLike) brought any
provider.magpie block up to the catalog whether magpie wrote it or not.
magpie's default went over a list the user set.
An Agent whose Sync does nothing but keep a block of magpie's name up
to the catalog is now ListOnly, and SyncCatalog runs it only while the
agent is Wired, which is what the Agents page's switch shows. The same
sync was in every sibling, so ListOnly is on all of them: openCodeLike
(OpenCode, MiMo Code and their WSL forms), piLikeKeyed (Pi and forks),
Goose, Crush, Air, AtomCode, Command Code, Droid, Fx, jcode, Kimi,
MiniMax, Mothx, omp, OpenChamber, OpenClaw, OpenPencil, Penguin, Qwen
Code and T3 Code. Left out on purpose: Codex, Claude, Grok and Hermes,
whose Syncs also repair while not connected (Hermes keeps its bots'
magpie provider current) and have their own gates.
Trade-off: a list magpie wrote while connected doesn't follow the
catalog while the agent runs a model of its own (switch off); it does
again once a model of magpie's is picked. Users whose list was already
written over: magpie keeps no copy of the old list, so it stays full;
from this release on it is left alone, and they trim it once by hand
(or connect the agent in magpie and use its model list's Pick).
Tests: TestCatalogSyncLeavesAHandWrittenMagpieBlock (MiMo, Pi and Crush
with a hand-written magpie block stay byte for byte; connected, MiMo's
list follows the catalog; disconnected and written by hand again, left
alone; a magpie model picked in MiMo, followed again).
TestListOnlyAgentsReadConnected: every ListOnly agent magpie connects
reads as Wired (n >= 15), so none of them loses catalog updates.
Fixtures of TestSyncCatalogRewritesAgentLists,
TestModelNameAndLevelsReachAgentFiles, TestSuffixModesReachAgentFiles
and TestPiKeepsTheirKeysInMagpiesProvider, and internal/cli's
TestSaveAnswersBeforeTheAgentsSync (its Pi settings were {}), now have
Pi connected (settings.json defaultProvider magpie), as a block magpie
wrote implies.
docs/subsystems/agent-wiring.md says the rule.
Run (mote, sandbox HOME via the tests' syncHome/codexHome):
- old code + the new test: red (MiMo, Pi, Crush written over; after
Disconnect written over).
- broken by hand: ListOnly dropped from openCodeLike: red on MiMo
(lines 52, 82); the Wired gate in SyncCatalog replaced with true: red
on all three.
- go test -tags nogui -count=1 ./internal/agent: ok.
- gofmt -l clean; go vet ./... for darwin, GOOS=linux and GOOS=windows:
ok.
- full suite, go test -tags nogui -count=1 -timeout 45m ./... at base
3bebc3839 (logs kept in the worktree): every package ok but
internal/cli (TestSaveAnswersBeforeTheAgentsSync, mine, fixture fixed
above, then ok alone) and internal/gateway: TestAntigravityTurned*,
TestAntigravityTurnsCodexsGPT5ThreadAwayOnce and
TestCodexSpentGrokFailingIsTold, red the same on a fresh origin/main
b26fa0903 copy, filed as #4362.
- rebased on e8d42c02d: vet (darwin, linux, windows) of internal/agent and
internal/cli, and go test of internal/agent, internal/cli,
internal/library and internal/gui: all ok. Pushed on 764a032f6,
whose three commits since touch gateway, usage, provider and chat only.
Not tried: the real Xiaomi MiMo desktop app (the fixture is the OpenCode
shape MiMo Code writes; whether the reporter's provider id is literally
"magpie" is unconfirmed: a provider of another id was never touched).
Lists already written over are not restored.
ferock (Discord, 10-30): Command Code requests sometimes fail with 400
"messages.3.content.20: Invalid signature in thinking block. The block
is bound to a different conversation ...". The client's history carries
thinking blocks signed for another conversation or account (a switch,
a fork, another provider), and the plugin passes the Messages body
through as written, so this is fixed in magpie, not the plugin.
forward(), which every Anthropic-protocol route goes through (relayed,
translated, plugin fetch, count_tokens), now reads that refusal
(thinking_bound.go). It remembers the block it names and every thinking
block after it, for that provider and account only, then asks again
without them. An assistant message left empty is dropped. The next turn
leaves them out at once. Other 400s, and other providers, keep every
block byte for byte. The drop_block beta isn't sent: Claude Code sends
it only behind a flag, and magpie doesn't mimic Claude Code.
Run (mote, at this head rebased on cae785a37):
- go test -run 'TestBoundRefusalRead|TestBoundThinkingLeftOut|
TestOtherRefusalKeepsThinking|TestWithoutThinkingBlocks|
TestPluginBoundThinkingLeftOut|TestPluginThinkingOff|TokenField|Beta'
./internal/gateway: ok
- go test -count=1 -timeout 45m ./internal/gateway (before the rebase):
every test ok except five Antigravity/Grok tests. They are red the
same way on origin/main e8d42c02d, and #4362 covers them.
- gofmt -l clean; go vet ./internal/gateway for darwin, linux, windows: ok
Broken by hand:
- the retry turned off: TestBoundThinkingLeftOut and
TestPluginBoundThinkingLeftOut go red with ferock's exact 400
- only the named block dropped, not the ones after it: red, because the
fake refuses message 5's block next
Not tried: a real Command Code account (the fake replays ferock's
literal error). The full ./... suite hasn't run yet. Claude
subscription accounts go through the bridge and are not covered here.
GoxxKintBlade on X (tweet 2116038360645206158, v0.1.2145) and Jothulmo
(tweet 2116045916549652992): an OpenAI API key provider's test was red
for every model, "gpt-6.1-sol: 400 Unsupported parameter: 'max_tokens'
is not supported with this model. Use 'max_completion_tokens' instead."
Cause: the model test's Chat body (provider.tinyBody) sent max_tokens
to every host but Bedrock and Azure. The gateway had the same gap on a
pass-through: a chat client's max_tokens (and magpie's own image
describer and classifier, which ask the gateway in Chat with max_tokens)
went to api.openai.com as sent. Only the Anthropic/Responses-to-Chat
translator (buildChat) already used max_completion_tokens there.
Fix, scoped by vendor:
- provider.OpenAIHost: openai.com and *.openai.com only (not Azure,
not "notopenai.com", not a relay).
- The test's Chat body asks OpenAI's own API with max_completion_tokens.
- The gateway's forwardOnce, the one place every upstream request
passes, renames max_tokens to max_completion_tokens for OpenAI's own
API (chatTokenField). DeepSeek (deepseekTokenField), Zhipu and relays
get the body as the client sent it.
- A Chat 400 whose words name the other field as the one to use
(provider.TokenFieldWanted: "use 'max_completion_tokens'" or "use
max_tokens"; a limit on the value is not one) is asked once more with
that name, in the model test (probe) and in the gateway (forward,
retryTokenField), and the gateway remembers it per provider in unfit.
That covers a relay in front of OpenAI's reasoning models. The key is
renamed in place (provider.WithTokenField), so the rest of the body
keeps its bytes.
Tests (new): TestOpenAIProbeAsksMaxCompletionTokens,
TestProbeRetriesTokenFieldNamed, TestTokenFieldWanted, TestWithTokenField
(internal/provider); TestOpenAIChatGetsMaxCompletionTokens,
TestChatTokenFieldRetriedWhenNamed (internal/gateway). The last one also
checks that a vendor reading max_tokens gets the body as sent, in one
request; TestDeepSeekChatGetsMaxTokens still passes unchanged.
Broken by hand: OpenAIHost taken out of tinyBody, probe's retry turned
off, chatTokenField and retryTokenField returning early. All four new
behavior tests went red with real FAILs (the probe test: "Status:400 ...
Use 'max_completion_tokens' instead."; the gateway retry test: HTTP 400
from the relay), and green again with the change put back.
Run on mote (mote-run): gofmt -l internal/ (nothing),
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... (VET-OK),
go test -timeout 45m -count=1 ./internal/provider ./internal/gateway
at base dca3e2d71: internal/provider ok (340s); internal/gateway was
still running at push time. Rebased onto e8d42c02d (6 commits, which
change both packages), then at this head on mote: gofmt -l (nothing),
linux and windows go vet ./internal/... (VET-OK), and go test -count=1
-run "TokenField|OpenAIProbe|OpenAIChat|DeepSeekChatGetsMaxTokens|
Bedrock|Azure|Mantle|TestModels|TestTest" on both packages: ok.
Not tried: a real OpenAI key (no real network in tests; the fixture is
OpenAI's own 400 text from the report). The full ./... suite runs on
mote after the push.
treeMan on Discord: with masking on, weaker models refuse to search
with a {{NAME_xxxxxxxx}} placeholder, ask to verify it, or rewrite it as
"an example name", which breaks long tasks. A request in which masking
swapped a value (maskHits.n > 0) now carries one short note, on each try:
Values written like {{NAME_ab12cd34}} are placeholders for real values.
Use them exactly as written, in replies and in tool calls alike: they
are filled in with the real values before anything runs. Don't ask to
verify them, and don't replace them with examples.
It names neither magpie nor a vendor or client (TestPlaceholderNoteIsNeutral
fails on magpie, Codex, Claude, a vendor's name, "provider", "gateway"...).
Its example uses a '1', outside the placeholder alphabet, so it is never
taken for a real placeholder or restored.
Where: where placeholders first appear, so it is new text the first time
and the same text on every later turn (the cached prefix holds). In the
instructions when they or the tools hold one (Anthropic system's last
block, Chat's first system/developer message, Gemini systemInstruction's
parts); otherwise on the earliest message that holds one, as a block or
part after its content (a string content becomes [text, note] blocks on
Anthropic, a paragraph on Chat), and on Responses as a developer message
after that item and the tool outputs following it. Responses
`instructions` (Codex's base_instructions) is never touched. A note
appended after text starts with a blank line, so a translator that joins
blocks (Anthropic to Chat) keeps it apart from the user's words.
Not added:
- a Claude subscription: the bridge puts the caller's instructions into
the run's first message, which Anthropic classifies; text added there is
risk for no gain;
- a ChatGPT/Codex sign-in (Account.Agent codex); Codex's own turns on
codexUpstreamOn don't pass this loop either;
- a Responses turn with previous_response_id: the note would pile up in
the stored conversation.
count_tokens counts without it.
A first version put the note in the system prompt. The full suite showed
TestMaskedConversationKeepsItsCachedPrefix red (a secret first found in a
tool output changed the system at turn 1 and rewrote the cache), hence
the first-appearance placement.
Run (mote, through mote-run):
- go test ./internal/gateway ./internal/redact -run
'TestPlaceholderNote|TestMaskedRequestTold|TestMaskedConversation|
TestUnredacted|TestRedacted|TestMask|TestMiddlewareThroughGateway': ok.
- Full suite at 46bdbad8f (-timeout 45m, log kept whole): red in
internal/gateway TestMiddlewareThroughGateway (mine: its fake echoes the
last message, which now holds the note; the fake strips it now), and
five tests red alone on origin/main cc81ad4ea too, filed as #4362
(TestAntigravityTurnsCodexsGPT5ThreadAwayOnce, TestAntigravityTurnedAway*,
TestCodexSpentGrokFailingIsTold); internal/gui TestMainWindowCorners
(#3949). Every other package ok.
- At 79c6a487c (this change on cc81ad4ea): go test -timeout 45m
./internal/gateway ./internal/redact ./internal/masking/...: redact and
masking ok; gateway red only in the five #4362 tests.
- go vet ./internal/gateway ./internal/redact on macOS, CGO_ENABLED=0
GOOS=windows go vet ./... on mote, go vet of both in WSL (Linux): ok.
(CGO_ENABLED=0 GOOS=linux go vet ./... stops in wails' menu_linux.go on
main too, so Linux was vetted natively.)
Broken by hand:
- note always in Anthropic's system (`if true ||`):
TestMaskedConversationKeepsItsCachedPrefix, TestPlaceholderNotePlaces,
TestMaskedRequestTold and the TestUnredacted* echo tests red.
- wiring off in serve: TestMaskedRequestTold red.
- the claude/previous_response_id skips removed:
TestPlaceholderNoteNotOnClientPaths red.
Not tried: no real vendor or weak model was run with the note, so whether
it stops the refusals treeMan saw is not measured; no real Claude
subscription or Codex sign-in request (both skipped by design).
The ChatGPT Codex backend says service_tier "auto" in response.created
and "default" in response.completed whether priority ran or not. jjt's
measurements on gpt-6.1-sol with a Plus account: Fast decodes at about
200 tok/s, without it about 110, and the reply says "default" both times
(real-priority.sse, speed-plus.txt). magpie copied that into tier_served,
so the usage log, its CSV and /v1/magpie/route said served = default for
requests that ran Fast.
servedTierAt (tier_record.go) leaves those two words empty when the
reply came from CodexBase's host. It is applied once per routed try, in
attempt (gateway.go, a defer, so every return path and the route's tries
see it), and on the relay of Codex's own sign-in (codexUpstreamOn).
OpenAI's API, where service_tier means what it says, keeps it as given:
a provider at api.openai.com and Codex with an sk- key relayed to it.
"priority" or "ultrafast" said by the ChatGPT backend is still kept.
Display: tier_served is shown by the CSV (an empty cell), the JSON log
and /v1/magpie/route (omitempty). No GUI page or TUI shows a tier
(grep of internal/gui/assets and internal/tui for tier_served,
tier_asked, tierServed: none), so no strings changed. docs/reference.md
and docs/subsystems/gateway-routing.md say it.
Tests:
- TestChatGPTBackendTierUnknown (new): the backend says auto, then
default (jjt's events, cut to the fields read); a routed try asked
priority and one asked nothing, and Codex's own sign-in relayed, all
record "" in usage and the route.
- TestOpenAIAPITierKept (new): api.openai.com's "priority" and
"default" kept, routed and through the sk- relay.
- TestTierRecordedPerTry: its "none asked" case on the ChatGPT backend
now expects "" where it expected "default".
Run on mote (mote-run; the wider run at base cc81ad4ea, the tier run
again after the rebase, at this commit on c37b8b659: ok, 22 pass):
- go test ./internal/gateway -run 'Tier|ChatGPTBackend|OpenAIAPI'
-count=1 -v: ok, 22 tests pass.
- go test ./internal/usage: ok. go test ./internal/gateway -run
'Codex|Usage|Route|Tier': two reds, TestAntigravityTurnsCodexs-
GPT5ThreadAwayOnce and TestCodexSpentGrokFailingIsTold, red the same
on a fresh origin/main c37b8b659 and filed as #4362; the rest ok.
- go vet ./internal/gateway, GOOS=linux and GOOS=windows: clean.
- gofmt -l internal/gateway: clean.
Broken by hand: servedTierAt returning t unchanged -> TestChatGPT-
BackendTierUnknown and TestTierRecordedPerTry red ("served default");
the host check removed -> TestOpenAIAPITierKept red (served "", want
"default"). Both green again with the fix.
Not tried: a real ChatGPT account through the built gateway; the full
Go suite (the coordinator asked for the targeted run under mote's load
of ~200); Windows and Linux test runs (vet only). No GUI file reads the
tier, so no GUI test was run.
A routing group on another computer's magpie had one member, Open
Design, out of its Coding Plan quota and wallet. This magpie rested
that remote model (remoteModelRest) and, through quotaHeld, gave the
402 again on every request until the time it named, never asking the
remote. The user moved the group to another vendor there, and Codex
here still got "Remote magpie: Open Design: [code=insufficient_balance]
... (out of its allowance: not asked again before 06:19)".
The remote magpie routes its own groups and holds its own rests, and
what it serves under a name can change there at any moment. A rest
from remoteModelRest is now marked (Rest.there), and quotaHeld passes
it by: the remote is asked, and answers from its own hold at once, or
from what it serves now. The rest still puts the model behind the
others in a local group. verifyHeld is unchanged: its hold is a
minute, and TestRemoteMagpieVerifyHeldOnTheModel asks for it.
Run (on mote, at cc81ad4ea plus this change):
- TestRemoteMagpieQuotaIsAskedNotReplayed and
TestHandAddedMagpieQuotaIsAskedNotReplayed: red on cc81ad4ea (402
replayed, remote asked 0 times), green with the change.
- go test ./internal/gateway -run 'QuotaIsAskedNotReplayed|RemoteMagpie
|AddedByHand|QuotaHeld|1772': ok. A wider run (Held|Quota|Verify|
Spent|Credit) is ok except TestAntigravityTurnedAwayLastIsNoQuota and
TestCodexSpentGrokFailingIsTold, red alone on untouched cc81ad4ea
too (#4362).
- go vet ./internal/gateway, GOOS=linux (nogui) and GOOS=windows: ok.
- Two sandbox magpies (own HOMEs, free ports) and a fake vendor: R with
group never-stuck = opendesign/od-model (402 insufficient_balance),
L with R as a remote-magpie provider. Old code: after
`group set never-stuck models=newvendor/new-model` on R, L kept
answering the reporter's exact 402 and the vendor never saw
new-model. With the change: 200 from new-model at once. With both
members in the group (order), R falls through: od-model asked once,
then new-model answers every request.
Broken by hand: the change taken out, both new tests go red as above.
Not tried: a real Open Design account, the reporter's phone setup, and
the full Go suite (to run on mote when it is free).
After magpie switched Codex's account, the Windows Codex app answered
every send with "Codex app-server process is not available" until it
was quit and opened again. The report said the app doesn't reconnect
after a clean exit. That is half right. The app (MSIX OpenAI.Codex
26.1021, an Electron ChatGPT.exe that spawns codex.exe app-server over
stdio) does start another, but only once the old one's stdout reaches
EOF and its exit has fired. On Windows a child of the app-server (an MCP
server, a tool command) inherits that pipe handle. A child left running
keeps the pipe open, so the app never sees the close, starts none, and
its send() throws. Reproduced on the Windows box with the real codex.exe
0.164 app-server plus an MCP server: stdout ended only when the MCP
server did, and at once when the tree was ended.
magpie took "the old pid is gone" as done in each place it restarts the
app-server. None of them checked that a new one came:
- codexAppStep (the switch watcher) now records the pids it ended and
waits codexAppBackWait (30s) for another app-server. If none comes and
the app still runs (CodexAppOpen), it quits and opens the app as the
Agents row's Restart does (CodexAppReopen: restartWin by the
OpenAI.Codex_2p2nqsd0c76g0!App AUMID, Windows only). Where it can't,
the row says to (CodexAppStuck).
- RestartCodexApp (macOS Restart), RestartCodexAppWhenIdle (uninstall)
and the switch notice's Restart (RestartSwitchedCodexApp, 46aa7e6b8)
wait for a new app-server too, and reopen or say so the same way.
RestartSwitchedCodexApp's own 20s codexAppBackWait went into the
shared 30s one.
- recheckLeft no longer clears the "still on the old account" record
while the app is open with no app-server.
- A turn stuck open when quota ran out mid-task (蛋仔's follow-up) held
the restart for up to codexTurnWindow (30m), since an open turn in
Codex's sessions meant "a task runs". A switch off a used-up account
(SwitchWhenSpent) now marks it spent (codexAppSpentSwitch). After such
a switch, a turn that has written no session file and sent nothing
through magpie for codexTurnStuckAfter (2m) counts as stuck, and the
app-server is restarted past it. Its next request would be refused on
that account anyway. A tool still running in that turn is ended with
it. A switch for any other reason waits for the turn as before.
macOS is never reopened unasked (a reopen opens a new window,
yoshi037070, 10-27). WSL needs nothing: WSL Codex has no desktop app, and
the Windows app's app-server runs on the Windows side.
Run (at this head unless said):
- mote: go test -timeout 45m ./... at 4cf444bc4, this change on
origin/main 807048470. It was rebased on dca3e2d71 after (5 commits,
none in codex_app*/codex_switch/codex_daemon), and the -run below was
run again at the pushed head. Result: every package ok except gateway and gui, whose reds aren't this
change's (it touches neither package). gateway: TestAntigravityTurn*
x4 and TestCodexSpentGrokFailingIsTold, red the same on origin/main
46aa7e6b8 (#4362), and TestUnroutedUnknownHoldAnsweredSooner, which
passes alone 3 of 3 at this head (filed #4377). gui:
TestMainWindowCorners (#3949).
- mote: provider and agent -run 'CodexApp|CodexDaemon|RestartCodex|
RestartSwitched|CodexSwitched|CodexSessionsQuiet|Switch' ok; gofmt -l clean; GOOS=windows, linux,
darwin go vet ./internal/agent ./internal/provider ok.
- win-run, the same -run: everything of mine passes. Two tests are red,
TestCodexDaemonEnvIsTheTerminals and TestWorkBuddyRestartOnMac, the
same on origin/main (#4115).
- Broken by hand, each red, then restored: the step's no-app-server
branch, RestartCodexApp's not-back check, uninstall's reopen,
recheckLeft's open check (4 provider tests); RestartSwitchedCodexApp
without the reopen (TestRestartSwitchedCodexApp "reopened 0"); the
codexWinApp matcher widened to \WindowsApps\OpenAI.
(TestCodexAppReopenedOnWindows). The stuck-turn bypass taken out
("a turn stuck on the used-up account: ended []"), the spent mark not
set (TestCodexSwitchedWhenUsedUp), and the bypass without its spent
and quiet checks ("a turn open after a switch not for spend: ended
[60]").
- Real Codex app on Windows (xiaomi-gpu, OpenAI.Codex 26.1021.3705.0,
from a throwaway test, not committed, run as a scheduled task in the
console session):
- RestartCodexAppWhenIdle ended the real app-server, and the app
started another within ~0.6s. codexAppBack saw it (left false).
- codexAppReopen quit ChatGPT.exe 43832 and opened the app by its
AUMID in 3.7s (main now 70060). A new app-server came 9.6s after.
Not tried:
- The stuck state itself in the real app: an MCP child really holding
the app-server's stdout inside the Codex app. It was reproduced with
codex.exe outside the app, and the reopen was run on a working app.
- A signed-in real account switch on Windows.
- The quota-mid-task hang with a real used-up account. Why the app sat
on the turn wasn't reproduced. A plain usage_limit_reached refusal
closes the turn (task_complete, as dd9828f2b found), so this covers a
turn that stays open, whatever holds it.
- Whether a reopen loses an unsent draft.
- The macOS path with a real stuck app (it says to quit and reopen;
nothing is reopened there).