Files
magpie/docs/subsystems
yetone 167101d57a gateway: service_tier "fast" reaches a Codex account as Codex sends Fast, "priority" (Archivemylife on X)
Archivemylife on X sent a Responses request for gpt-6.1-sol on a Codex
account with "service_tier": "fast" and got "default" back. magpie
dropped the key: codexBody kept only "priority" and "ultrafast", and the
IR's Fast (Chat and Responses parse) is set by "priority" alone, so
"fast" never reached the ChatGPT backend on either API.

"fast" is Codex's own name for its Fast mode. Codex never sends it:
ServiceTier::from_request_value reads "fast" and "priority" alike as
Fast and request_value sends "priority" (openai/codex
codex-rs/protocol/src/config_types.rs; step_settings.rs normalizes the
legacy "fast" the same way; read at 7fb4014d5).

- handle() turns a top-level string service_tier "fast" into "priority"
  on Chat and Responses (fastTier), before the Codex and key tier
  settings, routing and tier_asked. Those settings still win: they are
  the user's own value. Other tiers, "Fast", nested or non-string
  values go as they came.
- codexBody sends "fast" as "priority" too, for any path that reaches
  it without the handler.
- Anthropic Messages: Claude's equivalent is speed "fast", already read
  as Fast and sent to the ChatGPT backend as priority (covered by the
  new test). Anthropic's own service_tier (auto/standard_only) is about
  capacity, not speed, and is not mapped.
- Not changed: "flex" (Codex's Flex) is still dropped for ChatGPT
  accounts, as before; responses.go untouched.

The backend's reply still says "auto" then "default" with priority
honoured (servedTierAt already knows this), so the client's response
service_tier is not proof either way; speed is.

Run:
- Red on the old code (production files from HEAD, tests new):
  TestFastTierWordReachesCodex red on Responses fast, whole fast, Chat
  fast, whole fast; TestCodexBodyServiceTier red on "fast". Green with
  the change.
- Real Pro ChatGPT account in a sandbox HOME (codex logins only,
  refresh tokens blanked, no agent config touched), binary built at
  this change, gpt-6.1-sol: Responses "fast" (whole and streamed), Chat
  "fast" and Messages speed "fast" each went out with tier priority
  (trace tries); "default" went with none. Streamed Responses reply said
  service_tier auto/default. Two pairs, 600-word essay, effort low:
  priority 28.3 and 30.1 tok/s, none 22.3 and 21.2 tok/s.
- mica: go test -count=1 -timeout 45m ./... at this tree: 103 ok, no
  FAIL. go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
  go vet ./..., go build: ok. gofmt -l: empty. That tree was on
  be6f8b730; after rebasing onto 3f4372cc9 (a gateway change),
  internal/gateway (962s) and internal/provider ran ok again at this
  tree on mica. Rebased again onto c5f2a67d0 (routing.go, agy quota):
  go vet ./internal/gateway ./internal/provider and go test -run
  "Tier|Fast|Codex|Agy" on both packages ok at the pushed tree.

Not tried: a Plus account; Codex's own sign-in route (codexBackend),
where Codex itself never sends "fast".
2026-11-17 16:56:29 +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.