Commit Graph
3916 Commits
Author SHA1 Message Date
bbornandClaude Opus 5.5 ae7dc10ae2 docker: the image is Debian 12 slim, so the Cursor and Devin CLIs magpie installs at sign-in run in it (#2834, bborn2)
magpie installs a subscription's CLI at sign-in with its vendor's
`curl … | bash` (internal/provider/install.go: Cursor, Devin, Grok
Build). The distroless image had no curl and no /usr/bin/env (the
installers' shebang), so that install couldn't run there, and only
Grok Build had a native fallback. bborn2 reported that a Cursor CLI
installed by hand failed with "cannot execute: required file not
found". The image is now debian:12-slim with ca-certificates and
curl. It keeps the nonroot user at uid/gid 65532, HOME and XDG under
/config, the healthcheck, and magpie on PATH. Size: 157MB against
82MB for origin/main's image, both built here on arm64. Running a
feature magpie offers is worth the 75MB.

Changed in review: dropped the branch's GOPROXY build arg, a separate
goal. The comments in install.go and install_test.go that said the
image has no curl now say "had". docs/reference.md and the site's
Docker page (en, zh, ja) say Debian with bash and curl instead of
distroless with busybox.

Run, with OrbStack's docker:
- docker build of this tree and of d783df46c's Dockerfile: 157MB vs
  82MB.
- docker run of the new image: health "healthy", user nonroot (id
  65532). `curl https://cursor.com/install -fsS | bash` exit 0, then
  `~/.local/bin/cursor-agent --version` printed 2026.10.16-e3cb207.
  Devin's install.sh installed devin v3000.11.92 (its trailing
  `devin setup` said "Login canceled" with no terminal, as on any
  host). `devin --version` printed 3000.11.92. bash and `magpie
  version` run.
- Old image: `which curl` finds none, and /usr/bin/env doesn't exist.
- A volume written by the old image (file owned 65532) was read and
  written by the new image.
- gofmt -l clean; go vet darwin, linux (nogui) and windows clean.
- Full `go test -tags nogui -timeout 45m ./...`: every package ok
  except internal/agent and internal/gateway, which timed out at 45m
  mid-test (TestConnectSaysHow, TestLargeRequestEndpoints) under a
  load average of about 200 from parallel suites. This commit changes
  no code those packages build, only comments in internal/provider,
  which passed (992s), so they weren't rerun.
Not tried: a Grok Build install inside the image, and a full
in-magpie Cursor/Devin sign-in with a real account in the container.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 00:19:53 +08:00
yetone ccb2eea159 provider: moved Zed users get plugin 0.1.9, which says why a never-read model list failed (plugins#229)
plugins 779388b published @magpie-community/opencode-zed-auth 0.1.9 at
13:45 (npm view --prefer-online: 0.1.9), but the zed mover's min stayed
0.1.8. keepMovedCurrent installs mv.min, so moved users, ReneXiong
among them, kept 0.1.8 and its six pre-sign-in models shown as the
account's own. Every other mover's min equals its npm latest (checked
all eleven).

Run at this tree: go test -timeout 30m ./internal/provider/ ok
(1022s, sandbox HOME); gofmt -l clean; GOOS=linux and GOOS=windows go
vet ./internal/provider/ clean. Not tried: a real Zed account, as the
plugin commit says.
2026-10-18 22:53:08 +08:00
yetone d783df46cb plugin: a plugin's page adds items to a provider's and an agent's row menu (P6)
package.json's magpie.actions: [{id, menu, title, titles}] puts items in
the row menus magpie draws, after its own: a provider row's (right-click)
and an agent row's (its handle, or right-click). Picking one opens the
plugin's page and posts it {event: "action", data: {id, provider|agent:
{id, name}}}, nothing else of the row; the bridge's magpie.onAction(fn)
gets it, and an action picked before fn was given waits for it.

- plugin.Window reads them (page.go): menu one of ActionMenus (provider,
  agent; a session's menu is left out, its title is user content), id
  ^[a-z0-9][a-z0-9-]{0,39}$, an id given twice is the first's, 8 at most,
  none for a plugin with no page.
- /api/plugin-pages carries them on the page; a missing title is the
  page's, in each language (pluginpage.go).
- pluginpages.js: magpie.actions(menu, context) gives the row menu's
  items; openRowMenu draws a plugin's name as written (literal), not
  through t().
- The Plugins page says which menus a plugin adds to (actionsLine),
  translated in zh, zh-TW, ja and de.
- Docs: plugin-runtime.md's P6 section and verification; the site's
  plugin docs (en, zh, ja) gain "Items in magpie's menus".
- The core's budget (TestCoreScriptBudget) is not raised (#2710): with
  P6 the core came to 1,447,648 bytes, 648 over. pluginpages.js's header
  now says P5's and P6's part in one paragraph and points to
  plugin-runtime.md, which says it in full, and plugins.js's panels and
  actions lines share whereLine: 1,446,845, 155 under.

Run:
- Full: this series (P5, the Plugins dot, the probe test, P6, and a
  built-ins-on commit since dropped for main's own 5a2414acd) was run
  together, at load 200-660.
  At the pushed tree, 88dfab2d3 on origin/main 5380114da (rebased
  from 210bc2b77, no conflicts; its GUI assets and tests are the same
  bytes as the tree the GUI runs below used, diff -rq): gofmt clean,
  vet darwin/linux nogui/windows ok, TestCoreScriptBudget ok
  (1,446,845 of 1,447,000). go test -timeout 45m ./... at load
  193-278: 62 packages ok, red in TestMainWindowCorners (#1936) and
  TestPluginStreamLargeReplies JSON_fast (client timeout; alone 1 of
  3 red here, 0 of 3 on 5380114da side by side at load ~280; the
  series doesn't touch the stream path; #2551 reopened with the
  output, taken). Two earlier runs at this tree are discarded: one
  stopped when the disk filled, one when another session's go clean
  -cache emptied the build cache mid-run. The whole GUI suite at
  this tree was not finished (the disk filled); the files the series
  reaches ran (1318 tests, 124 red), and the 39 red files ran again
  at concurrency 1 on both trees: here 148 ok 120 red, origin/main
  135 ok 127 red. Both sides' reds are page.goto/launch timeouts
  under load (66 here, 71 there) and the same assertions:
  title-bar-tools' and settings-proxy-auth's "access control checks"
  on a cut-off /api/providers read (#2740, taken next), sidebar's
  "the list unrolls" and WebKit "#prefs pressed darkens" (#2684;
  alone, 1 red here, 3 on main), side-toggle (#2732); plugin-move
  red on main only. Six files again one by one on both trees:
  plugin-actions red 1 of 6 here, a 5s goto of ?view=plugins at load
  260; plugin-clash red on both; plugin-own-icon, plugin-gateway,
  plugin-checkin ok on both; settings-proxy-auth ok here, 3 red on
  main.
  At 976c9893a (on origin/main 6f950653f): go test -timeout 45m ./...
  red only in TestMainWindowCorners (#1936, the window's process
  killed at its deadline) and TestSetAnswersWhileDevinAndProvidersHang
  (#1375, 3 of 3 alone). The whole GUI suite, both engines: 10834
  tests, 237 red in 73 files, 184 of them a 180s browser launch. Those
  73 files run again at concurrency 2: 52 green, among them every
  plugin-* and agent-* file and plugin-actions; the 21 still red were
  run at origin/main f191d6423 and are red there too: codex-predictions
  (#2624), lightweight (#2638), segs-glide (#2683), usage-agents-hide
  (#2276), provider-advanced-fold (#2552), routing-bodies (#2559),
  routing-model-rest and rest-try-now (#2115, #2564), routing-keys-fold
  (#1612), routing-wb-restricted (#1905), routing-request-metrics
  (#2571), quota-count-wrap and quota-name-translated (#2228), s3-sync
  (#2448), usage-checkin (#2549), usage-ledger-abort (#2700),
  tencent-access-key (#2733), usage-range (#2734); side-toggle's WebKit
  motion red 1 of 3 on main, 0 of 3 here (#2732); usage-fold green alone.
  Rebased onto origin/main 717b69f78 (60725faa1, no conflicts): gofmt
  clean, vet darwin/linux nogui/windows ok; go test -timeout 45m ./...
  red in TestSetAnswersWhileDevinAndProvidersHang (#1375) and agent and
  gateway at the 45m alarm with tests still moving at load 400+, both ok
  alone (1173s, 1167s); 105 GUI files the series reaches (plugin*,
  sidebar*, side-*, settings*, title*, header*, agent-*): 1322 tests,
  23 red, run alone 214 of 218 ok, the 4 left in sidebar and
  sidebar-overlay-scrollbar (WebKit), red on 717b69f78 too (#2684,
  #1863). The whole GUI suite was not run again after the rebase.
- gofmt -l clean; go vet darwin, linux (-tags nogui) and windows ok;
  TestCoreScriptBudget ok.
- go test -run 'TestWindowActions|TestPluginPageActions' ok: duplicate,
  malformed and session-menu ids dropped, 12 actions kept to 8, none
  without a page, an off plugin's not served.
- plugin-actions.test.cjs: chromium and webkit, en zh zh-TW ja de, at
  1100 and 420: no page adds nothing; the agent menu ends with Hide then
  the plugin's item; the provider menu's item is in the window's
  language; a pick opens the page, which gets exactly {id, provider|
  agent: {id, name}} once, in one frame, though it calls onAction 400ms
  late. The Plugins row says which menus.
- Broken by hand, each red then restored: the bridge not holding an
  action picked before onAction (the late-registering fixture), the
  provider's whole row posted in place of {id, name} (the exact-data
  check), any id and any menu accepted (TestWindowActions).
- Neighbours in both engines: plugin-page, agent-cli-missing,
  agent-disconnect, group-bulk-remove, model-test-why and provider-find
  ok; plugin-panels red before P5's fixture fix (padding, in that
  commit), ok after.
- Real use: a dev build (-tags dev) in a sandbox HOME with a
  local plugin of two actions; WebKit on its dev UI picked "Inspect
  agent" on Claude Code and "Inspect provider" on a local provider, and
  the page logged {"id":"about-agent","agent":{"id":"claude","name":
  "Claude Code"}} then {"id":"about-provider","provider":{"id":
  "local-try","name":"Local Try"}}, one frame. Not clicked in the
  WKWebView window itself; the frame's loading there is
  TestPluginPageLoadsItsFilesInTheWindow's.
2026-10-18 07:13:12 +08:00
yetone d694d9bf8f agent: TestKeptAddressProbeNeverWaitedFor tests that Drift returns, not that it returns within a second
It went red in a full run at load average ~300 ("Drift waited for the
probe") because Drift, which reads the agent's files, took over a second.
The probe it starts is held until the test releases it, so a Drift that
waited for it would never return: the test now waits up to 30s for Drift
and fails only if it hasn't returned.

Run: broken by hand (Drift calls the probe before returning), red at
38.9s with "Drift waited for the probe"; restored, go test -count=3
-run TestKeptAddress ./internal/agent/ ok.

Full run, with the rest of its series:
  this series (P5, the Plugins dot, the probe test, P6, and a
  built-ins-on commit since dropped for main's own 5a2414acd) was run
  together, at load 200-660.
  At the pushed tree, 88dfab2d3 on origin/main 5380114da (rebased
  from 210bc2b77, no conflicts; its GUI assets and tests are the same
  bytes as the tree the GUI runs below used, diff -rq): gofmt clean,
  vet darwin/linux nogui/windows ok, TestCoreScriptBudget ok
  (1,446,845 of 1,447,000). go test -timeout 45m ./... at load
  193-278: 62 packages ok, red in TestMainWindowCorners (#1936) and
  TestPluginStreamLargeReplies JSON_fast (client timeout; alone 1 of
  3 red here, 0 of 3 on 5380114da side by side at load ~280; the
  series doesn't touch the stream path; #2551 reopened with the
  output, taken). Two earlier runs at this tree are discarded: one
  stopped when the disk filled, one when another session's go clean
  -cache emptied the build cache mid-run. The whole GUI suite at
  this tree was not finished (the disk filled); the files the series
  reaches ran (1318 tests, 124 red), and the 39 red files ran again
  at concurrency 1 on both trees: here 148 ok 120 red, origin/main
  135 ok 127 red. Both sides' reds are page.goto/launch timeouts
  under load (66 here, 71 there) and the same assertions:
  title-bar-tools' and settings-proxy-auth's "access control checks"
  on a cut-off /api/providers read (#2740, taken next), sidebar's
  "the list unrolls" and WebKit "#prefs pressed darkens" (#2684;
  alone, 1 red here, 3 on main), side-toggle (#2732); plugin-move
  red on main only. Six files again one by one on both trees:
  plugin-actions red 1 of 6 here, a 5s goto of ?view=plugins at load
  260; plugin-clash red on both; plugin-own-icon, plugin-gateway,
  plugin-checkin ok on both; settings-proxy-auth ok here, 3 red on
  main.
  At 976c9893a (on origin/main 6f950653f): go test -timeout 45m ./...
  red only in TestMainWindowCorners (#1936, the window's process
  killed at its deadline) and TestSetAnswersWhileDevinAndProvidersHang
  (#1375, 3 of 3 alone). The whole GUI suite, both engines: 10834
  tests, 237 red in 73 files, 184 of them a 180s browser launch. Those
  73 files run again at concurrency 2: 52 green, among them every
  plugin-* and agent-* file and plugin-actions; the 21 still red were
  run at origin/main f191d6423 and are red there too: codex-predictions
  (#2624), lightweight (#2638), segs-glide (#2683), usage-agents-hide
  (#2276), provider-advanced-fold (#2552), routing-bodies (#2559),
  routing-model-rest and rest-try-now (#2115, #2564), routing-keys-fold
  (#1612), routing-wb-restricted (#1905), routing-request-metrics
  (#2571), quota-count-wrap and quota-name-translated (#2228), s3-sync
  (#2448), usage-checkin (#2549), usage-ledger-abort (#2700),
  tencent-access-key (#2733), usage-range (#2734); side-toggle's WebKit
  motion red 1 of 3 on main, 0 of 3 here (#2732); usage-fold green alone.
  Rebased onto origin/main 717b69f78 (60725faa1, no conflicts): gofmt
  clean, vet darwin/linux nogui/windows ok; go test -timeout 45m ./...
  red in TestSetAnswersWhileDevinAndProvidersHang (#1375) and agent and
  gateway at the 45m alarm with tests still moving at load 400+, both ok
  alone (1173s, 1167s); 105 GUI files the series reaches (plugin*,
  sidebar*, side-*, settings*, title*, header*, agent-*): 1322 tests,
  23 red, run alone 214 of 218 ok, the 4 left in sidebar and
  sidebar-overlay-scrollbar (WebKit), red on 717b69f78 too (#2684,
  #1863). The whole GUI suite was not run again after the rebase.
2026-10-18 07:13:11 +08:00
yetone 8e44c2f351 gui: the dot on Plugins says what it is, and leads to the plugins with an update
The owner, on the sidebar's dot beside Plugins: no one can tell what it
means, and once they click it, they should see which plugins need
updating. It meant "a plugin update is waiting", said only in a hover
title, and Plugins opened on whatever tab was last open.

- Sidebar: under Plugins, Installed reads "1 update" / "N updates" in the
  dot's colour in place of its count, with a title saying where to update.
- Opening Plugins while an update waits lands on Installed.
- Installed names the plugins with a newer version in a bar above the
  list, with Update all beside them (moved there from the footer).
  Each row still shows its own "vX out" and Update.
- Strings in zh, zh-TW, ja and de; the docs (en, zh, ja) say the same.

Run:
- plugin-updates.test.cjs: chromium and webkit, en zh zh-TW ja de, at
  1024 (sidebar) and 600 (tab bar), 22 ok. Also ok in both engines:
  plugin-git, plugin-update-button, plugin-check-updates,
  plugin-card-update, plugin-prerelease, nav-sub-unroll, sidebar,
  builtins, i18n-keys. go test ./internal/gui/ -run
  'TestCoreScriptBudget' ok.
- Broken by hand, each red: no sidebar label (the 1024 cases), no jump
  to Installed, no bar (every case).
- Looked at in WebKit screenshots, zh at 1024 and de at 600.

Full run, with the rest of its series:
  this series (P5, the Plugins dot, the probe test, P6, and a
  built-ins-on commit since dropped for main's own 5a2414acd) was run
  together, at load 200-660.
  At the pushed tree, 88dfab2d3 on origin/main 5380114da (rebased
  from 210bc2b77, no conflicts; its GUI assets and tests are the same
  bytes as the tree the GUI runs below used, diff -rq): gofmt clean,
  vet darwin/linux nogui/windows ok, TestCoreScriptBudget ok
  (1,446,845 of 1,447,000). go test -timeout 45m ./... at load
  193-278: 62 packages ok, red in TestMainWindowCorners (#1936) and
  TestPluginStreamLargeReplies JSON_fast (client timeout; alone 1 of
  3 red here, 0 of 3 on 5380114da side by side at load ~280; the
  series doesn't touch the stream path; #2551 reopened with the
  output, taken). Two earlier runs at this tree are discarded: one
  stopped when the disk filled, one when another session's go clean
  -cache emptied the build cache mid-run. The whole GUI suite at
  this tree was not finished (the disk filled); the files the series
  reaches ran (1318 tests, 124 red), and the 39 red files ran again
  at concurrency 1 on both trees: here 148 ok 120 red, origin/main
  135 ok 127 red. Both sides' reds are page.goto/launch timeouts
  under load (66 here, 71 there) and the same assertions:
  title-bar-tools' and settings-proxy-auth's "access control checks"
  on a cut-off /api/providers read (#2740, taken next), sidebar's
  "the list unrolls" and WebKit "#prefs pressed darkens" (#2684;
  alone, 1 red here, 3 on main), side-toggle (#2732); plugin-move
  red on main only. Six files again one by one on both trees:
  plugin-actions red 1 of 6 here, a 5s goto of ?view=plugins at load
  260; plugin-clash red on both; plugin-own-icon, plugin-gateway,
  plugin-checkin ok on both; settings-proxy-auth ok here, 3 red on
  main.
  At 976c9893a (on origin/main 6f950653f): go test -timeout 45m ./...
  red only in TestMainWindowCorners (#1936, the window's process
  killed at its deadline) and TestSetAnswersWhileDevinAndProvidersHang
  (#1375, 3 of 3 alone). The whole GUI suite, both engines: 10834
  tests, 237 red in 73 files, 184 of them a 180s browser launch. Those
  73 files run again at concurrency 2: 52 green, among them every
  plugin-* and agent-* file and plugin-actions; the 21 still red were
  run at origin/main f191d6423 and are red there too: codex-predictions
  (#2624), lightweight (#2638), segs-glide (#2683), usage-agents-hide
  (#2276), provider-advanced-fold (#2552), routing-bodies (#2559),
  routing-model-rest and rest-try-now (#2115, #2564), routing-keys-fold
  (#1612), routing-wb-restricted (#1905), routing-request-metrics
  (#2571), quota-count-wrap and quota-name-translated (#2228), s3-sync
  (#2448), usage-checkin (#2549), usage-ledger-abort (#2700),
  tencent-access-key (#2733), usage-range (#2734); side-toggle's WebKit
  motion red 1 of 3 on main, 0 of 3 here (#2732); usage-fold green alone.
  Rebased onto origin/main 717b69f78 (60725faa1, no conflicts): gofmt
  clean, vet darwin/linux nogui/windows ok; go test -timeout 45m ./...
  red in TestSetAnswersWhileDevinAndProvidersHang (#1375) and agent and
  gateway at the 45m alarm with tests still moving at load 400+, both ok
  alone (1173s, 1167s); 105 GUI files the series reaches (plugin*,
  sidebar*, side-*, settings*, title*, header*, agent-*): 1322 tests,
  23 red, run alone 214 of 218 ok, the 4 left in sidebar and
  sidebar-overlay-scrollbar (WebKit), red on 717b69f78 too (#2684,
  #1863). The whole GUI suite was not run again after the rebase.
2026-10-18 07:13:10 +08:00
yetone b9f790d37b plugins: panels in magpie's pages, a page that replaces a built-in one, titles in the window's language, and a look that matches
P5 of the plugin runtime (docs/subsystems/plugin-runtime.md):

- Panels (magpie.panels): a plugin draws a frame into a slot of a
  built-in page (a provider's editor, Settings, Usage); magpie.context
  says where it is, and the frame is as tall as what it draws.
- A page can replace a built-in one (magpie.page.replaces); show() opens
  it in that page's place, and the sidebar row goes to it.
- page.titles and a panel's titles name it in the window's language
  ({"zh": …}); a malformed map is dropped, the title kept
  (TestWindowTitles).
- main's #2501 already names wails:// in the policy of a page in the
  desktop window (through ownWindow), which is why the usage page drew as
  bare HTML from v0.1.1259. TestPluginPageLoadsItsFilesInTheWindow loads
  a page through ownWindow in a real WKWebView, which Playwright on http
  can't; the subsystem page says how.
- The bridge adds magpie's look for what a page leaves unstyled, every
  rule in :where() so any rule of the page's wins, and the theme's
  colours as --magpie-* variables.

One commit: the panels, the replacing pages and the titles share hunks
in page.go, pluginpage.go, pluginpages.js and the docs, and couldn't be
split cleanly.

Run:
- Full: this series (P5, the Plugins dot, the probe test, P6, and a
  built-ins-on commit since dropped for main's own 5a2414acd) was run
  together, at load 200-660.
  At the pushed tree, 88dfab2d3 on origin/main 5380114da (rebased
  from 210bc2b77, no conflicts; its GUI assets and tests are the same
  bytes as the tree the GUI runs below used, diff -rq): gofmt clean,
  vet darwin/linux nogui/windows ok, TestCoreScriptBudget ok
  (1,446,845 of 1,447,000). go test -timeout 45m ./... at load
  193-278: 62 packages ok, red in TestMainWindowCorners (#1936) and
  TestPluginStreamLargeReplies JSON_fast (client timeout; alone 1 of
  3 red here, 0 of 3 on 5380114da side by side at load ~280; the
  series doesn't touch the stream path; #2551 reopened with the
  output, taken). Two earlier runs at this tree are discarded: one
  stopped when the disk filled, one when another session's go clean
  -cache emptied the build cache mid-run. The whole GUI suite at
  this tree was not finished (the disk filled); the files the series
  reaches ran (1318 tests, 124 red), and the 39 red files ran again
  at concurrency 1 on both trees: here 148 ok 120 red, origin/main
  135 ok 127 red. Both sides' reds are page.goto/launch timeouts
  under load (66 here, 71 there) and the same assertions:
  title-bar-tools' and settings-proxy-auth's "access control checks"
  on a cut-off /api/providers read (#2740, taken next), sidebar's
  "the list unrolls" and WebKit "#prefs pressed darkens" (#2684;
  alone, 1 red here, 3 on main), side-toggle (#2732); plugin-move
  red on main only. Six files again one by one on both trees:
  plugin-actions red 1 of 6 here, a 5s goto of ?view=plugins at load
  260; plugin-clash red on both; plugin-own-icon, plugin-gateway,
  plugin-checkin ok on both; settings-proxy-auth ok here, 3 red on
  main.
  At 976c9893a (on origin/main 6f950653f): go test -timeout 45m ./...
  red only in TestMainWindowCorners (#1936, the window's process
  killed at its deadline) and TestSetAnswersWhileDevinAndProvidersHang
  (#1375, 3 of 3 alone). The whole GUI suite, both engines: 10834
  tests, 237 red in 73 files, 184 of them a 180s browser launch. Those
  73 files run again at concurrency 2: 52 green, among them every
  plugin-* and agent-* file and plugin-actions; the 21 still red were
  run at origin/main f191d6423 and are red there too: codex-predictions
  (#2624), lightweight (#2638), segs-glide (#2683), usage-agents-hide
  (#2276), provider-advanced-fold (#2552), routing-bodies (#2559),
  routing-model-rest and rest-try-now (#2115, #2564), routing-keys-fold
  (#1612), routing-wb-restricted (#1905), routing-request-metrics
  (#2571), quota-count-wrap and quota-name-translated (#2228), s3-sync
  (#2448), usage-checkin (#2549), usage-ledger-abort (#2700),
  tencent-access-key (#2733), usage-range (#2734); side-toggle's WebKit
  motion red 1 of 3 on main, 0 of 3 here (#2732); usage-fold green alone.
  Rebased onto origin/main 717b69f78 (60725faa1, no conflicts): gofmt
  clean, vet darwin/linux nogui/windows ok; go test -timeout 45m ./...
  red in TestSetAnswersWhileDevinAndProvidersHang (#1375) and agent and
  gateway at the 45m alarm with tests still moving at load 400+, both ok
  alone (1173s, 1167s); 105 GUI files the series reaches (plugin*,
  sidebar*, side-*, settings*, title*, header*, agent-*): 1322 tests,
  23 red, run alone 214 of 218 ok, the 4 left in sidebar and
  sidebar-overlay-scrollbar (WebKit), red on 717b69f78 too (#2684,
  #1863). The whole GUI suite was not run again after the rebase.
- plugin-panels' tall panel (body{margin:0}) measured 220, not 180,
  after the look above gave an unstyled body 20px of padding; the
  fixture now sets padding:0 too, as a page that wants none would.
  plugin-panels ok in chromium and webkit after.
- gofmt -l clean; go vet darwin, linux (-tags nogui) and windows ok.
- GUI: plugin-page and plugin-panels in chromium and webkit, en zh zh-TW
  ja de, wide and narrow, ok.
- Broken by hand, each red then green: titled() in pluginpages.js
  (the "draws in its frame" test), the wails:// scheme in pagePolicy
  (the WKWebView test, before the rebase onto #2501), titles' parsing
  (TestWindowTitles).
- Real use: the published @magpie-community/page-usage 0.1.1 in a
  sandbox magpie window, its tiles styled.
2026-10-18 07:13:09 +08:00
yetone 5380114da1 LESSONS: 10-17: runs recorded at another tree, "under load" reds left unowned, a body scan on every passing reply
Folds the review of 10-17 04:00 to 10-18 04:00 (77 commits, v0.1.1277
to v0.1.1283) into LESSONS.md, and moves two lessons seen a third day
into docs/code-standards.md:
- magpie's default never overrides a value the user set (10-05, 10-10,
  10-17: 5a2414acd's Essentials to All, #2749), a row under "What a
  change contains";
- a checkout, worktree or log belongs to the session that made it
  (10-09, 10-12, 10-17: 7660399a1's worktree checked out by another
  session, 17557132c's log deleted), under Commits.

New lessons, each seen once:
- a named sibling left alone gets an issue (d4a1b9baa, plugins#176)
- a fix that only covers new data says what happens to the old
  (dccfefdf7)
- keep a suite's log whole (5b12407e8)
- close a two-part issue when both parts are fixed (#2449, #2702)
- a size budget raised on every hit bounds nothing (#2710)
- a publish run red for one package hides new failures (plugins#180)

Seen a second day:
- hot-path cost, widened from a polled field to b14784c03's body scan,
  fixed in 7ac20247a
- one suite per machine (load 313 on 10-17)
- the #1794 pattern of "seen again" comments with no owner (#2444,
  #2737), with one test filed three times (#2169, #2711, #2737)

Also adds the criteria still missed on 10-17 (a run record at a tree
other than the pushed one, a wrong issue cited) and what was done right
(the retire stack, df3734b95, f550d3699, 48aae83b8 and others).

Docs only. Every sha and issue number was checked against git log, gh
and the commit bodies.
2026-10-18 04:43:41 +08:00
yetone 7ac20247a9 gateway: a large passing reply is not read for why it failed, so a 24MB JSON reply reaches its client again (#2551)
b14784c03 put `failure(hw.code(), hw.errBody())` in the if's init of the
check that asks a too-small fallback last. An init runs before the
condition, so it ran on every try, a passing one too. A JSON reply is
held whole, so errBody is the whole reply. failure() over a 24MB body
took 1m45s on this box without -race. TestPluginStreamLargeReplies'
JSON_fast and JSON_throttled cases then waited past their client's
timeout, red on ubuntu and macOS CI at b14784c03 (run 39057486035) and
b36819d34 (run 39059788085). SSE passes through unheld, which is why
only the JSON cases failed.

The body is now read last in the condition, after hw.failed() and the
other cheap checks, as every other failure() call in serve already
does. The other callers were checked: each one is behind hw.failed() or
a status switch (passing() reads the body only for a 429).

Run (worktree at origin/main b36819d34 + this, sandbox HOME, pinned
caches, load 230 to 400):
- TestPluginStreamLargeReplies at origin/main: JSON_fast FAIL 77.9s and
  JSON_throttled FAIL 77.8s (client timeout), SSE both pass. This is the
  test that fails without the change.
- with the change: all 4 pass (JSON 45.0s and 42.0s, SSE 10.4s and 11.1s).
- failure(200, 24MB JSON) timed alone: 1m45.6s (scratch test, not
  committed).
- go test -tags nogui ./internal/gateway -count=1 -timeout 45m: ok (1941s).
- gofmt -l clean; go vet for darwin, GOOS=linux -tags nogui and
  GOOS=windows: ok.
Not run: the whole ./... suite, since the change is one condition in
internal/gateway/gateway.go. CI runs it.
2026-10-18 04:40:49 +08:00
yetone b36819d349 redact: a long string already scrubbed is not run through the rules again
yetone/magpie-releases#24: ~19% of the profile was gateway
recordConversation -> conversationTurn -> redact.ScrubJSON -> mask. Codex
sends its whole history on every turn, and what is kept of each request
is scrubbed whole, so each turn ran every rule over the whole session
again: O(history) per turn.

Scrub now remembers, for strings of 256 bytes or more, what it made of
them, keyed by SHA-256 of the string and by knownGen. What Scrub returns
depends only on the string and on the values known (rules are static);
known.go bumps knownGen whenever that set changes (a value added or
replaced, a reindex after values are let go), and a result made at
another generation is never used. Nothing is kept but the hash and, when
the string changed, the scrubbed text. Two generations of at most 32,768
entries / 32 MB each. ScrubJSON's fallback for a body that isn't JSON is
unchanged, so a failed parse still scrubs line by line; nothing is
recorded unscrubbed.

Measured (Apple M4 Pro, BenchmarkScrubCodexTurn: turn 301 of a Codex
Responses history, 1.3 MB, each turn's tool output ~4 KB of code naming
tokens, keys and URLs, scrubbed after turn 300 was):
  before (memo off): 2.81 s/op
  after:             0.10 s/op, 5.4 MB and 21.6k allocs/op

TestScrubRunsTheRulesOnceAString: turn 41 after turn 40 runs the rules
over one long string (its new output); on the old behaviour (memo off)
it fails with "the rules ran over 41 strings for one new turn". It also
checks the output is the same as a fresh scrub.
TestScrubMemoForgetsWhenAValueBecomesKnown: a string remembered as clean
is redacted once a value in it is masked elsewhere (Scrub and ScrubJSON).
TestScrubMemoKeepsTheSecretOut, TestScrubMemoBounded.

Run: go test -tags nogui -count=3 ./internal/redact/ ok; the full suite
as in the sessions commit before this one (same tree). agent and gateway rerun at a lower load: ok; gui rerun: ok. (The first
rerun had TestPluginStreamLargeReplies red on time again, #2551, which
passes alone in 22s, and TestDiffLines at 2.04s against its 2s bound,
filed as #2766.)
gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ./... ok.

Rebased onto b14784c03: go test -tags nogui ./internal/redact/ ./internal/sessions/ ./internal/usage/ ok; gofmt -l clean; GOOS=linux/windows vet of both ok.
2026-10-18 02:49:19 +08:00
yetone 3b3bc359da sessions: a long Codex session being written is read on from where it was, not from its first line
yetone/magpie-releases#24 (LeiCheng42, v0.1.1280): a 30s profile while
Codex ran shows magpie at about a core, ~24% of it in
usage.prefetchSources -> sessions.ReadCallSource -> readCalls -> scanAt.
The tray's usage loop (watchTrayUsage -> usage.QueryPage(Today)), the
usage API and the Sessions page read every source whose size or mtime
changed, and an active Codex rollout changes each turn. A Codex
continuation's index weighs about six entries a call, so a session past
~1,365 calls was over the shared 8192-entry revision budget: its window
was dropped, and every append parsed the whole rollout again from offset
0, for the Requests reader and the summary (List) alike.

Now up to two (revisionActiveFiles) recently written Codex sessions keep
their window past the shared budget, each up to 16x it (131,072
entries), and only while the file changed in the last revisionIdle
(5 min). The full parse built the same index on every append anyway, so
this costs no more at its peak; an idle session still loses it.

Measured (Apple M4 Pro, BenchmarkLongCodexSessionAppend: a 2,000-call,
10.7 MB rollout, one turn appended, then ReadCallSource + List(0)):
  before: 0.87-1.09 s/op
  after:  26-60 ms/op

TestLongCodexSessionAppendReadsOnlyTheAppend (via a scanAt hook) checks
that each of three appends is read from the previous size by both
readers, and that the result DeepEquals a fresh read of the whole file
(calls and summary) after the caches are dropped. On the old code it
fails: "append 0: read from 0, not where the last read ended
(10691427)". TestRevisionEntryBudget covers the two-window cap and the
idle/oversize drops.

Run: go test -tags nogui ./internal/sessions/ ok;
go test -tags nogui -timeout 45m ./... with the redact change on top,
under a load average of 440-610 from other sessions' suites: 59 ok, and
agent and gateway (45m timeout), gui (TestSetAnswersWhileDevinAndProvidersHang,
set took 1m30s), edit (TestTOMLBigFileParsesInLinearTime, 1.0s) and
middleware (TestStream, onEvent "took too long") failed on time. edit and
middleware rerun alone: ok. agent and gateway rerun at a lower load: ok; gui rerun: ok. (The first
rerun had TestPluginStreamLargeReplies red on time again, #2551, which
passes alone in 22s, and TestDiffLines at 2.04s against its 2s bound,
filed as #2766.)
gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ./... ok.
2026-10-18 02:43:03 +08:00
yetone b14784c03f gateway: a fallback too small for the request is asked once every account with room is out of its allowance (Kai on Discord)
Kai on Discord (0.1.1278): Claude Code to claude/claude-opus-5-5, the
Claude provider's two subscription accounts (Max, Pro) both at their
limit ("resets 5:58am", "resets Oct 18 at 3pm"), its Fallback
codex/gpt-6.1-sol. Routing said the second account's 429 had nobody left
to try, and Claude Code had the 429. The fallback was never in the
route's order.

Cause: roomy (0f398c489, 10-15) leaves out, before anyone is asked, a
candidate whose known window is no larger than the request's estimate.
A Codex account's gpt-6.1-sol is 272K (its live list's context_window);
Opus holds 1M. A Claude Code conversation past ~272K tokens left the
Codex fallback out of the candidates and the trace's order, silently,
and when both Claude accounts failed for their allowance the agent was
told to wait hours. "It worked yesterday": the conversation was shorter.
A short request on current main already fell back (the new test's first
cases pass on the old code).

Fix: roomy hands back what it left out (small, with its order rows).
When the last candidate with room fails out of its allowance or credit
(failQuota/failCredit), nothing before it failed otherwise (other ==
nil), no account is pinned, and it isn't an overflow, refusal or
turned-away prompt, those left out that aren't resting are appended and
asked, their rows added to the trace's order, and the failed one rests
as one before the last does. The too-small fallback's overflow then
reaches the agent through the existing outgrew path, to compact, after
which it holds the conversation. Any other failure (a bad key, a busy
vendor) reaches the agent as before, the small member not asked, so
dgqyushen's free-200K-first group keeps its behaviour. Streaming and
non-streaming share the loop; count_tokens and System One's decision
models don't go through roomy. The Routing page still shows a member
left out and not asked only by its absence (no GUI change).

Tests:
- TestClaudeAccountsSpentFallBackToCodex (new): fake `claude` CLI that
  answers every account with rate_limit_event rejected + "You've hit
  your limit", a fake Codex backend, Claude's Fallback codex/gpt-6.1-sol,
  Codex's window 272K. Short request streamed / not / with accounts
  already resting: Codex answers (green before and after). A ~375K-token
  request streamed and not: red on the old code (429, codex asked 0,
  order = the two Claude accounts), green now.
- TestMemberTooSmallIsTheLastResort (new): group paid(10K) then
  free(2K), a 2.2K request. paid 401: the agent gets the 401, free not
  asked. paid 429 insufficient_quota: free answers, paid rests, free in
  the order.
- TestRoomyLeavesWhatItCantJudge checks the handed-back candidates.

Broken by hand:
- the new block disabled (false &&): both stream cases of the Claude
  test red (429, codex asked 0), TestMemberTooSmallIsTheLastResort red
  (429 insufficient_quota, free 0). Restored: green.
- the quota condition forced true: TestMemberTooSmallIsTheLastResort's
  401 case red (free asked, 200). Restored: green.
- the other == nil condition removed: still green; no test has an
  earlier member failing otherwise before a quota failure.

Run:
- gofmt -l: clean. go vet ./internal/gateway (darwin), GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./... at de671719a (load ~240-470): every package ok,
  internal/gateway included (2451s), except three reds in packages this
  doesn't touch, each already filed and each a timing bound under load:
  internal/gui TestMainWindowCorners/macOS_26_SDK killed at its deadline
  (#1936, #2645; red alone too on this loaded machine), internal/library
  TestCheckStdio/timeout_ends_the_tree (#2765; -count=3 alone: ok),
  internal/plugin TestStopLetsARenewalEnd (#2743; -count=2 alone: ok).
- After rebasing on origin/main: go test ./internal/gateway -run with the
  new and roomy/overflow tests: ok.

Not done: Routing still shows a member left out and not asked only by
its absence; a row saying "too small for this request" would be a GUI
and i18n change of its own. Not tried against Kai's real accounts.
2026-10-18 02:17:02 +08:00
yetone a3b48e0f74 gateway tests: TestTranslatedStreamKeepsClientAlive gives a loaded scheduler room (#2169, #2711, #2737)
The test's client hung up after 150ms of hearing nothing counted, while
the gateway's keepalive gap is 10ms. Under load (300-600 on the dev box,
CI's macOS race shard at bf931f82c) the scheduler alone held a 150ms
gap, so each of the three subtests went red in turn and was filed apart:
chat_to_anthropic (#2169), responses_to_chat (#2711), chat_to_responses
(#2737). The red logs show the gateway did send keepalives (5-6 of the
provider's 7-10) and the gap was a stall, not a missing one.

The client now waits 500ms and the provider stays quiet for 1.5s
(quietFor, idleFor). Without magpie's keepalives the client still hears
nothing for three of its timeouts, so the test still proves what it is
about.

Run in a worktree at e44b9aef3, sandbox HOME and TMPDIR:
- go test -tags nogui -race -count=10 -cpu 1,2 -run
  TestTranslatedStreamKeepsClientAlive ./internal/gateway, load ~560-620:
  before, 2 of 60 subtests red (responses_to_chat, 0.36s); after, 60 of
  60 green.
- Broken by hand: continuation.go's alive() not calling enc.keepalive():
  all three subtests red ("downstream_keepalives=0 idle_timeout=true");
  restored, green.
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok
  (1557s). gofmt -l clean; go vet -tags nogui ./internal/gateway on
  darwin, GOOS=linux and GOOS=windows clean.
- Not run: the full ./... suite. Only internal/gateway compiles this
  file, and nothing outside it changed.
2026-10-18 02:13:40 +08:00
yetone e44b9aef33 middleware: onProvider changes what one provider a request is tried on is sent
A JS gateway middleware can export onProvider(body, ctx). The gateway
calls it on each try, just before the body goes to that provider, with
ctx.provider = {id, name, account, model}: account is the subscription's
kind (claude, antigravity, …), absent for a key. Every try starts again
from the body onRequest left, so a change for one provider never reaches
another in a routing group. null and ctx.reject turn nothing away there.
A hook that throws or runs past 250ms leaves the try's body as it was.

A plugin could act only before routing until now, by the model name the
agent asked for. Claude Desktop asks for opaque aliases, so a plugin
couldn't tell which vendor a request was going to. The first user is
@magpie-community/middleware-antigravity-cloak: it changes only what an
Antigravity account is sent, so that Antigravity stops refusing Claude
Code's system prompt (xzplzpl on X). magpie itself still sends every
prompt as the agent wrote it.

- gwmw.To and gwmw.Tried; middleware.Run.Tried runs the hooks.
- serveAgent puts the runs on the request's context, and serve's
  candidate loop calls triedOn before the Antigravity foresight, so it
  judges the body that will be sent.
- Docs: gateway-middleware.md, reference.md, integrating.md, and the
  hooks table and community list in site docs plugins.html (en, zh, ja).

Run:
- go test ./... -timeout 45m in a sandbox HOME (macOS, at de671719a):
  every package ok but two. internal/middleware's TestPointsLoadErrors
  pinned the old list of exports; it now says onProvider too, and the
  package is green. internal/gateway's
  TestTranslatedStreamKeepsClientAlive/chat_to_responses went red under
  the full run's load (#2737, numbers added there); -count=10 alone is
  10/10 green, and with no middleware triedOn returns the body as is.
- TestMiddlewareOnProviderPerTry (gateway): a group a/m1 (500) then b/m1;
  a got "asked for a/A/m1/key", b got "asked". With the triedOn call
  replaced by `_ = triedOn` it is red (sent a:"asked" b:"asked").
- TestOnProvider (middleware): per-try bodies, throw and null fail open
  and are counted, a reject is a no-op, a nil Run passes through.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
  on the changed packages.
- node --test internal/gui/tests/plugin-middleware.test.cjs: 24 pass.
- Real use: a sandbox magpie built from this tree, a real Antigravity
  account, the plugin installed from its folder. Real Claude Code 2.1.302
  (`claude -p` with a sandbox CLAUDE_CONFIG_DIR, model
  antigravity/gemini-3-flash) got its answer. With the plugin's
  {"off": true} the same run got the 400 "Resource has been exhausted".
  Direct /v1/messages with the billing line, the Agent SDK line, and
  Claude Code's three blocks: 200 each with the plugin on, 400 each with
  it off.
2026-10-18 00:50:14 +08:00
yetone de671719a0 provider: a retired built-in's failed move is tried again in 10 minutes, not 6 hours
A failed move waited moveRetry (6h) before KeepRetiringMoved tried it
again. That was fine while the built-in carried on serving the accounts.
A retired built-in serves nothing, so a move that failed for a moment
(npm out of reach, or the plugin listed in plugins.json but not installed
yet, which the real-account run on 85b8f6d4d hit with Command Code: the
first Move failed, the second worked) left the user's subscription
unserved for up to 6 hours unless they pressed Move.

- retryWait(id) is retiredRetry (10 minutes) for a retired built-in, and
  moveRetry otherwise. MoveRetiring and HandOver both use it (retryDue).
- KeepRetiringMoved's next run is brought forward to when a retired
  built-in's failed move is due (nextRetiringRun, at least a minute),
  instead of always an hour.
- docs/subsystems/provider-plugins.md says so.

TestMoveCutShort now also checks:
- a failed move 11 minutes old waits while the built-in serves it, and
  the next run is an hour;
- once retired, the next run is 10 minutes, it isn't tried at once, and
  it is moved after retiredRetry.

Broken by hand, each red:
- retryWait returning moveRetry for a retired built-in:
  "a retired built-in after retiredRetry: map[]"
- nextRetiringRun always an hour:
  "the next run after a retired built-in's failed move: 1h0m0s, not 10m0s"

Run: go test -tags nogui ./internal/provider -run TestMoveCutShort: ok.

What was run for the stack, at load ~300 (it was rebased from bad4508c4
onto 1acd79cdf; the only conflicts were in
docs/subsystems/gateway-routing.md, resolved to main's text with each
commit's own edit, checked word by word):

- At this commit's tree (bda209c1f, on 1e643ba7e; then rebased onto 1acd79cdf, where vet on all three systems and internal/gui ran clean):
  gofmt -l clean; go vet darwin/linux/windows clean; go test
  ./internal/provider ./internal/cli ./plugins/search ok; ./internal/gateway
  -run 'Jev|Auto|Review|Plugin|Retire|Move|Search' ok. The full suite
  wasn't run again on 1e643ba7e's four new commits (a provider display
  name, two Jev changes, auto-mode review), none in a file the stack
  touches but the gateway-routing doc; CI runs it before the tag.
- Full suite at 3f0858b6f (on c4aeaec74): gofmt -l
  clean, go vet darwin/linux/windows clean, go test -tags nogui ./...
  -count=1 -timeout 90m: 64 ok, exit 0.
- Full suite at a42a1090c (on 89521b03d) and ee288bc65 (on 717b69f78):
  the same, 64 ok, exit 0. Factory's own min commit (0.1.32) was dropped
  in the last rebase: main raised it to 0.1.33 in b5c76935b.
- Full suite at cbf4626a3 (on bad4508c4): gofmt -l clean, go vet darwin/linux/windows
  clean, go test -tags nogui ./... -count=1 -timeout 90m: 64 ok, exit 0.
  At 4c6c99bbd the same run had gateway red on TestPluginStreamLargeReplies
  only (#2551; passes alone, 181.957s).
- GUI: retired-move 4/0 in both engines. The remaining 519 files ran at
  85b8f6d4d, two at a time (3864 ok, 109 not ok when this was written;
  18 of the reds are browser launch timeouts). Each red file was run
  alone at the head, and those still red were run on origin/main
  bad4508c4:
  - red the same on main, filed: segs-glide 20/20 (#2683), routing-bodies
    (#2559, #2658), routing-model-rest (#2115), routing-keys-fold (#1612),
    routing-wb-restricted (#1905), provider-advanced-fold (#2552), sidebar
    (#2684), s3-sync (#2448), routing-request-metrics (#2571),
    rest-try-now (#2564), quota-name-translated and quota-count-wrap
    (#2228), lightweight (#2638), codex-predictions (#2624),
    gateway-key-models under load (#2648);
  - green alone: plugin-list-error, sessions-paging, plugin-kinds-discover,
    plugin-kernel, session-terminal, routing-time-went, routing-flood,
    routing-context-fold, routing-agent-gone, plugin-local,
    plugin-key-hint, name-suffix-no-names, nav-sub-unroll, model-api-gemini,
    model-api-preset.
  At ee288bc65: retired-move 4/0, routing-compaction 10/0,
  library-ime-scroll 18/0; title-bar-tools 4/6, red the same on main
  2042123f4 (#2740: a reload cuts off sideGwRead's read).
  The stack's only GUI change is the unmoved line in renderMovable, shown
  only when /api/providers has unmoved entries.
- Real accounts through the plugins (85b8f6d4d, sandbox HOME): grok,
  workbuddy, workbuddy-ai, cursor, zcode 200; devin, commandcode-plan,
  mimo-app 200 after a first timeout; qoder 401 shown as lapsed
  (plugins#181, the built-in had no 10605 handling either). Not tried:
  kiro, factory, zed (no account here).
- The built-in-only WorkBuddy model ids: the plugin reads WorkBuddy's live
  list, which doesn't offer them.
2026-10-17 23:15:26 +08:00
yetone 3443d18c31 gui tests: keychain-retry waits for the status that comes after the state is read
keychain-retry.test.cjs was red under load, on origin/main d4a1b9baa
(chromium zh) and at this stack (chromium en):

    Expected values to be strictly equal:
    + ''
    - "Codex's sign-in was read from the keychain"

The cause is in the order, not the timing. providerAction renders the
providers (the line goes) and only then awaits /api/state before it says
the status. The test read #status as soon as the line was detached, so a
slow state read left it empty.

The test's /api/state now answers 400ms late after the retry, which
reproduced the red every time (2 of 2 chromium runs, actual ''). The test
now waits for #status to say the read, then asserts it. A status never
said still fails, after the 5s wait.

Run: node --test keychain-retry.test.cjs, chromium and webkit, en and zh:
8 pass, 0 fail.
2026-10-17 23:11:01 +08:00
yetone 0718beb437 provider: FetchNew waits on no CLI for who is signed in; none feeds a list it fetches
cliIdentities() still held cursorStatus after Cursor's built-in was
retired. Nothing FetchNew fetches waits on `cursor-agent about` any more:
the Cursor plugin lists its own accounts (Listed), and cursorIdentity
only names its carried-over account. But a page's FetchNewBehind still
found the never-asked CLI unsettled and ran behind the page, so
FetchingNew stayed up on a poll with nothing due, the same loop Devin's
entry caused (TestFetchingNewOnceStarted and
TestFetchingNewForgottenWhileListed red from the Cursor commit on).

Removed: cliIdentities, awaitIdentities, asking, identitiesUnsettled and
identitiesAnswered, and their branches in fetchNewGo and fetchNewHeld,
which now list the accounts once. TestFetchingNewForgottenWhileListed
(#2390) and the CLI half of TestFetchingNewOnceStarted (#1147, #1789)
tested only that wait, and go with it. cursorStatus and devinStatus stay
as cliIdentity, asked by the plugin's own-account name and the movers;
left_alone_test names them itself.

Run in magpie-wt-int (this commit on the retire stack):
  go test -tags nogui -count=1 -run
    'FetchingNew|FetchNew|LeftAlone|Identit|Mover' ./internal/provider: ok
  go vet -tags nogui ./internal/provider; staticcheck -checks U1000
    ./internal/provider: only sameAccount, unused on origin/main too
The full suite at the stack's final head is recorded in the last
commit's body.
2026-10-17 23:11:01 +08:00
yetone bd30b068d3 docs: every deprecated built-in is retired; AGENTS.md and gateway-routing say so
AGENTS.md: the table's subscriptions are retired, not moving; the plugin
does everything, the built-ins' code is gone but for what the movers
read; the "fix the built-in too" step is gone; the parity tests hold
each plugin to what its built-in did.

gateway-routing.md: no bridges to a vendor's own API are left, so the
structured-output, tool-image and billing-line lists lose Cursor, Kiro,
Qoder, Devin and Command Code; Kiro's image ordering is its plugin's.

Run: docs only; the full suite runs at the stack's head.
2026-10-17 23:11:01 +08:00
yetone e431f71a89 gateway, provider: the code only the retired built-ins used is removed
With all eleven built-ins retired, staticcheck U1000 (diffed against
1978eabe5, the stack's base) named what only they reached:

- internal/gateway/connect_pb.go: the hand-made protobuf and Connect
  frames, kept for Cursor's built-in after Devin's went; Cursor's is gone.
- joinNonEmpty (uuid.go), said (said_test.go) and
  askClaudeCodeWebSearch (search_workbuddy_test.go).
- devinAuthorizeURL (signin.go).

The rest of U1000's list is the same at 1978eabe5.

Run: gofmt -l internal clean; go vet -tags nogui ./... on darwin,
GOOS=linux and GOOS=windows clean; the full suite runs at the stack's
head (recorded in the push).
2026-10-17 23:11:01 +08:00
yetone be62bcf79e provider: Command Code's built-in is retired; its plugin serves it
commandcode-plan joins retiredBuiltins (migrate.go): PluginServes is true
for it moved or not, and @magpie-community/opencode-commandcode-auth does
its sign-in, models, requests and usage.

Removed
- Sign-in: the StartSignIn case (startCommandCodeSignIn, the Studio
  callback, cmdOrigins, cmdWhoamiWait, commandCodeCallback/Keep) and the
  pasted-key branch (commandCodeKey, cmdSignedIn).
- Accounts: commandCodeAccount, cmdProvider, cmdSide, cmdLoginList,
  switch/on/forget (switchCommandCodeLogin, setCommandCodeLoginOn,
  forgetCommandCodeLogin, commandCodeAlsoOn), the Logins case, and the
  per-login usage (cmdLoginQuota, cmdQuota, the perLogin fetch). The
  Logins("") list keeps {CommandCodePlanID, nil} so its order holds.
- The Go plan's path: CommandCodeGenerate, cmdGoModels/cmdGoFetch/
  cmdGoRefused, cmdModels, cmdFree/cmdMarkFree, cmdPlansSeen's built-in
  users (cmdRemember, cmdPlanKnown, cmdPlanNow), CommandCodeOutputOf, and
  the account's generate field.
- asksOwnBackend's Command Code case.
- Gateway: the cmdGenerate/serveCommandCode dispatch and countOn's
  cmdGoing clause; internal/gateway/commandcode.go (the /alpha/generate
  translator) deleted.
- Built-in-only tests: gateway commandcode_test.go and
  commandcode_place_test.go, TestBillingLineLeftOutOnCommandCode;
  provider commandcode_go_test.go, commandcode_go_models_test.go,
  commandcode_free_test.go, TestCommandCodePlan,
  TestCommandCodeSignInWhoamiDown, TestCommandCodeSignInAgainToRemovedOwn,
  TestCommandCodeSignInPastedKey.
- Docs: Command Code out of gateway-routing.md's bridge lists (the
  2xx check, structured output, tool images, the billing line).

Kept, and why
- The mover and what it reads: cmdAuth, cmdOwn, cmdWho, cmdLogin,
  cmdSaved, cmdLogins (migrate_side.go, plugin_accounts.go).
- cmdAPI/cmdStudio (plugin_usage.go's moved card), cmdKeysURL
  (pluginsignin_paste.go), the plan and credit readers (cmdPlans,
  cmdPlanOf, cmdPlanName, cmdWindows, cmdLeft, cmdQuotaOf, cmdTime,
  cmdSubscription, cmdKeyWindows, cmdKeyPlanID): the keyed preset
  "commandcode", planquota.go, balance.go and qoder_usage.go use them.
- CommandCodeMaxOutput (models.go caps the plugin's "commandcode-plan"
  models with it), estimatedMoved, chat.go's plugin host cases, the
  gateway parity tests, and the PLUGIN-SERVED notice in
  commandcode_plan.go, now in the retired wording.

Tests whose meaning changed
- TestLoopbackSignInsTakePastedAddress no longer starts Command Code's
  built-in sign-in; the plugin's (TestLoopbackPorts) says its key is
  posted, never pasted as an address.
- The Go plan's free-model marks (TestCommandCodeFreeModels) were the
  built-in's alone; the keyed preset never marked them.

Run (worktree magpie-wt-rt-a, on top of 9a64c4025)
- gofmt -l internal: clean
- go vet -tags nogui ./... (darwin, GOOS=linux, GOOS=windows): clean
- staticcheck U1000 on ./internal/...: no declaration unused that wasn't
  unused at HEAD
- go test -tags nogui -count=1 ./internal/provider/ -run
  'CommandCode|commandcode|Migrat|Move|Moved|Retir|SignIn|AsksOwnBackend|
  SideLogin|Logins|Unmoved|Paste|Loopback|Account|PlanQuota|Balance|
  FetchNew|FetchingNew|LeftAlone|Identit|Order': ok (100s)
- same, -run 'Usage|Card|Quota|Discovery|Exposed|Models|Output': ok
- ./internal/gateway/ -run 'CommandCode|commandcode|Plugin|Parity|Moved|
  BillingLine|Search|ShapeFallback|GroupFails|CountTokens|Count|Format|
  ToolImage|Cursor|Connect': ok (117s)
- ./internal/cli/ ./internal/gui/ -run 'CommandCode|commandcode|Plugin|
  Retired|Moved|SignIn|Login': ok
- Not run: whole packages, the full suite, the GUI node suite (the
  machine is loaded; the parent runs those).
2026-10-17 23:11:01 +08:00
yetone 07a445f42b provider: Devin's built-in is retired; its plugin serves it
"devin" joins retiredBuiltins, as Zed (c0605abc2) and Grok (60ecd598c)
did. @magpie-community/opencode-devin-auth serves it, moved or not.

Removed:
- Sign-in: the PKCE localhost listen and callback branch in signin.go,
  devinExchange/devinExchangeURL. The exchange is Codex's alone again.
- Accounts: devinAccount and devinProvider in the account list, and the
  Logins, switch, on and forget cases (devinSide, devinLoginList,
  switchDevinLogin, setDevinLoginOn, forgetDevinLogin, removeDevinHome,
  addDevinLogin, devinAlsoOn). "devin" keeps its place in Logins("") with
  a nil list.
- Usage: devin_usage.go whole (perLogin fetch, usageLogins, loginQuota).
  devinUsageVersion moved to devin_images.go, which still uses it.
- asksOwnBackend's "devin".
- Gateway: attempt()'s serveDevin dispatch and the Devin translator
  (serveDevin, askDevin, buildDevin, decodeDevin, the Gemini schema and
  tool-description rewriting, the call-id helpers). gateway/devin.go is
  now connect_pb.go and keeps only the protobuf and Connect framing that
  cursor.go uses.
- Tests of the built-in alone: gateway devin_test, devin_gemini_schema,
  devin_sampling and devin_tool_ids; provider devin_usage_test,
  devin_cli_signed_out_test, TestDevinSignIn, TestDevinSeveralAccounts,
  TestSignInInstallsMissingCLI, TestDevinSignInUnseen, the Devin case of
  the required-tools test, and TestDevinSplitParallelCallsKeepTheirResults.

Kept, because the plugin, the devin agent or the move uses them:
- The mover, devinLogins, devinIdentity/devinStatus, DevinAuthAt,
  devinCredentialsAt, newDevinHome, devinCommand/devinProxy.
- DevinFamilies, DevinVariant and models.go's p.ID == "devin" shaping
  (the plugin's provider id is "devin" too). internal/agent/devin.go
  reads the families.
- The installer's "devin" case: the plugin's sign-in installs the CLI.
- The PLUGIN-SERVED notices in devin.go, devin_accounts.go and
  devin_images.go, reworded as retired.

Also fixed:
- cliIdentities no longer lists devinStatus. No look at the accounts
  asks it now, so it stayed unsettled, and FetchNewBehind told every page
  that lists were on their way (TestFetchingNewOnceStarted went red).
- 60ecd598c (Grok) left TestFetchingNewForgottenWhileListed red: its
  hook was GrokExecutable in the account listing. It and
  TestFetchNewListsAgainForAnAnswerWhileListing now hook kiroCLIDB,
  which is read after Cursor's account. Retiring Kiro will need another
  hook.

Tests whose meaning changed:
- TestSignInInstallFails and TestSignInCanceledWhileInstalling go
  through StartPluginSignIn("devin"), the plugin's install of the CLI.
- TestDevinCLIGoesThroughItsProxy seeds both accounts in logins.json
  instead of signing one in. The sign-in's proxy is covered by
  TestPluginSignInGoesThroughItsProxy.
- TestLeftAloneRunsNoCLI no longer expects `devin auth status` when the
  subscription is switched on.
- TestFetchingNewOnceStarted's unanswered CLI is Cursor's.
- devinRawID moved to anthropic_call_ids_test.go. A Devin call id is
  checked as safeCallID("dv_", ...).

Run:
- gofmt -l internal: clean.
- go vet -tags nogui ./... on darwin, GOOS=linux and GOOS=windows: clean.
- staticcheck U1000 on provider and gateway: no Devin leftovers.
- go test -tags nogui -count=1 -run '^(every test in provider, cli and
  gateway that names Devin|TestFetchNew.*|TestFetchingNew.*|
  TestLeftAlone.*|.*Identit.*)$' ./internal/provider ./internal/cli
  ./internal/gateway: ok.
- -run 'Migrat|Move|Moved|Retir|SignIn|AsksOwnBackend|SideLogin|Logins|
  Unmoved|Install|Proxy|Account' ./internal/provider: ok.
- -run 'Devin|Required|Split|CallID|Cursor|Connect|Parity|ToolImage|
  Format|BillingLine' ./internal/gateway: ok.
- -run 'Devin|Plugin|Retired|Moved' ./internal/gui ./internal/agent: ok.
- Not run: the whole packages, the full suite, the GUI node suite (the
  machine is loaded).
2026-10-17 23:11:01 +08:00
yetone 2927a161ef provider: Grok's built-in is retired; its plugin serves it
Grok ("grok") joins Zed in retiredBuiltins. It is served by
@magpie-community/opencode-grok-auth, moved or not.

Removed, the built-in's own paths:
- the sign-in (startGrokSignIn) and the per-account homes it made;
- the Logins/switch/on/forget cases and the alsoOn branch;
- grokAccount and the account list entry;
- the usage fetch (grokSubscriptionUsage, grokLoginUsage, the windows);
- the model list (grokModels, grokContextModels, the window labels);
- the token refresh, the headers, the version probe, and routing's usage
  clearing.
grok_usage_test.go is deleted, along with the six built-in-only tests in
grok_test.go and the four in grok_accounts_test.go.

Kept, because something still uses them:
- grokLogins and readGrokCredential, for the mover (migrate_side.go);
- grokBody, for the plugin's request bodies;
- GrokHome, the CLI install (pluginRunsCLI) and GrokBase;
- the gateway's grok draw, video, search and namespace code. It asks
  PluginProvider()=="grok" too.
Each remaining grok file has a PLUGIN-SERVED notice.

Fixes the retirement needed:
- movedAgent asks Moved again, not PluginServes. A retired Grok that is
  not moved yet still records the CLI's own sign-in, so the move takes it.
  TestMoveGrok fails without this: only the second account moved.
- In Logins(""), a retired built-in keeps its place, with no list. Grok's
  and Zed's accounts list where the built-ins' stood. Without this,
  TestAllLoginsMovedKeepTheirPlace fails ("[zed grok]").

Tests whose meaning changed:
- The gateway's grokSignedIn now serves Grok through the fake plugin
  moved onto "grok". It proxies to provider.GrokBase, read per request
  and refused unless loopback, so no test reaches the network. It names
  127.0.0.1 in fetchPrivate, because the vendor's own host is now the
  fake's.
- TestVideoContentAtPrivateAddressNotFetched clears that setting. Without
  the clear it fails with "200 secret-bytes".
- TestGrokAccountDraws checks the plugin's Authorization only. The real
  plugin's headers are the plugin repo's to test.
- The Grok cases in TestVideosRedacted and TestMediaRedactedErrors reach
  their echo through GrokBase (grokEcho).
- TestVideoModelByItsBareName's chat model is the fake's fake-1.
- TestGrokPluginSearchesItself expects "grok", not grok-plugin.
- TestGrokHideOwnSignIn is removed: hiding the CLI's own sign-in was the
  built-in's ForgetLogin.
- grok_accounts_test.go keeps test-only newGrokHome and addGrokLogin
  fixtures for the mover's tests.

Run in the worktree:
- gofmt -l internal: empty.
- go vet -tags nogui ./... on darwin, GOOS=linux and GOOS=windows: clean.
- go test -tags nogui -count=1 -run
  'Private|Grok|grok|CallerUsageVideos|GatewayKeyModelsHoldTheImageAndVideoLists|RemoteMagpie|Video|Redact'
  ./internal/gateway: ok.
- go test -tags nogui -count=1 -run
  'Grok|grok|Migrat|Move|Moved|Retired|Retir|SignIn|AsksOwnBackend|SideLogin|Hide|OwnRow|Logins|Unmoved'
  ./internal/provider ./internal/cli: ok, ok.
- go test -tags nogui -count=1 -run 'Grok|grok|Plugin|Retired|Moved'
  ./internal/gui: ok.

Not run: the full suite, the GUI node suite, and a real Grok account.
The machine is under heavy load.
2026-10-17 23:11:01 +08:00
yetone 1357236917 docs: the retired built-ins leave the gateway and account pages 2026-10-17 23:11:01 +08:00
yetone 6da19bf181 provider: Factory's built-in is retired; its plugin serves it
"factory" joins retiredBuiltins: every Factory account is served by
@magpie-community/opencode-factory-auth, and the hourly MoveRetiring
moves the ones still on the built-in.

Removed: the built-in's sign-in (factory_signin.go, WorkOS's device
flow), keeping the sign-in (renew, lapse, org reconcile and mend,
headers, factoryGet), its provider and account (factoryProvider,
factoryAccount, factoryAlsoOn), its login list, switch, on/off and
forget, its usage card (factoryLoginQuota), droid's prompt and body
rewriting (factory_client.go), and its rows in signin.go, logins.go,
logins_on.go, login_usage.go, subscription_usage.go and account.go.
zcodeDecode/Encode, kept in zcode.go only for factory_client.go, go
with it. An API key always goes to the plugin now (factoryAddKey), and
`magpie accounts import factory` keeps saying to add it with accounts
add factory; its dead import branches are gone.

Kept: the mover and what it reads (factoryLogins, factorySaved,
factoryCreds, factoryMu); ImportFactoryKeys, factory_key.go and
factoryWhoami, for "Use an API key instead"; droid's model table with
factoryAPIs and factoryCore, since the plugin's provider is named
"factory" (account.go APIs, FactoryGemini and servedByFactory still
answer for it); factoryAPI for the moved provider's host
(builtinHost); factory_usage.go's limits reader behind
FactoryAllowanceForTest, which the gateway's pool tests use; the
gateway's "factory" lists (estimatedMoved, the account check), as the
Zed commit kept zed's; the parity tests.

Tests:
- git rm'd, built-in only: factory_test.go (sign-in, refresh, accounts,
  orgs), factory_client_test.go, gateway factory_agents_test.go
  (droid's line on every wire, the generate route to chat) and
  factory_think_off_test.go (TestPluginThinkingOff covers the plugin);
  TestFactoryAPIKey, TestFactoryKeyAgainReadsUsageAfresh,
  TestFactoryServesModelsAddedSinceItsFetch, TestUserAgentAccountUntouched
  (TestUserAgentFor still covers an account's User-Agent).
- Changed meaning: TestGeminiEmptyReplyIsAnError,
  TestGeminiEmptyRepliesAskedAgain and TestGeminiImageModelReturnsItsImage
  used Factory's generate route as a fake-able Gemini upstream; they now
  use a Gemini API of the user's own (saveGem), the same decoder, and the
  image test checks :streamGenerateContent instead of /api/llm/g/v1/generate.
  TestMovedShowsBuiltinHost's first check is now a plain plugin
  (fakeco), and a retired Factory with no migration record shows
  api.factory.ai. TestFactoryAPIKeyMoved checks factoryLogins() is empty
  instead of the removed factoryLookup. factorySite/factoryJSON moved
  into factory_key_test.go.

Run in this worktree:
  gofmt -l internal: nothing
  go vet -tags nogui ./internal/provider ./internal/gateway ./internal/cli
    ./internal/gui, GOOS=darwin, linux, windows: clean
  staticcheck -checks U1000 -tests=false (darwin, windows) on
    internal/provider: nothing new
  go test -tags nogui -count=1 -run 'Factory|Gemini|PaymentRequired|
    ResetsInWords|UserAgent|UsedWindow|Vertex|PayloadTooLarge|UsageCache|
    AnthropicImage|ThinkingOff|Moved|Retired|Mover|Migrat|Move|
    SayTheirPlugin|Allowance|Discovery|ClaudeModels|GrokPrice|
    LoopbackSignIns|AsksOwnBackend|SideLogin|Import|Accounts|ZCode|MiMo'
    on the four packages: ok (all four); TestFactoryAPIKeyMoved ran with
    Bun (PASS), not skipped.
Not run: whole packages, the full suite, the GUI suite (machine load
~300). Not tried with a real Factory account. docs/subsystems not
changed, as for Zed.
2026-10-17 23:11:00 +08:00
yetone 09b9ae8c02 provider: ZCode's built-in is retired; its plugin serves it
"zcode" joins retiredBuiltins, as zed and mimo-app did: every ZCode
account is served by @magpie-community/opencode-zcode-auth, and the
hourly MoveRetiring moves the ones still on the built-in.

Removed: the built-in's sign-in (startZCodeSignIn, the team sign-in and
its route/key caches), Start Plan (zcode_start.go and its blocked hint,
which account.go Explain and test.go EdgeBlocked named), its client and
prompt (zcode_client.go, zcode_prompt.json), the models list
(zcode_models.go), the OS place readers (zcode_os_*.go), and its rows in
signin.go, logins.go (list, switch, forget), logins_on.go,
login_usage.go, subscription_usage.go and account.go. Tests that covered
only that code are git rm'd (zcode_accounts, _blocked, _client,
_device, _place, _quota, _start, _startmodels) with TestZCodeAccounts,
TestZCodeTeamSignIn, TestZCodeTeamNoSeat and TestZCodeFetchModels.

Kept: the mover (migrate_zcode.go) and what it reads (zcodeLogins,
zcodeSaved, the credential store readers, zcode_device.go's
zcodeDeviceMid); zcodeOwn, the plugin's own account; the Zhipu plan and
team-seat readers planquota.go uses (zcode_team.go, zcodeCall/Get);
zcodeDecode/Encode, moved into zcode.go because factory_client.go uses
them; the gateway's zcode countOn condition and zcode_blocked_test.go
(which builds its Provider directly), as the Zed commit kept zed's; the
StartSignInAt site parameter (generic); plugin_accounts and
account_seats cases; the parity tests.

Tests whose meaning changed: TestZCodePlanKeyFromConfig and
TestZCodeOwnTeam keep only their zcodeOwn checks (the quota, Start Plan
server, provider/Sign/LoginUsage parts were the built-in's).
TestZhipuKeyTeamWindows builds the team key directly instead of signing
in through the removed team sign-in. zcodeTestJWT moved to zcode_test.go
for migrate_movers_c_test.go.

Run in this worktree:
  gofmt -l internal: nothing
  go vet -tags nogui ./internal/provider ./internal/gateway ./internal/cli
    ./internal/gui, GOOS=darwin, linux, windows: clean
  staticcheck -checks U1000 -tests=false (darwin, windows) on
    internal/provider: nothing new (only the pre-existing unused ones)
  go test -tags nogui -count=1 -run 'ZCode|Zcode|Zhipu|Migrat|Move|Moved|
    Retired|LoopbackSignIns|AsksOwnBackend|Mover|SayTheirPlugin|SideLogin|
    PlanKey' ./internal/provider ./internal/gateway ./internal/cli
    ./internal/gui: ok (all four)
Not run: whole packages, the full suite, the GUI suite (machine load
~300). Not tried with a real ZCode account.
2026-10-17 23:11:00 +08:00
yetone b98f906b10 provider: a retired built-in's own account is still listed for its mover
movedAgent asked PluginServes(id) since cfa262509, so once a built-in
is retired sideLogins leaves the agent's own sign-in out as the
plugin's, though nothing has moved it. The mover's out() then never
lists it: MoveRetiring doesn't move it and MoveCandidates doesn't show
it in the Move line, so a user whose only account is the agent's own
(ZCode's, Kiro's, Grok's, ...) would be served by nothing once that
built-in is retired. movedAgent asks Moved(id) again: the own row is
set aside only after a real move.

New: TestRetiredOwnAccountStillMoves retires zcode in the test and
checks ZCode's own account is in its mover's list and in
MoveCandidates.

Run in this worktree (at 488ed5895 plus this change):
  go test -tags nogui -count=1 -run TestRetiredOwnAccountStillMoves
    ./internal/provider: red with movedAgent back on PluginServes
    ("ZCode's own, retired and not moved: {User: ... Own:false}"),
    green with the fix.
  go test -tags nogui -count=1 -run 'Retired|Mover|Migrat|Move|
    SideLogin|Own' ./internal/provider ./internal/gateway ./internal/cli
    ./internal/gui: ok (all four)
  gofmt -l internal: nothing; go vet -tags nogui ./internal/provider
    for darwin, linux, windows: clean.
Not run: whole packages, the full suite, the GUI suite (machine load
~300).
2026-10-17 23:11:00 +08:00
yetone 30fcbf684b provider: Xiaomi MiMo's built-in is retired; its plugin serves it
mimo-app joins retiredBuiltins (migrate.go), the way Zed did in
c0605abc2. @magpie-community/opencode-mimo-auth serves sign-in, refresh,
models, requests and usage.

Removed: the built-in's sign-in (mimo_signin.go), its usage fetch
(mimo_usage.go), its tests (mimo_test.go, built-in only), and its
cases in signin.go begin(), logins_on.go (SetLoginOn and alsoOn),
logins.go (Logins, the side list, switch, forget), login_usage.go
(builtinLogins, quota), subscription_usage.go and account.go. MiMo had
no gateway dispatch of its own.

Kept: mimo.go holds the PLUGIN-SERVED notice ("mimo-app" and the
package name, for TestMovedBuiltinsSayTheirPlugin), MiMoID, mimoCreds,
mimoSaved and mimoLogins, which migrate_mimo.go's mover and
migrate_movers_test.go still read. The GUI's MiMo account label stays
for plugin accounts.

Run in this worktree:
  gofmt -l internal                                  (nothing)
  go vet -tags nogui ./internal/provider ./internal/gateway
    ./internal/cli ./internal/gui                    ok; also GOOS=linux,
                                                     GOOS=windows: ok
  go test -tags nogui -count=1 -run 'MiMo|Mimo|Migrat|Move|Moved|
    Retired|LoopbackSignIns|AsksOwnBackend|Mover|SayTheirPlugin'
    ./internal/provider ./internal/gateway ./internal/cli ./internal/gui
                                                     ok (all four)
Not run: whole packages, the full suite, the GUI node suite (machine
load ~300).
2026-10-17 23:11:00 +08:00
yetone b7ceb53fe4 provider: WorkBuddy's built-in is retired; its plugin serves it
workbuddy and workbuddy-ai join retiredBuiltins, as Zed did in c0605abc2
and Qoder in 43cc3171d. @magpie-community/opencode-workbuddy-auth serves
both, moved or not.

Removed (built-in only):
- provider: workbuddy_models.go (the model list); in workbuddy.go the
  sign-in, token renewal, usage/credits reading, request signing and the
  site's model fetch; the WorkBuddy cases in account.go (Accounts),
  logins_on.go, logins.go (list/switch/forget), login_usage.go,
  subscription_usage.go and signin.go; WorkBuddyBaseForTest, now unused.
- The built-in tests: workbuddy_test, workbuddy_signin_test,
  workbuddy_accounts_test, workbuddy_ai_test, workbuddy_body_test,
  workbuddy_enterprise_test, workbuddy_free_test, workbuddy_names_test,
  workbuddy_spare_free_test, workbuddy_refused_test (provider), and
  gateway/workbuddy_refused_test.

Kept, and why:
- migrate_workbuddy.go (the mover) with what it reads: wbSite, wbCreds,
  wbOwn/wbAuthPath (the desktop's file, sent as a marker), wbLogins,
  wbTokens (back drops a renewed pair).
- workbuddy_checkin.go: the daily check-in now walks the plugin's
  accounts only and sends through the plugin's fetch (a.via); wbCallVia,
  wbNum and the site's api() serve it, and plugin_usage's host.
- WBRestricted/WBRestrictedHint: the gateway reads the plugin's 11140 by
  them. textOnly: applied to the plugin's lists.
- draw_workbuddy and search_workbuddy in the gateway: they serve the
  plugin's provider. The PLUGIN-SERVED notice in workbuddy.go.
- The WorkBuddy agent target (internal/agent) is untouched.

Tests changed in meaning:
- TestFetchNewAccount, TestFetchNewRetriedSoon and
  TestFetchingNewOnceStarted used WorkBuddy as the built-in signed in;
  they use Codex now (codexSignedIn, codexListedAt), same assertions.
- TestFetchPlanWithoutList uses local models; TestWorkBuddyFetchModels,
  TestWorkBuddyAIGLMIsTextOnly and TestOwnStoreSignInAgainDropsTheReading
  (WorkBuddy case) are gone with the code.
- Check-in: TestWorkBuddyCheckinSignedIn is gone; the fixture's account
  is a plugin account signing through via; PluginUnderItsOwnID became
  TestWorkBuddyCheckinPluginAccounts (plugin accounts listed, a built-in
  login left out). TestCheckinAccountsListed reads a moved plugin.
- TestWorkBuddyMover seeds the desktop's logins.json row: retired, the
  built-in no longer writes it, and an existing user's row is what moves
  (red without the row).
- Gateway: the WorkBuddy draw and search tests run through the fake
  plugin (besideFake), without the built-in's header checks;
  TestWorkBuddySearchesForItsModels folded into
  TestWorkBuddyPluginSearches (refusal and search-off checks kept);
  TestLoopEndsWorkBuddysReply is the plugin route only;
  TestWorkBuddyRestrictedRestsHours lost its built-in translation case.

Run:
- gofmt -l internal: empty
- go vet -tags nogui ./...; GOOS=linux and GOOS=windows the same: clean
- go test -tags nogui -count=1 -timeout 45m -run 'WorkBuddy|workbuddy|Checkin|CheckIn|FetchNew|FetchingNew|FetchPlan|Migrat|migrat|Mover|Moved|Retired|Retire|SignIn|Plugin|Draw|Search|Loop|Redact|Restricted|Images|TextOnly|Qoder|BuiltinsSay|AsksOwn|Loopback' ./internal/provider ./internal/gateway ./internal/cli ./internal/gui ./internal/qoder
  first run: gateway, cli, gui ok; provider red on TestWorkBuddyMover
  (above); after the fix provider ok (99s).
- Not run: whole packages, the full suite, the GUI node suite.
2026-10-17 23:11:00 +08:00
yetone 761556a0cc provider: Qoder's built-in is retired; its plugin serves it
qoder and qoder-cn join retiredBuiltins, as Zed did in c0605abc2.
@magpie-community/opencode-qoder-auth serves both, moved or not.

Removed (built-in only):
- gateway: the Qoder dispatch in gateway.go and gateway/qoder.go (the
  translator), with its tests (qoder_test, qoder_busy_test, qoder_cn_test).
- provider: qoder_usage.go; the Accounts() loop, builtinLogins case and
  loginQuota branch, the Logins/side-list/switch/forget cases, SetLoginOn
  and alsoOn, the sign-in case, the subscription_usage fetch, and qoder
  in asksOwnBackend; qoderLogins(); the built-in tests (qoder_test,
  qoder_cn_test, qoder_free_test).
- internal/qoder: codec, cosy, models, oauth, usage, userinfo, ids, store
  and their tests.

Kept, and why:
- migrate_qoder.go (the mover) and the legacy qoder.json migration it
  reaches through qoderLoginsOf. It now reads a pair with qoderSaved.
- qoder_checkin.go: the check-in walks plugin accounts (heldPlugins).
- internal/qoder/endpoints.go: the provider keys, Site/SiteOf, the
  Credential the mover reads and NewMachineID, with the notice.
- The PLUGIN-SERVED notice in provider/qoder.go and internal/qoder.
- gateway's relayStatus/retryAfterOn, which commandcode.go uses, moved to
  relay_status.go; the tests' qoderRoundTrip is now roundTripFunc
  (roundtrip_test.go), no change in meaning.

Tests changed in meaning:
- TestOwnStoreSignInAgainDropsTheReading lost its qoder case.
- New TestQoderLegacyFileMoves: a legacy qoder.json moves through the
  mover and is removed. Red when migrateQoder is skipped (tried by hand).

Run (machine load ~300, so narrow by request):
- gofmt -l internal: empty
- go vet -tags nogui ./...; GOOS=linux and GOOS=windows the same: clean
- go test -tags nogui -count=1 -timeout 45m -run 'Qoder|qoder|Migrat|migrat|Mover|Moved|Retired|SignIn|AsksOwnBackend|Plugin|Afresh|Checkin' ./internal/provider ./internal/gateway ./internal/cli ./internal/gui ./internal/qoder
  provider ok 114s, gateway ok 201s, cli ok 18s, gui ok 12s, qoder no tests
Not run: the whole packages, the full suite, the GUI node suite.
2026-10-17 23:11:00 +08:00
yetone e405315d79 provider: Cursor's built-in is retired; its plugin serves it
"cursor" joins retiredBuiltins (migrate.go), so PluginServes("cursor")
holds moved or not, and the built-in's code goes, as Zed's did in
c0605abc2 and Kiro's in the commit before this.

Removed:
- gateway/cursor.go (the Connect/protobuf translator) and its tests
  (cursor_test, cursor_conversation_test, cursor_maxmode_test,
  cursor_precision_test, cursor_stepusage_test), and gateway.go's
  Account.Agent == "cursor" dispatch to serveCursor;
- provider/cursor_usage.go (the usage card, cursorToken, cursorKeychain)
  and provider/cursor_picker.go, with their tests;
- from cursor.go: the built-in account (cursorAccount), its model list
  through `cursor-agent models` (cursorModels, parseCursorModels,
  cursorModelL), its sign-in (startCursorSignIn, cursorLinkWhole,
  cursorLoginUUID), the API client version (CursorClientVersion,
  cursorVersionFallback, cursorVersionRe) and the token refresh
  (CursorToken, cursorRefresh, tokenExpiry);
- StartSignIn's "cursor" case (signin.go), the usage fetch
  (subscription_usage.go), the login-list case and quota (login_usage.go)
  and the account (account.go);
- "cursor" from Native (provider.go) and asksOwnBackend (modelprefs.go).

Kept, because the mover, the plugin paths or other code need them:
- cursor.go's PLUGIN-SERVED notice (TestMovedBuiltinsSayTheirPlugin);
  cursorIdentity, cursorStatus, parseCursorAbout, readCursorToken,
  cursorTokenOf, cursorKeychainToken and cursorAuthFile: migrate_side.go
  and plugin_accounts.go ask whose account the agent is through them;
- cursorLoginURL (grok.go and claude_signin.go use it), cursorContext and
  withCursorContexts (the plugin's model contexts), CursorExecutable and
  isCursorAgent (the Cursor agent itself);
- cursor_models.go whole: CursorBase (agent/legacy.go), CursorVariants
  (groupfast.go, the plugin's fast pick), cursorPicks and the collapse
  (provider.go, models.go);
- accountIDs, builtinOrder, models.go's "cursor" live branch and
  servedByCursor, as Zed's and Kiro's commits left theirs. The live
  collapse and cursorPicks now only ever meet a built-in list, which a
  retired Cursor never has; they are left for a cleanup of their own.
- gateway/cursor_local_models_test.go (the Cursor agent, not the
  built-in) and the gateway's plugin_*_test.go parity tests.

Tests changed in meaning:
- cursor_signin_test.go became cli_signin_test.go: its two generic
  runCLISignIn tests stay (grok's), TestCursorSignInJoinsAWrappedLink
  goes with cursorLinkWhole.
- cursor_test.go keeps parseCursorModels as a test helper (the old
  parser, for the collapse tests' fixtures); TestParseCursorModels,
  TestCursorClientVersion, TestTokenExpiry and TestCursorLegacyPicks go,
  and cursor_names_test.go's TestCursorAvailableNames: they tested the
  built-in account's list and picks. Cursor's plugin lists its own
  picker models with their efforts (index.mjs), so magpie's collapse
  never runs for it; moving the two tests onto the plugin showed that.
- TestFetchNewWaitsForASlowSignIn (#1789) and
  TestFetchNewListsAgainForAnAnswerWhileListing (#1147) are gone: both
  were about a CLI account whose models `cursor-agent models` lists,
  and no built-in left lists its models through its CLI.
- internal/gui/providers_fetching_unix_test.go
  (TestProvidersAnswerWhileListsComeIn, #541) is gone: its slow vendor
  was the built-in's `cursor-agent models`. The guarantee (the
  Providers page answers while an account's list comes in) has no test
  now; re-homing it onto an HTTP-listed account (Antigravity, Copilot)
  needs exported test hooks and is left as a follow-up.
- TestNative drops its Cursor case; TestLeftAloneRunsNoCLI fakes and
  expects claude and devin only; isolate() and
  TestAccountDiscoveryOffReadsNoSignIn no longer set cursorKeychain
  (cursorTokenOf reads the Keychain on macOS only, as before).
- Dropped as built-in only: the Cursor case of the required-tools test,
  TestCodexToolImageCursor, TestCursorSplitParallelCallsKeepTheirResults.

Run at this tree (load ~300, so narrow runs only):
- gofmt -l internal: clean
- go vet -tags nogui ./... ; GOOS=linux and GOOS=windows the same: ok
- staticcheck -tags nogui -checks U1000 ./internal/provider/: clean;
  with -tests=false over provider and gateway: nothing Cursor or Kiro
- go test -tags nogui -count=1 -run 'Cursor|Kiro|Migrat|Mov|Retired|
  SignIn|AsksOwnBackend|Plugin|HandOver|NoWayBack|Adopt|Hide|
  RequiredTools|ToolImage|Split|Discovery|Account|Isolat' over
  provider, gateway, cli, gui: gateway ok 446s, cli ok 67s, gui ok 51s;
  provider failed TestCursorAvailableNames, TestCursorLegacyPicks,
  TestFetchNewWaitsForASlowSignIn (above) and
  TestSetUpstreamNameRefusesAnAccountBackend (Kiro's, fixed in that
  commit)
- every other test naming "cursor" or cursor-agent, by name, over the
  same four packages: gateway and cli ok; TestNative,
  TestLeftAloneRunsNoCLI, TestFetchNewListsAgainForAnAnswerWhileListing
  and TestProvidersAnswerWhileListsComeIn failed (above)
- after the changes: gofmt clean, vet ok on all three; -run 'Cursor|
  Kiro|Migrat|Mov|Retired|SignIn|AsksOwnBackend|Plugin|HandOver|
  NoWayBack|Adopt|Hide|Discovery|Account|Native|LeftAlone|SetUpstream|
  FetchNew|Hold|DailyCredits|NotSignedIn|ModelTest|Providers': provider
  ok 141s, gui ok 21s, cli ok 22s (gateway untouched since its ok run)
Not run: the whole packages, the full suite, the GUI node suite.
2026-10-17 23:11:00 +08:00
yetone 615732af65 provider: Kiro's built-in is retired; its plugin serves it
"kiro" joins retiredBuiltins (migrate.go, now one entry a line), so
PluginServes("kiro") holds moved or not, and the built-in's code goes,
as Zed's did in c0605abc2.

Removed:
- gateway/kiro.go (the CodeWhisperer translator) and its tests, and
  gateway.go's Account.Agent == "kiro" dispatch to serveKiro;
- provider/kiro_signin.go and its test: StartSignIn's "kiro" case, the
  AWS Location redirect in the pasted-address handler, kiroFlow and its
  callback branches in signin.go;
- the built-in account (kiroAccount, kiroProvider, kiroAcct), its model
  list (kiroModels, kiroModelList, KiroModel), its usage card
  (kiroQuotaAt, kiroLimits.windows, kiroLoginQuota, the fetch in
  subscription_usage.go), and its login-list, switch, on/off, forget and
  also-on cases (logins.go, logins_on.go, login_usage.go, account.go);
- "kiro" from Native (provider.go) and asksOwnBackend (modelprefs.go).

Kept, because the mover, the plugin paths or other built-ins need them:
- kiro.go's sign-in readers (readKiroAt, readKiroCLI, readKiroIDE,
  kiroCred), KiroAuthOf with its refresh and profile lookup, and
  kiroUsageLimits: kiroOwnUser (plugin_accounts.go) and addKiroLogin
  (the legacy-file adoption kiroLogins runs) ask Kiro whose account it
  is through them;
- kiro_accounts.go's homes and kiroLogins, plus kiroSaved/readKiroFile
  (moved there from kiro_signin.go), which migrate_kiro.go reads and
  writes; side_logins.go and cards_kept.go's Kiro key are untouched;
- the Save branch that keeps a key on "kiro": the mover takes it;
- newUUID and joinNonEmpty moved from gateway/kiro.go to gateway/uuid.go
  (Devin and others use them), and the said() test helper to
  gateway/said_test.go;
- kiro_accounts.go's PLUGIN-SERVED notice (TestMovedBuiltinsSayTheirPlugin).

Tests changed in meaning:
- TestKiroMover: retired, the agent's own sign-in (kiro-cli's or the
  IDE's) is the plugin's to read (movedAgent, since cfa262509), so it no
  longer goes in the move; the test now says so, and the own marker's
  way back is checked with a literal marker.
- TestKiroBuilderIDListsItsModels became
  TestKiroBuilderIDTakesItsServiceProfile: the model list is gone, the
  Builder ID profile KiroAuthOf finds (for whose-account) is still
  checked; TestKiroBuilderIDFoundByKirosAnswer checks the profile, not
  the models.
- Dropped as built-in only: TestKiroModelList, TestKiroAccount,
  TestKiroLimits' windows half, TestSaveKeepsKirosKey's account check,
  TestKiroHideOwnSignIn, TestKiroHideOnlySignIn, TestCodexToolImageKiro,
  the Kiro case of the required-tools test, the kiro sign-in test file,
  and "kiro" from TestLoopbackSignInsTakePastedAddress.
- TestSetUpstreamNameRefusesAnAccountBackend set up a Kiro account as
  its account backend; Kiro is no longer one, so it now signs Claude in
  (still in asksOwnBackend) and gives "claude/*", checking the refusal
  is the own-account one. Found by a later wider run (the regexp above
  didn't reach it); go test -run '^TestSetUpstreamName' ok 6s.
- kiro_test.go's reader tests call readKiroAt(key, "") where they
  called readKiro(key) (same result with no magpie-signed accounts).

Run at this tree (load ~300, so narrow runs only):
- gofmt -l internal: clean (after formatting said_test.go)
- go vet -tags nogui ./... ; GOOS=linux and GOOS=windows the same: ok
- go test -tags nogui -count=1 -run 'Kiro|Migrat|Mov|Retired|SignIn|
  AsksOwnBackend|Plugin|HandOver|NoWayBack|Adopt|Hide|RequiredTools|
  ToolImage' ./internal/provider ./internal/gateway ./internal/cli
  ./internal/gui: gateway ok 266s, cli ok 24s, gui ok 25s; provider
  failed TestKiroMover (the own sign-in, above), fixed, then
  provider ok 145s (go vet ./internal/provider ok first)
Not run: the whole packages, the full suite, the GUI node suite.
2026-10-17 23:11:00 +08:00
yetone 21252f6a2c provider: Zed's built-in is retired; its plugin serves it
The first built-in taken out (the owner, 10-16: 陆续把内置Provider下线掉,
一定要下线完毕). @magpie-community/opencode-zed-auth serves Zed for
everyone now; built-in accounts not moved yet are moved by the hourly
loop, or from the Providers list's line (the commit before).

Removed: the built-in's sign-in (zed_signin.go and its loopback paste
branch), usage (zed_usage.go), its login list, switch, forget and
account cases, its own-backend case in asksOwnBackend, the gateway's
serveZed and zed.go, internal/zed, and the tests of only those.

Kept, because the mover and the plugin path use them: zed.go's
credential and login readers (migrate_zed.go's move), zed_body.go
(plugins.go), and Zed in accountIDs, side_logins, cards_kept,
plugin_usage's movedCards, the gateway's estimatedMoved and the CLI's
account names, which name the plugin's accounts too. Zed the editor as
an agent (internal/agent, the library's MCP target) is untouched.

Tests changed: TestMovedBuiltinQuiet is TestRetiredBuiltinQuiet (no Zed
card, its sign-in refused, the move still offered with the account);
TestZedMoveCarriesItsModels compares the models without internal/zed;
TestLoopbackSignInsTakePastedAddress and asksOwnBackend's set lose Zed.
AGENTS.md and gateway-routing.md no longer name Zed's built-in client.

Run on this tree over af08ecb27's parent tree:
- go test -tags nogui ./... -count=1 -timeout 90m: 64 packages ok,
  internal/gui red only in TestCoreScriptBudget (the Move line; the
  budget is raised in af08ecb27). Rebased onto it:
  go test -tags nogui ./internal/gui -count=1: ok.
- Earlier on wt6 before the three fixes: provider red in
  TestAsksOwnBackendAgreesWithTheGatewayDispatch and
  TestLoopbackSignInsTakePastedAddress (Zed still named), fixed here.
- gofmt -l internal: nothing; GOOS=linux and GOOS=windows
  go vet -tags nogui ./...: clean.
- GUI: retired-move, plugin-move, deprecation-notice and
  deprecated-subscriptions, both engines, en and zh: 20 pass.
2026-10-17 23:10:59 +08:00
yetone 0f1666b387 provider: a built-in can be retired, its plugin serving it moved or not, and its unmoved accounts get a Move line
The owner (10-16) wants every deprecated built-in taken out of magpie,
one at a time. This is the ground for that; it retires nothing yet.

- retiredBuiltins / BuiltinRetired(id) in migrate.go name a built-in
  whose code is gone. Only an id with a mover can be retired.
- PluginServes(id) is Moved(id) or retired. Every gate that asked
  Moved(id) asks it now: sign-in, Factory keys, usage, logins, cards,
  forget, accounts, check-ins, plugin sign-in, the CLI's accounts and
  providers, the GUI's account label.
- A retired row's move.state is plugin, and its id is in onPlugins
  once the plugin is installed.
- /api/providers lists a retired subscription's built-in accounts that
  haven't moved in `unmoved` (MoveCandidate, now with the failed move's
  error and why). The GUI shows a quiet line over the Providers list
  for each, with Move / Try again (unmovedLine), in en, zh, zh-TW, ja
  and de.
- AGENTS.md and docs/subsystems/provider-plugins.md say what a retired
  built-in is.

Run at 270aa1c9c with this change:
- go test -tags nogui ./... -count=1 -timeout 90m: 66 packages ok.
- gofmt -l internal: nothing. GOOS=linux and GOOS=windows
  go vet -tags nogui ./...: clean.
- GUI, both engines, en and zh: retired-move (new, 4/4), plugin-move,
  deprecation-notice, deprecated-subscriptions, plugin-move-unserved,
  plugin-movable-review, i18n-keys: 39 pass.
- TestRetiredBuiltinIsThePlugins -count=20 (it picks a mover at random).

The Move line is the Providers list's own, not a page that could be a
plugin. It took the core's scripts to 1,427,218 bytes, which the budget
main raised in 81313b912 (1,447,000, issue 2612) already holds;
TestCoreScriptBudget passes.

Broken by hand: retired-move goes red with unmovedLine not appended;
TestRetiredBuiltinIsThePlugins goes red with BuiltinRetired's Movable
check dropped.
2026-10-17 23:10:59 +08:00
yetone 1acd79cdfc usage: a compaction window picked past the leanest band isn't called the leanest, and offers the band (yapechan on Discord)
yapechan (Discord #general, 10-17 05:21Z): after picking another auto-compact
threshold outside the cheapest range, Context still said "已是最适合你用法的
最省配置"; they asked for the hint to change and for a button that sets it.

Cause: /api/tune does read the value the user set (TuneRead -> Current). With
the agent's compactions timed, tune.Compact's advice never waits longer than
the window now, so a larger window comes back as its own advice (best ==
current) and the row's chip said "Already the leanest". A probe of
tune.Compact on TestCompactTimedWaitsLeast's fixture: 400K picked -> best
400K at +16% tokens over the cheapest (250K); 1M -> best 1M at +96%.

Fix (context.js, adviceRow): the leanest band is the curve's windows within
3% of its cheapest, tune's own sameCost. A timed row whose window costs over
3% past the cheapest now says "Not the leanest: {band} spends the fewest
tokens" (info chip, not the green one, also when magpie set the value), keeps
the caveat, and has a "Use {value}" button for the band's largest window, the
one of them that compacts least; its tooltip says it means more compactions
to wait on. A window inside the band still says it is the leanest, with no
button. Untimed rows are unchanged: their "same" already means within 3%.
New strings in zh, zh-TW, ja and de.

What was run (macOS, load average 300-375 throughout):
- New test context-tune.test.cjs "a window picked past the leanest band isn't
  called the leanest": both engines x 5 languages x 360/1100px, 92/92 pass
  for the whole file at this head. Broken by hand: old context.js -> FAIL
  "expected 'Not the leanest: 230K–270K…' actual 'Already the leanest…'";
  band test made unreachable -> same FAIL in WebKit; chip class back to
  "applied is good" -> FAIL "expected 'ctx-chip info' actual 'ctx-chip good'".
- GUI files run one at a time, all ok: context-picks, context-scroll-end,
  context-text, context-tune, context-window, gui-de, gui-ja, gui-zh-tw,
  i18n-keys, usage-range, account-alias, account-arrange.
- Whole GUI suite NOT completed: a combined run of all 794 files died
  partway (2358 test points, 37 not ok, all page.goto/90s timeouts in
  unrelated pages under the load); a per-file rerun did ~33 files in 30
  minutes and was stopped. Its two reds (account-alias, account-arrange,
  timeouts) pass alone.
- gofmt -l: clean. go vet ./..., GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: clean.
- go test -tags nogui -timeout 45m ./... under pipefail at 161030972 (this
  change on 72ed518bc): every package ok except internal/agent (45m timeout,
  2703.8s, #2544), internal/gateway (45m timeout, 2717.0s, #2108) and
  internal/gui TestSetAnswersWhileDevinAndProvidersHang (10.0s, then 55.1s
  alone; #1375). No Go code differs from main; numbers added to each issue.
2026-10-17 23:06:58 +08:00
yetoneandggbdpq 45b8c725cf gateway: a legacy /responses/compact carrying another account's native compaction goes to that account, or is refused saying why (#2727, ggbdpq)
codexBackend's /responses/compact relayed to Codex's sign-in (or, with the
sign-in paused, compactOn's account) before any seal check, so a compact
whose input carries a compaction magpie recorded another account as the
writer of reached an account that can't read it, and Codex got the
backend's bare 400. Now sealedCompact judges it, as /responses already is
(codexSealedFor -> serve, #2642): the writer on in magpie answers it,
signed as the writer (codexUpstreamOn); a writer gone (signed out, lapsed,
paused, switched off, kept from the model) is refused 400 with
checkpointError's reason; the sign-in's own seal, a key's seal, a request
naming its own chatgpt-account-id, and a sign-in state magpie can't read
relay as before. Two Team seats of one email still read as one (the
record holds the email).

Review fix on top of ggbdpq's 781381f4: a gateway key held to some
accounts (#905) was checked (compactSigninHeld) against the sign-in before
the compact was handed to the writer, so a key held to me@ spent the
writer biz@ (acct-2 asked, 200), and a key held to biz@ was refused 403
"goes through the account Codex is signed in to" though the compact
would go to biz@. The hold is now asked of the account the compact goes
to; a writer the key may not use gets 403 sealedCompactHeldError naming
the writer, with nothing asked. The test's fake backend now records under
a lock.

Reviewed and run (reviewer, at this commit with the #2739 commit under
it, on 89521b03d; rebased after onto origin/main, see the last line):
- Each fix broken by hand, TestNativeCompactionCompactJudgesItsWriter:
  M0 codex_backend.go as on main: 3 subtests red (writer answers, gone
  refused, compactOn gone). M1 the key '#' skip dropped: "a seal a key
  wrote is not judged" red (400). M2 the chatgpt-account-id skip
  dropped: its subtest red (400). M3 the writer never relayed to: the
  healthy-writer subtest red (backend saw ""). M4 gone never refused:
  2 red. M5 judged after compactOn's relay: the compactOn subtest red
  (backend saw acct-2). Each green with the code restored.
- TestNativeCompactionCompactKeepsTheKeysAccounts (new) on ggbdpq's
  781381f4: red both ways ("200, the backend saw acct-2" for a key held
  to me@; 403 "goes through the account Codex is signed in to" for a key
  held to biz@). Red again with the hold put back on the sign-in; green
  with this change. TestGatewayKeyAccountsHoldCodexCompact and
  TestGatewayKeyCompactOnCodexAPIKey still pass.
- -race -count=3 on both tests: ok.
- gofmt -l clean; go vet ./... and -tags nogui (darwin), GOOS=linux and
  GOOS=windows go vet -tags nogui ./...: clean; go build, GOOS=linux go
  build -tags nogui, GOOS=windows go build: ok.
- Full suite, set -o pipefail, go test -tags nogui -count=1 -timeout 45m
  ./... at 519bcc843 (both changes, on 89521b03d), load ~300: exit 0,
  66 packages ok (internal/agent 2246s, internal/gateway 2040s,
  internal/provider 786s); none timed out.
- Not run: a real Team-seat pair or a real sealed compaction through a
  ChatGPT account.
- After the rebase onto origin/main 1e643ba7e (a doc-line conflict in
  gateway-routing.md resolved by hand, main's text kept): go build,
  darwin/linux/windows go vet -tags nogui of internal/gateway and
  internal/provider, and the NativeCompaction|Compact|Checkpoint|
  GoesZstd|StayPlain|TestGatewayKey and TestCodexCompressed tests: ok.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-10-17 23:02:36 +08:00
yetoneandpc418 0eab029ea7 provider: a ChatGPT account's turn is zstd-compressed with at most Codex's own 2 MiB window, not 8 MiB (#2739, pc418)
codexZstd (internal/provider/codex_zstd.go) set no window, so klauspost's
encoder declared its default 8 MiB (and, single-segment, up to the body
size below that) on every turn magpie re-compresses for the ChatGPT
backend: the accounts loop (forwardOnce), the native relay
(codexUpstreamOn) and warm-up all go through CodexCompressed. Codex's own
client never sends that: openai/codex ce0323f2
codex-rs/http-client/src/request.rs compresses with
zstd::stream::encode_all(Cursor, 3); zstd 0.13.3 (Codex's Cargo.lock)
copy_encode streams through Encoder::new(dest, 3) with the size unknown,
which libzstd 1.5.7 gives level 3's windowLog 21 (2 MiB). pc418's
15,173,526-byte image-heavy turn got 400 in the 8 MiB frame and 200 at
2 MiB; a later replay of the 8 MiB bytes was taken, so this matches the
client's envelope rather than proving a backend limit. Level and checksum
are unchanged. Cost: a large turn is bigger on the wire at 2 MiB with
SpeedDefault (pc418's turn 7.59 MB -> 12.44 MB; libzstd -3 gives 9.78 MB).

Reviewed and run (reviewer, at this commit on 89521b03d):
- Source checked: request.rs on openai/codex main ce0323f2 (encode_all,
  level 3), Cargo.lock zstd 0.13.3, zstd-rs v0.13.3 copy_encode.
- libzstd check: a 9.4 MB fixture with a 3 MiB random block repeated
  ~4 MiB apart. `zstd -3` from stdin: Window Size 2.00 MiB, 6,293,668 B.
  The old encoder's frame: 8.00 MiB window, 4,297,564 B, and
  `zstd -d --memory=2MB` refuses it ("Window size larger than maximum:
  8388608 > 2097152"). This commit's frame: 2.00 MiB window, 8,377,219 B,
  and `zstd -d --memory=2MB` decodes it to the same bytes. (For the record,
  SpeedBetterCompression at 2 MiB gave 6,293,661 B, libzstd's size; not
  changed here.)
- TestCodexCompressedLargeImageTurn fails with the option removed:
  "zstd frame window = 8388608 bytes, want at most 2 MiB"; passes with it.
- The gateway zstd tests in gateway-routing.md's commands pass;
  -race -count=3 on the new test passes.
- gofmt -l clean; go vet ./... and -tags nogui (darwin), GOOS=linux and
  GOOS=windows go vet -tags nogui ./...: clean; go build, GOOS=linux go
  build -tags nogui, GOOS=windows go build: ok.
- Full suite: see the #2727 commit after this one, run at that head with
  both changes.
- Not run: a real ChatGPT account through magpie (pc418 ran real native
  relay and account-pool image turns at 2 MiB: 200 each).

Co-authored-by: pc418 <271863285+pc418@users.noreply.github.com>
2026-10-17 23:02:36 +08:00
yetone 5a2414acdd plugins: every built-in plugin starts on, a new install's too
The owner (10-17): "所有的内置插件默认都应该是开启的", "尤其对新用户来说……
不然新用户都不知道有哪些功能". Since 3ccbe6bc1 (10-13) a new install was
written plugins.yml with the Essentials preset, which left Sessions, the
Library, routing groups, warm-ups and Observability off for every new user
(origin/main's binary, fresh sandbox HOME: those five "off").

- pluginrt.Settle() writes All when there is no plugins.yml, new install or
  not; settings.RanBefore, which only told the two apart, is gone.
- plugins.yml gets `settled: 1`. A file below it is brought up once on
  start: an Essentials preset becomes All, the user's own rows kept (a
  plugin they turned off stays off). Every write (Set, SetConfig,
  SetPreset) sets it, so `magpie plugin preset essentials` picked
  afterwards stays the user's. An unreadable or unparsable file is left
  alone, as before.
- Docs (plugin-runtime.md) and comments that said a new install starts
  with Essentials.

Run (origin/main 72ed518bc + this):
- gofmt -l internal: clean; go vet pluginrt, cli, gui, settings: clean.
- go test ./internal/pluginrt/ ./internal/settings/: ok. New
  TestSettleBringsUpAnEssentialsInstall; TestSettleAndSet and
  TestBuiltinSwitch now check a new install has all 14 on.
- Broken by hand (Settle writing Essentials, the bring-up skipped):
  TestSettleAndSet, TestSettleBringsUpAnEssentialsInstall and
  TestBuiltinSwitch go red; restored, green.
- Real binary, sandbox HOME: a new install lists all 14 on and writes
  `preset: all, settled: 1`; a plugins.yml of `preset: essentials` with
  otel off comes up `preset: all`, groups/library/sessions/warmups on,
  otel off.
- go test -count=1 -timeout 45m ./...: every package ok but internal/cli
  (TestPluginLoginTakesTheLapseOff, passes 5/5 alone here and on
  72ed518bc; filed #2748) and internal/gui (TestMainWindowCorners, #1936).
- GUI: builtins.test.cjs 4/4 (chromium + webkit; a first try under load
  ~445 had chromium's page.goto time out at 5s, #2542),
  routing-groups-off.test.cjs pass. Only comments changed in those two.
2026-10-17 22:54:38 +08:00
yetone 1e643ba7e1 provider: a model listed by its display name ("GPT-6 Sol") joins the group magpie found for gpt-6-sol (Chill on Discord)
Chill added a provider "Only through routing groups". Its Claude models
(tidy ids) were filed into the groups magpie found, but a model the relay
lists as "GPT-6 Sol" was not grouped with gpt-6-sol.

Cause: autoGroups buckets models by mergeKey, which is sameModel: it
lowercased and turned "_" into "-" but kept spaces. "gpt-6 sol" and
"gpt-6-sol" were two buckets of one provider each, so no group held
them, though the group id (Slug of the key) was auto-gpt-6-sol for both.
Siblings checked: AutoGroupOf (and AutoStandIn, reseat and group import's
Instead through it), GroupFor and groupNamed already compare by
Slug(sameModel(..)) and were right; setModelSame's "its own id" check and
the editor's Merge placeholder (MergeName) use sameModel raw and get the
same fix. Group Match patterns are the user's own globs, not a name
match, and are unchanged.

Fix: sameModel spells a run of spaces (a no-break one too), "_" and "-"
as one "-", after dropping the vendor's prefix. Every word still counts,
so gpt-6, gpt-6-mini, gpt-6-sol and gpt-6-sol-mini stay apart, as do a
:variant and a four-digit release. Two ids now merged already had the
same auto-… id, so no saved group id or agent config changes.

Not done on purpose: OpenAI's dashed date (gpt-4o-2024-08-06) is not
stripped. sameModel strips YYYYMMDD and Ark's YYMMDD, but keeps release
suffixes that are models of their own; an OpenAI dated id is a pinned
snapshot apart from the moving alias, and stripping it would change the
id of a group magpie has found for years (auto-gpt-4o-2024-08-06) that
agents and saved groups name. The test pins it apart.

Test: TestSameModelDisplayNameAsID (sameModel spellings, pairs that must
stay apart, and Chill's case end to end: provider x with gpt-6-sol and
gpt-6-mini, provider y Unlisted with "GPT-6 Sol", "GPT 6", "GPT-6 Sol
Mini"; auto-gpt-6-sol has x/gpt-6-sol and y/GPT-6 Sol, no other found
group forms, AutoGroupOf and GroupFor agree). With group.go put back it
fails: sameModel("GPT-6 Sol") = "gpt-6 sol", and auto-gpt-6-sol: [] false.

Docs: providers-accounts.md's Routing groups row says what the same
model is.

Run at this head (sandbox HOME, pinned caches): gofmt -l clean;
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
-tags nogui ./..., go build: ok.
Full suite: go test -timeout 45m ./... at 2042123f4 + this change (sandbox
HOME, load ~350 with two other full suites running): 64 packages ok,
internal/gateway and internal/provider among them. Two reds, both filed
already: internal/agent hit the 45m timeout (#2723, #2544), and
internal/gui's real-window AppKit tests (TestPanelCloseHidesIt,
TestPanelJoinsFullScreenSpaces, TestDockJoinLeadsCommandTab,
TestDockReopenKeepsTheWindowsSpace, TestMainWindowCorners) were killed
at their 30-40s deadlines (#2645, #1936). Rerun alone: internal/gui ok
(326s), internal/agent ok (2619s).

No GUI asset changed, so the Playwright suite was not run. Not tried
against Chill's real relay: the fixture is the model id as reported.
2026-10-17 22:46:55 +08:00
yetone 48aae83b82 gateway: what Jev is told of a turn is masked unless Jev itself may have it unmasked
A routing group whose every member the user set to go unmasked
(unredactedRoute, provider.SkipsRedaction) hands its rules the body as the
agent wrote it. That was right for the members, but a group's Jev is none
of them: askJev sent the message, and since the commit before also the
user's message before it and the reply, to a remote decision provider
unmasked. The chat-model classifier was not affected (it goes through
serve, which masks).

askJev now masks the state's three texts with maskedText (maskedState)
unless Jev's own provider skips redaction, and fails closed when the
masker can't serve, as redacted does. Found by the agent writing the
commit before, on reading unredactedRoute's callers.

TestJevIsToldTheTurnMaskedWhenTheGroupGoesUnmasked: both members
Unredacted on local addresses, mask personal data on, an email in the
message and the one before; no state value Jev gets holds it. Broken by
hand (the SkipsRedaction check made `false &&`): red, "previous_user_message
went to Jev unmasked". gateway-routing.md says it beside unredactedRoute.

Full suite at bf2018807 (89521b03d + both commits): go test -p 3 -tags nogui -timeout 45m ./... under a sandbox HOME: 65 packages ok, gateway among them; internal/agent hit the 45m timeout (#2544, as on main under load ~330). gofmt -l clean; go vet -tags nogui, GOOS=windows go vet of internal/gateway ok.
2026-10-17 22:45:57 +08:00
yetone 6b5501027d gateway: Jev is told the user's message before and the reply to it, so a short follow-up routes like its turn (@HirotaNagai on X)
A follow-up like "继续", "yes" or "fix that" was classified alone, so it routed
as a trivial turn. The decision classifier (Jev's state and the chat-model
classifier's prompt) now also gets previous_user_message and
previous_assistant_reply, when present.

- Taken from the same parsed request as the classified message, after the
  gateway masks it, so the new fields are masked the same way. The answer
  cache key includes them.
- The reply is the text of the latest assistant message after the previous
  user message. Never thinking, tool calls, tool results or system prompts;
  a tool-only reply gives nothing.
- Caps: the message keeps 3000+1000. The previous user message is cut to
  its first 750 and last 250; the reply keeps its last 1000. Together at
  most half the message's cap.
- The intent, level and effort instructions name the keys only when they
  are present, as context, not the thing being judged.

Tests: TestTurnBeforeEachProtocol, TestTurnBeforeCuts,
TestJevIsToldWhatCameBefore, TestChatClassifierIsToldWhatCameBefore,
TestClassifyKeepsAnAnswerPerTurnBefore, TestJevSeesTheTurnBefore. Each was
broken by hand and went red (10 breaks: reply taking thinking or tool
arguments or a tool result, searched past the user message, no caps,
jevState dropping the keys, priorAsk naming both always, writePrior not
called, rules.go not setting prev, a cache key without the turn before,
privacy off in the end-to-end test).

Run at 85eef5d87 + this: gofmt -l clean; go vet ./..., GOOS=windows go vet
./..., GOOS=linux go vet -tags nogui ./... ok; go test -p 3 -tags nogui
-timeout 45m ./... 65 packages ok; internal/agent timed out at 45m under
load ~350 (origin/main alone: 2305s), alone with -timeout 90m ok, 936s
(#2544). Rebased on 89521b03d; full suite at bf2018807 (89521b03d + both commits): go test -p 3 -tags nogui -timeout 45m ./... under a sandbox HOME: 65 packages ok, gateway among them; internal/agent hit the 45m timeout (#2544, as on main under load ~330). gofmt -l clean; go vet -tags nogui, GOOS=windows go vet of internal/gateway ok.

When every group member skips redaction, unredactedRoute handed Jev the
unmasked body, now with the turn before as well; the next commit masks
what Jev is told.
2026-10-17 22:45:57 +08:00
yetone 6690caaaec gateway: auto mode's review isn't asked of another subscription's Claude model, and Claude Code's set model is judged where it goes
Claude Code 2.1.302 tells a session behind magpie "this session isn't
eligible because your requests go through 127.0.0.1:3425" and points the
gateway at code.claude.com/docs/en/auto-mode-classifier-billing. That
page asks a gateway to forward the dangerous-tool-use-2026-09-03 beta and
the top-level `safeguards` field, and to return `safeguard_results`
(message_delta.delta in a stream) with tool-use ids unchanged; one that
can't should have clients set CLAUDE_CODE_AUTO_MODE_SERVER=0. magpie
already does this on every route Anthropic answers (Claude subscription
bridge, api.anthropic.com, relays, Bedrock, Vertex) and writes the 0
when no reachable model is reviewed (24350a372). Only Anthropic can
produce safeguard_results, so for any other model the 0 is the remedy;
magpie never answers one on Anthropic's behalf.

Gap fixed here: AutoModeReviewed counted any claude-* name as reviewed,
so a Claude model on another vendor's subscription or a plugin (Copilot,
Kiro, Cursor…) was sent the beta and safeguards (Copilot 400s on them,
#1756) and counted as reviewed by the agent wiring, which then left
CLAUDE_CODE_AUTO_MODE_SERVER unset and the notice showing. Now an
account provider counts only when it is the Claude subscription or sits
on api.anthropic.com; providers with a key keep the name rule. And
claudeReviewed resolves the models Claude Code is set to (group,
provider, fallback) before judging them, as the gateway would, instead
of by name alone.

Tests: TestAutoModeReviewedRoutes (copilot/kiro/plugin cases),
TestAutoModeReviewLeftOffOtherSubscriptions,
TestClaudeReviewedJudgesTheSetModelWhereItGoes. Broken by hand: with
automode.go reverted, the first two go red (copilot/kiro/x-plugin true;
copilot beta+safeguards sent); with claude.go reverted, the third goes
red (v/gpt-x falling back to a/claude-sonnet-5 not reviewed).

Run at 2042123f4 + this change, sandbox HOME, load ~350:
- gofmt -l: clean. go vet ./... (darwin), GOOS=linux and GOOS=windows
  go vet -tags nogui ./...: clean.
- go test -timeout 45m ./...: 63 ok, 3 red, all filed and none in code
  this touches: internal/agent hit 45m (#2723, #2544); gateway's
  TestPluginStreamLargeReplies/JSON_fast hit its client timeout (#2551);
  gui's TestMainWindowCorners was killed at its deadline (#1936, #2645).
- Reruns alone: internal/agent -timeout 90m ok (2637s);
  TestPluginStreamLargeReplies ok; TestMainWindowCorners/macOS_26_SDK
  killed at 40s again at load ~200 (#1936).
After rebasing onto origin/main c4aeaec74 (6 commits, none in these
files): go vet of gateway and agent clean; TestAutoMode*,
TestSafeguards*, TestClaudeBridgeSafeguard* ok; the agent review tests
printed one bare FAIL whose output was cut off by tail, then passed
alone and -count=3 -v (all PASS); cause of that one FAIL not known.
Not run: a real Copilot/Kiro account through Claude Code (the agent test
covers the resolution with key providers; the account rule is covered
in the gateway unit tests), the GUI node suite (no GUI change).
2026-10-17 22:43:54 +08:00
yetone c4aeaec740 provider: moved Cursor users get opencode-cursor-auth 0.2.19 (plugins #207)
The cursor mover's min goes from 0.2.18 to 0.2.19 (plugins 0a2496b,
nicegui's #207): when one step sends two different native tool counts
before any output and before a result was submitted, the plugin
rebuilds once from the history instead of failing the turn as
"inconsistent native tool count". keepMovedCurrent updates every moved
Cursor user to it.

npm view @magpie-community/opencode-cursor-auth version --prefer-online
shows 0.2.19.

Run at 72ed518bc plus this change, with a sandbox HOME and TMPDIR:
gofmt -l internal/provider (empty); go vet ./internal/provider on
darwin, GOOS=linux and GOOS=windows ok; go test ./internal/provider
-count=1 -timeout 45m ok (400s), with the mover tests
(-run 'Mov|Plugin|Migrat|Adopt|HandOver|Retir') ok first in 64s.
The full ./... suite was not run; the change is one string in the
movers map, and only internal/provider reads it.
2026-10-17 22:00:59 +08:00
yetone 72ed518bca gateway: an account's own list of models no longer refuses a ChatGPT account's GPT Image (heyiwei5 on X)
heyiwei5 on X: a Codex routing group's agent asked Magpie Image for
codex/gpt-image-2 and was told 403 "model "codex/gpt-image-2" is set not
to be served by any account or key of Codex: each one's own list of
models leaves it out. Add it to an account's models in magpie
(Providers → the account's Models)". That advice can't be followed: an
account's own list (#474) is picked in the editor from the provider's
chat models, and a ChatGPT account's GPT Image (like a Grok
subscription's Grok Imagine and a WorkBuddy plan's image models) is
never among them. So any account list kept for some chat models turned
every drawing away.

drawOnAccounts now treats those accounts as not listing the image model
(asked after those that do) rather than barred, for providers whose image
models magpie names itself (listsCantName: drawsCodex, drawsGrok,
drawsWorkBuddy). A capped account is still held. A key's own list, which
is picked from models that include its image ones (a relay's
gpt-image-2), still bars them, as nonchat_keys_test checks. Videos don't
go through account lists for Grok, so nothing to change there.

Run:
- TestCodexDrawsPastAccountModelLists on origin/main 6f950653f: red with
  the reporter's 403 above; green with the fix (gpt-image-2 and 2.5).
- go test ./internal/gateway -run 'Draw|Draws|NonChat|Keys|AccountModels|Grok|WorkBuddy': ok.
- go test -timeout 45m ./...: every package ok except internal/agent,
  which hit the 45m timeout with load average ~400 on this machine
  (running TestOwnProviderNamedAsMagpies/openchamber for 2s, not hung);
  rerun alone with -timeout 90m: ok in 1923s.
- gofmt -l clean; go vet ./internal/gateway on darwin, GOOS=linux, GOOS=windows.
- Real ChatGPT account in a sandbox HOME (auth.json copied, 140h left on
  its token, nothing refreshed), its own list set to gpt-5.5 with
  `magpie provider account-models codex <user> gpt-5.5`, POST
  /v1/images/generations codex/gpt-image-2: origin/main's build answers
  the reporter's 403 word for word; this build draws a PNG.
2026-10-17 21:28:33 +08:00
yetone be36009363 provider: moved Qoder and Qoder CN users get plugin 0.2.18 (plugins#179, plugins#185)
The qoder movers' min (shared by qoder and qoder-cn) goes from 0.2.16 to
0.2.18, so keepMovedCurrent updates every moved user's
opencode-qoder-auth:
- 0.2.17 (plugins#179): the daily check-in through auth.checkin.
- 0.2.18 (plugins#185): a trimmed or wrapped 10605 is the model's queue
  busy, not a lapsed sign-in.

npm view @magpie-community/opencode-qoder-auth@0.2.18 version
--prefer-online printed 0.2.18 before the change.

The checks run on the pushed head, which holds this commit, are in the
DeepSeek search commit's body.
2026-10-17 21:24:33 +08:00
yetone d432920f02 search: DeepSeek's Search API as a search API vendor (TJHHHH on Discord)
DeepSeek's own Search API (api-docs.deepseek.com/guides/search) can now be
added as a search API, with a DeepSeek API key:
- provider.SearchVendors: deepseek, at https://api.deepseek.com, keys at
  platform.deepseek.com/api_keys, offered after You.com.
- askSearchAPI: POST /v1/tools/search, Bearer key (the default), body
  {query, count: searchHits}. The query is cut to the 128 characters the
  docs allow (a longer one is a 400); need_content stays false.
- readSearchAPI reads its summary (the docs' text "for a model",
  ~600-800 chars) as the page's text, since content is empty without
  need_content; its snippet stands in when there is no summary, and its
  date (RFC 3339 or null) is the page's age. Other vendors' fields are
  read as before; summary and snippet are only fallbacks after content.
- 402 (no balance) and 429 (5 QPS per account) already rest a key as out
  of credit and rate limited (searchRestFor); the test pins it for
  deepseek.
- Siblings: CLI usage (main.go, search_cli.go's api list and empty-state
  hint), README.md, README.zh-CN.md, gateway-routing.md's path list. The
  GUI takes its vendors from SearchVendors (no vendor list in app.js or
  i18n), so no GUI file changes.

Not tried against the real DeepSeek API (no key in this run); the fake is
built from the docs' response shape, with null site_name/date and empty
summary/content. Note DeepSeek bills direct API calls ($0.75 per 1,000
non-empty searches).

Run (worktree on origin/main bad4508c4 + this, the Factory and the Qoder
mover commits; machine load 130-345):
- TestDeepSeekSearchAPI (new) passes. Broken by hand five ways, each red
  with its own message: summary not read (Text "Download Go."), query not
  cut ("a long query went as 200 characters"), date not read (Age ""),
  path /search instead of /v1/tools/search, snippet not read (second
  page's Text ""). Restored: ok.
- gofmt -l internal cmd: nothing.
- go vet -tags nogui ./... on darwin, GOOS=linux, GOOS=windows: all ok.
- set -o pipefail; go test -tags nogui -timeout 45m ./... under a scratch
  HOME: 65 packages ok (gateway 2654.9s, provider 930.5s, cli 533.2s);
  internal/agent timed out at 45m (2704s, TestReverseProxyIsStillMagpie/
  nginx running). That is #2723, untouched by these commits; rerun alone
  with -timeout 90m: ok 3565.0s. Recorded on #2723.

After rebasing onto origin/main 89521b03d (13 new commits, none in the
search or mover files): gofmt -l . empty; go vet -tags nogui ./... ok on
darwin, linux, windows; go test -run 'Search|Mover|Moved|Migrat|Plugin'
./internal/gateway/ ./internal/provider/ ok (173.4s, 89.8s); go test
./internal/cli/ ok (286.5s). The full suite was not rerun at the rebased
head.
2026-10-17 21:24:33 +08:00
yetone b5c76935b9 provider: moved Factory users get plugin 0.1.33 (plugins#158, plugins#198)
The factory mover's min goes from 0.1.31 to 0.1.33, so keepMovedCurrent
updates every moved Factory user's opencode-factory-auth:
- 0.1.32 (plugins#158): each model carries droid's token multiplier, given
  to magpie as its rate, with a running promotion's discount struck through.
- 0.1.33 (plugins#198): the update-config skill entry Factory refuses is
  adapted in a system prompt's configuration section too, including
  claude-code-guide's "- /update-config:" form.

npm view @magpie-community/opencode-factory-auth@0.1.33 --prefer-online
printed 0.1.33 before the change.

Run at this commit's tree, with the DeepSeek search commit on top: see
that commit's body for gofmt, go vet (darwin, linux, windows) and the full
go test -tags nogui -timeout 45m ./... run on the pushed head.
2026-10-17 20:53:18 +08:00
yetone 89521b03d6 cli, gateway: magpie cpu records the running magpie's CPU profile for 30s, for a report of high CPU (@LeiCheng42 on X)
@LeiCheng42 on X reports magpie using the most CPU while Codex runs. As
with magpie heap (e085d6e92), Activity Monitor and `sample` show Go's
frames as ???, so `magpie cpu [<file>] [--seconds N]` asks the magpie
serving the gateway for GET /v1/magpie/cpu?seconds=N: runtime/pprof's CPU
profile over 30s (5..120; else 400), gzipped protobuf, with the pid,
version, uptime, CPU time used over the window (getrusage / GetProcessTimes)
and since start, cores, GOMAXPROCS and goroutines in X-Magpie-CPU-Stats. It
tells the user to use magpie as when busy (run Codex) while it records,
writes <file> else magpie-cpu-<date>-<time>.pb.gz (0600), refuses a file
that is there before recording, and says "is magpie running?" at once when
nothing answers. --help writes nothing; an unknown flag, "-", a second file
or --seconds out of range are refused before anything is asked.

Only the profiling request waits: the gateway serves everything else
meanwhile. pprof keeps one CPU profile at a time, so a second ask gets 409
(cpuRecording), and a caller that hangs up stops the recording. The route
takes heap's guard: heapRefused's checks move into profileRefused, shared
by cpuRefused, so only a loopback, unproxied, browserless call to a
loopback Host gets it, with or without a gateway key or lanGuard.

Run at bad4508c4 + this: gofmt -l (nothing); go vet ./..., GOOS=linux go
vet -tags nogui ./..., GOOS=windows go vet ./... (clean); go test -tags
nogui -timeout 45m ./... under a sandbox HOME: every package ok except
internal/agent (45m timeout, #2544; again alone, in TestPortMovesEveryAgent)
and internal/gateway (TestTranslatedStreamKeepsClientAlive/chat_to_responses,
sibling of #2169/#2711, filed as #2737; alone with -timeout 45m only
/chat_to_anthropic, #2169; the test passes 5/5 alone). TestCPU* -race
-count=3 ok. Broken by hand: cpuRefused returning "" (19 failures in
TestCPUProfileOnlyToThisComputer); no one-at-a-time guard and no hang-up
stop (TestCPUProfileOneAtATime red each); no seconds bounds, no pre-check
of the file, no is-it-running check, no help case (each CLI test red).
Rebased on 2042123f4: go build ./..., gofmt -l, GOOS=windows and
GOOS=linux vet of internal/gateway and internal/cli clean; go test -run
'CPU|Cpu|Heap|Help' ./internal/cli ./internal/gateway ok.

Real use: the built binary's `magpie serve` under a sandbox HOME on
127.0.0.1:3493; `magpie cpu --seconds 5` saved a 0600 profile that go tool
pprof -top reads and printed the numbers; a concurrent second one got the
409 while GET / answered in ms; Origin: null and a rebound Host got 403;
--help wrote nothing; an existing file was refused. Not tried: the GUI
app's process, or the Windows box.
2026-10-17 20:52:13 +08:00
yetoneandtimonwong 2042123f43 provider: a provider switched off for a while stays in the groups magpie found, so agents on auto-<model> aren't rewritten to the one left (#2671)
timonwong (#2671, with the branch this is): a found group, auto-<model>,
was built from the providers that are on only, so switching off one of
its two providers took the group away. Every agent on group/auto-<model>
was reseated to the other provider's model (agent.Reseat → sameModel),
rules and groups naming it went 404, and switching the provider back on
brought the group back but not the agents' settings.

timonwong's change, ported as is (05927b833, 063fe15a2):
- models.go: entriesOf(of, off), and heldOffEntries(), the models of the
  providers that are Ready and Off (a keyless one, a plugin not signed in,
  finds no group), held per request like the other entries.
- group.go: foundGroups/foundFrom merge those back in the Providers order
  before autoGroups, in groupsIn, DeleteGroup and RenameGroup. membersIn
  already skips a switched-off member, and the Routing page already says
  it as switched off (memberJSON.providerOff).
- A removed provider still leaves the group; NoAutoGroups and
  ModelSameAs are honoured; a hidden found group stays hidden.
  Side effect: a found group whose only usable member is left shows while
  a provider is off, which is the point.
Reviewed line by line; nothing writes a user-set value, and Reseat now
has nothing to move for these agents, so there is nothing to restore when
the provider is on again.

Added here: TestReseatKeepsAFoundGroupWithAProviderOff (internal/agent:
Claude Code and Hermes on group/auto-gpt-5 are not moved when cop is
switched off, a model only cop served still is, the group resolves, and
switching cop on moves nobody) and TestFoundGroupMemberOfASwitchedOffProvider
(internal/gui: auto-x is on the Routing page with b/x said as switched
off). The docs row names the tests.

Red on bf931f82c's provider code (models.go and group.go from main): both
new tests, timonwong's TestFoundGroupWithAProviderOff (404 as in the
issue) and the updated TestProviderOff. Broken by hand (heldOffEntries
returning nil): the agent and gui tests and TestFoundGroupStaysWithAProviderOff
and TestFoundGroupRemovedWithAProviderOff go red.

Run at this change on bf931f82c: gofmt -l clean; go vet ./... (darwin),
GOOS=linux and GOOS=windows go vet -tags nogui ./... ok; full go test
-tags nogui -count=1 -timeout 45m ./... (load average ~140): every package
ok, internal/gateway and internal/provider included, except
internal/agent, which ran past 45m (#2544), and internal/middleware's
TestDocsExample, a strategy's wall-clock budget under load that passes
alone (filed as #2728). internal/agent then alone, -timeout 100m: ok in
2971s.
No GUI asset changed (the gui test is a Go test of groupsState), so the
Playwright suite was not run.

Co-authored-by: timonwong <timon86.wang@gmail.com>
2026-10-17 20:38:06 +08:00
yetone 992f288e20 gateway: a Chat-only relay that refuses tools with reasoning and none too moves a group on (#2670, JJ-Lin)
JJ-Lin's analysis in #2670 found both causes and gave the mock upstream
the tests use. A relay with a Chat URL alone answers tools with
reasoning_effort with "use /v1/responses or set reasoning_effort to
'none'", and then refuses none ("Supported values are: 'low', ...").

- forwardTranslated: when none was #176's own and is refused naming the
  levels, offRefused is still remembered (it is true of the model), but
  the request isn't asked again at the lowest level (refused the same by
  the upstream's own word). The tools refusal is the answer. The #176
  retry is gated on turnedAway(none) plus a per-request guard, so it
  can't loop. Before: the first request went [xhigh none low] and every
  later one [high], with the 400 going to the agent.
- passthrough (a chat client's relayed request), the sibling: the same.
  It used to ask none on every request and hand back the confusing
  "'none' is not supported" error.
- shapeRefused/retryable: a 400/422 that wrongEndpoint reads reaches the
  group only once the member has tried every API it has a URL for. The
  next member is now asked once, and this one doesn't rest (failShape).
  Before, the group stopped on it.
- The agent's error still names the Responses URL the provider lacks
  (wrongAPINote via asksResponses). Reading supported_endpoint_types from
  /v1/models was left out: wrongAPINote already says what to set, and
  trying Responses on the Chat base unasked isn't clean.
- docs/subsystems/gateway-routing.md says both.

Plain chat without tools, and gpt-6-astra (where none is taken) are
unchanged; TestToolsEffortNoneTaken pins both
([effort none] -> 200 three times in a row; no-tools [xhigh] -> 200).

Tests (internal/gateway/tools_effort_none_test.go, JJ-Lin's mock):
- TestToolsEffortNoneRefused: one Server, Codex xhigh/high/high asks
  [xhigh none], [high], [high]. Each answer is the tools refusal with
  the Responses-URL note. A chat client gets [high none], [high].
- TestGroupPassesOverToolsRefusedOnChat: group relay -> other. Three
  requests in a row are all 200 from other, tries[0] is failShape, no rest.
Broken by hand:
- fallback.go reverted: the group test is red (400 to the agent).
- translated restore off: "request 1 asked [xhigh none low]".
- passthrough check off: the chat client gets "'none' is not supported".
- turnedAway gate off: "request 2 asked [high low]". Without the
  per-request guard too, it loops forever (seen, killed).

Run on origin/main 7660399a1 (full suite), then rebased (darwin, machine load ~200):
- gofmt -l internal/gateway: empty.
- go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet -tags nogui ./...: ok.
- go test -tags nogui -timeout 45m ./... under pipefail: 63 packages ok,
  3 FAIL. internal/gateway hit the 45m timeout with no test failing
  (load ~200). internal/agent timed out in TestReverseProxyIsStillMagpie/nginx
  (#2723). internal/cli: TestPluginLoginInstallsItsCLIFirst TempDir
  cleanup "directory not empty" (#2722, as #2449).
- Rerun alone on cb05dc2d1: internal/gateway ok 2454s (-timeout 90m),
  internal/cli ok 764s, internal/agent ok 3100s (-timeout 60m).
- Rebased onto 04e8aa8f1 (fallback.go conflict with #2656's
  customToolRefusal; both matchers kept): vet (darwin, linux, windows)
  ok, internal/gateway ok 2454s.
- Rebased onto 50a703190 (no conflict; #2649, #2651, #2639 and #2444
  touch the gateway): go vet ./internal/gateway ok, and
  -run 'ToolsEffort|GroupPassesOverToolsRefused|CustomTool|Effort|Group'
  ok 234s. The whole package was not rerun at this last base.
Not tried against the reporter's real relay: the mock is built from the
bytes in the issue.
2026-10-17 20:33:28 +08:00
yetoneandump45nose 50a7031902 test: TestVisionWaitIsntTheDescribersTime gives the describer 2s, not 300ms, so a loaded run doesn't turn it red (#2444, ump45nose)
The test queues an image description behind a held request for twice
the describer's limit, then needs the description back within that
limit once the lane opens. At 300ms the fake's answer itself came in
late on a loaded machine and on CI (main f191d6423, test
(ubuntu-latest): "no answer in 300ms"). ump45nose's patch on #2444
gives it 2s; it is queued 4s, so the queue still outlasts the limit
twice over and the test still holds #2318 to its point.

Run, in my own worktree at origin/main 717b69f78 + this change:
- go test -tags nogui -count=3 -run TestVision ./internal/gateway: ok
- broken by hand: askVisionWith back on context.WithTimeout(ctx,
  visionTimeout) (the code before #2318) -> red, "context deadline
  exceeded" after the 4s queue; restored.
- go test -tags nogui -race -count=5 -cpu 1,2 -run TestVision
  ./internal/gateway: ok (151s) at load average ~400.
- gofmt -l clean; GOOS=darwin, linux and windows go vet -tags nogui
  ./internal/gateway: ok.
- Only this _test.go file changed, and no other package imports it, so
  the full suite was not run. Rebased onto e183604f0 (two claude
  commits, not in internal/gateway) before pushing.

Co-authored-by: ump45nose <52391318+ump45nose@users.noreply.github.com>
2026-10-17 20:19:07 +08:00
yetone e183604f06 claude: a tool named with a dot comes back under the name the client declared (#2649)
tsy0716's client offers a tool named "spawn.agent". Through a Claude
subscription the reply's tool_use called "spawn_agent", a tool the client
never offered: Claude Code keeps only [A-Za-z0-9_-] of an MCP tool's name,
and magpie handed the call back under the name Claude Code used.

The MCP helper now offers each tool under bridgeToolName: a name Claude
Code keeps as it is (and at most 51, 64 with mcp__magpie__) is unchanged;
any other, or one ending as a changed name ends (_ and 12 hex digits), is
cut to 38 of [A-Za-z0-9_-] and given 12 hex digits of its SHA-256. So
"a.b" and "a_b" stay apart, and the name is the same in every run: a
resumed session, the history told to a new run (renderParts) and the
tool-choice line (toolChoiceAsk) name it as the run was offered it.
subscriptionRun.names maps it back to the declared name in toolStart (Claude
Code's streamed and whole messages, so every API the bridge serves) and in
mcpCall (what an agent like Cursor is told through onCall). A name Claude
Code already kept goes upstream exactly as before.

What was run:
- New TestClaudeToolNamesComeBackAsDeclared: tools "spawn.agent",
  "fs/read", "has space", an 83-character name, "a.b" and "a_b", through
  /v1/messages, chat/completions and responses, client stream on and off,
  Claude Code's reply streamed and whole (12 cases); a fake Claude Code
  that changes names as Claude Code does and calls every tool it was
  offered. Checks the client gets exactly the declared names, and Claude
  Code was offered six valid, unique names of at most 51; and the history
  and tool-choice text use the offered name.
- Broken by hand: with the encoding taken out the test fails; with only
  the decoding in toolStart taken out, every case fails ("the calls name
  [a_b a_b_2e7336dc8eba fs_read_96379919f693 ...], want the declared").
- go test -run 'Claude|Bridge|MCP|Mcp|Tool' ./internal/gateway/
  ./internal/claudebridge/: ok.
- gofmt -l clean; go vet -tags nogui ./... on darwin, linux, windows: ok.
- Full suite at this head (8b1fad8f5 before the message change), as
  recorded in the #2651 commit: ok but three timing reds outside this
  change (#2719, #1889, and one fixed on main by bad4508c4), each green alone.
- Rebased onto origin/main 17557132c (7 commits, none in these files):
  gofmt and vet on all three systems, then internal/gateway,
  internal/provider, internal/netproxy and internal/claudebridge at
  9af3bb98b: ok. The whole suite wasn't run again at this head.

Not tried: a real Claude Code run with such a tool name.
2026-10-17 19:55:50 +08:00