Files
magpie/docs/subsystems
yetone a24a5f6af4 gui: a model test its vendor queued shows queued, not green (sufeng1894 on X)
sufeng1894 (v0.1.4248) added Qoder China and QwenWork providers (both
served by the Qoder plugin): their models were green in the provider's
Test, and every request through Routing failed with 503.

A Qoder/QwenWork plan queues a model (code 10605, e.g. "this plan's
queue: p4"). The test sends x-magpie-fallback, the plugin answers the
queue's 503 at once, and probe counts it OK with Result.Queued
(d3aecfe95). The GUI drew that as a green dot and "answered", while
routing gives way from a queued member at once (503 busy) and the last
member's wait ends in the queue's 503 (4 minutes unstreamed; a frozen
queue after 5 minutes with qoder 0.2.71, v0.1.4321). So Test said the
opposite of what Routing does.

Now a queued result is its own state: an amber dot, its title
"Queued at its vendor, not answered: <queue>", and Test models' and
Test this model's status say the same and are not "ok". Working only
still keeps a queued model, as the test's OK says (a queue clears).
renderEndpoints is not a sibling: it is drawn only when no address is
plugin://, and only plugins report queued.

core_budget_test.go: +135 for it, the reason in the comment; one
string (queuedSaid) shared by all three places.

Run (mica-run/mote-run, at origin/main 8608ce024):
- models-queued.test.cjs (chromium, webkit): 4/4 ok; with the old
  app.js 4/4 red ("a queued model's dot isn't green", and the single
  test's status timed out waiting for the queued dot).
- go test -run Budget ./internal/gui: ok.
- every models-*, model-*, provider*, i18n-* and test-* GUI file:
  2430 tests, 2323 ok, 107 red (mote). The same 107 in the same 11
  files are red at untouched origin/main 8608ce024 (146 run, 107 red),
  all filed: i18n-keys (#6877), models-works-only (#4391),
  model-chip-steady (#4388), model-copy-id (#4621), model-api-preset
  (#5838), provider-max-output and provider-many-keys (#6209),
  provider-fetch-again, provider-models-rest, provider-picks-stay and
  provider-typed (#6532). A first run on mica died of ENOSPC (its disk
  is full) and tested nothing.
- Rebased onto 07f7e0b45 (nothing under internal/gui changed since
  8608ce024): the budget test and models-queued + model-test-one
  (8/8) ran again there, ok.

Not tried: a real Qoder China or QwenWork account; the reporter's 503
body, so which queue (or another cause) their 503s carry is not
confirmed.
2026-11-16 22:03:48 +08:00
..
2026-11-10 03:25:44 +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
One MCP server, magpie, given to every agent in place of the Library's servers MCP router
Memory shared by every agent: the memory MCP server, the digest in instructions, the Memory tab Memory
One skill, magpie-skills, listing the Library's skills in place of each agent's own Skill router
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.