JackyCcao on X turned birthday masking off (old dates in logs and tasks
after a birthday's word were still taken) and put their own birthday in
Masked words instead. A word matched only as typed, so 1990-05-12 let
1990/5/12, 1990.05.12, 1990年5月12日 and 19900512 go as written.
A masked word that is all of a date (dateword.go: year-month-day with
- / . 、 or a space, 年月日 or 년월일, a month's English name, or
day/month/year where only one reading is a date) now matches that
calendar date in each of those forms, with or without leading zeros,
as eight digits, and day-first or month-first only where the day is
over 12 or equals the month: for 1990-05-12 neither 05/12/1990 nor
12/05/1990, which reads as December 5th too. A word like 05/12/1990
is no date and matches only as written. Eight digits alone are not
taken for a date word (as likely an id) and match as before. A date
match never has a digit, or a dot and a digit, beside it, whatever
Whole words only says, so 1990.5.12.1, 3.1990.5.12 and 11990-05-12
are no match; this is a change for a date word without Whole words,
which matched inside such numbers before.
The birthday rule is not changed. It takes a date only right after a
birthday's word (生日, DOB, born...), so a log line's, a file name's
or a task's own date is never one, however old. What is left (生日:
2019-03-02 in a task log about a party) has the same shape as a real
date of birth, and a time beside the date doesn't tell them apart: a
date of birth stored as a time (1990-05-11T16:00:00.000Z, midnight in
UTC+8, as JavaScript writes it) is the commonest way one reaches an
agent in JSON. TestBirthdayLogDates pins both sides; #3878 tracks
fixed-shape false alarms.
Tests: TestDateWordEveryForm (22 forms x 5 words x 6 contexts, each
restored as written), TestDateWordDayMonthOrder, TestDateWordNotAnotherDate
(another date, 1990.5.12.1, longer numbers), TestDateWordOnlyADate.
Broken by hand: with the dateSpans hook in mask turned off, EveryForm,
DayMonthOrder and NotAnotherDate fail; OnlyADate and BirthdayLogDates
pin behaviour that was already right and pass on both.
Docs: gateway-routing.md, masking.html en/zh/ja.
Run on origin/main 94c2aaecb, sandbox HOME and GOCACHE, then rebased
onto 841bcf8da (its changes are in usage and gateway/history.go, none
in redact) and the vet and the four packages run again there; on e056779a6
(a GUI change, nothing in redact) redact, masking and settings again:
- gofmt -l clean; go vet clean on macOS, GOOS=linux -tags nogui and
GOOS=windows (internal/redact).
- go test -count=1 ./internal/redact/... ./internal/masking/...
./internal/pii/... ./internal/settings/...: ok. The date tests also
with TZ=UTC and TZ=Pacific/Kiritimati: ok.
- go test -count=1 -timeout 100m ./internal/gateway (at 94c2aaecb):
every test ok
but TestPluginToldWhereTheAgentWorks, which failed only because the
run's TMPDIR was inside this git worktree (its "not in a repo"
folder was in one, git "yes"). Run alone with TMPDIR outside the
repo it is ok; with TMPDIR inside it fails at this head too.
Not run: the full ./... suite (another session's full suite holds the
machine, load ~100-140). No GUI asset changed, so no GUI run.
jiakun_zhao on X ran `magpie web` in a terminal beside the desktop app,
to manage it through a Cloudflare tunnel. Settings › Network and sharing ›
Browser access now has the app serve the same page itself: Off, This
computer (127.0.0.1, for a tunnel or SSH forward) or Local network.
Access is magpie web's, unchanged: the key in the link is traded for the
cookie (webGuard), the allow list holds, and the gateway's client routes
on the page's port need a gateway key (onePort). A rebound Host and
Origin: null get no cookie. There is no way to serve it without the key.
The key and choice live in web-page.json (0600) beside settings.json, so
a sync never carries them. GET/POST /api/web-page are the app windows'
alone: a browser on the page can't read the key or turn the page off. A
busy port (magpie web, the magpie before an update) is tried every 4s;
`magpie web` on the same port opens the app's link instead.
Run at d43b7c40d (this change on ef155a5ca), then rebased onto the four
newer main commits, which touch gateway, usage, proc and library only:
- gofmt -l internal/gui internal/cli: nothing. go vet, GOOS=linux go vet
-tags nogui and GOOS=windows go vet of internal/gui and internal/cli:
clean. go build: ok.
- go test -timeout 45m ./internal/gui/ ./internal/cli/: ok (180s, 70s).
- GUI, alone: browser-access.test.cjs and model-test-one.test.cjs pass in
both engines; i18n-keys 23 of 24, its red is #3897 ("Runs as" from
7f827b3b0), not this change. agent-stale-copies.test.cjs 80 of 80 at
8d343a811 (this change before the rebase).
- Full GUI suite at 8d343a811: cut short. The disk filled (708MB free):
browsers failed to launch with ENOSPC in agent-stale-copies, which then
passed 80 of 80 alone, and node ended with exit 7 before the rest of
the files ran. There is no full GUI record for this change.
Not tried: a real Cloudflare tunnel to the page, and Local network from
another machine.
jzing.draw (Discord #general, 10-27) had a Usage row for Qoder's free
Qwen model, sent as qfmodel, tagged "actual Qwen3.8-Flash". Since
plugins#412/#413 (qoder 0.2.38) the plugin answers under the model list's
display name, and Qoder's list names qfmodel Qwen3.8-Flash, so it is the
model asked for. Swapped compares names alone and can't know that.
usage.ListedAs(provider, model, served) reads the provider's own list
(Provider.Available, once a minute per provider, only once a reply already
reads as swapped) and holds when served is the name it gives the model,
spelled however (SameSpelled). Every place a swap is set or read again
asks it: the gateway's try, the ledger and request-page rows, block
pricing, a kept row read back (request_page unpack) and a kept route
(history routedAgain), so old rows lose the false tag too.
Run at this tree (base ca8a6f346):
- go vet ./internal/usage ./internal/gateway on darwin, linux (nogui)
and windows; gofmt -l clean
- go test -count=1 -timeout 45m -p 1 ./internal/usage ./internal/gateway:
usage ok 146s, gateway ok 887s
- the new tests (TestListedNameIsTheModelAskedFor, TestListedNamesReadOnceAMinute,
TestKeptRowListedNameNotSwapped, TestBlockPricerListedNameNotSwapped,
TestRouteKeptListedNameNotSwapped) pass
Broken by hand: with the call sites put back (served.go's ListedAs kept),
TestKeptRowListedNameNotSwapped, TestBlockPricerListedNameNotSwapped and
TestRouteKeptListedNameNotSwapped fail.
Real use: a binary built from this tree, under a sandbox HOME holding a
copy of the owner's ~/.config/magpie, reads the real Qoder list:
qoder/qfmodel answered as Qwen3.8-Flash and dmodel as DeepSeek-V4-Pro are
listed (not swaps), qfmodel answered as GLM-5.3 is not.
Not tried: a live gateway call through the Qoder plugin; the full
go test ./... (other packages don't call ListedAs); the gateway try's line has no test of its own beyond the kept-route
read, which uses the same ListedAs.
The Codex app restart on Windows (df8374921, 3aead9c62) ends codex.exe
app-server through proc.End, which was TerminateProcess on codex.exe
alone. Where SIGTERM lets Codex end its own MCP servers, TerminateProcess
does not, so node.exe under npx, uvx and the rest were left running with
no parent, one more set each restart (liam_8829, 10-27).
End now lists pid's descendants while it is alive (killtree_windows.go's
descendants, the walk cancelTree already uses), ends pid with exit code 0
as before (the app reads 0 as a clean exit and starts it again), then
TerminateProcess's each descendant. Unix is unchanged (endTree = end).
Run:
- TestEndEndsWhatItStarted (new, Windows): cmd.exe /c ping -n 60; End(cmd)
must leave cmd exited 0 and the ping gone. On the Windows box
(10.0.0.132): the old proc test binary fails it ("process 52016 ...
still runs after End"), the new one passes.
- The whole proc package on the Windows box (TestNoCommandBypassesProc
skipped: it walks the source from the cwd): only
TestCombinedOutputOwnRuns and TestCombinedOutputOwnContext red, which
need /bin/sh and fail the same on the old binary.
- go test -count=1 -timeout 45m ./internal/library ./internal/proc
./internal/provider:
library ok (312s), proc ok (40s) at b67c7eaa0 (rebased on origin/main
14e4d8040). provider red only in tests already filed: with
-skip TestUnreadLoginsWriteErrorsKeepCredentials (the synctest crash in
filememo.Forget, #3632, on main since 091153bf), its only reds are
TestFetchAsksOneListOnceForTwoBasesOfIt, TestFetchUnionsProtocolLists-
WithoutChat and TestFetchAsksASharedBaseOnce (#3854, on main since
6eb510f78). Neither touches this change.
- gofmt -l internal/ clean; go vet darwin, GOOS=linux -tags nogui,
GOOS=windows on library, proc and provider.
Not tried: the real Codex app on Windows with real MCP servers under it.
MCP servers codex.exe itself loses while it runs are Codex's own.
liam_8829 (Discord #feedback, 10-27) turned every MCP server off and found
opencode.json still holding a "servers" node with no type and no enabled.
That node is OpenCode 2's own container: 2.x writes servers to
mcp.servers.<name> (opencode mcp add --global does), still reads V1
mcp.<name> beside it, and V2 wins a name clash. magpie read every child of
mcp as a server, so it listed "servers" as a typeless server, never saw the
servers inside it (so it could not turn them off), and wrote its own as V1
mcp.<name> beside them.
Now, for the OpenCode format (opencode.json, a project's opencode.json,
and the targets sharing that format):
- mcp.servers is read as the container when it has no type/command/url of
its own, and its entries are servers;
- a server is written where it already is, or to mcp.servers when the file
uses that layout; a V2 entry gets no "enabled" (OpenCode 2 drops it; the
field there is "disabled");
- removing a server removes it from where it is, V1 or V2, never the
container. Turning everything off leaves {"mcp":{"servers":{}}} plus the
user's own entries, byte for byte.
Run:
- TestOpenCode2Servers (new): red on the old code ("found [mine]"); red
with del's fix taken out ("ctx7 ... still in"); red with the enabled drop
taken out ("an OpenCode 2 server has no enabled"); green with the fix.
- Real OpenCode 2.0.25 in a sandbox XDG_CONFIG_HOME, `opencode debug
config`: the written file (V1 mine + servers{gh, own}) resolves every
server; {"mcp":{"servers":{}}} resolves to no mcp, no error.
- go test -count=1 -timeout 45m ./internal/library ./internal/proc
./internal/provider:
library ok (312s), proc ok (40s) at b67c7eaa0 (rebased on origin/main
14e4d8040). provider red only in tests already filed: with
-skip TestUnreadLoginsWriteErrorsKeepCredentials (the synctest crash in
filememo.Forget, #3632, on main since 091153bf), its only reds are
TestFetchAsksOneListOnceForTwoBasesOfIt, TestFetchUnionsProtocolLists-
WithoutChat and TestFetchAsksASharedBaseOnce (#3854, on main since
6eb510f78). Neither touches this change.
- gofmt -l internal/ clean; go vet darwin, GOOS=linux -tags nogui,
GOOS=windows on library, proc and provider.
Siblings: Codex config.toml and Claude .claude.json emptied correctly in
the same repro; ZCode already writes mcp.servers; Crush is V1 mcp.
Not tried: a real OpenCode TUI session; the project opencode.json and the
deveco/mimocode targets were not tested on their own (they share the same
entries/put/del); the full ./... suite was not run.
Kimi (a sponsor) reported: "伙伴卡编辑器默认区为 China,建议按用户区域分流".
A partner given only by regions started at its first one, and Kimi
Code's partner card lists China first, so a user abroad was offered the
China plan's endpoints, key page and catalog.
Now, when a partner's first region is China's or Global's and the other
is listed too, a new provider of it starts at the one where the user is:
China's in mainland China, Global's elsewhere. The place is read from
this computer's time zone: LocalZone ($TZ, /etc/localtime) on macOS and
Linux, the registry's TimeZoneKeyName on Windows. Asia/Shanghai,
Asia/Urumqi and their old names (Chongqing, Harbin, Kashgar, PRC) and
Windows' "China Standard Time" are mainland China; Hong Kong, Macau and
Taipei have zones of their own and get Global. Windows' China Standard
Time also covers Hong Kong, which Windows doesn't tell apart. A zone
that can't be read keeps the partner's first region, as before.
It is decided in validPartners, where the partner's default endpoints
are filled in, so every add path takes it: the GUI editor (its region
picker marks the region at the preset's endpoints, and Get a key and the
site link follow), the TUI's and CLI's add (FromPreset). The default
region's key page, site, siteHost and catalog become the preset's with
its endpoints, as atRegionOf does for a provider.
Which regions count: only one with id cn/china/global/intl or named
China, China Mainland, Mainland China, Global or International. Checked
against each partner in site/partners.js: Kimi (China, Global, "Pay as
you go · China", "Pay as you go · Global") switches between its two
plans only; APIKEY.FAN (Default, Direct) gives its own top-level
endpoints, so no region is defaulted; WandAPI, CoreCode, Sidrune and
FastAIToken have no regions. yylx (a built-in preset, not a partner)
lists Auto first and would stay at Auto anyway.
Providers already added keep their region: a provider stores its own
endpoints when it is added, and its region is read from them
(regionOf), so a user who moves keeps theirs. The list kept on disk
from before is fixed at the next fetch, which runs at start.
Tests:
- TestPartnerStartsAtTheUsersRegion, from usemagpie.ai/api/partners as
served on 2026-10-27 (testdata/partners-2026-10-27.json): abroad Kimi
Code starts at api.kimi.ai, keys /go/kimi/keys/global, site host
www.kimi.ai, catalog kimi-code-plan-global; in China and with no zone
at api.kimi.com and China's; a provider added in China stays there
after the user is abroad and the list is fetched again; APIKEY.FAN
starts at its own endpoints either way.
- TestHomeRegion: Kimi's four regions, yylx's Auto first, Global first,
plans only, no Global; chinaZone for Shanghai, Urumqi, PRC, China
Standard Time, Hong Kong, Taipei, Singapore, New York, UTC and "".
- Broken by hand: with the region back at p.Regions[0], the test fails
"abroad: a new Kimi Code provider is at {chat:https://api.kimi.com/
coding/v1 … catalog:kimi-code-plan-cn}, want {… api.kimi.ai …
kimi-code-plan-global}" and "the preset's endpoints … aren't its home
region's". With the key page/site/catalog line dropped, it fails on
keys https://usemagpie.ai/go/kimi/keys (not …/keys/cn) in China.
- go test -tags nogui -count=1 -timeout 45m ./internal/provider
./internal/cli ./internal/tui at 56de2d192 + these two commits: cli
ok, tui ok. internal/provider has three reds that are already on
main, and they fail the same way at origin/main 14e4d8040, just
fetched, run alone -count=3: TestFetchAsksASharedBaseOnce,
TestFetchAsksOneListOnceForTwoBasesOfIt and
TestFetchUnionsProtocolListsWithoutChat (#3854). The first run, with
nothing skipped, also crashed in TestUnreadLoginsWriteErrorsKeepCredentials
("close of synctest channel from outside bubble", #3632, red on main),
so the second run skipped that one test. No full ./... run: the
machine's disk was full (ENOSPC) from other sessions' caches.
- go build; GOOS=linux go build -tags nogui; GOOS=windows go build.
- Rebased onto 14e4d8040 (45 files changed on main since 56de2d192,
none of them these): go build, go vet ./internal/provider and
-run 'TestPartner|TestHomeRegion|TestPreset' ./internal/provider ok
at the pushed head; the package run above was not repeated there.
- gofmt -l: nothing; go vet, GOOS=linux go vet -tags nogui and
GOOS=windows go vet on internal/provider: clean; GOOS=windows go build.
Not tried: the Windows registry read on a real Windows machine (the
Windows box didn't answer ssh); the GUI editor with a real partner list
in a sandbox; the GUI suite (no file under internal/gui changed).
Kimi (a sponsor) asked for referral tracking on magpie's Kimi entry
points. The four built-in Kimi presets now send "Get a key" and the
editor's site link to Kimi's own pages with aff=magpie:
- moonshot (Kimi, pay as you go, Global):
platform.kimi.ai?aff=magpie, platform.kimi.ai/console/api-keys?aff=magpie
- moonshot-cn (Kimi (China)):
platform.kimi.com?aff=magpie, platform.kimi.com/console/api-keys?aff=magpie
- kimi-code (Kimi Code, Global):
www.kimi.ai/code?aff=magpie, www.kimi.ai/code/console?aff=magpie
(was www.kimi.com, the China site, for both)
- kimi-code-cn (Kimi Code (China)):
www.kimi.com/code?aff=magpie, www.kimi.com/code/console?aff=magpie
Endpoints (api.moonshot.*, api.kimi.*) are unchanged. The partner card
(site/partners.js "kimi") already had aff=magpie and is untouched.
What happens to providers added before: a provider keeps the Website
and KeysURL it was saved with, so an already-added Kimi provider's own
"Get a key" link (shown only while it has no key) stays the old page.
The editor's site link for a preset without regions reads the preset's,
so it shows the new one. Rewriting saved links was left out on purpose:
a saved value may be the user's own (keys=/website= in the CLI).
Run:
- curl -sIL of each of the eight new URLs: all 200, no redirect
(platform.kimi.com/.ai, their /console/api-keys, www.kimi.com/.ai/code
and /code/console, each with ?aff=magpie).
- The editor's link label is hostOf(url), the host only: platform.kimi.ai,
platform.kimi.com, www.kimi.ai, www.kimi.com, no query shown.
- git grep for the old URLs (platform.moonshot.*, www.kimi.com/code*):
no test, doc, site page, i18n string or TUI text pins them; nothing
treats these links specially (only models.go comments cite kimi docs).
- go test ./internal/provider: see the next commit's record (run with it).
Not tried: opening the links from the real app's editor.
ysm119 on Discord, after 0.2.25: claude-haiku-5-5-thinking still failed.
A Team account's picker has Claude Haiku 5.5 with thinking as its
default while cursor-agent lists only claude-haiku-5-5; 0.2.26
(plugins df4dfcd) sends each Haiku id as the id the account lists.
npm view --prefer-online says 0.2.26 at landing.
Run on origin/main a312bf3e3 (since rebased onto 14e4d8040, no shared files;
vet, budget and this change's tests ok again there),
set -o pipefail, -timeout 45m, logs tee'd: internal/plugin,
internal/probelog and internal/gui ok; internal/provider ok but for
TestFetchAsksASharedBaseOnce and its two siblings, red 4 of 4 on
origin/main 14e4d8040 too (#3854), and with
TestUnreadLoginsWriteErrorsKeepCredentials skipped (synctest crash,
#3632). GUI: model-test-one, model-test-why, models-works-only,
provider-typed, extra-body and i18n-keys, 44 pass in both engines.
Not tried: a real Team account of that shape, or a real failing Test
viewed on the Requests page.
ysm119 on Discord: "{all} 个模型中有 {n} 个没有响应", the error only in a
dot's hover title. The status now says the first failed model and its
error, as a single model's test already did. New string in en, zh, zh-TW, ja and de; the old
one, now unused, is gone.
app.js grows 140 bytes for it: appScriptBudget 1,310,129 -> 1,310,269
and coreScriptBudget 1,526,251 -> 1,526,391, no room added, the reason
in core_budget_test.go (ad3833512 had just lowered them to the bytes).
Run: go test ./internal/gui -count=1 -timeout 45m (with the rest of
this push); model-test-one, model-test-why, models-works-only, provider-typed,
extra-body and i18n-keys, Chromium and WebKit (44 pass, 0 fail).
Broken by hand: with app.js as before, model-test-one is red in both
languages.
Not tried: the real app's editor against a real failing provider.
ysm119 on Discord: claude-haiku-5-5-thinking's Test "didn't answer", and
the request log had nothing to say why. Provider.Do wrote a Test's row
with the status alone, so a refusal's row had no text, and a stream that
failed after its 200 was written as a plain 200. probe now writes its
own rows (the request is Taken, so Do and the transport don't): each
try, a retry's too, as before, and the last one with the test's result,
the vendor's error or the stream's.
Run: go test ./internal/provider ./internal/probelog ./internal/usage
./internal/gui -count=1 -timeout 45m (see the log at the push), gofmt
-l, GOOS=linux and GOOS=windows go vet.
Broken by hand: with test.go as before, TestFailedModelTestIsWrittenWithItsError
is red (both failed rows' error "").
Not tried: a real plugin's failed Test read back on the Requests page.
ysm119 on Discord tested Cursor's claude-haiku-5-5-thinking a quarter of
an hour after plugin 0.2.25 was published and magpie updated. CheckUpdates
(30s after start, then hourly) read npm's versions through Info, which
asks npm at most hourly and otherwise answers from its disk cache, so a
magpie started after a community fix was published could find the
version before it and update nothing for up to another hour (two in all
for the hourly look). latestOf now asks npm of every installed package
(infoWithin, age 0); the plugins page keeps Info's hourly cache, and a
package npm doesn't answer for is still what it said last.
Run: go test ./internal/plugin -count=1 -timeout 45m (ok, 305s).
Broken by hand: latestOf back on Info, TestUpdateCheckAsksNPMNow is red
(the check saw 1.2.3 while npm had 1.2.4).
Not tried: a real magpie restart against npm's registry.
max2020 (Discord #help, 10-27): "为什么反重力这里没有额度的预测和对价格的预估".
An Antigravity card's rows are its pools' windows (Gemini · 5 hours,
Claude & GPT · 7 days …). They are Aside, since routing reads the
models' own windows, and the models' windows are a Family's. So:
- quota history (pointOf) kept none of them. The card had no curve and
no "Runs out … at this pace" line, though noteQuotaHistory and the
GUI already name a pool's line "Pool · window" (9ccabdfbd said pools
are kept; the Aside check left them out from the start).
- holdsBounds left every Family, Pool and Aside window out, so no
"Whole ≈ N tokens · ≈ $X" and not even "not enough data".
Now a pool's own window (Pool set, no Family: QuotaWindow.PoolWindow)
is kept in the history under LineName ("Gemini · 5 hours") and has its
whole reckoned. It counts the calls to its own models (CountsIn): the
per-model windows given its pool, else, for a pool read with only its
week (a Starter plan, whose models get no pool), the families its name
says and no other pool took (PoolMembers). A model asked for by its
family's id (gemini-3.8-flash) counts toward its levels' windows.
withRecordedWindowStarts finds a pool's line by the same name. The
models' own windows, and a pool with no models known, are still not
told. Dry runs still skip pools: one pool spent says nothing about a
call to another pool's model.
Run (at a312bf3e3 + this change):
- TestQuotaHistoryKeepsAntigravityPools and
TestWindowHoldsReckonsAntigravityPools (new).
- go test ./internal/provider ./internal/usage ./internal/gui
./internal/cli, skipping #3632's and #3854's tests: usage, cli and
gui ok. provider's first run hit a full disk (ENOSPC in TempDir); its
26 failed tests were all TempDir/mkdir "no space left", rerun by name
with room: ok. Every other provider test passed in the first run.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
- Rebased on 28f3c4d7f (8 files of provider/usage changed upstream): both new
tests, go test ./internal/usage ok, vet darwin/linux nogui/windows ok.
- app.js is unchanged (it already looks the pool lines up), so no GUI run.
Broken by hand:
- pointOf back to skipping every Aside window: the history test is red
("histories = []").
- holdsBounds without the pool case: the holds test is red ("no whole
reckoned").
- Counts in place of CountsIn: the pool counts every call of the
account (530000 tokens, want 10000).
Not tried:
- a real Antigravity account. The owner's kept card is a Starter plan
with 0% used on Gemini and 100% on Claude & GPT, so its 7-day pools
would read "not enough data" until 5% is used.
- A forecast needs 3 readings over an hour of the current cycle.
- Antigravity's level ids (gemini-3.1-pro-high, claude-opus-4-6-thinking,
gemini-3.8-flash-tiered) have no API price in models.dev. A pool with
such calls tells tokens with no $ ("some models have no API price").
- Past cycles (HistoricalWindowHolds) still leave pools out, since a kept
card has no model ids to count by.
laddieyao (Discord #general, 10-27): with Codex joined to magpie beside
its ChatGPT sign-in, the Codex desktop app's model picker showed OpenAI's
GPT models alone, while the Codex CLI listed magpie's. The /models
request does reach magpie's gateway and its answer holds magpie's
models. ChatGPT.app 26.1013's picker then narrows app-server model/list
to the models a Statsig config (107580212, use_hidden_models /
available_models) names, while Codex is on its built-in provider, unless
Codex reads its list from a file (model_catalog_json,
hasConfiguredModelCatalog) or names a provider of its own. The CLI has
no such filter.
Where the Codex app is installed (codexReaders has an "app"), and only
joined/beside the sign-in (not magpie as Codex's provider, not account
failover alone), magpie writes the list it hands Codex at
/backend-api/codex/models to ~/.codex/magpie-desktop-models.json and
names it with model_catalog_json. Codex is still on its built-in
provider. With a catalog named Codex asks for no list, so magpie asks
the backend itself, with Codex's live sign-in (provider.CodexLiveList):
its entries go in verbatim, base_instructions and all, merged as the
gateway merges them (codexMerged, factored out of codexModels: picked,
hidden, window, V1, AutoReview edits), magpie's models after them.
- A list not known (not asked yet, or the backend failing) is unknown:
the file as it was stays, never an empty list; a key naming a file
that is gone goes, as Codex loads no config then.
- Written via temp+rename at Join, set, settle and every Sync (so a
change of magpie's models, picks or hidden models rewrites it, as
SyncCatalog runs on them); the backend list is asked again hourly
(5 min after a failure) and a change syncs again.
- A model_catalog_json of the user's own stands; none is written beside.
- magpie API, the app gone, or unwire take the key and the file out;
unroute never restores the desk file as the user's catalog.
- connectinfo counts the file, so a running app on an old list reads
as needing a restart.
- CLI-only machines: unchanged, the live /models path as before.
Run:
- Real account, sandbox HOME (copy of auth.json, chatgpt Pro; live
~/.codex untouched): Join wrote model_catalog_json and the file with
the real backend's 10 entries (gpt-6.1-sol ... codex-auto-review, each
with base_instructions) plus relay/claude-opus-5.5 and
relay/claude-sonnet-4-5. Then the real app-server bundled in
ChatGPT.app (codex 0.163.0-alpha.10.2, CODEX_HOME sandbox, base URL
pointed at a dead port) model/list returned all 12, relay models
visible, and config/read showed model_catalog_json set, which is what
the app's picker checks to skip its filter.
- New tests: TestCodexDesktopListBesideSignIn, ...CLIOnly,
...KeepsTheirs (internal/agent), TestCodexDesktopCatalog
(internal/gateway).
- Broken by hand, each went red: deskList a no-op (all three agent
tests), the user's-own branch removed (KeepsTheirs), the gone-file
branch removed (KeepsTheirs), the keep-last-good rule broken in
codexDeskRefresh (TestCodexDesktopCatalog).
- go test -tags nogui -timeout 45m ./internal/agent ./internal/gateway
./internal/provider ./internal/cli at bc0a99bb6 (on 68bbcc01c):
agent, gateway, cli ok; provider red on TestUnreadLogins...
(synctest crash, #3632) and three TestFetch* tests (#3854), both red
the same at origin/main 68bbcc01c / 5a3292354 run alone, both filed.
- Rebased over e7f21dba5 (Disconnect keeps a hand-set catalog): the
conflict in unroute merged (the desk key counts as no catalog of the
user's), and -run 'CodexDesktop|Disconnect|Unwire|Catalog'
./internal/agent ok. The packages' run at the final head could not
build: the machine's disk was full (other sessions).
- gofmt -l clean; go vet ./... on darwin, GOOS=linux, GOOS=windows ok.
Not tried: clicking the real desktop app's picker (the app-server
answer and config were checked, not the GUI); the Windows Store app
(its readers get no version but count as the app; not run there); a
backend list change rewriting the file while the app runs (the app
needs reopening to read a new file, which connectinfo's restart notice
covers).
@ZhenLuoTTAWDTT on X: with Codex on magpie the model list stops short,
and the models past it can't be chosen.
Cause, from the clients' own code: the Codex app (ChatGPT.app
26.1013.40934, app-initial-90eb42395b7d.js) and the VS Code extension
(openai.chatgpt 26.51021.22027, model-queries-667cf4bd657d.js) both ask
their app-server for model/list with includeHidden, cursor null and
limit 100 (e?.limit??100) and never ask for nextCursor. codex-rs's
list_models pages the list sorted by priority, hidden entries counted,
so anything past the 100th is in no picker there. The CLI's /model
(tui model_popups.rs) lists every preset in a scrolling popup and has no
cap. magpie truncated nothing; its models are numbered after the
account's own, so a user with many models lost everything past ~100 in
the app, while hidden entries (codex-auto-review and the like) took
slots at the top.
Fix: codexcat.Fit ranks the list last of all, on every route magpie
hands Codex a list (/backend-api/codex/models after the user's own
order, /v1/codex/models before its 1 MiB cut, and the
model_catalog_json file via CatalogUsed): hidden entries go after every
listed one, and with more than 100 listed, the models Codex used in the
last 30 days (usage.CodexUsed, most recent first, at most 100; on
/v1/codex/models only the asking key's, CodexUsedBy) are brought into
the first 100 in the order they stood. The rest keep their order. The
list's ETag and X-Models-Etag carry a tag of the used set
(codexcat.UsedTag), so Codex asks again when it uses a model it hadn't;
CodexUsed is read at most once a minute, or at once when Append writes a
Codex call to a model it doesn't hold. Documented in
docs/subsystems/gateway-routing.md.
Tests (each red on the old code, broken by hand: Fit a no-op, the gateway
calls and the used tag removed, Append's codexUsedNew removed):
TestFitKeepsUsedModelsWhereTheCodexAppReads, TestFitLeavesAShortListsOrder,
TestCatalogUsedFits, TestUsedTagIsTheSet (codexcat), TestCodexUsed
(usage), TestCodexModelListKeepsUsedModelsInTheAppsHundred and
TestCodexCatalogKeepsTheKeysUsedModelsFirst (gateway).
Real run: codex-cli 0.162.1's app-server in a sandbox CODEX_HOME (never
~/.codex) with a model_catalog_json of 3 hidden entries at priority 1-3
and 150 listed models, driven over stdio with the app's own request
(model/list includeHidden, limit 100). Before: page 1 held 100 of 153,
3 of them hidden, the last many/model-096, nextCursor "100". The same
catalog put through Fit with many/model-140 used: page 1 has no hidden
entry and ends with many/model-140. The TUI's /model scrolled to all
150 (tmux).
Run with this change on e4ca47b0f: gofmt -l clean; go vet
-tags nogui with GOOS=linux and GOOS=windows on codexcat, usage, gateway
and agent clean. go test -count=1 -timeout 45m: codexcat ok, usage ok;
-run 'Codex|Fit|Used|ModelList|Catalog' on gateway, usage and agent ok
(122s, 11s, 80s). The whole gateway and agent packages ran too, but the
machine's disk was full under other sessions' runs (209M to 2.5G free),
and 959 lines of that log are "no space left on device". Of the reds,
three are not that: TestFolderVarsAreListed is #3884 (CARGO_HOME, red on
main since e4552cca9); TestHistoryKeepsDaysAndDropsOld (gateway) and
TestSuffixModesReachAgentFiles (agent) failed beside half-written
settings files and pass alone 3 of 3 at this commit. Not run: the full
./... suite (no room on the disk); the Codex app and VS Code extension
themselves against a magpie with this change (their request was read
from their bundles and replayed against a real app-server).
Rebased on ca8a6f346 (agent rename and Codex app route, claude_runs in
gateway) and run again: GOOS=windows go vet on agent
and gateway clean; -run 'Codex|Fit|Used|ModelList|Catalog' ok on
codexcat, usage and gateway (75s), and with |Rename ok on agent (68s).
Then rebased on 94c2aaecb (usage rename) and usage run whole again: ok
(88s).
cybercaius on Discord: one custom provider (example, on api.example.me)
was listed in the Requests page's provider filter under its id and its
host, and the host stayed after the provider was deleted.
The Add sheet's Detect, model-list and Test requests are sent before the
provider has an id, so probelog records them under the host asked
("a provider being added has no id yet"). 8e2ba36de (v0.1.1697, yyddbds)
lists those under the provider saved on that host now (Renames.ProbeOf),
but a deleted provider is on no host any more, so its probes went back
to the host beside the id its calls are kept under.
Now the log's index notes, as it reads each line, the provider each
host's calls went to (logSnapshot.hosts; "" once two providers were on
one host). probeProvider lists a probe recorded under its host by the
provider saved on that host, and with none there, by the one the log's
calls to that host were made under. A host two providers are or were
on, or none, stays the host, lowercased, so one typed in two cases is
listed once. It is done when the log is read, so rows written before
this release are merged too. Renames.OnHost tells "no provider on this
host" from "two providers on it", so a host shared now is never given
to a deleted one.
Not added: deleting a provider's usage rows. usage.jsonl is the record
budgets, windows and totals are read from, and probe rows are counted in
none of them; with them under one name there is nothing left to clean.
Run:
- go test -tags nogui ./internal/usage ./internal/usageapi
./internal/probelog: ok, at the pushed head (rebased on 56de2d192).
- ./internal/provider, skipping the reds open on main
(TestUnreadLoginsWriteErrorsKeepCredentials #3632, TestFetchAsksASharedBaseOnce
and its two siblings #3854): the disk was full from other sessions'
temp files, and TestLoginUsageEachAccount failed on "no space left on
device"; it and the Rename tests passed on a rerun.
- New TestProbesOfADeletedProviderStayWithIt: probes under
api.example.me and API.example.me before provider.Add, a Test after,
a gateway call with the provider's Where, and twice.example used by two
providers; after provider.Delete the list is [example one
twice.example two] and example's filter has its 4 rows.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
Broken by hand: probeProvider without the log's hosts fails it with
"deleted: providers [API.example.me api.example.me example one
twice.example two]", the reporter's extra names.
Not tried: the reporter's own usage.jsonl; a host typed in the Add sheet
and changed before saving (its probes went to another host and stay
under it); the GUI suite (no GUI file changed; the filter lists what
QueryPage returns); the full go test ./... (disk full).
lucis0116 on X: renaming a provider or a group in magpie didn't reach
every agent.
Display names already reached the agents' files: store and SaveGroup
drop the catalog, and SyncCatalog writes the new "<model> · <name>" and
"<group> · routing group" labels into Codex's model_catalog_json, Claude
Code's picker, OpenCode and Pi (checked in a sandbox HOME). Two gaps
were left:
- A routing group given another id (Routing page, `magpie groups
rename`, TUI) left every agent on group/<old>, which magpie no longer
has. The CLI even said "agents set to group/from need group/to now".
agent.RenameGroup now moves each agent field on group/<old> to
group/<new>, spelled as the agent spells it. It goes through
renameRefs, the move RenameProvider already made, now shared by both,
then SyncCatalog. The GUI, CLI and TUI call it in place of
provider.RenameGroup.
- The Codex app's own app-server reads model_catalog_json only as it
starts, and KeepCodexAppOnItsProvider restarts it only when
codexAppRoute changes. The route named the catalog's path, not what
the file holds, so a renamed provider or group, or a model added,
stayed on the old list until the user quit the app. The route now
carries a hash of the catalog's bytes (codexCatalogTag, read again
only when the file's size or time changes). The restart goes through
the existing idle gate: no Codex request in flight, 10s idle, no turn
open. A write of the same bytes is no change.
Run, in a sandbox HOME only:
- TestRenameGroupMovesTheAgentsOnIt (new): Codex, Claude Code, OpenCode
and Pi on group/smart, renamed to clever: each said moved and each
file on group/clever, none naming group/smart.
- TestCodexAppRouteFollowsTheCatalog (new): the route changes when a
renamed provider rewrites the catalog, and stays put when the same
bytes are written again.
- Broken by hand: RenameGroup's match turned off makes the first test
red (no agent moved, every file on group/smart). The catalog line
dropped from codexAppRoute makes the second red ("a provider renamed
left the Codex app's route as it was").
- At aded9beea (base ad3833512): go test -tags nogui -timeout 45m
./internal/agent ./internal/cli ./internal/gui ./internal/tui
./internal/provider -count=1: cli, gui and tui ok. agent red on
TestFolderVarsAreListed (#3884, red on main since e4552cca9) and
TestCodexDisconnectStaysWithAccountsOn/login=api, which passed 3 of 3
alone and isn't on this path (filed #3891). provider crashed in
TestUnreadLoginsWriteErrorsKeepCredentials with "close of synctest
channel from outside bubble" in filememo.Forget (#3632, open on main).
- Rebased on 56de2d192 (a312bf3e3 adds a switched account's app-server
to the same stale set; no overlap): go test -tags nogui -count=1
./internal/agent -run 'Rename|CodexApp|Sync|Group|Codex|Hermes' ok
at this head; ./internal/provider -run
'CodexApp|Group' ok at a312bf3e3 + this change. The disk was full (other sessions' suites), so the
whole of each package wasn't run again at this head.
- GUI: group-id-dots, group-morph, agent-model-groups and i18n-keys,
32 of 32. No GUI script changed, and the GUI tests answer the API in
memory.
- gofmt -l clean. go vet -tags nogui on agent, cli, gui and tui for
darwin, linux and windows: ok.
Not covered:
- Claude Desktop reads the gateway's model list only as it starts. It
still needs its Restart button (AppBehind) after a rename, as after
any other catalog change.
- Pi, omp and StepCode enabledModels: RenameRefs renames magpie/<old>/
provider entries only. A group's magpie/group/<old> entry goes as
scope-gone, and the pick of group/<new> is added again. Not checked
entry by entry.
- Codex signed in beside magpie (models_cache.json aged by the catalog
tag) was not run again here.
- No real Codex app restart was watched. The reporter's agent isn't
named.
@Candydidi3 on X: with Opus in Claude Code, "magpie里拉起很多子进程". On a
Claude account each conversation is answered by a real Claude Code
(`claude -p`) with magpie's MCP helper (`magpie claude-mcp-helper`) as its
child. Claude Code's parallel subagents are conversations of their own,
so a session that starts N of them has N pairs running. idleMost (6)
pairs are kept for an hour so the next turn reads the prompt cache, and
runs waiting on tool calls stay up to 30 minutes. On macOS and Windows
nothing bounds the total unless the user sets `magpie claude-code runs N`.
A task manager names them "2.1.311" (Claude Code's binary is named by its
version) and "magpie", and nothing told the user what they were.
No leak was found. With the bridge's fakes, 12 concurrent conversations
left 6 runs when they ended their turns, 12 when they were parked on
tool calls and never answered (bounded by the 30-minute timer), and 0
right after they were cancelled. Real Claude Code 2.1.311, run with the
bridge's args, exits within 0.1s of stdin EOF and when its parent is
killed, and its helper exits with it.
So nothing about which processes run changes. They become visible
instead:
- GET /v1/magpie/claude-runs (claude_runs.go) lists each run with its pid,
model, account, state (answering, idle for its next turn, or waiting on
tools), since when, when magpie lets it go, and its RSS, plus
claudeRoom's live count. It is loopback only, refused like the heap
profile, and served no-store.
- `magpie claude-code runs` prints that list under the bound and says
what the processes are and how long they are kept.
- runs record when they started, when the current turn began, and the
timer's deadline (endIn wraps every timer.Reset). The literal 30-minute
timeouts become runTimeout.
Tests:
- TestClaudeRunsNamesEachProcess: idle, tools and answering runs are
listed with the pids that are alive, and dropped once they end; every
caller profileCallersRefused lists is refused. It went red with the
route taken out (404), and with the guard off 3 callers got the list.
- TestClaudeCodeRunsListsTheProcesses covers the CLI's lines and the case
with no magpie running. The existing CLI test now stubs the gateway, so
it never asks the live magpie on :3425.
- oneport_test knows ClaudeRunsPath.
Real run (10-27): a sandbox HOME with a made-up Claude sign-in in its own
CLAUDE_CONFIG_DIR (no keychain item was written for it), `magpie serve`
on 127.0.0.1:47820, and a `claude` wrapper that exec'd real Claude Code
2.1.311 against a mock Anthropic API. 8 concurrent subagent-like
requests left 6 Claude Code, each with its helper. `magpie claude-code
runs` listed the same 6 pids ps showed, idle, ends in 59m, about 160 MB
each. SIGTERM to the sandbox serve ended all 12 within a second.
Run (go1.26.8, -tags nogui, private GOCACHE):
- At 184b4b8ba (this change on origin/main 5a3292354): gofmt clean; vet
for darwin, linux and windows; `go test -count=1 -timeout 45m` of
internal/cli ok (88s) and internal/gateway FAIL (1079s). Of the 118
tests that failed, 117 failed on "no space left on device" (other
sessions filled the disk to 0 bytes free mid-run), and
TestHistoryKeepsDaysAndDropsOld failed because its big writes were cut
short. All 118 run again with -count=1: ok (153s). The history test
-count=3: ok.
- At this commit, rebased on origin/main 56de2d192 (Kiro's and Qoder's
mins, plugin options, Codex app-server restarts and Hermes, none of it in these
files): gofmt clean; vet for darwin, linux and windows; `go build
-tags nogui .`; TestClaudeRunsNamesEachProcess, TestClientPathCoversHandler
and TestClaudeCodeRuns* ok. The GUI build and a full gateway run there
didn't fit on the disk (about 500 MB free).
Not run: the full ./... suite, Windows or Linux, a real Anthropic account,
and the GUI suite (no GUI change).
tjhhhh on Discord (0.1.1673): switching the model of a Hermes profile
other than the default didn't take, and turning magpie's takeover Off and
On again lost the default model, so the hermes CLI failed at start.
Causes, read from Hermes' source (hermes_cli/main.py
_apply_profile_override, profiles.py):
- `hermes profile use X` writes <root>/active_profile, and every later
`hermes` runs profiles/X. magpie always wrote <root>/config.yaml, the
profile hermes no longer started in.
- At Off, hermesUnwireProfile deleted model.provider and model.default
from every profile on magpie and put nothing back. On rewrote only the
connected config, so the profile hermes ran had no model.
Now:
- hermesActive: the config magpie connects is the profile hermes starts
in: HERMES_HOME when it names a profile, else active_profile's (BOM and
whitespace trimmed) when it is a live profile (not "default", a valid
name, no tombstone, its folder there), else the root.
- Off leaves each bot on magpie on a model it can start with: its own
stashed model if it had one, else the connected config's own model,
with that provider's providers.<name> entry copied in when the bot
lacks it. What magpie put there is kept as hermes:<path>:off.
- On puts magpie back on each bot still on what Off left (hermesBack); a
bot the user moved while Off keeps theirs; a bot with no model at all
gets magpie's.
- Bots on the model magpie or hermes last picked follow a new pick
(hermesFollow now also follows the connected config's current default).
- gone.go: a profile folder's Agent finds the root's hermes-agent
checkout, so it counts as installed.
Run:
- go test -tags nogui -count=1 -run 'CLIMissingHermes|Hermes'
./internal/agent: ok.
- New tests red on the old code: TestHermesStickyProfile
(hermes_test.go:811 'active_profile "coder\n": connects .../.hermes,
want .../.hermes/profiles/coder'), TestHermesOffAndOnKeepsEveryBotsModel
(hermes_test.go:698 'off: writer is on {Provider: Default:}, want
{Provider:mine Default:kimi-k3}'), TestHermesBotsFollowTheModelHermesPicked
(hermes_test.go:768 'writer stayed'); TestHermesProfiles' writer after
disconnect now expects the root's own model, not nothing.
- Whole internal/agent (-timeout 45m, logged): the disk filled (other
sessions' temp files, under 1 GB free) and 43 tests failed on "no space
left on device"; each of them, and every Hermes test, passed on a rerun
(131s). TestFolderVarsAreListed is red on main since e4552cca9 (#3884),
not touched here.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
./internal/agent: clean.
Broken by hand: without the hermesBack call TestHermesOffAndOn fails at
hermes_test.go:716 'on: writer is on {mine kimi-k3}, want {magpie
deepseek/pro}'; following only the recorded pick fails
TestHermesBotsFollow at 768; gone.go reverted fails TestCLIMissingHermes
at install_missing_test.go:132.
Not tried: the real hermes binary (it rewrites the live ~/.hermes launcher
under a temp HERMES_HOME); a real Off/On in the reporter's setup; the full
go test ./... (disk full).
zhibukaixinyao (Discord #help, 10-27) asked when Windows gets the
"restart Codex" step: the Windows GUI has no Restart button, so after an
account switch the Codex app kept sending on, and showing the limits of,
the account it started with until the user quit and reopened it.
noteCodexSwitch now hands the app-server pid it recorded as left on the
old account to codexApp's stale set, the same set a route change fills.
KeepCodexAppOnItsProvider's step ends it once Codex is idle and no turn is
open, and the app starts another that reads auth.json afresh. This covers
a switch made in the gateway's process: the GUI's switch and
SwitchWhenSpent. Together with 3aead9c62 (the Windows app's app-server is
found at all) this needs no restart on Windows, macOS or Linux.
Run (at 9bfe68048 + this change):
- TestCodexAppServerRestartedOnAccountSwitch (new): nothing ended with no
switch, nothing while a turn is open, pid ended once idle after the
switch and only once, CodexAppStale "" afterwards.
- go test -race -count=3 -run TestCodexApp ./internal/provider: ok.
- go test ./internal/provider ./internal/agent ./internal/cli (skipping
#3632 and #3854's tests): provider ok, cli ok; agent red only on
TestFolderVarsAreListed, red on main since e4552cca9 (#3884).
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
Broken by hand: with the codexAppAccountLeft call removed the new test is
red ("switched, idle: ended [], want [60]").
Not tried: a real account switch on the Windows box (the box's Codex app
isn't signed in to two ChatGPT accounts). A switch made from the
CLI runs in its own process and still only sets the notice; the running
gateway doesn't hear of it.
qoder 0.2.39 (plugins a379c54) closes the stream Qoder holds open on a
queued call (10605 RESOURCE_LIMIT) before it waits, where 0.2.38 held it
until the request ended, and resends each try as a new request_id and
chat_record_id in the same request_set_id, as Qoder.app 0.4.3's worker
resends a queued ask.
npm view @magpie-community/opencode-qoder-auth version --prefer-online:
0.2.39 at landing.
Run: go test -count=1 -run 'Mover|Moved|Migrat|Qoder|Min'
./internal/provider ok; gofmt clean. The plugin change itself was run
against the owner's real qoder.com account (queued twice, answered at
71s, both refused streams closed at once) and its queue tests fail on
0.2.38's index.mjs.
Not tried: a moved user's update to 0.2.39 through keepMovedCurrent.
kiro 0.1.18 (plugins ceda580): Kiro counts its 5,242,880-byte image limit
on the Base64 string, so imwaco's 4,171,428-byte view_image PNG (5,561,904
as Base64) failed with IMAGE_SIZE_EXCEEDED on that turn and every later
one. The plugin now shrinks such an image on the request it sends
(Bun.Image: long edge to 2000 px, then WebP/JPEG smaller each try), leaves
smaller images byte for byte, and puts a one-line note in place of one it
can't bring under, so the turn still goes.
npm view --prefer-online --registry=https://registry.npmjs.org/:
@magpie-community/opencode-kiro-auth 0.1.18 (latest).
Run: go test ./internal/provider -run
'Kiro|Mover|Moved|Min|Retir|HandOver|Adopt|KeepMoved' ok; go vet
./internal/provider (darwin, linux, windows) ok; gofmt -l clean. The whole
./internal/provider package crashes in TestUnreadLoginsWriteErrorsKeepCredentials
("close of synctest channel from outside bubble", #3632, open, on main),
and an earlier run hit "no space left on device" (the disk had 290 MB).
Plugin side: HOME=$(mktemp -d) bun test packages/kiro 67 pass, also under
OpenCode 2.0.25's Bun 1.4.2.
Broken by hand (plugin): without the fitting 7 of its 10 new tests fail.
Not tried: a real Kiro account; a real move in a sandbox HOME (only the
min string changed).
WorkBuddy's plugin 0.1.38 adds a "Free models only" switch (a plugin option)
that lists only WorkBuddy's free models and refuses any other before it is
sent. Its list goes by the switch, but SetProviderOptions only handed the
values over: the host cleared its infos while Go kept provCache, so the
Providers page and /v1/models showed the old list until something else
re-read it. SetProviderOptions now forgets the kept providers (whether the
host runs or not), so the next Cached() lists them again. Nothing else runs
on a change. The workbuddy mover's min is 0.1.38 (npm view --prefer-online
at landing: 0.1.38).
Run:
- go test ./internal/plugin ./internal/provider -count=1 -timeout 45m at
this head (5a3292354 + this): internal/plugin ok (389s); internal/provider
FAIL on TestUnreadLoginsWriteErrorsKeepCredentials, "close of synctest
channel from outside bubble" in filememo.Forget, which is #3632 (open, on
main since 091153bf, nothing here touches it). TestPluginOptions now lists
a model only while its option is on, and only base-model after it is off.
- Rebased onto 3aead9c62 after the run; its new commits touch only
internal/provider/codex_daemon*.go and codex_app_server_test.go. go vet
./internal/plugin ./internal/provider ok there; a rebuild to test again
failed to link for a full disk (291MB free).
- gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/plugin
./internal/provider ok.
- Real accounts, sandbox HOME, dev build of this tree on 3516/3517 with the
plugin added by path: POST /api/settings/plugin-option free_only on for
workbuddy-ai took its list from 26 to 2 (hy3, deepseek-v4.1-flash) within
2s with no restart; workbuddy kept 19. gpt-5.4 got the plugin's 404 and
was not sent; hy3 and deepseek-v4.1-flash answered. Off: 26 again, and
gpt-6-luna and gpt-5.4 answered.
Broken by hand: without forgetProviders in SetProviderOptions,
TestPluginOptions fails ("with beta on, optco lists "base-model"").
Not tried: the switch clicked in the GUI window (the API it calls was);
Windows and Linux apps.
zhibukaixinyao on Discord (#help, 10-27): on Windows there is no restart,
and Codex keeps the old provider until it is restarted by hand.
The cause: isCodexAppServer took the Windows app's codex to live under
WindowsApps\OpenAI.*, which was a guess. The real ChatGPT/Codex MSIX
(OpenAI.Codex 26.1021.3705.0, installed with winget OpenAI.ChatGPT)
runs it from %LOCALAPPDATA%\OpenAI\Codex\bin\<hash>\codex.exe
... app-server --analytics-default-enabled. So findCodexApp found
nothing, KeepCodexAppOnItsProvider never ended it, and the
"still signed in to the old account" notice never showed on Windows.
Now that path counts too (WindowsApps is kept); the npm, WinGet Links
and --listen app-servers still don't.
Run:
- go test ./internal/provider -skip TestUnreadLogins: ok except
TestFetchAsksASharedBaseOnce and two siblings, red on main and filed
as #3854; TestUnreadLoginsWriteErrorsKeepCredentials crashes the
package on main, filed as #3632. Neither is touched here.
- go test -run 'TestCodexApp|TestFindCodexApp|TestIsCodexClient'
./internal/provider ./internal/agent: ok.
- gofmt -l; go vet on darwin, linux -tags nogui and windows; go build
for darwin, windows and linux nogui: clean.
- On the Windows box (Windows 11, real Codex app 26.1021, sandbox
USERPROFILE/APPDATA/LOCALAPPDATA, gateway on :3491, a fake custom
provider): `magpie codex fakeai/fake-1` ended the app's app-server
and the app started a new one (pid 63320 -> 56692); `magpie codex
default` did it again (56692 -> 56216). The app logged the exit as
expected (code 0, app_server_restart_recovery_done) and kept its
window. The origin/main build left pid 56216 through both.
Broken by hand: with the old WindowsApps-only check,
TestCodexAppOwnServer and TestFindCodexApp go red on the real Windows
command line.
Not tried: a signed-in Windows app switching ChatGPT accounts, the
durable host, and the managed `codex app-server daemon` (winget's
portable codex 0.161 refuses to run it: "the CLI package does not match
this platform or executable").
Every SyncCatalog wrote agents' config files again with the same bytes:
a new mtime that wakes every watcher of the file (filememo, the Codex
daemon loop, the agent's own reload), and a temp-and-rename that swaps
the file under an agent reading it. #3870 named Kimi Code, Grok and
AtomCode; with every agent connected in a sandbox HOME, a second sync
rewrote 15 files: .claude/settings.json, Cline's providers.json,
CodeBuddy, Copilot BYOK, Factory, Qwen, Snow (both), WorkBuddy (both),
ZCode, Kimi Code, Grok, AtomCode and magpie's stash.json.
WriteAtomic, which every TOML, JSON, YAML and dotenv writer goes through,
now reads the target after the filter and BOM are applied and returns
when its bytes are the same. A real change is written as before.
Tests:
- internal/edit TestUnchangedWriteKeepsFile: TOML table/key/top, JSON,
YAML and .env; mtime and inode kept on the same bytes, a changed value
written. Red in all 6 with the check turned off by hand.
- internal/agent TestSecondSyncWritesNothing: every connectable agent
connected, second SyncCatalog + dshWiredOnce writes no file. Red with
the old WriteAtomic (15 files), green -count=3 with this one.
Run:
- At 68bbcc01c + this change: gofmt clean; go vet -tags nogui
internal/edit and internal/agent for linux, windows, darwin ok;
go test -timeout 45m over every importer of internal/edit (access,
agent, autostart, backup, cli, codexcat, daemon, davsync, edit,
gateway, library, mcpauth, plugin, profile, provider, settings,
update, usage): all ok but provider's TestFetchAsksASharedBaseOnce
and two siblings (red the same on unchanged origin/main ad3833512,
3 of 3: #3854) and update's TestRelaunchOpenTriedAgain (TempDir
cleanup under load ~90, passes 3 of 3 alone: #3881).
- At the pushed head (rebased on ad3833512): gofmt, 3-OS vet, all of
internal/edit, and internal/agent's new test plus Disconnect, Codex
hand-edit, Kimi, Grok and AtomCode tests: ok. internal/gui, which
imports internal/edit, was not run.
Not tried: the real Kimi Code / Grok / AtomCode apps watching the file.
Settings › Network and sharing's gateway rows (renderPort, renderBareIds,
renderCORS, renderAllow, renderLAN and their drafts) move as they are, byte
for byte, into plugins/gateway/settings.js, loaded after app.js beside
plugins/otel/page.js, as Observability's moved on 10-26. app.js had 416
bytes left under its budget; the next change (the app serving its page to
a browser) adds a section to that tab. Both budgets are lowered to what is
left: app.js 1,310,129, the core 1,526,251.
Run at this tree (68bbcc01c + this):
- go test ./internal/gui -run 'TestCoreScriptBudget|Asset': ok
- GUI (playwright 1.62.0, both engines, every language they cover):
bare-ids, allow-ips, cors-origins, gateway-port, lan-docker,
connect-address-kept, gateway-connect-keys, gateway-keys-off,
agent-unreachable, api-key-theme, import-row, proto-menu-overflow,
remote-magpie, usage-remote-cards, i18n-keys: ok. gateway-caller-keys en
(#3797) and phone-web (#3876, filed now) red, the same 4 at the base
68bbcc01c run alone.
Yayoi_no_yume (X) asked for 0.85-0.95, ~0.88, over a hardcoded 0.5.
The threshold is the user's per model since v0.1.1689 (Settings >
Privacy > Confidence threshold, 0.5-0.95). This measures whether a
different default would be better, and keeps the defaults.
Corpora: 2000 segments of the owner's real Codex and Claude Code
sessions (prompts, tool arguments and results; 550 with CJK), kept
local; and 101 labelled cases (the 72 eval cases incl. #3029,
#3143, #3144, plus 30 new), 64 values that must be masked, 188 that
must not. Both real models, in a scratch cache: Privacy Filter q8
GGUF via pf-v2, AstrLink Guard rev 7216b6a3b897 (sha256 checked).
Rules alone mask 16 of 64.
model thr labelled masked/64 labelled FP/188 real model masks
Guard 0.5 60 0 34
Guard 0.8* 57 0 20
Guard 0.88 56 0 12
Guard 0.95 54 0 6
PF 0.5* 59 2 31
PF 0.8 57 1 19
PF 0.88 56 1 13
PF 0.95 56 0 12
Guard 0.8 -> 0.88 drops 3 false alarms (a model id, a sandbox path
word, a token counter) and lets a real colleague's name and a
labelled signed name through. PF 0.5 -> 0.88 drops 11 (timestamps
in paths, log lines, a plugin id) and lets 6 names and a phone
through, 4 of the names in real traffic. A higher default sends
real names unmasked; the false alarms left are shapes (ISO
timestamps in paths, Claude Code's <total_tokens> counter, base64)
that a check can turn away. The docs now say what the threshold
trades, en/zh/ja masking pages and gateway-routing.md.
Run at this head (and 89ef90356 under it), rebased on e7f21dba5:
gofmt -l, go vet (darwin), GOOS=linux -tags nogui and GOOS=windows
vet of redact (+gateway on linux), go build: clean. go test -count=1
internal/redact, masking, pii/..., settings, otlp, sessions: ok.
Not run before push: internal/gateway and internal/gui (both import
redact) and the full ./... suite, the machine at load ~138 with other
sessions' suites; running after. No GUI asset changed. Eval
recordings (testdata/eval-*.json) not re-recorded; TestMaskEval ok.
The EMAIL rule's bound characters held "." on both sides, so an
address followed by a full stop was no match: "The user's email
address is jo@quill.dev." (Claude Code's own userEmail line) and
"write to me at li.wei@qq.com." went to the vendor as written with
the rules on. Found measuring the local model's threshold for
Yayoi_no_yume on X: in 2000 segments of real Codex and Claude Code
traffic, two real addresses were masked only because a model found
them, at 0.70 and 0.95.
emailAt now judges a dot beside the match: one before it still turns
it away, and one after it only when a letter, digit, - or _ follows
(a@b.io.12 stays unmasked, as before). The rest of the bound
(letters, digits, _ % + -) is unchanged.
TestEmailBeforeAFullStop: its five sentence-end cases fail on the old
rule (5 of 5 unmasked), pass now; its two longer-name cases are
unmasked on both.
新v学员 (Discord #feedback, 10-27): upgrading an RTK installed with cargo
failed silently on Windows. Four causes, each fixed:
- No cargo on magpie's PATH (magpie started before Rust was installed,
or from a shortcut whose PATH rustup never touched): rtkUpgrader gave
no upgrade, so Upgrade was greyed with only a tooltip, which a click
never shows. Now the cargo rustup put beside rtk is run by its path;
with no cargo anywhere, the card (and the CLI) says it was installed
with cargo, to install Rust from rustup.rs or run the command shown
(RTKView.NoUpgrade, Manual), and UpgradeRTK's error says the same.
- CARGO_HOME (D:\Rust\.cargo is common) moved cargo's folder: an rtk
there wasn't cargo's to magpie. cargoBins reads it, for finding rtk
and for the upgrade; on Windows the folder matches whatever its case.
- cargo install --git built rtk-ai/rtk's default branch, develop, whose
Cargo.toml says 0.49.0 while v1.1.0 is out from master: the upgrade
left rtk as it was, or older, on every OS. It now names --branch
master, as rtk's own installation guide does.
- Windows refuses cargo's move over a running rtk.exe ("failed to move
… (os error 5)", exit 101, after the whole build), and an agent runs
rtk for every command. On that refusal the rtk is renamed aside
(rtk.exe.old-<pid>, which Windows allows), a copy put in its place,
and cargo run again; its build is kept in magpie's CARGO_TARGET_DIR,
so the retry builds nothing. Old copies are removed on the next
upgrade.
A failed cargo now says its first error with the cause, and what to do
for the common ones (rtk in use, link.exe/dlltool missing, GitHub
unreachable), not its last three lines, which only said the build
failed and where its files were left.
Run:
- Real Windows (10.0.0.132, sandbox CARGO_HOME/RUSTUP_HOME/USERPROFILE,
rustup + cargo 1.99.1, removed after): plain cargo install over a
running rtk.exe fails with "拒绝访问。 (os error 5)" exit 101; a
Windows build of this package's tests (GOOS=windows go test -c, a
scratch test calling ReadRTK/UpgradeRTK, not committed) with no cargo
anywhere gave NoUpgrade "cargo" and the new error; with cargo only
beside rtk (not on PATH) and the old rtk.exe running, UpgradeRTK
built rtk-ai/rtk master and went 1.0.0 -> 1.1.0 in 3m26s, the running
rtk kept running, rtk.exe.old-<pid> was left and removed once it
exited. The build used the gnullvm toolchain with llvm-mingw; the
gnu toolchain failed with "error calling dlltool" and lld's missing
-lgcc_eh, which is the output the tests use.
- New tests (rtk_cargo_test.go) and the updated
TestRTKUpgradeCargoNamesThePackage are red on origin/main
(32ea16c5a): no upgrader without cargo on PATH, the generic error,
the last-three-lines message, no --branch. The Windows paths are
forced through rtkOnWindows.
- go test ./internal/library ./internal/cli ./internal/gui (sandbox
HOME): ok. gofmt -l clean; go vet ./..., GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./...: clean.
- GUI, chromium and webkit: library-rtk-*.test.cjs and i18n-keys (136
pass), the new card test in en, zh, zh-TW, ja, de at 440px; then
every library*.test.cjs file (736 pass, 0 fail).
- Rebased on origin/main 68bbcc01c (none of these files changed
since 32ea16c5a): the three packages ok again, gofmt and vet clean.
Not tried: the MSVC toolchain (the box has no Visual Studio Build
Tools), so the link.exe hint is from cargo's known message, not seen
here; an rtk installed with non-default features is upgraded with the
default ones; CARGO_HOME is read from magpie's own environment only.
@yhwangl on X asked that putting an agent's config back never write
over what the user changed by hand after magpie took it over: only the
keys magpie changed go back, and a key magpie wrote that the user has
changed since keeps the user's value.
Codex's Disconnect put back the pre-connect model_reasoning_effort and
model_catalog_json whatever they were by then. An effort the user set
by hand to high after connecting went back to the low it was before,
and a model list of their own put in by hand was deleted.
Now:
- the effort goes back only while it is still one magpie set: the one
settle moved it to (stashed as codex.effort_set), the one picked on
the Agents page (the applied record), or none;
- dropProvider takes model_catalog_json out only when it is magpie's
list (or empty), and unroute puts the old list back only where the
key is empty;
- model_provider is put back only where the key is empty.
Other agents' fields already clear only a value still magpie's, and
put the pre-connect backup only into a field left empty.
Run, at this commit's tree (HEAD df8374921 plus this change), sandbox
HOME, private GOCACHE:
- gofmt -l internal/agent: clean; go vet ./internal/agent: ok
- go test -tags nogui -count=1 -run Codex ./internal/agent: ok (121.7s)
- broken by hand (the effort and catalog checks taken out of unroute):
TestCodexDisconnectKeepsHandEdits went red, green again with them.
Not run: the full suite (runs with the uninstall change).
linull24 (#3813): the Routing page used too much over mobile remote.
Reproduced it with a 390x844 phone viewport at 4x CPU throttle, three
live and three done requests coming every 400ms: the main thread was
busy 0.88s of each second. A 10s profile had getTotalLength at 1.66s,
the largest single item: while rows slide (the 520ms after each
rebuild, when layout() runs every frame) every wire's d is new each
frame, and measure() asked the browser for each one's length just to
find its ends, then pose() asked again for each leg of every flight.
- measure() no longer asks for a length up front.
- A wire's ends and the way it heads there are read off its d
(wireEnds: magpie's own absolute M/L/Q/C), the browser only for
any other d.
- A path's length is its points' (flat(), which pointAt already
used), so pointAt reads s along them directly; the browser's
getTotalLength is kept for a d flat() can't read.
Measured (same probe, same load, main's client.js swapped in for the
"before"): layouts 590/s -> 235/s, script 0.187 -> 0.144 s/s, main
thread 0.89 -> 0.84 s/s at load ~100; 0.71-0.74 s/s at load ~10.
getTotalLength is gone from the profile. A per-frame check that each
row's wire ends at the row's own centre while rows slide: worst 0px
over 1546 frames, as on main.
Tried and dropped: drawing a slide's frames from the boxes of the
last layout, each moved by its row's eased slide. Rows also move
during a slide for reasons that aren't the transform (a row above
changing height), and the wires were off by up to 153px.
Not changed: the rest of a busy page is the browser's own style,
layout and paint of the motion; with reduced motion it is 0.31 s/s.
GUI (both engines): every routing-*, panel-routing* and idle-ticks
file at 6ce0f14b9 with this change. Reds were in 12 files, all rule /
pause / model-rest timeouts; the same 12 files with main's client.js
gave 89 reds against 91 here, the same tests, timeouts landing on
different subtests at load 40-110. Filed already: #3096, #3094,
#2115, #3410, #3408, #3593, #3411. routing-busy-frames, routing-busy,
routing-flood, routing-idle-frame and idle-ticks pass.
On the rebased tree (parent b5582912a, which changed app.js): routing-busy-frames, routing-busy, routing-flood, routing-idle-frame, idle-ticks, routing-steady-garbage, routing-held-dot and routing-js, both engines, 65 of 65 ok; go test -tags nogui -run 'Budget|Script' ./internal/gui ok.
leelantao on X: two Plus accounts on in magpie lost 90%+ of their
allowance in a day. Affinity let a conversation leave its account after
cacheCold, five minutes, for every vendor. Under Smart the other account
then had more left and went first, so after any pause over five minutes
the next turn went to the other account. That account read none of the
conversation from cache and refused the reasoning the first had sealed.
Each time, the whole context was paid again uncached, on whichever
account was fuller.
Measured on a real ChatGPT account (Pro, gpt-5.6-terra, low effort,
sandbox HOME, Codex 4-turn task): a thread left 7, 12, 25, 45 and 60
minutes still read everything it had sent before from cache (17152 of
21514, 21248 of 21532, 21248 of 21550, 17152 of 17291, 20224 of 20953).
So the ChatGPT backend keeps it at least the hour measured. coldAfter
gives a ChatGPT account (Account.Agent "codex") chatGPTCold, an hour;
every other vendor keeps cacheCold. A group's rules read the same window
for keepsEffort (turnRule.cold, set from the answering candidate in
ruleAnswered), so they don't drop a ChatGPT conversation's effort after
five minutes and lose its cache that way either.
Also measured: the same task direct, through magpie's relay (Codex's
own sign-in) and through the pool path (codex/gpt-5.6-terra). Direct
and relay send 10 requests each, with 166.7k/166.2k input and
154.1k/148.0k cached. The pool path sends 11 requests: 223.1k input,
196.1k cached. Its requests are ~3.5k larger and its first one reads
nothing from cache. usage.jsonl matches the rollouts one for one. No
hidden retries, titles or warmups were sent.
Run, at 8bd300399 plus this change:
- go test -tags nogui ./internal/gateway -run
'Affinity|Stick|Effort|Rule|ChatGPT|Cold|Cache|Lone|Rotat|Weight|Smart|Seal|Codex'
-count=1: ok, 80s.
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok.
- gofmt -l: clean.
Broken by hand: with coldAfter returning cacheCold and keepsEffort reading
cacheCold, both new tests fail ("ChatGPT, 6 minutes on: why "cold"",
"a ChatGPT conversation 12 minutes on dropped its effort").
Not run: the whole gateway package (another session's gateway run held
the machine); I run it next and file anything red. Not tried: two real
ChatGPT accounts moving a conversation. The second saved account here is
lapsed, so the move's cost is reasoned from the code and the one-account
cache measurements.
ysm119 on Discord (Cursor Team account, after v0.1.1696): the Cursor
editor listed "Claude Opus 5 1M Medium Thinking", "Claude Opus 4.7 1M
Medium Thinking" and the like, read as one fixed tier each ("没法设置模型
档位"), and the picked claude-haiku-5-5-thinking failed Test models.
The mover's min is 0.2.25 (npm view --prefer-online: 0.2.25,
magpie-community/plugins cb776e2):
- a family only cursor-agent lists is named without the effort, Fast
and 1M wherever Cursor's name has them (Claude Opus 5 Thinking); its
tiers were already its reasoning levels, low to max;
- an id for a model with thinking that the account lists only without
it (claude-haiku-5-5-thinking, listed by plugin 0.1.x), or the other
way round, runs on the model the account has instead of going to
Cursor as named ("AI Model Not Found").
Run at origin/main 32ea16c5a + this change:
- gofmt -l internal/provider clean; go vet -tags nogui ./internal/provider
on darwin, GOOS=linux, GOOS=windows clean.
- go test -tags nogui ./internal/provider: ok but for
TestUnreadLoginsWriteErrorsKeepCredentials (synctest crash on main,
#3632; skipped) and TestFetchAsksOneListOnceForTwoBasesOfIt,
TestFetchUnionsProtocolListsWithoutChat, TestFetchAsksASharedBaseOnce
(red on main, #3854).
- Plugin side: bun test packages/cursor 310 pass; its three new tests
fail on 0.2.24.
Not run: the full suite (a one-line min); a real Cursor account or the
reporter's Team list (the plugin tests use the reporter's names with
Cursor's id pattern); magpie end to end.
ferock on Discord: Claude Code, model group/gemini-3-8-flash on a local
magpie whose group is served by a remote magpie's Antigravity, 400
"Remote magpie: Antigravity: GenerateContentRequest.tools[0].
function_declarations[19].parameters.properties[display].items: field
predicate failed: $type == Type.ARRAY". It worked in the morning and
broke after updating. The tool's literal schema wasn't posted, and no
Claude Code 2.1.311 built-in has a display property with items (searched
the binary), so it is an MCP tool of theirs.
Cause: geminiToolTypes (68ee4117a, v0.1.1624, 10-27 01:26) runs in
forwardOnce for any body whose model names Gemini, the local magpie's
forward to a remote magpie included. geminiSchemaType typed an untyped
schema from its enum/const values before its keywords, so
{"items":{...},"enum":["a","b"]} went on as type "string" with items
beside it. The remote's plainSchema kept the explicit type and the
items, and Google refused the whole turn. Before 68ee4117a the same node
reached plainSchema untyped and was inferred an array.
- geminiSchemaType: an object's or array's keywords (properties, items
and the rest, keywordType, split out of schemaTypes unchanged) decide
before enum/const values.
- plainSchema (the remote's Antigravity side, so a local magpie from
before is served too): items/minItems/maxItems are kept only on an
array and properties/required/min-maxProperties/propertyOrdering only
on an object, as JSON Schema reads them; of a type list it takes the
type its items or properties are for (["string","array"] with items is
an array, not a string with items).
- docs/subsystems/gateway-routing.md says both.
- Sibling not changed: kimiSchemaType/collectUntypedEnums still type
such a node from its enum; whether Kimi refuses items on a string is
unknown, filed as #3867.
Tests (antigravity_display_items_test.go): the shape the error points to
(an untyped display with items and a string enum, plus properties with a
const) through geminiToolTypes, and through parseAnthropic +
buildCodeAssist(antigravity) as Claude Code sent it, as this version's
local passes it on, and as an older local passes it on (display typed
"string", type lists, a string with object/array keywords); every node
sent has items only as an array and properties only as an object.
Run, in a worktree at origin/main 32ea16c5a:
- go test -tags nogui ./internal/gateway -run 'CodeAssist|Codeassist|
Gemini|Schema|Antigravity|Kimi|Plain|Grok|OneOf|Tool|Vertex|Google|
Shape|Enum' -count=1: ok (60s)
- gofmt -l internal/gateway: clean; go vet -tags nogui (darwin),
GOOS=linux go vet -tags nogui, GOOS=windows go vet on internal/gateway:
clean
Broken by hand: gemini_schema.go back to origin/main,
TestGeminiToolTypesItemsBeforeEnum and TestAntigravityItemsOnlyOnArrays
FAIL (display typed "string"); codeassist.go back to origin/main,
TestAntigravityItemsOnlyOnArrays FAILs (items, minItems, properties on
type "string").
Not tried: the reporter's literal tool schema (not posted; the fixture is
the shape the error and the update point to), a real Antigravity
account, and a real two-magpie setup. Not run: the whole gateway
package or ./... (another session's full internal/gateway run was on the
machine, load ~60-75).
JiangLiuer222 on X: after Disconnect the Codex app kept sending to
127.0.0.1:3425, now and then. The app's app-server reads config.toml only
as it starts, so one started while Codex was connected kept the gateway's
base URL until the user quit the app.
Now the gateway's watcher (KeepCodexAppOnItsProvider, from 8b0132b3d)
ends the app's own app-server whenever what it reads at start and magpie
writes changes: model_provider, openai_base_url, model_catalog_json, the
magpie table's base_url and the used-up takeover (codexAppRoute, through
the provider.CodexAppRoute hook, which replaces CodexAppOnMagpie). Same
guards as before: never while a Codex request is in flight or ended in
the last 10s, never with a turn open, only on magpie's Codex home, a
clean exit. At its first look only a used-up account's app-servers are
ended, as before.
Also checked: after Disconnect nothing writes the base URL back. Failover
and the stale-model rewire skip a disconnected Codex, and the takeover
paths in Sync need Codex joined or on magpie.
Run at this tree (on origin/main 32ea16c5a), private GOCACHE, sandbox HOME:
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
(internal/agent, internal/provider); go build darwin, windows, linux
nogui.
- go test -count=1 -run Codex ./internal/provider ./internal/agent: ok
(at 47175a68f); -run CodexApp again at 32ea16c5a: ok.
- Broken by hand: comparing only the takeover flag (the old condition)
made TestCodexAppServerRestartedOnDisconnect red ("disconnected, idle:
ended [], want [60]").
- Real app: ChatGPT.app 26.1013 under a sandbox HOME (CFFIXED_USER_HOME),
this build's magpie serve on 3492, Codex connected to a custom
provider by magpie codex fakeai/fake-1. magpie codex default: the
app's app-server 76497 ended within 5s, the app started 77343 and
logged "Codex CLI process exited classifiedAsExpected=true code=0";
window kept. Connect again: 77343 -> 79138. The owner's own app-server
(1902, HOME=~) was untouched.
Not tried: Windows and Linux real apps, a turn running during the
switch (unit-tested only), a signed-in sandbox app (it was signed out,
so no turn was sent to see the new route used).
char1eslu (#3766): AgentRouter answers gpt-5.6-sol, gpt-6-astra and
gpt-6.1-sol on chat completions with a 400, "模型 gpt-5.6-sol 不支持
/v1/chat/completions 接口,请改用 /v1/responses(OpenAI Responses API)。",
and serves them on Responses (gpt-5.6-sol on Messages too: the report's
provider test has ✓ anthropic). wrongEndpoint, the gateway's word that a
model is served on another API, which has the request asked there when
the provider has a URL for it (and remembers it in unfit), read English
alone. So while the provider had a Chat URL, a Chat client's request for
these models got that 400 back, whatever other URLs it had. The report's
200 ("/v1/chat/completions → /v1/responses") is a request translated
past chat, which d03779cc does for this host only while chat isn't
usable for the model, as after the report's url=. A Messages client's
request goes to the reporter's Anthropic URL and is answered there.
wrongEndpoint now also reads the message's two clauses, "不支持
/v1/chat/completions 接口" and "改用 /v1/responses", and asksResponses
the second, so a provider with its Chat URL alone gets the note that the
model is served on /v1/responses, which it has no URL for. Both read the
body's JSON strings decoded too (wordsOf), as the gateway's other words
are (#1669): the report quotes the message, not the body, and a relay
whose JSON escapes it (模型 ...) says the same. Neither clause
names a model, so the other two models' refusals match if their
messages differ only in the name (the report shows their 400 rows, not
their words). The routing page says so.
The same words now reach the group's checks, as retryable and
shapeRefused read wrongEndpoint. In a routing group (chat, drawing,
video, System One), a member answering this 400 ended the request there
on d03779cc: it was neither retryable nor shapeRefused, as
unservedWords' 模型.{0,12}不支持 misses these model ids by one
character. Now the next member is asked and this one isn't rested, as
for the English words. The image-tool and cache-key retries, which ask
again on a 400, don't on this one.
Not changed: a model's test, which still asks one API (the next
commit). Other relays' wordings: only the report's two clauses are
added, nor AgentRouter's other way round (a chat-only model asked on
/v1/responses), which the report has no words for.
What was run (tree 4e5bb297, on origin/main d03779cc, go1.26.8,
linux/amd64):
- TestChineseRefusalFallsBackToResponses, new: a provider with a Chat
and a Responses URL whose chat completions answers the report's 400
(its message verbatim; the JSON around it is a guess), as it is and
escaped as Python's json.dumps escapes it. A request on
/v1/chat/completions and one on /v1/messages each get the reply from
Responses, chat asked once and Responses once.
- TestWrongEndpoint: the report's 400, escaped too, and each of its
clauses alone are the wrong endpoint; "当前分组 default 下对于模型 gone
无可用渠道" (new-api's wording for a model no channel serves, written
from memory, not from the report) is not.
- TestWrongAPINote: AgentRouter with its Chat URL alone and the report's
400, as it is and escaped, gets " (asked at
https://agentrouter.org/v1/chat/completions; gpt-5.6-sol is served on
/v1/responses, which AgentRouter has no URL for)".
- The three, -count=50 -v: 150 PASS. -race -count=20 -cpu 1,2 over them
and the fallback tests beside them (WrongEndpoint, WrongAPINote,
FallsBack, OpenCodeGo, OtherRelayKeepsItsOneAPI): ok, no race.
- Broken by hand, each red:
- wrongEndpoint without the two clauses: every case of
TestChineseRefusalFallsBackToResponses, and TestWrongEndpoint's
rows of the whole message.
- wrongEndpoint with one clause of the two: TestWrongEndpoint's row of
the other clause alone (each).
- wrongEndpoint reading the body as it came: the escaped cases of
TestChineseRefusalFallsBackToResponses and TestWrongEndpoint's
escaped row.
- asksResponses without its clause: TestWrongAPINote, both bodies;
reading the body as it came: its escaped one.
- A real run: magpie built at d03779cc and at this tree (go build -tags
nogui -buildvcs=false), in a sandbox HOME, a local server standing in
for AgentRouter (its /v1/models lists gpt-5.6-sol, chat completions
answers the report's 400, /v1/responses and /v1/messages answer), set
up as the report has it: magpie provider add agentrouter url=...
key=... models=gpt-5.6-sol and anthropic=..., then responses=..., then
url= (the chat URL cleared). At each step magpie serve, and curl on
/v1/chat/completions (whole and streamed) and /v1/messages:
- Chat and Anthropic URLs: d03779cc answers both chat requests with
the 400; this tree 200, chat asked once and /v1/messages after it.
- Chat, Responses and Anthropic URLs: d03779cc answers both chat
requests with the 400; this tree 200, chat asked once and Responses
after it (the streamed one went to Responses at once: unfit).
- The chat URL cleared: both builds 200, the chat requests answered
on Responses.
- /v1/messages: 200 at every step on both, from /v1/messages.
- gofmt -l; go vet -tags nogui and go build -tags nogui for linux,
windows and darwin, and go vet and go build for windows without the
tag: exit 0 each. go vet and go build without the tag on linux: exit
1 (this box has no GTK or WebKitGTK dev packages).
- go test -tags nogui -count=1 -timeout 45m ./..., Bun 1.4.2 on PATH:
67 ok, and 7 red, none in what this changes: agent
TestInstalledVersion, TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath (#3141);
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641); davsync TestSync
(#3420); edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram
(#3640); gateway TestPluginToldWhereTheAgentWorks (#3675); gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649); provider's "close of synctest channel from outside bubble"
from TestUnreadLoginsWriteErrorsKeepCredentials (#3632), so the
package's tests after it didn't run: go test ./internal/provider
-skip '^TestUnreadLoginsWriteErrorsKeepCredentials$', Bun 1.4.2 on
PATH: ok.
Not tried: the real AgentRouter (no account here), macOS, an agent's
own requests (curl's stood in).
---- provider (second commit of the branch) ----
provider: a model turned away on one API is tested on the next (#3766)
char1eslu (#3766): after Test models, the three models AgentRouter
turns away on chat completions were red in the provider's Models list,
and Working only hid them, while the gateway answered them on
Responses. Their usage rows (kind provider_test, source probe: the
editor's test) were each a 400 on /v1/chat/completions, "模型
gpt-5.6-sol 不支持 /v1/chat/completions 接口,请改用 /v1/responses(OpenAI
Responses API)。". They stayed red after the reporter cleared the chat
URL (magpie provider set agentrouter url=), with their provider test
printing only ✓ responses and ✓ anthropic.
A model's test (testOne) asked one API, the first the provider speaks
unless the vendor's list, the user's pick or the client names another,
and took its answer as the model's. The editor's Test models sends the
editor's form, whose fields that aren't empty win over the saved
provider (typed), so a form that still names a chat URL the saved
provider no longer has asks chat: in the real run below that is red at
d03779cc, as the report's rows are.
Now, when the vendor says the model isn't served there
(catalog.WrongEndpoint: the gateway's wrongEndpoint, moved with its
words so both read the same), the test asks the next API the provider
has a URL for that may serve the model, by the gateway's rule (usable:
the model's listed or picked APIs, else each API the provider isn't
named-only on), with a key that sees the model on that API (keySeeing,
testOne's pick taken out as it was). That API's answer is the model's.
One that says the same has the next asked; when none is left the first
answer stays, so a provider with its Chat URL alone still shows the
vendor's message. Test models, a model's own test and Test as in the
editor, and magpie provider test <id> <model> (--as too), go through
it. As Codex the next API is asked with Codex's headers, as the gateway
sends them on Responses and Chat; as Claude Code the test isn't moved,
since the gateway sends Claude Code's headers on Messages alone.
docs/subsystems/providers-accounts.md says so, and the routing page
points there.
Not changed: which API is asked first, so a model that moved is asked
on chat again at each test before the API that serves it (the
gateway's unfit is its own). magpie provider test <id> with no model,
which tests each endpoint with a model of its own pick (testModel), is
as it was: its chat row can be red for a model the vendor serves
elsewhere, #3844.
What was run (tree 519dee3b, on origin/main d03779cc, go1.26.8,
linux/amd64):
- TestTestModelsMovesToTheAPIServingIt, new: AgentRouter with a Chat
and a Responses URL and a key for each (sk-chat made for Chat,
sk-responses for Responses), its chat completions answering the
report's 400 (its message verbatim; the JSON around it is a guess), as
it is and escaped. gpt-5.6-sol is OK on Responses, asked on chat with
sk-chat and then on responses with sk-responses, and nothing else. A
model chat turns away with new-api's "无可用渠道" (written from memory,
not from the report) is red after one ask. With the Chat URL alone,
gpt-5.6-sol is red after one ask, its error the vendor's message. When
both APIs say it, both are asked and chat's answer stays.
- TestTestModelsKeepsAModelOnItsAPI, new: a model the user picked chat
for, and one the vendor's list names on chat alone, is red on chat
after one ask, as the gateway keeps its request there.
- TestTestModelsAsAClientMovesAsTheGatewayDoes, new: turned away on
Responses with the word, a test as Codex is green on chat, asked with
Codex's User-Agent; a test as Claude Code is red on Messages after one
ask.
- The three, -count=50: 150 PASS; the gateway's
TestChineseRefusalFallsBackToResponses, TestWrongEndpoint and
TestWrongAPINote at this tree, -count=50: 150 PASS.
- -race -count=20 -cpu 1,2, internal/provider's TestTest and TestDetect
tests and internal/gateway's WrongEndpoint, WrongAPINote, FallsBack,
OpenCodeGo and OtherRelayKeepsItsOneAPI ones: ok, no race.
- Broken by hand, each red:
- the test never hearing the vendor's word, as at the previous
commit: TestTestModelsMovesToTheAPIServingIt, and
TestTestModelsAsAClientMovesAsTheGatewayDoes as Codex;
- the next API asked with the first one's key:
TestTestModelsMovesToTheAPIServingIt, red on responses;
- the next API asked whatever API the model is picked or listed on:
TestTestModelsKeepsAModelOnItsAPI, both models green on responses
after two asks;
- a test as Claude Code moved too:
TestTestModelsAsAClientMovesAsTheGatewayDoes, green on chat;
- the words in English alone, as at d03779cc:
TestTestModelsMovesToTheAPIServingIt, the report's message as it is
and escaped;
- the words matched in the body as it came:
TestTestModelsMovesToTheAPIServingIt, escaped.
The previous commit's own breaks of the words are red at this tree
too, in the gateway's tests.
- A real run: magpie built at d03779cc, at the previous commit and at
this tree (go build -tags nogui -buildvcs=false), in a sandbox HOME,
the previous commit's stand-in and steps. magpie provider test
agentrouter gpt-5.6-sol:
- Chat and Anthropic URLs: "✗ chat gpt-5.6-sol · 400 · 模型
gpt-5.6-sol 不支持 ..." at d03779cc and the previous commit, chat
asked alone; "✓ anthropic" at this tree, chat asked and then
/v1/messages.
- Chat, Responses and Anthropic URLs: the same ✗ chat, then; "✓
responses" at this tree, chat asked and then /v1/responses.
- The chat URL cleared: "✓ responses" at all three, responses asked
alone.
Then, the chat URL cleared, magpie web's /api/provider/test (the
editor's Test models) for gpt-5.6-sol: with the form naming the old
chat URL, red on chat with the vendor's message at d03779cc and the
previous commit, green on responses at this tree (chat asked, then
responses); with the form's chat empty, green on responses at all
three. The gateway answered as at the previous commit.
- gofmt -l; go vet -tags nogui and go build -tags nogui for linux,
windows and darwin, and go vet and go build for windows without the
tag: exit 0 each. go vet and go build without the tag on linux: exit
1 (this box has no GTK or WebKitGTK dev packages).
- go test -tags nogui -count=1 -timeout 45m ./..., Bun 1.4.2 on PATH:
67 ok, and 7 red, none in what this changes: agent
TestCodexDriftReached and TestCodexBehindReverseProxy (#3398);
TestInstalledVersion, TestHowInstalled,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath (#3141);
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641); davsync
TestSyncTeraCloudStillSeesOtherWrites (#3420); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (#3640);
gateway TestPluginToldWhereTheAgentWorks (#3675); gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649); provider's "close of synctest channel from outside bubble"
from TestUnreadLoginsWriteErrorsKeepCredentials (#3632), so the
package's tests after it didn't run: go test ./internal/provider
-skip '^TestUnreadLoginsWriteErrorsKeepCredentials$', Bun 1.4.2 on
PATH: ok.
Not tried: the editor itself (magpie web's route, which its Test models
posts to, stood in), macOS, the real AgentRouter (no account here).
Review (yetone/magpie maintainer agent): the two commits of
JoeyWu-tech's branch (387191d5a, f8fcf936e, patch sha256 15d451ff…,
as the issue says) squashed into one, one commit per issue. Read every
line. The only other place reading these words, asksResponses (the
note that a provider lacks a Responses URL), reads the Chinese and the
escaped body too; no other matcher of a wrong-API refusal is left
(grep for the English phrases outside catalog.go).
Run at this tree on 6cb1cfb79, macOS, go1.27:
- red by hand: the two Chinese phrases taken out of WrongEndpoint:
TestChineseRefusalFallsBackToResponses (all four subtests) and
TestTestModelsMovesToTheAPIServingIt red. The next-API loop in
testOne off: TestTestModelsMovesToTheAPIServingIt and
TestTestModelsAsAClientMovesAsTheGatewayDoes red. Green restored.
- real run, macOS: base and patched builds in a sandbox HOME, a fake
AgentRouter (chat answers the report's literal 400, Responses
answers), magpie provider add agentrouter url=… responses=…, then
magpie provider test agentrouter gpt-5.6-sol and magpie serve with a
/v1/chat/completions request. Base: "✗ chat … 400 · 模型 gpt-5.6-sol
不支持 …" and the client gets the 400. Patched: "✓ responses", and
the client gets the answer from /v1/responses (vendor log: chat,
responses, chat, responses).
- at the pushed head (rebased on 5f3146be0; the docs conflict with
#3696's sentences merged, both kept): go build ./..., go test
./internal/catalog ok; gateway -run
'WrongEndpoint|WrongAPI|Fallback|FallsBack|Chinese|OtherAPI|Endpoint|OpenCode'
ok (50s); provider -run 'TestTestModels|TestTest|TestOne|Probe' ok;
vet linux and windows of the three packages ok; gofmt -l clean.
The whole gateway and provider packages were not run at this head:
another session's go test ./... held the machine (one suite at a
time).
Not tried: the real AgentRouter, the GUI editor itself.
What changed: on a DeepSeek model behind an Anthropic Messages endpoint
(anthropicReplaysThinking), magpie gives each tool turn that has no
thinking a block of its own, {"type":"thinking","thinking":" "}
(withThinkingOnToolTurns), and replays a turn's unsigned thinking as its
text (anthropicBody with replay). Both went out with no signature field:
aBlock's Signature is omitempty. OpenRouter's /api/v1/messages holds a
thinking block's signature to a string, so become2206's Claude Desktop
conversation on openrouter/deepseek/deepseek-v4.1-flash-1017 was turned
away after its first tool call ("OpenRouter: Invalid Anthropic Messages
API request", metadata path [..., 0, "signature"], "expected string,
received undefined"), on every retry. The reporter's capture shows the
same body with only "signature": "" added getting 200.
aBlock.MarshalJSON already writes a thinking block's "thinking" even
when empty; it now writes "signature" the same way. That is the one
place both blocks above are written, so the placeholder, a redacted
block turned into it, and replayed reasoning all carry "signature": "".
A signed block goes as before. Claude's own models and api.anthropic.com
are never replayed and are sent only signed thinking (anthropicBody), so
nothing changes for them.
Tests: TestOpenRouterDeepSeekThinkingHasASignature sends Claude
Desktop's Messages turns (relayed, gateway.go's withThinkingOnToolTurns)
and a Chat client's translated turns with reasoning_content to a fake
upstream that answers as #2883 quotes OpenRouter when a thinking block
has no string signature. The three tests that pinned the old bytes
(TestDeepSeekAnthropicToolTurnsGetThinking, TestDeepSeekAnthropicNoThinkingField,
TestAnthropicReplyAfterToolGetsThinking) now expect "signature":"".
Run:
- Breaks: with aBlock.MarshalJSON reverted,
TestOpenRouterDeepSeekThinkingHasASignature fails at the Messages case,
"messages: 400 after 1 calls: {"error":{"message":"OpenRouter: Invalid
Anthropic Messages API request",...". With a narrower fix that only
gives the placeholder in withThinkingOnToolTurns a signature, it fails
at the Chat case, "chat: 400 after 1 calls: ... Invalid Anthropic
Messages API request", so the replayed-reasoning path is held too.
Both pass restored.
- gofmt -l clean on the three files. go vet ./... for linux -tags nogui,
windows, and darwin -tags nogui: ok. go build for the same three: ok.
- Full `go test -tags nogui -timeout 45m ./...` on Linux amd64, go1.26.8,
at base c483feadf (origin/main as of 10-19 05:33 UTC) + this: 57
packages ok (20 of them from Go's test cache, unchanged since a first
full run of this tree that lacked only the
TestAnthropicReplyAfterToolGetsThinking line), 20 with no tests. Every
red is in a test this change doesn't reach, and each was run on
unmodified c483feadf:
- umask 077 on this box: edit's TestWriteAtomicReadOnlyHardLink and
testenv's TestProgram (fixtures written 0444/0755 come out
0400/0700). Both pass with umask 022.
- a broken /tmp/.git left on this shared box: agent's
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout ("error obtaining VCS
status: exit status 128" building their fixture).
- red on c483feadf too, cause not pinned (this box's PATH and proxy
setup): agent's TestInstalledVersion, TestOmpDetectedWithPiDir,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI (3 of 3),
TestQoderSettingsFromAnIDEPluginIsNotTheCLI/qoder-cn (3 of 3),
TestCursorFolderFromTheEditorIsNotTheCLI (1 of 3) and TestZedAppPath
(2 of 3); claudebridge's TestCallbackGoesPastTheAgentsProxy;
gateway's TestClaudeToolCallbackOnANonLoopbackAddress; gui's
TestGatewayHeldByAContainer.
- red only in a full run, ok alone 3 of 3: davsync's TestSync, and
imagemcp's TestStalledDownloadSaysWhereTheImageIs (red in the first
full run only).
internal/gateway run again alone at the final tree: ok but for
TestClaudeToolCallbackOnANonLoopbackAddress, as above.
Real DeepSeek: on 2026-10-19, api.deepseek.com/anthropic,
deepseek-flash, a conversation whose assistant turn calls a tool and the
next user turn answers it, the assistant turn sent five ways: with no
thinking block, 400 "The `content[].thinking` in the thinking mode must
be passed back to the API"; with {"thinking":" "} (magpie before this),
with {"thinking":" ","signature":""} (after), with replayed text and no
signature, and with replayed text and "signature":"": each 200 with a
thinking block and the answer. So DeepSeek's own endpoint takes the
empty signature.
Not tried: OpenRouter itself (no account here); the fix rests on the
reporter's single-field experiment against it. darwin with the GUI
(cgo, Wails) wasn't vetted, as it can't be cross-built from Linux.
Review (yetone/magpie maintainer agent), for #3696 (magicseek), which is
#2883's problem A plus a problem B this patch didn't look at:
B: Claude Code 2.1.302 puts a turn's effort as output_config on a
{role: "system"} message; OpenRouter takes it as a configuration_update
and answers 400 "Mid-conversation reasoning effort (configuration_update)
is not supported on <model>" on DeepSeek and GLM. magpie already learns a
relay's refusal of exactly this field ("messages.1.output_config: Extra
inputs are not permitted", refuseShapes/shapeTurnEffort) and asks again
without it, keeping the request's own output_config and the system
message's text, then never sends that provider it again while it runs.
turnEffortRefused now also matches OpenRouter's wording, so the same
mend runs there. It is learned per provider, so a Claude model on the
same OpenRouter provider loses its per-turn effort too, as Claude Code
itself does after such a 400; the request's top-level effort stays.
Not done from the report: re-roling system messages to user, and pinning
a conversation's effort. The report's row "system message, no
output_config, DeepSeek: 400 Invalid Anthropic Messages API request" is
footnoted as the A/B combination, and OpenRouter's generic 400 names no
field magpie could learn from without also catching A's; asked on the
issue for that error's metadata path.
Tests: TestOpenRouterTurnEffortLeftOut sends the report's minimal
conversation plus Claude Code's system message with output_config, on
deepseek/deepseek-v4.1-flash-1017 and z-ai/glm-5.3-flash, to a fake that
answers the report's literal 400 for a message's output_config and
openRouterRefuseAnthropic's for an unsigned thinking block: 200 on the
second call, and the next request goes on the first.
Run at 810b00d07 + this on b92cb2f59 (origin/main), macOS, go1.27:
- red with turnEffortRefused reverted: both subtests "400 after 1 calls"
with OpenRouter's Mid-conversation message. Red with aBlock.MarshalJSON
reverted and B kept: the deepseek subtest "400 after 2 calls ...
Invalid Anthropic Messages API request", and
TestOpenRouterDeepSeekThinkingHasASignature. Green restored.
- go test -tags nogui ./internal/gateway -run
'Shape|Refus|OpenRouter|DeepSeek|Thinking|Effort|SystemMessage': ok.
- gofmt -l clean; GOOS=linux go vet -tags nogui and GOOS=windows go vet
./internal/gateway: ok.
- full go test -tags nogui -timeout 45m ./internal/gateway at 136f96b22
(on 47175a68f): ok (549s).
Not tried: OpenRouter itself (no account here); both halves rest on the
reporter's captures.
jilen (#3728): fx asked magpie for codex/gpt-6.1-sol on
/v1/chat/completions and showed "system: InvalidChunk: Invalid Chat
Completions response at model (event 1).", while the usage log had the
vendor's 502, an EOF from chatgpt.com. No stream was saved, but fx's
InvalidChunk at event 1 says one had begun: magpie had kept fx alive
with the stream's headers and comments, so the failure went as an
event of that stream (streamError). The encoder streamError made, from
an empty Request, began the message before the error with a Chat chunk
whose "model" was "". fx takes a chunk with an empty model for a broken
one and stops there, so it never read the error after it. Anthropic's
message_start and Responses' response.created, response.in_progress
and response.failed went out with an empty model the same way.
keptAlive now keeps the model the request names when serve takes it,
as magpie spells it there: a flat id (a~m) is its catalog id, a dashed
Claude id its dotted one, and Codex's own model through magpie's
accounts codex/<model>. An effort the agent put on the model is kept on
it (a/m:high), the name it asked by. serve has it from the body it
already read for askedAt; on Codex's own sign-in (codexUpstreamOn) it
is the model Codex wrote, which its turn already read. Neither reads
the body again. streamError begins with that model, from failTo,
holdWriter.release and Codex's failWith. Gemini's error names no model,
as before. docs/subsystems/gateway-routing.md says so.
fx still shows no reason. Its Chat reader ends the stream with
ProviderError at an event with an "error" key and keeps nothing of it
(src/gateway/chat_completions_protocol.zig:723 in fx 0.0.14, :710 on
fx's main e71a663b); only an error status's body reaches its message.
So fx says ProviderError where it said InvalidChunk, and the vendor's
EOF is in the stream and magpie's usage log, not in fx.
Not changed: an error after a reply that already went, a loop cut's
(cutLoop), starts a message of its own after the vendor's, under a new
id. A model in it wouldn't help, fx stops at the new id: #3792. Nor the
error's shape: the encoders still begin a message ahead of it. fx looks
for an event's "error" before its id and model, so an error alone would
get past it too, but no other agent was tried on one; that is #3792's
question as well.
What was run (tree 908b9857, on origin/main 2beed3b0, go1.26.8,
linux/amd64):
- TestStreamErrorNamesTheModel, new: streamError in each protocol with
the report's model and message. Chat's, Anthropic's and Responses'
events name that model and no other, Gemini's none, and each has the
message.
- TestKeptAliveChatErrorNamesTheModel, new: a Chat stream through serve,
kept alive while the vendor says nothing, then the vendor gone with no
reply (the EOF), or answering 502, 413, a 200 that isn't a stream, or
a JSON 200 that is no reply. In each, the stream's first chunk names
a/m and the error follows; the 413's says request_too_large. Asked
for a/m:high, the vendor gone, the first chunk names a/m:high.
- TestKeptAliveChatOnCodexErrorNamesTheModel, new: the report's route, a
Chat stream on magpie's codex provider (Codex's sign-in), the ChatGPT
backend a local server that says nothing until the stream was kept
alive and then hangs up, each time it is asked. The first chunk names
codex/gpt-5.5, and the error after it has the backend's EOF.
- TestKeptAliveCodexErrorNamesTheModel, new: Codex on its own sign-in,
the backend overloaded, Codex kept alive while the turn waits to be
asked again, then the backend gone. Every model its events name is
gpt-5.5, the model Codex asked for, and they name one.
- The four, -count=50: ok.
- -race -count=20 -cpu 1,2 over them and the stream tests beside them
(TestStreamError*, TestGroupLastFailureInStreamSaysItPasses,
TestStreamedByteCap, TestLoopEnds, TestLoopCutMidLine,
TestCodexOneAccountOverload, the Quiet ones): ok, no race.
- Broken by hand, each red:
- streamError's encoder made from an empty Request again:
TestStreamErrorNamesTheModel, every case of
TestKeptAliveChatErrorNamesTheModel,
TestKeptAliveChatOnCodexErrorNamesTheModel and
TestKeptAliveCodexErrorNamesTheModel.
- serve's keptAlive with no model: every case of
TestKeptAliveChatErrorNamesTheModel and
TestKeptAliveChatOnCodexErrorNamesTheModel.
- keptAlive given the model without its effort: the a/m:high case
alone.
- failTo naming none: the 413 case.
- holdWriter.release naming none for a reply that is no reply: the
JSON 200's case; for an error status: the vendor gone, a/m:high,
the 502, the 200 that isn't a stream, and
TestKeptAliveChatOnCodexErrorNamesTheModel.
- Codex's keptAlive with no model, or its failWith naming none:
TestKeptAliveCodexErrorNamesTheModel.
- A real run: magpie built at 2beed3b0 and at this tree (go build
-tags nogui -buildvcs=false), magpie serve in a sandbox HOME, a
provider (a local server) that holds its first answer 20s and then
hangs up, or answers 502, and fx 0.0.14 asking it through
/v1/chat/completions (fx ask, its settings' provider
openai-chat-completions at the gateway), with --json and without.
fx exits 1 after about 53s each time: InvalidChunk at 2beed3b0, all
four times (hang-up and 502, --json and not), ProviderError at this
tree, all four. curl asking the same: ": keepalive" lines, then a
first chunk with "model":"" (2beed3b0) or "model":"up/m" (this
tree), then the error with the vendor's EOF or 502.
- gofmt -l; go vet -tags nogui and go build -tags nogui for linux,
windows and darwin, and go vet and go build for windows without the
tag: exit 0 each. go vet and go build without the tag on linux: exit
1 (this box has no GTK or WebKitGTK dev packages).
- go test -tags nogui -count=1 -timeout 45m ./..., Bun 1.4.2 on PATH:
67 ok, and 7 red, none in what this changes: agent
TestCodexDriftReached (#3398); TestInstalledVersion,
TestHowInstalled, TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir (#3141);
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641); davsync
TestSyncTeraCloudStillSeesOtherWrites (#3420); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (#3640);
gateway TestPluginToldWhereTheAgentWorks (#3675); gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649); provider's "close of synctest channel from outside bubble"
from TestUnreadLoginsWriteErrorsKeepCredentials (#3632).
Not tried: the real chatgpt.com (it needs a ChatGPT account); the
ChatGPT backend was a local server that hangs up. fx's interactive
view, where the report's line came from.
Review (yetone/magpie maintainer agent), for jilen's #3728:
- Read every line. The only encoder built with an empty Request is
streamError's; its five callers (failTo, holdWriter.release's two
cases, cutLoop, Codex's failWith) are each given a model, cutLoop ""
on purpose (#3792).
- Red by hand at c711c3391 on 1cbdda25b, macOS, go1.27: streamError
back to &Request{}: all four new tests red; keptAlive built without
model: the two Chat kept-alive tests red; Codex's kept.model unset:
TestKeptAliveCodexErrorNamesTheModel red. Green restored.
- go test -tags nogui -race ./internal/gateway -run
'NamesTheModel|TestStreamError': ok. Full go test -tags nogui
-timeout 45m ./internal/gateway: ok (573s).
- gofmt -l clean; GOOS=linux go vet -tags nogui and GOOS=windows go vet
./internal/gateway: ok.
- Real run: magpie serve (base and patched builds) in a sandbox HOME, a
fake Chat vendor that holds 20s then answers 502, a streamed
/v1/chat/completions for fakev/fake-model. Base: the kept-alive first
chunk says "model":"", then the error. Patched: "model":
"fakev/fake-model", then the same error.
- Rebased onto ab546a4ee (gateway changed since): gofmt, vet linux and
windows, and go test ./internal/gateway -run
'NamesTheModel|StreamError|KeptAlive|KeepAlive|Alive|Codex' again
there: ok. The full package ran at the earlier base only.
- Not tried: fx itself, the real ChatGPT backend.
fremontdango on Discord ran two magpies. On the local one, a routing
group held one model from two providers of the remote magpie
(office/first/m, office/second/m). Its conversations were kept as if the
two were one vendor, because both are the one remote-magpie key here
(candidate.who()). The same group made on the remote behaved
differently:
- strict: when the first provider ran out, the conversation failed over
to the second, though strict means it never moves
- session/auto: with the first gone, the "same account, other model"
match kept the conversation on the second as "session", though nothing
of it was cached there
- the second's refusal of the first's sealed reasoning was recorded
against the whole remote, so the first's own seals were then taken out
of requests to it
- a native compaction one sealed went to the other too
There is now a vendor identity for these: candidate.vendor() and
sameVendor(who, model). Behind a remote magpie it is the key plus the
remote's provider, the model id's first part (remoteUpstream). A remote
group is one vendor by its whole id, and a model named without a
provider is the key alone. It is used by:
- affine's widest match
- strictOnly and strictKeep
- unanswered
- refused/withoutRefused
- checkpointReaders (native compaction)
- Codex leadFirst
Lanes, requests a minute and leastHeld's per-model seat stay on who(),
the limits the user set on the key here. Sticks and compaction writers
are stored as before (who plus model), so the sticks saved on disk still
match after the update. Only the local magpie (the one with the group)
needs this version.
Run:
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok
(559s) at 040a4ec29. After rebasing onto ab546a4ee (busy.go,
draw.go, gateway.go changed upstream): vet, gofmt and -run
'TestRemote|Strict|Affinity|Stick|NativeCompaction|Refused|Lead|Busy|Draw':
ok
- go vet (darwin, GOOS=linux, GOOS=windows, -tags nogui)
./internal/gateway, and gofmt -l: clean
- Two sandbox magpies, each under its own HOME/XDG dirs: the remote on
127.0.0.1:47611 with providers first and second (model m1, one fake
upstream on :47613 that answers 429 to first's key once a flag file
exists), and the local on :47612 with a Remote magpie provider and a
strict, ordered group of office/first/m1 and office/second/m1. Turn 1
of a session went to first. With the flag set, turn 2:
- local on origin/main: 200 from office/second/m1 (moved)
- local on this change: 429 "Office: First: usage limit reached"
(kept), and a new session went to second
Broken by hand: sameVendor reduced to c.who() == who made
TestRemoteMagpieStrictKeepsTheRemotesProvider fail (went to second) and
TestRemoteMagpieOtherProviderIsNotTheSameAccount fail (traced
"session", want "gone").
Not tried: the sealed-reasoning and native-compaction paths through a
real remote. They use the same sameVendor/vendor, and the package tests
for them pass. Three layers (local, middle, remote): the middle's
provider is the vendor here, and the middle keeps its own providers
apart.
lileo0668 (Discord, #help) added SenseNova's API (token.sensenova.cn/v1)
as a provider. sensenova-u1.5-lite showed in its model list but not in
Settings' image generation picker, so magpie's generate_image couldn't
use it.
SenseTime's launch post for U1.5 Lite on the Token Plan says it is an
image model only (no chat), served at /v1/images/generations and
/v1/images/edits in OpenAI's shape; an edit is JSON with
"images": [{"image_url": "<https URL or data URL>"}], and
response_format is url (a 24h link) or b64_json.
- catalog.DrawsID and ImagesAPI know "sensenova-u1" (u1.5-lite,
u1.5-fast), so the model a vendor's /models lists is a drawer, listed
in the picker and asked on the images API, not chat.
- drawImages, for those models only: ask for b64_json, and send an edit
as JSON with the images as [{"image_url": data URL}], the shape
ChatGPT's backend takes, instead of the multipart form other OpenAI
images APIs get. No other vendor's request changes.
Test: TestSenseNovaU1Draws (internal/gateway) fetches a fake SenseNova
/models (a chat and the U1 model), checks Drawers lists the U1 model
alone, draws it (images API, b64 back, chat never asked) and edits it
(JSON images). Broken by hand: without "sensenova-u1" in DrawsID it is
red (drawers []); with senseNovaDrawer returning false it is red (the
fake answers a link, image ""), and the edit would go multipart.
Run at this head: gofmt -l (clean), go vet ./..., GOOS=linux go vet
-tags nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go
build -tags nogui, GOOS=windows go build, and
go test -tags nogui -timeout 45m ./internal/catalog ./internal/gateway
./internal/provider ./internal/imagemcp ./internal/gui: catalog, gateway
(566s), imagemcp and gui ok; provider crashes in
TestUnreadLoginsWriteErrorsKeepCredentials (synctest channel closed
from outside its bubble in filememo.Forget), which is #3632, open and
red on main since 091153bf, and not touched here. After the rebase onto
origin/main 8b0132b3d: gofmt, vet (three OSes) and the catalog tests
plus TestSenseNovaU1Draws and the draw tests (-run 'Draw|Image|Edit')
again.
Not tried: a real SenseNova key (none here); its exact /models bytes and
the full answer JSON are from its docs, not a capture. Not run: the full
./... suite (load ~90) and the GUI Playwright suite (no GUI asset
changed). A mask on an edit is passed as in Codex's shape; SenseNova's
docs don't name a mask.
Reported by lileo0668 (Discord).
250adf5e (#3185) has Keep, turned off, wait on filememo.Written for
the setting, but it took the channel after the look (level, which is
settings.Load in the gateway), not before it. A save in between, the
user turning Keep awake on, had Forget close the channel from before
the look, and Keep waited on the one made after it until its beat,
filememo.OthersEvery(): 5s polled, a minute while Watch runs (where
the watch's event for the same save still woke it, if that came after
Written). A write from the CLI or a second magpie, which only the
watch's wake tells of, had the same window. The window is narrow, from
Load's read of settings.json (its unlock, for a save in this process,
which waits for that) to Written, and wider only while let() lets go
of a hold. It came up in review of #3632.
Keep now takes Written before the look, as middleware's observer,
OTel's session watch, pluginrt.KeepFresh and the agent's Codex daemon
check do, and waits on that channel when the look found it off. On,
it waits for its tick alone, as before: the channel is taken on every
pass but waited on only after a look that found it off.
What was run (tree e8e23dae, on origin/main ef0a03e1, go1.26.8,
linux/amd64):
- TestKeepOffSeesAWriteDuringTheLook (new): the level func turns the
setting on and writes it (filememo.Forget) right after its read, at
least 2s before the next beat, and Keep must ask it again before that
beat. It times its own level func's second call, not a hold: a Keep
that another test's failure leaves running holds through the same
stand-in. ok at -count=5, 0.00s each.
- Broken by hand, each put back after, -count=3 of the new test alone
and of the whole package:
- ef0a03e1's awake.go (Written taken after the look): red 3 of 3
and 3 of 3, the new test only, "turned on during the look, the
setting was looked at again 4.999540055s after it was written, at
the beat (00:22:45), not at once", 4.46s to 5.00s across the six.
- Written taken right after level(): the same, 4.44s to 5.00s.
- Written taken before the look but not waited on when off: the
new test red 3 of 3 and 3 of 3, 4.43s to 5.00s; in the whole
package TestKeep and TestKeepOffWaitsForTheSetting go red beside
it.
- Written taken once, above the loop: every test passes, the new
one too. After the first write Keep would spin while off, and no
test writes and leaves it off; noted on #3687, with the other test
fixes this file needs.
- The new test started 1.5s before a beat, so that it waits that beat
out before the write (a scratch wrapper, not committed): ok 3 of 3,
and red 3 of 3 with ef0a03e1's awake.go, 5.00s each.
- Outside graftcp, ./internal/awake with -race -count=20, -count=20,
and -race -shuffle=on -count=20: 100 of 100 ok each. The new test
took 0.00s in 19 of each 20, and 1.87s, 1.91s and 1.90s in the one
that started under 2s before a beat. TestKeepOffWaitsForTheSetting,
unchanged here, is red about once in 100 runs on 098ac969 (4 of 400)
when a 5s beat lands in its 50ms window: #3687. It didn't come up in
these runs.
- gofmt -l clean; GOOS=linux and darwin go vet -tags nogui ./...,
GOOS=windows go vet ./..., GOOS=linux and darwin go build -tags
nogui ./... and GOOS=windows go build ./...: exit 0 each. go vet and
go build ./... without the tag on linux stop at pkg-config here (no
libsoup-3.0 or gio-unix-2.0), exit 1.
- Full suite outside graftcp (systemd-run, umask 077, Bun 1.4.2 first
on PATH as on CI, -timeout 45m, log kept): 66 ok, awake, beat,
filememo and settings among them, and 6 red, none in what this
changes:
- agent TestInstalledVersion, TestHowInstalled,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir: #3141;
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: #3641.
- edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram: this
box's umask 077, #3640.
- gateway TestPluginToldWhereTheAgentWorks: this box's /tmp/.git,
#3675.
- gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
#3649.
- provider: "fatal error: close of synctest channel from outside
bubble", main's CI red, #3632.
Not tried: a real gateway with Keep awake turned on inside the window
(it is too narrow to hit by hand; the test puts the write there), and
macOS and Windows, vet and build only (nothing here depends on the OS).
Reviewed on macOS arm64, go1.26.8: internal/awake -race -count=20 ok.
Broken by hand: main's awake.go turned TestKeepOffSeesAWriteDuringTheLook
red twice of two ("looked at again 4.09s / 5.00s after it was written,
at the beat"). The other loops waiting on filememo.Written (middleware
points, otlp sessions, pluginrt config, codex daemon) already take it
before their look. gofmt clean; vet ok for linux nogui, windows, darwin.
Part 1 of 2, pruneDist (coffemon's first commit):
pruneDist took out every tarball in plugins/dist that
plugins/package.json doesn't name, as encoding/json reads it. Bun
installs a package from the tarball bun.lock's packages has it at, and
that can be one package.json has moved on from: gkd2323c's lock (#3622,
Windows, Bun 1.4.4) had autoclaw, codearts and cloudflare-workers-ai at
the tarballs before the ones package.json names, and those were gone
from plugins/dist, where nothing but pruneDist takes a file out. With
Bun's own copy of such a tarball, every bun command that changes
plugins/ puts the older version back; with none, every add and removal,
of any plugin, fails with "ENOENT extracting tarball from <that
package>" (part 2 has the likely why there was none).
Now a tarball the lock's packages has a package at stays, beside the
ones package.json names. Kept, it is what Bun installs: a package whose
lock is behind package.json stays at the older version without a word,
where 4e5b2ad8, once Bun had no copy, failed every command with ENOENT.
part 2 sends such a lock back to package.json before each bun
command when package.json has the package at a dist tarball too; with
package.json at npm it stays behind (#3720). package.json is read as
text, every dist/<file> in it counting, where encoding/json keeps one
value of a key named twice: Bun 1.4.0 adds a tarball's package a second
time instead of replacing it, the new tarball first, which Bun reads,
and encoding/json reads the second, so 4e5b2ad8 took out the tarball Bun
installs from. No magpie runs plugins on that Bun unless MAGPIE_BUN
names it (BunVersion has been 1.4.2 since 10-03, before plugins/dist
was), so that is how a decoded package.json loses it, not a path a user
is known to have taken. A tarball only the lock's workspaces names goes:
Bun 1.4.2 and 1.4.3 leave the one an add replaced there until their next
command, and nothing installs from it. With no bun.lock, package.json
alone decides, as before; with one that can't be read, nothing goes, as
with a package.json that can't be read.
This keeps the tarballs a lock has from going, and mends no lock: one
behind package.json's dist tarball, the reporter's or one that falls
behind later, is sent back by part 2, its tarball there or
gone.
What was run (tree 8f285445, on origin/main 4e5b2ad8, go1.26.8,
linux/amd64):
- TestDistTarballTheLockNamesStays (new): the reporter's package.json
and lock, built around the lines #3622 quotes; the package.json real
Bun 1.4.2 writes for `bun add ./dist/<0.2.6>` over 0.2.1, and the one
Bun 1.4.0 writes (the package named twice), each with the lock both
write, and the Bun 1.4.0 one with no lock; no lock; a lock that can't
be read (a folder in its place). The tarballs the lock's packages or
package.json name stay, the one only the lock's workspaces name goes,
and one nothing names goes; with no lock package.json alone decides,
and with an unreadable one nothing goes. With the change the TestDist
tests are ok on each Bun. Broken by hand, each put back after, with
Bun 1.4.2, 1.4.3 and 1.4.4 (outside graftcp, the proxy wrapper this
box runs commands in, umask 077, logs kept):
- 4e5b2ad8's pruneDist: the reporter's, both named-twice and the
unreadable-lock cases red on each ("<tarball> taken out");
- package.json decoded as 4e5b2ad8 did, the lock still read: the
named-twice case with no lock red on each ("<0.2.6> taken out");
- the whole lock read for tarballs instead of its packages: the
workspaces case red on each ("0.2.1 kept"), and
TestDistInstallsAPackageNPMDoesntHave red on 1.4.2 and 1.4.3
(0.1.4's tarball stays after 0.1.3 is pinned: those two leave it in
the workspaces).
- internal/plugin, -tags nogui, with Bun 1.4.4, the one magpie runs now:
ok but TestPluginSOCKSProxy, red the same at origin/main 7a60e78c
(#2207, open, filed for 1.4.3); TestFlowBigReplyProd and
TestRenewOtherHost skip by their own condition.
- gofmt -l lists nothing; GOOS=linux, windows and darwin go vet -tags
nogui ./..., GOOS=windows go vet ./..., GOOS=linux and darwin go build
-tags nogui ./... and GOOS=windows go build ./...: exit 0 each. go vet
and go build without the tag on linux: exit 1 (no GTK, WebKitGTK or
fontconfig headers on this box).
- Full suite, -tags nogui (CI's Linux job tags gtk3), outside graftcp
(systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout
45m, log kept): 64 ok, internal/plugin among them, and 8 red, none in
what this changes:
- agent TestCodexDriftReached and TestCodexBehindReverseProxy: #3398;
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir: #3141;
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: this box's /tmp/.git,
#3641.
- davsync TestSyncTeraCloudStillSeesOtherWrites: #3420.
- edit TestWriteAtomicReadOnlyHardLink: this box's umask 077, #3640.
- gateway TestPluginToldWhereTheAgentWorks: this box's /tmp/.git,
#3675.
- gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
this box's millions of open fds, #3649.
- provider: "fatal error: close of synctest channel from outside
bubble" in TestUnreadLoginsWriteErrorsKeepCredentials, main's CI
red, #3632; the package's tests after it didn't run.
- sessions TestAgyTitleLater: a same-size write in the same mtime
tick, 2 of 200 on main alone, #3708.
- testenv TestProgram: this box's umask 077, #3640.
Not tried: Windows, where the reporter is (CI's Windows job runs none of
these tests: it compiles them and runs a named few). package.json and
the lock are read for the forward-slash form magpie hands Bun
("./dist/<file>"), which the reporter's Bun 1.4.4 on Windows kept in
both. A tarball they name only with backslashes goes, where 4e5b2ad8 on
Windows kept one package.json named so (it read package.json through
filepath.ToSlash).
Part 2 of 2, mendDist (coffemon's second commit):
The commit before keeps the tarballs bun.lock has packages at, but a
lock behind package.json stays behind: gkd2323c's (#3622, Windows, Bun
1.4.4) had autoclaw, codearts and cloudflare-workers-ai at tarballs
pruneDist had taken, while package.json and the lock's workspaces had
moved on. Bun installs what the lock has, at every command that changes
plugins/. From that tarball, kept now, or from its own copy of it, it
put the older version back without a word; with neither, every install,
update and removal, of any plugin, failed with "ENOENT extracting
tarball from <that package>". Bun keeps its copy of a local tarball in
its install cache as @T@<16hex>@@@1 on 1.4.2 and 1.4.3, and as
@T@sha512-<32hex>@@@1, the start of the tarball's sha512, on 1.4.4, so a
Bun moved to 1.4.4 has no copy of one an older Bun made (magpie takes a
Bun release two days after it is out, bunSettle: 1.4.4, out on 10-22,
from 10-24). pruneInstallCache leaves these copies alone (no package
name before their first @). On Linux, such a lock and copies made by
1.4.2 or by 1.4.3 give an add on 1.4.4 the reporter's error, for both
packages locked at gone tarballs; the same Bun's add succeeds and puts
both back at their older versions.
Now mendDist runs before each bun command that changes plugins/ (in
runBun and install, under installMu): the packages the lock has at a
dist tarball package.json doesn't name, while package.json has them at
one plugins/dist holds, get one `bun update --ignore-scripts` of them
all, which resolves them from package.json again. It comes after
a9242eb6's mendPackageJSON, which cuts what follows package.json's
object (plugins#405): mendDist decodes package.json, and with that tail
there it would return without a mend, leaving the lock behind for the
command. A package.json that names the lock's tarball too, as Bun
1.4.0's names a package twice, isn't behind. Nothing is asked of the
registry: no package on dist has a dependency (its index.json, 42
packages, on 10-26). `bun add` of them doesn't do it on Bun 1.4.2 and
1.4.3, which keep what the lock has, and with no copy of them, an update
of one package alone fails on the others still locked at gone tarballs.
Each mend is logged with the packages it sent back, so a lock that falls
behind again, which nothing here explains, leaves a line saying when.
What it can't mend is left to the command it comes before, as before:
package.json's tarball gone too, or a package.json or bun.lock it can't
read. A lock behind package.json across npm and plugins/dist it leaves
alone, and Bun installs the lock's version (#3720). A lock with nothing
stale costs reading the two files, decoding package.json and a scan of
the lock; a tarball is looked at only where the lock and package.json
name different ones.
A lock already behind, the reporter's among them, is sent back at the
next bun command magpie runs that changes plugins/, as package.json's
tarball is in plugins/dist: pruneDist never takes one package.json
names.
What was run (tree 5ae0b4a1, on origin/main 4e5b2ad8, go1.26.8,
linux/amd64):
- TestDistLockBehindPackageJSONIsMended (new), with real Bun: autoclaw
and codearts installed from plugins/dist at 0.2.1 and 0.2.0, then at
0.2.6 and 0.2.1 (the reporter's), and the lock's packages given back
the entries Bun wrote for the first ones; with Bun's copies kept, with
them gone, with the older tarballs put back in plugins/dist, as the
commit before keeps them, and with the copies gone and plugins#405's
tail after package.json's object. From each state an unrelated
plugin's add (zcode) and then its removal succeed and leave both
packages at package.json's versions, in node_modules and alone in the
lock, and package.json's specs for both as they were; the add's prune
takes the older tarballs. With the change the TestDist tests are ok on
each Bun, and the two new ones at -count=10 on 1.4.2 and 1.4.4. Broken
by hand, each put back after, with Bun 1.4.2, 1.4.3 and 1.4.4 (outside
graftcp, the proxy wrapper this box runs commands in, umask 077, logs
kept):
- no mendDist: every case red on each, the older versions back with
the copies or the older tarballs kept (`is at "0.2.1", want 0.2.6`),
the add failing with "ENOENT extracting tarball from" both packages
with the copies gone;
- mendDist before install's add only: every case red at the removal on
each, the older versions back, or with the copies gone package.json
still naming zcode after Remove;
- one `bun update` a package: both copies-gone cases red on each, the
add failing with "ENOENT extracting tarball from" both packages, as
with no mendDist (each update alone fails on the other's gone
tarball);
- `bun add` of package.json's tarballs instead of `bun update`: every
case red on 1.4.2 and 1.4.3, ok on 1.4.4;
- the trigger as first written (the lock's tarball gone): the
tarballs-kept case red on each, the older versions back (`is at
"0.2.1", want 0.2.6`);
- mendDist before package.json's tail is cut: in install, the tail
case red on each at the add, "ENOENT extracting tarball from" both
packages; in runBun, red on each at the removal, package.json still
naming zcode after Remove.
- internal/plugin, -tags nogui, with Bun 1.4.4, the one magpie runs now:
ok but TestPluginSOCKSProxy, red the same at origin/main 7a60e78c
(#2207, open, filed for 1.4.3); TestFlowBigReplyProd and
TestRenewOtherHost skip by their own condition.
- gofmt -l lists nothing; GOOS=linux, windows and darwin go vet -tags
nogui ./..., GOOS=windows go vet ./..., GOOS=linux and darwin go build
-tags nogui ./... and GOOS=windows go build ./...: exit 0 each. go vet
and go build without the tag on linux: exit 1 (no GTK, WebKitGTK or
fontconfig headers on this box).
- Full suite, -tags nogui (CI's Linux job tags gtk3), outside graftcp
(systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout
45m, log kept): 65 ok, internal/plugin among them, and 7 red, none in
what this changes:
- agent TestCodexDriftReached: #3398; TestInstalledVersion,
TestHowInstalled, TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir: #3141;
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: this box's /tmp/.git,
#3641.
- davsync TestSync and TestSyncTeraCloudStillSeesOtherWrites: #3420.
- edit TestWriteAtomicReadOnlyHardLink: this box's umask 077, #3640.
- gateway TestPluginToldWhereTheAgentWorks: this box's /tmp/.git,
#3675.
- gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
this box's millions of open fds, #3649.
- provider: "fatal error: close of synctest channel from outside
bubble" in TestUnreadLoginsWriteErrorsKeepCredentials, main's CI
red, #3632; the package's tests after it didn't run.
- testenv TestProgram: this box's umask 077, #3640.
Not tried: Windows, where the reporter is (CI's Windows job runs none of
these tests: it compiles them and runs a named few); the reporter's own
plugins/ folder; the step that left their lock's packages at the
tarballs before while package.json and the workspaces moved on. On Linux
each Bun from 1.4.2 to 1.4.4 writes the packages at the tarball an add
names, so the test makes that state by hand.
Review (macOS arm64, go1.26.8, squashed into one commit per issue, on
origin/main 1cbdda25b), plus the class plugins#405 belongs to, a file
here written over a longer one without truncating:
- bun.lock: real Bun 1.4.4 reads the lock's first object and goes on
past bytes after it (a lock with an older lock's packages appended:
`bun install` checked 1 install, no changes, tail left as it was). So
a tail doesn't stop Bun, but pruneDist's and mendDist's regexp read
the whole file: the tail's older tarball was kept, and sent to bun
update before every command. Both now read lockHead, the first
object, braces and quotes inside strings skipped.
TestDistLockTailIsntRead (bun update run for a lock whose object is
behind, not for one whose tail is, nor one with "}\"{]" in a string)
and a TestDistTarballTheLockNamesStays case (the tail's tarball
goes). Broken by hand: lockHead returning the whole file turned the
tail case and both tail subtests red ("0.2.1 kept", "bun update run:
true"); escapes not skipped turned the braces-in-strings subtest red.
- package.json: every magpie write of it is temp+rename (mendPackageJSON
since a9242eb68) but the first one install makes, an os.WriteFile;
that goes through edit.WriteAtomic now. bun's own writes are bun's.
- TestDist* ok on Bun 1.4.2, 1.4.3 and 1.4.4; broken by hand with
1.4.4: mendDist's calls removed turned
TestDistLockBehindPackageJSONIsMended red, and the old pruneDist
turned TestDistTarballTheLockNamesStays red ("taken out").
- internal/plugin whole package ok (144s); gofmt clean; vet ok for
linux nogui, windows, darwin nogui.
Not tried: Windows, where both reports come from.
Ethereal499 and Isdavexxx on X, MasterYi on Discord, #540. The Codex app greys
Send for every model, magpie's too, while the ChatGPT account it is signed in
to is used up. Its composer's gate (ChatGPT.app 26.1013) reads authMethod
"chatgpt" plus rate limit allowed=false, and it asks account/read only when its
app-server starts. ef37b6fb7 (v0.1.1381) could fail in practice:
- (a) The reopen was macOS-only, ran once per time out, only from the GUI
process. A Windows or Linux user, a magpie without its window, or a second
time out stayed greyed.
- Switch-back: the app stayed on magpie (authMethod null, no cloud tasks or
Log out) after the reset. Nothing restarted it.
- (c) Detection lag: the account was read every 5 minutes.
- The notice sat on the Providers page, not on Codex's Agents row.
Now:
- The gateway process (`provider.KeepCodexAppOnItsProvider`, every 3s, on
every OS) ends the Codex app's own app-server each time `Agent.AppOut`
flips, both ways. The app starts another at once and reads account/read
afresh. Its window, threads and drafts stay.
- It never ends an app-server while a Codex request is in flight through
magpie or ended in the last 10s (`Server.CodexBusy`, Codex's requests only),
or while a session under the Codex home has a turn open (`codexTurnOpen`).
- It ends only the app's own app-server. That one runs on stdio; one another
program starts with `--listen` is left alone (Miyi Helper runs one on this
Mac). It must also run on magpie's Codex home (`proc.EnvOf`: ps -E on macOS,
/proc on Linux; Windows can't tell).
- The exit is clean (`proc.End`: SIGTERM, or TerminateProcess with code 0 on
Windows). The app shows any other exit as a crash.
- A listing that fails is taken up again at the next look. One that outlives
3 ends, or is denied, makes the row say to quit and reopen.
- The active account is read every minute while it is held or a window is at
90% or more (`codexLookEvery`).
- Codex's Agents row says "On magpie until <reset> · ChatGPT allowance used
up". Hovering it, or opening the row, says what is off until then (cloud
tasks, the usage meter, Log out) and that it all comes back on its own. In
en, zh, zh-TW, ja and de.
- Removed: gui's keepCodexAppSending/codexAppOut, provider's episode
bookkeeping, and the Providers-page notice.
Not changed, by design:
- A Codex own model that no magpie account serves stays as it is: magpie
can't serve that turn.
- Account discovery off and "Only switch Codex's sign-in" (login=chatgpt) are
the user's own choices, and are left alone.
Full suite green at cff1a9686 (on origin/main 6ce0f14b9), below. At
4541b3e97 (rebased on 430e3050d, which touched gateway.go, app.js and
i18n.js beside this) ran: gofmt -l, go build ./..., go vet on darwin,
linux (-tags nogui ./...) and windows; go test -run Codex ./internal/provider
./internal/agent ok; GUI codex-app-out (22 ok) and codex-app-stale (20 ok),
chromium and webkit. Pushed rebased on b92cb2f59 (two more commits,
neither in these files), built, not rerun.
Run at this commit (cff1a9686, on origin/main 6ce0f14b9), with a private
GOCACHE (another session ran go clean -cache mid-run):
- gofmt -l: clean. go build ./...: ok.
- go vet: darwin (touched packages); GOOS=linux -tags nogui ./...;
GOOS=windows (touched packages).
- go test -count=1 -timeout 45m: internal/proc, internal/provider,
internal/agent, internal/gateway, internal/gui all ok, skipping four
tests red on main without this change, each already filed:
TestUnreadLoginsWriteErrorsKeepCredentials (#3632, a synctest crash
since 091153bf) and TestFetchAsksOneListOnceForTwoBasesOfIt,
TestFetchUnionsProtocolListsWithoutChat, TestFetchAsksASharedBaseOnce
(#3854, since 6eb510f78). All three of the latter fail the same at
origin/main 6ce0f14b9 and at 353519f55 without this commit.
- GUI at cff1a9686, chromium and webkit, 231 cases ok: codex-app-out (5 languages, 980 and 440px),
i18n-keys, gui-de/ja/zh-tw, codex-app-stale, codex-accounts-via,
agent-stale-copies, agent-app-restart, agent-failover, agent-connect,
agent-layout, agent-expand-steady, agent-connected-unfolded,
agent-notice-lang and codex-signin-always.
- Windows box (cross-built test binaries): proc and provider's Codex app
tests pass. TestEndExitsClean passes there and goes red with exit code 1.
- Broken by hand, each went red:
- Codex-only busy: TestCodexBusy.
- The 90% cadence: TestCodexLookEvery.
- The retry after a failed listing: TestCodexAppServerUnknown.
- The turn guard: TestCodexAppServerRestartedEachWay.
- The --listen exclusion: TestCodexAppOwnServer.
- Code 0 on Windows: TestEndExitsClean.
- The row's notice: codex-app-out.test.cjs, 4 of 4.
- Real app: ChatGPT.app 26.1013 in a sandbox HOME/CODEX_HOME, with this
build serving on 3492/3493. Codex was put on magpie as Sync does for a held
account (model_provider = "magpie", codex.out in stash.json). OpenAI's usage
reading to the app was never faked.
- The first listing ran out at load ~200, so the timeout is now 30s. The
next look ended the app-server, and the app started another 12s later.
Its profile went from "Pro · Usage · Log out" to "magpie" with no reopen,
and /api/state carried appOut.
- Undoing it ended the app-server again, and the profile came back to Pro,
Usage and Log out.
- The owner's own ChatGPT app (its app-server on ~/.codex) was never
touched.
- One webkit codex-app-out run at load 291 had one red subtest, name lost.
It passed 3 of 3 alone and in two full webkit runs.
Not tried:
- The Windows Store app (not installed on the box), and a real Codex app
on Linux.
- A real used-up account.
- A turn running in the real app while the switch happens (unit-tested
only).
linkaww on Discord: Pi through a local magpie to a remote magpie with
masking on. The remote's masking log named the request "magpie", while
its usage already said Pi. The local magpie already sends the agent
(X-Magpie-Agent / X-Magpie-Via, passOnCaller). The remote's masking log
read agentOf, the real sender, instead of callerOf, the recorded label.
So the fix is on the remote: only the remote magpie needs this version.
There is one rule now, callerFrom/callerOf, for every place the remote
says who sent a request:
- the masking log (noteMasked)
- the requests in flight (/v1/magpie/concurrency). counted runs before
withCaller, so active.add calls callerFrom itself.
- observed calls
- Codex title / tool-loop answers (answeredHere)
- Codex search and backend records, which recorded agentOf
Usage and sessions already used callerOf. The trust rule is unchanged.
The headers are taken only from a magpie/ User-Agent and are a label
only: access, key limits and behaviour (middleware Info.Agent, models
shown, stand-ins, group rules) still go by the key and agentOf. A client
that isn't magpie is logged as itself.
Run:
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok
(562s) at bdd6a6c73, this change on 1cbdda25b
- after rebasing onto 430e3050d: go vet (darwin, GOOS=linux,
GOOS=windows, -tags nogui) ./internal/gateway, gofmt -l, and -run
'TestRemoteMagpie|TestMasked|Active|Concurrency|CodexTitle|ToolLoop':
ok
- Two sandbox magpies on 127.0.0.1:47611 (remote, masking on, a fake
upstream on :47613) and :47612 (local, a Remote magpie provider to
:47611), each under its own HOME/XDG dirs. A Pi request
(Bearer magpie-pi) carrying an API key went through the local. With
the remote on origin/main, its masking/<day>.jsonl line said
"agent":"magpie" and its usage said "pi". With the remote on this
change, both said "pi". The upstream got the key masked.
Broken by hand: masked.go back to agentOf made
TestRemoteMagpieMaskedNamesTheAgent fail ("logged as \"magpie\", want
pi"). active.go back to agentOf made TestRemoteMagpieActiveNamesTheAgent
fail (Agent:magpie).
Not tried: the GUI's Privacy page on the remote. It shows the record's
agent field, which the jsonl above has. A remote reached through a
Claude Code or Codex client User-Agent (passUserAgent): there the remote
reads that agent from its own User-Agent, as before.
An agent module loads and connects under limit, whose timer interrupts
the module once its second has passed. When the timer fired just as the
call returned, Stop didn't wait for its func, which could still be on
its way to Interrupt when limit read fired. The interrupt then landed on
an idle runtime, and moejs keeps one that lands while nothing runs for
the next call, whatever it is (its Interrupt doc). That call's own limit
never fired, so nothing cleared it: the agent's every connect after
failed with "connect: interrupted: took too long" until magpie loaded
the module again. A module that takes about its second, on a busy
machine, is the case.
limit now waits for the timer's func when Stop says it has begun, then
clears the interrupt it gave. A call the timer ran out on reads took too
long when it failed, as before, and keeps what it returned when it
finished; before, which of the two it got depended on the same race.
afterFunc stands in for time.AfterFunc, so a test can hold the timer's
func.
internal/middleware's timer func can run late the same way; there it
stops only the next call, not every one after: #3742.
What was run (tree 0199ae4d, on origin/main 68ee4117, go1.26.8,
linux/amd64):
- TestLimitRunsOutAsTheCallEnds, new: in a synctest bubble the timer's
func is held as the call returns. limit hasn't returned while it is
held; once it is let go, a call that finished keeps its nil, one that
failed reads took too long, and the connect after answers at once.
- TestLimitStopsAModuleStillRunning, new, green with main's limit too:
limit's everyday case. A connect that never ends, at once or after an
await, reads "connect: took too long" and the three connects after it
answer; a load that never ends reads took too long.
- Each 50 of 50 ok, and -race -count=40 -cpu 1,2 ok with no race.
- Broken by hand, each red with its own message:
- main's limit, through afterFunc: both cases, limit returning while
the func was held and the connect after failing "connect:
interrupted: took too long", and the failed call returning the
module's own error;
- no wait for the timer's func: both, returning while it was held,
and the connect after;
- the interrupt cleared before the wait: both, the connect after;
- the interrupt also cleared as each call starts, with no wait:
both, returning while the func was held;
- no clear: both tests, every connect after;
- the timer never stopped, so every call waits for its func: both
cases, the connect after taking its whole second;
- a call the timer ran out on always reading took too long: the one
that finished;
- one that failed keeping its own error: the one that failed, and
TestLimitStopsAModuleStillRunning's three cases, with the runtime's
"interrupted: took too long".
- The issue's case, with a pause put into the timer's func before it
interrupts, a connect that busy-waits 100ms and connectLimit at 50ms
for that one call: on 68ee4117 the three connects after all failed
"connect: interrupted: took too long"; here that call returned once
the pause ended, and all three answered.
- gofmt -l lists nothing; GOOS=linux, windows and darwin go vet -tags
nogui ./..., GOOS=windows go vet ./..., GOOS=linux and darwin go build
-tags nogui ./... and GOOS=windows go build ./...: exit 0 each. go vet
and go build without the tag on linux: exit 1, pkg-config finding no
fontconfig, libsoup-3.0 or gio-unix-2.0 (no GTK or WebKitGTK headers
on this box).
- Full suite, -tags nogui (CI's Linux job tags gtk3), outside graftcp
(systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout
45m, log kept): 66 ok, internal/agentplug among them, and 7 red, none
in what this changes:
- agent TestCodexDriftReached and TestCodexBehindReverseProxy: #3398;
TestInstalledVersion, TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI,
TestOmpDetectedWithPiDir and TestZedAppPath: #3141;
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: this box's /tmp/.git,
#3641.
- davsync TestSyncTeraCloudStillSeesOtherWrites: #3420.
- edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram: this
box's umask 077, #3640.
- gateway TestPluginToldWhereTheAgentWorks: this box's /tmp/.git,
#3675.
- gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
this box's millions of open fds, #3649.
- provider: "fatal error: close of synctest channel from outside
bubble", #3632; the package's tests after it didn't run.
Not tried: Windows or macOS, and a real plugin's module that takes
about its second; the timing is injected.
Reviewed on macOS arm64, go1.26.8, rebased on 430e3050d: -race
-count=40 -cpu 1,2 on internal/agentplug ok (and -count=20 again after
the rebase). Broken by hand: main's limit through afterFunc turned both
new cases red with the messages above; dropping ClearInterrupt turned
all four red. internal/plugin, internal/library and internal/cli ok;
gofmt clean; vet ok for linux nogui, windows, darwin. Not run:
internal/agent (slow, no change there beyond the import).
aiirobyte (#3695): the gateway exited five times on 2026-10-26, and
every client was refused until it was started again. The one exit with
a stack died of "fatal error: concurrent map read and map write": two
of seenBody's goroutines in middleware.(*Run).Tried at once, one of
them in moejs's InternGoString.
A request's middleware runs in runtimes of the request's own
(serveAgent). Only one goroutine may use a runtime at a time (moejs),
and Run has no lock to hold callers to it. serve runs each try's
onProvider on them (triedOn) through the Tried the request's context
carries. For a model that can't see, magpie has each image of the
request described (seenBody), up to four at a time, and each
description is a request it makes of its own gateway on a context made
from the agent's (magpieChose(ctx)). So the descriptions carried the
agent's Tried and ran onProvider on one runtime from as many
goroutines. A model that can't search has its searches made the same
way (searchWith): a search is asked beside the agent's own stream,
which goes through the middleware's onEvent, and beside the round's
other searches, so one search is enough to share the runtime when the
middleware has onEvent. The runtime's maps were read and written from
two goroutines and the gateway died. When it didn't, the calls' values
crossed. In the runs below, hooks threw on values that weren't there
("Cannot read properties of undefined (reading 'push')", and "(reading
'messages')"), and a description went out as
{"0":0,"messages":[0,{"content":[0,{"image_url":0}],...}],...}, its
max_tokens, system prompt, text and image each turned into 0. An
earlier run of the same break (tree e1c90a00, this code with older
comments) had one image asked about twice and another never.
ownAsk takes the request's Tried off the context of those two asks, so
they go without the agent's middleware, as serveAgent's comment already
said of them ("search and vision stand-ins") and as magpie's other own
requests (titles, the classifier) go. The agent's own tries are as
before: each runs onProvider once, on its runtime. The subsystem page
now says why, and the user docs (en, zh, ja) name searches and image
descriptions among magpie's own requests.
Going without also keeps what the docs tell a hook. Its ctx.protocol,
ctx.model and ctx.stream are the agent's request's, while a
description's body is a Chat request and a search's an Anthropic one,
whatever the agent speaks. A description is also kept for later
requests (sights), so one asked through a request's middleware was
handed to later requests, other agents' too. The one community
middleware with onProvider, antigravity-cloak, rewrites Claude Code's
and Codex's lines in the system prompt, which a description's or a
search's prompt, magpie's own, doesn't have.
Not changed: the report's other fixes, a lock over the runtime, one ask
at a time, or a Run per ask. Each keeps the gateway up but still runs
the agent's middleware on asks that are magpie's own, which the docs
say go without it, and with the first two onProvider still gets bodies
its ctx doesn't describe. With ownAsk nothing else uses a request's Run
from two goroutines (holdWriter's keepalive writes under the h.mu the
handler's writes hold). magpieChose is left as it is: it says whose
pick a call is, and its other callers, Codex's thread titles,
descriptions and predictions (codex_titles.go), run before serveAgent
with no Tried to take off.
What was run (tree 4f97ac18, on origin/main 865df247, go1.26.8,
linux/amd64):
- TestImagesDescribedWithoutTheAgentsMiddleware, new: a text-only model
asked with four images, and a middleware whose onProvider adds a line
naming the provider's model. The four descriptions reach the model
that sees without the line, the text model's request has it, and
onProvider is called once, with no failure.
- TestSearchesWithoutTheAgentsMiddleware, new: a model that can't
search makes two web_search calls in one round, with a middleware that
has onProvider and onEvent. Both searches reach the searcher without
the line, the model is asked twice, its first ask with it (the second
goes on from that ask's body), and no hook failed.
- Both, without -race: -count=50 -v, 100 PASS; -count=40 three more
times, ok.
- go test -tags nogui -race -count=20 -cpu 1,2 ./internal/gateway with
this -run, ok, no race:
'WithoutTheAgentsMiddleware|TestMiddleware|TestTextOnlyModel|TestVisionSetting|TestImageThatCant|TestGroupsTextOnly|TestDescriberThatCant|TestSeerPicks|TestManyImages|TestWebSearch'
- Broken by hand, each run with -race -count=1, then without -race at
-count=40 three times:
- main's vision.go: the test red, onProvider called 5 times (each
description and the agent's try), 3 of the calls throwing "Cannot
read properties of undefined" (reading 'push' twice, 'messages'
once), the fourth description reaching the model that sees through
the middleware as the mangled body above, races reported. At
-count=40 all three runs died: of "concurrent map read and map
write" in InternGoString (intern.go:167) twice, and of "concurrent
map writes" in internASCII (intern.go:195) once.
- main's search.go: the test red, both searches through the
middleware, races reported. At -count=40 each run had 40 of 40 red,
and none died.
- ownAsk returning the context as it is: both tests red, races
reported. At -count=40 all three runs died of "concurrent map read
and map write" in InternGoString.
- A real run: magpie built at 865df247 and at this tree (go build -tags
nogui -buildvcs=false), magpie serve in a sandbox HOME, a provider (a
local server) with a text-only model and one that sees (from its
/v1/models' modalities), Settings' vision model set to the one that
sees, and a middleware added with magpie plugin add whose onProvider
adds a line. 200 requests to the text-only model on
/v1/chat/completions, four new images each, twice per build.
865df247's gateway answered 6 and died on the 7th request, of
"concurrent map read and map write" at the report's intern.go:167 in
InternGoString, reached from Run.Tried; in the other run it answered
7 and died on the 8th, of "concurrent map writes". 24 and 28
descriptions reached the vendor, all but one with the line; that
one's onProvider threw "Cannot read properties of undefined (reading
'push')", so it went as it was. This tree's answered 200 of 200 both
times, its 800 descriptions without the line and its 200 text
requests with it.
- gofmt -l lists nothing; GOOS=linux, windows and darwin go vet -tags
nogui ./..., GOOS=windows go vet ./..., GOOS=linux and darwin go
build -tags nogui ./... and GOOS=windows go build ./...: exit 0
each. go vet and go build without the tag on linux: exit 1 (this box
has no GTK or WebKitGTK dev packages).
- node --test site/*.test.mjs, as CI runs it (node v22.22.1): 45 pass
(none of them reads plugins.html).
- Full suite, -tags nogui (CI's Linux job tags gtk3), outside graftcp
(systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout
45m, log kept): 65 ok, and 7 red, none in what this changes:
- agent TestCodexDriftReached and TestCodexBehindReverseProxy: #3398;
TestCopilotFolderFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath: #3141;
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: this box's /tmp/.git,
#3641.
- edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram: this
box's umask 077, #3640.
- gateway TestPluginToldWhereTheAgentWorks, the package's only red:
this box's /tmp/.git, #3675.
- gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
this box's millions of open fds, #3649.
- pii TestFindJoinsTextsAndMapsBack, TestGPUDeathMovesToCPU,
TestServeStartsWithoutResidencyHeartbeat and TestWarm: #3741, fixed
on main by c84f859d.
- provider: "fatal error: close of synctest channel from outside
bubble", #3632; the package's tests after it didn't run.
Not tried: macOS, Windows (built and vetted only), the reporter's
middleware (the report doesn't name it), a real vision model or
searcher.
Hu9956 (#3782): with masking on, DeepSeek Harness's computer use
(cua-driver: a window's state, then a click on one of its elements) went
to the vendor with element_token values as {{SECRET_...}}, found by the
rules. cua-driver hands the model a token for each element of a window:
s, the snapshot's counter in 8 hex digits, a colon and the element's
index (s0000002a:14). The model clicks by it. The SECRET rule takes a
value of 8 or more letters and digits after a field whose name holds
"token", and element_token is one, so each token in a window's state, in
a click's arguments and in a shell command's JSON went as a placeholder
and its index ({{SECRET_...}}:74). Two of the report's places show the
token with no index ("element_token": "s00000001"), so that is taken as
it is written too.
noIDs, which lets a backend's id (a UUID, 32 hex digits or more) go as
written unless its field is named for a credential, now takes an element
token for one too (elementToken): s and 8 lowercase hex digits, then a
colon and the index, with no letter, digit or _ on either side. Without
the index, s and 8 hex digits is one only as the value of a field named
for an element: alone in a text it may be a student's number
(s12345678), which the local model may call an account. A field named
for an element is no credential's, as one named for a page, a cursor or
a request isn't (credentialField, whose field name reading is now
fieldWords). So element_token's value goes as written, while the same
value after password=, token:, "refresh_token": or "api_key": is
masked, and so is a value of any other shape in element_token. A token
the local model takes for a secret, or anything else, goes as written,
as a UUID does. The user's own words still mask one.
docs/subsystems/gateway-routing.md says so.
A UUID in a field named for an element (element_token) goes as written
now too, as one in next_page_token does.
What was run (tree bb52fa4d, on origin/main 5215108e, go1.26.8,
linux/amd64):
- TestElementTokensGoAsWritten, new. Five tokens (s00000001,
s00000003:74, s0000002a:14, s00007a3f:42, s00010001:3) in seven
places, as the report has them (JSON laid out and compact, a space
after the colon, a shell command's JSON, element_token=, inside a JSON
string, elementToken), go as written. MaskJSON of a window's state and
a click, DB_PASSWORD=hunter2abc9 beside them, masks the password
alone. The local model's every label goes as written on s0000002a:14
in a text and on s00000001 in element_token. s12345678, in a sentence
or under student_no, labelled an account number or a secret by the
model, is masked. s00000001 and s00000003:74 after password=, token:,
"refresh_token": and "api_key" are masked, and so is element_token
holding abc123def456, s0000000g1, S0000002A, s000000012, s00000001x or
s00000001:x9. The user's own word masks one.
- It and TestIDsGoAsWritten -count=50: ok. internal/redact,
internal/maskrec, internal/gwmw, internal/masking and plugins/redact:
ok.
- Broken by hand, each red in TestElementTokensGoAsWritten:
- idAround not taking an element token: every kept place, the
MaskJSON body, the model's every label on s00000001 in
element_token (the rule masks it there), and its address and secret
labels on s0000002a:14.
- "element" not among credentialField's words: every kept place, the
MaskJSON body and the model's every label on s00000001 in
element_token (the rule, again).
- the model's secret kept on a token: its secret label on both.
- s and 8 hex digits a token anywhere: s12345678's four cases.
- a token only with its index: s00000001 in its seven places and the
model's labels on it.
- A real run: magpie built at 5215108e and at this tree (go build -tags
nogui -buildvcs=false), in a sandbox HOME with masking on
(settings.json "redact": true), a local server standing in for the
vendor that keeps each body it is sent. One request on
/v1/chat/completions with the report's three places: a window's state
as compact JSON with "element_token": "s00000003:74", one laid out
with "element_token": "s00000001", a shell command's cua-driver click
with "element_token": "s0000002a", a click by s00000003:74, and a user
message with DB_PASSWORD=hunter2abc9. 5215108e: the vendor got each
token as a {{SECRET_...}} placeholder (s00000003's with its :74), four
places. This tree: each as written, the password still a placeholder.
- gofmt -l; go vet -tags nogui and go build -tags nogui for linux,
windows and darwin, and go vet and go build for windows without the
tag: exit 0 each. go vet and go build without the tag on linux: exit
1 (this box has no GTK or WebKitGTK dev packages).
- go test -tags nogui -count=1 -timeout 45m ./..., Bun 1.4.2 on PATH:
68 ok, and 7 red, none in what this changes: agent
TestCodexDriftReached and TestCodexBehindReverseProxy (#3398);
TestHowInstalled, TestCursorFolderFromTheEditorIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
and TestZedAppPath (#3141);
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout (#3641); edit
TestWriteAtomicReadOnlyHardLink and testenv TestProgram (#3640);
gateway TestPluginToldWhereTheAgentWorks (#3675); gui
TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
(#3649); proc TestProbeTimeoutEndsWhatItStarted (#3848, passes 40 of
40 alone); provider's "close of synctest channel from outside bubble"
from TestUnreadLoginsWriteErrorsKeepCredentials (#3632), so the
package's tests after it didn't run: go test ./internal/provider
-skip '^TestUnreadLoginsWriteErrorsKeepCredentials$', Bun 1.4.2 on
PATH: ok.
Not tried: DeepSeek Harness and cua-driver themselves (no macOS here);
the request was written by hand from the report's places.
Review, applied on origin/main 8e2ba36de (git am, sha256 of the patch
matches the issue's 1db65568…), with two changes to the patch:
- The patch made any field with "element" among its name's words no
credential's (credentialField) and the field an index-less token may
sit in. That widened a key-name exemption: a UUID in element_api_key or
elementSecret went as written. Now only cua-driver's own name,
element_token (elementToken, element-token), is that field
(elementField); any other name is a credential's as before.
- A token known from before (ByKnown) was still masked as a credential.
One the local model labelled in prose ("I will click s00000001 now")
was then masked in every element_token after it, a click on nothing.
An element token is no longer masked by a value known from before;
the user's own words and rules, and the password, API key and token
rules, still mask one.
Not scoped to tool calls and results by place: the exemption is held to
the token's shape (s, 8 hex digits, :index; index-less only as
element_token's value), so a value of any other shape under that key is
masked, and every route masks through redact.mask (masking.Masker's
MaskJSON and Text), so each route gets it.
What was run in review (darwin/arm64, go1.26.8, sandbox HOME):
- TestElementTokensGoAsWritten red with origin/main's ids.go (the
report's laid-out "element_token": "s00000001" went as
{{SECRET_…}}), green with this.
- Broken by hand: elementField back to "any word element": red, a UUID
and s00000001 in element_api_key and elementSecret went out; ByKnown
masking a token again: red, the click's element_token masked after
the prose turn.
- go test -tags nogui ./internal/redact/... ./internal/masking/...
./internal/maskrec/... ./internal/gwmw/... ./plugins/redact/... and
internal/gateway -run 'Redact|Mask|Masked': ok. gofmt -l: nothing;
GOOS=linux go vet -tags nogui and GOOS=windows go vet of
internal/redact: ok.
- Real run: magpie built at 8e2ba36de and at this tree, `magpie serve`
in a sandbox HOME with "redact": true, a local fake vendor recording
bodies; one /v1/chat/completions request with the report's three
places (a laid-out window state with s00000001, a compact one with
s00000003:74, a Bash call's cua-driver click with s0000002a) and
DB_PASSWORD=hunter2abc9. Base: all three tokens went as {{SECRET_…}}
(the second with its :74). This: all three as written, the password
still a placeholder.
Not run: the full suite (one suite per machine; other sessions' runs
are on this box). Not tried: DeepSeek Harness and cua-driver
themselves.
Settings › Privacy's masked words (脱敏词) were found anywhere: ABC masked
the ABC inside XABCD, and 123456 the middle of 91234567 or 0.123456. A
new row under "Masked words in any case", "Whole words only" (仅完整单词
匹配), makes each word match only where no letter, digit or _ is beside
it, and for a number no "." and digit either, so a decimal counts as one
value: ABC masks "ABC IS xxx" and name='ABC' but not XABCD or ABCDEF;
123456 masks a 123456 of its own but not 91234567, 0.123456 or 123456.78
("the code is 123456." still is). Chinese and Japanese letters count as
no letter there, since those scripts put no spaces between words: 张三
is still found in 我的同事张三今天来了, and ABC in 用ABC做. It is
independent of any case and works with it (xabc then Abc! masks only
Abc). A match inside a longer word is passed over one letter at a time,
so a whole one after it is still found. Off by default and for every
existing user: settings.json without redactWordsWhole reads false, and a
page from before it that saves without the field keeps what was set
(api.go, as redactWordsAnyCase). Each match goes as {{TERM_…}} and comes
back as written. Translated in zh, zh-TW, ja, de.
redact.Options.WordsWhole (wholeWord, wordRune); settings.RedactWordsWhole
(redactWordsWhole) reaches it through internal/masking; prefsKeep sends it
on every Settings save. docs/subsystems/gateway-routing.md has a bullet
for the user's own words, any case and whole words.
Tests, each red when its part is broken by hand:
- TestWordsWhole (internal/redact), the reporter's literal examples plus
CJK and any case: with the whole-word check skipped, 10 cases FAIL
"1 masked, want 0"; with the decimal check off, FAIL on 0.123456 and
123456.78; with Han/kana counted as letters, FAIL on 张三, 用ABC做 and
これはABCです. Every case round-trips through Restore.
- TestWordsWholeJSON: a request body and a tool call's escaped
arguments; with the check skipped, FAIL "XABCD not kept as written".
- TestCountTokensRedacted/words_whole (internal/gateway): with
masking.go not passing the setting, FAIL "redaction off changed
content: …X{{TERM_…}}D…"; words_inside holds the default unchanged.
- TestSettingsRedactWordsWholeKept (internal/gui): with the not-sent
guard removed, FAIL "…redactWordsAnyCase…: whole words false".
- redact-words-whole.test.cjs: 20 of 20 (Chromium and WebKit, en, zh,
zh-TW, ja, de, 1100 and 640px); with prefsKeep's field removed,
WebKit fails "a later save keeps it".
Run, in worktree magpie-wt/redact-wholeword at base 353519f55, sandbox HOME,
pinned caches, pipefail, tee'd:
- go test -tags nogui ./internal/redact ./internal/masking
./internal/settings ./internal/gui (TestCoreScriptBudget, i18n)
./internal/gateway ./plugins/redact: all ok.
- GUI: redact-words-whole, redact-words-any-case, i18n-keys 44/44;
gui-zh-tw, gui-ja, gui-de 9/9.
- gofmt -l clean; go vet (darwin), GOOS=linux -tags nogui and
GOOS=windows vet of the changed packages clean; go build,
GOOS=linux go build -tags nogui, GOOS=windows go build ok.
Not run: the full go test ./... and the whole GUI suite (machine load
over 200 with other sessions' runs); the change reaches only the
packages above. Not tried: a real vendor request with the switch on;
the gateway test checks the body that goes out. A letter written as a
\u escape inside a tool call's arguments reads as no letter beside a
word (unescapedView), so it doesn't stop a match there.
Rebased onto origin/main 83368d994 (usage, signin, agent, gateway stream,
web page port, guard; app.js and gateway-routing.md touched elsewhere):
go test -tags nogui ./internal/redact ./internal/masking ./internal/gui
(budget, i18n) ok; redact-words-whole and i18n-keys 24/24.
Then onto 83368d994 (Codex thread descriptions; settings.go, app.js, i18n.js):
gofmt clean; go test ./internal/settings ./internal/masking ./internal/redact
and ./internal/gui -run 'Budget|I18n|Settings' ok.
cybercaius on Discord asked to turn Codex's thread descriptions off.
Titles and predictions had an Off; descriptions only had "as Codex
sends it" or a model.
Codex's settings on the Agents page now offer Off for "Thread
descriptions", worded as the titles' Off ("Off", "no description,
nothing sent", in zh, zh-TW, ja and de too). settings.CodexDescriptions
takes "off", /api/settings/codex-descriptions accepts it, and the
gateway answers a thread_description side turn itself through
sentNowhere, as titles' Off does: a finished response.completed with no
output, nothing sent upstream, and Routing/Usage recording it as
answered by magpie with the reason. Both routes take it (the Codex
backend path and /v1/responses).
Why an empty reply is enough: in ChatGPT.app's app.asar the
thread_description helper reads the reply's {"description"}; with no
message it records an "empty" result, not an error, and the thread's
description is left as it was.
The docs (gateway-routing.md) say each of titles and descriptions has
its own Off and neither turns off the other. No CLI change: titles' Off
isn't settable from the CLI either. docs/reference.md doesn't list
these settings.
Run:
- gofmt -l: nothing. go vet: darwin ./..., GOOS=linux -tags nogui
./..., GOOS=windows ./...: ok.
- go test -timeout 45m ./internal/gateway ./internal/gui
./internal/settings before the rebase: gui ok, settings ok; gateway
had TestDisabledCodexModels ("no space left on device") and
TestHistoryKeepsDaysAndDropsOld red during a moment the disk was
full; both pass -count=5.
- Rebased on f0ffee34c: TestCodexDescriptions/Titles/Predictions in
gateway, gui and settings ok; go vet of the three packages ok.
- Whole GUI suite (916 files, both engines, every language,
--test-concurrency=4, box at load 100 to 200 from other sessions):
13328 tests, 13144 pass, 184 fail. The 33 red files were run again
on main 508911e43: the same tests red there (quota-refresh-order
#3679, routing-* #3408#3409#3410#3411#3412#3799#1612#2658,
gateway-caller-keys #3797, menu-input-scroll #3402, key-replace
#3476, phone-web #3180, old-webkit #3403, header-centre #3479,
quota-count-wrap #3404, icon-tile #3858 new, provider-detect-draft
#3859 new, ...). The rest, run again at the rebased head: green
except s3-sync (#3413), search-first (#3795), usage-agents-hide
(#3414), usage-fold (#3415), usage-ledger, all red the same on
f0ffee34c, and library-row-remove 1 of 3 (#3099). codex-descriptions,
codex-titles, codex-predictions and i18n-keys green at the rebased
head.
Broken by hand:
- the gateway's off branch removed: gateway TestCodexDescriptionsSetting
red (magpie knows no model "off", no response.completed);
- the API's "off" check removed: gui TestCodexDescriptionsSetting red
(400);
- settings validation without "off": gui and gateway tests red (400 /
"must be a model's id ... not \"off\"");
- the picker's Off option removed: codex-descriptions.test.cjs red in
chromium and webkit, en and zh.
Not tried: a real Codex app session with descriptions Off; the app's
side is read from its minified code only.
yyddbds on Discord added one custom provider, 大灰狼 on dahuilang.best,
and the Usage page's provider filter listed it twice: 大灰狼 and
dahuilang.best. The Add sheet's Detect and model-list requests run
before the provider has an id, so probelog records them under the host
asked (probelog.Note: "a provider being added has no id yet"). Those
rows are listed on the Requests page, and their provider went into the
page's provider list as a provider of its own.
Renames now also knows each provider by the hosts of its URLs, and
probeChunk reads a probe row through Renames.ProbeOf: a host exactly
one provider is on is that provider's id. It is done when the log is
read, so rows written before this release are merged too. A host no
provider is on (an Add given up) or two providers share stays as it
was recorded; a provider id is never taken for a host.
Run:
- go test -tags nogui ./internal/usage ./internal/usageapi
./internal/probelog ./internal/provider (-skip
TestUnreadLoginsWriteErrorsKeepCredentials, #3632) ./internal/gui:
ok.
- New TestProbesOfAProviderBeingAddedListItOnce: Detect rows written
through probelog.Note under dahuilang.best and DaHuiLang.best before
provider.Add("大灰狼"), plus a gateway call under its id; providers
are [dahuilang other.example shared.example:8443], and the filter on
dahuilang has its 3 rows.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
Broken by hand: probeChunk back on Renames.Of fails it with providers
[DaHuiLang.best dahuilang dahuilang.best other.example
shared.example:8443], the reporter's two entries.
Not tried: the reporter's own usage.jsonl; the full go test ./...
(other sessions' suites were on this machine).
LuvLetter on Discord runs magpie in Docker (`magpie web`). ChatGPT sent
the browser back to http://localhost:1455/auth/callback?code=…&state=…,
which the browser couldn't reach, and the address went into "Import
from a file instead…" rather than the sign-in's Callback URL field.
Opening that box canceled the waiting sign-in, and the import read the
address as a refresh token, sent it to ChatGPT, and said "ChatGPT
didn't take the refresh token — it has been used since…".
- The Import box keeps a sign-in that takes a pasted address waiting
behind it (signing.behind in app.js); Done, Cancel or a new sign-in
end it. One that takes no address is canceled as before.
- POST /api/signin/import first takes out each text that is a browser
sign-in's end (an http(s) address with code or error and a state, or
Claude's code#state) and finishes the sign-in whose state it carries
through SubmitSignInCallback, as the Callback URL field does
(provider.PastedSignIns). The rest is imported as before.
- An address for no waiting sign-in fails with a reason that says where
such an address goes, and is never sent to a vendor.
- ImportLogins (Codex/Claude) and the Google import's line parsers
refuse a line with :// as "not a refresh token": the CLI import too.
Siblings: matching is by the OAuth state of every waiting sign-in
(signIns.m), so ChatGPT, ChatGPT API, Gemini/Antigravity, plugin
sign-ins and Claude (address or code#state) are all covered.
Run:
- go test -tags nogui ./internal/provider (-skip
TestUnreadLoginsWriteErrorsKeepCredentials, #3632 crashes the package
on main), ./internal/usage ./internal/usageapi ./internal/probelog
./internal/gui ./internal/cli: ok, at e111e08aa plus this change.
- New TestImportBoxFinishesThePastedSignIn (fake token endpoint, counts
trades: another sign-in's state 0, the address 1, again still 1),
TestImportBoxFinishesAPastedClaudeCode, TestImportTellsAddressesFromAccounts.
- signin-paste-import.test.cjs, en and zh, Chromium and WebKit: 6/6;
with the other sign-in/login/import GUI files and i18n-keys.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- Reproduced in a sandbox `magpie web`: the ChatGPT sign-in shows its
Callback URL field, and opening the Import box canceled it.
Broken by hand: looksLikeAddress returning false makes
TestImportTellsAddressesFromAccounts fail with the user's exact message;
signInByState returning nil fails the two finish tests; dropping
signing.behind fails the GUI test ("the sign-in waits behind the box,
not canceled").
Not tried: a real ChatGPT code exchange (tests never reach OpenAI); the
full go test ./... (other sessions' suites were on this machine).