Commit Graph
2027 Commits
Author SHA1 Message Date
yetone 9335e23d3b claude-desktop: every inferenceModels entry carries its /v1/models name (chengming0v0)
chengming0v0 on Discord (v0.1.2806, Claude Desktop): the models of an
API-key provider read "mythos-magpie-0167851852", "mythos-magpie-3494120245"
and the like in Desktop's model menu, beside rows named properly
("DeepSeek V4.1 Flash 1017 · 寄吧鲁东", "GPT-6.1 Sol · ag:zdgit").

Cause: since ae060550b (v0.1.2770), while a model is picked for one of
Desktop's tiers, magpie writes its profile's inferenceModels so Claude
Code gets behavesAs. Desktop 4.4212 skips /v1/models discovery while that
list has no bare tier word as a name (adminListObviatesDiscovery in
index.chunk-m4oMImJ-.js, discoveryEnabled unset), and pzn then names each
entry labelOverride ?? catalog name ?? discovered name ?? ypn(id), which
for mythos-magpie-<n> and anthropic/magpie-<n> is the id itself. Only the
rows listed by their [1m] id (DesktopLongest) got a labelOverride, which is
why the user's 1M models kept their names, and why one GPT model of theirs
showed its name once its window was set from 400K to 1M.

Change: DesktopInferenceModels gives every entry the display_name
/v1/models gives its row as labelOverride, a catalog-named Claude model
(magpie-<n>.anthropic.<model>) too, whose description naming the provider
is lost with discovery. A list magpie wrote before is rewritten on the next
Sync (its hash is magpie's); Desktop reads it as it starts, so it needs a
restart (the Agents row offers one). agent-wiring.md updated.

Reproduced with the reporter's shape: an API-key provider whose models
have reasoning levels (listed as mythos-magpie-<n>), a GPT model at 400K
and one at 1M under DesktopLongest, one picked for a tier, in the tests'
sandbox HOME. TestDesktopInferenceModelsNamed (new) is red on the old
desktop_list.go for every entry but the 1M one ("mythos-magpie-3254679763
is labelled <nil>, /v1/models names it \"gpt-6.1-sol · 寄吧鲁东\"", 5
entries), and
TestClaudeDesktopModelsList's new check, on the profile magpie writes, is
red on it ("named by its id: … name:anthropic/magpie-4604110569"); both
green with the change.

Run on mote, rebased on 3e3196222: gofmt -l clean; GOOS=linux and
GOOS=windows go vet ./internal/gateway ./internal/agent ok; go test
-count=1 -timeout 45m ./internal/gateway ./internal/agent ./internal/gui:
gateway ok, agent ok, gui red on TestMainWindowCorners/macOS_26_SDK only
(#3949, open, unrelated). After that run the new test gained the 400K/1M
pair; -run 'TestDesktopInferenceModels|TestClaudeDesktop' over gateway and
agent ok at the pushed tree.
Not tried: a real Claude Desktop 4.4212 with the written profile (read
from its app.asar only); the reporter's own Desktop version is unknown.
2026-11-03 14:37:00 +08:00
yetone 3e31962225 provider: Request headers to pass, the agent's own values to its provider
A provider's fixed Headers can't say a value that changes from request
to request or from client to client. 3jRzfF52Qx on X asked for the
agent's own header values to reach the vendor. Each provider now has a
comma-separated list of request headers, saved as `passHeaders`. When the
agent's request carries one of them, its value goes to that provider as
the agent sent it.

- Where it is: the editor's "Request headers to pass" (zh 透传请求头),
  under Advanced, right after Reply headers.
- The agent's value stands over a fixed Headers value of the same name.
  When the agent sends none, the fixed one goes.
- Never passed on, listed or not (provider.RequestHeaderPassable):
  - magpie's key: Authorization, X-Api-Key, X-Goog-Api-Key, Api-Key;
  - cookies and sign-ins: Cookie, Set-Cookie(2), WWW-Authenticate,
    Authentication-Info, Proxy-*;
  - the connection's own fields: Host, Connection, Keep-Alive, TE,
    Trailer, Transfer-Encoding, Upgrade, Expect;
  - what magpie writes for the body: Content-*, Accept,
    Accept-Encoding;
  - Origin, Sec-* and X-Magpie-*.
  Save refuses such a name with a reason (RequestHeadersOK), and so does
  the editor, before the save. The editor's list is held to Go's by
  TestReplyHeadersNeverAsTheProvidersAre. A name written into
  providers.json by hand is dropped on read.
- Only that provider gets them. forwardOnce, which every chat,
  responses, messages, count_tokens, group-member, fallback and plugin
  try goes through, puts the agent's headers in the try's context under
  the try's provider id (WithClientHeaders). Provider.Sign passes only
  what that id lists, before an account signs, so a signed-in account's
  own signing still wins. A plugin's fetch gets them in req.Header.
- Wire headers are still masked when read (5ec237568), so a passed
  token header shows masked in a call's log.

Run on mote at the tree rebased on origin/main 06944e065:
- gofmt -l: clean.
- go vet: darwin (provider, gateway, gui), GOOS=linux -tags nogui
  ./..., and GOOS=windows ./...: ok.
- go test -timeout 45m ./internal/provider ./internal/gateway
  ./internal/gui: provider and gateway ok. In gui, TestCoreScriptBudget
  and the i18n tests are ok and only TestMainWindowCorners/macOS_26_SDK
  is red, as on main on macOS 27 (#3949).
- The core budget is not raised. This change's words, and the comments
  on extra body and the never lists, were cut first. After the rebase
  onto 63dc359fb it was 438 bytes over again, so three provider-editor
  comments (User-Agent, balance token, plan access keys) were cut to a
  line each. The core is 1,533,554 bytes, 248 under 1,533,802.
- At this head (rebased on origin/main 63dc359fb): go test -run
  Budget|I18n|ReplyHeaders ./internal/gui is ok. The new provider and
  gateway tests are ok. node --test pass-headers, reply-headers,
  i18n-keys, header-session-hint, balance-fix and extra-body: 162 of
  162 ok.
- node --test, Chromium and WebKit: pass-headers (en/zh/zh-TW/ja/de),
  reply-headers, i18n-keys, provider-detect-models, header-session-hint
  and extra-body: 46 of 46 ok.
- Before the budget cut, against the same base: every GUI file that
  opens the provider editor and saves (45 files plus i18n-keys) had 739
  of 758 ok. These were red, and red the same on a fresh origin/main
  06944e065 copy: models-works-only (#4391), provider-picks-stay
  (#4397) and remote-magpie (#4398). Also red: one WebKit sub-pixel
  miss in provider-detect-models (#4964), which passed on main and at
  this head.

New tests:
- TestRequestHeadersList: cleaning and refusals.
- TestSignPassesClientHeaders: the agent's value over the fixed one,
  never magpie's key even when listed by hand, nothing for another id,
  and the fixed value when nothing was sent.
- TestPassHeadersReachTheProvider: messages relayed and translated,
  chat, a chat stream, responses and count_tokens.
- TestPassHeadersOnlyToTheirProvider: a fallback that lists nothing gets
  nothing, the log shows the passed headers masked, and in a group the
  member that lists them gets them while the one before it, which lists
  nothing, doesn't.

Broken by hand, each red, then put back:
- forwardOnce without WithClientHeaders: both gateway tests red.
- RequestHeaderPassable ignoring the never list: TestRequestHeadersList
  red, and TestSignPassesClientHeaders red on X-Api-Key=magpie-key
  passed on.
- Sign not skipping a fixed header the agent sent: the provider test,
  and the gateway test on every route, red on X-Route=route-fixed.

Not covered: embeddings, images, video and the Codex backend relay,
which don't go through forwardOnce.

Not tried:
- a real vendor or a real plugin provider with the setting;
- Windows and Linux test runs (vet only);
- a gateway test with Authorization listed by hand, which normalize
  drops on read. Sign's own check is covered by
  TestSignPassesClientHeaders.

Requested by 3jRzfF52Qx on X.
2026-11-03 14:16:20 +08:00
yetone 63dc359fb4 providers: a subscription account's rest, or its model's, shows on its row (maxleebeta)
maxleebeta on Discord (#feedback): WorkBuddy answered 429
{"type":"rate_limit_error","message":"WorkBuddy: 您的使用量已超出频率限制,将在
2026-11-03 23:57:19 UTC+8 重置,您也可以切换其他模型继续使用。"} while the
provider's card said 1,934/2,350 credits left (82%), and nothing on the
Providers page said the account was held back.

Routing already handled the refusal: resetsWhen reads the time (UTC+8, the
space before 重置 included), failure() gives failQuota, and since it says
切换其他模型 the rest is that model's alone (restID), by "resets", till
15:57:19 UTC; the account's other models are still asked (#1669). What
was missing was the page: a key's rest showed on its row, an account's
never did.

- gateway.RestsUnder(prefix) lists the rests in force under a key prefix
  (provider@ for a subscription's accounts, provider@user/model for a
  model's), with Key and the rest's note (Model, By, Error).
- providerJSON.accountRests gives them by user in lower case, the model
  filled in from the key when the note has none; provider.KeyRest gains
  By, Model and Error.
- app.js: the account row in the provider editor gets a line per rest
  (accountRestLines): "<model> resting · 429 quota used up · back at
  <time>" or "Resting · …" for the whole account, the vendor's words
  beside it (shown whole when it names a time magpie couldn't read, so
  an unknown format still says why), and Try now (gateway/unrest by the
  rest's key). The key row's rest line is now the same helper
  (restLineOf), so app.js grows ~800 bytes, under the core budget.
- New strings in zh, zh-TW, ja and de. docs/subsystems/gateway-routing.md
  says where the Providers page reads them.

Not changed: the "-sg" maxleebeta saw in pi is WorkBuddy AI's own model
id (deepseek-v4.1-flash-sg, the paid Singapore id beside the free
deepseek-v4.1-flash); pi's footer and model picker show ids by design,
and the name magpie writes for it is the vendor's ("Deepseek-V4.1-Flash",
"(SG)" added by the plugin only where two ids share a name). Neither
magpie nor the plugin appends "-sg"; the CN build has no -sg ids.

Run (mote, through mote-run):
- go test ./internal/gateway ./internal/gui ./internal/provider at f0df4bb2b
  (base 06944e065): gateway ok (737s), provider ok, gui ok except
  TestMainWindowCorners/macOS_26_SDK, red on macOS 27 as on main (#3949).
- Rebased on 889767b7b: TestCoreScriptBudget, TestI18n*,
  TestAccountRestsInProviderState and the written-reset tests ok;
  gofmt -l clean. GOOS=linux and GOOS=windows go vet -tags nogui ok at
  f0df4bb2b, before the rebase. Then rebased once more onto 8ee172ca0,
  which changes only gateway search files; not re-run there.
- internal/gui/tests/account-rest.test.cjs: chromium and webkit, en, zh,
  zh-TW, ja, de, at 900 and 360px, ok. rest-try-now.test.cjs's 15 webkit
  reds fail the same on origin/main 06944e065 (#2564, #4127).
- Broken by hand: TestRateLimitedModelListedUnderAccount red with
  RestsUnder returning nothing, TestAccountRestsInProviderState red
  without accountRests, account-rest.test.cjs red without
  accountRestLines.

Not tried: a real WorkBuddy account hitting this 429, so the line has
not been seen on a live gateway; the whole GUI suite (mote under another
session's suite). The line shows in the provider editor's account rows,
not on the collapsed provider row.
2026-11-03 14:09:42 +08:00
yetone 06944e065b gateway: a reply that begins as an event stream is read as one whatever its Content-Type (uk.jent)
uk.jent (Discord, #feedback): MiniMax Code's plugin (0.1.7) served as
Anthropic Messages to Grok Build 1.0.74. The first token took minutes
(5-6 at worst), then hundreds of characters came at once, and every
thinking block said "Thought for 0.0s".

Cause: eventStream decided a reply was a stream by its Content-Type
alone, unless the type was empty or text/plain. A stream sent under
any other type (application/octet-stream, say) was read as a whole
reply. On the Messages passthrough, sigFieldTidy, anthropicTextCalls
and the other tidies hold a whole reply until it ends, so the agent got
the turn only at its end, every block at once. On Chat and Responses
(translated) the same reply failed "did not stream". Under
application/json, notAnAPIReply turned it into a 502 ("isn't JSON").
The plugin itself passes MiniMax's body through untouched, and the host
streams it chunk by chunk, so neither is the cause.

Fix:
- eventStream reads the body's first bytes under any Content-Type that
  isn't text/event-stream. A body that begins as an event stream
  (event:, data:, a ":" comment) is one, and its Content-Type is set to
  text/event-stream for the agent. A JSON or binary body never begins
  that way.
- notAnAPIReply lets a JSON-labelled body that begins as an event
  stream through (eventsStart, shared with eventStream).
- docs/subsystems/gateway-routing.md says the rule.

Test: TestPluginThinkingStreamsAsItComes. The fake MiniMax plugin is
put in front of a vendor that sends its first thinking and then waits
until the agent has heard it (or gives up after 10s). It covers
messages, messages with tools (as Grok Build sends them), chat and
responses, each under text/event-stream, application/json, text/plain,
no type and application/octet-stream.

Run on mote:
- On origin/main d73f2254d: gofmt -l internal/gateway clean; go vet
  -tags nogui ./internal/gateway with GOOS=linux and GOOS=windows ok;
  go test -tags nogui -timeout 45m ./internal/gateway ./internal/plugin:
  internal/gateway ok (742s), internal/plugin ok (136s).
- Rebased on origin/main 441a2b6b1, which brought the #4775 upload
  changes into internal/gateway: gofmt and both vets again ok; go test
  -run 'TestPluginThinkingStreamsAsItComes|NotAnAPIReply|
  APIReplyUntouched|Upload|Unrouted|Streamless|PluginStream|QuietWhole|
  Thinking|Signed|Passthrough|Continuation' ./internal/gateway: ok
  (108s). The whole package was not re-run at this head.

Broken by hand:
- With eventStream at the old code, the octet-stream cases go red in
  all four shapes: messages "reached the agent only once the vendor
  had finished"; chat and responses "FakeCo did not stream".
- The application/json cases go red with eventStream alone fixed and
  notAnAPIReply at the old code ("the thought never reached the agent",
  a 502 after 90s).
- text/event-stream, text/plain and no type pass on the old code.

Not tried:
- a real MiniMax Code account or a capture of the mavis endpoint's real
  reply headers. There is none here, so the cause is the class that
  fits the symptom, not MiniMax's literal bytes.
- a real Grok Build run.
- a stream that comes compressed (Content-Encoding).
2026-11-03 13:50:05 +08:00
yetone 441a2b6b16 plugin: a cancelled sign-in saves nothing, and a failed authorize says why (#5016)
Found reviewing magpie-community/plugins#658 (AStudio's and Agnes Code's
sign-ins wait up to 5 minutes for the vendor's desktop app).

Cancel didn't end a plugin sign-in. The window's Cancel (and the sign-in's
timeout) ended plugin.Finish's context, but "callback" was not a
cancellable call, so the host never heard: the plugin's wait went on, and
a session file written after Cancel still saved the account. Now
authorize, callback and apiKey are cancellable as gatewayRequest is
(host.go `cancellable`): magpie writes `abort`, host.js (`signInSteps`)
drops whatever the plugin answers after it, so nothing is saved, and
counts the call done at once. The plugin's wait is told too: every fetch
it makes for the sign-in carries the sign-in's signal
(`whileSigningIn`), and magpie's hook passes the signal as
callback(code, { signal }) / authorize(inputs, { signal }), which OpenCode
doesn't, so a plugin can stop polling a file. A plugin that ignores the
signal keeps running until its own deadline, but its answer is dropped.

An oauth method's authorize that returned { type: "failed", error } (no
callback) was stored and its missing callback called, so the user saw
"s.a.callback is not a function". host.js now answers that, or any result
with no callback, as the sign-in's failure, and plugin.Authorize returns
ErrFailed with the plugin's reason, for auto and code methods; an api
method's authorize already did. The GUI's start shows it as its failure,
`magpie plugin login` prints it.

Docs: provider-plugins.md, and the plugin guide (en, zh, ja) on failing
from authorize and the signal.

Not changed: #3083's timeout field, #4678's model/usage task lifetime.

Tests (testdata/signinend, no network; the vendor is testenv.FakeVendor):
TestCancelledSignInSavesNothing, TestCancelledSignInEndsThePluginsWait,
TestCancelledSignInEndsItsFetch, TestSignInFailsWithThePluginsReason
(internal/plugin), TestCancelledPluginSignInSavesNothing
(internal/provider, through StartPluginSignIn/CancelSignIn).

Run on mote (macOS 27), at this change on d73f2254d (the new tests and vet of both packages again after the rebase on 897e88d7e, which touches neither):
- go test -count=1 -timeout 45m ./internal/plugin/ ./internal/provider/:
  ok (134s, 145s); the new tests -v: all PASS.
- ./internal/cli ok; ./internal/gui FAIL only in
  TestMainWindowCorners/macOS_26_SDK, #3949 (macOS 27 on mote; this
  change touches no GUI code).
- GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: ok;
  gofmt -l: nothing.
- GUI (Chromium + WebKit): plugin-signin, plugin-signin-no-url,
  plugin-signin-opened (en, zh, zh-TW, ja, de), plugin-signin-scrolls,
  plugin-keyless-signin, plugin-moved-signin, signin-paste-plugin,
  signin-close, i18n-keys: 108/108.

Red on the old code (origin/main's host.js, host.go, providers.go): all
four plugin tests (an account saved after Cancel; the plugin's wait and
its fetch not ended, timed out; methods 2/3/4 said "s.a.callback is not
a function"), and TestCancelledPluginSignInSavesNothing.
Broken by hand: host.go's `cancellable` back to gatewayRequest only, all
three cancel tests red; the whileSigningIn line out of the fetch wrapper,
TestCancelledSignInEndsItsFetch red.

Not tried: the real AStudio and Agnes Code plugins (plugins#658) against
this host; the site's plugin guide isn't deployed by this commit.
2026-11-03 13:40:20 +08:00
897e88d7e6 gateway: most's timer looks again no sooner than a second while an upload earns (#4775)
Cause: with wuuli's upload credit, a request's charged time stands
still while its body earns at least as fast as it is read. When little
was left, checkMost re-armed most's timer at that sliver, and again
every time it fired, for as long as the body kept coming. In the #4775
review, a hold frozen 100µs short of unroutedMost was looked at 6731
times in a second.

Change: checkMost waits at least unroutedRecheck (1s, or an eighth of
unroutedMost when a test shortens it) before it looks again. A hold is
answered at most that much late. Masking, the 30s unknown-work guard,
the 60s socket idle deadline, the decoded cap and the trickle's 408
are unchanged.

Test: TestUnroutedMostRecheckIsNoSpin freezes a hold's charged time a
sliver short of unroutedMost and counts the timer's looks in a second.
It allows 30.

Run, via mote-run (macOS arm64, Go 1.26.8), at this tree before the
rebase (base affa979d5):
- gofmt -l: clean. go vet ./...; GOOS=linux go vet -tags nogui ./...;
  GOOS=windows go vet ./...: all exit 0.
- go test -tags nogui -race -count=5 of the ten upload and body tests
  (the patches' four, this series' five, TrickledBodyAnswered408): ok
  (102.5s).
- go test -tags nogui -timeout 45m ./internal/gateway/...: one red
  (771.9s), TestCodexPoolSaysTheClientsVersion. That is #4807 (another
  test's Codex identity reaching it), fixed on main by 17f2387e1, which
  this tree's base predated.
- After the rebase onto f3335dd1b (which brings 17f2387e1), at
  698362aaf (this tree, before this message was amended):
  go test -tags nogui -timeout 45m ./internal/gateway/...: ok (775.7s).
- go test -run TestUnrouted at each of the three commits: ok.

Broken by hand, each with its test (this series and the patches):
- Reset(left) without the floor: NoSpin went red (6731 looks).
- origin/main's unrouted.go with only the two names the tests need:
  wuuli's TestUnroutedProgressingUploadOutlastsMost went red with 408
  at 1s (identity, chunked, gzip, zstd), and so did
  TestUnroutedUploadTimeIsBounded (5 of 6 cases). Leng's
  TestUnroutedUploadAllowanceHasCeiling charged 11m against 3m.
  TestUnroutedUploadCreditKeepsIdleDeadline passed, as a guard that
  holds on main too should.

Not tried: a real slow link or proxy, the reporter's own conversation,
and running on Linux or Windows (vet only).

Thanks to wuuli (Xulin Wu) and lengjingxu (Leng on X, who reported it
again) for the patches this series builds on.

Co-authored-by: Xulin Wu <wuxulin@bytedance.com>
Co-authored-by: Leng <Lengjingxu@gmail.com>
2026-11-03 13:36:52 +08:00
b4e3885477 gateway: earned upload time banks nothing, and a body that decodes to nothing still ends (#4775)
Review tests for wuuli's and Leng's upload credit, guarding the two
ways an earned allowance could hold a request too long.

Banking: a body sent at once earns far more than it took to read
(2 MiB earns 64s at 32 KiB/s). TestUnroutedFastUploadBanksNothing
holds a request after such a body with a lock routing needs. It is
answered 504 at unroutedMost, and the credit buys the later internal
hold nothing (`d -= min(spent, earned)`).

Empty encoded streams: empty gzip members (a 60 KB extra field, no
content) or zstd skippable frames keep the wire busy, decode to
nothing, never reach the 512 MiB decoded cap, and earn upload time
forty times faster than they are read. TestUnroutedEmptyEncodedStreamIsBounded
sends one chunked over a raw conn through Front. It is answered 408 at
unroutedMost plus unroutedUploadGrace: the cap ends it, not the rate.
Go 1.26.8's gzip.Reader loops over members without recursion (read on
mote), so no stack grows with the member count.

unroutedUploadGrace becomes a var so the test can scale it, as
unroutedMost already is. Its value is unchanged (8m).

Run, via mote-run (macOS arm64, Go 1.26.8, -tags nogui):
- go test -run TestUnrouted ./internal/gateway/: ok at this stage.
- The full verification is in this series' last commit.

Broken by hand:
- `d -= earned`: FastUploadBanksNothing went red, unanswered at 20s.
- No clamp on bytes read: EmptyEncodedStreamIsBounded went red in
  gzip and zstd, unanswered at 30s, and Leng's
  TestUnroutedUploadAllowanceHasCeiling went red (1m and 11m charged).

Not tried: a real client sending such a stream, and a slow real link.

Co-authored-by: Xulin Wu <wuxulin@bytedance.com>
Co-authored-by: Leng <Lengjingxu@gmail.com>
2026-11-03 13:36:52 +08:00
yetone 639a15c507 gateway: a chunked body is still arriving between two reads until a read meets its end (#4775)
Cause: bodyArriving (#4511) counted a body as still arriving between
two reads only when the request said its Content-Length. A chunked
body, which every encoded upload from an agent can be, was judged by
the read alone. When most's timer fired between two of its reads, the
request was answered 504 "without routing it to any provider", as a
hold of magpie's own, though its body was still coming. A decoder
spends its time between reads too: in the #4775 review, a stream of
empty gzip members got the 504 in 2 of 10 runs.

Change: waitedBody records that a read met its end or an error
(bodyEnded). A chunked body counts as arriving between reads until
then. A body read whole, an empty one, and one not yet begun (the wait
for body room) still count as magpie's hold. Every watched route reads
the body through request_bounds' io.ReadAll, so a read reaches EOF or
an error.

Tests:
- TestUnroutedBodyArrivingBetweenReads now expects a chunked body to
  count as arriving between reads, and not once its end is read.
- TestUnroutedChunkedBodyReadWholeHeld504 (identity, gzip and zstd,
  sent chunked) guards the other side: a hold after the whole body has
  been read is still 504.

Run, via mote-run (macOS arm64, Go 1.26.8, -tags nogui):
- go test -run TestUnrouted ./internal/gateway/: ok. 24 tests at this
  stage on 07b6834fe (wuuli's and Leng's patches).
- The full verification is in this series' last commit.

Broken by hand:
- No bodyEnded store: ChunkedBodyReadWholeHeld504 went red in all three
  encodings, answering 408 "its body was still arriving".
- The old `d <= 0` condition: BodyArrivingBetweenReads went red, with
  "a chunked body between two reads ... did not count as arriving".

Not tried: a real slow link or proxy, and the reporter's conversation.
2026-11-03 13:36:52 +08:00
Leng 19d04425c8 gateway: cap earned upload time before duration arithmetic
Bound upload credit to eight additional minutes so progressing compressed streams cannot keep pre-routing requests alive indefinitely. Clamp wire bytes before multiplication to avoid duration overflow. Keep the progressing-upload fix by Xulin Wu in its original authored commit.
2026-11-03 13:36:52 +08:00
Xulin Wu df69ffe979 gateway: let progressing uploads outlast the routing hold (#4775)
Latest main 9d08993c already classifies an unfinished body as 408, but
still ends a large upload at the two-minute unrouted budget. Credit
actual body-read time at one second per 32 KiB received on the wire,
never more than the time spent reading. Fast uploads cannot bank time
for later internal holds. The idle deadline, unknown-work budget, body
room and size cap remain; a trickle still exhausts the base allowance.
The 408 suggests checking the link/proxy or compacting before retrying.

Red: TestUnroutedProgressingUploadOutlastsMost failed on unchanged main
with HTTP 408 at the scaled 1s hold. Restoring main's budget calculation
via Go overlay with final tests makes all four TLS upload cases fail
with 408 and TestUnroutedUploadTimeIsBounded fail its numeric assertions.
Green: declared/chunked/gzip/zstd TLS tests through Front, idle protection,
rate boundaries and existing unrouted/request-body tests pass (28.267s).
Same selection -race -count=20 passes (547.523s).

Verified on macOS arm64, Go 1.26.8, Bun 1.4.3, temp HOME and pinned Go
caches. gofmt -l and git diff --check clean; native/Linux nogui/Windows
vet and builds pass. Final go test -tags nogui -timeout 45m ./... passes:
87 packages (32 cached), 18 without tests, wall 1152.1s; gateway 734.881s,
plugin 122.229s, claudebridge 3.813s. Individual skips not enumerated.

First full suite had 85 passing packages, gateway 743.006s, and two reds.
The known Bun SOCKS assertion (#2207) is fixed by the preceding unchanged
skygunner patch acb2249e (original a93c613a); its -race -count=20 and all
three vets pass locally. A callback helper timeout is filed as #4782:
its isolated -race -count=20 passes (3.586s) and final suite passes, but
the delayed stage is unresolved, not claimed fixed. Existing macOS C
compiler deprecation/enum warnings remain.

No live gateway, account, or original conversation used. No GUI assets
changed; Playwright not run. Linux/Windows were cross-built/vetted, not
runtime-tested. The original network throughput cause remains unknown.
2026-11-03 13:36:52 +08:00
yetone 0872bc2a0e context: a request's text and reply from the request archive (wangbinyq)
wangbinyq on Discord: with the request archive on, clicking a block of
the context window card still said "只保留最近 10 个请求的原文", since the
card read only the last 10 bodies magpie keeps in memory.

What changed:
- /api/context/text tries memory first, then the request archive's copy
  when the route names one (Route.Archive, the route found in the trace
  or in the history file of the card's ?day=, HistoryRoute looks a day
  either side). gateway.ArchivedPromptText parses it as PromptText does
  and masks it through maskedCopy, as the body in memory is; it is
  marked from "archive" and the card says so.
- New /api/context/reply: the reply to the request, from the Recent
  calls (Server.ReplyBody) or the archive's Response. gateway.ReplyPieces
  reads it into thinking/assistant/call pieces (conversationOutput, split
  out of conversationTurn) after redact.ScrubJSON, and masks every piece
  through maskedCopy. The card's text view has a Reply button beside
  Close that shows it and goes back to the part.
- What is shown is what the archive stores, masked as the memory copy
  would be, nothing more. A body or reply that can't be masked shows
  nothing (404 "unread"); one the archive cut short isn't parsed ("cut");
  one it names and doesn't have says so ("missing"), and one with no
  archive copy keeps the old "only the last 10" line ("off"). A failed
  bucket read is an error, not "gone".
- The archive read is capped at archiveReadMost and the last copy read is
  kept 5 minutes, so the items opened one by one read it once.
- ctxtext.js takes the route (id and time) instead of the id; context.js
  passes it (its one-line change paid for by a comment cut, core budget
  not raised). New strings in zh, zh-TW, ja and de.
- docs/subsystems/gateway-routing.md (Prompt) and gui-shell.md.

Run on f3335dd1b (main has since d73f2254d, textcalls_anthropic.go and
its test only, none of these files), on mote (macOS 27):
- go test -run 'TestArchivedPromptText|TestReplyPieces|TestPromptText|
  TestConversation|TestContext|TestCoreScriptBudget' ./internal/gateway
  ./internal/gui: ok.
- Whole ./internal/gui and ./internal/gateway (before the last rebase,
  same change): ok except TestMainWindowCorners/macOS_26_SDK (#3949) and
  TestCodexPoolSaysTheClientsVersion (#4807, fixed on main by 17f2387e1
  since).
- GOOS=linux go vet -tags nogui and GOOS=windows go vet of both: ok;
  gofmt -l clean.
- GUI, both engines, every language, 1100 and 420 wide: every file that
  reaches the context card (context-text, context-map, context-window,
  context-map-live, context-scroll-end, context-scripts, context-tune,
  ctx-route, compact-one-value, routing-ctx-*, routing-context-fold,
  routing-live-patch, routing-return-cost) plus i18n-keys: 514 of 518.
  The 4 reds are context-map's webkit 420px "two tiles overlap", red the
  same on origin/main f3335dd1b run alone (5 of 10 webkit there), #3488.
- The whole GUI suite is running on the Linux box (wsl-run) as this is
  pushed; mote had another session's full suite on it.

Broken by hand (each went red):
- maskReplyPieces skipped: TestReplyPiecesAreMasked (phone unmasked).
- ArchivedPromptText's masking skipped: TestArchivedPromptTextIsMasked
  and TestContextTextFromTheArchive (phone in the 200 body).
- ctxtext.js's "missing" reason dropped: context-text.test.cjs, 10 of 10
  chromium.

Not tried: a real archived request in the running app, the bucket
(WebDAV) archive with a real server, and a reply cut short by the
archive's size in a real call.
2026-11-03 13:34:35 +08:00
yetone d73f2254d7 gateway: a relayed reply Anthropic reviewed for auto mode makes no call out of its text
xybio on Discord (#feedback): Claude Code through magpie (127.0.0.1:3425)
shows "We're changing auto mode to no longer charge for classifier
requests ... this session isn't eligible because your requests go through
127.0.0.1:3425". Anthropic's llm-gateway-protocol page asks a gateway to
forward request headers and body fields unchanged (safeguards among them)
and to return replies without dropping keys like safeguard_results or
rewriting tool-use ids.

Audit of the Anthropic-to-Anthropic path (passthrough, forwardOnce):
- Request: anthropic-beta and anthropic-version always go; safeguards and
  the dangerous-tool-use beta go as sent to a reviewed route
  (serverReview/AutoModeReviewed) and are taken off for any other model.
  No body field is dropped there.
- Reply: safeguard_results already pass, whole and streamed
  (TestAutoModeServerSideReviewRelayed). tool_use ids go as they came;
  toolUseIDs salts one only when the client already holds it (#4910),
  which Anthropic's unique ids never are.
- The one rewrite found: anthropicTextCalls (39bade71d, two days old)
  reads Claude's <invoke name=…> markup out of a relayed reply's text and
  makes it a tool_use with an id magpie invents (call_text_N), stop_reason
  tool_use. On a reviewed reply that call has an id Anthropic never
  judged, so Claude Code can match it to no verdict.

Fix (textcalls_anthropic.go): a stream whose message_delta carries
safeguard_results, or a whole reply that carries them, has no call read
out of its text; the text goes as text, stop_reason and results as they
came. Without results the written call is still made, so
packinggoodsllc_07668's case (a Claude group writing invokes) is kept.
docs/subsystems/gateway-routing.md says so.

Not changed, said here: masking (redact.MaskJSON, opt-in) masks values
inside safeguards.classifier_context (paths, user_identity) like any other
string the user sends; ids (tool_use_ids, *_id) are kept. Only
Content-Type and request ids are copied from a successful reply's
headers, so anthropic-ratelimit-unified-* don't reach Claude Code. The
wiring leaves the review on whenever a reviewed model is reachable
(claudeReviewEnv), so a session on a non-Claude model, or on a relay that
drops safeguard_results, still gets the notice; which route xybio uses is
not known.

Run (mote-run):
- TestAutoModeReviewedReplyMakesNoCall red with the stream check taken
  out (names [Bash], stop tool_use) and with the whole check taken out
  (call_text_1 tool_use), green with both.
- At e3f7d3194 (rebased on 2c214ce25): gofmt -l clean; GOOS=linux and
  GOOS=windows go vet ./internal/gateway ok; go test -count=1 -timeout
  45m ./internal/gateway: every test passed but
  TestCodexPoolSaysTheClientsVersion (734.7s), which is #4807.
- Rebased onto origin/main f3335dd1b, which fixes #4807 (17f2387e1) and
  changes thinking_bound.go: at the pushed head fe5d30d7c's tree, vet for
  linux and windows ok, and -run "TestAutoMode|TestInvokeReported|
  TestTextWritten|TestTextCall|TestClaudeBridgeSafeguard|TestCodexPool|
  Thinking|TestSafeguards|Passthrough" ok (36.6s). The full package was
  not rerun there.

Not tried: a real Claude Code auto-mode session through magpie and its
/status "Auto mode server" row; no real Anthropic reply carrying both
safeguard_results and written invoke text was seen.
2026-11-03 13:23:49 +08:00
yetone f3335dd1b4 gateway: DeepSeek's thinking is left out of a request to Claude (GgbondHi6930 on X)
GgbondHi6930 on X: a Smart group of DeepSeek and a Claude API key. A
conversation ran on DeepSeek at max effort; with DeepSeek unticked its
next turn went to Claude and failed "signature in thinking". A new
conversation worked.

Cause: DeepSeek's Anthropic endpoint signs each thinking block with its
reply's id, a UUID (checked against api.deepseek.com/anthropic). The
agent keeps those blocks and sends them back, so the first Claude turn
carries them, and Claude refuses the request, 400 "messages.1.content.0:
Invalid `signature` in `thinking` block" (real reply through
OpenRouter's Anthropic route, req_011CgfP4zyRcUhPiTg5sLpoe). Until now
magpie mended this only after the refusal, in forward's bound-thinking
retry. That needs the refusal to reach forward as a 400/422 with
Claude's wording, and it spends a request. With fakes that answer as
Claude does, main recovers through it, on Messages (whole and streamed)
and on Codex's Responses. So the reporter's failure is where that retry
can't read the refusal. A relay's status or wording is the likely case;
it is not reproduced exactly.

Change: forwardOnce, which every route to an Anthropic upstream passes
(relayed, translated Chat/Responses, group fallback and Smart routing,
a plugin's fetch, count_tokens), now calls withoutForeignThinking. For
an upstream serving Claude (api.anthropic.com, or a claude- model name)
and not DeepSeek, it leaves out each thinking block whose signature is a
UUID. Those blocks never reach Claude, and refuseBoundThinking reads a
refusal's indices against that same body. These go byte for byte:
- Claude's own signatures (base64; 3,000 of Claude Code's own were
  checked, all base64 and 800+ characters);
- unsigned blocks (Claude took one in a real request);
- redacted_thinking;
- other vendors' signatures, which the retry still mends.
DeepSeek's endpoint and every other upstream get the body unchanged.

Tests (thinking_switch_test.go):
- TestDeepSeekThinkingThenClaude: the reporter's case, whole and
  streamed. 3 DeepSeek tool turns, then DeepSeek unticked and 3 Claude
  turns. Claude refuses nothing and gets its own blocks back as signed.
  With DeepSeek ticked again and Claude unticked, DeepSeek is sent every
  block, its own and Claude's.
- TestDeepSeekThinkingThenClaudeResponses: the same through Codex's
  /v1/responses.
- TestWithoutForeignThinking: Claude, DeepSeek and Kimi upstreams.

Run on mote (mote-run):
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./...: clean, at cfa9a6987 (base 17d2ef10f).
- go test -timeout 45m ./internal/gateway/... ./internal/provider/...
  at cfa9a6987: provider ok. Gateway ok except
  TestCodexPoolSaysTheClientsVersion, which is #4807 (passes alone 3/3;
  commented there). It was fixed on main by 17f2387e1, which this commit
  is rebased onto.
- After the rebase onto 17f2387e1, which touched none of these files'
  code: -run 'Thinking|Bound|TestCodexPoolSaysTheClientsVersion' ok.

Broken by hand: with withoutForeignThinking returning the body as it
came, all three tests go red ("Claude refused 1 of its 4 requests",
"Claude refused 1 of its 3 requests", "message 1 = [thinking,text]").

Not tried:
- a real Claude account through magpie; no Anthropic key was usable
  here, and the relay accounts found (aihubmix, yylx) are out of credit;
- the reporter's own relay;
- Chat Completions clients, which carry no signatures;
- Kimi, GLM and MiniMax signatures, which the refusal path still mends.
2026-11-03 13:16:35 +08:00
yetone 2c214ce252 agents: Air's row says which of Air's own agents go through magpie (jumy_18634)
jumy_18634 on Discord picked a model on the Air (JetBrains IDEs) row and
found Air's Codex in IDEA 2026.3 still on another model. The model on an
Air row is the Magpie ACP agent's alone, and the row never said so.

What Air's own agents run, read from the jars (air-plugin
262.8665.521, Air app 262.1037.14):
- The IDE plugin's Codex runs this computer's codex (the terminal's
  PATH, else the @openai/codex it installs) as `codex app-server` with
  the user's CODEX_HOME or ~/.codex, and sets no model_provider
  (CodexAppServerProcessKt, CodexCliUtils). Its menu is model/list, its
  default config/read's model, and a task's model goes in thread/start.
  Its Claude Agent runs claude with only Air's hooks in --settings.
  So both are on magpie while Codex / Claude Code are connected here.
- The Air app's Codex runs with a CODEX_HOME of its own and JetBrains'
  gateway ([model_providers.air-gateway]), and never is.

Changed: an Air row, opened, says to pick Magpie in Air's agent menu and
that the model there is Magpie's. The IDE plugin's row says whether
Codex and Claude Code are connected here, and so whether Air's Codex and
Claude Agent go through magpie; the app's says its own agents don't
(airSaid in app.js, words in zh, zh-TW, ja, de). air.go's comment and
docs/subsystems/agent-wiring.md say what the jars showed, in place of
"not tried in an IDE". Six Agents-page comments in app.js are cut to one
line each to keep the core under its budget, no raise.

Run at the pushed head, on mote:
- Codex 0.166.0 `codex -c check_for_update_on_startup=false app-server`,
  as Air starts it, in a sandbox HOME with a magpie-style config.toml
  (model_catalog_json, model_provider magpie on a fake gateway at
  127.0.0.1:3599): model/list gave the catalog's two models, config/read
  the config's model; after config.toml changed under the running
  server, config/read gave the new model; a thread/start with model
  kimi/kimi-k3 (as Air's CodexThreadStartParams sends it) and a turn
  sent /v1/responses with model kimi/kimi-k3 to the gateway.
- GUI: agent-air-own.test.cjs (new), chromium and webkit, en zh zh-TW ja
  de, 1100 and 640px: 20 of 20.
  The 166 GUI files that reach the Agents page or i18n, both engines:
  red only in page-width-steady, found-skill-pick-remove, mobile-web and
  remote-magpie, which fail the same way alone on origin/main affa979d5
  (#5013), and nav-timeout, which fails at the old base and passes after
  the rebase.
- go test -tags nogui ./internal/agent -run 'Air|Notice', ./internal/gui
  -run 'Budget|I18n|Air|Notice': ok. GOOS=linux and GOOS=windows go vet
  -tags nogui ./internal/agent ./internal/gui: ok. gofmt -l: clean.

Broken by hand: without the Air branch in connectPanel,
agent-air-own.test.cjs is red, 10 of 10 in chromium.

Not tried: Air itself (no JetBrains IDE on this Mac or mote); a real
Codex or Claude Code connected through Air; Air on Windows or in WSL.
Air's bundled codex isn't among the running copies the Codex row names
as on an old list.
2026-11-03 13:02:15 +08:00
yetone 3d7b1233dd claudetui: /usage's screen is read at the terminal's own 200 by 50 on macOS and Linux (#4988, shinnqy on X)
shinnqy on X: in the latest magpie Claude Code's usage doesn't load.
#4988 (0.1.2776, macOS, Team plan): the card said 100% / unused, and
`magpie quota refresh claude` gave one window, "7 days · Fable" 0%, while
the account's 5 hours were 29% and 7 days 17% used.

Cause: 3a74cd92e reads /usage's panel off a terminal grid (screen.go) and
prefers that look of it over the stream. screenSize() made the grid 80 by
24 everywhere but Windows, saying "a pty here is given no size", but
child_unix.go makes the pseudo-terminal 200 by 50. Claude Code draws the
panel at the foot of its 50 rows; on the 80 by 24 grid every row under the
24th was clamped onto the 24th and drawn over it, so the kept look of the
panel held one window (the last drawn), or a figure redrawn in place was
lost to the stream's older one.

Fix: one screenCols/screenRows (200 by 50) for the Unix pseudo-terminal,
Windows' pseudo console and the grid. Windows is unchanged.

Test: TestShimReadsUsageBelowTheTwentyFourthRow, a 200 by 50 panel with
three windows drawn as 2.1.316 draws (ESC[H, CR + ESC[nB, ESC[55G), then a
frame that redraws only the session's figure (29% -> 30%). fakeFrames now
splits frames at a 50-row foot (ESC[50;1H) as well as ESC[24;1H.

Run at this head (mote): gofmt -l internal/claudetui clean; go vet
./internal/claudetui with GOOS darwin, linux, windows ok; go test
./internal/claudetui ok; go test -run 'Claude|Usage|TUI' ./internal/gateway
./internal/provider ok. xiaomi-gpu (win-run): -run
'TestShimReadsUsage|TestGrid|TestShimWaits' ./internal/claudetui ok.

Broken by hand: the new test on origin/main's tui.go (80 by 24 grid) is
red, telling "Current session: 29% used" for the redrawn 30%; green with
the fix.

Not tried: a real Claude Code panel with figures at 200 by 50 on macOS
(no real-account run in a sandbox; the fixture is synthetic, in 2.1.316's
encoding). The report's "messages can't be sent" half is not explained by
this: nothing here touches the request path, and no log came with it.
2026-11-03 12:51:31 +08:00
yetone affa979d56 gateway: Codex's one account used up goes on to the Codex subscription's fallbacks
adorable_piglet on Discord: once the ChatGPT (Plus) account's quota ran
out, the Codex app couldn't send at all, and magpie never moved the turn
to the fallback they had set (their own API key, another provider).

Cause: with one ChatGPT account and nothing to route, a turn on Codex's
own sign-in is relayed as it came (codexUpstreamOn). The relay handed an
overload on to the subscription's fallbacks (codexFallBack), but a
quota, credit or rate refusal went to Codex as the backend said it, the
429 usage_limit_reached with its x-codex headers. Codex then stops.

Change: codexAccountOut names the refusals that are the account's, not
the request's: failure() quota, credit or rate, as a status or as a
stream's failure before any reply (response.failed, an error event, a
stream without Content-Type), and a 403 usage_not_included. Never a 401:
Codex renews its own sign-in on it. When the subscription has fallbacks
(codexFallsBack, never a compaction), such a refusal now goes on to them
once the credits retry and the automatic reset have been looked at, as
an overload does; the trace keeps the try's real failure kind. With no
fallback set, Codex still gets the backend's refusal.

What Codex's own client does: it greys Send from its own /wham usage
read. magpie already gets past that once the usage reading says used up
(codex.out with the app-server restart, #540, 9f641daea); this change is
the turn itself.

docs/subsystems/gateway-routing.md says it.

Run (mote, at this tree):
- go test -tags nogui ./internal/gateway -run 'TestCodexOneAccount|TestCodexOwnModel|TestCodexSpent': ok.
- New TestCodexOneAccountSpentFallsBack: all 7 codexSpent shapes red on
  the old code (Codex got the 429/403 or the failed stream), green now.
  TestCodexOneAccountSpentNoFallbackRelayed and
  TestCodexOneAccountSignInRefusedNotFallenBack hold the no-fallback and
  401 cases.
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok. gofmt clean.
- The whole internal/gateway package (-timeout 45m) was still running at
  push; the result is reported separately.

Broken by hand: codexAccountOut returning false: the 7 subtests red again.

Not tried: a real used-up ChatGPT account in the real Codex app.
2026-11-03 12:41:12 +08:00
yetone 17d2ef10fa claude: a conversation's instructions stay after Claude Code's prompt in every interactive run
m4rs0n on Discord: since #2432 (eb8b840dd) a Claude subscription
conversation in the interactive mode broke the prompt cache as it grew.
The same body sent again read 100% from the cache, but the same body plus
an assistant "ok" and a new user turn read only 1,273 of 8,565 tokens and
wrote 7,290. A tool loop read a constant 1,273 every call (opus 1,273,
sonnet 1,197, haiku 2,000: Claude Code's own system prompt).

Cause: eb8b840dd gave a one-off ask (no tools, no reply) its caller's
instructions with --append-system-prompt-file, after Claude Code's own
prompt, and lets that run go after its reply. Every other run (with tools,
with a reply, a resumed or replayed session) kept them in the first pasted
message. So the conversation's next request started a run whose system
block ended at Claude Code's prompt and whose first message held the
instructions. The cached prefix broke right after Claude Code's prompt,
and the rest was written again. A tool loop's runs did the same: a pasted
first message loses magpie's mark (the paste is one text). The bisect
v0.1.2676..v0.1.2677 has only 541102eba (the onboarding mark), which
doesn't touch the request. Before it, those runs were -p, which keeps the
marks.

Change:
- appendsPrompt no longer requires no tools and no reply. Every
  interactive run that isn't lean and has no client cache marks appends
  the instructions. -p keeps them in the first message, where its mark
  holds.
- A run that resumes a session (shelved, branched, branchAt, or a
  replaySession transcript) is given the file again when the session's run
  had it (savedSession.appended). Sessions keep no system prompt, and every
  run key holds the system prompt, so the file is the one the session's
  run had. Appended runs can now be shelved and branched, which they
  couldn't before.
- replaySession leaves the instructions out of the transcript's user line
  when they are appended.
- docs/subsystems/claude-subscription-bridge.md says so.

Tests:
- TestClaudeTUIConversationKeepsItsInstructionsWhereTheFirstAskHadThem is
  the reporter's sequence: A, then A + "ok" + "Now say two words." Both
  runs are given the same append file, which starts with the rules. No
  run is typed them, and no session file holds them.
- TestClaudeTUIResumedSessionIsGivenItsInstructions: a shelved session is
  resumed with its append file.
- TestClaudeAppendInTheInteractiveMode replaces
  TestClaudeAppendOnlyForInteractiveOneOffs. Tools and reply append in
  the interactive mode; client marks and -p don't.
- TestClaudeTUIReplayGoesInATranscript now expects the rules out of the
  transcript's user line and the append flag on the run.

Run at the pushed head, on mote:
- go test ./internal/gateway -run 'Claude|TUI|Subscription|Replay|Branch|Lean|Append|Shelve|Resume': ok.
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok.
- gofmt -l: clean.
- The full internal/gateway package was red once, before the replay test
  was updated, with the failing test cut off by a tail. A rerun with the
  whole log is under way. Its result goes in the report and, if red, in an
  issue.

Broken by hand: the new tests on origin/main's code fail.
- TestClaudeAppendInTheInteractiveMode/tools and /reply fail.
- The conversation test fails ("given ... and <none> after Claude Code's
  system prompt, want the same instructions").
- The resumed test fails.
- With only the savedSession.appended carry removed, the resumed test
  fails ("<none> ... want A's instructions").

Not tried:
- A real Claude account. The sandbox recipe needs a live login's OAuth
  token copied out, and rotated tokens written back, which this session's
  rules forbid. The prefix claim rests on Claude Code 2.1.316 marking the
  end of its system block itself (recorded 2026-11-03 for #2432), not on a
  new real request.
- Windows and WSL runs of the interactive mode.

Sibling paths:
- Streaming and non-streaming both start runs through startRun.
- count_tokens doesn't write the cache.
- An API-key Claude request is passed through with the client's own
  marks, outside this bridge.
2026-11-03 12:40:21 +08:00
yetone 6b81344301 library: the keep-here switch says sync, and is on while it syncs (bin.90)
bin.90 on Discord read the Library editor's 「只在这台电脑」 switch as a
LAN-sharing switch: "this computer only" says nothing about what it keeps
from where. It is about sync, so it now says so.

- Library editor (MCP servers, skills): the switch is "Sync to your other
  computers" (同步到其他电脑 / 同步到其他電腦 / ほかのコンピュータと同期 /
  Mit deinen anderen Computern synchronisieren), on while the server or
  skill syncs. Its note says off keeps it here, and a sync from the
  others neither removes it nor replaces it.
- The stored value keeps its meaning: `local` true is still kept here.
  The switch shows !local and saves !on, so every saved library.json,
  sync payload and CLI flag (`magpie library mcp local NAME on|off`)
  means what it meant.
- Row tag: "Not synced" (不同步 / 同步しない / Nicht synchronisiert) where
  it said "This computer only", in the Library, the TUI ("not synced ·")
  and `magpie library` output.
- Agents page sibling (the same words for an agent's picks): its menu
  item is "Don't sync picks to your other computers", its tag "Not
  synced". The agentsHere setting is unchanged.
- docs/subsystems/library.md and sync-backup.md name the new labels.

app.js stays in its budget: origin/main 8af751987 was already 31 bytes
over coreScriptBudget (1,533,833 > 1,533,802), so a comment in
setAgentHidden was cut to one line (core 1,533,756 now), no raise.

Run on mote, rebased on 8af751987, budget again at 2cfeda3d3:
- GUI: mcp-local-server, agent-here, i18n-keys, skill-off-here: 78/78
  before the rebase, in Chromium and WebKit, every language, at 390, 640
  and 1100 wide and in the panel; after it agent-here, i18n-keys and
  mcp-local-server 56/56, agent-here again 30/30 after the trim.
- go test ./internal/tui ./internal/cli ok; ./internal/gui ok except
  TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949, open,
  the same without this change); TestCoreScriptBudget ok after the trim.
- go vet ./internal/tui ./internal/cli ./internal/gui; GOOS=linux go vet
  -tags nogui and GOOS=windows go vet of tui and cli; gofmt -l clean.

Broken by hand: saving `d.local = on` (no negation) turns
mcp-local-server red (expected 'false', got 'true').

Not tried: a real sync between two computers with the switch flipped;
the stored value's meaning is checked through the saved request only.
2026-11-03 12:21:49 +08:00
yetone 1d8658abca routing: a group's model picker offers the providers' image models, and a group of them draws (jzw690 on X)
jzw690 on X: the Routing page's group editor ("Add a model") listed no
image models, so a group of image models, to draw at
/v1/images/generations and to pick in Settings > Images, couldn't be
made.

What changed:
- /api/groups gains `drawers`: each provider's image models
  (gateway.Drawers, less ones unticked in its editor unless a group
  names them), apart from the chat `models`. The picker offers them
  after the chat models, noted "<provider> · Image model" (an existing,
  translated key); a member row says so and offers no reasoning level.
  Decision-model groups don't offer them. Image models stay out of the
  chat catalog, so agents are not offered them.
- An image member drew only when its provider had no picks: picks are
  of chat models, so membersFound dropped it as unpicked, and GroupDraws,
  resolveDrawing, the group's turns and DrawerMissing all failed.
  provider.FindDrawingGroup keeps such a member when drawsModel holds;
  the image path uses it (drawingMembers), video keeps FindGroup.
  DrawerMissing for a group ref asks GroupDraws.
- Routing card: such a member reads ready (groupsState), and Settings >
  Images lists every group that draws, not only those reached through
  Served.
- docs/subsystems/gateway-routing.md says so.

Tests:
- TestImageGroupOfUnpickedImageModelsDraws (gateway), from the
  reporter's case: two key providers whose live lists hold gpt-5.5 and
  gpt-image-2, one with gpt-5.5 picked. group/<id> draws at
  /v1/images/generations (the first member's 502 moves on to the next),
  as the Settings pick a request naming no model draws, and the model
  gone from the list makes it missing.
- TestGroupEditorOffersImageModels (gui): drawers listed, an unticked
  one not offered unless a group names it, none among chat models, the
  group's members ready, Settings offers the group.
- group-pick-drawers.test.cjs: the picker offers it with its note, adds
  it, no reasoning button, Save posts it; en and zh, Chromium and
  WebKit.

Broken by hand: drawingMembers passing nil instead of drawsModel made
the gateway test red ("group/pix-images doesn't draw"); turning off the
groups.go drawer branch made the gui test red ("group not ready").

Run at b295d1196 plus this change (mote unless said):
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.
- go test -count=1 -timeout 45m ./internal/provider ./internal/gateway
  ./internal/gui: provider ok. Two reds, neither on this path:
  TestCodexPoolSaysTheClientsVersion (full run only, passes alone 3/3;
  #4807) and TestMainWindowCorners (red on origin/main f49f6ba68 too,
  macOS 27; #3949). Both commented.
- GUI on the Linux VM (Playwright 1.62.0, both engines), 62 files:
  group-*, routing-group*, settings-groups, fallback-group,
  agent-model-groups, image*/images*, panel-routing*, routing-manual,
  routing-levels, i18n-keys. 698/710. i18n-keys was red on a comment of
  this change saying ", with an image" (reworded; 4/4 after). The
  WebKit reds under concurrency 4 passed on a serial run except
  group-member-info webkit zh, red 2/2 on origin/main f49f6ba68 too
  (#1745, commented).

Rebased on origin/main 809801f1f (its 8 commits change client.js and
gateway-routing.md), then again on mote: gofmt clean, go test -run
of the budgets, TestImageGroup*, TestDrawing*, TestGroupMember* and
TestGroupEditorOffersImageModels in gateway, gui and provider: ok; on
the Linux VM, both engines, group-pick-drawers, group-pick-filter,
group-decide-members, group-editor-fits, group-member-off,
routing-levels, settings-groups, image-models-hide, i18n-keys: 96/96.
Rebased last onto 03d7927a8 (search strings, i18n.js values only;
none of this change's files), not run again.

Not tried: a real provider's image model drawn through a group in the
running app; Windows and the real Linux app (WebKitGTK).
2026-11-03 11:57:11 +08:00
yetone 84da86ebd5 gui: Hide accounts is one switch for every page, window and the panel (paultian)
paultian on Discord (#feedback): Routing, Usage and Providers each kept
their own "Hide accounts" state, so turning it on in one page left the
others showing emails. Now window.hideAccounts is one switch, one
localStorage value (magpie.maskEmails), behind #rtMask, #usageMask and
#pvMask alike. Flipping it in any page applies to every page at once,
and a storage event carries it to other windows and the tray panel.
The old magpie.maskProviders value is folded in on first load (hidden
if either value was on) and then removed, so nobody who hid accounts
on one page sees them shown after updating. The tooltip and the
Settings line now say "on every page" instead of "on this page", in
every language.

Tests: provider-mask.test.cjs checks that one switch hides accounts on
every page and in a second window, that the state survives a reload,
and that an old maskProviders=1 comes through as hidden.
account-mask's expected tooltip text is updated.

Run on mote (GUI files at base 05aba5ca4; the Go asset/budget tests again
at this head after rebasing on a92cc3f33):
- go test -run 'Budget|I18n|Asset|Script|Strings|Lang' ./internal/gui: ok
- The masking/privacy GUI files at --test-concurrency=2, chromium and
  webkit, every language (account-mask-alias-plan, account-eye,
  window-mask, usage-fold, masking-demo-unblurred, account-alias,
  provider-mask, account-eye-provider, account-mask,
  privacy-hides-accounts, account-mask-sessions, mask-emails,
  plugin-name-unmasked, i18n-keys, masking-records): 403 of 408 pass.
  The 5 reds:
  - provider-mask "chromium en 420" (a click timed out). Rerun with
    usage-fold at concurrency 1: provider-mask is all green, and that
    run is 146 of 150.
  - usage-fold, 4 subtests: "17 subscriptions and 29 accounts" in
    chromium and webkit, and "several accounts" in webkit en and zh.
    They fail the same 4 at origin/main 625938a2f at concurrency 1
    (6 of 10 pass). That is #3415 / #4790, not this change.
- Not touched: Go code, so no go vet.

Broken by hand: with the old assets, provider-mask's one-switch tests
go red; with the maskProviders migration taken out, the
old-value-comes-through test goes red.

Not tried: the whole GUI suite (the owner's rule is to ship each
verified fix right away), and the real tray panel on Windows/Linux
following a switch flipped in the main window. Only the browser
storage event is tested.
2026-11-03 11:32:47 +08:00
yetone a92cc3f331 agent: Antigravity's effort is picked in its row, as its app can't say one (#4838)
MDX-Tom (#4838): Antigravity's app lists the gateway's models by id, with
no level control of its own, so a request for one of Antigravity's
families of levels (gemini-3.8-flash -> -high/-low) went at the level the
app asked or the family's default, and nothing in magpie could change it.
Their plugins PR #655 forced a level in middleware, over any level the
request carried and on every model named like gemini/flash, for every
agent. This puts it in core instead, as Cursor Private Inference has
since #1003: Antigravity's agent row gets an effort field, kept in
magpie (provider.AgentEffort "antigravity"), whose levels are those of
the models it lists (cursorLocalEfforts is now pickedEfforts(agent)).
The gateway already asks an agent's requests for its picked level; on an
Antigravity account that picks the family's variant (AntigravitySentID)
and its thinkingLevel. With none picked the requests go as they asked.
The field is shown only while the app is on magpie's gateway, and
nothing is written to the app's settings.json.

Run on mote at the pushed head (on a858e53fa): gofmt -l clean;
GOOS=linux (nogui) and GOOS=windows go vet of internal/agent and
internal/gateway ok; -run TestAntigravity|TestCursorLocal|TestClaudeDesktop
in internal/agent ok; -run TestAntigravity|TestAgentEffort|TestCodeAssist|
TestCursorLocal in internal/gateway ok. On b295d1196: go test
./internal/agent ok (196s). Before the rebase on 443e53d6b: internal/agent,
internal/provider ok; internal/gateway red only on
TestCodexPoolSaysTheClientsVersion (#4807, passes alone 3/3);
internal/gui red only on TestMainWindowCorners/macOS_26_SDK (#3949, red
on untouched 443e53d6b the same way on mote).

Broken by hand: without the field, TestAntigravityEffort is red ("no
effort field"); with the gateway's agentPick taken out,
TestAntigravityAgentEffort is red (both picks went as -high at "").

Not tried: a real Antigravity account and the real app's picker; the
agy CLI row has no such field (its own /model can say a level). No GUI
suite run: the field renders through the agent row's generic effort
field (cursor-local-effort.test.cjs), no new API call or layout.
2026-11-03 11:27:31 +08:00
yetone a858e53fa9 gateway: Copilot's "unsupported beta header(s)" is read as a refused beta
bigcat1800 on Discord: with Claude Desktop's tool search on (the commit
before), Claude Code in its Code tab asks tool search by
tool-search-tool-2025-10-19. Copilot's Messages API turns that name away:
400 "Copilot: unsupported beta header(s): tool-search-tool-2025-10-19",
which reached Claude Code, since refuseBetas read only Bedrock's
"Unexpected value(s) `x` for the `anthropic-beta` header". It now reads
Copilot's wording too: the request is asked again at once without the
betas named, and they are left out for that provider from then on, as
Bedrock's are. Any provider wording it the same way gets the same.

Through the live gateway, Copilot's claude-haiku-5.5 answered the same
request (a ToolSearch tool and a defer_loading MCP tool) with no beta and
with advanced-tool-use-2025-11-20, and refused tool-search-tool-2025-10-19.
A Claude subscription took both names.

Run at the pushed head, on mote: TestCopilotUnsupportedBetasLeftOut,
TestUserBetas*, TestBedrockBetas, TestSignInBetaStaysWithMagpie and
TestAutoModeReviewGoesWithItsBeta ok; go test ./internal/gateway
(-timeout 45m) ok but TestCodexPoolSaysTheClientsVersion, the full-run
red filed as #4807 (another test's Codex identity; nothing about betas);
linux and windows vet, gofmt clean.
At the pushed head, rebased on 625938a2f (search.go, handover.go moved):
linux and windows vet of gateway and agent ok, go test -run
'Beta|Bedrock|ClaudeDesktop|Search' of both ok, which covers the Desktop
commit before this one too.
Broken by hand: with the Copilot match turned off,
TestCopilotUnsupportedBetasLeftOut is red (status 400 "Relay: unsupported
beta header(s): tool-search-tool-2025-10-19, effort-2025-11-24").

Not tried: Copilot's raw error body (the fixture words it as magpie's log
shows it, without the "Copilot: " magpie adds; two betas are assumed
comma-separated), and a rebuilt magpie against real Copilot.
2026-11-03 11:25:42 +08:00
yetone 80d0cc1a66 claude-desktop: magpie's profile turns on Desktop's tool search
bigcat1800 on Discord: Claude Desktop 4.4212 in 3p mode (Code tab,
bundled Claude Code 2.1.309) on magpie, 13 MCP servers, and no MCP tool
was deferred: ~162K tokens of tool schemas on every request, though
ENABLE_TOOL_SEARCH=true was in the CLI's environment.

Cause, read from Desktop 2.7032's app.asar (Ztr, $tr, pnr) and Claude
Code 2.1.312/2.1.316 (oae, Wvn, Yar): with Desktop's 3p policy
toolSearchEnabled unset (the default, and magpie never wrote it), the
gateway provider's tool-search mode is "off", and Desktop starts the CLI
with CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. The CLI then answers
"standard" (no tool search) whatever ENABLE_TOOL_SEARCH says; only an
admin-tier ENABLE_TOOL_SEARCH=force beats it. The model id shape
(magpie-<n>.anthropic.claude-opus-5-5[1m] or plain claude-opus-5-5)
plays no part. With toolSearchEnabled on, Desktop passes
ENABLE_TOOL_SEARCH=force as a managed setting ("host" mode, bundled CLI
2.1.247 and later) or turns the betas back on ("legacy").

magpie's profile now gets toolSearchEnabled: true once, on a switch on
and from Sync (so a Desktop already on magpie gets it at magpie's next
start), as claudeAiImport is: desktopSeedImport and the new
desktopSeedToolSearch share desktopSeedOnce. A value the user set, false
too, or took away in Desktop's window since, stays theirs (stash mark
claude-desktop.tool-search). A profile the user applied themselves for
magpie's gateway is not written. The gateway already carries deferred
tools and tool_reference to every upstream (#2660, anthropic_shapes.go).

Run:
- CLI 2.1.312 in a sandbox HOME against a recording fake (port 3591),
  60 MCP tools, model magpie-1.anthropic.claude-opus-5-5[1m]:
  DISABLE_EXPERIMENTAL_BETAS=1 (+ ENABLE_TOOL_SEARCH=true): 83 tools,
  0 deferred, 205KB. Same plus --managed-settings
  {"env":{"ENABLE_TOOL_SEARCH":"force"}} (Desktop's host mode): 13
  tools, ToolSearch, beta tool-search-tool-2025-10-19, 56KB. Plain
  claude-opus-5-5 behaves the same in each mode.
- At the pushed head, on mote: gofmt -l internal/agent empty; GOOS=linux
  (nogui) and GOOS=windows go vet ./internal/agent ok; go test
  ./internal/agent and its importers (backup cli davsync gui library
  profile stats tui uninstall) ok but internal/gui's
  TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 red filed as
  #3949 (AppKit corners, nothing this touches).
- Broken by hand: the seed returning nil turns
  TestClaudeDesktopTurnsOnToolSearch red ("switch on: toolSearchEnabled
  <nil>"); the once-mark ignored turns it red ("seeded again over the
  user's choice").

- The same CLI in Desktop's host mode through the live gateway, in a
  sandbox HOME: a Claude subscription model and a GPT routing group each
  ran ToolSearch, loaded the deferred tool and called it. A Copilot
  Claude model got 400 "unsupported beta header(s):
  tool-search-tool-2025-10-19"; the next commit reads that refusal.

Not tried: a real Claude Desktop 4.4212 or its bundled CLI 2.1.309 (the
CLI was 2.1.312, Desktop's code read from 2.7032), a real request
through magpie in host mode to a Claude subscription or a translated
upstream with the tool-search-tool-2025-10-19 beta, and the reporter's
note that magpie's recorded shape had no anthropic-beta (the CLI sends
claude-code-20250219, interleaved-thinking and effort betas even in off
mode).
2026-11-03 11:24:14 +08:00
yetone 625938a2f8 search: a picked searcher that can't serve gives way to the next that can (plugins#635)
pedestrianz (magpie-community/plugins#635) set Codex's gpt-6.1-sol to
search for Cursor's models. When the Codex plan was used up (429, usage
limit), every web search of a Cursor turn failed with it: a searcher named
in Settings gave way only to the ones named after it (SearcherThen), never
to the searchers magpie would pick itself. That rule is Gearclickist's:
Grok, picked, answered without searching, and the search moved to a
pricier Codex model the user hadn't picked.

Now a named searcher that can't serve at all hands the search on, after
those named after it, to the searchers magpie would pick in turn
(searchInTurn: the ones not spent first, up to two more providers). Can't
serve means every account or key is out of its allowance (searcherSpent),
or the search was refused for quota, credit or rate (failure() in
searchWith). Both are marked errCantServe, through a cantServe wrapper,
without changing the error's text. A named searcher that is spent is no
longer asked first; it is asked last only if no one else could search.
One that answered without searching or found nothing still gives way to
no other, so Gearclickist's case is unchanged. The Routing row and
Settings' SearcherFailed name who searched in its place
(searchingInstead, namedFailed). If none can, the errors go back to the
model as a failed tool result ("... no other provider could search in its
place") and the turn goes on to the model's answer. The AI Studio keys
443e53d6b added to searchRank are among those asked.

pickedSearchSetup's failing searcher answered 400 "search quota used up",
which is now a quota refusal that hands on. Its body is now "invalid
tools: web_search", a refusal of the request, so
TestPickedSearcherIsNotHandedOn still covers the not-handed-on case.
docs/subsystems/gateway-routing.md says when a named searcher is handed
on.

Run on mote (macOS 27), at this commit's tree, rebased on origin/main
443e53d6b (the AI Studio search keys):
- go test -count=1 -timeout 45m ./internal/gateway ./internal/agent
  ./internal/browsermcp ./internal/cli ./internal/davsync ./internal/gui
  ./internal/imagemcp ./internal/library ./internal/settingsapi
  ./internal/tui (gateway and its importers): all ok except two reds,
  both filed and not in search. TestCodexPoolSaysTheClientsVersion
  (#4807) is red in the full package run and passes alone at this tree
  (-count=3, with the search tests). TestMainWindowCorners/macOS_26_SDK
  (#3949) is red the same way at origin/main b295d1196.
- Rebased onto b295d1196 (route-events, the WorkBuddy min, #4938; none
  touches search): go vet and go test -run
  'Search|Searcher|Picked|RouteEvents|Trace' ./internal/gateway: ok.
- gofmt -l internal/gateway: clean. GOOS=linux go vet -tags nogui and
  GOOS=windows go vet ./internal/gateway: ok.
- TestPickedSearcherThatCantServeGivesWay (new; httptest fakes, no
  network): the named ds answers ChatGPT's 429 usage_limit_reached; ds2,
  named nowhere, searches; the model gets its "22/17℃"; SearcherFailed
  says ds2 searched in ds's place, and ds2's web_search row has
  For.Instead ds/deepseek-flash. A second search, with ds now resting,
  doesn't ask ds's vendor again and goes to ds2. With ds2 removed, the
  turn still ends 200, and the model is told "search failed" with the
  usage-limit reason.

Broken by hand:
- origin/main's search.go with the new tests: the new test is red ("the
  picked searcher asked 1 times, ds2 []"); TestPickedSearcherIsNotHandedOn,
  TestSearchInPlaceOfAutoSaysWhy and TestPickedSearchersInTheirOrder
  still pass.
- With searchWith's cantServe wrapping taken out: red the same way.

Not tried: a real Codex account that is used up, with Cursor's plugin
models searching through it. Grok, Claude or Gemini as the searcher in
its place were not tried with real accounts; the fake stands in for each.
2026-11-03 11:23:37 +08:00
yetone b295d11965 serve, update: one magpie works the gateway; the service waits, the copy an update left stops (#4938)
ox01024's #4938, Bug 2. Two magpies did the gateway's work at once on a
Mac:

- launchd's com.yetone.magpie.serve ran `magpie serve` beside the app.
  It ran startUp (plugin Settle/Refresh, FoldCopies, Hold, the agent
  moves), the plugin host and every account's model fetch, then failed
  to bind, exited 1 and was started again 5s later: 6,035 times in two
  days, a 279MB serve.log, and logins.json.lock held against the app's
  requests until they went 504.
- The copy an update left (.magpie-update/old) handed the socket over,
  hid, and lived on ~3h, its loops writing beside the new one.

What changed:

- cli: `magpie serve` (no --web) checks codexrelay.Leave,
  gateway.ServedBy and gateway.Taken before startUp, as the app's
  serveGatewayLocked does. While the port is held it prints one line
  and looks again every 15s, doing nothing else. Once the port is free
  it serves (serve_wait.go). It waits rather than exiting 0: under
  KeepAlive SuccessfulExit:false a clean exit would leave no service
  after the app quits.
- gui: after a handover the old magpie's loops end with backendCtx:
  - library.KeepLinked (now takes a ctx),
  - provider.WatchQuotas,
  - the menu bar usage loop,
  - the updater's check/auto-restart loop.
  lighten lets its hidden webviews go as lightweight mode does, so
  their polls stop. quitBy exits it at handedOffDrain + 3m whatever
  holds its quit up (gateway.HandedOffDrain getter; exitNow stubbable).
- docs/subsystems/gui-shell.md says both.

Run at the pushed head on mote (mote-run):
- gofmt -l internal/: nothing. go vet ./internal/{cli,gui,library,gateway};
  GOOS=linux go vet -tags nogui and GOOS=windows go vet of the same: ok.
- go test -count=1 -timeout 45m ./internal/cli ./internal/library
  ./internal/gui ./internal/gateway at bf05291e2 + this: cli and
  library ok. Two reds, both already filed:
  - gui TestMainWindowCorners/macOS_26_SDK (#3949). It is red the same
    on origin/main 443e53d6b, run alone.
  - gateway TestCodexPoolSaysTheClientsVersion (#4807). It is red only
    in the full package run, and passes alone 5 of 5 at this head.
- After rebasing on 8819beeb0, on that head: the vets above; cli and
  library in full, ok; gui and gateway with -run for handover, handoff
  and lightweight, ok.
- Sandbox HOME on mote, a fake app answering / as magpie 0.1.2770 on a
  private port (3593), `magpie serve` built from this tree beside it:
  alive after 8s at 0% CPU, nothing written under HOME, one standby
  line. 20s after the fake quit it served the port. The same with the
  old wait call removed: "magpie: listen tcp 127.0.0.1:3593: bind:
  address already in use", exit, and plugins.yml and lock files written
  first.

Broken by hand, each red:
- No wait before startUp: TestServeWaitsForTheGatewayBeforeStartingUp
  ("ran the start-up moves while another magpie served the gateway").
- KeepLinked ignoring its ctx: TestKeepLinkedEndsWithItsContext
  ("went on after its context ended").
- No quitBy in handover.run: TestRestartHandsTheGatewayOver ("has no
  deadline to quit by").

Not tried:
- A real launchd service beside the real app, and a real update
  handover on a Mac. Neither was run: no live app or launchd.
- The lighten change (needs Wails webviews) has no test.
- Not done here: serve.log rotation, `magpie daemon install` beside a
  running app (#4887), the old copy's appPage port, and Bug 1 and
  Bug 3 (ggbdpq has Bug 1).

cdredfox on Discord reports ~270% CPU after v0.1.2770. That fits this,
but it is not confirmed as their cause.
2026-11-03 11:16:02 +08:00
yetoneandJunyu Zhou 8819beeb0e gateway: a display reads routing as it happens at /v1/magpie/route-events (#3387)
joe21_eee (sywyyhykkk on GitHub) wrote this for an ESP32 screen that
shows each agent's requests live: started, each try, the first content,
fallback, done. Ported from their route-events branch (42e1fa43f) with
the changes below.

What a display gets (route_events.go):
- GET /v1/magpie/route-events/snapshot: cursor, active, routes (every
  request the trace has that is still going).
- GET /v1/magpie/route-events?after=<cursor> (or Last-Event-ID): SSE,
  one "route" event a change, id = cursor, from a 512-change ring under
  trace.mu, so a short request is told step by step. 409
  snapshot_required for a cursor not this process's or too old, "event:
  reset" for a reader that fell behind, a heartbeat every 15s, a 10s
  write deadline.
- A route is routeActivity, an allow list: trace id (base 36), time,
  agent label, the provider of the seat the last try went to (never the
  seat id, which names an account or a key fingerprint), model, attempt,
  fallback, phase, status, failed, ms, ttft_ms. No session, account,
  key, folder, prompt, reply or error text.
- firstToken.onFirst tells the first content as it comes (serve and the
  ChatGPT backend's reads), written to an unexported Try.firstMs so the
  full trace's TTFT is unchanged.

Changed from the branch:
- No new key type. The branch added an "sk-magpie-route-" key, its CLI
  flag and its own Authenticate path through access, identifyCaller and
  corsGuard. main has read-only keys now (readOnlyGuard), and the feed
  is answered as /v1/magpie/usage is: this computer, and another machine
  with an enabled key while shared; a held key is refused (refuseHeld).
  Both GETs are in readOnlyRoutes, so the display gets
  `magpie gateway-key add Screen --read-only`. A full key already reads
  more than this (every call's usage). access, cli, cors.go and lan.go
  are untouched.
- A route the trace drops unfinished (drop: an unrouted request's
  stand-in once its own route begins; trim past twice traceKeep) is told
  request_dropped and marked offFeed. The branch kept its own active map
  that only "done" cleared, so a stand-in stayed going forever. The
  snapshot is read from t.routes, no second map.
- A stream ends when the gateway stops serving (Server.streamsEnding,
  closed first thing in ListenAndServe's drain). Before, an open stream
  held srv.Shutdown for its whole drain, 15 minutes on a handover.
- Revocation is access.On(KeyID) (identifyCaller swaps the secret out
  before handlers see it), asked at most once a second when there are
  changes and at every heartbeat, and remoteKeyed for a remote reader. A
  rotated key keeps its id, so its open stream goes on until it
  reconnects (said in the docs).

Docs: gateway-routing.md "Route events for a display" and the
read-only key's route list; reference.md beside the usage API.

Run at the pushed head on mote (Go 1.26.8):
- At daaafeb6e (rebased on ffc4aa684): gofmt -l internal/gateway empty;
  GOOS=linux go vet -tags nogui and GOOS=windows go vet of
  ./internal/gateway ./internal/access ok; go test -race -run
  'TestRouteEvents|TestReadOnlyKeyEveryRoute' ./internal/gateway ok.
- At daaafeb6e, every package that imports the gateway: internal/agent,
  browsermcp, cli, davsync, imagemcp, library, settingsapi, tui,
  access and the root package ok. internal/gui: one red,
  TestMainWindowCorners/macOS_26_SDK, which is #3949 (mote runs macOS
  27; this change touches no GUI code).
- Before the rebase (eb779ce92 base; gateway and access are the same
  at ffc4aa684): go build ./..., go vet, and the whole internal/gateway
  package, -timeout 45m. All ok except TestCodexPoolSaysTheClientsVersion,
  which is #4807 (red in a full package run on mote, passes alone; it
  passes alone at origin/main bf05291e2 too).
- At the pushed head (rebased on 443e53d6b, which changed search.go):
  gofmt, go vet ./internal/gateway and the -race run above again, ok.
- Not run: go test ./... in full. Other sessions' suites had mote at
  load 60 to 120.

Broken by hand (each on mote, then restored), the test that went red:
- serve's onFirst line removed: TestRouteEventsLiveFallback.
- drop's request_dropped removed: TestRouteEventsDroppedRouteGoes.
- the offFeed check removed: TestRouteEventsDroppedRouteGoes.
- the streamsEnding case removed: TestRouteEventsEndWithTheGateway.
- refuseHeld skipped: TestRouteEventsTold.
- the access.On recheck skipped: TestRouteEventsReplayAndRevocation.
- the snapshot taken out of readOnlyRoutes: TestRouteEventsTold,
  ReplayAndRevocation, LiveFallback.
- the seat's id told for its provider: TestRouteEventsReplayAndRevocation.
- the handler's own local/sharedWith gate removed: still green, since
  lanGuard refuses another machine first when not shared. It stays, as
  usage's does.

Not tried: an ESP32 or any real display, a real gateway with real
agents (tests drive httptest servers and fake upstreams), a handover
between two real magpie processes.

Co-authored-by: Junyu Zhou <feijifeibudao@gmail.com>
2026-11-03 11:06:59 +08:00
yetone 443e53d6b2 search: an AI Studio key that searches by googleSearch searches for other providers' models
cocoasoda on Discord: a Gemini AI Studio key provider searches natively
(googleSearch grounding, geminiKeySearches), but it never showed in the
search-for-other-providers (代搜索) list. searchRank knew only a Google
sign-in (googleAccount) at rank 5, so namedSearcherRank gave such a key
-1 and Searchers() left it out; autoSearcher never chose it.

searchRank now gives geminiKeySearches(p) rank 5 too: a saved key
provider, not a plugin, not Vertex, whose Gemini searches itself. That is
the same rank and the same googleSearch route as a Google sign-in, and
Searchers() marks it Own (it searches by its own tool, not a relay or a
search key).

Run on mote (macOS 27), at the rebased head e76db5515's tree:
- go test -count=1 ./internal/gateway -run
  'AIStudio|GeminiKey|Searcher|WebSearch': ok; ./internal/gui -run
  'Budget|Script|Search': ok; gofmt -l: clean.
- GUI: searcher-pick, searcher-then, search-instead, search-order,
  provider-search (chromium + webkit): 84/84.
- Before the rebase, at eb779ce92 + this: GOOS=linux and GOOS=windows
  go vet -tags nogui ./internal/gateway ./internal/gui: ok.
- TestAIStudioKeySearchesForOthers: a fake AI Studio endpoint
  (httptest, no network) answers the googleSearch call; the test checks
  rank 5, Own, the small model gemini-2.5-flash, autoSearcher's pick,
  and that another provider's model's web search goes there once, with
  tools [{"googleSearch":{}}] and x-goog-api-key.

Broken by hand: the new case taken out of searchRank, the test is red
("rank -1, by hand only false").

Not tried: a real AI Studio key; the whole ./internal/gateway and
./internal/gui packages at this head (a run at the old base is still
going).
2026-11-03 10:57:36 +08:00
yetone ffc4aa6844 providers: an Antigravity pool's meters and a family's set their own caps
pluviophile714 on Discord: an Antigravity (Google AI Pro) account row's
"上限 90%" pill says 每个窗口可单独设上限:点击下方它的用量条, and a click on
its "剩余 97.8% · 7d" meter did nothing. The class: a meter is a cap
button only when its window has a capId. Two kinds of meter never had one:

- A pool's own windows (Gemini · 5 hours / · 7 days, Claude & GPT · …),
  set Aside for routing, got no Capped/CapID from WithCapped, and
  routing's allowanceOf skipped them, so a cap there could not hold.
  Now WithCapped marks a pool window that has members capped (CapsSome),
  with CapID = its LineName ("gemini · 7 days", as both pools have a
  "7 days"). allowanceOf hangs each pool window on its members' own
  windows (Limit.pool), and CapHeld and NearCap count them through
  capLimits, so a cap on it holds that pool's models only. Routing's
  used-up and For still read the models' own windows, as before.
- A family's meter (windowCapMeter skipped `tiers`): several models'
  windows shown as one (Gemini 3.1 Pro High/Low, a pool read without its
  summary). It now posts every tier's capId in a new `windows` field;
  provider.SetWindowCaps sets them in one save (SetWindowCap, the CLI's,
  is it with one).

Changed for users: an account cap (the reporter's 90%) now also counts
an Antigravity pool's 5h and 7d windows, as the pill already says it
does ("each usage window"). Other Aside windows (on-demand spending,
Ollama's bought credits, MCP · Month) and windows past the first two
(tooltip only) stay unsettable: routing doesn't hold on them.

app.js shrinks 305 bytes (comments trimmed); no budget raised.

Run on mote (macOS 27), at the rebased head a2c1e8df1's tree:
- go test ./internal/gui -run 'Budget|Script', ./internal/provider -run
  'Cap|Pool|Allowance': ok. GUI: window-cap-pool (new), window-cap,
  quota-pools, quota-families, i18n-keys, chromium + webkit: 112/112.
- Before the rebase, at eb779ce92 + this: go test -count=1 -timeout 45m
  ./internal/provider ./internal/cli ok; ./internal/gui red only in
  TestMainWindowCorners (#3949, macOS 27); ./internal/gateway red in
  TestCodexPoolSaysTheClientsVersion (#4807) and
  TestUnroutedBodyRoomWaitNot408's TempDir cleanup (filed #4989); both
  pass alone, -count=5. GOOS=linux and GOOS=windows go vet -tags nogui
  of provider, gui, gateway, cli: ok. gofmt -l: clean.
- window-cap-pool.test.cjs: chromium + webkit, 420 and 1100 wide, en,
  zh, zh-TW, ja, de: 40/40; window-cap 60/60.

Broken by hand:
- capLimits without the pool windows: TestPoolWindowCapHeld red ("the
  Gemini week at 60% of 50%: <nil>").
- Old app.js: window-cap-pool's 20 family cases red. Its pool cases pass
  on the old JS once a capId is sent; the Go test is what's red for the
  pool on the old code.

Not tried: a real Antigravity Google AI Pro account (the fixture is the
quota-pools tests' shape with the reporter's 2.2% used); the whole GUI
suite (running after the push).
2026-11-03 10:51:52 +08:00
yetone c28220a5e7 sessions: a Codex thread saved on another provider resumes from Sessions
mrten_95615 on Discord: opening a Codex session from Sessions ran
`codex resume <id>` and Codex 0.166 stopped at "This chat uses custom,
but your current provider is magpie. Switch to custom to continue."
(modelProviderMismatch). Codex 0.166's app-server resumes a thread only
on the provider it was saved with (its state-database row, else its
session_meta), checked against the one config.toml (with -c) selects
(codex-rs app-server config_manager.rs load_for_resume); no flag lets a
resume go on another provider, and a provider config.toml no longer has
fails as modelProviderNotConfigured. Codex 0.165 resumed it on its own
provider without asking.

sessions.ResumeNow is the line that runs when the user opens a session
(GUI Terminal, TUI enter); the listed line is unchanged and nothing more
is read on a listing. For a Codex thread saved on a provider other than
the one Codex is on:
- config.toml still has that provider's table, or it is a Codex
  built-in (openai, amazon-bedrock(-runtime), gcp, ollama, lmstudio):
  `codex resume -c model_provider=<it> <id>`. Codex runs that embedded
  (no shared daemon) on the thread's own provider.
- the provider is gone: MoveCodexProvider moves the thread to the
  provider Codex is on (files copied to magpie's trash first, the state
  row too) and it resumes there, the only way Codex resumes it at all. A
  thread written to in the last minute or open in a Codex is left
  (ErrActive) and the plain line runs.
A WSL distro's Codex session and every other agent are as listed.

Run at this head (mote):
- go test -count=1 -run 'TestCodexResume|TestMoveCodexProvider|TestCodexProviderIn' ./internal/sessions: ok
- go vet ./internal/{sessions,gui,tui}, GOOS=linux -tags nogui and GOOS=windows vet of them: ok; gofmt -l: clean
- At this head (rebased on origin/main bf05291e2): go test -count=1
  ./internal/sessions ./internal/tui: ok; ./internal/gui: ok but
  TestMainWindowCorners/macOS_26_SDK (#3949, mote is macOS 27; this
  change touches only gui/sessions.go's terminal route); go vet darwin,
  GOOS=linux -tags nogui, GOOS=windows of the three: ok; gofmt -l clean.
- Full suite before the rebase (go test -tags nogui -timeout 45m ./...
  on mote, at eb779ce92 + this change): 86 packages ok; internal/gateway
  red on TestCodexPoolSaysTheClientsVersion alone (#4807, open, a full
  package run's known red). Not re-run after the rebase.
Broken by hand: ResumeNow returning the listed line, TestCodexResumeOnItsProvider
fails "resume ... && codex resume 01a0bdc9-..., want ... codex resume -c
model_provider=custom 01a0bdc9-..."; with the move dropped it fails
"the thread's rollout wasn't moved to magpie".
Real Codex: codex-cli 0.166.0 (npm darwin-arm64) in a sandbox
CODEX_HOME with two fake Responses servers: a thread made on "custom",
config.toml switched to magpie. Plain `codex exec resume` failed with
the reporter's modelProviderMismatch; ResumeNow's line resumed it and the
turn reached custom's server. With custom's table removed, plain resume
failed with modelProviderNotConfigured; ResumeNow moved it and the turn
reached magpie's server. The TUI `codex resume -c model_provider=custom`
was also driven in tmux (resumed, turn on custom, "Running without the
shared background server" warning). Codex 0.165.0 resumes it plainly.
Not tried: a Codex profile that names its own model_provider (a -c
override may lose to it); the Codex desktop app's resume; Windows'
PowerShell line (same flag, not run there).
2026-11-03 10:50:30 +08:00
yetone eb779ce92a gui: the tray icon's tooltip is in magpie's language (yi_time)
yi_time in #feedback: magpie set to Chinese on Windows, and the tray
icon's hover tooltip said "Today: 121K tokens (2.9K in · 180 out ·
118K cached)" and "3 requests" in English. The tray menu already
followed magpie's language (trayLang, #301); the tooltip's words were
hard-coded English in trayusage.go.

Now every tooltip is in trayLang(settings.Lang, systemLang), on
Windows, macOS and Linux alike. That covers trayIdleTip, magpie's
totals (trayTotalCard), and each subscription card (trayCardText: its
use or what is left, the pace, when it resets, until's d/h/m, "as of
…"). The words are in trayWords beside the menu's, for zh, zh-TW, ja
and de; English stays the key and the fallback. A window's name and an
error are still the card's own. A change of language in Settings now
also refreshes the tooltip (onTrayUsage); before, only the menu was
relabelled. The test-only trayUsageText and trayUsageView stay in
English, so the existing tests keep their strings.

Test: TestTrayTooltipFollowsMagpiesLanguage.
- yi_time's own numbers in zh: "magpie\n今天:121K token(输入 2.9K ·
  输出 180 · 缓存 118K)\n3 个请求".
- The same numbers in en are unchanged.
- Covers the total card and a card's used, left, reset and as-of.
- For zh, zh-TW, ja and de, no English word in the idle, totals, card
  (with pace) or combined tooltips.

Run at this head (rebased on 5573f7923):
- mote: gofmt -l clean; CGO_ENABLED=0 GOOS=linux go vet -tags nogui
  and GOOS=windows go vet of ./internal/gui ok.
- mote: go test ./internal/gui. Everything passes except
  TestMainWindowCorners/macOS_26_SDK, which is #3949 (red on mote's
  macOS 27, not touched here).
- Windows (xiaomi-gpu, win-run): go test -run Tray ./internal/gui ok.

Broken by hand: with the tooltip words taken out of trayWords, the
test goes red. Its zh output is then exactly the old English tooltip.

Not tried:
- The real tray on Windows, hovering the icon.
- The watch loop's choice of language has no test of its own. Passing
  "en" there would not go red.
2026-11-03 10:14:23 +08:00
yetone 5573f79231 agent: an agent's own models say they go direct, and a pick of one asks before 接入 goes off (maxleebeta)
maxleebeta in #feedback: Pi 1.5.0 connected to magpie; picking one of
Pi's own OpenCode Go models (opencode-go/<model>) turned 「接入」 off at
once, with nothing said, while magpie's models kept it on.

The cause: the pick writes defaultProvider opencode-go, so Pi asks
OpenCode Go itself and magpie is no longer in its config, and Wired()
is rightly false. What was missing is that the model said so. Options
from ownProvider (every ownOptions agent: Pi, OpenCode, Crush, Goose,
Cline, Hermes, Morph, OpenChamber, Qoder, StepCode, plugged agents, the
WSL twins) and ompOwnOptions carried no Direct, unlike Claude Code's
and Codex's own models. So the picker neither tagged them "direct, not
via magpie" nor asked before a pick took the agent off magpie. Each
now carries Direct = its vendor's name. The GUI already does the rest
(pathTag, the leave-ask, direct options listed after magpie's).

Tests:
- internal/agent TestOwnModelsSayTheyGoDirect: Pi, OpenCode, Crush and
  omp, signed in to OpenCode Go, each give every opencode-go/ option
  Direct "OpenCode Go"; magpie's options have none. Picking one writes
  defaultProvider opencode-go.
- internal/gui/tests/agent-own-direct.test.cjs: the tags, magpie's
  first, the ask (Cancel keeps 接入 on, nothing written), magpie's other
  model not asked, confirmed → written and off. Run in chromium and
  webkit × en/zh/zh-TW/ja/de × 980/420.

Run at this head (rebased on 2c2d2a5e5, mote):
- gofmt -l clean
- CGO_ENABLED=0 GOOS=linux go vet -tags nogui and GOOS=windows go vet
  of ./internal/agent ./internal/gui: ok
- go test ./internal/agent (TestOwnModelsSayTheyGoDirect, Codex
  Own/Pi/Omp/Crush/OpenCode runs): ok
- GUI agent-own-direct, agent-leave-magpie, agent-own-path,
  agent-own-providers, claude-default-off, pi-default-note: 56/56
  pass, both engines

Before the rebase (base 4cd01c964), go test of ./internal/agent and its
importers (backup, cli, davsync, gui, library, profile, stats, tui,
uninstall): all ok except internal/gui's
TestMainWindowCorners/macOS_26_SDK, which is #3949 (red on mote's
macOS 27). This change doesn't touch it.

Broken by hand:
- Without Direct in agents.go/omp.go, the Go test goes red for all
  four agents.
- With `direct` stripped from the GUI fixture, the GUI test goes red.

Not tried: a real Pi 1.5.0 signed in to OpenCode Go.
2026-11-03 10:08:44 +08:00
yetone 12599e9cd0 signin: ChatGPT signs in by device code, the first way from another computer
curtinp118 on Discord runs magpie on a VPS and opens its web UI from home.
ChatGPT's browser sign-in comes back to localhost:1455, which is the
viewer's own computer. The page there won't load, and the box's main line
said "The account shows up here as soon as you're done", so the sign-in
looked broken. The fix until now was to copy the dead page's address back
by hand.

ChatGPT now also signs in by device code, as `codex login --device-auth`
does (codex-rs login/src/device_code_auth.rs). This is
startCodexDeviceSignIn, with StartSignInWith site "device":
- magpie asks auth.openai.com/api/accounts/deviceauth/usercode for a code
  with Codex's client id and headers;
- the box shows the code and https://auth.openai.com/codex/device;
- magpie polls deviceauth/token, where 403/404 means not entered yet, for
  up to 15 minutes;
- it then trades the authorization code at the token endpoint with the
  returned verifier and the /deviceauth/callback redirect.
Nothing listens on this computer.

The window starts this way when magpie web is opened from a host other
than localhost or loopback (remotePage in app.js). Either way, the box has
a link to the other way: "Sign in with a code instead" or "Sign in in the
browser instead". A device code that ChatGPT turns away (404) fails, and
that box links to the browser's way. Strings are in zh, zh-TW, ja and de.
providers-accounts.md describes the flow.

This went over TestCoreScriptBudget. It now fits with no raise
(1,533,700 of 1,533,802, on main's 1,533,789). The two way-switch
buttons share one helper (codexWay), and eight comments on the sign-in
code are cut down: openSignInPage, signingKept, startPluginSignIn, the
sign-in proxy, signInProxyChoices, Copilot's GHE.com, dropSigningIn and
renderStepPlan.

Run on mote (the pushed head is rebased on ae060550b):
- go test ./internal/provider: the new TestCodexSignInByDeviceCode,
  TestCodexDeviceSignInCanceled and TestCodexDeviceSignInOff, against a
  fake auth server that answers with the bytes auth.openai.com gave on
  11-03;
- go test -tags nogui ./internal/provider ./internal/backup (before the
  comment trim, which touched app.js only): ok; ./internal/gui
  ./internal/cli after it: ok;
- GUI at this head: signin-codex-device.test.cjs (new; Chromium and
  WebKit, en and zh, 420px wide), signin-paste-codex, signin-callback,
  signin-port-blocked, signin-paste-plugin, signin-paste-import, the
  sign-in proxy files and i18n-keys, 40 files: 591 pass, 0 fail;
- the whole GUI suite one commit earlier (base c86fa2a34; the rebase onto
  6a6e4fefa only brought in internal/sessions): two runs, each cut short
  when mote rebooted or by the owner's call not to wait. They got through
  1075 and 1395 cases, with 0 not ok;
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., the Linux nogui and Windows builds, and gofmt -l (base
  c86fa2a34).
Rebased on 4cd01c964 at last: go test -tags nogui ./internal/gui ok and
signin-codex-device, signin-paste-codex, signin-callback and i18n-keys
21 of 21. Before that, rebased on ae060550b with the comments cut: go test
-tags nogui ./internal/gui ok, ./internal/provider ok, and 40 sign-in,
proxy, i18n-keys and desktop-tiers GUI files: 594 pass, 1 fail. The red
was signin-proxy's chromium ja 380 proxy test. That file alone then
passed 3 runs, 120 of 120. It is #1814, open since 10-12 for this test
under load, and noted there. The step that failed wasn't kept.
The full go test ./... was not run, by the owner's rule.

On Linux (WSL magpie-desktop, sandbox HOME), magpie web listened on
0.0.0.0:3561 and was reached at the WSL IP. POST /api/signin
{"agent":"codex","site":"device"} got a real code from auth.openai.com
with url https://auth.openai.com/codex/device. The sign-in stayed waiting
across real polls for 12s, nothing listened on 1455, and cancel ended it.

Broken by hand:
- Taking the device branch out of begin() turned
  TestCodexSignInByDeviceCode and TestCodexDeviceSignInOff red.
- Taking the remotePage default out of startSignIn turned 8 of the 12
  signin-codex-device cases red.

Not tried:
- Entering the code with a real ChatGPT account, so a real token trade
  through the device callback hasn't been seen.
- Business/Enterprise workspaces that turn device codes off.

Also not changed: WorkBuddy's plugin sign-in already finishes by itself
from a remote browser (server-side poll; checked on the same WSL setup).
A backup still carries no sign-ins.

Reported by curtinp118 on Discord.
2026-11-03 09:54:05 +08:00
yetone ae060550b9 claude-desktop: a tier's pick runs with its tier's Claude prompt (behavesAs)
moer2831 on Discord: a model picked for one of Claude Desktop's tiers ran
in the Code tab on Claude Code's generic prompt, not the one of the
Claude model of that tier ("通用提示词和对应模型提示词差距挺大的,感觉直接
蠢了一个度"). Desktop 4.29 and later hand Claude Code behavesAs only from
a profile's inferenceModels (z3t in 4.4212's app.asar: modelPicker
options with each entry's behavesAs).

What changed:
- gateway.DesktopInferenceModels: while a model is picked for a tier,
  the list is every row /v1/models gives Desktop, by its id and in its
  order (a non-empty list replaces discovery, pzn), with supports1m,
  prefer1m and labelOverride as Desktop read them off the row, and a
  pick's anthropicFamilyTier/isFamilyDefault. A pick that isn't a Claude
  model gets behavesAs = its tier's newest Claude id (claude-opus-5-5,
  claude-sonnet-5-5, claude-haiku-5-5, claude-fable-5-1). Nothing picked
  (or a pick no longer listed): no list. Unreadable picks are unknown.
- agent: desktopSyncModels writes it into magpie's Desktop profile on a
  tier's Set, as Desktop comes on magpie and on Sync; temp+rename, only
  when it changed; taken away when nothing is picked. The list is
  magpie's only while its hash is one magpie recorded (stash mark
  claude-desktop.models); any other list (the user's) is never written
  over or removed.
- Claude Code's modelSettings gets the pick's own window even when it
  matches the default (claudeBudget.behaves), since behavesAs would
  otherwise give it the Claude model's.
- GUI: the tiers menu ends with one line, "Claude Desktop reads the
  tiers as it starts: restart it after a change." (en, zh, zh-TW, ja,
  de). The Agents row's Restart already lights from the profile hash.
- docs/subsystems/agent-wiring.md and gateway-routing.md.

Run on mote at this tree (base c86fa2a34): gofmt -l clean; GOOS=linux
(-tags nogui) and GOOS=windows go vet ./internal/agent ./internal/gateway;
go test -count=1 -timeout 45m ./internal/agent ./internal/gateway
./internal/gui ./internal/cli ./internal/tui ./internal/backup
./internal/davsync ./internal/library ./internal/profile ./internal/stats
./internal/uninstall: ok but internal/gateway's
TestCodexPoolSaysTheClientsVersion (passes alone here and at main; #4807)
and internal/gui's TestMainWindowCorners (red the same at origin/main
6a6e4fefa; #3949). GUI (chromium + webkit, every
language they cover): desktop-tiers, i18n-keys, and every file named for
tiers, picks, roles, Desktop, i18n or a language (887 tests,
871 pass; the 16 reds are 4 files red the same at origin/main 6a6e4fefa:
found-skill-pick-remove #4097, menu-input-scroll #3402,
phone-connect-menu #4706/#4707, provider-picks-stay #4397). Not the
whole GUI suite.

Rebased on origin/main a5c1fa4b4 (nothing there touches agent, gateway or
GUI assets but routing.css), then again at the pushed head: go vet
./internal/agent ./internal/gateway; the size budgets,
TestDesktopInferenceModels, TestClaudeDesktop*, TestClaudePlan;
desktop-tiers and i18n-keys in both engines: ok.

Broken by hand, each red: behavesAs left out (TestDesktopInferenceModels);
the window write's behaves check dropped (TestClaudePlan); the sync on a
tier's Set dropped (TestClaudeDesktopModelsList); the user-list guard
off (TestClaudeDesktopModelsList); the menu's line not shown
(desktop-tiers 0 of 4).

Not tried: a real Claude Desktop 4.29 or later (none on mote; this
Mac's is 2.7032 and live). Builds before 4.29 ignore behavesAs and take
the names. Desktop 1.x gets the mythos ids. A user's own gateway profile
applied in Desktop makes magpie's list do nothing.

Thanks moer2831 for the report.
2026-11-03 09:33:25 +08:00
yetone 7c115f6f5b provider: picks gone from a list for over an hour serve the list (maxleebeta)
maxleebeta on Discord: with WorkBuddy and WorkBuddy AI both signed in,
the Agents page's model picker had no WorkBuddy AI model, and its
Providers row read "已登录 · 1 个图像模型 · Free plan" where WorkBuddy's
read "1 个模型".

WorkBuddy AI's /v3/config (read 2026-11-03 with the owner's account) no
longer lists deepseek-v4.1-flash, its free model until now; hy3 is at
x0.00 instead. The China build still lists deepseek-v4.1-flash. A pick a
plugin's list stops listing goes to Delisted (8febe3a50), and a provider
whose every pick is there serves none of its models (waitsForPicks), for
as long as the list leaves them out. A Free plan account whose one pick
was deepseek-v4.1-flash was served nothing, for good. The row counts
chat models on, and with none it shows the plan's drawers from
/v3/config: "1 image model". The owner's own providers.json has the
same state: workbuddy-ai picks [gpt-6-astra], delisted
[deepseek-v4.1-flash].

Now Provider.DelistedAt keeps when the last pick still in Models left
(dropGonePicks sets it, a pick listed again clears it, Save keeps it
across other settings: delistedAtWith, accountSettings). waitsForPicks
holds only for pickWait (an hour) after it. Past that, or for picks set
aside before DelistedAt was kept (DelistedAt is zero), the list is
served as if none were picked. The picks still come back with a list
that has them. Our Free Model's restart, which the wait was for, lists
its channels again within minutes, and relistSoon asks again in 5.

The plugin is unchanged: its list is what WorkBuddy AI serves today.

New test: TestPicksGoneForGoodServeTheList (the real ids: before
deepseek-v4.1-flash, -sg, glm-5.3-flash; after hy3, -sg, glm-5.3-flash).
It checks: none is served at once; the list is served past pickWait,
with another setting saved on the way; the list is served for picks set
aside with no time kept; and the pick and nothing else is served once it
is listed again. Broken by hand:
- waitsForPicks back to its old body: the new test is red ("served []
  after pickWait").
- Save dropping DelistedAt: TestEveryPickDelistedServesNone is red
  ("served after another setting was saved: [pool-a]").

Run on mote on origin/main 6a6e4fefa plus this change: gofmt -l clean; go vet for GOOS=linux (nogui)
and windows of internal/provider and internal/gui; go test -timeout 45m
of internal/provider, internal/gui, internal/routes and
internal/gateway: provider and routes ok; gui red only in TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27 on mote); gateway red only in TestCodexPoolSaysTheClientsVersion (#4807).

Not tried: a real WorkBuddy AI Free plan account (we have none); the
owner's account's config was read, not changed. The full ./... suite
wasn't run: one was already running on mote.
2026-11-03 09:26:51 +08:00
yetone 6a6e4fefac sessions: WorkBuddy AI's own sessions are listed under its name (maxleebeta)
maxleebeta (Discord #general) is signed in to both WorkBuddy builds, the
China one and the international one, and the international one was
missing from an agent list. The provider side lists both: provider.All()
and CatalogFor have workbuddy/* and workbuddy-ai/* models under "WorkBuddy"
and "WorkBuddy AI". The sessions package, though, read only ~/.workbuddy.
WorkBuddy AI keeps the same files in ~/.workbuddy-ai (its product.json
dataFolderName, as internal/agent wires it), and nothing read them. So
WorkBuddy AI was missing from the Sessions page's agent picker, from
Usage > Sessions' agent strip, from the reading consent's folders and
from the usage ledger.

Changed:
- WorkBuddyAIDir and workbuddyAIFiles read ~/.workbuddy-ai/projects as
  agent workbuddy-ai with WorkBuddy's parser, in allFiles, Dirs,
  callSources (wholeCallReaders), Deletable and Found.
- buddyDir picks WorkBuddy AI's own models.json for the
  call-through-magpie skip.
- A ~/.workbuddy-ai that is a link to ~/.workbuddy is read once, as
  WorkBuddy's.
- skillsCounted names workbuddy-ai (WorkBuddy's parser counts no skills).
- docs/subsystems/gateway-sessions.md has a line for it.

Tests:
- TestWorkBuddyAI checks sessions, cwd, title, tokens, Deletable, Found,
  calls, the skip of magpie's gateway, and the link.
- TestWorkBuddyAIGatewayIsItsOwn: one model id that WorkBuddy's
  models.json gives to magpie and WorkBuddy AI's gives to the user's own
  provider.
- TestWorkBuddyAISessionsListedUnderTheirName checks /api/sessions,
  /api/sessions/manage and /api/sessions/stats: name "WorkBuddy AI",
  icon workbuddy-color, deletable.

Broken by hand (each went red): allFiles, parserFor, Deletable, Found,
the call sources, the wholeCallReaders entry, buddyDir.

Run on mote at this head (base origin/main c86fa2a34):
- gofmt -l and go vet for darwin, GOOS=linux and GOOS=windows -tags nogui
  (internal/sessions, internal/gui): clean.
- go test -tags nogui -timeout 45m over sessions and every package that
  imports it: ok for sessions (after the skillsCounted line), agent, cli,
  davsync, gui, otlp, tui, tune and usage.
- internal/gateway failed only TestCodexPoolSaysTheClientsVersion, which
  is #4807 (red in a full package run on mote, another test's Codex
  identity reaches it). Nothing here touches it.

Not tried:
- The reporter's screenshots, which we couldn't download, so their list
  may be another one.
- A real WorkBuddy AI install.
- The Agents page's detection of a newer, renamed WorkBuddy AI bundle
  (5.9.3).
- Windows.
- WORKBUDDY_CONFIG_DIR set: both apps then use that folder, and its
  sessions are listed as WorkBuddy's.
- No GUI JS changed (the page reads the agents from the API), so no
  Playwright files were run.
2026-11-03 08:54:40 +08:00
vincent c86fa2a341 gateway: a relayed citation without the offsets OpenAI's schema wants is dropped, the thread healed (#4921)
A thread a routing group served once on Volcengine Ark (or another
vendor whose Responses endpoint writes its url_citations with no
start_index/end_index) never worked on a codex member again: magpie
relayed the reply's annotations as they came, Codex stored them, and
the ChatGPT backend refused every later replay of the history whole —
"Missing required parameter: 'input[221].content[0].annotations[0].
start_index'" — five retries a turn, on any codex member, through any
upgrade (#4921, the reporter's routing log and rollout). This is
#2855's defect with a different field: what magpie hands a client must
be something magpie could send again.

Such an annotation goes, at both seams, as the reasoning-item fix did:

- a whole reply streamed as the vendor's own events (responsesWholeEvents)
  drops it in every place a client reads a citation: its annotation
  events, the content part, the item and the reply the client keeps
  (dropOffsetlessCitations);
- the history Codex replays loses it on its way to the ChatGPT backend
  (withoutOffsetlessCitations, the same leaving-out as a reasoning
  item's text, #1411): to the backend by its own sign-in and compaction
  relay (codexUpstreamOn), to it as a group member or an openai.com or
  Azure upstream (the provider loop, beside withoutReasoningText), and
  asked again without it where a relay in front of it names the
  parameter (refusesCitationOffsets), marked so it is never sent one
  again — a thread already poisoned heals on its next turn, no new
  thread needed.

The text, and a citation that carries its offsets, go as the vendor
wrote them; a turn with no "annotations" in it is not decoded
(anyInputItem scan, itemCitesWithoutOffsets; the undecoded-turn test
holds, allocations and all).

Run: the three new tests fail on the base with the reporter's exact
400 and pass here (ablation: the tidy call and the rewrite's body
neutralized, tests kept); TestCodexRewritesAsBefore,
TestCodexRewritesLeaveTurnUndecoded and the fuzz hold the rewrite to
its scan; the citation/whole/reasoning neighborhood ok (23s); gofmt,
go vet (linux, windows) and go build -tags nogui clean.

Review: this is skygunner's version of the fix (fcea11649), not
ggbdpq's 57dc7b420. ggbdpq's stripped citations only for a request
that wasn't for a magpie model, so the reporter's own path (a routing
group's codex member, the history passed through) kept the bad
annotation. ggbdpq's parity table and verification of the report
were used to check this one.

Changed in review: annotationLacksOffsets looks only at url_citation
and container_file_citation, the two types OpenAI's schema gives
start_index and end_index. file_citation and file_path carry a single
index, so the patch dropped every one of them as "offsetless".
TestCitationsWithOneIndexKept (added in review) holds both kinds and
checks that a history with only file_citations is sent byte for byte.

Broken by hand at the reviewed head: annotationLacksOffsets made to
return false, all four citation tests red; the type check removed,
TestCitationsWithOneIndexKept red. Restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.
2026-11-03 07:43:18 +08:00
ggbdpq 0561d53521 gateway: spawned Claude Code registers no claude-cli:// URL handler (#4928)
--setting-sources "" keeps the user's own disableDeepLinkRegistration
from loading, so every spawned claude registered the claude-cli:// OS
URL handler again and "Claude Code URL Handler.app" came back after the
user had deleted it. A headless run has no use for an OS URL handler:
the setting is now passed as flag settings (--settings is not one of
the sources --setting-sources controls) on the bridge run and the
warm-up and usage runs beside it, whatever the user's settings read.

Review: applied as ggbdpq posted it (patch sha256 checked against the
issue's). Checked in the Claude Code binary that flag settings read
disableDeepLinkRegistration === "disable" and that --setting-sources
"" doesn't filter --settings. `claude auth login` and `auth status`
take no --setting-sources, so the user's own settings already apply
there; they are not changed.

Broken by hand at the reviewed head: claude_warmup.go and
claude_subscription.go reverted to their parent,
TestClaudeSubscriptionPromptKeepsForeignHarnessOutOfSystem,
TestWarmClaudeAsksClaudeCodeOnce, TestClaudeUsageRunsClaudeCode,
TestAskClaudeTUIOn and TestClaudeUsageTUIOn red. Restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
ggbdpq a8d36b0faa fix(claude): a run let go after answering a prompt suggestion leaves its session for the conversation's next turn (#4914)
Claude Code asks its prompt suggestion after each turn as the
conversation and one message more, and its run goes on with it (#1638):
the run waits on from the suggestion's exchange, under a key the
conversation's own next turn never comes by, since the client leaves the
exchange out of its messages. While the run is kept, that turn finds it
by where it stood before and takes it back to there (resume). But a run
let go past idleMost was lost to its conversation: shelve kept its
session where the suggestion's exchange had left it, or, when the
conversation's own turn had already taken the run back from a suggestion
(-p), not at all — its session was marked taken back, which the file may
not say, and no session was kept. The next turn found no run and no
saved session, and a new Claude Code was told the whole conversation in
one message, a prefix the cache had never seen, written to the cache
again (a 50k conversation: 19k read and 29k written where 49k read and
50 written; the log said no run here had had a conversation one had).

The shelf now keeps a session where the conversation's next turn comes
by, too (savedSession.behind, run.behindKey), and unshelve takes it from
there when no session waits at the turn's own key. A session taken back
is kept once the run has answered a whole turn since (run.replied, set
as a turn ends, cleared at each take-back): the file's lines since are
that turn and what came after, and Claude Code's resume goes on from
them. And a run's end is kept under the boundary before its own
(run.convPrev), so the log of a turn that finds it gone says what became
of it when its last exchange was a side question.

Run: TestClaudeLetGoConversationAfterSuggestionResumesItsSession fails
on the parent a3768cdd1 with the product file alone reverted to it,
tests kept (the ablation: the shelf keeps no session for the
conversation's next turn), and passes on the fixed tree with
TestClaudeLetGoConversationResumesItsSession, whose fake now answers a
rewind; go test -tags nogui -count=1 ./internal/gateway/ (559s, only
the known TestCodexPoolSaysTheClientsVersion flake red); gofmt -l
clean on both files; go vet -tags nogui on internal/gateway for
darwin, linux and windows; go build -tags nogui ./... on all three.

Review, changed from ggbdpq's patch: the session kept under the
conversation's next key is cut before the side question when it is
resumed. ggbdpq's patch resumed the shelved session whole, so the
suggestion's question and answer stayed in the history the model
reads on the conversation's next turn. A shelved session found by
behindKey is now copied up to the line before the side question
(cutBehind: cutSessionBefore at behindTurn for a -p run, cutSession
at behindLine for a TUI run, the branch point both already use), the
copy is resumed and the shelved file removed. If the cut fails, the
session is dropped and a new Claude Code is told the conversation, as
before the patch.

The test now checks the resumed session id is a new copy, that the
copy ends at a2 then a3 with one SUGGESTION left (the first one,
already taken back above a2), and that the resumed run is told a3
alone. Its fake Claude writes stdin lines with printf: sh's echo
turned the JSON's \n escapes into newlines, which split every line
and hid its uuid.

Broken by hand at the reviewed head: claude_subscription.go reverted
to its parent, the test red (no session kept); ggbdpq's own
claude_subscription.go put back, red at the cut check (the shelved
session resumed whole). Restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
ggbdpq 8f6dacbf7f gateway: a browser's CORS preflight from another machine is answered, not asked for a key (#4931)
From the report (magpie 0.1.2698, macOS 27.0.1, LAN sharing on, gateway
port 3425): a page at https://learn.trancy.org, listed in Settings ->
Network and sharing -> Web pages, failed to add itself as a custom
engine ("Failed to fetch"). The same OPTIONS preflight for /v1/models,
declaring GET and the authorization header with no key on it, was
answered 204 with the CORS headers at http://127.0.0.1:3425 and refused
401 with no CORS headers at the machine's LAN address and behind an
HTTPS reverse proxy (Nginx Proxy Manager, no CORS handling of its own);
the browser logged net::ERR_FAILED,
corsError: PreflightMissingAllowOriginHeader, and gave up before the
keyed POST. The 401 body was the gateway's own "no API key was sent:
send a magpie gateway key as Authorization: Bearer <key> (or
x-api-key)".

lanGuard sits in front of Handler (Front, oneport.go), and corsGuard is
inside Handler, so a request from another machine met the key check
first: with the gateway shared (or listening on the network),
identifyCaller refused the keyless preflight 401 before corsGuard could
see it. On loopback lanGuard asks no key, which is why the same
preflight was answered there. A preflight is an OPTIONS that declares
the call to come, and per what CORS asks of it carries no key and no
body: the browser cannot send one.

lanGuard now hands a preflight (corsPreflight: an OPTIONS with an
Origin and an Access-Control-Request-Method) to corsGuard instead,
after the allow list and the shared/on-network rules have judged it as
they judge every request. corsGuard answers a listed origin's with its
204 and headers and refuses any other page's as on loopback; the call
the preflight asks after still needs an enabled gateway key, and an
OPTIONS that declares no call is no preflight. `magpie web`'s page
port, which hands client routes to the same Front, is covered by the
same change.

Tests (internal/gateway/cors_test.go), from the report's three-row
table:
- TestCORSPreflightFromLAN: the loopback preflight answered 204 (the
  row that already worked), the LAN-direct one and the reverse-proxy
  one (X-Forwarded-For, loopback peer) answered 204 with Allow-Origin
  and Allow-Headers; an unlisted origin's preflight refused with no
  CORS headers; a keyless GET and a plain OPTIONS from the LAN still
  401; a preflight while magpie isn't shared still refused.

Broken by hand (the preflight handoff taken back out of lanGuard): the
LAN-direct and reverse-proxy rows go red, 401 with the report's own
error body, while the loopback row stays green; restored, ok.

Run (macOS arm64, this tree, -tags nogui):
- go test -run 'TestCORS|TestLAN|TestForeignPages|TestOpaqueOrigin|
  TestLocalhostSubdomain|TestRebound|TestOnePort|TestFront'
  ./internal/gateway: ok.
- the same with -race: ok.
- go vet ./internal/gateway, and with GOOS=linux and GOOS=windows: ok.
- go build . with GOOS=darwin, GOOS=linux and GOOS=windows: ok (the
  darwin cgo enum-conversion warnings in internal/gui are pre-existing).
- gofmt -l on the three touched files: clean.
- go test -count=1 -timeout 50m -tags nogui ./internal/gateway: every
  test ok except TestCodexPoolSaysTheClientsVersion, the known #4807
  (another test's Codex identity reaches it in a full package run); it
  passes run alone at this head.
- go test -tags nogui -count=1 ./internal/access ./internal/settings .:
  ok. ./internal/gui: TestProxyCheckSaysAProxyPassedBy fails, and fails
  the same way run alone on the untouched base a3768cdd1 — this
  machine's environment, not this change (the test drives checkProxy's
  ALL_PROXY walk, nothing of the gateway).

Not tried: a real Trancy page against a real LAN address and a real
Nginx Proxy Manager install; the report's LAN and proxy rows are taken
from its measured curl and browser evidence, and reproduced here at the
lanGuard/corsGuard seam with httptest instead. A preflight arriving
while magpie isn't shared is still refused, so the browser reports the
preflight, not the later call, as the failure — the network's rules
come first, as the report asks.

Review, changed from ggbdpq's patch (security): the patch let every
keyless preflight from another computer past lanGuard's key check.
corsGuard passes some unlisted origins on with no key (a page on this
computer by name or address, *.localhost, the request's own origin,
an app's or extension's scheme), and a route that takes OPTIONS
(Codex's backend relay, the MCP paths) would then serve such a
"preflight" with the user's sign-in. lanGuard now hands on only a
preflight whose origin is listed (corsAllowed); every other one meets
the key check as before, Origin null included. No request other than
an OPTIONS with Origin and Access-Control-Request-Method skips the
key: a POST, GET or DELETE carrying a preflight's headers is 401.

TestCORSPreflightFromLANReachesNothing (added in review) sends a
keyless preflight from the LAN for Codex's relay, an MCP path and
/v1/models from localhost, 127.0.0.1, foo.localhost, the request's own
origin, an extension, app://, null and a foreign site: none reaches
the handler or gets CORS headers. The listed origin's is answered by
corsGuard alone, and other methods with its headers are 401. A
rebound page never gets here: lanGuard's rebound check runs on
loopback first, and from the LAN the key check stands. Broken by
hand at the reviewed head: the corsAllowed condition removed, this
test red (TestCORSPreflightFromLAN stays green); the whole handoff
reverted, both red. Restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
yetone 3c2dceb340 gateway: "member" in Model name in replies names the member to Claude Code and Codex too (ZoeCats)
ZoeCats (Discord #feedback, after v0.1.2760): with Settings › Models ›
Replies › Model name in replies on "vendor" the name is no longer written
over, but on "member" (作答的成员) a reply still didn't name the routing
group's member that answered.

Cause: replyNamingOf turned the "member" setting into the model asked for
whenever the agent was Claude Code, Claude Desktop or Codex (vendorNamed,
kept from #822's memberModel). ZoeCats's agent is Claude Code, so the
setting did nothing for them, while "vendor" was already for every agent.
The setting was saved and read as it should be (the vendor choice worked
through the same path), and an absent X-Magpie-Response-Model falls
through to the setting.

Fix: the user's pick is for every agent. Those three already take a
provider/model id back under the default (the group or provider/model
they asked for), so the member's provider/model id is no new shape for
them. vendorNamed, replyNamingOf's unused agent argument and the dead
namesMember are gone. The menu's note for "member" says "for every agent,
groups included" in en, zh, zh-TW, ja and de; settings.go's comment and
gateway-routing.md say the same.

Tests (fake upstreams, no network):
- TestReplyNamesMember: "on, codex", "on, claude code", "old file on,
  codex" now want the member, plus "on, claude desktop" and "on, codex,
  name asked" (the header still wins), on 6 paths x streamed or not, each
  after a failover in a group.
- TestPluginReplyNamesMember (new): a group served by the fake plugin,
  Chat and Messages, streamed and whole, with no token and Claude Code's,
  member and default.
- TestGeminiReplyNamesAskedModel: also with replyModel member and vendor.
- reply-model-setting.test.cjs: the member note says every agent and
  names no Claude Code.
Red on origin/main db7c57670 with only the tests changed: every
codex/claude code/claude desktop member case of TestReplyNamesMember
and the four Claude Code member cases of TestPluginReplyNamesMember
(the reply named group/chat, group/claude). Gemini and plugin member
cases without a vendorNamed token were already green.

Run on mote at this tree (on origin/main db7c57670, the pushed base):
- gofmt -l internal/ clean; GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of ./internal/gateway ./internal/settings clean.
- go test -tags nogui -count=1 -timeout 45m ./internal/settings
  ./internal/settingsapi ./internal/gui ./internal/cli ./internal/gateway:
  settings, settingsapi, gui, cli ok; gateway ok except
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity; red in the full package, green alone), untouched here.
  TestReplyNamesMember, TestPluginReplyNamesMember and
  TestGeminiReplyNamesAskedModel pass.
- node --test reply-model-setting + i18n-keys (chromium + webkit, 5
  languages, 1100 and 420 wide): 26 pass, 0 fail.
Broken by hand: the tests alone on the old member.go (above) were red.

Not tried: a real Claude Code or Codex session reading the member's id
back (the default already gives them a provider/model or group id); a
real vendor account through a real group.
2026-11-03 07:15:52 +08:00
yetone 1851ead1a7 library: Pi and omp lock ~/.agents/skills from their versions; Put skills in links every skill there
usrname1833 on Discord asked for two things.

Pi reads ~/.agents/skills itself, so a skill kept there is Pi's whatever
is ticked, with the lock as Codex and OpenCode have. Pi started to in
0.54.0, not 0.19 (its CHANGELOG; userAgentsSkillsDir in
package-manager.js), and omp in 11.0.0 (src/discovery/agents.ts; 10.6.2
doesn't). Target.SharedToo says so from the version, and every reader of
readsShared goes through Target.readsSharedDir: Always (the lock),
syncSkills' inShared (no second link) and a handover's readsSharedHere.
OmO's senpi reads it in every npm version (0.74.0 up), so omo joins
readsShared. A Pi or omp of no known version is taken as older, as
before.

The second ask is a switch: Library > Skills > "Put skills in": each
agent's own folder (the default, today's behaviour) or ~/.agents/skills
(Library.SharedSkills; POST /api/library/skills/where {how};
magpie library skill where agents|shared). On, every library skill on
here gets magpie's link in ~/.agents/skills (syncShared, after
sweepShared), so every agent and tool reading that folder has it and
shows it locked. The files stay in the library rather than moving, so
updates, edit tracking and Off here keep working; existing skills just
get links when it is turned on, nothing is moved. A user's own entry by
the same name is never written over. Off takes out magpie's links there
and nothing else, and agents' own links come back. Per computer:
Collect doesn't carry it. docs/subsystems/library.md says all this.

Not covered, filed: on Windows without link rights the shared entry is
a marked copy, and takeEdits doesn't take edits made in it (#4958).

Run on mote rebased on d76c4b23a (which has 8abdf53a8):
gofmt -l clean; go vet GOOS=linux and GOOS=windows on internal/library,
internal/gui, internal/cli ok; go test internal/library, internal/gui,
internal/cli ok. GUI, every skill-*, library-* and i18n-keys file in
chromium and webkit: 1302 pass, 4 fail, all in library-all (webkit) and
library-null-agents (chromium). Both pass alone at this tree (52/52), so
they are load reds, filed as #4967. skill-where.test.cjs (new) covers en,
zh, zh-TW, ja, de at 900px and 400px. Before the rebase, cli's
TestEveryRouteHasACommandOrIsNamed was red on /api/usage/checkin-account
(not this change); it is green at this base.

Rebased twice more on origin/main (cli's settings_parity_test, app.js,
i18n.js, settings): internal/cli and internal/gui go test ok, i18n-keys
and skill-where green at the pushed tree.

Broken by hand, each red, then restored: since() always false
(TestPiReadsSharedSkillsFromItsVersion, TestSkillsWhereShared red);
syncShared step dropped (red); sweepShared's keepsShared keep dropped
(red on the SameFile no-relink check); the holder line in wanted
(TestSkillsWhereSharedWithKimi red); skillWhereBar not appended
(skill-where 0/11 per engine).

Not tried: a real Pi, omp or OmO run (versions read from their npm
source); the setting on the Windows box or in WSL; the whole GUI suite.
2026-11-03 05:43:12 +08:00
yetone 91379b9339 settings: a reply's model can be the vendor's own name again, the member, or the model asked for (ZoeCats)
ZoeCats (Discord #general): since v0.1.2473 a reply's model says the name
the client asked for (a group or provider/model id), groups that aren't
aggregates included, and the only way back to the vendor's own text was the
X-Magpie-Response-Model header, which their client can't send.

Settings › Models › Replies › Model name in replies (replyModel), picked
from the app's menu, in en, zh, zh-TW, ja and de:
- "" the model asked for (the default, as now);
- member: magpie's provider/model that answered (what memberModel did;
  Claude Code, Claude Desktop and Codex still get the name asked for);
- vendor: the vendor's own text, for every agent, the vendorNamed three
  included, as every agent got before v0.1.2473 and as the header's
  "vendor" already gave them.
X-Magpie-Response-Model (asked, member or vendor) still picks for its
request; an unknown value falls through to the setting, as before.

memberModel is folded in without changing anyone's choice: a file with
memberModel on reads as replyModel member, an explicit replyModel wins, and
memberModel is written beside it as a mirror so an older magpie reads the
same. An older page sending only memberModel changes the setting only when
its switch moved (a vendor choice survives its saves). The CLI's set/reset
goes through Keys/Choices (replyModel in place of memberModel).

app.js's row is paid for by five comments in Settings' code cut down:
app.js is 145 bytes under its base, no budget raise.

Run on mote at this head (rebased on origin/main b328a7790):
- gofmt -l clean; GOOS=linux go vet -tags nogui ./... and GOOS=windows
  go vet ./... clean.
- go test -tags nogui -count=1 -timeout 45m ./internal/settings
  ./internal/settingsapi ./internal/gui ./internal/cli ./internal/gateway:
  settings, settingsapi, gui, cli ok; gateway ok but
  TestCodexPoolSaysTheClientsVersion, red in the full package and green
  alone (#4807, another test's Codex identity; passed alone at the
  previous head).
- GUI (node --test, chromium + webkit): reply-model-setting (5 languages x
  1100/420, plus default-to-member), loop-guard-setting, i18n-keys,
  account-discovery, disabled-models, masking-records,
  refusal-retries-setting: 222 pass, 0 fail.
- Whole GUI suite earlier at d73b208ac's tree: reds in account-eye (#4244)
  and segs-press-redraw's "every Settings option" (#4566, searchAllRow;
  red the same at origin/main b328a7790, run alone), plus load reds in
  unrelated pages; none in Settings' Replies.

Rebased again onto f3681b90c (Agents page, usage, claude /usage) and
run there: internal/gui and settingsapi -run Budget|SettingsSave|Keys ok,
settings TestReplyModel ok, i18n-keys + reply-model-setting 26/26.

Broken by hand (each red, then put back):
- replyNamingOf ignoring the vendor setting: TestReplyNamesMember's
  vendor, vendor+codex, vendor+claude code cases red on every protocol.
- normal() without the memberModel fold: TestReplyModelFoldsMemberModel
  and TestReplyNamesMember's "old file on" red.
- Merge without the old page's memberModel rule: TestReplyModelSaves'
  old page turns it on / off red.
- settings_keep_test.go went red at the earlier head (MemberModel not sent),
  fixed by setting replyModel member there.

Not tried: a real vendor account through a real group; the GUI test was not
run against the old app.js (the row doesn't exist there).
2026-11-03 05:38:18 +08:00
yetone 3a74cd92e8 claude: /usage waits for its figures, and a read without them is unknown
Seagull fries (haioushutiao, Discord #help; magpie 0.1.2704, Claude Code
2.1.316, Windows 11, Claude Pro): the Claude card said 暂时无法获取额度,
"Claude Code's /usage told no allowance: ❯ /usage ─── Settin s Status
Config Usage …". Reproduced with a real Claude Code 2.1.316 under
Windows' pseudo console in a sandbox: /usage's panel is drawn first with
"Loading usage data…" while Claude Code asks Anthropic for the figures
(5s timeout, retried only on a 401), and the helper took 3s of a still
screen as the panel drawn whole. On a slow answer it told the panel's
frame as the result, and parseClaudeUsage called any text with no window
"told no allowance". A failed load ("Error: Failed to load usage data",
"r to retry") went the same way.

claudetui:
- screen.go: a small terminal grid (CUP/CUU..CHA/VPA, EL, ED, ECH, CR/LF
  with scrolling, OSC/DCS skipped, an escape or UTF-8 character cut
  between reads kept), 200x50 on Windows as the pseudo console is made,
  80x24 elsewhere. The pseudo console sends only the cells that changed,
  skipping a cell that holds the same letter ("Settin\x1b[1Cs"), so the
  stream read split words and kept a redrawn digit beside the old one.
  While /usage is read, each look of the screen with a window is kept
  (panel), and usageText reads that before the stream.
- command(), built on b4073c06a's wait for the panel (ikunbots; its
  usageDrawn and "hadn't drawn" error kept, now also judged on the grid,
  since the pseudo console's split "Settin s" never matched its tabs):
  "Loading usage data" on screen is waited out (to
  commandWait, s.doing "was still loading /usage's figures" for the
  deadline message); "Failed to load usage data" gets one "r"; a panel
  still with no figure and loading or failed on screen is an
  error_during_execution result, "/usage couldn't load the plan's usage:
  <screen>".
- the fake draws the panel a frame at a time (fakeFrames), as Claude Code
  does: with one write, the pseudo console passed on only the last
  frame, which no longer shows the windows. TestShimReadsUsage now passes
  on Windows (#4820, the fake's side; a real panel with figures was not
  seen on Windows, see below).

provider:
- parseClaudeUsage: a panel with no figure is "Claude Code's /usage
  showed no usage figures: …", not "told no allowance" (kept for
  claudeUsageDenied's refusals).
- claudeUsageUnknown: Claude Code's "temporarily unavailable" and the
  helper's "couldn't load the plan's usage" keep the account's reported
  reading (quota_last), as the first did alone before. Other no-figure
  text is still shown as an error (TestClaudeHeaderSurvivesUnclassified-
  UsageFailure, TestClaudeUsageReadingAloneDoesNotHideUnclassifiedFailure
  hold that).

Fixtures are the reporter's case as the pseudo console passed it on for
the real 2.1.316 (a temporary dump of the helper's screen bytes, sandbox config,
proxy that never answers / refuses): testdata/usage-loading-win-2.1.316.bin
and usage-failed-win-2.1.316.bin.

Run at the pushed head:
- mote: go test ./internal/claudetui ./internal/provider ok; go test
  -run 'Claude|Usage|TUI' ./internal/gateway ok; GOOS=darwin/linux/
  windows go vet ./internal/claudetui ./internal/provider ok; gofmt -l
  clean.
- xiaomi-gpu (win-run): go test ./internal/claudetui: all pass except
  TestShimFirstMessageWaitsForTools, red on Windows at main (#4810).
- xiaomi-gpu, real Claude Code 2.1.316 (npm), sandbox CLAUDE_CONFIG_DIR
  with a fake token, magpie.exe built from this tree, helper run as the
  gateway runs it: a proxy that never answers gives is_error "/usage
  couldn't load the plan's usage: … Settings Status … Loading usage data…"
  after the 20s wait (was a success with the chrome); a refused proxy
  shows "Failed to load usage data", "r" is pressed, and the same error
  comes back in 6.6s. "Settings" is whole now.

Broken by hand (before the rebase onto b4073c06a; the merged loop is
re-checked below):
- old tui.go: TestShimWaitsForUsageFigures slow, retried and failed again
  all red, each telling the reporter's chrome as success.
- the "r" not written: TestShimWaitsForUsageFigures/retried red.
- old parse message: TestClaudeUsageWithoutFiguresIsUnknown red ("told
  no allowance"); old quota_last check: its couldn't-load cases red.
- after the rebase, on the merged loop: the "r" not written,
  TestShimWaitsForUsageFigures/retried red; the old "anything still 3s"
  in place of usageDrawn on the grid, TestShimWaitsPastTheBanner red.

Not tried: a real account (the box has none of the owner's), so a real
2.1.316 panel with figures was never seen through the pseudo console;
whether Claude Code's frames that show the windows reach the pseudo
console's output before it renders the next one is shown only by the
fake. Not taken: asking Anthropic's /api/oauth/usage, which the owner
ruled out (9bf6d4352).
2026-11-03 05:16:40 +08:00
yetone 6c08ee13b0 gateway: a model asking for earlier reasoning back goes on to the group's next member
EDwinpzy (Discord #feedback, magpie 0.1.2717): Command Code's
reflection/beam:free answered a second turn with 400 "Missing required
parameter: 'messages[N].reasoning_content'". The 400 wasn't retryable,
so a routing group of Beam then Glyph ended at Beam and never asked
Glyph. The client's request is whole; it is that model's demand for
history it doesn't have, and another member's model may not make it.

reasoningBackRefused (thinking_back.go) reads the demand: DeepSeek's
"must be passed back" (thinkingBackRefusal) and words that name
reasoning_content as missing or required. shapeRefused and retryable
take it, so the member fails as a shape refusal (failShape): no rest,
the next member is asked once. refuseThinkingBack's refill still runs
first, inside forwardOnce. A 400 for a missing 'messages' or 'model'
still stops at the first member. The plugin side (commandcode 0.1.22
fills Beam's earlier replies with reasoning_content) ships separately.

Tests: TestGroupFailsOverAMissingReasoning (chat and responses routes,
the reporter's two-turn shape, his words in the Provider API's error
JSON) and TestMissingReasoningIsNotABadRequest.

Run on mote: go test -count=1 -timeout 45m ./internal/gateway: every
test passes except TestCodexPoolSaysTheClientsVersion, red in a full
package run and green alone, already filed as #4807 (another test's
Codex identity reaches it); go test ./internal/provider ok;
GOOS=linux and GOOS=windows go vet ./internal/gateway ok; gofmt -l clean.
After a rebase on 253aee08b (conflict with #4732's zhipuImageRefusal in
shapeRefused, both kept): the same packages and vets again, provider ok,
gateway red only for #4807 and TestCompactionOverByteCapEveryTime, which
is #4862 (red in a full run, green alone). At the pushed head, rebased on
d76c4b23a: TestGroupFailsOver*, the two new tests, ThinkingBack, Zhipu,
Webp, #4807's and #4862's tests ok in gateway; Mover/Moved/CommandCode ok
in provider.

Broken by hand: with reasoningBackRefused returning false (the old
classification), both new tests are red (400 from Beam, Glyph never
asked; shapeRefused and retryable false for every demand).

Not tried: a real Beam request (the Command Code key here answers 401),
so the error JSON around the reporter's words is constructed, not saved.
2026-11-03 05:10:38 +08:00
yetone b4073c06a0 claude-tui: /usage waits for its panel, never takes Claude Code's banner as it (ikunbots on X)
ikunbots (v0.1.2738) showed a Claude card saying "Claude Code's /usage
told no allowance: ▘▘ ▝▝ /private/var/folders/…/magpie-claude-work-501
────". After /usage is typed, Claude Code draws itself again (banner,
folder, the prompt's rules) before the panel. A slow /usage leaves that
still, and the helper took any screen still for 3s as the panel, so the
banner was told as /usage's answer and parsed as an error.

Now a screen without "NN% used" counts as drawn only when the panel's
Settings tabs show and nothing says loading (usageDrawn). With no panel by
commandWait (or the caller's deadline), the result is an error naming what
was last drawn, never a success carrying the banner.

Run (on mote):
- go test ./internal/claudetui/: ok (new TestShimWaitsPastTheBanner: the
  fake draws the reporter's banner, then the 2.1.316 panel 4.5s later;
  TestUsageDrawn; a "banner, no /usage panel" case in
  TestShimEndsAtItsCallersDeadline).
- Broken by hand (old "anything still 3s" condition back):
  TestShimWaitsPastTheBanner red, told the banner as the result, as in the
  report.
- go test -run 'Usage|TUI' ./internal/gateway/ ./internal/provider/: ok.
- GOOS=darwin/linux/windows go vet ./internal/claudetui/ ./internal/gateway/: clean; gofmt clean.

Not tried: a real slow /usage on a real account; the "loading" word is
a guess at the panel's loading text, which only keeps waiting longer.
2026-11-03 02:41:17 +08:00
yetone dfd3b720bd docs: the gateway's OpenAI images and videos routes, and what each vendor is sent
A table of POST /v1/images/generations, /v1/images/edits, POST /v1/videos, GET /v1/videos/{id} and /content, what each takes and answers, and each vendor's translation, checked against draw.go, draw_volcengine.go and video.go. Asked for by axelburks on Discord. Docs only; nothing run.
2026-11-03 02:40:27 +08:00
yetone 5bd1aee637 video: Seedance takes a last frame and Ark's own fields through /v1/videos
/v1/videos read OpenAI's request into Ark's content-generation body
but left out the last frame (last_frame, which magpie reads for
MiniMax), and dropped every field OpenAI's API doesn't have, so a
caller in OpenAI's shape couldn't turn off Seedance's audio, fix a
seed or ask for an adaptive ratio (axelburks on Discord asked that the
OpenAI shape be converted to the vendor's).

volcengineVideoBody now sends last_frame as an image_url item with
role last_frame, and passes the request's other fields on as sent
(masked as the prompt is, as for a provider's own videos API). A
multipart form's "false" or "42" goes as false or 42, as Ark takes
them.

Run (mote): at a7f31ef46 (this stack on 2c90922b0), gofmt -l internal clean,
GOOS=linux and GOOS=windows go vet ./... ok; go test -timeout 45m of
internal/gateway, imagemcp, browsermcp, cli, davsync, gui, library,
settingsapi, tui, agent: all ok but two reds already filed and untouched
here: gateway TestCodexPoolSaysTheClientsVersion (#4807) and cli
TestEveryRouteHasACommandOrIsNamed (#4826). After rebasing on 1490045f5, gateway re-run there (pushed onto 253aee08b, whose later commits change only provider/gui Gemini URL defaults; not re-run):
gofmt, both vets, and gateway -run Ark|Volcengine|Video|Videomaker|
ImageMCP|Draw|Image|Film|MiniMax|Grok plus imagemcp, ok.

Broken by hand: arkFilms false for a non-preset Ark key turns
TestArkKeyMakesSeedanceVideos red (create 404 at /api/v3/videos, the
reported gap); leaving out the last_frame item, or sending multipart
strings untyped ("false", "42"), turns
TestArkVideoTakesLastFrameAndItsOwnFields red.

Not tried: a real Ark account (the fake answers with Ark's captured
replies from volcengine_fixtures_test.go); multipart extras against real
Ark; the MCP's generate_video has no last_frame argument yet. Siblings
filed: #4954 (an OpenAI key's Sora can't make videos), #4955 (Seedance
listed as chat models).
2026-11-03 02:40:27 +08:00
yetone 93060c98d0 video: an Ark key's Seedance models make videos at Ark's tasks (axelburks on Discord)
axelburks asked for image and video APIs on the gateway that convert
OpenAI's request shape into the real vendor's, Volcengine's in
particular. /v1/videos already did that for the Volcengine preset's
Agent Plan, but any other Ark key (pay-as-you-go /api/v3, or an Ark
endpoint added by hand) had no video models, and one marked a Video
model was sent to an OpenAI-shaped <base>/videos that Ark doesn't
have (404).

Now an Ark key's Seedance models (listed or picked, named seedance) are
its video makers, started at <base>/contents/generations/tasks with
volcengineVideoBody, polled at .../tasks/<id> and downloaded from
content.video_url, as the Agent Plan's are. The id names the key that
started the video, and its poll and download go on that key.

Docs: docs/subsystems/gateway-routing.md.

Run (mote): at a7f31ef46 (this stack on 2c90922b0), gofmt -l internal clean,
GOOS=linux and GOOS=windows go vet ./... ok; go test -timeout 45m of
internal/gateway, imagemcp, browsermcp, cli, davsync, gui, library,
settingsapi, tui, agent: all ok but two reds already filed and untouched
here: gateway TestCodexPoolSaysTheClientsVersion (#4807) and cli
TestEveryRouteHasACommandOrIsNamed (#4826). After rebasing on 1490045f5, gateway re-run there (pushed onto 253aee08b, whose later commits change only provider/gui Gemini URL defaults; not re-run):
gofmt, both vets, and gateway -run Ark|Volcengine|Video|Videomaker|
ImageMCP|Draw|Image|Film|MiniMax|Grok plus imagemcp, ok.

Broken by hand: arkFilms false for a non-preset Ark key turns
TestArkKeyMakesSeedanceVideos red (create 404 at /api/v3/videos, the
reported gap); leaving out the last_frame item, or sending multipart
strings untyped ("false", "42"), turns
TestArkVideoTakesLastFrameAndItsOwnFields red.

Not tried: a real Ark account (the fake answers with Ark's captured
replies from volcengine_fixtures_test.go); multipart extras against real
Ark; the MCP's generate_video has no last_frame argument yet. Siblings
filed: #4954 (an OpenAI key's Sora can't make videos), #4955 (Seedance
listed as chat models).
2026-11-03 02:40:27 +08:00
yetone 1490045f59 claude bridge: an unloaded deferred magpie MCP tool is handed over by its full name
packinggoods (#feedback, 11-02): every first MCP call in Claude Code
failed with "Error: No such tool available: magpie-web-search__web_search"
and the retry worked.

Claude Code with tool search on names a deferred MCP tool in a reminder
and leaves it out of tools until ToolSearch loads it. Through the Claude
subscription bridge the run's model reads that name and calls it,
mcp__magpie__magpie-web-search__web_search; toolStart cut mcp__magpie__
and, the tool not being one the client sent, handed the client the bare
magpie-web-search__web_search, which it has no tool of. After a
ToolSearch the tool is in tools, the cut name maps back, and the call
works: the retry. a3768cdd1 (the router sending a name it no longer
lists to its server) doesn't reach this; nothing gets to the router.

toolStart now hands such a call over under the name the model called,
the client's own, when the cut name maps to nothing and isn't among the
run's tools. A declared tool maps as before; with the run's tools not
yet set the old behaviour stays.

Reproduced in a sandbox HOME with Claude Code 2.1.316 against a fake
Anthropic API and a stdio MCP server: a call of the bare name gives
the reporter's exact error, and a call of the full name of an unloaded
deferred tool runs.

Run at this head (mote): go test -tags nogui ./internal/gateway -run
'TestClaudeBridgeHandsOverAnUnloadedMagpieTool|TestClaudeBridgeKeepsMagpieMCPNames|TestClaudeRunEndsAfterStructuredOutput|ToolChoice|ToolName'
ok; then rebased on fb872a68e (a2837c1f5 and 2ff93ffd6 on top change
only two provider movers' mins): gofmt -l internal/gateway clean,
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway ok,
go test -tags nogui ./internal/gateway -run 'Claude|MCP|Hub|ToolName|ToolChoice'
ok (88s).
Broken by hand: with the name = called line out,
TestClaudeBridgeHandsOverAnUnloadedMagpieTool is red: handed
"magpie-web-search__web_search", want
"mcp__magpie__magpie-web-search__web_search".
Not tried: a real bridge run on a real Claude account, and the
reporter's own setup (agent, account) is inferred from the screenshot.
Not changed: a deferred tool of another client MCP server
(mcp__linear__…) is still answered by the run (#4956, related #4854).
2026-11-03 02:36:06 +08:00
yetone 2ab9235711 agents: an agent's picks can be kept to this computer, as an MCP server can
chenxiang0010 on Discord: 「agent当前选择的模型可不可以像mcp那样 只对当前设备生效」.
Sync carries every agent's picks (model, effort...) between computers;
an MCP server has an opt-in "This computer only" that sync and backup
files never carry. Agents now have the same: the row's menu (right-click
or ...) has This computer only, off by default, so an upgrade changes no
pick on any computer.

- settings: AgentsHere, this computer's own (KeepOwn), and kept by a save
  of the Settings page (settingsapi.Apply), which doesn't send it.
- davsync: each kept agent adds "<id>.*" to the own set (withHere, isOwn),
  so a sync neither pushes its fields nor brings the server's; a Restore
  from the server leaves them. sync-state.json records the list as of the
  last sync (Here): hashes before a sync use it and after use the current
  list, so turning it on or off is no change on either side, and a changed
  list forces the sync past its early returns. Turned off, the next pick
  goes up again. Other agents still sync both ways; the implicit own
  fields (hayden4608) are unchanged.
- backup.Restore skips a kept agent in a backup file.
- gui: POST /api/agents/here; the row says "This computer only" beside
  the version (hidden in the tray panel and in a narrow row), menu ticks.
  Core words moved from the library plugin's i18n into core i18n
  (zh/zh-TW/ja/de). Comments in renderAgents cut to pay for it under the
  core budget (no raise).
- cli: the route is named under stage 3 (no command yet).
- docs/subsystems/sync-backup.md describes it.

Run on mote, at the base eb8b840dd (Go and the GUI files below) and again
at this head's base for internal/gui (core budget) and agent-here,
i18n-keys, agent-menu-label:
- go test -tags nogui ./internal/davsync ./internal/settings
  ./internal/backup ./internal/gui ./internal/settingsapi: ok
- go test ./internal/cli: ok but TestEveryRouteHasACommandOrIsNamed,
  red on main for POST /api/usage/checkin-account alone (#4826)
- GOOS=linux and GOOS=windows go vet ./...: ok; gofmt -l: clean
- GUI, chromium + webkit: agent-here (en/zh/zh-TW/ja/de x 1100/640/360),
  i18n-keys, sync-own-fields, mcp-local-server, agent-menu-label:
  90/90 ok
- the whole GUI suite: cut off at test 3783 by a session restart; the
  rest (key-* on) is still running at push. Reds seen so far, under
  three GUI suites at once on mote, none in an agent file: account-eye,
  balance-fix (Sub2API, /api/user/self), codex-auto-reset, context-map,
  editor-advanced-align; being checked at main and filed there.

Broken by hand, each red then restored:
- hereOf returns nil: TestAgentHereThroughSync "B's kept picks went up"
- backup.Restore's kept skip off: "B after a backup file"
- KeepOwn line dropped: TestAgentsHereIsThisComputers "another
  computer's kept agents came in"
- TestSettingsSaveKeepsWhatItDoesNotSend went red on this change before
  settingsapi kept AgentsHere (a Settings save would have dropped it).

Not tried: a real two-computer sync with real accounts; no CLI/TUI
command for the flag; Settings -> Sync doesn't list kept agents; WSL
agent ids (codex@wsl:...) only through the key format.
2026-11-03 02:27:20 +08:00