Jevik_AI on X (Windows, portable magpie) deleted magpie's folders by hand. ~/.codex/config.toml kept openai_base_url on 127.0.0.1:3425, and every Codex turn then failed with a 502, with nothing left that knew why. Deleting magpie's files never puts an agent back, so there is now an uninstall that does. - internal/uninstall: Run goes in this order. System removes the background service, opening at login, the Start menu shortcut (shortcut.Remove, with its App Paths key), the magpie:// links and the privacy model's helper. Agents ends Codex's account failover, then runs each connected agent's own Disconnect, or its offline disconnect for an app that is closed. That is the same code as the Agents page, so a value the user changed by hand since Connect stays theirs (e7f21dba5for Codex). It then ports Codex's rollouts and restarts the Codex app's app-server (provider.RestartCodexAppWhenIdle, which says whether one was left on the old config). Data deletes magpie's folders, but keeps the Library's folder while it holds skills, servers or hooks the user's agents use. The executable is left where the user put it. - `magpie uninstall [--yes]`: refuses while another magpie runs, and says which one. On a terminal it lists what goes and asks [y/N]; with no terminal, only --yes does it. - Settings › About › Uninstall magpie: POST /api/uninstall runs System and Agents. If anything failed, nothing else is removed and the sheet offers Try again. Otherwise POST /api/uninstall/finish starts a detached `magpie uninstall --data-after <pid>` (Setsid on unix, DETACHED_PROCESS on Windows) and the app quits; the files go once it has ended, since WebView2 holds its folder open until then. A Codex app still on the old config is named before quitting. magpie web refuses both routes. Strings go through t() in all five languages. - --data-after refuses a pid that is no process (0, negative, its own): kill(0) counts as alive, and a run given 0 waited out its 2 minutes. Not done, and why: - No restore on quit. Quitting keeps agents on magpie by design: the service or the next start serves them. - No Apps & Features entry or Windows uninstall hook. A portable copy registers nothing with Windows, and an uninstaller that ran without magpie's own disconnect would leave the configs as they are. The `# magpie:` note above each line magpie writes (previous commit) is the recovery path for a copy deleted by hand. Run at this head (db75663a0's tree, on5d24bc6cc), on mote: - gofmt -l clean; go vet ./... on darwin (-tags nogui), GOOS=windows and GOOS=linux -tags nogui: ok. - go test -tags nogui -count=1 -timeout 45m on ., internal/uninstall, cli, gui (TestCoreScriptBudget included), provider, shortcut, edit, agent and proc: all ok. - GUI at this head: mote was at load 100-120 with other sessions' GUI runs. Chromium crashed (SIGBUS) mid-file in settings-search and settings-sections after their en cases passed, WebKit failed to launch within 180s in s3-sync, settings-search and settings-sections, and fonts and title-bar-tools went red on unstable elements (#2984 has fonts under load). uninstall-settings had not reported when this was pushed. - At the earlier base b3580c72c, on this machine: the full suite (-timeout 45m), red only on #3884, #3632 (both since fixed on main) and the core budget, which main's later move of Web search out (#4133) has room for now. GUI: 104 Settings and i18n files in chromium and webkit, uninstall-settings and i18n-keys green in both; the reds were #3797, #3876 and the load reds above. Tried for real, in a sandbox HOME: `magpie uninstall` end to end with Codex connected and a sandbox Codex app running (config.toml back without magpie's lines, magpie's data gone, the exe kept, the app's app-server restarted onto the restored config); codex-cli 0.162.1 reading the noted config.toml. Other agents were covered by tests only. Not tried: the GUI's Uninstall in a real app window, a real --data-after run waiting on a live app's pid, and the Windows box. Broken by hand: --data-after's pid guard removed -> TestUninstallDataAfterNeedsAProcess red (0, -1 and its own pid accepted); restored, green. At the pushed head (rebased on 51f66fe8b; the uninstall call adapted to EndCodexFailover's (bool, error) on the way), on mote: - gofmt clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok; go build ./... ok. - go test -timeout 45m: internal/uninstall, edit, shortcut, cli, agent, provider ok; internal/gui red only on TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27). - GUI: uninstall-settings and i18n-keys, 30 pass 0 fail. - WSL (magpie-desktop, CGO_ENABLED=0): uninstall, edit, shortcut, provider ok; agent red on TestGrokInstalled, TestOmpDetectedWithPiDir, TestZedAppPath, the same at origin/main51f66fe8b(#4033, #3548).
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 hub |
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.