Files
magpie/AGENTS.md
T
yetone 9fcf6a6e7f provider: every deprecated built-in moves onto its plugin, and there's no way back
The owner, 10-16: 陆续把内置Provider下线掉…一定要下线完毕. The plugins now do
what the built-ins did (the parity batch up to 53009f81a), so the built-ins
are retired:

- MoveRetiring moves every subscription with a mover (retiring is
  MovableIDs, the list was empty) that still has built-in accounts, from
  the gateway's hourly loop, six hours after a failed try as before.
- A user who moved back is moved again. Only a move back made by removing
  or turning off the plugin (Migration.Left) is left as it is.
- There is no move back from the GUI or the CLI. provider/moveback and
  `magpie plugins move-back` answer that the built-ins are retired. A
  moved subscription's editor says it stays on its plugin and shows no
  button, and the success line no longer offers to go back. New strings
  in zh, zh-TW, ja and de; the three unused ones are gone ("Moving back…"
  stays, for removing a plugin).
- AGENTS.md and docs/subsystems/provider-plugins.md say so.

Tests:
- TestMoveRetiring's subtests check that a moved-back subscription is
  moved again and an off or removed plugin's is not.
- TestMoveBackRefused goes red on the old handler.
- plugin-move.test.cjs checks that a moved Zed has no button and says it
  stays.

What was run, at 63be47717 with this change:
- go test -tags nogui ./... -count=1 -timeout 90m: 65 packages ok. The
  gateway was red on TestUsageKeepsTimeToFirstToken (#2575, new) and
  TestVisionWaitIsntTheDescribersTime (#2444) at load ~260. Neither file
  is touched here, and both pass alone with -count=3.
- gofmt -l is clean; GOOS=linux and GOOS=windows go vet of provider, gui
  and cli pass.
- GUI, both engines: plugin-move, plugin-move-unserved and i18n-keys pass
  23 of 23.
- The other plugin-*.test.cjs files go red under parallel load as they do
  on untouched main (#1544, commented with the runs). Serially, then alone,
  they pass 28 of 28.
2026-10-16 22:58:40 +08:00

5.3 KiB

Notes for coding agents

Subsystem design and review

Before changing a documented subsystem, read its design reference and verify the linked source. When preparing or reviewing a PR, follow the same page's documentation update, semantic change description, and review rules.

Code standards

Write and review changes against the code standards.

Community PRs

Before reviewing a community PR, read contributors: what stops a review for possible harm, what is closed unreviewed, and the authors whose PRs are closed on sight.

Lessons

Before changing code, read LESSONS.md: what recent merged work got wrong and the rule that would have caught it.

Built-in subscriptions that a plugin serves

Some built-in subscriptions are deprecated. Reaching them can break their vendors' terms, so they are moving out of magpie into community OpenCode plugins, which keeps magpie itself from being banned. Each one has a plugin that does the same job:

Subscription id Plugin (npm) Mover
Command Code commandcode-plan @magpie-community/opencode-commandcode-auth internal/provider/migrate_side.go
Cursor cursor @magpie-community/opencode-cursor-auth internal/provider/migrate_side.go
Devin devin @magpie-community/opencode-devin-auth internal/provider/migrate_side.go
Factory factory @magpie-community/opencode-factory-auth internal/provider/migrate_factory.go
Grok grok @magpie-community/opencode-grok-auth internal/provider/migrate_side.go
Kiro kiro @magpie-community/opencode-kiro-auth internal/provider/migrate_kiro.go
Xiaomi MiMo mimo-app @magpie-community/opencode-mimo-auth internal/provider/migrate_mimo.go
Qoder, Qoder CN qoder, qoder-cn @magpie-community/opencode-qoder-auth internal/provider/migrate_qoder.go
WorkBuddy, WorkBuddy AI workbuddy, workbuddy-ai @magpie-community/opencode-workbuddy-auth internal/provider/migrate_workbuddy.go
ZCode zcode @magpie-community/opencode-zcode-auth internal/provider/migrate_zcode.go
Zed zed @magpie-community/opencode-zed-auth internal/provider/migrate_zed.go

The movers map in internal/provider/migrate*.go is the source of truth. TestMovedBuiltinsSayTheirPlugin fails when a mover has no notice in its code.

Which code actually runs

Two cases decide it:

  • Moved: the user moved the subscription onto its plugin, from the editor's "Move to plugin" (or provider.Adopt). Its migrations.json state is plugin (provider.Moved(id)). A new user never sees a deprecated built-in: the Add sheet leaves one with no account out (unusedSub in app.js), so it is installed from the Plugins page. A user who installs the plugin themselves is moved too (provider.HandOver): at once when the built-in has no accounts, from the gateway's hourly loop (KeepRetiringMoved) when it has, unless they moved back or the plugin is signed in under its own -plugin id already. Until then the Add sheet shows the plugin's tile only (replacedSub in app.js). Since 10-16 the built-ins are being retired: the hourly loop's MoveRetiring moves every subscription with a mover that still has built-in accounts, a user who moved back included, and there is no way back from the GUI or CLI. Only removing or turning off the plugin puts the built-in back (Left), and that is left alone.
  • Not moved: the user is still signed in through the built-in: the move hasn't run yet, it failed (tried again after six hours), or they removed the plugin.

For a moved subscription, the plugin does everything: sign-in, refresh, models, requests, usage and errors. It runs in the plugin host (internal/plugin). The built-in's code in internal/provider/<name>*.go, internal/gateway/<name>.go, internal/zed and internal/qoder doesn't run for it at all. The gateway sends its requests to the plugin's fetch, not to the built-in's translator.

So a bug report about one of these subscriptions is usually about the plugin:

  1. Check whether the user's subscription is moved. A moved provider's row in /api/providers has move.state == "plugin"; the provider id is in onPlugins.
  2. Fix the plugin in the community repo, magpie-community/plugins (packages/<name>, provider id = the built-in's id; checked out locally at ~/workspace/projects/magpie-commuity-plugins). Publish a new version.
  3. Raise the mover's min to that version. keepMovedCurrent then updates every moved user's plugin.
  4. Make the same fix in the built-in only if it should also reach users who haven't moved. A fix made only in the built-in does nothing for moved users.

This magpie-side code still runs for moved subscriptions:

  • the plugin host: internal/plugin, host.js;
  • internal/provider/plugins.go, plugin_usage.go (movedCards) and pluginsignin.go;
  • the move itself: internal/provider/migrate*.go;
  • the GUI's plugin paths in internal/gui/assets/app.js: subOf, pluginSubs and startPluginSignIn.

A test against the built-in alone doesn't prove anything for moved users. To compare the two, use the parity tests: internal/gateway/plugin_*_test.go.