ttmouse on v0.1.1168: open magpie's window, Command-Tab to another app, Command-Tab back, and magpie is last in the switcher. Cause: magpie is out of the Dock (Accessory) until the window opens. With Settings > Dock set to "while the window is open" (or a full-screen window), the quick panel's focus activates magpie while it is still Accessory, and it joins the Dock (Regular) after that. An app activated before it joins stays last in LaunchServices' front-to-back order (lsappinfo visibleProcessList), which Command-Tab follows, though it is frontmost. Wails' Focus only calls activateIgnoringOtherApps when the app isn't active, and calling it again while active is a no-op. setDock also ran async (dispatch_async), so openMain's Show/Focus could come before the policy change. Fix: - setDock runs on the main thread at once (InvokeSync), so openMain joins before it shows the window. - A pure dockStep(regular, on, active, front) decides the move. Joining while already active activates the Dock and then magpie again (activateAgain), which puts magpie first in the order. Joining while not active just activates it; leaving never re-activates. - The full-screen join does the same once the window is in full screen (DidEnterFullScreen) if magpie was active when it joined. - Dock "off" (the default) is unchanged: magpie stays out of the Dock and out of Command-Tab, by design. The tray panel's behaviour is unchanged. - docs/subsystems/gui-shell.md: Runtime path item 7 for the Dock setting. Run: - TestDockStep (table, pure). TestDockJoinLeadsCommandTab (darwin GUI build): a real Accessory Wails app activated, then setDock(true, true) + window Show/Focus, asserts it is first in lsappinfo's order. Red with `again` forced false (front was the test, kitty first in the order), green with the fix. - go test ./internal/gui (GUI build, darwin) passes; full go test -tags nogui ./... passes; gofmt -l clean; go vet ./internal/gui (darwin) and GOOS=linux / GOOS=windows go vet -tags nogui clean. - Real build on this Mac, sandbox HOME, own bundle id, port 3481, DockWindow on: launched with the quick panel, window opened through the Mac's reopen, then two osascript Command-Tabs. Old build: magpie front but 11th of 11 in the order (the report). New build: magpie 1st; after Command-Tab, the other app 1st and magpie 2nd; Command-Tab again brings magpie back. Dock "always": magpie 1st, round trip works. Dock "off": stays UIElement, not in the order. Not tried: the full-screen path in the real build, a human Command-Tab (only osascript keystrokes), real accounts (not involved).
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 |
| Plugins that run on the gateway's requests and replies | Gateway middleware |
| 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 |
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.