/api/state keeps the state it built in agents-state.json, written only
when the bytes change. They changed on every poll: a stale copy's start
is now less how long it has run, two clock reads apart, so it moved by
microseconds each time (on a real config, only
/agents[1]/staleCopies[i]/since differed between two polls). The file
was written through edit.WriteAtomic, whose write calls
filememo.Forget(). That bumps provider.StampNow, so every 15s poll threw
away each agent's model list and picker (magpieModels, viaMagpie) and
every provider's kept catalog, and the next look built them anew.
- StaleCopies' since is truncated to the second (the check against
magpie's change still uses the exact time).
- keepState writes through steady.WriteFile (temp, flush, rename), which
leaves filememo alone: nothing a request reads is built from this file.
Not changed: on Linux and WSL the process list gives a run time in whole
seconds (ps etime), so a copy's since can still move by a second between
polls there; macOS reads the exact start from sysctl.
Run on mote at 7428f3229 + this change:
- go test ./internal/agent ./internal/gui (-count=1 -timeout 45m):
agent ok (280.8s). gui FAIL in two tests already red on main and
filed: TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK on macOS 27 (#3949).
- node --test agent-stale-copies.test.cjs: 0 failed.
- go vet (darwin), GOOS=windows go vet of both packages, GOOS=linux go
vet ./internal/agent, gofmt -l: clean. A Linux vet of internal/gui
needs gtk4 and webkitgtk-6.0, which neither mote's cross build nor the
WSL box has.
Broken by hand: without the truncation TestStaleCopySinceSameEachLook
is red (since 08:20:11.5 then 08:20:11.500001); with filememo.Forget()
after the write TestKeptStateLeavesFilememo is red.
A magpie beside the installed one (a dev build on its own port) asks,
for each field's drift, whether the agent's config names the installed
magpie's gateway (theInstalled). It took edit.Read's copy of the file
and two strings of it: with a Codex config.toml of 1.5 MB (one table
per project trusted) that was 311 MB in 60 drift polls of a sandbox
built from 4a7d1c63a plus the next commit, more than everything else
the poll allocated (219 MB).
It now looks in the bytes filememo keeps, with bytes.Contains, as
nothing is written from them. A magpie on the installed port never
gets here (elsewhere() is false), so users of a release are unchanged.
TestInstalledWiringReadsNoCopy: a 1 MB config wired to the installed
magpie is seen as its, and 10 looks allocate under 1 MB.
TestDriftInstalledMagpie still tells the installed wiring from one to
neither. Broken by hand: the copy and strings put back, red.
Run at this tree on mote: gofmt clean; go vet ./internal/agent on darwin, linux and windows; go test -count=1 -timeout 45m ./internal/agent ok (194.5s)
codexAppRoute runs every 3s for as long as magpie does (the Codex app's
app-server watcher). It read the whole of Codex's config.toml with
os.ReadFile only to learn the file could be read; the keys it uses come
from filememo, which parses the file once per change. Codex keeps every
project's trust level in that file, and the owner's is 1.5 MB, so this
was 1.55 GB of the 33 GB a live magpie allocated in 53 minutes (heap
profile: KeepCodexAppOnItsProvider → codexAppStep → os.ReadFile). It is
now opened and closed: a file that can't be opened is still an unknown
route, a missing one still a known one.
Run on mote:
- TestCodexAppRouteReadsNoWholeConfig (new): a 1.6 MB config, 10 looks
allocate under 1 MB; a config with mode 0 gives no route.
- Broken by hand: ReadFile put back, red (14.4 MB for 10 looks); the
unreadable check dropped, red.
- go test -run CodexAppRoute ./internal/agent: ok.
- go test -count=1 -timeout 45m ./internal/agent ok (185.3s), at this tree rebased on 4a7d1c63a; gofmt -l clean; go vet ./internal/agent for darwin, linux and windows ok
viaMagpie is the half of every agent's model picker that magpie serves.
It built CatalogFor, the own and first accounts, and the fast and ultra
picks on every call. The window's /api/drift poll asks each agent's
fields for their options every 15s. In a live magpie's 53-minute heap
profile (v0.1.2404), Claude Code's options alone (claudeViaMagpie)
allocated 4.7 GB of 32.8 GB.
viaMagpie now keeps its list per agent and prefix, the same way
magpieModels does since v0.1.2422. It builds the list again when
provider.StampNow moves, and after a minute for what the stamp can't
see (an account another app signed in to). Each caller gets its own
copy. The two now share stampedLists[T].
Run (mote, at this tree):
- go test ./internal/agent: ok, 191.501s.
- TestViaMagpieKeptWhileCatalogStays, TestMagpieModelsKept... and
TestIsMagpieKept...: ok.
- go vet ./internal/agent: darwin, linux and windows ok.
Broken by hand, TestViaMagpieKeptWhileCatalogStays goes red each time:
- never kept: FAIL;
- the stamp not compared: FAIL;
- the kept list handed out unshared: FAIL.
Real A/B: magpie web --gateway under the same sandbox HOME as
v0.1.2422's record, 200 GET /api/drift each. Before = v0.1.2422's tree.
The drift JSON is byte-identical.
- allocated under Drift: 2065 MB before, 1717 MB after.
- under viaMagpie: 367 MB before, under pprof's cut after.
- under CatalogFor: 538 MB before, 229 MB after.
- CPU: 1.95s before, 1.80s after.
Most of what is left under Drift in this sandbox is theInstalled's read
of each agent's config. It runs only for a magpie beside the installed
one (this sandbox's gateway port), not for the installed app.
The window asks /api/drift every 15s. Each agent's Drift checks its
fields through magpieValue -> f.Options -> magpieModels, and
magpieModels built the whole catalog every time: CatalogFor, the
prices, Labels and Vision's ranking (provider.Described -> seersRanked).
A live magpie's heap profile (v0.1.2404, 53 minutes) allocated 32.8 GB.
Drift accounts for 14.5 GB of it, and magpieModels for 9.7 GB. The
footprint peak of 882 MB rides on that garbage.
magpieModels now keeps the list it built for each agent. It builds the
list again when provider.StampNow moves: a provider, account, plugin or
setting saved, catalog.Touched, or providers.json, settings.json or the
catalog cache rewritten by another process. It also builds it again
after a minute, for what the stamp can't see. Each caller gets its own
copy (slices.Clone). A model's own lists are clipped, so an append in a
caller's copy can't write into the kept list.
Run (mote, at this tree):
- go test ./internal/agent: ok, 188.985s.
- TestMagpieModelsKeptWhileCatalogStays: ok.
- go vet: darwin and windows ok, for internal/agent and internal/gui.
Linux vet of internal/gui fails in wails' cgo menu_linux.go
("undefined: pointer"); that is the cross-compile from darwin and not
this change.
- go test ./internal/gui: three reds, each filed already and none in
code this touches: TestSettingsSaveKeepsWhatItDoesNotSend (#4514),
TestMainWindowCorners/macOS_26_SDK (#3949), TestColdTurnsTaken
(#4510).
Broken by hand, the new test goes red each time:
- never kept: 422 vs 407 allocations;
- the stamp not compared: "a provider saved since is not listed";
- the kept list handed out unshared: FAIL.
Removing the Clip lines leaves the test green: its catalog's lists have
no spare capacity. The clip is a guard that wasn't shown to matter.
Real A/B: magpie web --gateway under a sandbox HOME with the owner's
providers, 200 GET /api/drift each. "old" is this tree with
magpieModelsFor = 0. The drift JSON is byte-identical.
- CPU: old 3.45s, new 1.99s.
- allocated under Drift: old 3098 MB, new 2063 MB.
- allocated under magpieModels: old 1049 MB, new 20 MB.
Not tried: the sandbox has no OAuth sign-ins, so subscription models
weren't in its catalog; the live catalog is larger.
viaMagpie (claudeViaMagpie, 4.7 GB live) still builds per call; that is
the next change.
liby233 on Discord: dsh in an editor over ACP (deepseek-acp, CodeG, the
desktop app) listed only DeepSeek's own models. Checked against the real
packages from npm (deepseek-acp 0.9.0, dsh 0.2.1-rc.5): deepseek-acp
mounts FileSettings on $DSH_HOME/settings.yaml alone, never profiles/,
and loads the pi-ai plugin only when that file mentions "llm-pi-ai". Its
credentials-local store throws when .credentials.yaml is readable beyond
its owner ("run chmod 600"), so a 0644 store stops it from starting.
- settings.yaml gets llm-pi-ai.providers.magpie, built by the same code
as the profiles' route (dshPutProviders), at 0600 when magpie creates
it. It gets no agent-default-model of magpie's. The user's routes,
other sections, comments, mode and the api they chose for magpie's
route are kept. Disconnect takes only magpie's route out, and the
section too when nothing else is left in it.
- dsh 0.2 renames settings.yaml to settings.yaml.imported (over the one
before) at each full start and imports it into the profile. The
serving round, Sync, Set and Unwire write it again. The user's own
import from before magpie's first write is copied once to
settings.yaml.imported.kept, so magpie's import never overwrites it.
- .credentials.yaml is made owner-only (go-rwx) on every write and every
Sync, whoever made it 0644. In a WSL distro, a file written through
\\wsl.localhost comes out 0644, so the chmod runs inside the distro:
wsl.exe -d <distro> -e chmod go-rwx <path>. A failure is logged and
doesn't fail the write.
Run:
- internal/agent on mote (ok) and its Dsh/WSL tests on Windows
(xiaomi-gpu, ok); gofmt; go vet on darwin, GOOS=linux -tags nogui
and GOOS=windows.
- The new tests (dsh_acp_test.go) were broken by hand, each turning red:
dshSettingsAgain disabled, ownerOnly disabled, dshKeepImported
disabled, and the round's call removed.
- Real runs on mote in a sandbox HOME (~/runs/realdsh-home), never a
live ~/.dsh. After magpie's Pick, real deepseek-acp's session/new
listed magpie::deepseek/pro and magpie::deepseek/flash; without
settings.yaml it listed only DeepSeek's. With a 0644 store its boot
failed with the credentials-local error, and it started once magpie
had made the store 0600. `dsh --profile web --dump-config` shows
agent-default-model magpie and the route. `dsh headless` ate
settings.yaml into the headless profile, and magpie's round
(dshWiredOnce) wrote it again, after which ACP listed magpie's models
again.
- On magpie-desktop: `wsl.exe -d magpie-desktop -e chmod go-rwx` takes
a file written through UNC from 644 to 600.
Not tried:
- magpie's own write into a real WSL distro end to end; only the
command form above, and fakeWSL in tests.
- A WSL distro has no serving round, so after dsh eats settings.yaml
there, it comes back only on magpie's next Sync or model pick.
- A dsh from before profiles (config.yaml only) is left as before.
Also: fakeWSL answers the chmod without recording it, since it is neither
a start nor a probe (TestWSLMoreAgentsStopped counts starts).
On Windows, adding a skill or switching RTK on for an agent in WSL failed
with `mkdir \\wsl.localhost\<distro>\root\.codex: Cannot create a file
when that file already exists` (linusxiong). In the distro ~/.codex is a
link to /mnt/c/Users/<user>/.codex. Through \\wsl.localhost Windows can't
follow a link the distro has: a mkdir of it says it exists, and nothing
below it can be made, written, read or listed. ggbdpq found and explained
the link (thanks); their patch, which takes that EEXIST as "there", wasn't
used: the writes below the link fail next (its test passed because a
symlink here is followed).
The fix, for every agent folder and every writer through \\wsl.localhost:
- The WSL probe asks `readlink -f` in the distro where each agent folder,
its skills folder and the folders beside them lead (wslLinkPaths ->
distro.Links; a $HOME that is itself through a link is left alone), and
which drive each Windows mount is (win:/mnt/c C: -> distro.Drives).
- distro.open opens a path at or below a link where it leads: on a Windows
drive, the drive's own path (C:\Users\<user>\.codex); elsewhere in the
distro, through \\wsl.localhost again. native spells it back through
the link, so the agent is told its own path.
- A link readlink couldn't resolve is never guessed at: distro.open
errors, and the agent is unreached (Agent.Unreached: its notice says
why; every field Set and Sync returns it).
- Writers: the agents' own files (place.join/place.open, every
filepath.Join(at.home, ...) in internal/agent), the library's WSL
targets (wslOpen/wslOpened; one "wsl" problem per agent and nothing
written), RTK (rtkAt, rtkInstall checks agent.WSLOpen before its mkdir),
the Sessions page's WSL reads (sessions.WSLHome.Open) and the Copilot
CLI sign-in read (provider.CopilotWSLHomes -> CopilotWSLDirs).
- Not changed: magpie's image MCP server opens arbitrary paths an agent
in WSL gives it the same way; filed as #4578. Links deeper than the
probed paths (other than <agent dir>/skills) aren't resolved. A distro
probed by an older magpie has no Links until probed again (each run).
Run:
- Real Windows box (xiaomi-gpu, distro magpie-desktop, sandbox
/tmp/x4502/home with .codex -> /mnt/c/Users/yeton/runs/x4502-target/.codex,
.claude -> /tmp/x4502/data/claude, .pi -> a missing folder), a throwaway
Windows test running the real probe with that HOME: probe said
link:.codex /mnt/c/..., link:.claude /tmp/x4502/data/claude, link:.pi,
win:/mnt/c C:, win:/mnt/d D:. The old way, MkdirAll(\\wsl.localhost\
magpie-desktop\tmp\x4502\home\.codex\skills\pdf) = "Cannot create a file
when that file already exists" (the report's error). distro.open wrote
SKILL.md to C:\Users\yeton\runs\x4502-target\.codex\skills\pdf and to
\\wsl.localhost\magpie-desktop\tmp\x4502\data\claude\skills\pdf, both
read back with cat in the distro through the links; .pi said "~/.pi in
WSL magpie-desktop is a link magpie couldn't follow". Sandbox and target
removed after.
- New tests with a fake distro whose ~/.codex and ~/.claude are links to
/mnt/c/... that don't exist here, so, as through \\wsl.localhost,
nothing below them can be made: TestWSLFolderIsALinkToC,
TestWSLFolderLinkUnresolved, TestRTKWSLFolderIsALink,
TestRTKWSLFolderLinkUnresolved (library); TestWSLProbeLinks (runs the
probe script), TestWSLOpenThroughLinks, TestWSLAgentFolderIsALink
(config and a Claude session read on C:), TestWSLAgentFolderLinkUnresolved
(agent).
- Broken by hand: the library tests on the base (with a no-op
FakeWSLDrives) fail with "mkdir .../home/me/.codex: file exists", the
report's error; with ggbdpq's patch applied they still fail (the skill
mkdir, and RTK's hook not written).
- mote: go build ./...; go vet of agent, library, sessions, provider for
darwin, GOOS=windows (and linux for agent, library); gofmt -l clean;
go test -timeout 45m ./internal/agent ./internal/library
./internal/sessions ./internal/provider: all ok.
- Windows (win-run): the same four packages. The new tests pass (the
RTK ones skip: the fake distro runs sh). 32 tests are red, all already
red at the base c63c2136b run on the same box, and filed (#4115, #2808:
Hermes profiles, Codex keychain, Agy, desktop entries, ...); the Hermes
ones fail alike on base and branch with -count=3.
- Rebased on origin/main 3ecc02b78 (it changed internal/agent): at this
head on mote, go build ./..., go vet of the four packages for darwin,
windows and linux, gofmt -l, go test ./internal/agent ./internal/library:
ok.
Not tried: the full ./... suite; the GUI (no GUI change; the unreached
notice uses the existing Notice); a real Codex/Claude Code run against
the moved files in the distro.
dev_quj on X: "magpie 一直提示Claude Desktop不经过magpie,我重启了依然还是
这个提示" — the Agents row said "已不经过 magpie:配置已变更" while
Desktop ran on magpie.
The check required deploymentMode "3p" in both Claude/ and
Claude-3p/claude_desktop_config.json. Desktop decides otherwise (m4 in
4.4212's and 2.7032's index.pre.js): with a 3p configuration applied it
starts in 3p when the profile has disableDeploymentModeChooser, whatever
deploymentMode says, and otherwise unless Claude-3p's file says "1p". The
Claude folder's deploymentMode is never read. And Desktop 4.4212 deletes
Claude-3p's deploymentMode itself: a stored "1p" with no claude.ai sign-in
is dropped at start (W5r -> "[custom-3p] deploymentMode written { mode:
undefined }") and Desktop relaunches in 3p on magpie. So a file left
without the key, by Desktop or another tool, was called off magpie, and
nothing magpie could do (Reconnect writes "3p" back) kept Desktop from
dropping it again.
desktop3p now asks Desktop's question with the applied profile (magpie's
or the user's for magpie's gateway). The appliedId, address and key
checks are as they were. appReads (the "restart Desktop" notice) reads
the same effective mode instead of the two files' words, so Desktop's own
write at start isn't a change to restart for.
Real Claude Desktop 4.4212.0 (macOS zip, on mote, sandbox
--user-data-dir, never the live config): three starts with magpie's
profile applied and Claude/ {} or "3p"; Claude-3p "1p" + chooser
disabled, "1p" + chooser not set, and {} — each ran in 3p with
apiHost=http://127.0.0.1:3425 in Claude-3p's main.log, and each left
Claude-3p's file without deploymentMode. The "1p", chooser-not-set case
started in 1p, logged "deploymentMode written { mode: undefined }" and
came back in 3p. An earlier start with both files "3p" kept them.
Run at the pushed head on mote (mote busy with other sessions' GUI and
gateway suites, so the touched package only, not the full suite):
go test -count=1 -timeout 45m ./internal/agent: ok
go vet, GOOS=linux go vet, GOOS=windows go vet ./internal/agent: ok
gofmt -l internal/agent: clean
Broken by hand: desktop3p put back to the old rule (both files "3p"):
TestClaudeDesktopModeAsDesktopReadsIt red on the dropped key, the Claude
folder's key gone, "1p" with the chooser disabled, and none with the
chooser on; TestClaudeDesktopChangedSince red too. Green with the fix.
TestClaudeDesktopMSIX and TestClaudeDesktopChangedSince's 1p cases now
turn the chooser on first, as Desktop needs for 1p to count.
Not tried: Windows' Desktop (MSIX or classic) and a real gateway request
from Desktop; a signed-in claude.ai cookie (Desktop keeps "1p" then,
which magpie says only with the chooser on); dev_quj's own files, so
this is the class the report is in, not their proven trigger. No other
desktop agent reads a mode the same way; Codex/WorkBuddy checks unchanged.
Two gaps in the previous commit's replaceBuiltInOptions:
- writePicker leaves out the row of a model a tier is on at an effort
(#1616), since Claude Code shows it as that tier's row. With
replaceBuiltInOptions Claude Code drops the tier rows along with its
built-in lineup (2.1.316: only the Default row and the picker's own
stay), so such a model was in /model nowhere. While the switch hides
Claude Code's own models, every model keeps its row.
- SetOwnModelsHidden saved the setting without catalog.Touched, unlike
SetHiddenModels, so flipping the switch in the GUI left Claude Code's
settings.json as it was until some other change re-synced it.
Tests: TestClaudePickerLeavesOutATiersModelAtItsEffort gains the
replace case (Terra on Haiku at max is listed); TestOwnModelsSwitchTellsTheAgents
counts catalog.Changed per flip.
Reviewed and run by yetone at the batch head over cac655c14 (this commit,
the four others from ggbdpq's #4495/#4548/#4512/#3260 patches and the
#4548 follow-up), on mote:
- gofmt -l clean; go vet ./... for darwin, linux (-tags nogui), windows;
go build ./... for darwin and windows.
- go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
internal/gui, with two filed reds: TestSettingsSaveKeepsWhatItDoesNotSend
(#4514), red alone at origin/main cac655c14 too, and TestColdTurnsTaken
(#4510), red only in the full run. Rebased afterwards onto e94fb18b8,
a usage-page change that touches none of these files.
- Windows (xiaomi-gpu): go test -run 'TestVSCode|TestClaudePicker'
./internal/agent ok. TestCopilotFolderFromAnIDEPluginIsNotTheCLI is red
there at cac655c14 too (#1827).
- Broken by hand: each half reverted alone -> TestClaudePickerLeavesOutATiersModelAtItsEffort and TestOwnModelsSwitchTellsTheAgents red.
YOUIMARK's Windows has Scoop's VS Code 1.143, a portable build: magpie
showed the editor, but its Dir stayed %APPDATA%\Code\User, which doesn't
exist — code.cmd on PATH was detection enough — so the provider, models
and settings.json magpie wrote went where the build never reads.
Before: vscodeUserDir always took the OS's place for the User folder,
%APPDATA% on Windows; only detection ever looked at the editor itself,
by its launcher alone, so any portable build was found and then read
and written in a folder it doesn't use.
Now: a build whose launcher has a data folder beside it is portable, as
VS Code itself takes a build for portable by that folder alone — a zip's
own data folder, or Scoop's, whose apps\vscode\current\data is the
persisted one, current a junction into apps\vscode. Its User folder is
data\user-data\User there: found, wired, connected and disconnected
there. The launcher is found as detection finds it, and a Scoop shim
stands for the launcher the .shim beside it names, which proc.Unwrap
doesn't read. Zoo Code, which keeps its settings in VS Code's User
folder, is laid out by the same function and follows it. An installed
build's launcher has no data folder beside it, and keeps the OS's place;
so does a portable build before its first run, whose launcher alone is
still detection enough, its writes then making the folder where it
reads. VSCodium portable is left as it was: its data folder is named by
its product.json, which no report asks after.
This is the other half of the branch the Copilot-launcher fix came from
(taken along with 6f435677c, since reworked); it shares no code with
that one — this half is only where a portable build keeps its User
folder, not what magpie takes a copilot launcher for.
Run at this head (parent 841025836):
- New TestVSCodePortableUserDir: an installed build with the launcher on
PATH keeps the OS's User folder; with the data folder beside the
program the build's Dir is data\user-data\User, it is detected before
its first run has made the folder, connecting writes magpie's group in
the data folder's chatLanguageModels.json and disconnecting takes it
out. New TestVSCodePortableScoopShim: the same through scoop's shims
folder, the .shim naming the launcher in apps\vscode\current\bin, and
a shim with no data folder beside the launcher it names staying an
installed build. Both are red with vscodeUserDir taken back to the
OS's place ("the portable build's User folder is .../Application
Support/Code/User", "Scoop's portable VS Code reads ...") and green
with the change.
- go test -tags nogui ./internal/agent -count=1: green but for
TestMothX, which fails the same without this change — this machine's
PATH has a real mothx (fnm), which the test's LookPath finds.
- gofmt -l clean; go vet ./internal/agent for darwin, linux and windows;
go build ./... for darwin and windows, and for linux ./internal/agent
(the repo's linux build fails in wails's own code on this machine
without this change too).
Issue: #3260
Generated-by: GLM-5.3-Flash (ZCode)
Reviewed and run by yetone at the batch head over cac655c14 (this commit,
the four others from ggbdpq's #4495/#4548/#4512/#3260 patches and the
#4548 follow-up), on mote:
- gofmt -l clean; go vet ./... for darwin, linux (-tags nogui), windows;
go build ./... for darwin and windows.
- go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
internal/gui, with two filed reds: TestSettingsSaveKeepsWhatItDoesNotSend
(#4514), red alone at origin/main cac655c14 too, and TestColdTurnsTaken
(#4510), red only in the full run. Rebased afterwards onto e94fb18b8,
a usage-page change that touches none of these files.
- Windows (xiaomi-gpu): go test -run 'TestVSCode|TestClaudePicker'
./internal/agent ok. TestCopilotFolderFromAnIDEPluginIsNotTheCLI is red
there at cac655c14 too (#1827).
- Broken by hand: vscodeUserDir's portable branch off -> TestVSCodePortableUserDir and TestVSCodePortableScoopShim red. Checked against Scoop: extras/vscode.json puts appsscode
The "show the agent's own models" switch filtered magpie's pickers
alone (agent.Picks, #1642): Claude Code's own /model rows stayed put,
because nothing magpie wrote for Claude Code looked at the switch —
while /model is fed by magpie all the same (modelPicker's rows are
writePicker's). raclen traced the whole chain (#4548).
writePicker now sets modelPicker.replaceBuiltInOptions (Claude Code's
own key: with it the /model picker shows only the listed rows) while
the switch is off, and drops the flag again when it is on, so the
whole picker is written either way. The Default row stays under both
settings: Claude Code keeps it as its own fallback.
Tests: TestClaudePickerOwnModelsSwitch writes a settings.json and
checks modelPicker carries the rows plus the flag with the switch
off, and the flag without it with the switch on.
Verification on the base 5d955a4d4, macOS arm64: agent package
-targets nogui; gofmt, vet on darwin/linux/windows and builds clean.
Claude Code's reading of the key is per its documented modelPicker
behavior (code.claude.com/docs, model-config); the Default-row
fallback shape is per the reporter's capture, not re-run here.
Generated-by: GLM-5.3-Flash (ZCode)
Reviewed and run by yetone at the batch head over cac655c14 (this commit,
the four others from ggbdpq's #4495/#4548/#4512/#3260 patches and the
#4548 follow-up), on mote:
- gofmt -l clean; go vet ./... for darwin, linux (-tags nogui), windows;
go build ./... for darwin and windows.
- go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
internal/gui, with two filed reds: TestSettingsSaveKeepsWhatItDoesNotSend
(#4514), red alone at origin/main cac655c14 too, and TestColdTurnsTaken
(#4510), red only in the full run. Rebased afterwards onto e94fb18b8,
a usage-page change that touches none of these files.
- Windows (xiaomi-gpu): go test -run 'TestVSCode|TestClaudePicker'
./internal/agent ok. TestCopilotFolderFromAnIDEPluginIsNotTheCLI is red
there at cac655c14 too (#1827).
- Broken by hand: the replaceBuiltInOptions line dropped -> TestClaudePickerOwnModelsSwitch red. Not tried: a real Claude Code /model with the switch flipped (2.1.316's handling of the flag was read from its binary).
zyh6036 on X: DeepSeek Harness Desktop showed no model after magpie
turned dsh on and the app restarted, while the profile's patch file was
full of magpie's gateway.
Cause: a dsh start (agent-default-model) magpie had set to a found
routing group keeps the id the group had then, group/auto-<slug>. Since
81a24cf8f the group is listed as auto/<model>, and that is the only id
magpie's routes list. dsh looks up the start by route and id, finds
nothing, and shows "Select model" with nothing picked. The owner's live
desktop profile was in this state: the start was
"group/auto-gpt-6-sol" and the route listed auto/gpt-6-sol.
renameFoundGroups never reached it, because it moves only values that
applied.json records, and there was no dsh record there.
Fix: dshStartOnItsRoute already moves a start onto the route its model
is on now. It now also moves a start whose id magpie no longer lists it
by (provider.PublicRef for a found group, provider.RenamedRef for a
renamed provider) onto the id the route lists. The effort and the other
keys in the entry stay. It runs on every route write, in every profile
(desktop, web, CLI) and in the home layer, so KeepDshWired repairs an
existing install within a round. The fix is not OS-specific.
Run at this head (rebased on bb5eb83c3), on mote (macOS) through mote-run:
- go test ./internal/agent ./internal/provider -count=1 -timeout 45m:
ok (284s, 164s)
- go test ./internal/agent -run 'Dsh|FoundGroup|Drift|Keeps': ok
- GOOS=windows go vet ./...: ok
- GOOS=linux go vet ./internal/agent ./internal/provider: ok
(a GOOS=linux vet of ./... from macOS stops in wails' cgo files)
- go vet ./internal/agent (darwin): ok
- gofmt -l: clean
The full suite was not run, so that another session's suite on mote
isn't held up (one full suite per machine). Only internal/agent changed.
The -run 'Dsh|...' subset ran before the rebase.
Broken by hand: with dsh.go at HEAD,
TestDshStartOnAFoundGroupsOldIdMovesOntoItsId fails, and the start
stays "group/auto-pro" in the web profile.
Real app: DeepSeek Harness 0.2.1-rc.5 on mote, each run in a sandbox
HOME and DSH_HOME:
- Fresh wiring shows magpie's models, whether the app was opened first
or magpie wrote first.
- A copy of the owner's live desktop patch: every route is listed, but
the seat reads "Select model".
- The same copy with the start as the fix writes it (auto/gpt-6-sol):
the seat reads "GPT-6 Sol · routing group High", ticked in the picker.
Not tried:
- Running the fixed magpie binary itself against that copy. The unit
test covers the magpie side.
- Windows' desktop app.
- Whether zyh6036's install was in this state. A store or key that
doesn't resolve also empties the list (seen with no key at all), and
their reply will say which.
70d50254c (v0.1.2387) took the model list out of the route the Codex
app's app-server is ended on. The effort the app saves on each pick
went into the catalog, the next sync rewrote it, and the route's hash
of the catalog changed, so the app-server was ended every few minutes
and the ChatGPT app read that as a crash (goto_nozomi on Discord,
ggbdpq on #4550). This adds two things on top of that.
- codexAppStep logs each end with what made the app-server stale:
"codex: ended the Codex app's app-server [pid] for the app to start
another: <why>". The reason is the ChatGPT account switched, the
route changed, or the used-up takeover. Before this a successful end
logged nothing, so a reported crash couldn't be put down to magpie or
to the app (ggbdpq asked for it on #4550).
- TestCodexAppRouteKeepsThroughListFlaps runs in a sandbox HOME
through SyncCatalog. A relay's list drops a model and has it back,
the catalog is re-ranked in another order with other descriptions,
and the catalog is caught half-written. Each must leave the route as
it was. 70d50254c's tests cover an effort pick and a rename.
Product call, as 70d50254c made it: a list change alone never restarts
the app-server, not even once Codex has been idle for a while. The
restart is what crashes ChatGPT when an MCP server is slow, and idle
time doesn't make it safe. The new list is read at the app's next
launch, or on the Agents row's Restart (StaleCopies). Where requests
go (model_provider, openai_base_url, the magpie table's base_url,
requires_openai_auth, the used-up takeover) still restarts it, as
TestCodexAppRouteFollowsConnectAndDisconnect and
TestCodexAppRouteFollowsOpenAIAuth hold.
Run (mote):
- go vet, GOOS=linux go vet and GOOS=windows go vet of ./internal/agent
and ./internal/provider: clean.
- go test -count=1 -timeout 45m ./internal/agent ./internal/provider on
e484b1e93: ok. Rebased onto 5cc2eea2f (dsh in internal/agent), then
go vet and go test -count=1 -timeout 45m ./internal/agent again, and
-run CodexApp ./internal/provider: ok.
- gofmt -l on both packages: nothing.
Broken by hand:
- TestCodexAppRouteKeepsThroughListFlaps at 70d50254c^ (the route
still hashed the catalog) is red three ways: a model dropped (:119),
another order (:141) and a half-written catalog (:147) each changed
the route.
- With the used-up reason taken out of codexAppStep,
TestCodexAppEndSaysWhy is red ("... start another: where Codex's
config sends it changed", want "used up").
Not tried:
- The real ChatGPT/Codex app. Nothing here changes when the app-server
is ended, only what is logged.
- The whole ./... suite and the GUI suite. Neither package touches the
GUI.
- Whether goto_nozomi's crashes stop on v0.1.2387. #4550 stays open
for them to say, with the new log line asked for if any crash is
left.
liby233 on Discord: in WSL magpie wired dsh in ~/.dsh/config.yaml, and dsh
saw magpie's models only once they were written to its settings.yaml.
With no ~/.dsh/profiles, dshAt fell back to the "pre-0.1.5" config.yaml.
No dsh on npm reads that file. 0.0.1-rc.1 (the first), 0.0.1-rc.5,
0.1.0-rc.8, 0.1.1-rc.1/rc.2, 0.1.2-rc.1, 0.1.3-alpha.2 and 0.2.1-rc.5 all
boot $DSH_HOME/profiles/<name> (grepped from their npm tarballs). A dsh
makes no profile until one is first booted, so a fresh CLI install,
in a distro or not, was wired in a file that nothing reads.
- With no profile, and a dsh that is not from before profiles, magpie
writes profiles/web/cordis.patch.yml as dsh's template, as it does
for Desktop (#2279). dsh's initProfile adds package.json,
pnpm-workspace.yaml and cordis.yml next to it and keeps the file.
- "Before profiles" is judged by the CLI's version where it is known
(locally from its package.json; in a distro the WSL probe now asks
dsh --version). Otherwise config.yaml is used only when it holds an
entry that isn't magpie's. That keeps the legacy path for a genuinely
old dsh.
- The sync carries a magpie model already wired in config.yaml (the
reporter's state) into the profiles and drops magpie's entries from
config.yaml. It does this whether or not dsh has since booted a bare
web profile, and only where no profile has a model or wiring of its
own.
- Disconnecting before dsh ever booted the web profile removes what
magpie made, as for Desktop.
Tests: TestDshCLIWithNoProfileYet and TestDshConfigYamlCarriedToProfiles
(new), plus wslMore's dsh row, now profiles/web. All three are red on the
old dsh.go: "names .../.dsh/config.yaml, not the web profile's patch
list", and the web profile is left as dsh's bare template after the sync.
Tests pin dshVersion, so a dsh on the test machine decides nothing.
Run (go test -timeout 45m, logs teed and grepped):
- gofmt -l internal/agent: clean. go vet ./internal/agent on darwin,
GOOS=linux and GOOS=windows (mote): ok.
- go test -run 'TestDsh|WSL' ./internal/agent: ok on mote (macOS),
magpie-desktop (WSL Ubuntu 24.04, nogui) and xiaomi-gpu (Windows 11).
- Full suite `go test ./...` on mote at this change on origin/main
8680ffa41: 82 packages ok; internal/gui red only in
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949), both filed before this and
in code this change doesn't reach.
- Rebased again onto origin/main 70d50254c (it changed internal/agent's
new_session_effort and rename_group tests). At this pushed head: vet
(darwin, linux, windows) ok, and internal/agent, internal/cli ok;
internal/gui has the same two reds and no others.
- Rebased once more onto e484b1e93, which touches internal/provider only.
At that head (the pushed one): go build ./..., go vet internal/agent and
internal/provider, and go test -run 'TestDsh|WSL' ./internal/agent all
ok on mote.
- Real dsh 0.2.1-rc.5 from npm in magpie-desktop, in sandbox HOMEs under
~/dshprobe (never the live ~/.dsh), with this commit's CLI built there
(nogui):
A. Empty HOME, `magpie dsh magpie/relay/glm-4.6`: only
profiles/web/cordis.patch.yml was written, holding llm-pi-ai's
magpie route, agent-default-model and web-search-deepseek.
`dsh --profile web --dump-config` shows llm-pi-ai baseURL
127.0.0.1:3425/v1 and agent-default-model relay/glm-4.6. dsh added
package.json, pnpm-workspace.yaml and cordis.yml and kept magpie's
entries. `magpie dsh default` then left dsh's bare template.
B. origin/main's CLI wired config.yaml (the reporter's state). The
dump showed no magpie route. `dsh --profile web --dump-config`
booted web, then this CLI's `magpie sync` moved the route and model
into profiles/web and emptied config.yaml, and the dump showed them.
C. Wired and never booted: `magpie dsh default` removed profiles/.
Not tried: the reporter's own machine and dsh version, a running
`dsh web` session picking the model up live, the desktop app, and a
pre-npm dsh that reads config.yaml (none could be found).
The Codex app crashed and relaunched every few minutes (indekkusu141209
on X, #4550: 08:06, 08:12, 08:26).
Cause. KeepCodexAppOnItsProvider ends the app's app-server whenever
codexAppRoute changes. Since ca8a6f346 (lucis0116 on X) the route held a
hash of the bytes in the catalog that model_catalog_json names. The
ChatGPT app takes an ended app-server as a crash. Those bytes change far
more often than where requests go:
- Each model's default_reasoning_level follows config.toml's
model_reasoning_effort (codexcat.ModelDefault, Creat.wu on Discord).
- The Codex app writes that key on every effort pick, and on a switch to
a model with other levels. So does magpie's settle() when a pick moves
the effort.
- The next SyncCatalog, set off by things like a plugin token refresh or
a providers.json save, rewrote the catalog. 3s later the route had
changed, and the app-server was ended once idle.
The route doc's own promise, "nothing the Codex app writes itself is in
route", was broken through the catalog.
The repro was in a sandbox HOME, not the live ~/.codex. A throwaway
gateway test diffed CodexDesktopCatalog's bytes:
- Two passes with nothing changed: same bytes.
- A model pick: same bytes.
- models_cache.json refetched with a new fetched_at/etag: same bytes.
- model_reasoning_effort low -> high: different bytes.
The new agent tests below show the same for magpie-models.json, and the
old route moved with it.
Change. The route is where requests go, and only that:
model_provider, openai_base_url, magpie's base_url and
requires_openai_auth, and AppOut. model_catalog_json and the catalog's
content are out, and codexCatalogTag (codex_app_route.go) is gone. A
list-only change (a provider renamed, a model added, an effort picked)
restarts nothing. The app reads the new list at its next launch. The
Agents row already shows a Codex app on an older list, with its Restart
(StaleCopies). Its digest compares slugs and visibility, so an effort
pick doesn't flag it. No new UI.
The effort in the catalog is kept. It is the Creat.wu fix, and with the
restart decoupled, a rewrite of a file the app reads only at start costs
nothing.
Trade-off: a provider renamed or a model added in magpie shows in a
running Codex app only after it is reopened, or after the Agents row's
Restart. Before this commit that happened on its own, which was
lucis0116's ask.
Siblings, all read:
- RestartCodexApp (Agents row), RestartSwitchedCodexApp (switch notice,
46aa7e6b8) and RestartCodexAppWhenIdle (uninstall) are user-started or
a real route change. None reads the catalog. Unchanged.
- KeepCodexDaemonCurrent restarts the CLI's managed daemon only with no
codex session on it, on the slug digest. That is not the desktop app.
Unchanged.
- No other agent hashes its catalog into a restart.
- zhangjian94cn's fix/4243-codex-lifecycle-boundary takes away all of
magpie's restarts. That goes further than this commit, and no code was
taken from it. #4243 (aresxu8866-hue) asked for the catalog to count
only when it is magpie's, which this commit supersedes.
Tests:
- TestCodexEffortPickKeepsTheAppRunning (new): the reporter's case. An
effort saved as the app saves it, then SyncCatalog. The catalog
changes and the route does not.
- TestCodexAppRouteIgnoresARename replaces
TestCodexAppRouteFollowsTheCatalog, whose guarantee is now reversed.
- Broken by hand: both new tests run on the old codexAppRoute are red
("an effort picked in the Codex app changed its route", "a provider
renamed changed the Codex app's route"). Green with the change.
Run at this head (5b0bb1349's tree, rebased on e90a635a9), on mote:
- go test -tags nogui -count=1 -timeout 45m ./internal/agent
./internal/provider: ok, ok. The same before the rebase.
- gofmt -l .: nothing.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
go vet ./..., go build ./...: ok. That run was before the rebase; vet
on agent and provider was run again after it.
Not run: the full go test ./... suite. Another session's full suite held
mote, and the owner's rule is to ship without holding for it; it follows
after the push. Not tried: a real ChatGPT/Codex desktop app. Nothing on
the ChatGPT side was changed or measured (the MCP handshake ggbdpq
traced). docs/subsystems/agent-wiring.md was updated.
#3751's second half; 67b12956 fixed the half about lengths. A Codex
thread moved to another provider, by the Sessions page's Move
(MoveCodexProvider, #887) or as Codex steps off magpie (bringBack's
MoveCodexThreads), has each of its rollouts written whole into a temp
file that then takes its place. The move took no Codex lock and left
alone only a thread written to in the last minute. A Codex that resumed
the thread (the app-server, as run below; a resumed TUI too, by Codex's
source) keeps its rollout open to append to for as long as it has the
thread, so what it wrote after a move went into the file the rename had
put aside: a turn the upstream answered was in neither the rollout nor
what Codex sent after its next resume.
moveCodexPaths now holds the thread as Codex holds one it writes to,
archives or deletes (rollout/src/writer_lock.rs, acquire; thread-store
holds it through a whole archive, unarchive or delete): under
thread-writer-locks/.coordination.lock it makes and locks
thread-writer-locks/<thread>.lock, then lets the coordination lock go
and keeps the thread's lock from before a file is copied to the trash
until the thread's row in the state database has moved. Letting go takes
the lock file away under the coordination lock, as Codex's guard does. A
Codex that resumes the thread meanwhile is turned away by Codex itself
("already has an active writer"), so the files and the row move together
and a rollback is written under no Codex. A thread a Codex has open is
left as it was: its files, their time and its row, with no copy kept.
Its error, "a Codex has the session open", is ErrActive too, so it goes
where a thread written to in the last minute goes: MoveCodexThreads
leaves it for its next call, and the Sessions page's reply marks it
active, so the page says "{title} is still being written to; close it in
Codex and try again in a minute" ("{n} sessions ..." for several), in
en, zh, zh-TW, ja and de. No new words and no GUI file changed: app.js
grows 0 bytes. There is no CLI for the move. The minute is the page's
own: codex exec lets the thread go as it exits (the interactive TUI
wasn't tried), but Codex 0.164.0's app-server keeps a thread loaded, and
held, until 30 minutes after it went idle with nothing showing it
(thread_unload_delay_secs, 1800 by default), or until it ends. So a
thread the Codex app has shown can be refused for up to half an hour
after it is closed there, or until the app quits. Those words are left
as they are (#3986).
A Codex home without thread-writer-locks (a Codex from before them)
has no lock to take, and its threads move as before, with the
last-minute check alone. None is made there: PortCodexRollouts reads a
home with one as one whose Codex holds its threads, and would then
rewrite rollouts under a Codex that doesn't. A lock folder that can't
be read, or a lock file that can't be opened, refuses the move with
its error. The coordination lock is waited for at most 10s
(filelock.Wait), under storeMu and mu as the row's 5s busy_timeout
already is; not had by then, the thread counts as held, as in
editRollout.
editRollout, the port's writer, isn't used: it publishes one file under
the coordination lock alone, while a thread's files (a revert's, a
packed twin) and its row move together, and its edit can't refuse a
longer id in a paginated rollout as 67b12956's rewriteCodexProvider
does. rewriteCodexProvider is unchanged, so the padding and that
refusal stay as they were.
A thread bringBack leaves keeps its row on magpie, so the next bringBack
picks it again (codexThreadsOn) and moves it once its Codex has let go:
it isn't left for good. bringBack runs at Disconnect and in Codex's
Sync, which SyncCatalog runs: at the GUI's start, after a provider,
plugin or model list is saved or fetched, and when the catalog is
fetched again (catalog.KeepFresh, at least daily in the GUI and in
magpie serve). Until then the thread stays on magpie, as one written to
in the last minute does now, so for up to about a day while magpie runs.
At a Disconnect magpie also restarts the Codex app's app-server
(KeepCodexAppOnItsProvider, every 3s), which lets the thread go; when
that comes after bringBack's move, the thread waits for the next Sync.
When Codex goes back to openai, or another id of magpie's length,
RelabelCodexThreads first writes a plain rollout's provider in place,
held or not; MoveCodexThreads meets a held thread there only for what
that skips, a packed rollout mostly. For an id of another length it
moves them all.
RelabelCodexThreads takes no lock either. It writes the id over in the
first line, in place, so a Codex appending to the file loses nothing:
tried below, the turn after it was kept and the row stayed as it wrote
it. It is left as it is.
The port's paragraph in docs/subsystems/gateway-routing.md, where
67b12956 put the move's lengths, says so, and so do the comments of
MoveCodexProvider, MoveCodexThreads and bringBack.
What was run (tree d652ce94, on origin/main 74dcf40a, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- TestMoveCodexProviderLeavesAnOpenThread (new): a thread's writer lock
held as a resumed Codex holds it. The Move is refused with ErrActive;
the file, its time and the row are as they were, nothing is kept in
the trash and no temp file is left. With the lock let go (its file
left behind, as a Codex that ended leaves it), the Move goes through
and the lock file is gone.
- TestMoveCodexProviderHoldsTheThread (new): looked at from a trigger
on the row's update, as the Move writes the row, the thread's lock is
held and the file names the new provider already; the lock file is
gone after.
- TestMoveCodexThreadsLeavesAnOpenThread (new): two threads on magpie,
one held. The other moves; the held one keeps its file and row, with
no copy and no error, and the next call moves it once let go. A home
without thread-writer-locks moves its thread as before, and gets
none.
- The three with 74dcf40a's codex_provider.go: red, "err <nil>, want
ErrActive", "as the row was written: no lock file", and both threads
moved.
- -race -count=10, the three and every move and port test of
internal/sessions (TestCodexProviderIn, TestMoveCodexProvider,
TestMoveCodexProviderPacked, TestMoveCodexProviderKeepsBytePlaces,
TestMoveCodexThreads, TestMoveCodexThreadsNone,
TestPortCodexRollouts and its KeepsBytePlaces, LeavesAnOpenThread,
LongerLine and RepairsForks, TestPortLineDropsClaudeBlocks,
TestPortLineLeavesOthers): 16 tests, 10 runs each, ok. -race
-count=3: internal/agent's TestCodexThreadsComeBackOffMagpie and
TestCodexThreadsFollowMagpieIn (bringBack, bringOver) and
internal/gateway's TestPortedCompactionReadsTheSame, ok.
- Broken by hand, each alone in a scratch worktree at this tree, the
eight move tests run, each red:
- no lock taken: all three new tests, as at 74dcf40a.
- the row written for a thread left: both LeavesAnOpenThread tests
("its row moved to ..., its files didn't"), and MoveCodexThreads
never finds the thread again ("after its Codex let go: [] <nil>").
- the lock taken after the copy to the trash: both
LeavesAnOpenThread tests ("a copy kept of a thread left as it
was").
- the lock let go after the files, before the row:
TestMoveCodexProviderHoldsTheThread.
- the error not ErrActive: TestMoveCodexProviderLeavesAnOpenThread
("err a Codex has the session open, want ErrActive") and
TestMoveCodexThreadsLeavesAnOpenThread (the held thread's error
returned, "thread ...: a Codex has the session open").
- the lock file left when the move lets go: both
TestMoveCodexProvider tests.
- thread-writer-locks made in a home without one:
TestMoveCodexThreadsLeavesAnOpenThread.
The other move tests stayed green under each.
- Codex CLI 0.164.0, real, with gw-c's #3616 move-open harness: a
sandbox HOME and CODEX_HOME, loopback only, a fake Responses
upstream, and MoveCodexThreads from fake-provider to fake through a
test binary built from each tree. Two turns on a thread T; a codex
app-server resumes T (T's lock file appears in thread-writer-locks),
waits 80s and has a turn; at 70s, the move.
- 74dcf40a: the move moved T, file and row. The turn completed and
the upstream got it, but the rollout has it 0 times, and Codex
resuming T on fake sent turns 1 and 2 without it.
- here: the move moved nothing, file and row on fake-provider. The
turn is in the rollout (2 lines). With the app-server gone (its
lock file gone) and the rollout a minute old, the move moved T
(files 1, db 1), and thread-writer-locks had only
.coordination.lock after it. Codex resuming T on fake sent turns 1
and 2 and the turn the app-server had.
Each tree ran twice: in the first runs the move after the app-server
came within the minute after its turn, which left T here; the script
now waits the minute out.
- Codex CLI 0.164.0, the same sandbox: with T's lock file made and
flocked under the coordination lock by another process, as
holdCodexThread does, codex exec resume T exits 1 with "thread/resume
failed: thread ... already has an active writer" and sends nothing;
once it is let go and the file taken away, the resume runs.
- Codex CLI 0.164.0, the move-open run with RelabelCodexThreads from
fake to fak2 (one length) at 70s: T relabelled at once, the turn in
the rollout (2 lines), the row still fak2 after it, and Codex
resuming T on fak2 sent the turn.
- gofmt -l clean. tools/vetset.sh: 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; untagged
linux vet and build exit 1 (no GTK or WebKitGTK dev packages on this
box).
- go test -tags nogui -count=1 -timeout 45m ./... (log kept), Bun
1.4.2: 68 packages ok and 8 red, sessions ok; each red on the list of
reds already filed: agent (#3141, #3398, #3641, and
TestWSLColdPlaceOpensNothing, #3924), davsync TestSync (#3420), edit
and testenv (umask 077, #3640), gateway
TestPluginToldWhereTheAgentWorks (#3675), gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649), provider TestCodexAppServersOnHome (#3906), then "close of
synctest channel from outside bubble" (#3632), tui
TestTUIFetchesSubscriptionModels/agent (#3919)
- On origin/main 1a804859 with this commit cherry-picked (a scratch
worktree, not this tree): go test ./internal/sessions ok; go test -run
Codex ./internal/agent, only TestCodexDriftReached red (#3398)
Not run: the GUI tests, i18n-keys among them; no GUI file changed.
Not tried: Windows, where magpie's lock is LockFileEx on one byte and
Codex's on the whole file (as for the port), and macOS; the Codex app
itself, whose app-server was driven over stdio here as the app drives
one; a thread of a Codex in a WSL distro moved from Windows, where the
lock taken may not be the distro's; a file system without locks, where
the move is refused as held.
Review (yetone, at this commit on origin/main bb5e68cea, go1.26.8):
- Checked against Codex's codex-rs/rollout/src/writer_lock.rs: acquire
takes thread-writer-locks/.coordination.lock, creates and try-locks
<thread_id>.lock and lets coordination go; its guard's drop takes
coordination again, closes the file, removes it and lets go. The move
does the same, and leaves a home without the folder alone.
- On main, the three new tests red on macOS (mote): "err <nil>, want
ErrActive", "as the row was written: no lock file", both threads
moved. With this change, ok.
- Broken by hand, each red: letGo called at once (HoldsTheThread);
os.Remove dropped ("lock file is left", both MoveCodexProvider
tests); threadOpen's Is false (LeavesAnOpenThread x2); the lock
folder always made (MoveCodexThreads, "thread-writer-locks made where
Codex keeps none").
- macOS (mote): go test -tags nogui ./internal/sessions
./internal/filelock ./internal/agent ok; -race -count=10 -run
'TestMoveCodex|TestPortCodex' ./internal/sessions ok (at d0a61b856);
gofmt -l clean; go vet darwin, GOOS=linux -tags nogui and
GOOS=windows for sessions and agent ok.
- Windows (xiaomi-gpu, win-run) and Linux (WSL magpie-desktop,
wsl-run): go test -run 'TestMoveCodex|TestPortCodex'
./internal/sessions ok (at d0a61b856).
Not tried by the review: a real Codex CLI or app holding a thread
during a move, on any system; a WSL distro's Codex moved from Windows.
At the pushed tree (rebased on origin/main 7e0fe83d4), macOS (mote):
gofmt clean; go vet darwin, GOOS=windows and GOOS=linux -tags nogui for
sessions ok; go test -tags nogui ./internal/sessions ./internal/agent
ok; -run Budget ./internal/gui ok.
ethanchi on Discord, checked with real WorkBuddy turns: Alma showed raw
DeepSeek DSML tool-call text with a magpie model. Alma decides function
calling per model from models.dev by the id (electron/model-capabilities.ts).
For an id models.dev doesn't know, such as a routing group's name
("workbuddy-ai-DeepSeek") or a plugin's model, it found none, and
electron/server.ts wrapped the model in hermesToolMiddleware. That
middleware puts the tools in the prompt, so no native tools went out and
DeepSeek answered in DSML text. The only way round it was turning on Tool
Calling in Alma's Model Options.
Alma stores that switch as capabilityOverrides.functionCalling on the
provider's availableModels (StoredModelCapabilities in
electron/database-schema.ts, written by PUT /api/providers/:id/models,
updateProviderModels). resolveModelCapabilities ->
getModelCapabilitiesWithOverrides takes a set functionCalling over the
auto value, and both places that pick hermesToolMiddleware (server.ts and
tools/agentExecutor.ts) ask resolveModelCapabilities. Read from Alma's
source at 546528ac.
almaModels now puts functionCalling: true in the capabilityOverrides of
every model it lists. That is the same claim the gateway's /v1/models
makes for every chat model (toolsTold). The drawer-only entry for image
generation is not told. A functionCalling the model already has in Alma is
the user's own, since magpie never wrote one before, so it is kept, off as
well as on (almaUserFirst, in almaWithOverrides and almaSameModels), and
it doesn't make every Sync write again. A model whose overrides Alma lost
is told again.
Tests (internal/agent): TestAlmaToldTools is new. TestAlmaToldReasoning's
pinned overrides now carry functionCalling: true, and the user's
functionCalling: false is still kept there.
Broken by hand, each red, then restored:
- functionCalling line removed: TestAlmaToldTools "relay/glm-4.6:
functionCalling <nil>, want true", TestAlmaToldReasoning red.
- user-first skip removed in almaWithOverrides: "user's off:
functionCalling true".
- user-first skip removed in almaSameModels: "second sync wrote [PUT
/api/providers/p1/models]".
Run on mote at 7aa67e9e5 + this change: 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: all ok.
go test -tags nogui -timeout 45m -count=1 ./...: 82 packages ok,
internal/agent and internal/gateway among them. One red: internal/gui
TestSettingsSaveKeepsWhatItDoesNotSend ("SearchAll: not sent by the
Settings page"). That is #4514, open since b09349d17's test fixture, with
yiqiui's patch on it. It is not touched here.
Rebased on 7b883cc61, where nothing new touches internal/agent: go build,
go vet ./internal/agent and go test -tags nogui ./internal/agent/ ok on
mote at the pushed head.
Not tried: a real Alma. The values come from Alma's source; the request
that reaches Alma goes through the fake Alma in alma_test.go. The user's
real Alma data was not touched. No GUI files changed, so no GUI suite was
run. A model that magpie told functionCalling: true keeps it if magpie
later stops listing it as calling tools. Today magpie says so for every
chat model, so that can't happen yet.
hentulong on X: after routing Codex through WorkBuddy and switching back,
Codex couldn't connect, and a fork said "Persisted response contains
hosted-tool, compaction, or unverifiable hidden reasoning state that
Rustponses cannot replay".
Cause: while Codex is routed through magpie to another vendor, the
reasoning items magpie hands it stay in the thread's rollout. After the
switch back Codex talks to chatgpt.com itself, and OpenAI refuses every
reasoning item it didn't seal. On the owner's real account:
- summary only, no encrypted_content: unsupported_persisted_item_context
(the reporter's Rustponses error) on a previous_response_id
continuation;
- with content (reasoning_text, what Codex 0.165 writes for DeepSeek via
magpie): 400 array_above_max_length "Invalid 'input[5].content'";
- foreign encrypted_content: invalid_encrypted_content.
Codex treats each as fatal, so that thread and its forks fail while new
threads work. No stale config: Unwire/EndFailover drop openai_base_url.
Fix: when Codex is no longer routed or failing over (Unwire, quit,
uninstall and the periodic pass), PortCodexRolloutsLeft rewrites, in
threads begun on openai/magpie, every reasoning item (and every one in a
compacted line's replacement_history) whose encrypted_content isn't an
OpenAI Fernet token ("gAAAA") into type "magpie_reasoning", without id
and encrypted_content. Codex reads an unknown type as Other and never
sends it; magpie's sessions readers still show it. The edit keeps member
order and line length (same fitLine/lock path as the existing port),
has its own state entry, and starts at 2026-09-21. A survey of 150 live
rollouts found 340 of 340 OpenAI reasoning items in the gAAAA shape.
Run (mote, at f1d0c0bfd + this): go vet ./... for darwin, linux and
windows; go build for the three; go test -tags nogui -timeout 45m ./...:
every package ok but internal/gui, whose one red is
TestSettingsSaveKeepsWhatItDoesNotSend (SearchAll), open on main as #4514; gofmt -l clean.
Broken by hand: with the retire step off, and with Unwire passing false,
TestPortCodexRolloutsLeftRetiresUnsealedReasoning,
TestPortCodexRolloutsLeftKeepsItsOwnState and
TestCodexDisconnectRetiresMagpieReasoning go red.
Real Codex 0.165, sandbox CODEX_HOME, owner's account: a turn via magpie
with auto/deepseek-flash, then `codex exec resume` on gpt-6-sol direct
failed with array_above_max_length; after the left port the same resume
answered. The summary-only Rustponses refusal was reproduced with a
websocket probe against chatgpt.com and is retired by the same rule.
Not tried: the reporter's exact case in the interactive TUI (exec
resume doesn't warm up, so it never sends previous_response_id). A
thread Codex holds open keeps its in-memory history until reopened; a
switch not made through Unwire is caught by the periodic pass within
10 minutes.
Rebased after the full run onto 9551fadcb (5174c0970 GUI assets,
9551fadcb gateway/usage; no file here). At the pushed head:
go test -tags nogui -run Codex ./internal/sessions ./internal/agent ok,
go vet ./internal/sessions ./internal/agent ok.
herman_hong on Discord: Tuned for you advises Codex compact at ~120K.
A foreground compaction kept them waiting, so they had set 384K by hand.
Now that Codex compacts in the background, they want the advice there
and the 384K kept as the backstop.
Codex has this since 0.163.0 (checked in codex-rs at rust-v0.166.0, not
in 0.162.1): [features.async_compaction] enabled and
model_async_compact_threshold_percent, an integer share (1 to 100) of
the model's window, 65 by default. It is Stage::UnderDevelopment, runs
only with remote compaction v2 (which magpie already sets on its
provider), and starts none once the foreground limit is reached. magpie
already writes it from Settings' Background compaction (#2490), with
the version gate and the user's own keys kept. This drives that setting
from tune:
- agent: knob TuneAsync ("async_compact") on codex. TuneRead gives the
share, TuneApply turns Background compaction on at it (stashing what
Settings had the first time), and TuneUndo puts that back unless the
user changed it since. The foreground limit (Long conversations, or
the user's model_auto_compact_token_limit) is never touched. Async
keys the user wrote in config.toml come first (codexAsyncOwn): the
row says so and Apply errors. A table magpie wrote itself doesn't
count as the user's.
- gui/tune.go: advice.async holds the advice as a share of the window,
rounded down. With timed compactions it uses the token-cheapest
window, since a background compaction keeps no one waiting. It is
offered only when it would start before the foreground limit (the
lesser of the limit now and 90% of the window). held lists Codexes
too old for a share.
- context.js: the row gets a text button, "Use 120K in the background",
whose tip gives the share and says the foreground limit stays. After
Use a chip says so, with Undo background. A config.toml of the
user's, or a Codex too old, gets a one-line caveat and no button.
The too-old line is shared with Settings' row (codexHeld). No select,
no layout change. zh, zh-TW, ja and de are in i18n.js.
- The core script budget goes up by 1,571 bytes for the row
(core_budget_test.go says why). app.js is 278 bytes smaller.
Run (at this change on origin/main 6893cfbe3; rebased on d0a61b856,
whose new commits touch none of these files, and TestCoreScriptBudget,
TestTune*, TestCodexAsync* run again there: ok):
- gofmt -l: clean.
- mote-run go vet ./internal/agent ./internal/gui, plus GOOS=linux
-tags nogui and GOOS=windows vet of both: ok.
- mote-run go test -count=1 -timeout 45m ./internal/agent
./internal/tune ./internal/provider: ok. ./internal/gui: the new
tests and TestCoreScriptBudget pass. TestSettingsSaveKeepsWhatItDoes
NotSend is red on clean origin/main too (#4514). Eleven AppKit window
tests (TestMainWindowCorners, TestPanelCloseHidesIt, ...) were killed
at their 30-40s on mote at load ~25; this change touches no window
code.
- wsl-run node --test context-tune, codex-async-compact and i18n-keys:
the new test passes in chromium and webkit, in all five languages,
at 360 and 1100. It checks the label, the tip, the POST body
{knob: async_compact, value: "30"}, the chip and Undo, the locked
and held caveats, and no overflow. i18n-keys' "a plugin's words are
its own" is red on main (#4524).
Broken by hand (each went red, then restored):
- codexAsyncOwn always "": TestTuneCodexAsyncOwn red in all 4 cases.
- asyncOurs ignoring the set share: TestTuneCodexAsync red (it would
undo over the user's 50).
- codexAsyncAt keyed on WaitBest, and always ok: TestCodexAsyncAt red
(timed cheapest, foreground, 90%).
- context.js posting without the knob: the GUI test red, knob
"compact" where "async_compact" was wanted.
Not tried: a real Codex 0.163+ turn compacting in the background
through magpie, and a real account's /api/tune. When the models' windows
differ, the share comes from the advice's window, so the tokens are
approximate; the tip shows the share Codex gets.
young02036 on Discord: Claude Desktop 4.29.0 on Windows, a Code tab
session whose environment host is "WSL · Ubuntu", a magpie group of
Codex gpt-6.1-sol (500K) and Claude Opus 5.5 (1M) listed as
mythos-magpie-4247180078, and /context read "49.4k / 200k".
Cause: Desktop runs such a session on the distro's Claude Code, which
reads its user settings in the distro. Desktop 4.29.0's remote probe
reads them from `${CLAUDE_CONFIG_DIR:-$HOME/.claude}` there. Desktop sets
CLAUDE_CODE_MAX_CONTEXT_TOKENS only for Cowork (its bundle's one write of
it); a Code tab session gets the mythos-magpie id and no window. magpie
wrote Desktop's window, capabilities and Explore flag into Windows'
~/.claude/settings.json alone: desktopOn() was false for every
claude@wsl:<distro>. So the distro's Claude Code took the unknown id for
200K.
Fix: desktopOn() is true for a distro's Claude Code while this machine's
Desktop is on magpie (desktopSetsHere), so its Sync (desktopOnly when it
isn't on magpie itself, writeWindow when it is) writes the same values
into the distro's settings.json, and takes them out when Desktop leaves.
Turning Desktop on or off also syncs each running distro's Claude Code at
once; a stopped distro has no Sync (asleep) and is written on the first
catalog round after it starts.
Run:
- WSL (magpie-desktop, wsl-run), real Claude Code 2.1.289 in a sandbox
HOME, `claude -p --model mythos-magpie-4247180078 /context`: no env in
~/.claude/settings.json gives "30.4k / 200k" and the unknown-model
notice; CLAUDE_CODE_MAX_CONTEXT_TOKENS=500000 there gives "30.4k / 500k".
- New TestClaudeDesktopWSLContextWindow: a distro's settings.json gets
1000000 and mythos-magpie capabilities with Desktop on, the user's
model/theme kept, nothing before Desktop is on, all gone after it is off.
mote and Windows (win-run) pass.
- Broken by hand: desktopOn returning false for a distro, the test is red
("the distro's window "", want glm's 1000000").
- win-run go test ./internal/agent -run 'TestClaudeDesktop|TestWSLClaude':
only TestClaudeDesktopCarriesTheLanguage red, same at origin/main
305c624ed on Windows alone (#4115).
- mote: go test -timeout 45m ./... at this tree (base 305c624ed):
internal/agent ok (280s), 81 packages ok. Red, none touched here:
internal/proc TestNoCommandBypassesProc (claudetui, #4491),
internal/gui TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and the
AppKit window tests killed at their deadlines on mote (#4125, #2645,
#3949). GOOS=windows and GOOS=linux go vet ./internal/agent ok,
gofmt clean.
Not tried: the real Desktop 4.29.0 on Windows with a WSL host session
end to end (the window read from the bundle and the distro's real Claude
Code, not a Desktop session); Claude Code 2.1.309 (the distro has
2.1.289). A session already open keeps the window it started with until
a new one starts.
pota on Discord: magpie switches the ChatGPT (Codex) desktop app's
account on macOS and Windows but not on Linux. OpenAI ships the app for
Linux since 08-11 (preview; learn.chatgpt.com/docs/linux/linux-app): a
deb, an rpm and an Arch package, which install /usr/lib/chatgpt. Its
app-server is /usr/lib/chatgpt/resources/codex ... app-server, run with
the user's HOME and no CODEX_HOME, so it reads ~/.codex like the CLI.
isCodexAppServer took only .app/Contents/ and Windows paths, so on Linux
nothing found the app: no "still signed in as" notice after a switch,
no restart of its app-server, and no version on the Agents row.
- provider: linuxCodexApp takes an absolute .../chatgpt/resources/codex
as the app's own app-server (findCodexApp, CodexAppStale, the switch's
restart all read it).
- agent: restartOnLinux; codexAppOpen knows on Linux whether the app is
open (any /usr/lib/chatgpt/ChatGPT process, not its codex alone or
another program's ChatGPT). desktopApps["codex"].linux reads the
version from resources/linux-package-metadata.json, HasApp/AppVersion
see it, and codexReaders counts the bundled codex's --version as a
reader of Codex's config. version() no longer stops at an empty store
read before the other sources.
Real run, WSL magpie-desktop (Ubuntu 24.04), OpenAI's chatgpt_amd64.deb
26.1027.30824 (bundled codex-cli 0.166.0-alpha.5.1) under Xvfb, sandbox
HOME, fake unsigned JWT accounts alice/bob (no real credentials), magpie
web on 127.0.0.1:3591:
- POST /api/login/switch alice: 200, auth.json alice; /api/providers
then says codexApp "bob@example.com" (the stale notice).
- POST /api/codex/daemon/restart-app: 200 in ~3s; the old app-server
ended (app log "Codex CLI process exited classifiedAsExpected=true
code=0"), a new one started with the sandbox HOME, the notice cleared.
- /api/agents/cli: "codex":{"app":"26.1027.30824"}.
- The same run with linuxCodexApp reverted: no notice, restart-app 400,
the app-server untouched (pota's case).
Run at 5b1709eee: go test -tags nogui -timeout 45m ./internal/agent
./internal/provider on mote, ok; gofmt -l clean; GOOS=linux go vet
-tags nogui and GOOS=windows go vet, ok; go build ./... ok. Full
go test -tags nogui -timeout 45m ./... on mote at cae01311c (the
earlier base; nothing under internal/agent, provider or proc changed
since): every package ok except two reds that are on main and filed,
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestNoCommandBypassesProc (#4491, now child_unix.go too). WSL
./internal/agent ./internal/provider: provider ok; agent red only in
TestGrokInstalled, TestCursorFolderFromTheEditorIsNotTheCLI and
TestOmpDetectedWithPiDir, red the same alone at origin/main 5b1709eee
in WSL (#4033, #3548); the new Linux tests pass there.
Broken by hand: linuxCodexApp returning false turns TestFindCodexApp and
TestCodexAppOwnServer red; codexAppOpen's Linux case removed and
linuxVersion returning "" turn TestCodexLinuxAppOpen and
TestCodexLinuxAppVersion red; the old store early return turns
TestCodexLinuxAppVersion red; codexReaders' linux case removed turns
TestCodexLinuxAppReadsTheConfig red in WSL.
Not tried: the rpm and Arch packages (the Arch one has the same
usr/lib/chatgpt layout; the rpm's is assumed), a real ChatGPT account
(the app's own UI asks to sign in, since the fake tokens fail refresh),
and reopening the app when no app-server comes back (Windows only;
Linux says to quit and open it again, as macOS does). A switch made from
the CLI while magpie web runs elsewhere doesn't restart the app; the
notice says to, as on macOS.
After magpie writes Kimi's config.toml, every Kimi was told "reads its
settings at start-up — restart open kimi sessions". That holds for the old
Python kimi-cli (~/.kimi). Kimi Code 2.x (~/.kimi-code, npm
@moonshot-ai/kimi-code) watches config.toml and reloads it, so an open
session takes the new models at once; only its web and desktop app's model
picker is read again when Settings › Providers is opened again. jiabubu
picked from that stale picker and got "Model \"magpie/...\" is not
configured in config.toml".
The notice now follows KimiDir's legacy flag: kimi-cli keeps the restart
advice word for word, and Kimi Code 2.x is told "reads this as it runs; in
its web or desktop app, reopen Settings › Providers or reload the page to
see new models". The same goes for Kimi in a WSL distro: wslKind gets an
optional restartAt, which Kimi's kind uses to pick its notice from the
distro's folder (a stopped distro reads as ~/.kimi-code, as kimiDir has it).
Both new strings are in NOTICES and translated in zh, zh-TW, ja and de.
Run (worktree at 027360021 + this commit, through mote-run / wsl-run):
- gofmt -l internal/agent: nothing. go vet ./internal/agent,
GOOS=linux go vet -tags nogui ./internal/agent ./internal/gui,
GOOS=windows go vet ./internal/agent ./internal/gui: ok.
- go test -count=1 -timeout 45m ./internal/agent: ok (157s), including the
new TestKimiNoticeByKind and TestEveryNoticeIsTranslated.
- Broken by hand: with kimi.go and wsl.go reverted, TestKimiNoticeByKind
fails for Kimi Code 2.x both here and in WSL (the restart advice).
- GUI (wsl-run): agent-notice-lang in WebKit 11/11 and Chromium 11/11.
i18n-keys 3 of 4; "a plugin's words are its own" fails on "Unmarked"
(plugins/routing vs internal/usage/search_calls_test.go), red on main,
#4524.
- go test ./internal/gui (at 0407d69e8 + this change) failed only in
TestSettingsSaveKeepsWhatItDoesNotSend (SearchAll, #4514) and real-window
AppKit tests killed at their deadline on mote (#4125, #2645); the same
five of them, run at clean origin/main 027360021, fail the same way.
Not tried: a real Kimi Code app showing this notice in magpie's GUI. Kimi
Code 2.4.1's reload behaviour is from an earlier sandbox run.
jiabubu on Discord (#feedback): one Kimi Code model put in a routing group
so it lists first lost "always thinking" and "dynamic tool loading" in Kimi
Code, which the same model straight from its provider has. buildGroupEntries
never set AlwaysThinks, DynamicTools or DefaultEffort on a group (the Entry
comment said "a group has none of them"), so kimiModelTables wrote the
group's table without always_thinking and dynamically_loaded_tools, and
default_effort fell back to high.
groupSharedKimi now gives a group each of the three when every member's
entry says the same, and none of it when one member doesn't or has no
entry: a group request can reach any member (rule targets are members too,
ruledEntry's of()), so Kimi Code must not shape a request for a member that
can't take it. The capability words are Kimi Code 2.4.1's own
(catalog-runtime.ts capabilityFromDeclared), already written for direct
models; kimi-cli still gets neither.
Tests: TestGroupSharesKimiFacts (provider: all share, one without, efforts
differ) and TestKimiCodePlanCapabilities now writes a one-member group
"top" (the reporter's case: always_thinking, dynamically_loaded_tools,
default_effort max) and a group "mix" with a relay model (neither word).
Run on mote (mote-run, sandbox HOME):
- At 83a630d69 (on fbb1b36d1): gofmt -l internal/provider internal/agent
clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
go vet ./... ok; go test -tags nogui -count=1 -timeout 45m ./...: every
package ok but internal/gui TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and internal/proc TestNoCommandBypassesProc (#4491). Both fail
the same at origin/main 841326709, just fetched; neither touches this
change.
- At the pushed head (rebased on 841326709): go test -count=1 -timeout 45m
./internal/provider ./internal/agent ./internal/catalog ok.
Broken by hand: without the groupSharedKimi call, both tests go red
(group/top loses always_thinking and dynamically_loaded_tools and gets
high). With "any member" instead of "every member", both go red
(group/mix and the mixed auto groups get the words).
Not tried: a real Kimi Code session picking the group (the words are the
ones real Kimi Code 2.4.1 already reads for direct models), Windows and
Linux test runs (vet only), nested groups.
young02036 on Discord put Codex Plus gpt-6.1-sol (500K) and Claude opus 5.5 (1M) in one routing group, with Context set to the smallest member's (500K). Each model picked on its own showed its window. The group showed 200K.
Cause: with the main model one of Claude's own, marked [1m], magpie tells Claude Code no window. Anthropic runs that model at its own window, so claudeWindow is 0 and no CLAUDE_CODE_MAX_CONTEXT_TOKENS is written. writePicker still lists every magpie model and group in /model. Claude Code 2.1.314 runs an id it doesn't know as Claude's at that MAX, and with no MAX at its own 200K. So group/mix and w/gpt-6.1-sol picked there ran at 200K.
Fix: pickerApart takes desktopPlan's path when four things hold:
- the main is a Claude model or a group of them;
- claudeWindow is 0;
- /model offers a row that is unmarked;
- that row isn't Claude's and has a known window.
desktopPlan also counts the picker rows (pickerRefs). The top MAX is then the largest window, and each smaller row gets its own modelSettings.<id>.autoCompactWindow. A group gets its smallest member's window, the same as every other agent; under Full window that is 500K uncapped.
Every other main is as before. A told window still serves a /model pick, and a main of no known window keeps the last one. Codex, OpenCode, DSH, Pi and the rest already list the group at 500000: they read the catalog's Context, which for a group is its smallest member's.
Real Claude Code 2.1.314, in a sandbox HOME against a fake Anthropic server, with `-p --model X "/context"`:
- old layout (no MAX): group/mix 200k, w/gpt-6.1-sol 200k;
- new layout: group/mix 272k, gpt 272k, glm 204.8k, claude [1m] 1m;
- new layout without the group's entry (Full window): group/mix 500k.
- go test -tags nogui ./internal/agent/: ok (289s), on the base before the rebase (576b5dcbc)
- at 3e5aa1151, after the rebase: go test -tags nogui -run 'Window|Picker|Context|TierEffort|Budget' ./internal/agent/: ok
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok
- gofmt -l: clean
- full suite (go test -tags nogui -timeout 45m ./...) at 3e5aa1151: still running at push, per the ship-immediately rule; any red gets an issue
Broken by hand: with pickerApart's term forced false, TestPickerModelsTheirOwnWindow is red with 10 errors ("a Claude main: group/mix in /model compacts at ""; want "272000"", MAX "" want 1000000, and so on). Earlier versions of the trigger turned five existing tests red (TestClaudeContextWindow, TestClaudeDesktopContextWindow, TestClaudeTierEffort, TestTypedWindowReachesCodexAndClaudeCode, TestLargestMemberTypedWindow), so the trigger is limited to a Claude main.
Not tried:
- the interactive /model switch (only `-p --model`);
- the reporter's real accounts;
- confirmation from the reporter that the agent is Claude Code.
Left alone, filed as #4509: a /model pick smaller than a non-Claude main's told window runs on the main's window.
nb5p on Discord: (1) a custom provider set to Responses had its models
wired into dsh on magpie's Chat Completions route (`magpie`), so dsh sent
Chat and magpie translated; (2) in dsh's models, mygateway/gpt-6.1-sol was
"GPT-6.1 Sol" while mygateway/gpt-6.1-terra was "GPT-6.1 Terra · MyGateway".
Cause 1: Provider.Native never read BaseAPI, the API the user gave the
Base URL as. Detect fills in every API that answers, so a relay picked as
Responses also had a Chat URL, and Native returned Chat (out[0]). Native
now takes BaseAPI after the vendor rules (ResponsesFirst, MessagesFirst),
when the provider serves it. dsh supports it: dsh 0.2.1-rc.2 bundles
@earendil-works/pi-ai, whose KnownApi includes "openai-responses", and
magpie already has the `magpie-responses` route (dshKinds). Siblings
reading m.APIs from magpieModels move with it: dsh, Pi, omp, droid,
Grok Build.
Cause 2: provider.Labels counted collisions over models and routing
groups together. A model two providers serve gets an auto group with the
model's name, so the shown model collided with its own group and kept
"· Provider" (terra: served by a second provider too, hidden for dsh;
sol: one provider). Models and groups are counted apart now: a model
keeps its suffix only when another model reads the same, and a group
named like anything else keeps "· routing group". Labels feeds every
agent's list, so this holds for all of them.
Not changed: the gateway's usable() still orders a translated request
Chat first and doesn't read BaseAPI (#4508).
Tests (each red on the old code, broken by hand in a worktree on
origin/main: all new cases red; reverting only Native red on the route,
reverting only Labels red on terra's name; the old dsh output reproduced
the report exactly):
- internal/agent TestDshCustomResponsesProvider (new): both models on
magpie-responses, none on magpie, named "GPT-6.1 Sol"/"GPT-6.1 Terra".
- internal/provider native_test: Responses picked beside Chat, Chat
picked, Responses picked for a Claude where Messages is served, and
Responses picked with no Responses URL.
- plainnames/plainown_groups/suffix_mode expectations updated to the rule.
Run on mote, at this change on 7fe191cec (the pushed head is the same
change rebased on a newer origin/main, 6f435677c; not re-run there):
go test -tags nogui -count=1 -timeout 45m ./internal/provider
./internal/agent ./internal/gateway ./internal/cli ./internal/gui:
provider ok 170s, agent ok 303s, gateway ok 797s, cli ok 53s; gui FAIL
TestColdTurnsTaken only (0.00s, a test race untouched by this change,
filed #4510). gofmt -l clean. Still running at push: TestColdTurnsTaken
-count=20 and GOOS=linux/windows go vet ./... on mote, and the test on
origin/main alone.
Not tried: a real dsh session against a real Responses relay; nb5p's
own providers.json (the second provider serving terra is inferred from
the suffix); the GUI suite (no GUI file changed); the full ./... suite.
Tony-ooo's Windows (magpie 0.1.1320): VS Code 1.143 ships a copilot
launcher of its own in <install>\bin\copilot-shim and puts it on the
user's PATH, while the CLI was never installed and ~\.copilot doesn't
exist. magpie ls and magpie agents still said Copilot CLI was installed,
and it showed up as a Library target; renaming the shim folder away made
the row go.
Detected's last resort took any command of the agent's Bin name that
binAt found, and cliBin (what CLI magpie offers to update) took the same
launcher. An Agent may now turn away a command found for its Bin
(binNot, binsOwn). Copilot CLI turns away one an editor keeps, told by
the product.json beside the editor's program (editorLauncher, as
vscodeCodeBinary tells an install). Ported from ggbdpq's patch on the
issue.
Changed from the patch:
- editorLauncher resolves a symlink first and looks in bin's own folder
and the two above it only. The patch walked up to the root, so a
product.json in any folder above (a home, a checkout of an editor's
source) turned away a real CLI under it.
- BinPath and cliHeld (gone.go) go through binsOwn too. BinPath returned
the shim, and cliHeld counted it as the CLI holding ~/.copilot.
- The windows-tagged test is dropped: it wrote into a folder of the real
registry PATH and passed without the fix.
Run at the pushed head (parent 3e5aa1151):
- mote: gofmt -l clean; go vet ./internal/agent for darwin, linux and
windows; go test ./internal/agent -count=1 -timeout 45m: ok (371.2s)
- Windows box (win-run, Go 1.26.8): TestCopilotLauncherFromAnEditorIsNotTheCLI
passes (the symlink row is skipped there), run at this change on
a808c31a7. The whole internal/agent package there has the same 14
reds with and without this change: TestCopilotFolderFromAnIDEPluginIsNotTheCLI and the others
are in #1827, #1388 and #4115 (TestT3CodeCodexInstance added there).
Broken by hand:
- the patch's unbounded walk without EvalSymlinks: the "product.json
four levels up" and "a link to the shim" rows go red.
- binNot: nil: 6 rows go red (detected, cliBin, BinPath for the shim in
each layout).
Not tried: VS Code 1.143 itself on the Windows box, or the reporter's
magpie ls. If the shim comes first on PATH and a real CLI later, Detected
still says not installed; cliBin falls back to proc.FindTool, Detected
doesn't.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
zgjfjfl set Long conversations to "Compact at 544K", and Codex still
compacted every conversation at about 128K. The model is gpt-6-A, with no
context size set on the provider, on v0.1.2281.
Codex 0.165 compacts at min(model_auto_compact_token_limit, 90% of the
window). magpie writes the model's window into the catalog and writes
auto_compact_token_limit only when Long conversations is below that
window. Two things put Codex under 544K, and the row said neither:
- ~/.codex/config.toml's model_context_window or
model_auto_compact_token_limit, at the top or in a profile, which
Codex reads before magpie's catalog. The row now names each key, with
its profile and value, and "Take it out" removes those lines
(agent.CodexCompactHeld, DropCodexCompactHolds,
POST /api/settings/codex-compact-held/drop). Nothing is removed unless
the user clicks.
- The model's own window. gpt-6-A isn't in models.dev, so its window
comes from the provider's own /models list (context_length). A relay
that lists it at 128K makes Codex compact at ~115K, and no Long
conversations value can raise that. The row now names the model Codex
runs (agent.CodexModel, from config.toml's model and the picked
profile) and the window magpie tells Codex, and says a larger one is
set in the provider's Context window (codexWindowUnder).
Which of the two the reporter has is not known: their config.toml and
their relay's list weren't seen.
Run (worktree at origin/main a6951cc63, through mote-run):
- Real Codex 0.165 against a fake Responses server in a sandbox HOME:
config.toml model_context_window = 128000 made it compact at ~115K
with Long conversations at 544K; with the key taken out it didn't.
- go test -tags nogui -run 'TestCodexCompactHeld|TestCodexWindowUnder|
TestCoreScriptBudget|TestI18n' ./internal/agent ./internal/gui: ok.
- go vet -tags nogui for darwin, GOOS=linux and GOOS=windows on
internal/agent and internal/gui: ok. gofmt -l: clean.
- node --test codex-compact-held.test.cjs on the Linux box (wsl-run):
20 of 20 ok, Chromium and WebKit, en/zh/zh-TW/ja/de at 900 and 420px.
On mote Chromium was 10 of 10 ok; mote's Playwright WebKit launch hung
at 180s for every test there, beside another session's full GUI suite.
The first Linux WebKit run was red at 420px in en, ja and de: the test
took scrollTop before Playwright's click scrolled the button into view.
The button is now wheeled into view first (reader.cjs reach), and the
check allows only the browser holding scrollTop under a shorter page.
- i18n-keys.test.cjs: 4 of 4 ok.
- A first GUI run was red in every file: the new block declared `box`
twice in one function (a SyntaxError), so no row drew. Fixed before
this commit. A rerun of codex-async-compact, compact-at and
compact-one-value at this tree was cut short when mote's browsers
stopped launching; codex-async-compact's five Chromium cases had passed
by then. That run was stopped, not finished.
Broken by hand:
- CodexCompactHeld without the profile lookup: its test went red.
- codexWindowUnder forced to nil (`if true ||`): red at line 46.
- CodexModel without the profile lookup: red at line 52.
- The window line turned off (`if (false) hb.append`): codex-compact-held
red in all 10 Chromium cases at the own line's waitFor.
Not tried: a real relay listing gpt-6-A, the reporter's config.toml,
WSL Codex configs, `codex --profile` on the command line, the Codex app.
Core script budget: 1,537,356 -> 1,537,669 for the two lines in Codex's
row, with the comment cut and no room added.
jiabubu on Discord (magpie 0.1.2245, Windows, Kimi Code 2.4.1, Kimi Code
Desktop 1.2.1.0): the Routing page's request list drew Kimi Code's
requests as the grey cube and "kimi-code-cli", and Kimi Code Desktop's as
the cube and "kimi-code-desktop".
The request list, Usage and Sessions already take a client's name and
icon from one table, /api/state's clients (agent.Clients). The drift was
in usage.AgentOf: Kimi Code 2.x sends "kimi-code-cli/…", which matched
neither the kimi agent's "kimicli" prefix nor its "kimi-code" alias, and
Kimi Code Desktop ("kimi-code-desktop/…", its bundle's clientName) had
no entry at all, so both kept their raw product names.
- kimi's UA list takes kimi-code-cli.
- Kimi Code Desktop is a client of its own (agents.go's others). It runs
Kimi Code's engine on ~/.kimi-code, so it is set up through Kimi
Code's row. Its icon is the app's own: the 128px entry of build/icon.ico
in KimiCode-1.2.1-win-x64.exe, the installer winget's
MoonshotAI.KimiCodeDesktop 1.2.1 points to on code.kimi.com (sha256
75111cb6…c312, as the manifest says). Nothing was drawn by hand.
- app.js's pngIcons names it (comment shortened, app.js 5 bytes smaller,
budget untouched); app.css's tile rule names it, as icon-tile measures
it solid to its edges.
- Old records re-resolve through AgentOf, so earlier kimi-code-cli
requests read as Kimi Code too.
Guard: TestEveryClientHasNameAndIcon checks that every client has a
name and an icon file app.js's icon() really loads (a PNG only if
pngIcons names it), and that the ids the gateway records by more than a
User-Agent (claude-desktop, claude-science, cursor-local, codex, magpie)
and kimi / kimi-code-desktop are all clients. The cube is allowed only
for the six clients with no logo yet (ante, pencil, openpencil, newmax,
kirocrew, raft), filed as #4487. routing-client-icons.test.cjs draws the
request list from a history fixture and checks names, data-icon, and that
the desktop PNG loads.
Run (mote unless said):
- Red on the old code: TestAgentOf (got "kimi-code-cli" want "kimi"),
TestEveryClientHasNameAndIcon (kimi-code-desktop not among the
clients); routing-client-icons in Chromium on the old app.js
(0/2, the desktop row is the cube).
- Broken by hand: pngIcons without the entry makes the guard fail ("a PNG
app.js's pngIcons doesn't name, so it is drawn as the cube").
- go test ./internal/agent ./internal/usage ./internal/usageapi: ok.
./internal/gui: ok except the ten real-window AppKit tests killed at
their deadline on mote (#4125, #2645). ok with those skipped, after
the rebase.
- go vet (darwin), GOOS=linux -tags nogui and GOOS=windows vet of
internal/agent and internal/gui: ok. gofmt -l: nothing.
- routing-client-icons: Chromium 2/2 on mote, WebKit 2/2 on Linux
(wsl-run; WebKit launch hangs on mote, #4125).
- routing-*, i18n-keys, icon-tile, mono-icon-redraw and
models-add-and-icons in Chromium on mote and WebKit on Linux: i18n-keys
green. icon-tile caught the missing tile entry (fixed here). The other
Routing reds are still being compared against a fresh origin/main copy
in both engines (running at push time). Any that turns out to be ours
gets a follow-up commit.
Not tried: a real Kimi Code 2.4.1 or Kimi Code Desktop 1.2.1 against
magpie (the UA strings come from their bundles: appName kimi-code-cli,
clientName kimi-code-desktop). Only the Windows installer's icon was
read; the macOS app's wasn't compared. Full Go suite to follow the tag.
jiabubu on Discord (Kimi Code 2.2.0, Windows): Kimi Code's own provider
gives K2.8 Preview and K3.1 Pro the capabilities thinking,
always_thinking, image_in, video_in, tool_use and
dynamically_loaded_tools; through magpie they had thinking, image_in and
tool_use, so Kimi Code offered a thinking switch the models refuse to
turn off, and started K2.8 on high where Kimi's own starts it on max.
Kimi Code 2.4.1's managed provider (packages/oauth managed-kimi-code.ts,
capabilitiesForModel) derives them from /coding/v1/models:
supports_thinking_type "only" -> thinking + always_thinking,
supports_dynamic_tools -> dynamically_loaded_tools, supports_video_in ->
video_in, think_efforts.default_effort -> the default. magpie now reads
the same fields (flat, or nested reasoning.type, tools.dynamic_load,
reasoning.effort.default) into catalog.Model (AlwaysThinks,
DynamicTools, DefaultEffort; kimiFacts), carries them through
provider.Entry and the agent's model list, and the new Kimi Code's table
gets always_thinking, dynamically_loaded_tools and default_effort at the
vendor's default (else high, as before). Only Kimi's list sends these
fields, so another vendor's model is written as before; kimi-cli, which
refuses unknown words, gets none. A routing group has none of them.
default_effort is now recorded in the stash as magpie's (kimiOwn), so a
level the user picked stays while the model has it. A table with high
and no record is read as the high magpie wrote before it kept one, and
becomes the vendor's default (max on K2.8, high on K3/K3.1).
Left out:
- video_in: with type="kimi" Kimi Code uploads a video to
{base_url}/files (purpose=video) and sends the ms:// id. The gateway
has no /files route, and the id belongs to the account that stored it.
Filed as #4485.
- dynamically_loaded_tools works (Kimi Code's tool select is behind
KIMI_CODE_EXPERIMENTAL_TOOL_SELECT): the loaded tools' system message
is lifted into the request's tools (liftMessageTools, #2322), so they
stay callable (TestKimiCodeLoadedToolsReachKimi), but each load
restarts Kimi's prompt cache. Filed as #4486.
- max_output_size: Kimi's own provider writes none; magpie keeps writing
the model's known reply cap (32768 on K2.8 per models.dev), unchanged.
This also covers #3399 (K3.1 offered thinking off): Kimi's list says
"only" for both K3.1 models.
Real list: tests read Kimi's /coding/v1/models reply of 2026-10-31
(internal/catalog/testdata/kimi-code-cn-models-2026-10-31.json, read
with the owner's kimi-code-cn key, no key in the file).
Run (mote, at this commit on origin/main b62fa332f; the agent-wiring.md
line was added after the run, docs only):
- go test -tags nogui -count=1 -timeout 45m ./... : 79 packages ok;
internal/proc (TestNoCommandBypassesProc) and internal/sqlitedb
(TestOnlyThisPackageReachesSQLite) red on a Go module cache my e2e
sandbox had left inside the run folder (vendor files under
e2e-kimi/sb/home/go/pkg/mod); with it removed both ok.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... ok; gofmt -l clean.
- Real Kimi Code 2.4.1 (npm) in a sandbox HOME/KIMI_CODE_HOME on mote,
with a sandbox magpie serve (MAGPIE_ADDR 127.0.0.1:34652), the
kimi-code-cn preset pointed at a fake upstream that serves the real
list: magpie wrote the six tables (K2.8: thinking, always_thinking,
image_in, tool_use, dynamically_loaded_tools, support_efforts low/high/
max, default_effort max; K2.7 Highspeed without
dynamically_loaded_tools), Kimi Code took the config, and `kimi -p`
reached the upstream with thinking enabled and reasoning_effort max
(K2.8) and high (K3.1 Pro).
- Rebased onto 43966a53f..f2eb56c6b (claude, GUI budget, usage; none of
them touch these files) as f5a82f215, then again at this head:
internal/agent, internal/catalog, internal/provider ok, internal/gateway
-run 'Kimi|MessageTools|Lift' ok. The full suite was not rerun there.
Broken by hand, each red then green:
- kimiFacts not called: TestFetchKimiCodeFacts and
TestKimiCodePlanCapabilities red.
- fields not carried in route.go / entryFor: TestKimiCodePlanCapabilities
red.
- the unrecorded-high rule off: TestKimiCodeOldHighBecomesTheVendorsDefault
red.
- always_thinking without the !legacy guard: the kimi-cli case red.
Not tried: the TUI picker by eye (that the thinking switch is gone);
tool select with a real MCP server and the experimental flag; Windows
(the reporter's system; nothing here is OS-specific); a real Kimi
upstream through magpie (the list was real, the chat was a fake).
coolmantou on Discord asked to start an agent from magpie's Agents list.
In the Mac app's window, an agent row's menu (openRowMenu, the one the
grip and a right-click open) now has "Open in terminal". This includes a
row under Not set up. Clicking it posts POST /api/agents/open with only
{agent: id}. The server finds that exact id in agent.Detected() (not
agent.Find's prefix match) and builds the line itself: the agent's
Launch() where it has one (agy, Claude Science, Cursor local), otherwise
its program's path, single-quoted (BinPath, new in internal/agent).
openTerminal then opens that line with the user's Session terminal
choice. The command never comes from the page. Other systems, the web
build, WSL agents and desktop apps with no program are refused, and
their rows have no item (agentJSON.terminal). The tray panel's rows don't
have the item either. The label is "Open in terminal", not "Terminal",
because the user's terminal can be iTerm or Ghostty. The string is in
en, zh, zh-TW, ja and de. Windows and Linux are #4474.
The core budget had 39 bytes left on main, so no budget was raised.
Instead:
- the item says nothing on success; the terminal opening is the answer,
and a failure goes to statusErr;
- the omp roles' comment above OMP_UNSET was cut to what OMP_UNSET's
values don't already say.
app.js is now 22 bytes under main's size.
Run:
- go test ./internal/gui ./internal/agent on mote (macOS) and in
magpie-desktop (Linux, -tags nogui), both ok.
- TestAgentOpenRunsOnlyTheAgent puts claude in a folder named
"it's a' $(touch made1) `touch made2`; touch made3 #". It posts the
ids "claude; touch made4", "claude'$(touch made5)'" and "cl"; none
of them opens anything. It then runs the line made for claude
through /bin/sh and checks that only the program ran.
- After the rebase onto origin/main 2604d68db, the core budget
first went red (1,536,904 > 1,536,586). It passed again after the
trims above, along with TestAgentOpen* and TestAgentCommand*.
- gofmt -l clean. go vet on darwin, GOOS=linux -tags nogui and
GOOS=windows for internal/gui and internal/agent: ok.
- GUI, both engines (wsl-run): agent-open-terminal.test.cjs is new,
14/14 at the pushed tree. It covers every language, a row under Not set up, no item for
the desktop app, the web build or the tray panel, and checks that the
post body is the id only. Its goto has 30s, since a goto while
another suite ran on the box took 5s once. i18n-keys and agent-disconnect pass.
- Real run on mote in a sandbox HOME: the endpoint was called through
the real openTerminal with an `open` on PATH that records instead of
opening. It returned 204, and the open args were -a
/System/Applications/Utilities/Terminal.app <file>. The file was
-rwx------ and read: #!/bin/sh / '<sandbox>/.local/bin/claude' /
exec "${SHELL:-/bin/zsh}" -l.
Broken by hand:
- agentCommand returning the path unquoted: the Go test went red with
"ran more than the agent: [made1 made2 made3]".
- The term item dropped from openRowMenu: the 10 row tests went red.
- The panel and web gates dropped: the 4 gate tests went red.
Not tried:
- No terminal app actually opened. The scratch run recorded what
`open` would get instead.
- iTerm, Ghostty and the other Session terminal choices were not tried.
- Launch() agents (agy, Claude Science, Cursor local) were not opened
for real; their lines were already quoted and used by
"Copy launch command".
- The full Go suite and the whole GUI suite were started before the
rebase and not waited on (ship at once).
chenxiang0010 on Discord asked to keep a provider or a model out of the
auto-created routing groups. A model could already be kept out (remove
its found group; magpie keeps it removed), but a provider could only be
turned off per group or everywhere. Now Routing -> Groups, under "Find
groups on their own", has "Leave out a provider..." (app menu, saved
when it closes) and `magpie group auto skip <provider>...|none`. The
providers chosen (providers.json autoGroupSkip) join no found group; a
group the user made or changed keeps them, a found group left with one
provider goes away, and a request for it is served by AutoStandIn from
a provider still in, and agents on it are reseated (agent.Reseat). A
rename carries the id along. en, zh, zh-TW, ja, de.
Run at 383947fce (this change on origin/main 2ff75161d):
- go test -timeout 45m ./... on mote: 80 packages ok; internal/gui red
only in its real-window AppKit tests (TestDockJoinLeadsCommandTab,
TestPanelCloseHidesIt, TestMainWindowCorners, ...), which fail the same
on fresh origin/main 2f65a33aa on mote (#4125, #2645).
- gofmt -l clean; go vet ./... on Windows (win-run) clean; on Linux
(wsl-run) clean with -tags nogui (the WSL distro has no gtk4).
- GUI: group-found-skip (new) and group-found-off, all five languages,
1100px and 390px, Chromium and WebKit on Linux (wsl-run): 24/24. On
mote every WebKit launch times out (#4125), Chromium 12/12 there.
- The routing files the full run flagged (concurrency 6) rerun alone on
wsl-run, here and at fresh origin/main 380032cda: click-scroll's
WebKit case and group-morph's WebKit 420px cases fail the same on
origin/main. group-duplicate's de case was mine: the found groups'
new "Anbieter ausnehmen..." line made German taller than the test's
420x1200 window, which it assumes needs no scroll; it now uses 1400
and passes 10/10 in both engines.
- Whole GUI suite on wsl-run, concurrency 6: still running at push time
(5092 ok, 170 not ok so far, mostly in files this change doesn't load:
account-*, agent-*, connect-*, gui-de/gui-ja's "{agent}" placeholder
string). They are compared against origin/main after the push.
Broken by hand: foundGroups without unskipped -> TestAutoGroupSkip and
TestGroupsSkip red. Test calls before the fix to groupCmd's args ->
TestGroupAutoSkip red.
Not tried: the real app with real providers; a model-level skip (a
model is kept out by removing its found group, as before).
karissasel_ on X: T3 Code through magpie could only run Claude Code; the
harness couldn't be chosen. T3 runs a thread on the driver of the provider
instance its model is picked under, and magpie wrote only a claudeAgent
instance. It now also writes `magpie-codex` ("magpie · Codex", driver
codex) in ~/.t3/userdata/settings.json. Its config.launchArgs (T3's
CodexSettings key, passed to `codex app-server`, and its -c pairs to
`codex exec`) are Codex's own -c overrides: model_provider=magpie, the
same model_providers.magpie table codex.go writes, and model_catalog_json
pointing at magpie-codex-models.json beside settings.json. Values are
quoted for T3's tokenizeCliArgs. ~/.codex/config.toml is not written. A
binaryPath/homePath the user gave T3's own codex instance is carried over.
The user's name, on/off and unknown keys are kept; launch args and catalog
are magpie's, and Check says when they no longer reach the gateway
(the base_url read back through T3's tokenizer; a reverse proxy to magpie
the user put there counts, reachesMagpie, as for every agent). An
older Claude-only wiring gets the instance once on Sync; one the user
removed stays removed (stash t3code.codex) until magpie is turned on for
T3 again. Turning magpie off removes both instances and the catalog. The
option's note says where to pick (4 languages); reference.md and
agent-wiring.md describe it.
Run (on mote, the tree as committed):
- real end to end, sandbox HOME (~/t3e2e/home): settings written by this
code, magpie serve on 127.0.0.1:47811 with a fake Responses upstream,
T3 Code server 0.1.5 (npm t3) and @openai/codex 0.165.0.
`t3 thread start . "Reply with the word pong." --provider magpie-codex
--model fake/fake-model --wait` answered PONG-T3-CODEX; the upstream saw
POST /v1/responses, model fake-model, stream true, with the provider's
own key (sent by magpie's gateway).
- go test -tags nogui ./internal/agent -count=1 -timeout 45m: ok
- gofmt -l; go vet (darwin, GOOS=linux, GOOS=windows) ./internal/agent
- node --test internal/gui/tests/i18n-keys.test.cjs: ok
Broken by hand, each red then restored: no escaping in t3Arg
(TestT3CodeCodexInstance red); Sync without t3CodexSync (both new tests
red); no stash check (TestT3CodeCodexInstanceAddedOnce red); t3CodexOff
never reporting (TestT3CodeCodexInstance red). The first full run
was red in TestReverseProxyIsStillMagpie, Check comparing the launch
args by string; that red is the break for the proxy rule.
Not tried: T3's desktop app window (the server CLI is what it runs); the
Windows quoting on a Windows box; a real vendor upstream (fake one only);
T3's other drivers (cursor, opencode, pi, grok, ...), which are off by
default in T3 and not wired.
Qyburn3 on X ("为什么我每天好多次要重启"): the Agents row of a Codex
app already connected said 已接入 · 退出并重开 Codex 应用后生效 several
times a day.
Cause: StaleCopies counts a running copy as behind when a digest of
what magpie writes for Codex changed after it started. That digest took
magpie-desktop-models.json byte for byte. Beside the ChatGPT sign-in
(since add927e60) that file holds the ChatGPT backend's entries as
sent (base_instructions, comp_hash, available_in_plans...), asked for
again each hour, and each entry's details follow magpie's version and
models.dev, so a rewrite with the same models moved the digest and the
row asked for a reopen. The same digest drives KeepCodexDaemonCurrent,
so the CLI's app-server daemon was restarted for it too.
Fix: of Codex's two lists (magpie-models.json, magpie-desktop-models.json)
the digest takes which models they hold, slug and visibility in no
order (listedModels), beside the wiring keys and magpie's table as
before. A list that doesn't parse is still taken whole. A digest an older
magpie stashed is kept at its time when it matches the files as they are
(readsBefore), so the update itself doesn't ask every user to reopen
once more. Claude Desktop's reads already hash model ids only. The file
is still written only when its bytes differ (deskList); a running Codex
keeps working on its startup copy, and new details reach it on its next
start.
Run at this head (ccbefe2a2 + this), through mote-run:
- go vet ./internal/agent, GOOS=linux and GOOS=windows: ok
- go test ./internal/agent -count=1 -timeout 45m: ok (147.6s)
- wsl-run go test ./internal/agent -run 'TestCodexStale|TestChangedAt': ok
- the real ~/.codex/magpie-desktop-models.json (35 models) through
listedModels in a throwaway test, with every base_instructions,
priority and comp_hash changed and two entries swapped: same part.
Broken by hand: with the old byte-for-byte reads,
TestCodexStaleNotForAListsDetails is red at "the same models, other
details: 1 stale, want 0"; with the readsBefore carry-over off, red at
"an older magpie's stash, nothing changed since: 1 stale, want 0".
Not tried: a real Codex app beside a real ChatGPT sign-in watched over a
day; whether a list that flips between two model sets (a plugin's
listing failing and coming back) still asks for a reopen each flip (it
does: only the last digest is kept). No GUI change, so no GUI run.
ccdcn on X: in the Codex app, the models of a provider they added
(XJAI's model-code, model-work, model-test) had no reasoning effort to
pick, though the chip said 中. Nothing magpie reads knows those ids, so
their entries in magpie-models.json (and /v1/codex/models) had
supported_reasoning_levels [] and default_reasoning_level null. Codex
then hides the choice but still sends an effort (medium, or
model_reasoning_effort), and the gateway's fitEffort passes an effort on
as asked when a model's levels are unknown, so the effort went out and
couldn't be changed.
provider.CodexEfforts offers low, medium and high for a model whose
levels are wholly unknown. It is used by codexListed (GET
/v1/codex/models, the backend list, spawn models) and by
agent.magpieModels("codex") (the file Codex reads, and magpie's own
Codex effort control). A model known to have no levels keeps none: one
the vendor's catalog or models.dev lists (any provider, any spelling),
one the user marked as taking no reasoning ask, a vendor entry in
Codex's shape, and a routing group.
TestCodexDesktopEfforts' "user's own" now expects medium added to the
user's enabled-reasoning-efforts: its fixture's fake/m1 is such a model.
Run (on mote):
- go test -timeout 45m -count=1 ./internal/provider ./internal/agent
./internal/codexcat: ok
- go test -timeout 45m -count=1 ./internal/gateway ./internal/gui:
gateway ok (615s); gui red only in 10 real-window AppKit tests
(dock, panel, tray, main window), each killed at its deadline. Four of
them run alone on origin/main 024393fbb fail the same way on mote:
#4125 (mote's AppKit/launchd hang). Not run on another Mac.
- GOOS=linux / GOOS=windows go vet ./internal/provider ./internal/agent
./internal/gateway: ok; gofmt -l clean
The runs above were at base d99e213f5. Rebased on 024393fbb, which
changed internal/gateway only; at this head the new tests and every
TestCodex.*Effort test in provider, agent and gateway pass again.
Broken by hand: with codex_models.go and route.go stashed, the new
TestCodexOffersLevelsForUnknownModels and
TestCodexCatalogOffersUnknownModelsLevels fail (offered []).
TestCodexPickedEffortReachesUnknownModel checks each offered level
reaches the vendor as reasoning_effort.
Real Codex: codex-cli 0.165.0 app-server (sandbox CODEX_HOME), model/list
on the catalog codexcat writes for xjai/model-test: before,
supportedReasoningEfforts [] / default none; after, low, medium, high /
default medium.
Not tried: the Codex desktop app with a real XJAI vendor. Not changed:
other agents (OpenCode variants etc.), which send no effort for such a
model today, and groups whose members are all unknown.
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).
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).
7474a86f1 left the map literal's keys aligned to a longer key it no
longer has, so `gofmt -l` named the file on main. gofmt -w only;
whitespace, no test changes.
蛋仔 on Discord wanted the Codex app wholly on magpie, with no ChatGPT
account of its own, and set requires_openai_auth = false in
[model_providers.magpie] by hand. While their ChatGPT sign-in had room,
the next Sync (authStale) set it back to true, and putProvider's
SetTOMLTable replaced the table without it. magpie only ever writes true
or nothing, so a false is the user's: openaiAuth now reports it as not
known (no rewrite, no drift), and putProvider carries it into the table
it writes.
Run (mote, at this head):
- go test ./internal/agent -count=1 (whole package, rebased on 819aad1bc): ok
- GOOS=linux and GOOS=windows go vet ./internal/agent: ok
- Broken by hand (ownNoAuth always false): the new subtest "user's own
false kept" goes red ("used up false: ... kept").
Not tried: the real Codex app with false set (the reporter's case).
2f5a3f1c0 kept a Gemini model on Chat in Pi's models.json (Raft runs
Pi's SDK on it with a fetch pi-ai's Google adapter refuses) and was
pushed before its full suite ended. That suite went red on this test,
which still wanted google-generative-ai at /v1beta in Pi's file. It now
wants Chat there (no api, no baseUrl), and checks the same providers in
OmO's models.json, whose folder is its own: gem/ and hybrid/
gemini-3-flash on google-generative-ai at /v1beta, hybrid/gemini-2.5-pro
and the Gemini routing group on Chat.
Run (mote, at this tree on 2f5a3f1c0):
- Full suite at 2f5a3f1c0's tree (go test -tags nogui ./... -count=1
-timeout 45m): every package ok but internal/agent, red on this test
alone.
- go test -tags nogui ./internal/agent -count=1 -timeout 45m: ok (150s).
- Broken by hand (piAsked back to StepCode alone): this test red on Pi's
two Gemini entries; OmO's part passes either way.
- gofmt -l: nothing.
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.
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.
codexReached keeps its read of Codex's log while the database and its
-wal keep their size and modification time (84210ae7, #1665), for up to
reachedFor (15s). Both tests insert a request into logs_2.sqlite and ask
Drift at once, three or four times over. Two inserts inside one tick of
the file system's clock leave that stamp as it was, so Drift answers
from the read taken before the second insert. On this Linux box (ext4
under /tmp), 317 of 400 back-to-back inserts left a rollback-journal
database's size and time unchanged; in WAL mode 156 of 400 did, once
the -wal had wrapped and was written over in place. Codex's own
logs_2.sqlite here is WAL, with a -wal that stays at 4.4 MB.
On b437e4ad, -count=60 of the two tests:
TestCodexDriftReached red 11 times
applied_test.go:280: elsewhere: &{Kind:bypassed ... Detail:Codex couldn't reach magpie at 09:46 — magpie wasn't running then, ...} (5)
applied_test.go:284: reached magpie: &{Kind:bypassed ... Detail:Codex's last request (09:46) went to chatgpt.com, not magpie — ...} (6)
TestCodexBehindReverseProxy red 2 times
proxy_kept_test.go:293: to chatgpt.com: <nil>
Both tests are older than the memo; before it, each ask opened the log.
These tests are about what Drift says of each kind of request. When the
log is read again is TestCodexReachedReadsLogOnlyWhenItChanged's to
test. So each request they log now drops the kept read
(forgetReached), and the next ask reads the log.
What was run (tree d5c248e9, on b437e4ad):
the tick injected: after each insert, the database's time set back
to what it was before the insert (os.Chtimes), so every insert keeps
the stamp. -count=20 of both tests:
without this change: both red 20 of 20, at the elsewhere check
(applied_test.go:280) and the to chatgpt.com one
(proxy_kept_test.go:293)
with it: ok
-count=200 of TestCodexDriftReached, TestCodexBehindReverseProxy and
TestCodexReachedReadsLogOnlyWhenItChanged: ok
broken by hand, with this change:
codexReachedRead never records a refusal:
applied_test.go:277: refused: <nil>
applied.go's went-elsewhere case off:
applied_test.go:281: elsewhere: <nil>
proxy_kept_test.go:294: to chatgpt.com: <nil>
gofmt -l internal/agent: nothing
GOOS=linux, darwin, windows go vet -tags nogui ./internal/agent: exit 0
full suite, go test -tags nogui -count=1 -timeout 45m ./... (481s):
62 packages ok, the two tests above with them. 14 reds in 7
packages, none in a file this change touches, each red on b437e4ad
without it:
internal/agent TestInstalledVersion, TestHowInstalled,
TestOmpDetectedWithPiDir, TestCopilotFolderFromAnIDEPluginIsNotTheCLI
and TestZedAppPath: proc.Look keeps "not found" for a tool written
in the tick of its folder's last change (#3141). Alone on b437e4ad,
-count=10: TestHowInstalled red 3 times, TestZedAppPath 7.
internal/agent TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: their fixture build under
/tmp meets a /tmp/.git that isn't a repository of this user's
("error obtaining VCS status: exit status 128").
internal/claudebridge TestCallbackGoesPastTheAgentsProxy,
internal/gateway TestClaudeToolCallbackOnANonLoopbackAddress,
internal/gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie: the processes this run started had
their outgoing connections sent through a proxy (graftcp).
internal/edit TestWriteAtomicReadOnlyHardLink and internal/testenv
TestProgram: umask 077 here; the fixtures' own modes go through it
(0444 is written as 0400).
internal/netproxy TestBunProxyLoginWithReservedCharacters: Bun
1.3.11 on PATH names port 80 in the request line (#3397).
Not changed:
- The memo. In the app, a request Codex logs inside the tick of
magpie's last read (a connect and its refusal one after the other)
can reach Drift up to reachedFor late, which the memo allows for
already. A settle window like filememo's or codex_list_tag's would
see it at once, at the cost of a read per ask just after each of
Codex's writes, the reads #1665 took out.
- The fixtures' journal mode. A WAL fixture would pass these tests
only while its -wal grows, which stops once it wraps.
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.
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout build a fake reasonix with go
build inside t.TempDir(). go build stamps VCS info by default: it looks
for a folder named .git above the fixture's module and runs git there,
and when that .git is no repository git will open (empty, as here, or
unreadable), git exits 128 and the build fails ("error obtaining VCS
status: exit status 128"). On this box /tmp/.git is an empty folder
owned by nobody, and git there says "not a git repository", so both
were red in every full run here that got that far.
Both builds now pass -buildvcs=false. reasonixCLI reads only the build
info's package path (info.Path, reasonix/cmd/reasonix), which the flag
doesn't touch. With no .git above, as on CI, the fixture is byte for
byte the same with and without the flag. No other test builds a package
with go: goose_test.go builds a single file, which go doesn't stamp,
and gui's `go mod download` builds nothing. The same /tmp/.git turns
gateway's TestPluginToldWhereTheAgentWorks red another way, through
provider.GitOnDisk (#3675), which this doesn't change.
What was run (tree 9ef1c9ee, on origin/main 01468003, go1.26.8):
- TMPDIR under an empty .git (mode 0700, mine), under a .git with mode
000, and TMPDIR=/tmp (the box's /tmp/.git), -count=3 each: on
01468003 both red at their build every time ("error obtaining VCS
status: exit status 128"); with the change ok, 3 of 3 each. With no
.git above, ok on both.
- TestGooseDetectSkipsGoGoose under the empty .git: ok, 3 of 3, its
build run, not skipped.
- The fixture built in a folder with no .git above, with and without
the flag: `go version -m` prints the same (path reasonix/cmd/reasonix,
no vcs lines), and cmp finds the two binaries identical.
- gofmt -l . clean; GOOS=linux, windows and darwin go vet -tags nogui
./... and GOOS=windows go vet ./... without the tag: exit 0 each. go
build not run: the change is in a _test.go file.
- Full suite outside graftcp (systemd-run, umask 077, Bun 1.4.2 first
on PATH as on CI, -timeout 45m, log kept): 65 ok, 6 red, the Reasonix
pair not among them:
- provider: #3632's fatal error, which 01468003 has.
- agent TestInstalledVersion, TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath: #3141.
- edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram: this
box's umask 077, #3640.
- gateway TestPluginToldWhereTheAgentWorks: the same /tmp/.git,
through provider.GitOnDisk, which takes any .git for a repository:
#3675.
- gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
#3649.
Not tried: Windows and macOS, where the flag does the same; and a .git
that is another user's repository (git's "dubious ownership"), which
needs a second user here.
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.
registry.json's `icon` can be an https URL: Kilo Code
(https://github.com/Kilo-Org.png), Search1API (https://s1.dev/icon.png),
PowerContext (a raw.githubusercontent SVG) and GoAnyAPI
(https://goanyapi.com/logo.png). It reached the page as it was, and app.js
icon() took any name for a bundled file (icons/<url>.svg), so the Discover
card, the plugin's page and Kilo's agent row showed the generic cube.
A market picture now goes through the path a plugin's own picture already
takes (pluginOwnIcon / RepoIcons). Only a public https host is fetched,
the size is capped, and the file is kept as file:<hash> and served from
/api/icons. The page never loads a remote URL. Until the picture is in,
the icon is "", which the page draws as the cube.
- provider.MarketIcon / MarketPicture. PluginIcon (installed plugins)
uses them.
- agent pluggedIcon (an agent plugin's row, which is Kilo's case) uses
them too.
- gui listingIcons: /api/plugins/listings and /api/plugins/market keep
the market's picture icons and the npm icons in one RepoIcons call
(the market waits up to 3s, the listings don't wait). The market's own
slice is not changed.
- app.js icon(): a name with ':' or '/' that isn't file:/data: is drawn
as the cube, never asked for as icons/<url>.svg. A kept picture that
fails to load already falls back to the cube through the img's onerror.
app.js stays under its budget: two comments were shortened, with no
raise.
Tests:
- TestMarketIconURLKept (provider): an https icon becomes file: and is
fetched once, a bundled name is unchanged, and http:// is refused.
- TestRegistryIconPictureKept (gui): listings give file: for a data:
icon, keep a bundled name, and give "" for javascript:. The market's
listing is not mutated.
- plugin-registry-icon.test.cjs: Chromium and WebKit, en/zh/zh-TW/ja/de
at 980 and 420. A kept picture is drawn on the card and on its page. A
URL shows the cube. A 404 picture shows the cube, not a blank. A bundled
icon stays bundled. Nothing is asked of another host.
What was run:
- Before the rebase (mote):
- focused Go tests: ok.
- plugin-registry-icon: 22/22.
- real use, sandbox HOME, the four real registry URLs: each fetched
and kept as file: (Kilo png 1455 B, s1 png 4426 B, PowerContext svg
40309 B, goanyapi png 21878 B).
- At the rebased fix (on dca3e2d71), on mote:
- go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok.
- Linux and Windows builds: ok. gofmt clean.
- go test -tags nogui -count=1 -timeout 45m: internal/gui, provider,
agent and plugin all ok.
- GUI on mote: the 58 Plugins-page files were run twice. Both runs were
red by browsers crashing or failing to launch (#4125: pboard crashes,
SEGV, newContext "browser has been closed"). origin/main's
agent-plugin-agents fails the same way there.
- GUI on the Linux box (wsl-run), at this head:
- plugin-registry-icon, icon-tile, i18n-keys and plugin-card-update:
ok, except plugin-card-update in WebKit, which is red the same at
origin/main 46fb0c1b9 (#3079, commented).
- plugin-registry-icon was first red there in WebKit: the Discover
list is drawn again as the market comes in, so a card could detach
mid-scroll. The test's scroll now looks again; it passes 20/20 in
both engines.
- The Chromium reds plugin-github (80 -> 79) and plugin-move-unserved
(Model 1) are red the same at origin/main 46fb0c1b9 (#3218,
#4410/#4392).
Broken by hand:
- MarketIcon returning its input made both Go tests red. The listing
gave the raw data URI and javascript:alert(1), and PluginIcon gave the
https URL.
- Without the app.js guard, plugin-registry-icon was 0/22: it asked
for http://magpie.test/icons/https://s1.dev/icon.png.svg.
Not run yet: the whole GUI suite, the full go test ./..., Windows test
runs and the real GUI app. They run after the push, and each red gets
its own issue.
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.
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.
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).