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.
Interactive mode dropped --thinking-display, so no summary reached the client, and -p set it only when an effort was known: both runs now get showThinkingSummaries in --settings. A High carried in the turn's own message (output_config on a {role:system} message) lost to a 31999 budget read as xhigh; the turn's level now wins in parse and in routing's requestEffort.
Red on the old code: TestClaudeBridgeTakesTheEffortOfEveryRoute (3 new rows), TestTurnEffortBeatsBudget.
d31988c95 (the Mac title bar at first show) also carried, unnamed, the
reverse of 1648fcfe2 and 95eab9a66: withMistralCacheKey and isMistral
were taken out of gateway.go, mistral_cache_key_test.go was deleted,
and TestOwnCacheKey lost its two Mistral rows. Its body names only the
title bar. So Mistral users lost the cache key daoche_wuzui asked for
(poor cache hits on X) with no commit saying so.
This restores those four gateway files to what 95eab9a66 left; the
title bar change (internal/gui) is kept as it is.
Run (mica): gofmt clean; go vet ./internal/gateway on darwin,
GOOS=windows and GOOS=linux -tags nogui ok; go test -run
'Mistral|OwnCacheKey|CacheKey|DesktopProbe|PromptCache' ./internal/gateway ok.
Not tried: the full suite, a real Mistral key.
b70563ec6 kept one process-wide "accounts reordered at" stamp. affine
dropped any conversation's stick older than that stamp, so reordering
Claude's accounts in the GUI cost a running Codex (or any other
provider's) conversation its account and its prompt cache on the next
turn. In tests, any earlier SetAccountOrder set the stamp, and later
tests that backdate a stick to check an hour's cache saw it dropped:
TestAffinityKeepsAnHourCachePastFiveMinutes,
TestChatGPTConversationStaysPastFiveMinutes and
TestClaudeConversationKeepsItsAccountsCache went red in package and
subset runs (#6249, #6262, one cause).
The stamp is now per provider (provider.NoteReordered(id),
ReorderedAt(id)), and affine compares the stick only with the
reorder of the provider whose account it holds. fresh(t) and the
tests that reorder call provider.ForgetReorders.
Run (mica, darwin):
- go test -run 'Codex|Draw|Image|Keep|Relay|Reorder|Affinity|ChatGPTConversation|ClaudeConversation|AccountOrder|AccountRank' ./internal/gateway:
ok 253s; the same run at origin/main FAILs in the three tests above.
- go test ./internal/provider ok 128s; ./internal/cli ok 46s.
- go vet darwin (provider, gateway, cli, gui), GOOS=windows (same),
GOOS=linux -tags nogui (provider, gateway, cli): ok. gofmt -l: clean.
- Broken by hand: the new case "another provider reordered keeps it"
on the old affinity.go answers "k1 k2 k2, want k1 k1 k1"; green now.
Not tried: the full suite, the GUI suite, a reorder with real accounts.
Not changed: `magpie accounts order` (internal/cli) notes the reorder
in its own process, so a running gateway never sees it and keeps the
old stick until it expires; that was so before this change too.
DeepSeek Harness's desktop app puts one paragraph on @ paths in every
system prompt. With it word for word, gemini-4-argon on Antigravity
answered most requests in about 3s, with no thinking, and stopped after
one shallow step. The reporter found that removing just that paragraph
fixed it, and a recorded DSH request with the paragraph reworded was
answered normally 20 of 20 times. The antigravity plugin 0.1.7 now sends
it reworded; this is the same for magpie's built-in Antigravity.
codeAssistBody, for an Antigravity account and unless the prompt is set
to go as written, now sends antigravityReword(antigravityCloak(system)).
antigravityReword replaces each exact paragraph in agReworded with a
rewording that says the same, and leaves the rest alone. The caller's
request keeps the system prompt as written, as it does for the cloak.
Run (mica, at origin/main d31988c95):
- go test ./internal/gateway -run "Antigravity|Cloak|CodeAssist": ok
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok; gofmt -l clean
- Broken by hand: dropping antigravityReword at the call site turns
TestAntigravityDSHAtPathsGoReworded red with the paragraph sent as
written; restored, green.
The test also checks Gemini CLI and prompt=as-written get the paragraph
as written, and that a prompt merely mentioning @ paths is untouched.
Not tried: a real Antigravity account through the built-in path (the
plugin's rewording was what the reporter's recorded request measured).
Reported-by: xueyinmei-dot
On macOS 26 an update's silent relaunch (open -n -g) deadlocked the new
process's main thread: ApplicationStarted ran plainTitlebar -> insetLights ->
toolbarRounder, which allocates a temporary NSWindow and releases it while the
hidden background launch is still inside FBSWorkspaceScenesClient
createSceneWithIdentity. Every InvokeSync waiter (tray usage, lighten, the
resize/move timers) then blocked behind it, so the old tray left and the new
one never came up.
The Mac's title bar is now done in reveal, just before the window is first
shown (a user action, never inside the launch); Linux keeps it at start.
Their other two suggestions need no change: keepAt already returns while
h.placed isn't the window, and with the main thread free the ready waiters
no longer pile up.
Run: gofmt; go vet darwin, linux nogui, windows; go test ./internal/gui on
mote (ok, 136s). New TestMacTitleBarNotDoneAtStart, red with the call put
back in ApplicationStarted and red with it removed from reveal.
Not tried: the real deadlock. It needs macOS 26's hidden relaunch through
LaunchServices from an updated bundle; mote (macOS 27) was not driven that
way, so it is not shown not to reproduce there either. The full suite was
not run before the tag.
withFields re-sorted the client's message keys, which the Mistral reasoning tests (byte-for-byte) caught. The fake Mistral's known fields now list prompt_cache_key, as Mistral's chat docs do. Run: Mistral, CacheKey, Hermes and the five full-run reds alone (all ok); gofmt.
Mistral routes a request by prompt_cache_key to the server holding its
prompt cache; magpie sent none, so cache hits were poor. A Chat request
bound for Mistral (preset or api.mistral.ai) with no key gets the sha256
hex of the session, else the conversation id: opaque, stable per
conversation, never the raw id. A client's own key and a user's extraBody
key are kept; translated requests get it through ownCacheKey (its
refusal retry applies). Other vendors are unchanged.
Run (mote): TestMistralPromptCacheKey, TestOwnCacheKey, CacheKey tests,
then gofmt, go vet on darwin/windows/linux nogui, and the gateway
package. TestMistralPromptCacheKey was red on the old code (no key).
Not tried: a real Mistral API key.
Codex sends its image tool's calls to the ChatGPT backend path magpie serves
(/backend-api/codex/images/generations and /images/edits). codexBackend
relayed them as they came, signed with Codex's own sign-in. With Codex kept
signed in to account A (KeepLoginAs) and the pool ordered to put B first,
text turns went to B, but every image call still spent A's image allowance,
so once A's was used up no image could be drawn while B had room.
Now, when magpie has more accounts than the sign-in (and the call carries
no API key, names no account, and is signed by the sign-in), the call is
served by the images handler on codex/<model>: drawOnAccounts goes over the
accounts in the pool's order, past one whose image allowance is spent
(restDrawer), signed with that account's own token and chatgpt-account-id.
A sign-in alone, an API key, a request signed by an account magpie lacks
and a model with a namespace are relayed as before.
Run on mote: TestDrawingFollowsThePoolNotTheKeptLogin (two fake accounts,
acct-1 answering usage_limit_reached, pool order spare first, Codex kept on
acct-1) red on the old code for the /backend-api/codex path (asked acct-1,
429), green now for it and for /v1/images/generations; TestCodexImagesRelayedWithTheSignInAlone
green. go vet darwin, windows, linux nogui ok; gofmt clean. internal/gateway
-run "Codex|Draw|Image|Keep|Relay" ran: two reds, TestAffinityKeepsAnHourCachePastFiveMinutes and
TestClaudeConversationKeepsItsAccountsCache, both ok alone and neither near this change (see issue).
Not tried: a real Codex account; Codex's real image request body (edits shape taken
from the images API's); the full suite (started after the tag).
Auto affinity kept a conversation on the account that answered it by its cache, so an account moved down (or another made First) still took the next turn. SetAccountOrder, the login switch and the CLI switch now call provider.NoteReordered; affine drops a stick last answered before it, in Auto and not within a turn (Session and Strict keep it).
Run on mote: TestReorderedAccountsTakeTheConversationAtItsNextTurn red with the check off (k1 k1 k1), green with it; go test internal/provider, internal/cli ok; internal/gateway -run Affinity|Ordered|Stick|Reorder|Strict|Conversation|Fallback ok; go vet darwin, windows, linux nogui ok; gofmt clean.
Not tried: a real Codex account; GUI tests (no GUI file touched beyond the switch handler); the full suite (started after the tag). The image-quota half of the report is not fixed: no real refusal body was available.
y0ngb1n runs magpie on a server behind Cloudflare and uses it from a local
magpie as a Remote magpie. Cloudflare's analytics showed /v1/models asked
~3.7k times an hour (one a second) since Nov 10, 175k in 7 days.
Cause: the follower (KeepRemoteListsFollowed, 11-06/11-08) waits at the
other magpie's /v1/models with X-Magpie-List-Wait and If-None-Match, and
the gateway holds the wait while the tag is the one named. Cloudflare
compresses the list and so turns its ETag weak (W/"ml-..."); the follower
sent that back, and modelsOnceChanged compared it exactly (tag != since),
so every wait was answered 200 at once. The tag it answered equalled the
follower's, so no refetch, only followGap (1s) before the next ask: a
request a second for ever, for as long as the local magpie runs.
Fix:
- gateway/models_wait.go: the wait compares the tag weakly (tagNamed, as
listModelsTagged already does), so it is held to its end and answered 304.
- provider/remote_follow.go: a 200 that carries the tag the follower has,
answered sooner than followQuick, is a wait that was not held (an older
gateway behind such a proxy): the remote is left to its schedule
(errListNotWaited, again after followOldAgain) as other non-waiting
magpies are. Tags are compared without W/.
Run:
- Two magpie processes in sandbox HOMEs on mote (A serving, B a Remote
magpie of A through a counting proxy that makes ETags weak, as
Cloudflare does): old code 14-15 /v1/models per 15s on A, with the fix
4 at start and none in the next 30s. Without the proxy's weakening the
old code was already quiet (1 per ~50s), so the cause is the weak tag.
- TestModelsWaitNamedByAWeakTag and TestRemoteMagpieWeakTagNotAskedOver:
each red with its half of the fix reverted (200 instead of 304; 32 asks
in 400ms), green with it.
- go test -run 'TestRemoteMagpie|TestModelsWait|TestModelsList' on
internal/provider and internal/gateway; gofmt; vet darwin, linux nogui,
windows: clean. Full packages internal/provider (160s) and
internal/gateway (929s) on mote at the head before the rebase: ok.
Not tried: the user's real Cloudflare; GUI.