Skip to content

fix(live): start the session host as a launchd job on macOS 27 and later - #987

Merged
umputun merged 2 commits into
masterfrom
live-host-launchd
Nov 13, 2026
Merged

umputun merged 2 commits into
masterfrom
live-host-launchd

Conversation

@umputun

@umputun umputun commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Live sessions closed when macOS force-quit a GUI program started from a pane. After agterm quit and relaunched, a program switched off in Allow in the Background became the app of the coalition the session host and its daemons were still in, and loginwindow's force-quit about 30 seconds later took every session in that coalition with it.

On macOS 27 and later the client starts agterm-session-host as a one-shot job in the user's GUI launchd domain, so the host and its daemons get a coalition of their own. Each attempt uses a unique label, its plist is written 0600 into the private endpoint directory and removed once bootstrap returns, and the host refuses a key or label that is not its own. A definite bootstrap failure falls back to the disclaimed spawn; a timed-out one never starts a second host. The host boots out its own job when serving ends, including on error. Older macOS keeps the spawn unchanged.

On macOS 27 a job host ends with the GUI login session, as a reboot already ends every Live session. Sessions created before the update keep their old host until Reset Live Sessions moves them, and sessions under a host that fell back to the spawn stay exposed; troubleshooting covers both.

Checked on macOS 27 with a build of this branch: a disallowed Chrome for Testing started from a pane was force-quit, and the host, both daemons and both shells survived it. Microphone capture and Claude Code voice input worked in a Developer ID build. Local Network at the installed path gets checked before the release.

Fixed #985

Live sessions closed when macOS force-quit a GUI program started from a pane.
After agterm quit and the same build relaunched, a program switched off in
Allow in the Background became the app of the coalition the session host and
its daemons were still in, and loginwindow's force-quit about 30 seconds later
took the daemons with it.

On macOS 27 and later the client starts agterm-session-host as a one-shot job
in the user's GUI launchd domain, which gives the host and its daemons a
coalition of their own; responsibility disclaim alone does not change it. Such
a host ends with the GUI login session, as a reboot already ends every Live
session. A definite bootstrap failure falls back to the disclaimed spawn, and
a timed-out one never starts a second host. Older macOS keeps the spawn
unchanged.

Fixed #985
A session host started as a launchd job removed its job only after an
accepted stop. One that found the endpoint already served by another host,
or whose startup or serve loop threw, left its one-shot job loaded in the
GUI domain until logout. It now tries to boot out its own label after
serving ends, including on error, and logs a failed bootout. A host whose
key or label is not its own still exits without touching any job.

Troubleshooting no longer suggests a reset helps sessions under a host that
fell back to the spawned start.
Copilot AI balanced review requested due to automatic review settings November 13, 2026 18:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@umputun
umputun merged commit 2484bfe into master Nov 13, 2026
10 checks passed
@umputun
umputun deleted the live-host-launchd branch November 13, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After a same-build relaunch, Live panes stay in the coalition of the agterm that quit, and a force-quit of a program started in a pane kills them

2 participants