The memory tools had no target-project argument and no way to see the
caller context they resolved, so a scoped migration run from one project
couldn't keep memories for another or check where they went.
- memory_search and memory_save take `project`: a folder on this
computer (absolute, or relative to the caller's own folder), or the key
of a project memory knows (github.com/owner/repo, with or without
project:, or a project's one name). A project named goes with scope
project (a save's default then) or a search's all; global or agent with
a project is refused, and an unknown project says which ones memory
knows.
- Answers name what was used: a memory reads "this project (<key>)" and
"only for you (<agent>)", and a search ends "(looked in: everywhere,
project <key>, agent <id>)".
- New read-only memory_context: the agent the server takes the caller
for and how it was found (router _meta, magpie mcp memory's initialize,
key/User-Agent, the session's initialize), the project with its folder
and source, the scopes a search looks in and the server version, as
text and structuredContent. Given `project`, it shows that one.
- HTTP and stdio are the same server (magpie mcp memory relays), and
OwnMCPTools lists memory_context with the others.
Run (mote, -tags nogui unless noted):
- TestMemoryMCPProjectArgumentAndContext (new): folder, key and relative
folder; the caller's own project untouched; refusals; memory_context's
text and structuredContent; tools/list. Red with the project argument
ignored by hand.
- TestMemoryBridgeContextAndProject (new): the real gateway behind
magpie mcp memory over stdio, initialized as codex as in the report.
- go test ./internal/browsermcp ./internal/cli ./internal/library: ok;
go test -run 'Memory|OwnMCP|Hub|RootDirs|Tool' ./internal/gateway: ok.
- Windows (xiaomi-gpu, win-run): the new gateway, browsermcp and cli
tests ok (a test's own unquoted Windows path was fixed on the way).
- go vet darwin, linux nogui, windows for the four packages; gofmt.
Not tried: Codex desktop itself over /mcp/run/magpie-memory; the full
suite runs after the tag.
Follows c9c10b960: Codex's MCP client name now reads as codex, so a search as Codex also looks in agent:codex-mcp-client. TestMemoryMCPSharedAcrossAgents now expects codex. Ran on mica: -run 'TestMemory|TestRun' ./internal/gateway ok; gateway+library+browsermcp full run: library and browsermcp ok, gateway cut at the 10m default timeout under load (suite follows the tag). Windows/linux-nogui/darwin vet clean on gateway and library.
Codex reaches Magpie Memory at /mcp/run/magpie-memory, which starts `magpie mcp memory` per Codex session. A session magpie never saw start (Codex keeps its session id across a magpie restart) started the server with the default initialize, client "magpie", so memory_save scope=agent said it couldn't tell which agent called. Now: such a session (and an initialize naming no client) is started as the request's agent, Codex on this route; the direct HTTP route keeps the client an initialize named under its Mcp-Session-Id; every codex* client name (codex-mcp-client, codex-tui) is Codex.
Ran on mica: new tests (red on the old code with the reporter's error text), internal/gateway, internal/library, internal/browsermcp (see below). Not tried: a real Codex Desktop.
The image server's files (b2ccfe25d keeps them an hour, behind a link
with a token) were served with the vendor's type and nosniff only. A
Recraft SVG opened from its link is a document on the gateway's own
origin, and a page there is same-origin to the gateway, which a local
request reaches without a key: script in the SVG could have asked
/v1/chat/completions on the user's subscriptions. An SVG is now served
with "default-src 'none'; style-src 'unsafe-inline'; sandbox", as the
GUI's SVG icons already are (library.go, providers.go). Other types
are unchanged, so a video still plays in its own page.
Run: go test -run TestImageMCP ./internal/gateway ok (mote).
Broken by hand: with the header line removed,
TestImageMCPSVGRunsNothing is red (mica).
Not tried: a real Recraft SVG in a browser.
Mistral routes a conversation to the server holding its KV cache by the
x-affinity header. Checked against the sources: mistral-vibe's CHANGELOG
("KV cache warming via x-affinity in count tokens"), its
_runtime_config.py request_headers (sets x-affinity every turn), and
pi-ai's buildMistralHeaders (earendil-works/pi, mistral-conversations.ts:
sessionId unless the model's or call's headers name one).
forwardOnce now sets x-affinity for a Mistral API key provider
(mistralAffinity): the client's own value as sent, else a hash of the
session or conversation, never the id itself, the same every turn. Other
vendors, accounts and plugins get none; the user's own provider headers
are put on after it. Every route (relayed, translated, count_tokens)
goes through forwardOnce.
Run: go vet on darwin, linux nogui and windows for internal/gateway, and
go test -count=1 ./internal/gateway at the branch head via mote-run, ok
(1370s). New: TestMistralAffinityHeader.
Broken by hand: header setter off, red ("affinity \"\" \"\" \"\""); the
isMistral scope removed, red ("another vendor got x-affinity").
Not tried: a real Mistral key, so whether Mistral's cache hit rate
changes is unmeasured. Full ./... not run.
gzipFile read the day's whole file (and its .gz) into memory, so a 7.25 GB
day took a 1.6 GiB host down in a restart loop. It now streams: the file's
routes are remembered by an 8-byte hash, the new .gz goes to a temp file
beside the old one (the old .gz copied raw, the new routes a gzip member
after it) and is renamed over it; any failure leaves the file and the .gz
as they were.
Nothing bounded a plain day either. A day now goes on in a numbered file
(DAY.1.jsonl) past 256 MB, and today's files past 1 GiB in all lose their
oldest. History, HistoryRoute and the Context tab's stamp read the numbered
files too.
Run (mote): gofmt, go vet gateway+gui on darwin, windows, linux nogui;
gateway and gui packages. TestGzipFileHoldsNoWholeDay (64 MB day, with a
.gz to dedupe against) allocated 149 MB on the old code, now under 24 MB.
Broke dayAppendPath by hand: TestDayGoesOnInANumberedFile went red.
Not tried: a real 7 GB file; full ./... suite (run after the tag).
TestGroupFailoverTimesEachTry went red on a loaded box with TTFT equal
to FirstText: "ttft_test.go:260: the answering try: {... Millis:304
TTFT:233 FirstText:233 ...}". The paced vendor kept its reasoning and
its text 80ms apart on the wire, and a gateway that read late got both
in one read and timed them as one. TestUsageKeepsTimeToFirstToken had
the same gap and was fixed for #2575 with paced's heard hook: the gap
before each marked event starts only once the agent has been sent the
one before. The failover test now posts with that hearing agent and
gives the answering vendor its heard, so the text comes a gap after the
agent had the reasoning, and the end a gap after it had the text.
The same gap stands under four more tests, which get the same hook.
TestCodexBackendTimesFirstToken, in the same file, checks u.Millis >
u.FirstText across the text and the end (its request is now built by
codexServe, which codexPost uses too). In reasoning_speed_test.go,
TestReasoningSpeedThroughGateway and TestSpeedEndsWithTheReply need
their thoughts read apart, 100ms at least (TestReasoningPacingEdges),
for a speed; the fixture's gap is 150ms. TestSpeedEndsWithTheReply's
first thought is now marked too, so the gap after it is guarded as
well (a first marked event is sent at once). In
reasoning_uncounted_test.go, TestStreamedReasoningWithoutCount's Chat
cases, paced 80ms apart, get it for their three thoughts; its
Anthropic cases replay DeepSeek's 33 deltas and are left as they were.
What was run (tree d6c1100b, on origin/main db0f2f20, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077 (these packages
don't run Bun; Bun 1.4.2 on PATH for the final runs, 1.3.11 for some
old-code runs):
- The five tests with the change, -count=5: ok. None waited out
heard's 10s.
- With 240ms slept by hand in holdWriter.Write on the vendor's first
event (fallback.go, a gateway passing it on late): the old failover
test red 3 of 3 at :260, "TTFT:242 FirstText:242".
- With 240ms slept by hand in the Codex backend's read loop once the
reasoning came (codex_backend.go): the old Codex test red 3 of 3 at
:337, "Millis:322 TTFT:322 FirstText:322". The new one: ok 3 of 3.
- With 400ms slept by hand in holdWriter.Write on the first thought:
the old TestReasoningSpeedThroughGateway red 2 of 2 at :76 on each of
its paths ("streamed reasoning missing"), and the old
TestSpeedEndsWithTheReply 2 of 2 at :133 ("a reply that came at its
pace tells no speed: 0/0").
- With 400ms slept by hand in holdWriter.Write on the first thought
("We..."): the old TestStreamedReasoningWithoutCount red 2 of 2 in
its "chat tool, counted" case at :94 ("speed 0/0 ms; want
told=true"), its other cases ok. With the same holds, the new
failover, the two reasoning speed tests and this one: ok 2 of 2 each.
None of these reds was reproduced without an injected delay.
- go test -count=1 -timeout 45m -v ./internal/gateway: 4009 tests ok
(15664 with subtests), 14 skipped, red in two,
TestClientPathCoversHandler and TestReadOnlyKeyEveryRoute (the CA
route /magpie-ca.crt in neither route list), red on origin/main
db0f2f20 too (#5993).
- gofmt -l clean. go vet -tags nogui for linux and windows, go vet for
windows, go build -tags nogui for linux and darwin and go build for
windows: exit 0 each. GOOS=darwin go vet -tags nogui: exit 1 at
internal/gui/traywindows_darwin_test.go, as on origin/main (#5263).
go vet and go build without the tag on linux: exit 1 (no libsoup-3.0
or gio-unix-2.0 pkg-config here).
- The full suite: see the comment on the issue.
Not changed: TestResponsesToolWithoutReasoningStillTimed, whose old
version stayed ok 2 of 2 with a 400ms hold on its first piece in
holdWriter.Write.
Not tried: a Mac or Windows, or the red under real load.
(cherry picked from commit 86e12bbdeb466a2cc4e3f8718c23d7a1236d77b2)
Landed for #5948 after it came back on CI at dbb2e5dd2 (run 43342362373,
macos-latest) as a second shape of the same gap: ttft_test.go:264, usage
Millis:450 == FirstText:450, the text and the end read at once.
Run at this commit on 422f90e80 (mica, macOS, load ~19):
- the six TTFT and reasoning speed tests, -count=5: ok.
- Broken by hand: a 240ms hold in holdWriter.Write after the reasoning;
the old TestGroupFailoverTimesEachTry red 3 of 3 at :264, as on CI, the
new one ok 3 of 3 with the same hold.
- go test -count=1 -timeout 45m ./internal/gateway: ok 854s.
- gofmt -l internal/gateway: clean.
Not tried: Windows; the full ./... suite (test-only change in one package).
DaVinci42's four cases on #4374 (v0.1.3925), fixed in the Copilot Gemini
tool-schema translation only:
- copilotGeminiToolUnions renamed a disjoint object anyOf to oneOf, which
Copilot's Gemini takes with 200 but strips of its branches, so the model
sent a string. The rename is gone; copilotGeminiToolShapes folds the
branches into the one object (same-named properties join their enums, so
a discriminator keeps "project" and "none").
- a union of local $ref branches is resolved against $defs/definitions
(a copy; a target that refers on is not followed) before it is judged,
instead of being dropped to an untyped string.
- a type written beside a nullable single-branch anyOf is removed (400).
- an array with no items gets items {} (typed after by geminiTypes) (400).
Run (mote, -tags nogui): TestCopilotGeminiFoldsCodexUnions,
TestCopilotGeminiReporterSchemas (the reporter's four schemas verbatim),
TestCopilotGeminiShapesLeaveOthersAlone (claude / no agent: body unchanged),
and the TestCopilot*/TestGeminiTypes*/TestAntigravity* set pass. With the
three changed non-test files put back to origin/main the first two go red
(all four reporter subtests). gofmt clean; go vet darwin/linux/windows and
the gateway package run: see the next commit/tag notes.
Not tried: a live Copilot account (the fake refuses by the reporter's
recorded rules).
The image MCP server kept every drawing, and every video, in memory for an
hour (up to 256 MB), and swept them only when another image arrived. A
drawing also held its reply, the base64 strings parsed from it and the decoded
bytes at once. Now:
- imageMCPKeepFile writes the image to <config>/image-mcp (emptied at the
first use in a run) and the file URL serves it from there; only the
metadata is in memory. A timer removes it at its hour. If it can't be
written the bytes stay in memory, as before.
- imageMCPDrawn drops the recorded reply and each b64 string as it is decoded;
the stdio server (internal/imagemcp) clears each b64 once decoded.
- both hand the heap back (debug.FreeOSMemory) when a drawing is done: the
Go scavenger gives it back slowly, and Task Manager showed it as
magpie's.
The foreground/background numbers in the report (WebView2 processes a few MB
when hidden) are WebView2 suspending, not a leak.
Run: TestImageMCPKeepsDrawingsOffTheHeap (new; 6 x 12 MB drawings kept):
heap +71 MB on the old code, +0 after. internal/imagemcp and the gateway's
Image/Video/MCP/Browser/Record tests, gofmt, and vet for darwin, linux
and windows on mote. Broke it by hand: the old image_mcp.go with the new
test is red. Not run: the full suite, a real vendor's drawing, Windows.
Entry.Provider was a Provider value, 1,328 of an Entry's 1,760 bytes,
copied into every model of every provider each time a catalog, an
agent's list or a routing group's entries were built. It is now a
*Provider: entriesOf and decide's list give every model of one provider
the same one (sharedEntry), and a group's entry points at its first
member's. It is read only; every place that hands it on as a value
(Resolve, CanFast, ownAgent, modelAllowed, …) dereferences it, so what
they get is a copy as before. entryFor keeps its signature for the one
model ServedEntryOf builds; offEntries' entries now carry their provider
too.
Measured on mote with the owner's real accounts (acctp sandbox, page
open for 2m32s, w40 = before, w41 = this, alternating):
- catalogOf's allocations 106 MB -> 67 MB, providerEntries' 88 -> 78 MB
- CPU at the page's settle mark 3.42/3.33 s -> 3.18/3.30 s
- live heap unchanged (76.3/76.1 -> 76.7/75.9 MB): the lists are
rebuilt, not kept, so the copies were churn for the GC, not held
Run: go build and go vet ./... and the tests compiled (go test -run ^$)
on mote; the full suite at this tree (d1e823d5f) on mica: 99 packages ok, 0 FAIL (agent 317s, gateway 972s, gui 188s, provider 220s, usage 56s).
macOS CI at 9c33839de (run 43284325340) failed silent with
`Post ".../backend-api/codex/responses": context canceled`
(search_queue_test.go:112). The test's 5s hard cap, there to end a
stream of runaway pings, was armed before the request, so on a loaded
runner (internal/gateway took 1364s) it cancelled the request before
magpie's headers came. That was the path to the headers, not the stream
the cap is about.
The cap is now 60s up to the headers and 5s from them, so it still ends
a stream that never stops pinging.
Run on the Linux box (wsl-run, magpie-desktop; mote and mica at load 58
and 72), at origin/main f9bc297a5 + this change:
- go test -tags nogui -count=10 -run '^TestSearchQueueKeepsCodexAlive$' ./internal/gateway/: ok
Broken by hand: a 6s sleep before the gateway's handler in silent mode
(the loaded runner's slow headers) gives the CI error on the old test,
`context canceled` at :112, and passes with this change.
Not run: the whole gateway package; only this test's file changed.
76ceff87c was built on an older base and its tree dropped the Linux
backdrop-blur rule (7c37424fc) and Codex seats change (d6b5f24db) with
their tests, docs and history.go edits. This restores those files from
d6b5f24db; the diff against d6b5f24db is now only the hours feature.
Run: git diff d6b5f24db --stat lists the usage files alone.
The range menu behind Custom has a top row, "[N] hours back". Enter asks
the Usage page for the rolling window last:Nh (1 to 720), which the
backend already answers for every view (totals, chart, models, accounts,
Requests); the chip reads "Last 30 hours". The pick and N are kept on this
device (magpie.usagePeriod, magpie.usageHours). 24 stays the preset's
chip, and an empty page, the credit days and the menu-bar way in know the
new period. zh, zh-TW, ja, de strings added.
Run (mote, at the rebased head): usage-hours, usage-24h, i18n-keys in
chromium and webkit, en and zh. Broken by hand: keptPeriod limited to the
presets turned usage-hours red (expected last:30h, got today).
Not tried: the whole GUI suite (queued on mote's suite.lock behind other
sessions, still running), narrow widths by hand, the tray panel (it has no
24h chip and is unchanged).
The accounts list on the Routing page folded accounts by provider and name, so a Team seat and a Pro Lite login (or two logins) that carry one email read as a single card, and the day's counts of all of them went to it. An account is now told apart by its plan as well: the page's foldActs key and the gateway's tallyKey add the lowercased plan when it has one; a seat with no plan keeps the two-part key, so stored tallies and fixtures are unchanged. The key still ignores the id, which flips between codex and codex@user when the live login switches.
Run (mote): routing-codex-seats.test.cjs, chromium and webkit, en zh zh-TW ja de: 5 of 5 each. Red on the old client.js (4 cards where 3 are wanted). TestTallyKeyTellsPlansApart and the tallies tests ok; go test ./internal/gui ok; go vet darwin, linux nogui and windows ok; gofmt clean.
Siblings: the TUI draws no account names (no Who use in internal/tui); the combo picker names members from groups.accounts, which already carries the backend's distinct names (email · Team, email · workspace).
Not tried: the reporter's real accounts; the whole GUI suite and the full Go suite are run after the tag.
ubuntu CI at 836d074f1 (run 43242922324, race) failed
TestRemoteMagpieAskedToFollow at remote_update_test.go:156: "could not
read settings ... invalid character 'n' looking for beginning of object
key string". The 'n' is TestFetchPrivateEntries' "{not json". That test
shares the package's HOME and restored it with allowPrivate's
t.Cleanup(settings.Save(was)), but Save refuses to write over a file it
can't parse (unless a last good generation is there), and the cleanup
dropped the error. The broken file was left to whichever later test
saved settings next without fresh(t).
It now reads the file's bytes before garbling it and writes them back in
a cleanup that runs before allowPrivate's, and reports a failed write.
Run (mote): go test -tags nogui -count=1 -run
'TestFetchPrivateEntries$|TestRemoteMagpieAskedToFollow$'
./internal/gateway: red on origin/main (the CI message, word for word),
ok with this change. gofmt -l empty.
Siblings checked: allow_test's garble runs under fresh(t);
backup's and davsync's unreadable-settings tests use their own HOMEs;
request_settings_once and the cli update tests write the bytes back.
Whole-package run: after the push (below in the loop's record).
Settings → Images checked the pick with provider.Resolve, which finds no
model of a key set to Select none (it serves no chat model), so
minimax-cn/MiniMax-H3-Image was refused with "no model ... to generate
images", and resolveDrawing, which the gateway draws through, refused it the
same way. image-01, image-01-live and -Highspeed and the international
minimax provider had the same gap. Settings now asks gateway.DrawerMissingOf
(the Drawers of the provider count), and resolveDrawing falls back to the
provider's Drawers when Resolve finds nothing.
Request shape checked against platform.minimax.io/docs/guides/image-generation:
POST /v1/images/generations (api.minimax.io; the CN key's host likewise), as
draw_minimax.go already sends it.
Run: TestMiniMaxImageModelPickable (both providers; all, none, picks; every
image model; one real draw through the gateway against a fake host) and
TestImageGenAcceptsMiniMaxImageModel, red on the old code (Select none case,
settings check reverted by hand). No real MiniMax account was asked.
Claude Desktop on antigravity/gemini-4-carbon failed 403 of 408 requests:
400 "Request contains an invalid argument", 502 empty reply after 170-230s,
and 200s marked failed with output tokens.
Changed, in internal/gateway:
- A tool name starting with a digit or a dash (MCP tools named for an id)
goes to Google as _x_<name> and comes back without it; a property with no
name is left out of the Antigravity schema. Both turned the whole request
away on a live call.
- A MALFORMED_FUNCTION_CALL / UNEXPECTED_TOOL_CALL finish carries the call
in finishMessage; it is now made the call instead of reading as an empty
reply (tokens spent, then asked again for nothing).
- passing(): a 502 empty reply is asked again once, not lastRetries times on
top of the in-place emptyRetries.
Run (mica): go test -run 'TestCodeAssist|TestEmptyReply' ./internal/gateway;
the new tests are red on the old code (names, malformed case).
Live (owner account, gemini-3.8-flash): names with a digit/dash first, a
space, unicode, a slash and an empty property key each 400; 64 and 100 char
names are 200.
Not tried: real gemini-4-carbon (the account lacks it, 404), so the user's
exact 400 is not reproduced; the finishMessage form is Google's documented
shape, not captured from Carbon.
Huawei's gateway answers a parameter it can't take (the codearts plugin sent
`stop` as an array; plugin 0.3.15 sends a string) with InferHub.001001005.400
inside a 200. magpie read it as a plain 400 and rested the account, 182
times in the report. The code joins shapeWords, so a member behind it is
asked and the one that refused doesn't rest, as for any request shape a
vendor can't read.
Run (mica): TestCodeArtsInvalidParamIsTheRequests, shapeRefused, custom-tool
tests; go vet on darwin, windows, linux nogui; gofmt clean. The new test was
red before the regex change. Not tried: a real CodeArts account; the whole
suite (started after the tag). The last member in a group still rests as
before, since shapeRefused only applies when another is left.
A program keeping a ledger of its own (a WakaToken plugin) can now read the
requests incrementally: cursor=start or cursor=now, then each next_cursor.
Rows carry a stable content-derived id (same after a restart), origin, and
original_ids (request_id, response_id, client_response_id, message_id,
session_id, native_session_id), each only when the source gave it. A call
read late, a corrected row (same id, higher seq) and a native row replaced by
the gateway's (deleted, with seq) all come through a persisted journal
(usage-feed.jsonl, appended and synced before answering). Cursors magpie
cannot resume from are refused: 400 cursor_invalid / cursor_filter_changed,
410 cursor_expired / cursor_reset. A held key sees only its own rows and
tombstones. Without cursor, offset/limit mode is unchanged.
Also: Record.MessageID (not persisted) from the agent file's message id, and
usageapi's row decoration moved into a namer shared by both modes.
Docs: reference.md, integrating.md, gateway-routing.md, gateway-sessions.md,
site remote.html (en/zh/ja), llms-full.txt.
Run (mote, this tree): go vet darwin, GOOS=windows, GOOS=linux -tags nogui on
usage, usageapi, gateway (gui on darwin); go test -count=1 for
internal/usage, usageapi, gui, gateway: all ok. New tests: resume gets exactly
the new rows, ids and cursors survive a restart, correction keeps the id,
gateway takeover retires the native row, refused cursors, expiry, now cursor,
identical records, and the feed over the gateway (held key, 401 without key,
offset mode). Broken by hand: an unconditional memo made the new-rows test
red (fixed to memo only the next page).
Not tried: real Claude Code/Codex session files, a huge (700k+) history,
Windows run of the tests, GUI browser suites (no GUI file touched).
MiniMax's new image models were missing from the MiniMax provider's image
models: only image-01 and image-01-live were listed. Per
platform.minimax.io/docs/guides/image-generation (and platform.minimaxi.com,
the same ids), MiniMax-H3-Image and MiniMax-H3-Image-Highspeed draw on an
OpenAI-shaped API of their own: POST /v1/images/generations, and
/v1/images/edits with images[].image_url, answered with data[].url (an item
that failed holds only an error and is skipped).
Both are now in minimaxDrawModels (every MiniMax API key, intl and CN) and
drawMiniMax asks them there. The size is the one form the API takes:
WIDTHxHEIGHT when it can draw it (655,360 to 20,000,000 px, within 1:3 and
3:1), else a ratio and a 1K/2K/4K tier, never both (the vendor answers 400).
A mask or markup layer is refused before anything is spent. catalog.ImagesAPI
knows "h3-image" so a relay serving the id is asked on its images API.
Run (mote-run): go test -run 'MiniMax|Draw|Image' ./internal/gateway
./internal/catalog ok; TestMiniMaxH3ImageDraws red with H3-Image taken out of
the list. Not tried: a real MiniMax key (none here); the fake follows the
docs' example answer. Streaming is not used.
The web-search MCP tool gains optional allowed_domains, blocked_domains,
recency_days, images and search_context_size. Codex search (/alpha/search,
codex-rs codex-api search.rs) gets them as the fields web.run has: a
query's domains and recency, image_query for images, settings.filters,
search_context_size, image_settings. Every other searcher is asked the
sites as site:/-site: operators and ignores the rest. Image results read
as pages whose text starts "Image: <url>". Arguments travel in ctx, never
in a request body. Schema text names neither magpie nor a vendor.
Run: real Plus account, curl to /alpha/search with image_query and with
domains+recency+filters: both accepted, image reply shape recorded in
TestImageResultsReadAsPages. New tests (search_scope_test.go) use the
fake backend; go test ./internal/gateway full on mote: only the count
schema tests red (a boolean default), fixed, then -run Search|Codex|
ChatGPT|ImageResults ok; vet linux/windows clean.
Not tried: through a running sandbox magpie end to end; GUI untouched.
kudi3699 again: v0.1.3877's Lapsing faded the lost share across the
week and needed 0.5 points. A WorkBuddy check-in reward is a few dozen
credits (20 of a 5100 pool is 0.39 points, less the fade), so it stayed
under the threshold until its last hours and the half-used account was
still never picked. The plugin side is fine: mover min is 0.2.29, past
0.2.27 that reports check-in rewards' runsOutAt/runsOut, so no plugin
change.
Allowance.Lapsing is now the whole loss in points when RunsOut is within
7 days, none past it (no fade); routes.lapsingMin is 0.1 points. A seat
at 90%+ is still not helped.
Run (mote): go test internal/routes, internal/provider -run
"Lapsing|LeastUsed|Allowance", internal/gateway -run
"WorkBuddy|LeastUsed|Smart|Pace|Routing"; go vet -tags nogui for linux,
windows, darwin on the three packages; gofmt clean. Broken by hand:
lapsingMin back to 0.5 turns TestLeastUsedSpendsSmallCheckInRewardSixDaysOut
red (20 credits, 6 days out, old 50% vs new 20%). Not run: the full suite
(after the tag), real WorkBuddy accounts.
An upstream that turns Responses into Chat itself (OpenDesign,
deepseek-v4.1-flash) passed output_index on as tool_calls[].index. With a
sentence of text first the calls came as 1,1,2,3, and a client that keeps
calls in an array by index broke on the whole turn. chatTidy's renumber
gave a call its upstream index unless another call had it; it now gives
each call the next index in the order calls start, so 1,2,3 is 0,1,2 and
the 0,0,1 case still is 0,1,2. A stream numbered from 0 in order is
unchanged. The Responses to Chat encoder (chatEncoder) and the Messages
and Gemini translations already count calls, not positions; plugin
streams go through chatTidy.
Run: TestChatTidyNumbersCallsFromZero (text then three parallel calls),
red with the old renumber (frames 1-5 kept 1,2,3), green with it; the
chatTidy tests; go test ./internal/gateway on mote; vet on darwin, linux
nogui and windows.
Not run: the full suite before the tag; a real OpenDesign account.
TestMemorySearchDatesInLocalTime (4028687b8) set time.Local to +08:00.
time.Local is read by every time.Now, so the swap raced an http conn
goroutine an earlier test (serveMTLSGateway) left finishing: main's Test
run 43194740198 at 727e23637 went red on macOS -race with a DATA RACE
on time.Local, memory_mcp_test.go:262 against net/http setState.
Now no test touches time.Local here:
- memoryStamp writes in memoryZone(), time.Local by default, a variable
the gateway test sets.
- The half that checked a new save keeps its zone moved to memory's own
TestSaveKeepsTheLocalZone, which holds memory's clock (now) at 04:30
+08:00 and reads "+08:00" back from memory.json.
Run on mote: go vet ./internal/memory ./internal/gateway, linux nogui
and windows vet of both; go test ./internal/memory ok;
go test -race -count=3 -run ^TestMemory ./internal/gateway ok; gofmt -l
empty. Broken by hand, each red: Save's now() as now().UTC() fails
TestSaveKeepsTheLocalZone; memoryStamp in time.UTC fails
TestMemorySearchDatesInLocalTime ("2026-11-10T20:30Z").
Not run: the full gateway package (the race needs a leftover goroutine
from another test, so it isn't reproduced on demand; the swap that it
raced on is gone). Same class still open: #2949 (TestHeldClock) and
#4360 (testenv.Zone's cleanup), which swap time.Local too.
stickKeep was 24h and sticksKept 512. A long task picked up again after a
weekend lost its binding, the request went to another provider, and that
one refused the reasoning the first had sealed (invalid_encrypted_content).
Every answer already renews a binding, so only a gap over the keep let it
go. stickKeep is now 30 days and sticksKept 4096. No setting: the larger
default fits every case. Docs line in gateway-routing.md updated.
Run: TestStickSurvivesDaysAway (a 4-day-old binding saved and read back)
is red on the old 24h value ("a 4-day-old binding was lost") and green
now. Stick/Affinity/Sticks-named tests in internal/gateway pass via
mote-run; gofmt -l clean.
Not run yet: the full internal/gateway run and darwin/linux/windows go vet
were still going when this was pushed; results follow in a later commit
or note. Not tried: a real multi-day session. No GUI files touched.
Copilot answered 400 to an MCP tool schema with an array-level enum, a root
oneOf or anyOf, prefixItems, an anyOf beside its own type, or an object
without properties at the root. copilotGeminiToolShapes (after
copilotGeminiToolUnions) writes each as the nearest schema it takes:
properties {} added; same-type anyOf merged (null kept as anyOf with null);
an anyOf with an untyped branch dropped, so geminiTypes types the node;
array enum moved to string items or dropped; root union an object with the
branches' properties, none required; prefixItems / items-as-list one items
schema. Nested oneOf and fit schemas go byte for byte. Antigravity's
plainSchema had the same array-level enum and now moves it to items. A
same-type object anyOf that wasn't provably disjoint is now merged instead
of refused (TestCopilotGeminiKeepsUnprovenUnions uses mixed types now).
Real Copilot account, sandbox magpie (own HOME, only the copilot login),
gemini-3.8-flash and gemini-4-argon, build without the pass -> with it:
array enum 400->200, root oneOf 400->200, prefixItems 400->200, root anyOf
(strings, objects, untyped) 400->200, anyOf beside type 400->200, root
{"type":"object"} 400->200, fit control 200->200. Nested object-without-
properties and nested typeless same-type anyOf were already 200 on the old
build, so the reports' failing forms are the root and type-beside ones.
Run: new TestCopilotGeminiTakesToolShapes (8 rows, red on the old code with
the call unwired), TestCopilotGeminiToolShapesLeavesFitSchemas,
TestAntigravitySchemaArrayEnumMovesToItems, -run Copilot|Antigravity|Schema
on internal/gateway ok (mote); vet darwin, windows, linux nogui ok.
Not tried: the full gateway and provider package run (mote busy, still
going when tagged); Google AI, Vertex and Antigravity with real accounts;
the GUI suite (no GUI file touched).
v0.1.3817 and the fixes after it scoped Fable's quota refusals ("hit your
limit", "reached your Fable limit") to Fable. A plain 429 rate_limit_error
is failRate, and restAfterMarked rested the whole account for it, with its
backoff ladder and sink: Fable rate limited showed "限流 · 42 分钟后恢复" on
the account's Opus row too.
claudeModelRate: a Claude account's failRate that names no window that
counts every model (5-hour, session, weekly, usage limit, organization,
overage, or a representative-claim header of five_hour/seven_day) rests
that model only, in restAfterMarked, rateRest and the sink. Anthropic counts
rate limits per model. Quota refusals and account windows rest the account
as before. Messages, Chat Completions, Responses, groups and the Routing
rows share restAfter.
No real Fable 429 was available: ~/.config/magpie/usage.jsonl, rests.json
and app.log hold none, and Claude Code's bridge keeps no response headers,
so the rule is not checked against real anthropic-ratelimit-unified-*
headers. The account-wide limit the logs do hold ("You've hit your weekly
limit · resets 2pm") is in the test and still rests the account.
Cost if the guess is wrong (Anthropic applies a plain 429 to the whole
account): the next Opus request to that account gets its own 429, rests
Opus there, and falls over to the next account in the same client request,
as any rested candidate does; the user sees no error. One extra refused
request per model per rest. The test checks Opus's own rest and that
Fable's stays and a second account is not resting.
Run at this tree (mote): TestClaudeModelRateRestsThatModelOnly red with
claudeModelRate returning false (account rests, Model empty), green with
it; TestFallback* ok; gofmt. Package internal/gateway and internal/provider
run, and vet on darwin, linux and windows, were still running at commit;
results follow. Not tried: a real Fable-limited account.
The [DONE] fix in the previous commit (ggbdpq's patch, applied with git am,
reviewed: three hunks in continuation.go plus tests, nothing else, nothing
that reaches out) ended a Chat upstream's read at its own end. The other two
translated upstreams had the same hole: a relay that holds the connection
after message_stop, or after response.completed/incomplete/failed, kept the
translated reply's end waiting for the hangup. saidOver now names each
protocol's last word and the read ends there.
Run: TestAnthropicStopEndsTranslatedReply and
TestResponsesCompletedEndsTranslatedReply (a held upstream; Responses client
over Anthropic, Chat client over Responses) plus ggbdpq's two tests; all four
red on origin/main's continuation.go (5s/30s timeouts), green with the fix.
go test ./internal/gateway ok (1039s, on mote); go vet darwin/linux/windows
clean; gofmt clean.
Not tried: a real OfficeAce account, the full ./... suite before the tag.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
A relay that streams a reply whole, says it over (finish_reason, [DONE])
and holds the connection kept the client waiting on the translated
reply's end: the read went on, the end was said only when the reading
gave up, and the client — Codex on a Chat-only provider, its turn stuck
in progress — gave up first. The reply now ends at the [DONE] its
protocol says it over with, its usage in the chunks before it; a reply
that said nothing is still the empty reply's to answer, and an upstream
whose end is told by its finish_reason (Gemini's OpenAI-compatible,
Command Code) is read as it was.
Generated-by: GLM-5.3-Flash (ZCode)
kudi3699: a WorkBuddy account with a 5000-credit pack ending next March,
half used, plus check-in credits ending soon, was ranked by the whole
pool's used share in "Least used first", so it was never picked and the
check-in credits were lost. Smart (Renewal, Lapse) and Use before expiry
(Pace) already went by the plugin's runsOutAt/runsOut; Least used did not.
Allowance.Lapsing is what a window loses at RunsOut (RunsOutLeft of Of, at
most what is left) as points of the used share, fading to nothing a week
out; an amount not told is 0. routes.Seat.Lapsing at >= 0.5 points puts a
seat with room ahead of the rest, soonest Lapse first, then Used as before.
A seat at 90%+ is not helped. It is the shared runsOutAt/runsOut field, so
any plugin that sends it gets this. The WorkBuddy plugin already reports it
(0.2.27, the soonest pack incl. check-in rewards), so no plugin change and
no mover min change.
Run (mote): go vet routes/provider/gateway; GOOS=linux -tags nogui and
GOOS=windows vet; go test internal/routes, internal/provider (all),
internal/gateway -run "WorkBuddy|LeastUsed|Smart|Pace|Routing". Broken by
hand: urgent() forced false turns TestLeastUsedSpendsLapsingFirst and the
gateway test red. Not run: the full suite (started after the tag), real
WorkBuddy accounts, the plugin's bun tests (plugin untouched).
ljayic asked for a complete, stable management API so nothing needs a
hand-edited file. /v1/magpie/admin/ now serves the app's own /api handlers
(providers and their keys and accounts, OAuth sign-in start/poll/cancel,
gateway keys, account groups) to a gateway key set with
`magpie gateway-key admin <id> local|any`. Routes and actions not in
gui/admin.go's adminRoutes are 404, so a provider's saved key, a gateway
key's secret, sign-in export and actions on this computer's apps are not
served; "admin-key" is not served either, so the API can't raise its own
caller. Sign-in returns the vendor's page and code, opens nothing, takes no
password.
Guard (gateway/admin.go), in order: any Origin or Sec-Fetch-Site/-Mode is
403 with or without a key (Origin null, foreign, listed, *.localhost, an
app scheme); no key 401; a key without Key.Admin 403; from loopback the Host
must be ownHost (a rebound page's GET has no Origin); from the network the
key must be "any"; a proxied request counts as remote. Key.Admin is dropped
(adminOf) for a read-only, Browser, issued, expiring or default key, and
setting read-only clears it. The route is in readOnlyRefused and keySlotFree.
Docs: docs/reference.md "Management API", gateway-routing.md, and the
remote page in en, zh and ja. Routing Groups, sign-in export and a GUI
switch for the level are left to #6307.
Run (mica, the worktree before the rebase onto 9 newer commits): go vet of
access, cli, gateway, gui (darwin), GOOS=windows vet of the same four,
GOOS=linux -tags nogui vet of access, cli, gateway; gofmt -l empty;
go test -count=1 -timeout 45m ./internal/access ./internal/cli
./internal/gateway ./internal/gui: all ok but TestKeySlotEveryRoute, which
named the new route and is fixed here, then it and the read-only, admin and
guard tests pass again. After the rebase the same tests ran again.
Broken by hand, each red in TestAdminAPIGuards: browser check off (a
browser case served), Admin check off (a key without it served), Host check
off (a rebound name served), the "any" requirement off (a local-only key
from the network served, and a proxied request).
Tests: TestAdminAPIGuards (no key, unknown key, non-admin, read-only,
local/any, x-api-key, 8 browser headers x 3 callers, rebound Host, proxy,
no handler), TestAdminKey (access: levels, read-only, Browser, issued),
TestGatewayKeyCLIAdmin, TestAdminAPIGatewayKeys / Providers (a canary key
is never told) / SignIn, TestAdminRoutesEveryAPIRoute.
Not tried: a real sign-in against a vendor through the API, a request from
a second computer on the LAN, the GUI suite (no page or app.js changed), a
Linux/Windows run of the new tests.
tmr11235, after v0.1.3857: "没有设置上限或者并发,只有一个号,这个号额度用了95%,
但我不希望排队". v0.1.3852/3857 made a turn that waits for its account's one
turn near a usage cap say "queued". The wait itself is nearCap: an account
within 5 points of a cap holds one turn at a time. HoldCaps counts a Codex
account set not to spend its credits as capped at 100% of any window
(Credits), though the user set no usage limit, so such an account at 95%
was near its "cap" and its second turn waited for the first, with no other
account to send it to.
Now a try near its cap takes the account's turn only when the user set a
usage limit on it (a share or an amount: userCapped) or the turn has another
candidate to go to (it is sent there first, the account kept behind). A sole
account whose only hold is credits off is sent at once; the 100% hold itself
still applies at the try (capHeld). A cap the user set keeps its one turn at
a time, as dyzdyz010 asked for.
Run (mica): TestNearCap*, TestFarFromCap*, TestPiTwoTurns*,
TestNearCapOnlyCreditsOffOneAccountSendsAtOnce (a single account at 95%,
credits off, no cap: both turns out at the vendor at once, none waiting);
gofmt; go vet darwin, linux nogui, windows of internal/gateway.
Broken by hand: the userCapped condition removed, the new test red ("never:
both turns out at the vendor at once").
Not tried: a real Codex account; I could not tell from the report whether
tmr11235's account has credits off or a cap they forgot: with a cap set,
a sole account still queues, by design. Full suite after the tag.
WaiooT (Tencent Cloud Token Plan, deepseek-v4.1-flash, an agent named
nowledge-mem): requests often ended "an empty reply (the model answered
nothing; try again) -- cut at its length, the whole output spent on
reasoning". Output 4,096, reasoning tokens 4,096, finish length. The
request named max_tokens 4096 (the memory tool's own setting; magpie adds
no limit to it) and no reasoning. Tencent's DeepSeek runs thinking by
default (docs 1823/132248: thinking "enabled", reasoning_effort "high",
"max_tokens >= 2048 advised in thinking mode") and counts it in
max_tokens, so the thinking spent the whole limit before an answer.
A Chat or Responses request to a tencentmaas.com provider's DeepSeek model
that names a reply limit of 16384 or less, names no reasoning of its own
(reasoning_effort, thinking, enable_thinking, reasoning...) and has no Max
output set by the user is sent that limit plus a high effort's room
(replyRoom, as side calls are), within the model's own limit where known
(withThinkingRoom, maxoutput.go). Scoped to that host and DeepSeek models.
The failure itself, a cut void, was already failed at once and asked
nowhere (#2972): its text now names the limit the request set and what to
do ("raise max_tokens in the agent, or ask for less reasoning"), still
holding cutVoidWords, so the group and patience matching is unchanged.
Run (mica): TestTencentDeepSeekCapGetsThinkingRoom (4096 gets room;
max_completion_tokens too; effort asked, thinking off, a large limit, no
limit, and another vendor's DeepSeek go as they came), TestChatLength*
(the error names the limit), TestShortDefault*, and gateway tests matching
Void|Length|Empty|Cut|Tencent|Output|Thinking|Reasoning; gofmt; go vet
darwin, linux nogui, windows of internal/gateway.
Broken by hand: withThinkingRoom's call removed, the new test red
("4096 and no reasoning: max_tokens 4096, want 28096").
Not tried: a real Tencent Token Plan key (none here), so that the 4096
came from the agent and not a Tencent default is read from the docs and the
reporter's numbers, not seen on the wire; an Anthropic-protocol client in
front of Tencent's DeepSeek is not covered; full suite after the tag.
macOS CI at 169ec9165 (run 43178215035) hit internal/gateway's 30m alarm
in TestSearchQueueKeepsCodexAlive/silent, as #5666 recorded for
/comments at 00198b26e. The fake upstream waited on proceed with no other
way out, and proceed was closed only after the client's Do returned. When
the client failed first (t.Fatal on a loaded runner), the deferred
up.Close waited for that handler until the package alarm, and the
client's error was never printed.
The handler now also returns on its request's context, and a deferred
once-close of proceed runs before up.Close. A client failure is a named
red with its message, in under a second. Why Do failed on that runner is
still unknown; the next red will say.
Same approach as the fix proposed on #5666 (Gaoshou101's comment), made
on the current test, which has since gained release/finish.
Run on mica:
- go test -tags nogui -race ./internal/gateway -run '^TestSearchQueue'
-count=10: ok (15s).
- GOOS=linux go vet -tags nogui and GOOS=windows go vet on
internal/gateway: ok. gofmt clean.
Broken by hand: a t.Fatal injected after Do, once the handler had
reached proceed. Old code: panic at the 60s -timeout, stuck in
/comments, the same shape as CI. Fixed: all four subtests red in 0.33s
with the injected message. A 1ms hard cancel failed fast on both (the
request never reached the upstream), so it doesn't exercise this.
Not run: the full gateway package (a test-only change to this one test).
Mistral answers a Chat request with more than 20 images with 400 "Total
number of images exceeds the maximum allowed of 20." Codex reading its
21st screenshot in one conversation failed on every later turn. Both
routes to Mistral (the Chat passthrough and the Responses-to-Chat
translation) now replace the oldest images past the newest 20 with a
short text part, in place; a request within 20 goes byte for byte, and
other vendors are not touched. Mistral's docs give no number ("depends on
the model"), so 20 is the one its error names.
Run on mote: TestMistralImageLimit (Chat route, Responses route, 20 images
unchanged, another vendor's 26 images unchanged). Broken by hand: with the
two calls off, the chat and responses cases fail. Not tried: a real
Mistral key; a model with a smaller limit than 20 (Mistral's docs do not
say any does).
Beside the ChatGPT sign-in the Codex app's picker reads
magpie-desktop-models.json, written only once the ChatGPT backend's model
list is known. not_4O4 (Windows, Codex App 26.1106.6628.0) had no such file:
the backend's ask never succeeded from there, so the file was never written
and the picker showed GPT alone while the account had room, magpie's models
only (and no GPT) once it was used up and magpie became the provider.
After an ask has failed with no list from before for that sign-in,
CodexDesktopCatalog now hands Codex's own models_cache.json entries and
magpie's models (the revoked sign-in's path), told once through
CodexDesktopChanged; the backend's list replaces it when it answers. With no
cache the file stays as it was, and a 502 after a revoked sign-in is still
no answer.
Run (mote): go vet gateway and agent (darwin), GOOS=windows and linux -tags
nogui vet of gateway, go test ./internal/gateway ./internal/agent;
TestCodexDesktopCatalogBackendUnreachable is new and TestCodexDesktop*,
TestCodexDesktopCatalogRevokedSignIn still pass. On the Windows box
(win-run) the agent's Codex desktop tests passed and a used-up probe wrote
magpie-models.json with relative key as in the report.
Broken by hand: the stand-in only for revoked, the new test went red.
Not tried: the real Codex app on the reporter's network; the reporter's
used-up half (GPT missing from the provider catalog) did not reproduce, the
catalog carries codex/<slug> entries in the probe on macOS and Windows.
The error magpie gives Codex when a conversation's compaction has failed 3
times now says what happened, how long magpie waits and what to do:
"Couldn't compact the conversation: <model> failed N times in a row (last:
<vendor's reason>). magpie waits <t> before asking it again. To compact now,
switch this conversation to another model." It is a 400 back to Codex
(codexCompact), never sent upstream as prompt.
The hover hint beside "Switch {agent}'s account automatically" is two short
lines per agent instead of three long ones, in en, zh, zh-TW, ja and de.
It still says it is the agent's own sign-in that moves, that the agent sends
the requests, and that sharing an account is against the vendor's terms.
Run on mote: gofmt -l, go vet (darwin, linux, windows) on internal/gateway,
go test -run Compact ./internal/gateway, and in chromium and webkit
i18n-keys, i18n-en-no-cjk, keep-login, pool-ends, sign-in-moves (84 of 84
GUI subtests ok, en and zh). The hold test now asserts the new wording.
Not run: the full suite before the tag (started after it); ja, de and zh-TW
screenshots of the hint; breaking the new assertion by hand (the old text
lacks the asserted words).
Antigravity CLI on a Google model through an API provider: the row's
effort field was there and applied (TestAgyAgentEffort), but agy's own
/effort (works on the Google names agy knows, which the gateway serves
by bare name) and --effort low|medium|high (any model) send a
thinkingLevel that the row's pick then rewrote, so the session's choice
seemed to do nothing. A request naming a level is now left as asked
(agyLevelAsked); a request with thinkingBudget -1 still gets the row's.
"/effort" stays "not adjustable" for "magpie/..." model keys: agy 1.5.5
and 1.5.6 have no settings or ModelInfo key that enables it (tried
thinkingLevel, thinkingBudget, displayName, vertexModelId).
Run: TestAgyAgentEffort, TestWithGeminiEffort on mote; the new case is red
(sent "low" for an asked HIGH) with the condition removed by hand and green
with it. Real agy 1.5.5/1.5.6 against a fake Gemini upstream in a sandbox
HOME showed the levels reaching the gateway. Not tried: a real Gemini API
key, agy against the real gateway end to end.
As the gateway ends (abortAll), keepShelf shelves every run idle between
turns and writes the shelf to claude-shelf.json (temp and rename): per
entry the conversation fingerprint (turnKey: account, model, settings,
messages), Claude Code's session id, its project folders (config folder
and work folder), the account, tools and cache marks. The next gateway's
unshelve reads the file once when its shelf has nothing for the turn
(loadShelf, which takes the file away) and starts Claude Code with
--resume, told the turn alone, instead of the whole transcript (~100k
cache-write tokens on a long conversation). A file that does not parse
whole, another version, a missing session file, a folder that is not a
Claude project folder, or an entry older than idleLongest is unknown and
falls back to today's replay. Rewritten-turn matching (looseTurn) is not
kept; runs in a turn or parked on tool results at the stop are not
either; a crash writes nothing.
Run (mote): gateway "Claude|Subscription" tests green (90s), gofmt, go vet
darwin/linux/windows (nogui) and gui. TestClaudeIdleRunSurvivesARestart
(two Servers on one HOME, fake claude) is red with keepShelf off (session
removed as the gateway ended) and green with it; the unreadable-file
cases fall back to replay. TestClaudeSessionFilesAreRemoved now expects
the sessions to stay until the shelf discards them.
Not tried: a real Claude Code (a sandbox HOME has no sign-in), the
full ./... suite before the tag, Windows.
Claude Code's "You've reached your Fable limit. Run /usage-credits to
continue or switch models with /model" read as a plain rate limit: the
"reached your ... limit" wording was in none of the quota word lists (only
"hit your ... limit"), so the whole account rested and Opus was refused
with Fable though its quota was left.
The four lists in routing.go and fallback.go's quotaWords take "reached"
as they take "hit". modelNamed (so every rest path that asks modelLimited)
reads a Claude account's "reached/hit your <family> limit" as that model's
when the family is in the model's id (claudeFamilyLimit); "usage",
"session", "weekly" and the like, and "You've hit your limit", stay the
account's. Messages, Chat Completions, Responses, the group fallback and
the Claude Code bridge all rest through restAfter.
Run at this tree (mote): TestClaudeNamedModelLimitRestsThatModelOnly red
without claudeFamilyLimit (rests the account, Why rate), green with it;
internal/gateway and internal/provider, gofmt, vet on darwin, linux and
windows (results below). Not tried: a real Fable-limited account; the
family word is Claude Code's wording as the screenshot shows it.
tmr11235 (Pi, Codex subscription, gpt-6.1-sol): the second request sat in
"routing" until the one before it was answered. Two Pi turns at once on a
Codex sign-in are both out at the vendor at once (HTTP and websocket
upstream, TestPiTwoTurnsOnCodexAreOutTogether, green on the old code too),
and no concurrency cap is set for Codex by default. What does hold a
second turn is an account within 5 points of a usage cap the user set
(nearCaps, one turn at a time). That wait comes before the first try is
begun, so the row had no try and read "routing", and the wait wasn't a
known one for the unrouted watch either (it could end the request as
unknown after 30s).
The wait now sets the route's Phase to "queue" and the request's phase
(notePhase, so it is a known wait). The Routing page says "queued…" and
its explanation says what it waits for, in en, zh, zh-TW, ja, de.
The one-turn rule itself is unchanged: it protects a cap the user set.
Run (mote): TestNearCap*, TestNearCapWaitSaysQueued, TestPiTwoTurns*,
go test ./internal/gui, routing-queued/routing-masking/routing-wait-dot
in chromium, routing-queued in webkit, i18n-keys, i18n-en-no-cjk, gofmt,
go vet darwin/linux nogui/windows of internal/gateway.
Broken by hand: showQueued replaced by a no-op, TestNearCapWaitSaysQueued
red ("never: the waiting turn's route says queued").
Not tried: a real Codex account near a real cap; full suite is started
after the tag.
Novello42 reported Codex with MCP tools through Copilot's Gemini and Grok
failing with 400 or empty tool arguments. Both causes were fixed in
b1f5806cb (v0.1.3757): Copilot's Gemini no longer gets `type` written
beside a nullable anyOf, and Copilot's Grok gets root unions as objects
(nested unions folded) and namespaces flat. This adds the matrix that was
missing: Pydantic's Optional[str] (#3931), Codex's move_thread_to_project
projectId and a reconstruction of automation_update (root oneOf through
$defs, unions inside the branches), each sent by a Chat, Messages and
Responses client to both models, against a fake Copilot that refuses what
the live account refused.
No product change. Run (mote, -tags nogui): the new test passes at
origin/main 4028687b8. At b1f5806cb^ (before the fix) 12 of its 18 cases are
red: all nine Gemini and the three Grok automation ones, so it guards the
fix on every route, not only the Responses one.
Not tried: a live Copilot account; Grok with a union inside a union that
sits under a property rather than at the root (no recorded refusal to
copy); the full suite.
memory_search printed a memory's Updated as a bare UTC date, so a memory
saved at 04:30 on the 11th in Shanghai read as the 10th, and the stored
times were written in UTC. Now:
- every memory time is written in the local zone (now() instead of
now().UTC()): created, updated, edited, used, sync tombstones, digest
publish time;
- memory_search shows 2026-11-11T04:30+08:00 (memoryStamp);
- the dream's notes list the creation day in local time, as "Today" there
already was.
Old data: the file already held full timestamps, only in UTC ("...Z").
They parse as the same instants and are shown in local time, so no
migration; they are rewritten with a local offset when next changed.
There is no date filter in memory_search, and the Memory tab shows no
dates, so nothing else read the UTC day.
Tests: TestMemorySearchDatesInLocalTime (gateway) with time.Local at +08:00
reads an old "Z" memory and checks a new save is stored with +08:00. Red on
the old code both halves, broken by hand: the DateOnly line printed
2026-11-10, and now().UTC() in memory.go failed the saved-zone check.
Run with TZ=UTC and TZ=Asia/Shanghai on mote: internal/memory,
internal/memdistill, internal/gui (memory tests) ok; gofmt clean;
go vet ./..., linux nogui, windows ok. Not run: full ./... suite before
the tag (started after it), GUI browser tests (no assets changed).
基元律动's OpenAI-compatible relay answers a field it doesn't take as
"未知请求字段:<name>". refusedOptional only knew the English wordings, so
the retry without prompt_cache_retention (and the other optionalFields)
never happened and the error went to the client. magpie itself adds none
of these fields to a custom provider's request: prompt_cache_retention is
the client's own, and optionalFields already drops it on a refusal and
remembers the provider. Added the Chinese wordings (未知/未识别/不支持/
不允许/无效 + 请求 + 字段/参数/属性) to unsupportedOptionalField.
Run: gofmt clean; go test -run 'Optional|Refus' ./internal/gateway ok on
mote; go vet gateway darwin/windows/linux. chinese-unknown-field and
chinese-unsupported-quoted in TestRefusedOptionalNamesOnlyUnsupportedFields
fail on the old gateway.go (checked by hand). Not run: full suite before
the tag (started after), the relay itself (no account).
Claude Code delivers a sub-agent's report that arrives mid-turn as a
{role: "system"} message: "Another Claude session sent a message while
you were working: <agent-message from=...>report</agent-message>", beside
a <task-notification>. saidWithResults skips system text, and
withTaskNotices kept only the notification, so the bridged main agent was
told the report was delivered and never saw its 14k chars. withTaskNotices
now also hands over <agent-message> blocks from system/developer messages,
in order, labelled as another agent's output and not the user's. User-role
standalone reports already went through as said text, so no duplicate.
Siblings: the only other system filter is saidWithResults's (deliberate:
system text is never the user's); the workdir scan skips system on purpose.
Run: TestClaudeAgentMessageReportGoesWithTheResults (notification beside,
split across blocks, two agents) red on origin/main's code (3 of 3), green
after; go vet darwin/linux nogui/windows; full internal/gateway on mote ok;
gofmt clean.
Not tried: a real Claude Code with a real sub-agent, GUI tests (no GUI change).
Copilot's gemini-4-carbon now and then answers a Chat request 200 with
completion_tokens above 0, no content or tool delta and finish_reason null
(~855 bytes: the usage frame). thoughtOnly never saw it (no reasoning in
it), the Chat decoder gave no stop, and the Responses encoder closed it
with an empty response.completed, so Codex stopped without a word.
A Chat upstream's reply that said nothing and never gave a finish_reason now
takes the empty-reply path (#667): asked again in place, the error when it
stays empty. A reply with text and no finish_reason, and one ending with a
stop and no text, go as before.
Run: TestChatUsageOnlyReplyIsEmpty plus the gateway empty/length/thinking
tests via mote-run. Broken by hand: without the `voids && stop == ""`
condition the new test is red with the empty response.completed.
Fixture: role chunk, then a choices:[] chunk with usage, then [DONE].
Not tried: the real Copilot account (the empty reply is intermittent).
adaptiveThinking turned thinking enabled+budget into adaptive and wrote
the budget's nearest level as a top-level output_config.effort whenever
none was there. Claude Code's High is carried in a turn's own message
(turnEffort) beside a 31999 budget, so the first magpie wrote "max" on
top, and the next magpie (parseAnthropicRequest, requestEffort) reads the
top-level level before the turn's: every request ran at max. Now no
top-level level is made of the budget when a turn carries one.
Siblings that read only the top-level effort: thinkingOffAsTaken and
withBetweenTools judged "above high" without the turn's level, and
withBetweenTools wrote into a nil map when there was no output_config
(panic); both now use outputConfigEffort (top-level, then the turn's).
Reviewed and left: requestEffort, parseAnthropicRequest,
outputConfigEffort (turn after top-level, never the budget),
buildAnthropic from the IR (r.Effort is already the turn's),
withOutputEffort, decide.go's rule effort (an explicit pick),
gemini/chat budgets (no turn effort exists in those protocols).
Run (mote): the two new tests, red on the old anthropic.go (upstream
effort max / top-level max), green on the fix: TestRemoteMagpieKeepsTurnEffortOverBudget
goes local -> remote magpie (both real handlers) -> Anthropic fake and
checks the hop's body too. Not tried: a real Claude Code through two
magpies.
Claude Desktop's Code tab, and Claude Code under it, write the id the gateway
listed the model by (magpie-<number>.anthropic.<Claude model>,
mythos-magpie-<n>, anthropic/magpie-<n>, claude-magpie-<n>) as each turn's
model. The gateway's log counts the turn under the model that served it, and
the agent's file counted it again under the alias: a row for a model that is
none, its cost on top of the real one.
Only the gateway knows those ids, so a call that names one went through it.
Such calls are now left out of what Direct, the ledger and the Requests
page's chunks take from session files, for every agent that records one.
Calls under a model of the agent's own are unchanged. usage.MagpieAlias
mirrors the gateway's alias forms; a gateway test fails when the two differ.
Run (mote, at the pushed head): TestAliasCallsAreTheGatewaysNotDirect, TestMagpieAliasForms and
the gateway's TestUsageKnowsEveryAliasForm pass; with ownCalls returning its
input the first fails (7 rows, four under aliases). go test internal/usage,
internal/gui, internal/sessions ok; vet darwin, linux nogui and windows of
usage and gateway clean; gofmt clean. Go-only change, so no GUI file was run.
Not tried: a real Claude Desktop 3p session (none on this machine; the model
forms come from the gateway's own alias code and its tests, not JSONL bytes).
Existing persisted request chunks rebuild with the new binary.
Claude Desktop reaches magpie with a gateway key, which Claude Code takes
for an API key (docs: automatic is 1 hour on a subscription, 5 minutes on
an API key) and marks with no ttl. runTTLFor read that as the client's
word, since claudeTTLOf gave Desktop no pick, and the bridge's run wrote
5-minute caches. Desktop with no pick now gets "default" (this computer's
Claude Code pick, else an hour); a 1h mark and a magpie's header stay as
they are.
Run: TestClaudeCacheTTLOf and TestClaudeDesktopRunKeepsAnHour (both red on
the old code, checked by reverting remote_magpie.go), go test -run
'Cache|TTL|Claude' ./internal/gateway ok on mote, gofmt, go vet darwin,
linux, windows.
Not tried: a real Claude Desktop turn and a usage row's ephemeral_1h in a
sandbox (needs Desktop signed in to a gateway and a live account). A
Desktop user who picked 5m in its own config is now given an hour: its
marks can't tell that from the API-key default.
After an app update the service (`magpie daemon`, ~/.local/bin/magpie)
ran on as the old version until its own look at the disk found the gateway
idle, and `magpie daemon restart` by hand showed the app "Port 3425 is in
use by ~/.local/bin/magpie (pid N): quit it" while the new service came up.
- PortHeld.Own: a holder that is a magpie running this install's program
(same file, symlinks followed) is marked; the Gateway card then says
"Starting the gateway…" instead of the port-in-use error.
- The app asks an older service of its own install (the pid the service
manager reports, program from the unit/plist: daemon.Program) to restart,
once per process, through gateway.RestartPath, as `magpie update` does:
it restarts into the new version once idle, bounded by its drain, under
the same service manager.
Run on mote: go test of the new tests in internal/gui, internal/daemon,
internal/gateway; go vet darwin, linux nogui, windows; gofmt; gateway-*
and i18n GUI files in chromium and webkit. Broken by hand: dropping the
Older check makes TestNudgeAsksOwnOlderDaemonOnce red.
Not tried: a real app update over a real launchd service. The restart is
an in-place re-exec of the service, not a socket handover, so the port is
closed for the service's start-up.
GUI (mote, chromium+webkit): gateway-port-holder, older, skew, takeover, port, i18n-keys, i18n-en-no-cjk 36 of 36 ok. All gateway-* files: 30 reds, all in gateway-card (shares on the network, #6267) and gateway-key-arrange (420px, #6268); the same 30 with client.js reverted to origin/main, so not from this change.
Not tried: a real app update over a real launchd service; the daemon re-execs in place, it is not a socket handover.