Commit Graph
3181 Commits
Author SHA1 Message Date
yetone 149ab950e7 gateway: a Codex lead on a chat provider goes on when its subagent on one of Codex's own models sends it a message, the sealed message left out with a note (#1613, laacmilan)
laacmilan's lead was on token/gpt-6.1-sol, an API key on Chat
Completions. Codex put a subagent on one of its own models, which magpie
serves from the ChatGPT account. The ChatGPT backend seals that
subagent's send_message, and Codex hands it to the lead as an
agent_message: a plain "Message Type: MESSAGE" header plus
encrypted_content (codex-rs protocol.rs to_model_input_item). serve's
sealed gate (#619, #1237) took any sealed agent_message as a task. Only
the ChatGPT backend can read it, so the lead's next turn was refused. The
refusal said the lead "has since been on one of Codex's own models",
which it never was. This had been so since the gate was added, not only
since yesterday's release.

- A sealed message (not a task) that no candidate can open is left out
  now (withoutSealedMessages). An input_text note naming its sender goes
  in its place, and the request goes on where it was. The subagent's
  final result still reaches the lead as text. A sealed task (NEW_TASK,
  or an item with no header) is still refused, as in #619: without it
  the subagent has nothing to do.
- The refusal for a sealed task, where the provider that answered the
  lead can't seal, no longer says the lead switched models. It says the
  task came from an agent of this thread on one of Codex's own models,
  and points to Codex's subagent model on the Agents page.
- docs/subsystems/gateway-routing.md says so.

Run:
- The new tests in sealed_message_left_out_test.go. The lead and
  subagent cases fail on the old code with the reporter's exact message,
  and also fail with the strip turned off by hand.
- go test -tags nogui -run 'TestSealed|Codex|Sealed' ./internal/gateway.
- go test -tags nogui -timeout 40m ./internal/gateway.
- gofmt -l.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway.

Not tried: real Codex desktop with a real ChatGPT account and a chat
provider. The requests are Codex-shaped fixtures built from codex-rs's
item format.
2026-10-11 21:17:02 +08:00
yetone 398f8469be gateway: Codex's compaction on a custom provider goes on when its relay answers the summary 400 "Upstream request failed" (#1511, TooPub; #1523)
TooPub reported (#1511) that Codex through magpie to a custom relay
provider stopped compacting with
  {"error":{"code":null,"message":"apex: Upstream request failed","param":null,"type":"invalid_request_error"}}
while Codex pointed straight at the same relay compacted fine, and a new
conversation worked. #1523 (jswysnemc, anyrouter) is the same failure.

magpie answers Codex's compaction_trigger for a magpie model itself: it
asks the model for a summary with the raw history (codexCompact). Normal
turns are translated and worked; the summary request goes as it is, and
the relay turned it away with its own generic 400. codexCompact's fallback
(ask again with the conversation as text, then compact without a model)
took the relay's generic failure only as a 404 (#866, "flyapi: Upstream
request failed"), so the 400 went back to Codex and the compaction
aborted.

- upstreamFailed: a 4xx (not 401/403/429) whose body says "upstream
  request failed" now takes the same fallback as #866's 404.
- The summary request sends "tools": [] instead of leaving tools out.
  Captured with Codex 0.162, that is the one difference between magpie's
  summary request and the summary request Codex sends a custom provider
  itself, which is what worked for the reporter. The relay hides the
  upstream's reason, so which of the two the relay objected to isn't
  known; the fallback covers it either way.

Siblings: Chat-only custom providers go through the same codexCompact
(covered in the test for both protocols). Other agents' compaction is a
normal request through the translators, with no magpie-side compaction
step. A pass-through option (#1523) wouldn't help: Codex compacts a custom
provider it reaches itself locally, which is what magpie's summary request
mirrors.

Run:
- New tests from the reporter's literal body: asks again as text,
  compacts locally (Responses and Chat), and 401/403/429 with the same
  words still go back to Codex. TestCodexCompactsThroughCodexRelay now
  and TestResponsesRelayCallIDs' compact cases now require
  "tools":[]. With the change reverted by hand, all three fail;
  TestCodexCompactOther400Stays and TestCodexCompactOtherFailuresStay
  stay green.
- Real Codex 0.162 in a sandbox CODEX_HOME against an in-process magpie
  gateway and a fake relay answering the summary with the reporter's
  400: on the old code "Error running remote compact task: {...apex:
  Upstream request failed...}" exactly as reported; with the change,
  "context compacted" and the turn completes.
- go test ./internal/gateway and go test ./... (nogui); gofmt -l; GOOS=linux
  and GOOS=windows go vet -tags nogui ./internal/gateway.
Not tried: the reporter's actual relay.
2026-10-11 21:05:45 +08:00
yetone 03dcc90c81 gui: Usage's head is fitted again when its sum's box shrinks, not only when the head resizes (#1599, found while verifying)
The fit for #1599 ran on a resize of the head and on a change in its
nodes. Under load the sum's box (#usageCost) sometimes shrank after the
head had been fitted, with the head's width unchanged and no node
changed, so nothing fitted it again and the sum stayed cut:
usage-sum-whole failed in 3 of 5 runs at load ~45 (Chromium en at 780px:
the sum 719.7–782.2, its box 719.7–764, the head not tight). The
ResizeObserver now watches #usageCost too.

What grows beside it after the fit isn't pinned down; the failing runs
show the box narrower than at the fit, which this catches whatever the
cause.

Verified:
- usage-sum-whole.test.cjs (Chromium and WebKit, en/zh/ja/de): 6 of 6
  green at load ~43 with the change, where 3 of 5 failed just before
  without it at load ~45.
2026-10-11 21:00:29 +08:00
yetone 76f802d37d gateway: Command Code's Provider API searches by itself for the 12 models that do, and the rest keep magpie's searcher (#1590, M3chD09)
Command Code's Provider API passes a provider-defined web_search on to the
model's vendor, and only some models search: M3chD09 ran all 87 and 12
did (claude-sonnet-5-5 and claude-haiku-5-5 on Messages; gpt-6-luna,
gpt-5.6-sol, gpt-5.6-luna, meta/muse-spark-1.2/1.3 and their -contributor
ids, xai/grok-4.5/4.6/4.7 on Responses). magpie took the whole provider
as one that doesn't search, so each of those searches went to the
searcher instead. Marking the provider as searching (Searches, or its
host in searchHosts) would have sent the tool to the other 75, which take
it and don't search.

searchModels now lists, per provider and API, the models that search by
themselves; modelSearches reads it for a keyed provider made from the
"commandcode" preset or at api.commandcode.ai, and none count when the
provider is sent Command Code's x-cmd-zdr header, under which it refuses
every built-in tool (cmd_zdr_unsupported_tool, from the report). It is
read in searchesModel, so the relay/translate choice and the tool swap
both follow it, and in webSearchOf, so a remote magpie's list says
"native" for those models too. Sign-ins (the Command Code Plan, its
plugin) are not changed.

Verified:
- TestCommandCodeSearchesForSomeModels: gpt-6-luna and xai/grok-4.7 on
  Responses and claude-sonnet-5-5 on Messages are sent the agent's own
  web search tool; deepseek-v4-pro and claude-opus-5-5 aren't; with
  x-cmd-zdr: 1 none is. Without the searchesModel change it fails for the
  three searching models.
- go test -run Search ./internal/gateway, gofmt -l.
- Not tried against the real Command Code API (no key for it here); the
  list is the reporter's run of 2026-10-11.
2026-10-11 21:00:29 +08:00
yetone d82985eee1 agent: a routing group whose members are all best on Responses is asked there by Pi, omp, droid and dsh, so its tool-call arguments stream (#1594, ObsidianArch02)
magpieModels gave a routing group no native API, since its members may
each want another. Pi, omp and droid then asked every group on Chat
Completions, and dsh put it on its Chat route, even a group of GPT
members all served on Responses. The gateway translated each answer from
Responses to Chat, and that translation holds a tool call's arguments
until the call ends (#613), so Pi's Code Mode saw no code until the whole
call had been generated.

A group now has APIs ["responses"] when every member, nested groups'
included, is served best on Responses (allResponses over the group's
members, by Provider.Native). Any other group keeps none: one with a Chat
member, and a Messages-only group too, as the gateway knows whether a
Claude thinks adaptively by its own model id, not the group's. dsh moves
a start on such a group to its Responses route (dshStartOnItsRoute); a
dsh session resumed on it asks for the model once, as for any model that
moved routes.

The rest of the request (a protocol picked per group, conversion shown
per request) is not in this commit.

Verified:
- TestPiModelsAskedOnTheirNativeAPI: auto-gpt-5-5, a GPT group and a
  group of that group get openai-responses; a group with a Chat member
  and one of Messages-only members get none. Without the route.go change
  it fails for the three Responses groups.
- TestOmpModelsAskedOnTheirNativeAPI: the same for omp.
- TestGroupOnResponsesRelaysArgumentDeltas (gateway): a group of two
  Responses-only members asked on /v1/responses relays each
  function_call_arguments.delta as the vendor sent it, on /responses.
  It guards what this change relies on, and passed before it too.
- go test ./internal/agent ./internal/provider, gofmt -l, GOOS=linux and
  windows go vet -tags nogui.
- Not tried with a real Pi against a real group.
2026-10-11 21:00:29 +08:00
yetone 16b5c8700f gui: a library MCP server no agent or project has isn't checked on its own; its status says "not checked" and a click checks it (#1597, xiaozhu1337)
Opening the Library's MCP tab started (or reached) every server in the
library once a session to list its tools, the ones switched off for
every agent too. Some users keep many servers in the library and turn on
a few, and each unused one was still started.

A server that no agent has, here or in a project magpie keeps (inUse),
is now left out of that check. Its status reads "not checked", with the
reason in its tooltip, and a click checks it, as a click already checks
any other server again. Once an agent is given it, the page renders again
and the server is checked as before. New strings in zh, zh-TW, ja and de.

Verified:
- library-mcp-health.test.cjs: a server on for no agent shows "not
  checked" and is not in the first check; one on only in a project still
  is; a click on it checks it alone (fresh) and opens no editor. Chromium
  and WebKit, en and zh. Without the library.js change it fails: the
  first check asks for "idle" too.
- library-mcp-tools and library-mcp-tool-switch: their padding servers
  were on for no agent and relied on the old check, so they are on for
  Claude Code now; the tests are otherwise unchanged.
- library-servers-bulk, mcp-signin, library-mcp-copy-config,
  project-servers, library-zed-mcp, search-mcp, gui-ja, gui-de pass in
  both engines. library-mcp-tool-switch times out in WebKit at load ~180
  on some languages with and without this change (#1609, filed earlier).
2026-10-11 21:00:29 +08:00
yetone 7bfd02aa62 gui: Usage's sum at the head's right is never cut, in any window width or language (#1599, sean908)
Between 640px and the width the Usage head needs in full (the tabs, the
periods with Custom named, Refresh's period and the sum), the sum was the
one item in the head that could shrink, so ≈$0.001 read "≈$0." with
nothing to say more was there. The narrow-window layout only began below
640px, and how wide the head needs to be depends on the language and the
sum's own length, so no single breakpoint fits.

The head now takes the narrow layout (.usage-head.tight: the sum's label
hidden, the unpicked Custom unnamed, Refresh compacted, wrapping as a
last resort) wherever the sum would be cut. A ResizeObserver and a
MutationObserver on the head decide it on the next frame, by whether the
sum's right edge passes its box.

Verified:
- usage-sum-whole.test.cjs (new): Chromium and WebKit, en/zh/ja/de,
  every width from 380px to 1240px in steps of 10: the sum reads whole,
  inside its box and the window, and the page never scrolls sideways.
  Without the change Chromium en is cut from 650px to 750px+ (the box
  0px to 15px wide for a 62px sum).
- usage-range, usage-arrange, usage-unpriced-names, currency,
  usage-ledger, usage-refresh, usage-refresh-flight, usage-quota-head,
  usage-hit-rate, click-scroll, gui-ja, gui-de: 104 pass in both engines.
- Not tried in the built desktop app on the reporter's screen.
2026-10-11 21:00:28 +08:00
yetone 0e89b090c1 gateway: Codex's auto-review on codex-auto-review goes through a ChatGPT account past its usage cap, since OpenAI made it free (#1593, hywang1230)
An account past the usage cap set on it in magpie was held for every
model, so Codex's auto-review on codex-auto-review was refused with
"usage cap reached" once the account reached its cap. OpenAI made
Auto-review free for every ChatGPT sign-in on 2026-10-06: the reviewer's
calls are counted in no usage window, so the cap, which keeps a share of
a window unspent, has nothing to keep for them.

capHeld now leaves the user's caps out for a Codex (ChatGPT) account's
call on codex-auto-review (freeOnChatGPT). Credits set not to be spent
still hold it at 100% of a window, as nothing says the backend answers it
there. A review run on another model, or any other model, is held as
before.

Verified:
- TestAccountCapLetsAutoReviewThrough: an account at 92% with a 90% cap
  takes codex-auto-review on Codex's backend path and as
  codex/codex-auto-review, and still refuses gpt-5.5 on both. With the
  exemption disabled it fails with the reporter's exact 429 ("usage cap
  reached: every account that serves "codex/codex-auto-review" ...").
- go test -run 'TestAccountCap|TestCodexNoCredits|TestWindowCaps'
  ./internal/gateway, gofmt -l, GOOS=linux/windows go vet -tags nogui.
- Not tried against the real ChatGPT backend with a capped account.
2026-10-11 21:00:28 +08:00
yetone 8b799cc890 usage, gateway, gui: a request's "In magpie" is magpie's own time, not a try the vendor held before its 503 (#1532, nianlee-official)
The reporter's Codex -> OpenCode Go deepseek-flash request read "In magpie
104 s" with "Vendor's first token 37 s". Record.Sent is the ms from the
request to its answering try's body being written, and by design it
includes the tries that failed first and the pauses after them; the
request detail showed all of it as "In magpie". The reporter's own
routing screenshot shows OpenCode Go answering 503 Service Unavailable
after holding a try ~70-100 s (01:07:08: 3 tries, 222 s), and rows like
01:01:48 / 00:58:27 answered on a second try. Their ledger row showed no
"2 tries" only because that badge came in v0.1.1182.

Now each record also keeps, of Sent:
- own_ms: magpie's own work (before the first try, and in the answering
  try up to its request starting to go out, httptrace GetConn), floor 1;
- retried_ms: from the first try's start to the answering try's, i.e. the
  tries that failed first and their pauses;
- queued_ms: the answering try's wait for a MaxConcurrency / MaxRPM slot.
What's left (Sent - the three) is connecting and sending the body. The
Requests detail shows In magpie, Tries that failed first, Waiting for a
slot, Connecting and sending, Vendor's first token (en, zh, zh-TW, ja,
de). A record written before keeps showing Sent as In magpie. Sent and
Vendor's first token are unchanged. The packed in-memory request rows
carry the three fields (no on-disk format).

Measured: with an isolated gateway and a fake chat upstream, a
Codex-shaped Responses body of 1.79 MB (~330 turns of reasoning,
function_call and function_call_output, 18 tools, zstd encoded, sent
over real HTTP) took 0.64-1.36 s of magpie's own time alone and
0.8-0.95 s with 4 at once, at load average ~228; far from 100 s.

Run: TestSentTellsMagpieFromEarlierTries (upstream holds the first try
1.5 s and says 503, the second answers: Sent 1514, Own <500, Retried
>=1500) and TestSplitSent; on the old code the detail's value is the
whole 1.5 s (reproduced: sent 1514 ttft 1515), and both go red with
splitSent returning (sent, 0, 0). usage-ledger-detail.test.cjs (Chromium
and WebKit, en and zh) adds the reporter's row and fails on the old
app.js ("104 s" where "180 ms" is expected); i18n-keys, gui-ja, gui-de,
gui-zh-tw pass. go test -tags nogui ./internal/gateway ./internal/usage,
go vet (darwin, GOOS=linux, GOOS=windows) and gofmt -l pass.
2026-10-11 20:58:56 +08:00
yetone 3bc9ab152d provider: moved Cursor users get cursor plugin 0.2.7, which keeps an assistant turn's reasoning across a tool continuation (plugins #82, nicegui)
The cursor mover's min goes from 0.2.6 to 0.2.7 so keepMovedCurrent
updates every moved user's plugin. 0.2.7 (magpie-community/plugins
126b105, bump 379ec96) sends an assistant turn's reasoning_content back
to Cursor as a reasoning part, the shape cursor-agent 2026.10.01 sends,
when a tool result continues the turn. npm view shows 0.2.7.

Run: go test ./internal/provider -run 'Moved|Mover|Migrat|KeepMoved|HandOver'
(TestMovedBuiltinsSayTheirPlugin included), then the whole package and
the full suite.
2026-10-11 20:56:21 +08:00
yetone 2df2e0886d plugin, provider, gateway: a plugin's model is listed with every kind it takes and gives (audio, video, pdf), not image alone (#1595, tkhs101)
The plugin host read a model's capabilities.input only for "image", and
fromModelsDev hard-coded output to text, so /v1/models listed
opencode-zen-free's muse-spark-1.3-contributor-free (models.opencode.ai:
input text/image/audio/video/pdf) as ["text","image"] with no output.

- host.js: fromModelsDev and the config merge keep modalities.input and
  .output whole; the listing sends inputs/outputs, the kinds the
  capabilities object marks true, in OpenCode's order.
- plugin.Model gets Inputs/Outputs; pluginCatalog puts them on
  catalog.Model's new InputModalities/OutputModalities (input only where
  the plugin said what it takes, as ImageInput already is).
- catalog: models.dev entries and a vendor's live list (now reading
  modalities.output) fill the same fields; Decorate carries the catalog's
  when the live list says nothing, beside ImageInput.
- provider.Entry.Modalities() is what the gateway lists: the source's
  kinds, with "image" still decided by Images, so the user's own
  "takes images" override still wins and the other kinds stay.

Not changed: the 7 models the report lists as having lost their levels
have reasoning_options [] upstream (models.opencode.ai), so "reasoning,
no levels" is what they are; mimo-v2.6-flash turns away levels (#214).
DSH's model kinds and Muse's list still say text/image only.

Tests: TestPluginModelModalities (gateway) with the reporter's literal
metadata: muse-spark's config as opencode-zen-free 0.1.3's configModels
writes it, and mimo-v2.6-flash-free's capabilities as its models hook
lists them; a model said nothing of stays unlisted, and the image
override drops image only. TestFetchedModalitiesKeepEveryKind (catalog).
Broken by hand: host.js without inputs gives the report's [text image]
(red); Entry.Modalities without the Inputs branch (red); Decorate
without the fill (red). Run: go test catalog, plugin, provider, gateway;
gofmt -l; GOOS=linux and windows go vet on the four; go test ./...
green on 76db4c6c2+this; after rebasing on e9b16ca18 the four packages
again: catalog, plugin and gateway green; provider red once in a run of
all four together (the failing test's name was cut off by a tail), then
green 3 runs of 3, two of them concurrent.
2026-10-11 20:56:21 +08:00
yetone e9f6e48d6a gateway, docs: keepIdle's record no longer says a reply ending after letGo kept a run twice, which serveSubscription rules out (#1596)
d1f0576a7's comment, test comment and subsystem doc named the cause of
a run under two keys as letGo keeping it at backKey and the same
request's ended then keeping it at the turn after. That order can't
happen: serveSubscription's ended callback starts with `if !gone()
{ return }`, and gone is the stop of the context.AfterFunc that calls
letGo, so for one request exactly one of the two runs. The reporter's
own overlap test drove ended by hand while letGo ran, an order the
gateway doesn't produce.

Which callers kept one run twice in the reporter's gateway is not known;
keepIdle, the only writer of b.idle, now holds the rule whichever it
was. The comments and doc say that instead. No code change.

Run: gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gateway, -run TestClaudeIdle ./internal/gateway.
2026-10-11 20:53:02 +08:00
yetone dbe81adae6 gateway tests: TestClaudeIdleEvictionEnds fails on what keepIdle's old loop allocates, not on a 5s deadline (#1596)
d1f0576a7's child process failed the old loop by -test.timeout=5s under
GOMEMLIMIT=64MiB, with 30s for the parent. On a busy machine (load ~130
here) starting the gateway test binary and its TestMain can take a good
part of that, so the passing case had little room. Now the child runs
the keeps in a goroutine and watches TotalAlloc: past 256 MiB without
ending, it exits 2 with what it allocated. The ending loop is done in
microseconds, so its child has 4m and the parent 5m.

The rekey scenario set idleAt before keepIdle stamped it with
time.Now(); it is now set after, so on a coarse clock (Windows) the
stale run is still the oldest and the scenario still reaches the loop.

Run: on origin/main 5c9221899, -run TestClaudeIdle ./internal/gateway
green (each child ~20ms); with internal/gateway/claude_subscription.go
from 76db4c6c2 (before the fix), rekey and stale both red in ~0.5s,
"keepIdle allocated 258 MiB without ending". gofmt -l clean, GOOS=linux
and GOOS=windows go vet -tags nogui ./internal/gateway clean;
go test -tags nogui ./internal/gateway and the full suite before push.
2026-10-11 20:53:02 +08:00
yetone 93e118a578 testenv: a test that runs plugins on a bun older than 1.4.2 is skipped, saying which bun and to install 1.4.2 or newer, not failed on Bun's own differences (#1600, justrun1983)
justrun1983 saw TestPluginModelListThroughAccountProxy fail on main with
"fake-not the list: http://models.invalid:80/list" among the models. The
plugin tests run the bun on PATH (testenv.Bun), and Bun 1.3 names the
default port in a proxy's request line: GET http://models.invalid:80/list,
which Go reads as r.URL.Host "models.invalid:80", so the test's proxy
answered 400 and the fake plugin took the error text as a model. Bun 1.4
sends GET http://models.invalid/list. It wasn't the offline environment:
the test already clears every *_PROXY variable and reaches nothing real.

magpie itself never runs plugins on a Bun older than plugin.BunVersion
(1.4.2, the one it downloads and the floor CheckBun keeps), and CI pins
1.4.2, so an older bun on a developer's PATH tests something no user runs.
On Bun 1.3.0 internal/plugin's TestPluginSOCKSProxy ("vendor
vendor.invalid:80"), TestPluginProxy (the proxy saw
http://vendor.invalid:80/...) and TestPluginHTTP2TakesTheProxy (Bun 1.3's
node:http2 answers status 0, and the host quits) failed the same way.

testenv.Bun now runs `bun --version` once (it already ran it to warm the
binary) and skips with a message naming the bun when it is older than
testenv.MinBun. testenv can't import internal/plugin (whose own tests use
it), so MinBun is a copy, and TestMinBunIsBunVersion fails when it and
plugin.BunVersion differ; BunVersion's comment names it and test.yml's
bun-version.

Run (bun 1.3.0 from npm's @oven/bun-darwin-aarch64 first on PATH, temp
HOME):
- before: gateway TestPluginModelListThroughAccountProxy FAIL with the
  reporter's exact text; plugin TestPluginSOCKSProxy, TestPluginProxy,
  TestPluginHTTP2TakesTheProxy FAIL.
- after: all skipped, packages ok.
A probe of the request line a proxy receives: 1.3.0 sends
http://models.invalid:80/list, 1.4.2 and 1.4.3 http://models.invalid/list.
TestBunOlderThanMinSkips (fake bun printing 1.3.0, 1.4.1, 0.9.9, 1.4.2,
1.4.3-canary, 1.10.0, 2.0.0, nothing) goes red with the skip removed by
hand. With bun 1.4.2: go test -tags nogui ./internal/testenv,
./internal/plugin, ./internal/gateway pass; gofmt -l clean; go vet,
GOOS=linux and GOOS=windows go vet -tags nogui on testenv and plugin pass.
Not run: the full ./... suite, nor the fake-bun test on Windows (it skips
there: the fake is a shell script).
2026-10-11 20:44:39 +08:00
yetone e9b16ca184 gui: a plugin's Update is a button the size of Install, in green, on its card, its row and Update all (#1587, timonwong)
timonwong saw a plugin update announced on Plugins but the button that
brings it hard to find: on a card it was a small chip among the meta
chips ("Update to v0.0.9"), on the Installed row a text link, and Update
all a text link in the footer.

- One updateButton() makes every plugin Update: .pm-act (Install's height,
  min width, padding, font and corners) with .pm-up, green-soft with
  green text, filled green on hover (the app's own tokens; no stripes).
  Its title says the version (or the repo's newer commit for a git one),
  and for a community package that magpie updates by itself within the
  hour.
- A card's one button is Update in place of Signed in / Installed, as an
  app store's Update takes Open's place, and the card's version reads
  "v0.0.7 → v0.0.9" then. Sign in, not done yet, and Move keep their
  place; the Installed row offers Update then. The plugin's page uses the
  same button (actionFor).
- The Installed row's Update and the footer's Update all are the same
  green button.
- The class is pm-up, not update: the title bar's app-update pill owns
  .update (margin, height 22px), which the first try picked up.

Tests:
- new plugin-update-button.test.cjs: at 520px, Chromium and WebKit, en,
  zh, zh-TW, ja, de: the card's Update, the row's Update and Update all
  have Install's height, min width, padding, font, corners and margins,
  are at least Install's width, have a colour that isn't Install's, fit in
  the card, no sideways scroll. On the old plugins.js/css 7/7 fail; with
  the class named update the margins check fails.
- plugin-card-update.test.cjs follows the chip to the card's button.
- every plugin*.test.cjs, both engines: 274/274. The
  first run caught Update taking Sign in's place on the plugin's page
  (plugin-market), fixed by the order above.
JS/CSS only; no Go changed.
2026-10-11 20:10:05 +08:00
yetone b7a926e9aa library, gui: a market search one source of which didn't answer says which, over what the rest found, not a failed search; a 503 is asked once more (#1589, Ti800)
Ti800 searched the Library's Discover for "prototype" and saw the amber
error "couldn't search skills.sh: www.skills.sh answered 503 Service
Unavailable" over two results. The cause was neither a stale request
(fetchMarket already drops an answer whose seq is old, results and error
alike) nor an error left over from an earlier search: MarketSkills matches
skills.sh's most-installed list (front page, cached) and magpie's picks
itself, then asks skills.sh's search. The search answered 503; the two
cards were the most-installed list's matches, and the handler sent both
the list and the search's error, which the page drew as a failed search.

- library: the search's failure is a SearchError naming its source
  (skills.sh, the MCP Registry); get() asks once more after a 503, after
  a one-second pause (one extra try, nothing else retried).
- gui: /api/library/market/{skills,servers} add failed and cause beside
  error. With results, the page says in a muted line with an amber dot
  that skills.sh's search (or the MCP Registry) didn't answer and why, and
  that these are only the matches among magpie's picks and the most
  installed (or magpie's featured servers). With no results the error bar
  is as before. Strings in zh, zh-TW, ja, de.

Siblings: the MCP market has the same shape (featured + registry) and gets
the same notice. The Plugins page's npm search already shows its error in
the "On npm" section only, beside the market's own list, keyed by query.

Tests:
- internal/library TestSkillsSearch503 (httptest fake skills.sh): 503 then
  200 gives the search's results and no error; 503 every time gives the
  popular match and a SearchError for skills.sh, searched exactly twice.
  With the retry taken out it fails: "after one 503:
  [mattpocock/skills/prototype] couldn't search skills.sh: … 503 …, 1
  searches".
- internal/gui TestMarketOfNamesTheFailedSource.
- gui tests market-partial.test.cjs: the reporter's case (two results +
  skills.sh 503), nothing found (error kept), an older search's 503
  answered 1.2s after a newer search's results (nothing changes), and the
  MCP Registry case; Chromium and WebKit, en/zh/zh-TW/ja/de, 520px wide:
  10/10. With the new branch disabled, 5/5 Chromium fail with "the partial
  list is shown as a failed search". market-*.test.cjs and
  library-discover-jump: 114/114.
- go test ./internal/library ./internal/gui, gofmt -l, GOOS=linux and
  GOOS=windows go vet -tags nogui on both packages; full suite in the
  push record.
Not tried against the real skills.sh (it answers 200 now); the fake
answers 503 as the report's text says.
2026-10-11 20:10:05 +08:00
yetone 5c9221899f sessions, agent: MiniMax Code's own calls reach Usage's split by agent, and its 0.6.8 User-Agent names it (#1605, LukeZ1988)
Usage's split by agent counts the gateway's calls and the calls the
agents' session files record (sessions.Calls). MiniMax Code had no
session reader at all, so a MiniMax Code on its own MiniMax sign-in or a
relay of the user's never showed in it.

What @minimax-ai/code 0.6.8 really writes, run in a sandbox HOME and
MINIMAX_DATA_DIR against a fake Anthropic upstream: each session is a
folder under <data dir>/v2/sessions/<yyyy>/<mm>/<dd>/, named
<time>-session_<base64 of its mvs_ id>, its messages in messages.jsonl.
An assistant line names the provider and model that answered, its usage
(input without the cache, output, cacheRead, cacheWrite, as pi's ai
package counts them) and the time in ms. The new reader
(calls_minimax.go) is a whole-file call source (callSources,
wholeCallReaders), and the folder is watched (Dirs). A call through
magpie's own entry (custom_provider:magpie) is skipped; the gateway
already counted it, with the account that answered. A reply is keyed by
its message_id, so one copied into another generation of the history
counts once.

Gateway side: magpie's entry sets User-Agent minimax-code, and the sandbox
run showed it reaching the upstream on /v1/messages and count_tokens.
0.6.8 without that header (a provider pointed at magpie by hand) sends
"MiniMaxCode", which now names minimax-code too. The class check:
StepCode, jcode, Prime Agent, Snow and every other built-in agent are
named by their own gateway key (TokenFor); TestEveryAgentNamedByItsKey
guards that for all of Clients(). Their direct, non-gateway calls are
not read yet, and neither are those of pi, Cline, Qoder, Grok, Droid,
omp, Cursor, Hermes and Alma, which the Sessions page reads (filed
as #1607).

Run: TestMiniMaxCodeCalls (the two real messages.jsonl files, verbatim:
three calls through magpie's entry and one on a relay; under ~/.minimax
and under MINIMAX_DATA_DIR) passes; dropping the gateway skip by hand
turns it red (4 calls). TestAgentOf (MiniMaxCode, minimax-code),
TestEveryAgentNamedByItsKey. go test ./internal/sessions
./internal/usage, the agent tests named above, gofmt -l, GOOS=linux and
GOOS=windows go vet. Not tried: MiniMax Code on Windows or in WSL (WSL
distros' MiniMax sessions are not read), a call on the MiniMax sign-in
itself (provider name taken from the file whatever it is), or a session
after compaction.
2026-10-11 20:09:15 +08:00
yetone 6b5181b927 agent: Codex on a relay or with several accounts in magpie offers its GPT models via magpie too (#1603, SwimmingLiu)
Codex's picker left out the models magpie serves on the Codex accounts
in it (codex/...) whenever Codex wasn't routed through magpie, on the
reasoning that going via magpie to Codex's own sign-in only adds a hop.
That holds only when Codex is on its own ChatGPT sign-in and that one
account is alone in magpie. With Codex on CC Switch's custom relay, the
accounts in magpie are not what Codex is on, and with several accounts
on, magpie routes over them; the reporter saw the GPT models direct
only, with no 经 magpie entry.

modelOptions now offers them via magpie, beside the direct ones, unless
Codex is on its own sign-in with a single account. The stopped-WSL
distro's options do the same when several accounts are on. Listing the
options writes nothing.

Run: TestCodexAccountsOfferedViaMagpie (relay + two accounts, relay +
one account, own sign-in + one account) failed before and passes after;
forcing the old branch by hand turns the third subtest red.
codex-accounts-via.test.cjs: Chromium and WebKit, en and zh, 980 and
420px, 8/8 (the API is faked; the GUI itself is unchanged, no new
strings). go test -tags nogui ./internal/agent, gofmt -l, GOOS=linux
and GOOS=windows go vet clean. Not tried with real Codex accounts.
2026-10-11 20:09:15 +08:00
yetone 9852eeb07a provider: a key whose model list didn't answer still takes requests, not left out as unlisted (#1598, wuwei0727)
A provider with several keys keeps the first in key/keyName and the
rest in keys; that split is how it is stored. When the vendor's /models
didn't answer the first key (a 429, a timeout) or a key was added since
the last fetch, the per-key catalog had no list carrying it, and
Provider.Serves read that as "this key sees none of the models". The
gateway's perKeyBarred then put it in unlisted on every request, and
Routing showed four of five keys.

Serves now treats a key that no list marks as unknown, which serves: a
failed list is not an empty one. A key whose own list did answer still
serves only what that list has. Nothing in the saved keys changes.

TestCountTokensKeyFailover's k-unlisted stood for a key outside m1's
list by being in no list at all, which now reads as unknown. Its list
now answers with another model (m2), which is the case the test guards:
it is still skipped.

Run: TestKeyWithNoListStillServes (the reporter's shape: xx1 in key,
xx2..xx5 in keys, xx1's list answers 429, xx5 lists one model) failed
before the fix and passes after; go test -tags nogui ./internal/provider
and ./internal/gateway ok; the full suite found the count_tokens fixture
above, nothing else; gofmt -l clean; GOOS=linux and GOOS=windows go vet
clean. Not tried: the reporter's own providers.json (the attached zip
returned 404) or a real multi-key vendor. A key whose list answers
empty is now tried too, as nothing marks it.
2026-10-11 20:09:14 +08:00
yetone 6f1b432759 provider, gui: smart routing spends WorkBuddy credits that expire soonest first (cdredfox on X)
WorkBuddy's Credits window had no reset, so in a Smart group every
WorkBuddy account ranked alike. workbuddy plugin 0.1.14 (plugins f0274d6)
reads WorkBuddy's own package lists (billing/meter/get-user-resource-paid-
packages and -free-packages, the calls WorkBuddy's client makes) and reports
on the Credits window when the soonest-ending package that still has credits
ends (runsOutAt) and how many credits it holds (runsOut). The daily Free
Plan slice (CapacityType 4) and code 001 aren't counted: they renew daily.

magpie carries runsOutAt from the plugin's usage window into QuotaWindow and
the routing Limit. Allowance.Renewal, which only Smart ranks on, treats it
as the window's reset when it is sooner than the real one. Pace, the tiers,
For, Full and resting are unchanged. The mover's min is raised to 0.1.14 so
moved users get the plugin. The usage card and account meter say "232.4
expire in 5h" in every language.

Run:
- plugin: bun test, 63 pass; 2 of the 3 new tests fail on 0.1.13's
  index.mjs. Verified live on a workbuddy-ai account in a sandbox HOME:
  Bonus Pack 232.4 left ending 10-12T16:39Z ranked before Pro (10-28).
- TestWorkBuddyCreditsRunOutForRouting and
  TestSmartSpendsWorkBuddyCreditsRunningOutFirst: both fail with the
  Renewal change removed by hand.
- GUI: credits-run-out.test.cjs in webkit and chromium, 5 languages, at
  360/440/1000px, red on the old app.js; with i18n-keys, quota-*,
  panel-usage, reset-each-title, usage-fold: 117 pass.
- go test ./... green (agent and gateway rerun with -timeout 30m after the
  default 10m ran out under load from other sessions; 378s and 492s).
- gofmt -l clean; GOOS=linux and windows go vet of provider, plugin,
  gateway clean.

Not tried: the CN workbuddy site (its token was stale, 401), so the CN
package list is assumed to have the same shape. The built-in WorkBuddy
(not moved users) doesn't get this. The account-line tooltip has no GUI
test of its own.
2026-10-11 20:07:19 +08:00
yetone b755607e63 provider: the built-in Grok offers each context window Grok lists, grok-4.7@500k beside grok-4.7, as the CLI's /context-window does (#1608, yhong91)
Grok's /v1/models lists each model at context_window 256000 (the
default) and context_windows [256000, 500000]. parseGrokModels read only
context_window, so magpie's catalog had every Grok model at 256K while
the Grok Build CLI offers 500K.

Now, as the grok plugin does since 0.1.12 (plugins#83, for moved users):
- grokContextModels offers the default at the plain id (a saved agent
  stays where it was) and each other listed window beside it as
  <id>@<N>k, named "<name> @ <N>k", Context that window. A model whose
  list has one size, or none, stays one model.
- grokSigned sends grok-4.7@500k as model grok-4.7, with
  x-grok-model-override: grok-4.7 and x-grok-context-window: 500000, the
  header the CLI 1.0.50 sends for /context-window 500k. The body is
  rewritten in the signer because Prepare runs before Sign, which reads
  the window from the prepared body.
- pricedNames prices grok-4.7@500k as grok-4.7 (grokWindow), as it
  already prices grok-4.7-xhigh; only Grok ids are read this way.

Not taking the largest window as context_window, as the issue suggests:
the CLI asks for 500K with the header, and the plain id keeps asking at
the default as before.

Run:
- HOME=<temp> go test -tags nogui ./internal/provider/: ok.
  go test -run 'Grok|Price' ./internal/gateway/: ok.
- Broken by hand: ignoring context_windows turns
  TestParseGrokModelsWindows red; not setting the header or rewriting
  the body turns TestGrokSignsWindow red; dropping grokWindow turns
  TestGrokEffortListPrice red.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui
  ./internal/provider clean.
- The same wire request (body model grok-4.7, x-grok-context-window:
  500000) answered 200 on a real SuperGrok account through the plugin
  during plugins#83's review.
Not tried: the built-in itself against a real account; whether Grok
compacts any differently at 500K.
2026-10-11 20:06:04 +08:00
yetone bac81385ab gateway: an image answer that stalls says whether it was coming as a url or as b64_json, how much had come and how long nothing more had (#1576, david-zdw)
david-zdw found their relay answers the same size as a 416 B url on one
domain and as a 3 MB b64_json body taking 380 s on another. The 504 "began
answering after … but hadn't sent all of its answer in 5m0s" didn't say
which, and the two point at different fixes: a url answer stuck after its
start, or the image's own bytes coming too slowly.

Change: sendWith reads the vendor's body through a reader that notes when
its last bytes came. On the deadline the error goes on: "it was sending
the image itself as b64_json; 3.0 MB had come, and nothing more for the
last 40s" (or "it was answering with the image's url, not the image; …",
or that what came doesn't yet say which).

Run:
- TestStalledAnswerSaysUrlOrB64 (a b64_json body and a url body, each
  stopping mid-answer), TestSizeOf, and TestVendorThatStopsMidAnswerIsSaid
  updated for the 21 B it got; the draw/fetch tests pass.
- go test ./internal/gateway, gofmt, GOOS=linux/windows go vet -tags nogui.

Not done: b64_json is still read whole into memory, not decoded to disk as
it comes. The image is passed on as bytes all the way to the agent's
answer, so streaming it would change every drawer; left for its own change.
Not tried against the reporter's relay.
2026-10-11 19:59:15 +08:00
yetone e9ae318589 gateway: a relay's 500 "负载已经达到上限" is a busy server, not quota, so a group's Patience waits it out (#1418, real-jacket)
real-jacket's relay answered 500 "当前模型 gpt-5.5 负载已经达到上限,请稍后重试
(request id: …)". usedUpWords matched 上限, so failure() called it
failQuota: the key rested till a reset and busy() (5xx only when
failOther) never let Patience wait, so the agent got the 500 at once.

Change: a 5xx is out of quota only on a vendor's own quota code
(quotaCodes: Claude Code's "usage limit reached|<unix>",
usage_limit_reached, RESOURCE_EXHAUSTED). The quota words still classify a
4xx, and the 429 plan words are unchanged; credit is unchanged.
gateway-routing.md says so.

Run:
- routing_test's failure table: the literal 500 → failOther; a 503
  "upstream quota service unavailable" → failOther; 500
  usage_limit_reached and 503 RESOURCE_EXHAUSTED → failQuota; 403
  "今日额度已达上限" → failQuota; 429 "当前分组上游负载已饱和" → failRate.
- New TestGroupWaitsOutRelayLoadLimit (two members answering the literal
  500, Patience 240): fails on the old code with the 500 (a 1, b 3), now
  200 after a replan with no quota rest.
- go test ./internal/gateway, gofmt, GOOS=linux/windows go vet -tags nogui.

Not done: a 429 with the same load wording still reads as quota (no
literal case of it seen).
2026-10-11 19:59:15 +08:00
yetone 691858e064 gateway: a Codex routing group that falls to DeepSeek sends every tool call with reasoning_text, so DeepSeek no longer refuses it with 400 (#1592, waangzh)
What the reporter saw: a Codex mixed group (ChatGPT first, DeepSeek after)
answered 400 "The `reasoning_text` in the thinking mode must be passed back
to the API." once the turn fell to DeepSeek.

Cause, checked against the real api.deepseek.com/v1/responses on 2026-10-11
with the owner's key: DeepSeek refuses a history where
- a reasoning item is sealed only (ChatGPT's encrypted_content, no summary),
- a function_call/custom_tool_call has no reasoning item in its step (an
  assistant turn ChatGPT answered without one, or a second step), or
- a reasoning item's reasoning_text is empty.
It accepts reasoning_text " " (with or without encrypted_content and id).
withReasoningText only filled the third case.

Change:
- withReasoningText (passthrough) walks the input by step: a reasoning item
  with no text gets its summary, else noReasoning (" "), keeping its other
  fields (encrypted_content, id); a tool call with no reasoning item since
  the last output or user message gets one with noReasoning before it.
- buildResponses (translated, e.g. an Anthropic agent onto DeepSeek's
  Responses) does the same for a tool call with no thinking before it.
- Only where replaysReasoning says so (DeepSeek); gpt-5.4 on a relay gets
  no reasoning_text.
- gateway-routing.md describes the Responses replay.

Run:
- The reporter's 400 reproduced on the real API, directly and through the
  old binary (direct model and group/codex-different); the new binary
  answers 200 completed for each case, whole and streamed.
- New TestDeepSeekGroupMemberAfterChatGPT (8 subcases) and
  TestTranslatedDeepSeekCallWithoutReasoning fail on the old code, and
  TestDeepSeekReasoningPassedThrough's empty item; all pass now. The fake
  now refuses what the real API refuses.
- go test ./internal/gateway, gofmt, GOOS=linux/windows go vet -tags nogui.

Not done: DeepSeek's Anthropic endpoint has the same rule (a tool_use with
no thinking is refused, checked live); not changed here. Kimi and GLM
thinking were not checked: no key, and magpie has no replay rule for them.
2026-10-11 19:59:15 +08:00
yetone f716bdba99 provider: moved Grok accounts update to grok plugin 0.1.12, which offers each context window Grok lists (plugins#83, guoqchen1001)
The grok mover's min goes from 0.1.11 to 0.1.12, so keepMovedCurrent
updates every moved Grok user's @magpie-community/opencode-grok-auth.

0.1.12 (magpie-community/plugins#83, merged as 8260d979) offers a model
Grok's /v1/models lists at two context windows at each one: grok-4.7 at
the default 256k and grok-4.7@500k. The plugin's fetch sends the plain
model with x-grok-context-window: 500000, as the Grok Build CLI 1.0.50
does with /context-window 500k. The model's api.id is the offered id,
since magpie's modelAPIID/withModel put api.id in the body.

Run:
- npm view @magpie-community/opencode-grok-auth@0.1.12: published.
- HOME=<temp> go test -tags nogui ./internal/provider/: ok.
- gofmt -l internal/provider: clean. GOOS=linux and GOOS=windows
  go vet -tags nogui ./internal/provider: clean.
- The plugin at 0.1.12 was tried on a real Grok account (in the PR's
  record): grok-4.7 and grok-4.7@500k each answered 200.
Not tried: a moved user's plugin actually updating through
keepMovedCurrent on a real install.
2026-10-11 19:55:50 +08:00
yetone 35eea09464 gateway: a provider routed its own way keeps that order inside a group that routes another way (kchen0x on X)
kchen0x had a Smart routing group with Antigravity (9 accounts, set to
按顺序) and a Business account. Requests still went to the 9th account, the
one renewing soonest. planLevel pooled every member's keys and accounts
into one list for any group not routed in order, so the provider's own
routing was never read; Smart then put the soonest renewal first.

Now a member whose provider routes other than Smart, and other than the
group does (ownRouting), is planned as a nested group already is: a unit
weighed by the first account or key it would try (firstAwake), then tried
whole in its own order. A provider left on Smart is pooled as before.
leastHeld, which reorders a rotate group's first request, leaves such a
group alone as it does one holding a nested group (without that, a
rotate group still came back "k2 k1 k3 kb").

GUI hint (GROUP_NEST, 4 languages), start docs (en, zh, ja) and
gateway-routing.md say so.

Run:
- TestProviderKeepsItsOwnRoutingInAGroup covers outer Smart, rotate,
  usage, pace and manual, plus a Smart provider still being pooled. On
  the old planLevel it fails with "k3 k2 k1 kb" (the reported order).
- go test -tags nogui -count=1 -timeout 40m ./...: all ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/gateway.
- GUI: i18n-keys, gui-ja/de/zh-tw and every *group*/*routing* test, both
  engines: 765 pass. A first run beside the full go test had 9 webkit
  timing reds (routing-group-fold, routing-keys-fold, routing-ctx-still,
  gateway-key-groups); each file passes alone, and the whole set passes
  when nothing else runs.
2026-10-11 19:54:55 +08:00
yetone 917a365778 gui: opening the Usage page or the tray panel's Allowances reads the allowances now, once in 30s (#1588, qq666666qq)
On Windows the tray panel's Allowances tab, and the window brought back
on Usage, showed the reading magpie kept until "Read the allowances
again now" was pressed: picking the panel's tab and the panel shown
again only loaded usage/quotas without ?asked=1, which hands back the
backend's cache, and so did the window coming back to the front on
the Usage page.

Opening the allowances is now asking to see them (quotasOpened), as
Refresh now is and as #1518 counts the Usage page opened:
- the window: Usage from the nav (as before), the Overview tab picked,
  and the window back to the front on the Overview;
- the tray panel: the Allowances tab picked, the panel brought up on it
  (focus / visibility), and a menu bar cell clicked (panelQuotaFocus).
A panel page loaded while it is put away (hidden or without focus)
doesn't ask, so a panel prepared at login sends nothing with allowance
reads at "When I ask".

An asked read makes the backend read every account again (AskUsage
clears the caches; only Claude has its own 30s floor), so an opening
within 30s of the last asked read (QUOTAS_OPEN_GAP) sends an ordinary
read instead: switching tabs and back, focus and visibilitychange both
firing, focus-follows-mouse don't reach the vendors again. Reads stay
one at a time: an opening during an ordinary read goes after it
(loadQuotas, unchanged). Refresh now still asks every time; the timed
refresh is unchanged and never asks.

Written against main from qq666666qq's fork patch
(qq666666qq/magpie#1), which asked on every tab click and every return
without a gap; this keeps their entries and adds the gap, the Overview
tab, and the hidden-panel guard.

Run: new allowance-open-read.test.cjs (Chromium and WebKit, en and zh,
panel at 360px): passes; red on the old app.js (the panel's Allowances
never asks; the window re-asks on every nav click), red with
QUOTAS_OPEN_GAP = 0, and red with the window-return line removed. The
GUI tests touching the allowances (every test naming usage/quotas, the
Usage view or the panel's Allowances tab) in both engines, and
go test -tags nogui ./internal/gui. No Go changes. Not tried in the
native Windows tray.

Of the GUI run (3164 tests, load ~120-230), the 8 failures passed when
their files were run again, except library-mcp-tool-switch in WebKit,
which fails the same with main's app.js (76db4c6c2): filed as #1609.
Rebased onto f6e1e98ee; the new test, claude-usage-asked, panel-usage,
panel-arrange, click-scroll and ./internal/gui run again after it.
2026-10-11 19:46:37 +08:00
yetone f6e1e98ee6 gateway: the ChatGPT backend is spoken to over HTTP/1.1, as Codex and Pi speak to it (jasonz3g on X: Codex in Pi through magpie ends now and then with "stream error: stream ID 21; INTERNAL_ERROR; received from peer", never Codex or Pi alone)
The gateway's client speaks HTTP/2 wherever a server offers it, so every
Codex stream, every account's, went to chatgpt.com on one shared HTTP/2
connection, where Cloudflare's RST_STREAM ended a reply mid-way. The
official clients never speak HTTP/2 there: codex-cli 0.162.0, pointed at
a local TLS server, offers no ALPN at all (HTTP/1.1), and Pi's own Codex
provider (pi-ai) uses a WebSocket or Node's fetch, HTTP/1.1 both.

Requests to provider.CodexBase's host now go through an HTTP/1.1-only
transport (codex_http1.go), otherwise the same as the gateway's: proxy
dispatch, IPv4 fallback, head timeout, idle pool. Every other vendor
still gets HTTP/2. Covers the Codex subscription served to any agent, the
Codex agent's own passthrough and the models list, as all go through
s.client.

What was run:
- TestCodexBackendOverHTTP1: two TLS servers offering HTTP/2; the Codex
  one is asked over HTTP/1.1, the other over HTTP/2.0. Fails without the
  change ("asked over HTTP/2.0, not HTTP/1.1").
- go test -tags nogui ./internal/gateway ./internal/netproxy
  ./internal/provider under a scratch HOME pass; gofmt; go vet (darwin,
  GOOS=linux nogui, GOOS=windows).
- curl --http1.1 to chatgpt.com/backend-api/codex/models answers over
  HTTP/1.1 (401 unsigned).

Not reproduced: the reset itself is occasional and wasn't seen here, so
whether this alone ends it is for the reporter's use to say. A cut that
comes after the reply has begun still ends it with "connection lost
mid-reply", which Pi retries.
2026-10-11 19:38:33 +08:00
yetone 99548470d0 gateway: Claude Code's billing line no longer goes to vendors' models, so their prompt cache is read again (#1600, justrun1983)
Claude Code puts `x-anthropic-billing-header: cc_version=…;
cc_entrypoint=…; cch=…;` in system[0], a block of its own whose cch
changes every turn. magpie sent it on to every upstream, so a vendor's
model read it as the first words of the prompt and its prefix cache
missed from byte 0 on every turn: the reporter's Claude Code on
commandcode-plan/deepseek-v4.1-flash read 4.1% of its input from the
cache, ~96-99% with the line turned off in Claude Code.

The line now goes on only to a Claude model asked on Anthropic's
Messages API (a key's, a relay's, Bedrock's), byte for byte as Claude
Code sent it (keepsBillingLine, billing_line.go). Everywhere else it is
left out and the rest of the system goes as sent, cache_control included:
- a vendor's model relayed on Messages (passthrough: DeepSeek's,
  Command Code's Provider API, a moved plugin's Messages);
- every translation to Chat, Responses or Gemini (forwardTranslated,
  a Claude model on Chat too: it is for Anthropic only);
- the subscriptions asked through their own clients' APIs: Cursor,
  Devin, Kiro, Qoder, Zed and Command Code's Go plan (attempt).
Untouched: the Claude subscription (its run sends its own, already
without the caller's: withoutBillingHeader), another magpie (it decides
for the provider it picks) and Code Assist, where antigravityTurnsAway
reads the line to explain Antigravity's refusal (#666).

Tests use the reporter's literal block (cc_version=2.1.114.aff;
cc_entrypoint=sdk-cli; cch=…): TestBillingLineLeftOutForVendors sends
two turns differing only in cch through Messages (DeepSeek), Chat
(DeepSeek and a Claude), Responses and Gemini upstreams and requires the
same body without the line; TestBillingLineLeftOutOnCommandCode does it
for Command Code's Go plan and Provider API; TestWithoutBillingLine
covers the system string, the line inside a first block, a system of the
line alone, and mentions that stay. TestBillingLineKeptForClaude and the
existing TestClaudeCodeBodyReachesRelayAsSent require a Claude model's
Messages body unchanged byte for byte. Broken by hand: dropsBillingLine
returning false turns every vendor subtest and the Command Code test red;
the backend strip removed turns the Go plan check red; keepsBillingLine
returning false turns both Claude tests red.

Run: go test -tags nogui ./internal/gateway (whole package), the full
suite under the queue lock, gofmt -l, GOOS=linux and GOOS=windows go vet
-tags nogui ./internal/gateway. Not tried against a real DeepSeek or
Command Code account: the cache-hit numbers are the reporter's.
2026-10-11 19:37:06 +08:00
yetone 15872d977a gui: with the window open, magpie leads Command-Tab's order, so one Command-Tab away and one back returns to it (#1381, ttmouse)
ttmouse on v0.1.1168: open magpie's window, Command-Tab to another app,
Command-Tab back, and magpie is last in the switcher.

Cause: magpie is out of the Dock (Accessory) until the window opens.
With Settings > Dock set to "while the window is open" (or a full-screen
window), the quick panel's focus activates magpie while it is still
Accessory, and it joins the Dock (Regular) after that. An app activated
before it joins stays last in LaunchServices' front-to-back order
(lsappinfo visibleProcessList), which Command-Tab follows, though it is
frontmost. Wails' Focus only calls activateIgnoringOtherApps when the
app isn't active, and calling it again while active is a no-op. setDock
also ran async (dispatch_async), so openMain's Show/Focus could come
before the policy change.

Fix:
- setDock runs on the main thread at once (InvokeSync), so openMain
  joins before it shows the window.
- A pure dockStep(regular, on, active, front) decides the move. Joining
  while already active activates the Dock and then magpie again
  (activateAgain), which puts magpie first in the order. Joining while
  not active just activates it; leaving never re-activates.
- The full-screen join does the same once the window is in full screen
  (DidEnterFullScreen) if magpie was active when it joined.
- Dock "off" (the default) is unchanged: magpie stays out of the Dock
  and out of Command-Tab, by design. The tray panel's behaviour is
  unchanged.
- docs/subsystems/gui-shell.md: Runtime path item 7 for the Dock setting.

Run:
- TestDockStep (table, pure). TestDockJoinLeadsCommandTab (darwin GUI
  build): a real Accessory Wails app activated, then setDock(true,
  true) + window Show/Focus, asserts it is first in lsappinfo's order.
  Red with `again` forced false (front was the test, kitty first in the
  order), green with the fix.
- go test ./internal/gui (GUI build, darwin) passes; full
  go test -tags nogui ./... passes; gofmt -l clean; go vet ./internal/gui
  (darwin) and GOOS=linux / GOOS=windows go vet -tags nogui clean.
- Real build on this Mac, sandbox HOME, own bundle id, port 3481,
  DockWindow on: launched with the quick panel, window opened through the
  Mac's reopen, then two osascript Command-Tabs. Old build: magpie front
  but 11th of 11 in the order (the report). New build: magpie 1st; after
  Command-Tab, the other app 1st and magpie 2nd; Command-Tab again brings
  magpie back. Dock "always": magpie 1st, round trip works. Dock "off":
  stays UIElement, not in the order.

Not tried: the full-screen path in the real build, a human Command-Tab
(only osascript keystrokes), real accounts (not involved).
2026-10-11 19:30:17 +08:00
yetone 0896e9fad1 provider tests: waitPast waits up to signInDeadline, as waitDone does, not 5s
c702d9cfe (#1552) moved the sign-in tests' waits from 2s to
signInDeadline (90s), since a loaded CI box runs every package's binaries
at once. waitPast, the same wait for leaving any state, kept its own 5s.
At load ~125, TestSignInInstallsMissingCLI and TestMovedSignInAsBuiltIn
went red here with "still installing" after 5.0-5.8s, 3 of 40 runs.
waitPast returns as soon as the state moves, so the longer bound costs a
passing run nothing.

Ran:
- 6s injected into both fake installers after their release: the old
  bound red in both ("still installing"), this one green.
- go test ./internal/provider (at load ~120); gofmt -l; go vet, GOOS=linux
  and GOOS=windows go vet ./internal/provider.
2026-10-11 19:28:08 +08:00
yetone 2ff4ecb42d provider: the Devin install tests' held installer gives up when its test ends, and writes the CLI without the test's t
TestSignInInstallsMissingCLI and TestMovedSignInAsBuiltIn hold their fake
installer on a channel the test closes only after its first checks. A
Fatal before that left the installer blocked for the rest of the package's
run. f3c098da8 fixed the same hold in the Grok sibling with a cleanup;
these two were already gated and kept the leak. The hold now also ends on
the test's cleanup, and the installer returns an error then.

The installsMissingCLI fake also called testenv.Program(t, ...) on the
sign-in's goroutine. Under load (~125) its test hit waitPast's 5s first,
and the fake's late t.Fatal panicked the whole package ("Fail in goroutine
after TestSignInInstallsMissingCLI has completed"). It now uses
testenv.WriteProgram and returns the error.

Ran:
- An injected t.Fatal right after StartSignIn / StartPluginSignIn, plus a
  test that dumps goroutines a second later: on origin/main the fake is
  still blocked at install_test.go:40; with this, nothing is left.
- -race -count=20 of both tests, 2 runs each beside origin/main at load
  ~125-140: green on both.
- gofmt -l; go vet, GOOS=linux and GOOS=windows go vet ./internal/provider.
2026-10-11 19:28:08 +08:00
yetone 51042630ec gui: Settings has a search box that shows only the settings whose name, words or part match (sgfvdsg86265, jasonidae, daguoagi on X)
Three X posts found the GUI's settings too many to look through. A box at
the right of Settings' tabs now finds a setting by its name, its
description or its part's name, in the shown language and in English
(data-en), so "currency" finds 货币 too. While searching, the tabs hide,
every part with a hit shows under its name, rows that miss hide, and a
warm-up pane shows under its agent's name. Escape or clearing the box puts
back the tab that was open. Rows that render later are found as they come
(a MutationObserver re-runs the search).

Run: settings-search (new), settings-sections, settings-groups,
settings-shortcut, webdav-settings-refresh in chromium and webkit, 50/50;
settings-search covers en, zh, zh-TW, ja, de at 560x420 and magpie web on
a 390px phone with no overflow, nothing posted, nothing scrolled. go test
-tags nogui ./internal/gui/..., gofmt, go vet (darwin, linux nogui,
windows). Screenshots looked at for zh and the phone.
Not done: shortening the settings' own descriptions.
2026-10-11 19:21:35 +08:00
yetoneandSma1lboy d1f0576a78 gateway: a Claude run kept again leaves its old key, so letting go past idleMost ends instead of spinning with the bridge locked (X, Sma1lboy)
Sma1lboy found magpie at 158 GB after two days with many omp agents on a
Claude subscription, and traced it to keepIdle.

Cause: letGo keeps a run at backKey when the client goes away mid-reply,
and the reply's ended can then keep the same run at the turn after. The
run sat in b.idle under both keys. Past idleMost, the eviction loop picked
that run as oldest on every pass but deleted only run.idleKey (the newer
key, then ""), so len(b.idle) never fell: the loop never ended, held b.mu
(stopping every Claude subscription request) and appended to drop
without bound.

Fix: keeping a run again removes its earlier entry when that entry is
still its own (not a run that replaced it), and the eviction loop deletes
the map key it found as oldest, aborting each run once.

Run: go test -tags nogui ./internal/gateway/ (ok, 396s); gofmt -l clean;
GOOS=linux and GOOS=windows go vet ./internal/gateway clean. The new
TestClaudeIdleRunMoves and TestClaudeIdleEvictionEnds (rekey and stale,
in a child process) fail on the old keepIdle: the child times out in the
loop. Not reproduced with a real two-day omp workload.

Co-authored-by: Sma1lboy <541898146chen@gmail.com>
2026-10-11 19:10:43 +08:00
yetone 85089a2400 gui: a routing group whose plugin lists none of its models no longer blanks the Routing page; it shows as matching nothing, the rest as ever (#1585, dbydd)
The reporter's Routing page showed only "null is not an object
(evaluating 'g.members.map')" and no group, while every group still
routed. A group made of patterns only whose models a provider stops
listing (a plugin behind on updates) has no members, and Go's nil slice
went out of /api/groups as "members": null. groupRow, pickedRow, the
filter and the group editor (inGroups reads every group) all call
members.map/some/flatMap, so one such group threw out the whole list.

- groups.go: groupsState says a group's members as [] when it has none,
  and an unmakeable template's too.
- providers.go: the Gateway's group entries say icons and providers as
  [], never null (app.js gatewayModels joined g.providers).
- routing.js: every /api/groups response goes through groupsFrom, which
  makes each list a list and leaves out an entry that isn't a group;
  drawGroups draws a group that still throws as one flagged row
  ("This group can't be shown: …", zh/zh-TW/ja/de), never the whole list;
  the filter shows such a group rather than throwing.
- app.js: gatewayModels reads null icons/providers as none.

Verified: a probe through provider.SaveGroup({Match: a/m*}) then the
provider listing other models gave "members":null on main; the Go test
TestGroupsNeverNullMembers goes red with groups.go reverted (group and
3 templates null) and green with it. GUI test group-null-members.test.cjs
uses that response's literal bytes: 12/12 red on the old assets, 12/12
green now (Chromium + WebKit, en + zh, 1100 and 420 wide, plus the
Gateway list). gui-de, gui-ja, i18n-keys, group-*, panel-routing,
gateway-model-info and the routing-manual/save/provider-off tests pass
(221/221). Which plugin the reporter has was not asked; the fix covers
any provider whose models a pattern group stops matching.
2026-10-11 18:57:48 +08:00
yetone 76db4c6c28 main, agent: --help on any command or agent only prints its usage, and Snow and Gemini CLI refuse a value they don't know instead of taking magpie out (#1457, blackrion)
`magpie snow --help` printed "✓ Snow CLI model --help" and did what
`magpie snow default` does. It deleted profiles/magpie.json, put back the
active profile, and wrote "--help" as advancedModel into the profile it
went back to. There were two causes:

- run's agent forms took any second argument as a model. The `len(args)==2`
  branch special-cased only `default`.
- Snow's model Set, on magpie's profile, treated a value no profile of the
  user's is on as "leave, and write it into the profile left for".

The arguments were the class, not Snow alone. Under the old code, `magpie
claude --help` and `magpie codex --help` wrote "--help" as Claude Code's
and Codex's model, and `magpie save --help` saved a profile named
"--help" (the new guard test caught each of these).

What changed:
- help_cli.go and run: -h or --help anywhere in the arguments, or help as
  the word after the command, prints that command's usage and returns
  first, before run reads, moves or starts anything. It prints the
  command's own usage where it has one (model, group, group rule, library,
  plugin, quota, sessions, search, visible, webdav, s3, claude-code), its
  lines of magpie's usage otherwise, and for an agent its forms and
  fields. The usage gains a `magpie <command> --help` line.
- `magpie <agent> …` refuses any other argument starting with "-"
  (negative numbers aside): "unknown flag X: nothing was changed".
- snow.go: on magpie's profile, a model that is neither through magpie
  nor any profile's model is refused, and the files stay as they were.
  A `magpie/<x>` that isn't in the catalog is refused on or off magpie's
  profile; it used to fall through to the same leave. A model of one of
  the user's profiles still switches Snow there, and empty still goes
  back to the profile they were on.
- gemini.go, a sibling found by auditing every agent's Set: provider is
  Gemini CLI's first field, so `magpie gemini <a model with no option>`
  reached it. It unrouted Gemini CLI (stashed key, sign-in and model put
  back) and only then said "unknown provider". An auth it doesn't know is
  now refused before unroute. The audit found no other Set that leaves
  on an unknown value. The other model Sets write an unknown value as the
  agent's own model, which is the intended own-model pick. The on/off
  provider fields of ante, claudedesktop, copilotjetbrains, cursorlocal,
  pencil, t3code, workbuddy and zcode take any non-empty value as "on".
  Both are left as they are.
- docs/subsystems/agent-wiring.md says the above.

Tests:
- TestHelpOnEveryCommandDoesNothing reads the commands from run's switch
  in main.go's AST, so a new command is covered without a list to keep.
  It adds every agent id. For each one it runs --help, -h and help in
  several positions under a sandbox home, and checks that nothing is
  written, the run returns within 20s and usage is printed.
- TestAgentHelpLeavesSnowWired is the reporter's case: Snow wired, then
  `snow --help`, `-h`, `help`, `model --help` and `snow-cli --help`,
  unknown flags, and `snow nonsense`. Snow's files must stay the same.
- TestSnowUnknownModelChangesNothing and TestGeminiUnknownAuthChangesNothing
  cover the Sets.

What was run:
- Each test was run against the old code. Old main.go: the save, snow,
  claude and codex subtests FAIL ("✓ saved profile --help" with
  profiles.json written; "✓ Snow CLI model --help"; "✓ Claude Code model
  --help"; "✓ Codex model --help"), and so does TestAgentHelpLeavesSnowWired.
- Old snow.go with old main.go: TestAgentHelpLeavesSnowWired FAILs with
  Snow's files changed, and TestSnowUnknownModelChangesNothing FAILs with
  `"--help" taken`.
- Old gemini.go: TestGeminiUnknownAuthChangesNothing FAILs with
  `"nonsense-model" changed Gemini CLI`.
- All pass with the fix.
- In a sandbox HOME with pinned Go caches, at origin/main 4dd2112ef + this
  change: `go test -tags nogui -timeout 40m ./...` is green (48 packages ok, no FAIL).
- gofmt -l is clean. go vet, GOOS=linux go vet -tags nogui and
  GOOS=windows go vet -tags nogui pass on . and ./internal/agent.
- Not tried: the real Snow CLI on Windows, the reporter's setup. The fix
  returns before anything is read, so nothing of Snow is run.
2026-10-11 15:56:06 +08:00
yetone 4dd2112ef1 gui: an app menu stays open till the reader scrolls, so Connect's address menu opens at phone width in magpie web (found during #1551)
At phone width magpie web's header takes two rows, so the Gateway page's
Connect address and key sit below the fold. The menu's capture-phase scroll
handler took any scroll of a view outside the menu as the reader's and
closed the menu. A scroll that wasn't the reader's could come in after the
menu opened: the browser or a test bringing the clicked address into
sight, code, or a scroll event landing in the frame after the click. That
happened with or without MAGPIE_PUBLIC_URL, and at 1100 too when code
scrolled the view.

The click guard already puts such a scroll back and holds the clicked
element where it was, so the menu stays beside its anchor. A new
scrollCloses(box, e) closes a menu only on the reader's own scroll of a
view (purposeUntil: wheel, touch, keys, drag), or on a scroll of anything
that isn't a view, as before. All five app menus with that handler use it:
openProtoMenu's non-live branch (the live branch already did this),
openAgentModels, openRowMenu, openRangeMenu and openSessCombo.

Since 9bb68615b (#1554) the guard also puts back, at the click, a scroll
made just before it. When the clicked element has focus, backToReader then
brings it back into sight with readerScrolls(1000), before the menu opens
and is placed. That window marked the guard's own scroll as the reader's
for a second, so the address clicked from the page's top still closed its
menu. backToReader now notes the window as the guard's (guardUntil), which
readerScrolls clears, and scrollCloses doesn't count it. The guard's
behaviour is otherwise unchanged: the scroll still stands.

Run (at this head, rebased on origin/main):
- New phone-connect-menu.test.cjs: 44/44 green.
  - Chromium + WebKit, en/zh/zh-TW/ja/de, 420 and 1100, with and without
    a public URL. The address and key menus, a scroll by code in the frame
    after the click, and the reader's wheel closing the menu.
  - Plus the case as found, both engines, at 420: the page at its top,
    the address brought into sight by code and clicked in one task. Green
    in 8 parallel copies per engine.
- Broken by hand:
  - origin/main's app.js: 0/44 pass.
  - The guardUntil mark taken out: exactly the 4 as-found tests red.
- click-scroll.test.cjs, public-url-default.test.cjs: green in both
  engines.
- The 78 GUI test files that open an app menu and scroll, or are about
  scroll/menu/phone/public-url/connect/range/picker, both engines, run in
  parallel: 840/842. The two reds were this commit's as-found test before
  it was made deterministic (now green as above), and
  removed-groups-menu-scroll "chromium en 1100px: the last of 30 removed
  groups is reached in the menu". That one passed 12/12 in 12 parallel
  copies with this app.js and 12/12 with origin/main's, so it was a
  one-off under the 78-file load and not tied to this change. Its cause
  isn't found.
- go test ./internal/gui after the last change.
- Full go test -tags nogui ./... under the queue lock at this commit
  before the guardUntil change (a JS-only change after it): rc=0.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ./... .
2026-10-11 15:32:46 +08:00
yetone 076b95c28e provider, agent: the sign-in watch tests wait for the watch's next whole loop, not for 20ms without a note
8a881dc20 made TestAccountDiscoveryOffReadsNoSignIn (internal/provider) and
its sibling in internal/agent take "{}{}" and count only opens after their
own check. It waits until the watch's notes stop for 20ms, so that a note
landing after the check's read returns isn't counted as a read of a sign-in.
That is a timing guess. A watch goroutine held off for over 20ms under load
notes the test's own open late. The provider test also asks for its "own
read" before any wait at all.

openWatch and fifoWatch now count their loops. The func they return waits
until a loop that began after the call has finished, so every open the
watch found before the call is in what it returns. The 20ms quiet windows
are gone.

Ran:
- Injected 30ms between the watch's open and its note:
  - origin/main's provider test: 10/10 red ("the watch saw [], want the
    test's own read").
  - this one: 10/10 green.
  - this one with the loop wait taken out: 10/10 red.
- A real read of a sign-in after the check (cursorAuthFile) is still
  reported.
- Before the rebase onto 8a881dc20, the same helpers were also run with a
  5ms slow read ("{}{}"): red on the old check, green with the fix.
- -count=200 and -race -count=50 of both tests.
- go test of both packages.
- The full go test ./... under the queue lock.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet ./... .
- The test fails ~1 in 20 from a .claude/worktrees checkout (on main
  before 8a881dc20), the same rate as elsewhere. Neither the test nor the
  code it reaches reads the working directory (HOME is a t.TempDir).
2026-10-11 15:32:45 +08:00
yetone 642bea3a99 gui, tui, provider: Remote magpie has a heading of its own in the Add sheet, Another computer's magpie, after On this machine, not among the Relays (Avalon on Discord)
Avalon on Discord (v0.1.1168): "供应商添加中没有Remote magpie 的选项". It was
there, filed under Relays (中转), where nobody looks for another computer's
magpie, since it isn't a relay.

The preset is now of its own kind, KindRemote ("remote"), declared after the
local presets. Kind only groups presets for display: the GUI's add sheet,
`magpie presets` and the TUI's add list; makerCatalogs (vendors only) and
the import matcher (skips local) are unchanged for it, as it has no URL.
- GUI: a fourth section after On this machine, "Another computer's magpie"
  / "shared on its network" (zh 另一台电脑上的 magpie / 在它的局域网上共享,
  zh-TW, ja, de too). A preset's note is now also found in the words it is
  shown in, and the zh/zh-TW/ja note begins with 远程/遠端/リモート, so 远程
  finds it as remote and magpie do.
- TUI: the add list says "Remote magpie · another computer's magpie, shared
  on its network" instead of "· relay" (kindNote).
- CLI: `magpie presets` lists it under "another computer's magpie".
- Docs: reference.md, subsystems/providers-accounts.md and the site's
  remote page (en, zh, ja) say where the tile is.

Run:
- remote-magpie.test.cjs gains "Remote magpie has its own heading in the
  add sheet" (420px, en and zh, Chromium and WebKit): the heading and hint,
  right after On this machine, Remote magpie under no other heading, no
  sideways scroll, and remote / magpie / 远程 each find it alone under its
  heading. With the old app.js it fails "no heading of its own" in both
  engines and languages; with only the note search taken out, zh fails on
  远程. Its older test now wheels the sheet to the tile (now the last row;
  a scroll from code is put back by the page's guard, which made it flaky
  in WebKit at 700px): 8 of 8 WebKit runs green.
- TestTUIAddListSaysRemoteMagpieIsAnotherComputers fails on the old note
  with `listed as "Remote magpie · remote"` (and "· relay" before the kind).
- Every GUI test that opens the add sheet (40 files) plus gui-de, gui-ja,
  gui-zh-tw and i18n-keys, in Chromium and WebKit: all pass.
- site worker.test.mjs passes.
- gofmt -l clean; go vet -tags nogui on ., internal/provider, internal/tui,
  internal/gui for darwin, GOOS=linux and GOOS=windows.
- go test -tags nogui -timeout 40m ./... under a temp HOME: all 48 packages ok.
Not tried in the real Wails window.
2026-10-11 15:21:18 +08:00
yetone e03fed7388 gui tests: azure-endpoint measures the endpoint and the key in one frame while the editor opens
azure-endpoint.test.cjs read the two fields' boxes one after the other
while the new editor was still opening, so each read could catch it at a
different height, and "the endpoint above the key" failed in Chromium on a
loaded machine (2 and 3 of 3 runs at load ~130). remote-magpie.test.cjs
had the same check and already reads both in one frame (a998a3636); this
does the same here.

Run: azure-endpoint.test.cjs 5 of 5 green in Chromium and green in WebKit
at the same load.
2026-10-11 15:21:17 +08:00
yetone dde3a31a3d gui: Codex's model button edits its model with a provider switched off, never its subagent model (#1582, SwimmingLiu)
With an API provider on beside two ChatGPT accounts, the button beside
Codex's switch edited `model`. With that provider switched off and the
Agents page refreshed, Codex's model had no option of magpie's left (its
own models go to OpenAI directly), so startField() fell back to
connectField(), the first field with any magpie ref: subagent_model,
which still lists the ChatGPT accounts' models. The same button became
"subagent model" and posted subagent_model.

startField() now takes an agent's `model` field whenever it lists
anything, so a provider switched off changes only what the menu lists.
A model with nothing to list (Ante's, magpie's models only) still leaves
the field the agent connects through. startField is the one choke point
for the row's button, connectedSaid() and leavesMagpie(), so every
agent's row (Codex, Claude Code's tiers, Snow/OpenChamber's small,
Reasonix's planner, Gemini CLI's auth) gets the same rule.

Verified:
- new internal/gui/tests/codex-start-model-field.test.cjs, the
  reporter's case (A on, A off + reload, A on again), Chromium and
  WebKit, en and zh: fails on origin/main 93c5d846c with
  "expected 'model', actual 'subagent_model'" in all 4; passes with the
  fix. Breaking the empty-list guard (`f.key === "model"` alone) fails
  the Ante check ("expected 'provider', actual 'model'").
- 76 Agents/Codex GUI test files in both engines: 749/750; the one red,
  agent-expand-steady webkit 980px "the switch moved" 19 !== 18, came
  under load ~125, passes 4/4 alone, and its fixture's model fields carry
  refs so startField returns the same field; filed as #1583.
- go test -tags nogui ./... (sandbox HOME), gofmt -l, GOOS=linux and
  GOOS=windows go vet -tags nogui ./internal/gui.
- Not tried in the real app with real Codex accounts.
2026-10-11 15:08:17 +08:00
yetone f0dc9ea695 imagemcp, gateway: a 4K image a relay answers by URL is saved, and one that can't be downloaded is answered with its URL, not lost (#1576, david-zdw)
What the reporter saw: generate_image (magpie mcp image) failed on 4K and
2048x1152 with "image 1: context deadline exceeded" and "no image: context
deadline exceeded", while the same request to /v1/images/generations came
back in ~40 s, and usage.jsonl showed the upstream's 200. Their relay
answers with a URL whatever response_format says.

Two causes, one per error:

- "image 1: context deadline exceeded" was generate_image's own download
  of the URL (imagemcp.download): 2 minutes for the whole of it, on
  http.DefaultTransport, which knows the global proxy but not a provider's
  own (#237). A 10 MB PNG that was still coming was cut, and the error
  dropped the URL of an image already drawn and paid for. Any earlier
  image of n was saved but not said either.
- "no image: context deadline exceeded" (the usage log's 502s at
  300002-300032 ms) was the gateway's drawTimeout (5 min) expiring while
  it read a vendor's answer that had already begun: sendWith passed the
  bare context error up. The vendor really took over 5 minutes there;
  this commit doesn't change that limit, it says what happened.

What changed:

- gateway: an images caller that asks response_format "b64_json" gets the
  image itself. One the vendor gave only a URL for is fetched by the
  gateway's own client, through the provider's proxy (p.Via), after the
  draw and outside drawTimeout. One that can't be fetched is answered by
  its URL, as before, never dropped. A caller that asks no format still
  gets the URL. Nothing is sent to the vendor differently.
- gateway.FetchImage: an image download gives up when nothing has come
  for ImageStall (1 min) or it has taken ImageLongest (5 min), and says
  which and how much had come. A slow download goes on while it moves.
  The edits' fetchPicture uses it too.
- gateway: a vendor that began answering but hadn't finished in
  drawTimeout is a 504 "<name> began answering after Ns (200 OK) but
  hadn't sent all of its answer in 5m0s", not a 502 "context deadline
  exceeded".
- imagemcp: asks for b64_json; downloads a URL the gateway still hands it
  with FetchImage; an image it can't have is answered with the vendor's
  URL to download it from, beside the ones saved (an error only when
  none was). Its client to the gateway waits ToolTimeout (11 min), past
  the draw and the fetch together, not 6 minutes.

What was run:

- Reproduced on the old code: the new TestFourKImageByURLIsSaved (a real
  3840x2160 PNG, 9.8 MB, served by URL in 256 KB pieces over ~4 s) with
  the old download's 2-minute cap scaled to 1 s fails with the
  reporter's exact "image 1: context deadline exceeded"; the stalled
  case fails the same way, with no URL in the error.
- Broke each part by hand and watched its test go red: no inline fetch,
  fetch not through the provider's proxy, the bare deadline message, the
  stall timer not reset (a total cap again), a lost image ending the
  call, the MCP not asking b64_json.
- go test ./internal/imagemcp/ ./internal/gateway/ ; the full
  go test -tags nogui ./... ; gofmt -l ; GOOS=linux and GOOS=windows
  go vet on both packages.
- On the Windows box (Windows 11 x64): imagemcp.test.exe all passed, and
  gateway.test.exe for the new tests and the images/ModelScope tests.

Not tried: the reporter's relay itself (never contacted), and a real
4K draw end to end. Why their URL took over 2 minutes from the MCP when
their own download took 7.5 s isn't known from here: a provider proxy
the MCP didn't use is one way it happens; a slow file host is another.
Both are covered now.
2026-10-11 14:59:23 +08:00
yetone 6679e963fd gateway: a screenshot sent to a ChatGPT account goes at the size Codex's own client sends it (ylorn on Discord)
ylorn's ChatGPT account dropped turns a PNG screenshot took past about
1 MiB (the commit before this tells that as too large). ylorn uses Pi's
openai-codex through magpie, not Codex, and Codex's own client never
sends a screenshot that size: it scales every inline image down first.
Read in openai/codex at cc7ba336 (codex-rs/core/src/image_preparation.rs
resize_image, codex-rs/utils/image/src/lib.rs):
- detail none, auto or high: at most 2048 px a side and 2500 patches of
  32 px (HIGH_DETAIL); "original": 6000 px and 10000 patches; "low" it
  refuses itself (DetailBased mode, the default; UnifiedBudget is a
  feature flag)
- prompt_image_output_dimensions_for_limits: as it is if it fits,
  scaled to the longest side, then by area with the patch grid rounded
  down
- resized with FilterType::Triangle; PNG written as PNG, JPEG as JPEG at
  quality 85, WebP lossless, GIF as PNG; an image that fits keeps its
  bytes; no byte cap other than a 1 GiB guard
- Codex zstd-compresses request bodies to ChatGPT by default
  (enable_request_compression); magpie already reads those and sends
  upstream plain, which this doesn't change.

codexImagesFit (codex_images.go) does the same in forwardOnce, for a
ChatGPT (codex) account's Responses requests only: every data-URL
input_image in a message's content or a tool output's output larger
than Codex's limits for its detail is scaled to Codex's size with a
separable triangle filter widened by the scale (as the image crate's)
and written in its own format (JPEG q85, PNG, GIF as PNG). Only the
image_url string's bytes are replaced, so the rest of the request is
the same bytes for the prompt cache, and the last 64 results are kept
so a conversation's screenshot isn't resized on every turn. An image
that fits, "low" detail, a remote URL, an image past 80 Mpx, and WebP
(which Go's standard library doesn't decode) go as they came. Other
vendors, API keys and Chat requests are untouched. Codex's own requests
come already sized, so this changes nothing for them.

Tests (codex_images_test.go):
- TestCodexImageSizeAsCodex: Codex's own test cases (2048x2048 →
  1600x1600, 2050x2 → 2048x2, original 6401x100 → 6000x94, 4096x2048
  kept, 64x32 kept) and a 3456x2234 screenshot → 1979x1280 (checked
  against Codex's formula in f64).
- TestCodexScreenshotSizedAsCodex: still PNG, 1979x1280, its black and
  white halves and red band where they were, the rest of the body
  byte-identical.
- TestCodexImagesSizedInEveryPlace: JPEG stays JPEG, a tool output's
  image is sized, "original" gets the larger budget.
- TestCodexImagesThatFitGoAsTheyCame, TestCodexImagesOnlyForChatGPT.
- TestCodexAccountGetsScreenshotAtCodexSize: an agent's /v1/responses
  turn of 2.2 MB reaches the fake ChatGPT backend as 657 KB at
  1979x1280. Red with the call taken out of forwardOnce; the legibility
  checks go red with the filter's centre moved.

Run: go test -tags nogui ./internal/gateway, gofmt -l, go vet -tags
nogui with GOOS=darwin, linux and windows on ./internal/gateway. Not
tried: ylorn's account and network, a real agent's screenshot through
a real ChatGPT account after this change, WebP.
2026-10-11 14:32:57 +08:00
yetone a2b96139c9 gateway: a Codex request ChatGPT drops for its size is told as too large, not retried or rested (ylorn on Discord)
ylorn (Discord #general, v0.1.1179): through a ChatGPT account, every
turn a PNG screenshot took past about 1 MiB was answered

  HTTP/2 503  content-type: text/plain  server: cloudflare
  upstream connect error or disconnect/reset before headers. reset reason: remote connection failure

also without magpie, and the same screenshot as a JPEG went through.
magpie took that 503 as the backend's trouble: with two accounts on, the
turn was asked of acct-1, then of acct-2 three more times, acct-1 rested
for it, and the next turn moved to acct-2. The same bytes are dropped
the same way on every account, so none of that could help, and the
agent was handed a 503 it retries again with the same body.

codexDropped (codex_dropped.go) makes a 503 whose body says "upstream
connect error or disconnect/reset before headers", to a request of
1 MiB or more, the 413 it stands for, with a message saying the request
was dropped for its size (in MiB), that magpie didn't retry it or rest
the account, and to /compact or remove or shrink the images (a JPEG in
place of a large PNG screenshot). It runs on a ChatGPT account's replies
in forwardOnce (the accounts loop, any agent) and on the ChatGPT
passthrough in codexUpstreamOn (Codex's own sign-in alone). A 413
already skips the other accounts of the same provider and rests nobody,
and Codex doesn't retry a 4xx. The same 503 to a smaller request stays
the 503 it is, retried as before.

1 MiB isn't the backend's limit for everyone: from here, on a Pro
account, gpt-6-astra direct to chatgpt.com/backend-api/codex/responses
answered 200 to bodies of 0.5 to 20 MiB, plain and zstd, and to
3456x2234 PNG screenshots up to 5.6 MiB. So nothing is refused before
sending; only this drop, on a body this large, is taken as the
request's.

Tests (codex_dropped_test.go), with an httptest backend that answers
ylorn's literal 503 (text/plain, Server: cloudflare) to bodies over
1 MiB:
- TestCodexDroppedBigBodyIsTheRequests: two accounts, a 1.2 MiB turn is
  413 with the message, asked of acct-1 once, nobody rests, and the next
  small turn goes to acct-1. On the old code: 503, asked
  [acct-1 acct-2 acct-2 acct-2], acct-1 rested, next turn on acct-2.
- TestCodexDroppedBigBodyRelayed: Codex's sign-in alone, 413 with the
  message (old code: the 503 relayed).
- TestCodexEdgeResetSmallBodyStays503: a small body's 503 is relayed.

Run: go test -tags nogui ./internal/gateway (new tests red before, green
after), gofmt -l, go vet -tags nogui with GOOS=darwin, linux and windows
on ./internal/gateway. Not tried: ylorn's own network or account, where
the drop happens.
2026-10-11 14:32:57 +08:00
yetone 1cb136ec76 gui: every row's grip stands 4px inside its card's edge, as the Agents row's does (#1581, real-jacket)
On the Usage page a card's hover grip stood on the card's left border:
its ::before sat at left -8px inside a 12px card padding, while the
Agents and Providers rows' sits at -7px in 14px, 4px inside the list.
Each grip copied its `left` while the box around it had its own padding.

Measured in Chromium and WebKit (grip left minus the inner side of the
nearest box drawing a border or a shadow) on the old CSS:
- Usage card: 1px (the issue's 2px is from the border's outer side)
- tray panel's agents: 2px; tray panel's Arrange rows: 3px
- Routing groups: 3px in the window, 1px on the narrow browser page
  (whose rows there have 12px padding all round)
- Agents, Providers: 4px; a group's members in its editor and an
  agent's model order are far inside (no edge beside them)

Now: Usage -5px, panel agents -8px, panel Arrange -8px, Routing groups
-7px, and the browser page's narrow Routing rows keep 14px on the left.
Every one is 4px in, in both engines, every language, 980px and 420px.
The grips still show only on hover.

New test internal/gui/tests/grip-inset.test.cjs: for each grip kind
(Agents, Providers, Usage, Routing groups, group members, model order,
panel agents, panel Arrange), en/zh/zh-TW/ja/de, 980px window and 420px
browser page, Chromium and WebKit: the grip is hidden away from the row,
drawn on hover, and grip-left minus edge >= 4px.

Run:
- grip-inset.test.cjs on the old app.css/routing.css: 80 of 160 cases
  fail (Usage 1px, panel agents 2px, panel Arrange 3px, Routing 3px/1px);
  on the new: 162/162 pass.
- node --test (both engines) agent-grip, fold-show-grip, provider-order,
  usage-arrange, group-arrange, group-member-drag, group-duplicate,
  group-bulk-remove, panel-arrange, codex-model-order, zhipu-team,
  mobile-web, phone-web, phone-rows, view-no-sideways, gui-de, gui-ja,
  gui-zh-tw, routing-group-fold, panel-usage, panel-fold, grip-inset:
  383/383 pass.
- go test -tags nogui ./internal/gui (temp HOME): ok.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gui: ok.
Not run: the whole GUI suite.
2026-10-11 14:31:15 +08:00
yetone 1c0eab7c84 gui, gateway: every search API takes a base URL of the user's own, under its key in Settings (#1580, xzhlksh)
The reporter has endpoints that answer as Tavily, Exa and others do, at
addresses that aren't the vendors', and Settings only took a key. The
saved SearchAPI already had a url, and the CLI's url= set it, but the
Settings row showed the field only for SearXNG and sent "" for the rest.

- Settings › Models › Web search: the add row has a base URL field on a
  line of its own under the key, for every API, with the vendor's own
  address as its placeholder (searchVendorJSON.base). Picking an API
  already added fills in its saved URL, so Add with a new key alone keeps
  it; Add with no key typed changes only the URL, the key kept (the key
  placeholder says so). Strings in zh, zh-TW, ja, de.
- provider: check() also refuses a URL with a ?query or #fragment, since
  the vendor's path goes after it.
- gateway: the key goes only to the URL set. Go drops Authorization on a
  redirect to another host but keeps Brave's X-Subscription-Token and
  Exa's x-api-key, so a search API's redirect to another host is not
  followed; the error names where it was sent. The request still goes
  through the gateway's client and so magpie's proxy settings.
- CLI: `magpie search add <api> <key>` keeps the url set before; `url=`
  with nothing after it puts the vendor's own back (was: a new key alone
  dropped the url).
- docs/subsystems/gateway-routing.md: "A search API's base URL";
  gui-shell.md: the field.
- search-api.test.cjs: Settings is drawn twice (/api/state, then
  /api/settings), so scrolling to the add row can hit a detached node
  (WebKit, 1 in ~6 runs here); it retries the scroll.

magpie ships and lists no third-party search endpoint; the URL is only
the user's.

Tests (sandbox HOME, pinned caches):
- TestSearchAPIAtItsOwnBaseURL: an httptest fake at <fake>/relay/<vendor>/
  gets tavily POST /relay/tavily/search with Bearer, exa POST
  /relay/exa/search with x-api-key, brave GET
  /relay/brave/res/v1/web/search with X-Subscription-Token, firecrawl
  POST /relay/firecrawl/v2/search with Bearer. Passes on the old gateway
  too: the backend already honoured a url.
- TestSearchKeyStaysAtItsBaseURL: with search_api.go put back, FAIL
  "a key reached another host: exa-secret / brave-secret".
- TestSearchCLI: with search_cli.go put back, FAIL "a new key took the
  base URL away"; with provider/search_api.go put back, FAIL
  "url=https://x.example.com/?k=1 taken".
- TestSearchAPIBaseURLFromSettings: POST /api/settings/search-api saves,
  keeps the key, refuses ftp/no-scheme/query URLs, lists vendor bases.
- search-api.test.cjs in Chromium and WebKit, en and zh, 980px and
  420px: 8/8; with the old app.js, FAIL "Tavily takes a base URL"
  (false !== true). WebKit 980px 10 runs in a row green after the retry.
  search-first, search-mcp, searcher-pick, i18n-keys, gui-ja, gui-de,
  gui-zh-tw, click-scroll with it: 45/45 in each engine.
- Screenshots at 980/420 in both engines checked by eye.
- go test -tags nogui -timeout 40m ./... on 5fa908c08 + this: all 48 packages ok. gofmt -l clean; go vet, GOOS=linux and GOOS=windows go vet -tags nogui on ., internal/gateway, internal/gui, internal/provider: clean.

Not tried against a real third-party endpoint or a real vendor key.
2026-10-11 14:21:29 +08:00
yetone 93c5d846ca plugin: a plugin's requests to a host on the user's own network go direct, as magpie's own do (#1572, ggbdpq)
What changed: with a proxy set (magpie's, the environment's or the
system's), the plugin host sent a plugin's requests for a host on the
user's own network - a Remote magpie, an LLM relay on the NAS - through
that proxy, which can't reach it (502 Bad Gateway) or resolve its name.
Go's netproxy.Func leaves such a host direct since #982 (lan.go onLAN);
host.js's proxyFor and its node:http2 sessions (#1035) were that rule's
siblings without it.

- host.js ports lan.go's rule: onLAN takes a private (10/8, 172.16/12,
  192.168/16, fc00::/7), link-local, loopback or CGNAT (100.64/10)
  address, a .local name, or a name every address of which is one of
  those; looked up for 400 ms at most, kept a minute (256 names), a
  failed or slow lookup is "not on the network". It is asked only when
  the global proxy would be taken (after loopback, a provider's own
  proxy or "direct", and NO_PROXY), as Func asks it, so a user without a
  proxy pays no lookup and a provider's own proxy is still taken as is.
  IPv6 is compared on its bytes, so a v4-mapped address in hex form
  (::ffff:a00:1, how URL writes it) is judged as its IPv4 address.
- http2.connect returns its session at once, so tunnel() now takes a
  promise of the proxy and connects when onLAN has answered: straight to
  the host for one on the user's network, through the CONNECT otherwise.
  Unlike the issue's patch, a LAN name that needs a lookup is covered on
  this path too.
- The issue's patch was reviewed, not applied: its lanIP missed loopback
  and hex v4-mapped IPv6, it didn't strip a trailing dot, it never
  cleared its lookup timer, and it left HTTP/2 to LAN names proxied.

New TestPluginLeavesTheUserNetworkDirect (real Bun, a proxy that keeps
every target it is asked): a fetch to this computer's private address
over http:// (absolute form) and https:// (CONNECT; a certificate for
that address via NODE_EXTRA_CA_CERTS), to "localhost." (a name decided by
what it resolves to), and an HTTP/2 session to the private address all
reach the server directly; a public address (203.0.113.5) and a name that
resolves nowhere (vendor.invalid) still go through the proxy.

Run: the new test against the old host.js fails on all three fetches
(proxy asked for each); with only the HTTP/2 check removed it fails on
the session ("h2: proxyconnect tcp: 502 Bad Gateway"); with every host
taken as LAN it fails on the public address and the vendor name. A bun
check of lanIP over 24 addresses (both sides of every range) matched
lan.go. go test ./internal/plugin ./internal/netproxy ok; full
go test -tags nogui ./... ok in every package (the five whose build
hit another session's go-build cache prune were rerun, all ok: ., agent,
gateway, gui, library); gofmt -l clean; go vet -tags
nogui internal/plugin on darwin, GOOS=linux and GOOS=windows clean.
Not tried with a real NAS or Remote magpie behind a real proxy.
2026-10-11 14:07:21 +08:00
yetone 5fa908c087 gateway, provider: Claude Desktop's requests to ModelScope go on its Responses API, which reports the cache and reasoning that its Chat API leaves out (#1578, sparrowbits)
What changed
- provider.ResponsesTellsCache: ModelScope's API-Inference (the
  "modelscope" preset, or a provider whose Responses URL is
  api-inference.modelscope.cn) with both a Chat and a Responses URL.
  ResponsesFirst is true there for every model, so `usable` puts
  Responses before Chat. A translated request (Claude Desktop / Claude
  Code's /v1/messages, a Gemini client) goes to /responses, and
  Provider.Native wires Pi, omp and droid to Responses. A Chat client's
  request is still relayed on Chat, and Codex's on Responses, as before.
- forwardTranslated: when Responses is first only for the cache report,
  a 404 there marks the model unfit on Responses and asks it on Chat. A
  ModelScope model with no Responses route then works as it did before.
  This fallback is scoped to ResponsesTellsCache.
- docs/subsystems/gateway-routing.md: the "One try" row names it.

Why
The reporter's usage.jsonl covers 202 Claude Desktop requests, all
/v1/messages -> /v1/chat/completions: 0 cache_read over 34.9M input
tokens, and reasoning 0/202. Codex on /v1/responses with the same model,
on the same day, read 94% from cache. Their direct calls show why.
ModelScope's /responses answers
input_tokens_details.cached_tokens = 12288 on the second identical
prompt. Its /chat/completions answers only prompt_tokens /
completion_tokens / total_tokens, though it is served from the same
cache. magpie already maps Chat's prompt_tokens_details.cached_tokens
(and prompt_cache_hit_tokens, cached_tokens, cache_read_input_tokens) to
cache_read_input_tokens (cUsage.usage). The new test
TestOtherChatAndResponsesKeepChat pins that. So the missing figure was
not a mapping gap: ModelScope's Chat API never sends one. The fix is to
ask on the API that does.

Scope: other presets with both Chat and Responses URLs keep Chat.
- DeepSeek, xAI, Zhipu, MiMo, Qianfan, Tencent TokenHub, Volcengine's
  plans, OpenCode Zen/Go, Command Code, PipeLLM and CherryIn have an
  Anthropic URL, so Claude-format requests are relayed on Messages as
  they are.
- Groq's and Volcengine Ark's Chat APIs report
  prompt_tokens_details.cached_tokens, and Groq's Responses API is a
  partial beta.
- OpenAI keeps its existing OpenAI-model rule.
- Nothing is known of a custom relay's Responses API.

What was run
- New tests in internal/gateway/responses_tells_cache_test.go, against
  an httptest fake that answers with the reporter's literal usage
  bodies:
  - TestModelScopeMessagesTellTheCache: streamed and whole Messages go
    to /v1/responses, and the client gets cache_read_input_tokens 12288,
    input_tokens 108 and output_tokens 32.
  - TestModelScopeModelNotOnResponsesGoesToChat: a 404 on Responses
    goes to Chat, and stays on Chat for the next request.
  - TestOtherChatAndResponsesKeepChat
  - TestModelScopeNativeIsResponses
- Broken by hand:
  - Without the ResponsesTellsCache check in ResponsesFirst,
    TestModelScopeMessagesTellTheCache fails ("Messages went to
    [/v1/chat/completions], want /v1/responses"), and so do
    TestModelScopeNativeIsResponses and the fallback test.
  - Without the 404 fallback, TestModelScopeModelNotOnResponsesGoesToChat
    fails with "404 ModelScope: Not Found".
- gofmt -l is clean. go vet, and GOOS=linux and GOOS=windows go vet
  -tags nogui, pass on internal/gateway and internal/provider.
- Full suite: go test -tags nogui ./... under a temp HOME at base 1d016ee3f: rc=0, 48 packages ok.

Not tried
- Not tried against the real ModelScope API: no ModelScope token here.
  The fake is built from the reporter's bodies.
- Which ModelScope models lack a /responses route, and what ModelScope
  answers for them, isn't known. A 404 is assumed; any other error
  reaches the client as ModelScope said it.
- Reasoning is counted from Responses' output_tokens_details, but the
  reporter's excerpt doesn't show that field, so the test doesn't assert
  on it.
2026-10-11 13:46:38 +08:00
yetone f1001ec991 library, gui: each of an MCP server's tools has a switch, and the agents that can leave one out are told to (nf1qaz2w on Discord)
nf1qaz2w asked to turn single tools of a Library MCP server on and off.
6f4fb883e listed each server's tools by name and description; each now
has a switch beside it.

What changed
- Server.DisabledTools keeps the tools turned off, by the names the
  server gives them; ServerTools (POST library/servers/tools) sets them.
  The editor's save sends none, so SaveServer keeps them.
- Each agent given the server that reads a per-tool setting is written
  it in its own form (mcp_tools_off.go, toolsOffOf), checked in source:
  - Codex: [mcp_servers.<name>] disabled_tools (codex-rs/config/src/
    mcp_types.rs, ToolFilter in codex-rs/codex-mcp/src/tools.rs;
    openai/codex cc7ba336)
  - Gemini CLI: excludeTools in the entry (docs/tools/mcp-server.md,
    mcp-client.ts; gemini-cli 9b6e0265)
  - Crush: disabled_tools in the entry (internal/config/config.go
    MCPConfig, filterTools; crush df5b024a)
  - Hermes Agent: tools.exclude in the entry, original names
    (tools/mcp_tool_registration.py, mcp-config-reference.md;
    hermes-agent c5733167)
  - Claude Code: mcp__<server>__<tool> in permissions.deny of
    settings.json (code.claude.com/docs/en/permissions; names spelt as
    Claude Code 2.1.296 normalizes them, [^a-zA-Z0-9_-] -> _)
  - OpenCode: "<server>_<tool>": false in top-level tools of
    opencode.json (docs mcp-servers "Manage"; name() in
    packages/core/src/tool/mcp.ts, migrateTools in config/normalize.ts;
    sst/opencode 0d61729b)
  Every other agent (Cursor, Copilot, Goose, Zed, Kimi, Pi, Grok, Devin,
  Antigravity, Alma, dsh, omp, ZCode, Command Code, Cline, WorkBuddy,
  CodeBuddy, Droid, Claude Desktop, MiMo Code, plugin agents) gets the
  server whole; AgentView.ToolsOff is false for it, and the open tool
  list names those agents as unable to turn off single tools.
- Applied.ToolsOff / Applied.ToolRules record only what magpie added
  (offList): a name, deny rule or tools key the user had is theirs and
  stays when the tool is turned on again; an OpenCode key the user set
  to true is never written over. A list or deny that isn't a list of
  names is a problem and the file is left as it is. The key (and an
  emptied permissions / tools) goes when magpie's were the last.
- GUI: a switch per tool, flipped at once with no repaint or scroll,
  quick clicks sent as one request; turned-off tools dimmed. zh, zh-TW,
  ja, de strings. Project files and Copy config… don't carry it
  (docs/subsystems/library.md says so).

What was run
- go test ./internal/library -run 'ToolsOff|OffList': per format the
  list is written, removed on re-enable, the user's own entries kept
  (Codex, Gemini, Crush, Hermes, Claude deny, OpenCode tools); cursor
  untouched; SaveServer keeps the list. Broken by hand (no off.apply,
  no syncToolRules): TestToolsOffInTheEntry, TestToolsOffClaudeDeny,
  TestToolsOffOpenCode go red.
- go test -tags nogui ./internal/library ./internal/gui: ok.
- library-mcp-tool-switch.test.cjs: chromium and webkit, en/zh/zh-TW/
  ja/de, 980 and 420 wide: pass; 10/10 red against the old library.js,
  library.css and i18n.js. library-mcp-tools.test.cjs' fixture gives
  Claude Code toolsOff (as the real view does).
- library-*.test.cjs, click-scroll, i18n-keys: chromium and webkit.
- gofmt -l; go vet, GOOS=linux and GOOS=windows go vet -tags nogui
  ./internal/library ./internal/gui.
- go test -tags nogui ./... (full suite, under the queue lock).
All in sandbox HOMEs; no live agent config was touched.
2026-10-11 13:44:02 +08:00
ggbdpqandfactory-droid[bot] d1ddb7defe catalog: a model no catalog lists by its id has what its maker's entry says of it — window, thinking, images, name — not just a price (#1565, ggbdpq)
What changed: #1520 prices the id an entry names as its
canonical_model_id, but the capability tables only counted entries
listed by an id, so the model behind the id was unknown all the same:
gpt-5.6-cyber (OpenAI's gpt-daybreak-red-latest, canonical
openai/gpt-5.6-cyber) had no window, reply limit, thinking, images or
name — asked as given (WorkBuddy's shape) or behind a relay's prefix.
An entry now votes for the canonical id it names too, when no catalog
lists that id: one listed by its id keeps the answers it has. The
per-entry vote moved into a closure (vote) whose branches are the ones
it replaces, keyed the same for a listed id.

Review (yetone's session): TestCanonicalOnlyIDCarriesItsMakerWord and
the updated TestCanonicalIDIsNeverTakenForAnother fail on the previous
catalog.go (window, reply limit, thinking, images and name all empty for
gpt-5.6-cyber and claude-gpt-5.6-cyber; 0 and "" for claude-sonnet-4-0)
and pass with it. The expectations were moved to the literal catalog:
Daybreak Red's window is its input limit, 272000, not the 400000 context
(as every listed model's is), and Cortecs's name is "Claude Sonnet 4
(latest)". A sweep of every listed and canonical id (plain, claude-,
[1m]) through ContextOf, OutputOf, Thinks, SeesImages, NameOf,
EffortsOf, Knows and PricedBy on the local models.dev cache, before and
after: no answer for a listed id changed; the 23 canonical-only ids
and their renames gained theirs. The full suite, gofmt and the cross-OS
vets were run on the series.

Author's run: the red/green above; go test -tags nogui
./internal/catalog ./internal/usage ./internal/provider green; go test
-tags nogui ./... green but TestOffline (red on the baseline too) and
TestSearchFollowsTheSearchersProxy (green alone); gofmt -l clean; go
vet, GOOS=linux and GOOS=windows vet on internal/catalog clean.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-10-11 13:35:56 +08:00