Files
magpie/docs/subsystems
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
..

Subsystem design references

These pages describe current responsibilities, runtime paths, state, and contracts. Start with the subsystem relevant to your task, then follow its source links to verify the implementation you change.

Subsystem Reference
Built-in subscriptions moving to plugins Provider and plugin ownership
Built-in plugins: registry, lifecycle, plugins.yml, presets, settings schemas, the window's kernel (slots, error boundary, kit) Plugin runtime
Plugins that run on the gateway's requests and replies Gateway middleware
Tools that plugins give, offered to every agent as an MCP server Plugin tools
Plugins that await context recall and observe completed replies Asynchronous gateway request hooks
Claude subscription turns across Claude Code runs Claude subscription bridge
How the gateway picks a provider, key or account, and falls back Gateway routing and fallback
Gateway Session Aggregation Gateway Session Aggregation
Connecting an agent's config to the gateway, drift, disconnect, WSL twins Agent wiring
Providers, keys, subscription accounts, refresh and allowance Providers and accounts
Instructions, MCP servers, skills and RTK written into agents Library
Tray, panel, window, magpie web and the page's JSON API GUI app shell
Encrypted backups and setup synchronization over WebDAV, S3 or GitHub Sync and backup

A subsystem can span several packages or repositories. Its reference describes the behavior those parts provide together; it does not need to list every function.

Maintain a reference

Update the owning reference in the same PR when a change alters a documented responsibility, interface, state transition, runtime path, compatibility rule, or failure behavior. An internal refactor that preserves these contracts does not require a prose change.

Keep each fact in one reference and link to it from agent instructions or other pages. Link to source files and named symbols rather than copying implementation details that change frequently. Explain field meanings and constraints that signatures alone do not express.

For a new reference, include the responsibilities and boundaries, source of truth, main runtime paths, state transitions, important constraints, and existing verification commands. Include failure and compatibility behavior where relevant. Document current behavior separately from proposed changes; the proposal belongs in its issue or PR.

Describe a PR's semantic changes

For each affected subsystem, explain the observable change with its trigger and before/after behavior. Include changes to interfaces, state, compatibility, and failure behavior when relevant. Link the affected reference, implementation, and verification evidence. State when a refactor preserves the documented behavior.

For example, a change to plugin adoption should explain which migration state and account condition trigger it, which implementation handles requests before and after adoption, and which test exercises that transition.

This is an author-provided explanation that a reviewer verifies against the diff and surrounding code. It is not an automatically proven compatibility verdict.

Review a change

  1. Identify the affected subsystem and the actual runtime path, including plugin or built-in ownership.
  2. Compare the claimed before/after behavior with the base and head implementation. Trace relevant callers and state transitions beyond the changed lines.
  3. Check that changed contracts appear in the owning reference and that source links still resolve.
  4. Check that the cited tests or runtime evidence exercise the claimed behavior. Report checks that were not run.

A documentation update alone does not prove the implementation. Existing tests and runtime evidence remain necessary for behavior changes.