fix(aterm): quit kitty with its last window, so a bundle reopen starts a session #1340

Merged
coilyco-ops merged 2 commits from aos/claude/mt75 into main 2026-08-28 18:51:27 +00:00
Owner

Closing an aterm app and reopening it never restarted the console process. Reported by Kai in session.

Why

kitty stays running with no windows open on macOS. That is the platform's own convention and kitty's macos_quit_when_last_window_closed defaults to no, confirmed against the installed 0.48.2 and its shipped docs ("kitty will stay running, even with no open windows").

The instance that survives a closed window is the bundle's own linked binary, which is exactly what makes the Dock, the switcher, and Mission Control read the role. So LaunchServices keeps the .app registered as running, and the next click activates an empty app instead of executing the wrapper. No new session, no new console process.

The fix

aterm/plan.go passes -o macos_quit_when_last_window_closed=yes, so closing the window ends the instance that drew it and the next click launches fresh.

Verification

  • New regression test asserts the option reaches the plan ahead of the child. Negative control run: it fails on the unpatched plan.go and passes with it.
  • The option was checked through kitty's own parser rather than by spelling: parse_config resolves it to True, and an invented key is rejected as an unknown config key. A --version smoke test was tried first and discarded, since it short-circuits before option parsing and passed for the bogus key too.
  • just aterm-test, just aterm-lint, just aterm-contract (live roster), and pre-commit run --all-files all green.

Rollout

Every window option comes from the binary rather than the wrapper, so this lands on a rebuilt aterm with no aterm bundles regeneration. Kai's installed /opt/homebrew/bin/aterm needs the new build before a click behaves.

Docs

docs/aterm.md was at its 8000-char cap and docs/*.md is at the 40-file count cap, so the new prose displaced retold justification rather than extending the file. It also drops the claim that each click opens a new session: macOS launches nothing for an app it already runs, so that only holds with no window open. The file now sits at 7994 of 8000, which is filed as a follow-up.

Closing an aterm app and reopening it never restarted the console process. Reported by Kai in session. ## Why kitty stays running with no windows open on macOS. That is the platform's own convention and kitty's `macos_quit_when_last_window_closed` defaults to `no`, confirmed against the installed 0.48.2 and its shipped docs ("kitty will stay running, even with no open windows"). The instance that survives a closed window is the bundle's own linked binary, which is exactly what makes the Dock, the switcher, and Mission Control read the role. So LaunchServices keeps the .app registered as running, and the next click activates an empty app instead of executing the wrapper. No new session, no new console process. ## The fix `aterm/plan.go` passes `-o macos_quit_when_last_window_closed=yes`, so closing the window ends the instance that drew it and the next click launches fresh. ## Verification * New regression test asserts the option reaches the plan ahead of the child. Negative control run: it fails on the unpatched `plan.go` and passes with it. * The option was checked through kitty's own parser rather than by spelling: `parse_config` resolves it to `True`, and an invented key is rejected as an unknown config key. A `--version` smoke test was tried first and discarded, since it short-circuits before option parsing and passed for the bogus key too. * `just aterm-test`, `just aterm-lint`, `just aterm-contract` (live roster), and `pre-commit run --all-files` all green. ## Rollout Every window option comes from the binary rather than the wrapper, so this lands on a rebuilt `aterm` with no `aterm bundles` regeneration. Kai's installed `/opt/homebrew/bin/aterm` needs the new build before a click behaves. ## Docs `docs/aterm.md` was at its 8000-char cap and `docs/*.md` is at the 40-file count cap, so the new prose displaced retold justification rather than extending the file. It also drops the claim that each click opens a new session: macOS launches nothing for an app it already runs, so that only holds with no window open. The file now sits at 7994 of 8000, which is filed as a follow-up.
fix(aterm): quit kitty with its last window, so a bundle reopen starts a session
Some checks failed
ci / aos-eval-tests (pull_request) Successful in 12s
ci / aos-cli-tests (pull_request) Successful in 1m2s
ci / ward-doctor (pull_request) Failing after 13m12s
ci / gate (pull_request) Failing after 18m42s
5a4a98b085
kitty stays running with no windows open on macOS, which is the platform's
own convention, and `macos_quit_when_last_window_closed` defaults to `no`.
The instance that survives a closed window is the bundle's own linked
binary, so LaunchServices keeps the .app registered as running and answers
the next Dock, Spotlight, or Finder click by activating an empty app rather
than executing the wrapper. Closing an aterm app and reopening it therefore
never restarted the console process.

The launch plan now passes the option, so closing the window ends the
instance that drew it and the next click launches a fresh session. Verified
against kitty 0.48.2's own parser: the override resolves to True, and an
invented key is rejected as unknown.

Every window option comes from the binary rather than the wrapper, so this
lands on a rebuilt `aterm` with no bundle regeneration.

docs/aterm.md was at its 8000-char cap, so the new prose displaced retold
justification rather than extending the file. It also drops the claim that
each click opens a new session, which macOS does not do for an app it
already runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Kai Siren <coilysiren@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Agent-Role: platform
Merge branch 'main' into aos/claude/mt75
All checks were successful
ci / aos-eval-tests (pull_request) Successful in 8s
ci / aos-cli-tests (pull_request) Successful in 43s
ci / gate (pull_request) Successful in 1m4s
5e2861e339
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-flight-deck/agentic-os!1340
No description provided.