Disconnect and quit was the only way to stop the gateway, and it quits
magpie too. Pause does the same without the quit, from the tray's Pause
Gateway (Resume Gateway while paused), Settings › General › Gateway
(On/Paused, the app's only) and the Gateway page's Resume gateway, all
through POST /api/gateway/pause.
- Pause disconnects each connected agent as its row's Disconnect does
(its own settings put back), keeps their ids in gateway-paused.json in
the config folder, and stops the listener with requests in flight
drained. An agent that can't be disconnected keeps the gateway serving,
those before it connected again, and is named in the status line.
- While paused, serveGatewayLocked serves nothing: not the 15s watch, a
port change nor a handover; a magpie started again stays paused. A
pause file that can't be read counts as paused.
- Resume serves again and connects the agents the pause disconnected.
A port held by something else keeps the pause and says what holds it.
The Gateway page's Start/Restart, connecting an agent and picking one
of magpie's models for it resume too.
- quitask's wired list and the pause share wiredOf.
- Strings in en, zh, zh-TW, ja, de. gui-shell.md documents it.
Run (mote was unreachable for the later runs; the Windows box instead):
- mote, before the rebase: go vet ./internal/gui; go test -run
'TestGatewayPause|TestGatewayResumes|TestTray|TestGatewayFix|TestQuit'
./internal/gui: ok.
- at this tree on b46f23ffa: win-run go vet ./internal/gui ok; wsl-run
go vet -tags nogui ./internal/gui ok; gofmt -l clean.
- win-run go test -count=1 ./internal/gui: the pause and tray tests ok;
8 reds, each the same on origin/main d4b4a188e run alone on Windows
and filed (#4115 %AppData% import rows, #5928 ~\ paths, #2107/#3649
TestGatewayHeldByAContainer).
- wsl-run GUI (chromium + webkit): gateway-pause (5 languages x 1000/420),
settings-general, gateway-takeover, i18n-keys, i18n-en-no-cjk: 51/52.
The red is gateway-takeover webkit en's dark-mode case, red 1 of 2 on
untouched origin/main too: #5942.
- rebased on 401187300: win-run go test -run 'Budget|TestGatewayPause|
TestGatewayResumes|TestTray|TestQuit' ./internal/gui ok; wsl-run go vet
-tags nogui ./internal/gui ok; gofmt clean. darwin vet not rerun after
the rebase (mote refused SSH).
Broken by hand: serveGatewayLocked without its pausedNow check, and the
rollback's reconnect skipped: TestGatewayPauseAndResume ("served while
paused") and TestGatewayPauseRollsBack ("codex not connected again")
went red; green again restored.
Not tried: the real app's tray on a desktop, a real agent's config
round-trip (the Go tests fake the agents; Disconnect/connect are the
rows' own code), an agent wired from the CLI while the app is paused
(it doesn't resume), the whole GUI suite, the full Go suite (started after the tag).
zhujiu (Discord #feedback) asked for a 不再提示 on the question a tray
Quit asks while agents go through magpie (8826a15ea), and a switch in
Settings to turn it on and off again.
- The question (quitask.js, an in-app sheet) has a "Don't ask again"
checkbox above its buttons, unticked each time. It goes with the Quit
chosen: Quit and Disconnect and quit post window/quit?now=1&noAsk=1,
which saves settings.quitNoAsk (settings.SetQuitNoAsk, under the file
lock) before quitting; a failed save keeps magpie open. Cancel saves
nothing.
- AskQuit quits at once when quitNoAsk is set (quitAtOnce); otherwise as
before. The default is unchanged: it asks.
- Settings › General has "Ask before quitting" On/Off (segs, app-only),
after Open at login. settingsapi.Keys lists quitNoAsk, and Merge carries
it when a save doesn't send it, so the tray panel or an older page
can't turn the question back on.
- zh, zh-TW, ja, de strings. Five app.js comments shortened to stay in
the core script budget (no raise).
Run at the pushed head (on origin/main f95bacdfb), on mote:
- gofmt clean; go vet darwin, linux, windows (nogui too).
- go test internal/settings, internal/settingsapi ok; internal/gui
-run "Budget|Quit" ok.
- internal/cli: TestEveryRouteHasACommandOrIsNamed red for
POST /api/usage/checkin-account, from e87140242, filed as #4826; this
change adds no route.
- GUI, chromium and webkit: quit-ask-setting (25: en, zh, zh-TW, ja, de
at 1100 and 420), quit-ask (35), settings-general, settings-sections,
settings-search, settings-tabs-stick, wsl-agents-setting, agent-prefs,
i18n-keys, old-webkit, auto-backup, all pass.
Broken by hand, each red:
- api.go's noAsk ignored: TestQuitDontAskAgain "wasn't saved".
- quitAtOnce not reading the setting: TestQuitDontAskAgain "still asks".
- Merge carry dropped: TestQuitNoAskKeptUnlessSent.
- SetQuitNoAsk saving false: TestSetQuitNoAsk.
- quitask.js without &noAsk=1: quit-ask's two Don't ask again tests.
Not tried: a real tray Quit with the box ticked in the built app on
macOS, Windows or Linux; only the sheet in Playwright and the handler
in Go. Not the whole GUI suite.
Aisiverto on X (Windows, v0.1.2519) wired Codex to magpie and quit magpie.
Codex then retried "unexpected status 502 Bad Gateway ... url:
http://127.0.0.1:3425/backend-api/codex/responses" five times and gave up,
and it took a long search to find magpie's openai_base_url in config.toml.
A Quit the user chooses (the tray's Quit, the panel's and window's Quit,
Command-Q on the Mac) now asks first when this process serves the gateway
and agents are wired to it. The window comes up on a sheet
(quitask.js, lazy-loaded) that names each agent cut off, says closing the
window keeps magpie running (menu bar on a Mac, system tray elsewhere),
and offers Quit (focused), Disconnect and quit, and Cancel. Disconnect and
quit puts each agent back as its row's Disconnect does, then quits; a
disconnect that fails keeps magpie open, named in the status line. A
second Quit within a minute of the question quits, so a window that
can't show it traps nobody. With nothing wired, or another magpie serving
the gateway, Quit quits at once.
Not asked: a restart to update, Uninstall, a browser's page (magpie web),
logging out or shutting down, and the Dock's Quit (AppKit terminate:).
Found while checking the report:
- Closing the window on Windows hides it; magpie stays in the tray and
the gateway keeps serving (tried for real, below). Not a bug.
- Autostart is off by default on Windows.
- The proxy / NO_PROXY in the report isn't magpie's to fix: the 502 is
magpie's port with nothing behind it.
Strings in en, zh, zh-TW, ja and de (existing terms: Agent, 退出). No
native dialog, no <select>. TestCoreScriptBudget met without a raise:
app.js gains two lines, the sheet is outside the core, and driftFix's
comment block is cut to six lines (453 bytes back; main's core had grown
to 258 bytes over with these lines in).
Run, at this head (on origin/main 94f6f6092), on mote unless said:
- gofmt -l internal/gui: clean.
- go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet -tags
nogui ./..., go build, GOOS=linux go build -tags nogui, GOOS=windows
go build: ok.
- go test ./internal/gui -run 'Budget|Quit|CommandQ', and with -tags
nogui -run 'Budget|Quit': ok (TestCommandQAsksFirst runs AppKit in a
child process).
- quit-ask.test.cjs, old-webkit.test.cjs, i18n-keys.test.cjs in chromium
and webkit, en/zh/zh-TW/ja/de: 60/60 ok.
- At the previous base (9d08993c8): go test ./internal/gui (whole
package, GUI build): two reds. TestCoreScriptBudget (258 over, fixed
above) and TestMainWindowCorners/macOS_26_SDK, red the same at
9d08993c8 itself (#3949, macOS 27). The nogui run of the package was
not reached.
- The whole GUI suite: started at 24fd4a250 on WSL (magpie-desktop),
stopped about halfway (3,915 results) to rebase; 68 reds in 28 files.
Those 28 files with quit-ask, old-webkit and i18n-keys at 9d08993c8+this
on mote: 74 reds in 7 files, none in this change's files. The 7 alone
at origin/main 9d08993c8: the same 6 files red (73), and
gateway-caller-keys red at main when run alone (1 of 4). All filed:
balance-fix #4682#4683, key-replace #4126#3476, agent-panel-name-width
#4203 (red on macOS too, commented), context-map #3488, header-centre
#3479, gateway-key-models #4616, gateway-caller-keys #3797.
- Not run: go test ./... in full (mote at load 140-160 with others' full
suites, WSL with two GUI suites), and the GUI suite to its end.
Broken by hand, each red:
- api.go's ask skipped (false &&): TestWindowQuitAsksFirst "the window's
Quit didn't ask (AskQuit never ran)".
- askingQuit without RemoveMenuItem: TestCommandQAsksFirst "the app menu
still has the Quit role".
- quitNow as asked == 0 ||: TestQuitNow "connected, never asked: quitNow
= true, want false".
- The return after a failed disconnect removed: quit-ask 5/25 chromium
red (the failed-disconnect test in every language).
- app.js's ?ask=quit line removed: 20/25 webkit red.
Windows, for real (xiaomi-gpu, sandbox HOME/APPDATA under
C:\Users\yeton\quitask-sb, MAGPIE_ADDR 127.0.0.1:3471, MAGPIE_NO_ACCOUNTS,
a -H windowsgui build of this branch, launched in the desktop session):
`magpie codex fakeq/m1` wired the sandbox Codex to
http://127.0.0.1:3471/backend-api/codex; WM_CLOSE on the window left
the process alive with no visible window and the gateway listening.
Not tried:
- The tray's Quit and the sheet on real Windows: WebView2's CDP port
never listened and UI Automation didn't find the tray icon, so the
sheet was tried in Playwright only.
- A real Codex run against the sandbox gateway before and after a quit.
- The Dock's Quit (not covered by design).