curtinp118 on Discord runs magpie on a VPS and opens its web UI from home. ChatGPT's browser sign-in comes back to localhost:1455, which is the viewer's own computer. The page there won't load, and the box's main line said "The account shows up here as soon as you're done", so the sign-in looked broken. The fix until now was to copy the dead page's address back by hand. ChatGPT now also signs in by device code, as `codex login --device-auth` does (codex-rs login/src/device_code_auth.rs). This is startCodexDeviceSignIn, with StartSignInWith site "device": - magpie asks auth.openai.com/api/accounts/deviceauth/usercode for a code with Codex's client id and headers; - the box shows the code and https://auth.openai.com/codex/device; - magpie polls deviceauth/token, where 403/404 means not entered yet, for up to 15 minutes; - it then trades the authorization code at the token endpoint with the returned verifier and the /deviceauth/callback redirect. Nothing listens on this computer. The window starts this way when magpie web is opened from a host other than localhost or loopback (remotePage in app.js). Either way, the box has a link to the other way: "Sign in with a code instead" or "Sign in in the browser instead". A device code that ChatGPT turns away (404) fails, and that box links to the browser's way. Strings are in zh, zh-TW, ja and de. providers-accounts.md describes the flow. This went over TestCoreScriptBudget. It now fits with no raise (1,533,700 of 1,533,802, on main's 1,533,789). The two way-switch buttons share one helper (codexWay), and eight comments on the sign-in code are cut down: openSignInPage, signingKept, startPluginSignIn, the sign-in proxy, signInProxyChoices, Copilot's GHE.com, dropSigningIn and renderStepPlan. Run on mote (the pushed head is rebased onae060550b): - go test ./internal/provider: the new TestCodexSignInByDeviceCode, TestCodexDeviceSignInCanceled and TestCodexDeviceSignInOff, against a fake auth server that answers with the bytes auth.openai.com gave on 11-03; - go test -tags nogui ./internal/provider ./internal/backup (before the comment trim, which touched app.js only): ok; ./internal/gui ./internal/cli after it: ok; - GUI at this head: signin-codex-device.test.cjs (new; Chromium and WebKit, en and zh, 420px wide), signin-paste-codex, signin-callback, signin-port-blocked, signin-paste-plugin, signin-paste-import, the sign-in proxy files and i18n-keys, 40 files: 591 pass, 0 fail; - the whole GUI suite one commit earlier (base c86fa2a34; the rebase onto6a6e4fefaonly brought in internal/sessions): two runs, each cut short when mote rebooted or by the owner's call not to wait. They got through 1075 and 1395 cases, with 0 not ok; - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., the Linux nogui and Windows builds, and gofmt -l (basec86fa2a34). Rebased on4cd01c964at last: go test -tags nogui ./internal/gui ok and signin-codex-device, signin-paste-codex, signin-callback and i18n-keys 21 of 21. Before that, rebased onae060550bwith the comments cut: go test -tags nogui ./internal/gui ok, ./internal/provider ok, and 40 sign-in, proxy, i18n-keys and desktop-tiers GUI files: 594 pass, 1 fail. The red was signin-proxy's chromium ja 380 proxy test. That file alone then passed 3 runs, 120 of 120. It is #1814, open since 10-12 for this test under load, and noted there. The step that failed wasn't kept. The full go test ./... was not run, by the owner's rule. On Linux (WSL magpie-desktop, sandbox HOME), magpie web listened on 0.0.0.0:3561 and was reached at the WSL IP. POST /api/signin {"agent":"codex","site":"device"} got a real code from auth.openai.com with url https://auth.openai.com/codex/device. The sign-in stayed waiting across real polls for 12s, nothing listened on 1455, and cancel ended it. Broken by hand: - Taking the device branch out of begin() turned TestCodexSignInByDeviceCode and TestCodexDeviceSignInOff red. - Taking the remotePage default out of startSignIn turned 8 of the 12 signin-codex-device cases red. Not tried: - Entering the code with a real ChatGPT account, so a real token trade through the device callback hasn't been seen. - Business/Enterprise workspaces that turn device codes off. Also not changed: WorkBuddy's plugin sign-in already finishes by itself from a remote browser (server-side poll; checked on the same WSL setup). A backup still carries no sign-ins. Reported by curtinp118 on Discord.
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 |
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
- Identify the affected subsystem and the actual runtime path, including plugin or built-in ownership.
- Compare the claimed before/after behavior with the base and head implementation. Trace relevant callers and state transitions beyond the changed lines.
- Check that changed contracts appear in the owning reference and that source links still resolve.
- 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.