Make desktop launchd control domain-aware#15
Merged
Conversation
hardcoded the gui/<uid> launchd domain and pinned the plist to LimitLoadToSessionType=Aqua. Over SSH / headless logins the GUI domain is unreachable, so launchctl bootstrap failed with "125: Domain does not support specified action" and the gateway never ran (leaving plugins list empty), forcing users to hand-edit the plist and bootstrap into user/<uid> themselves. Resolve the domain per session instead: prefer gui/<uid> when the calling process is in the Aqua session (desktop parity), otherwise bootstrap into user/<uid>, with a fallback that tries the per-user domain if the GUI bootstrap is rejected. Probe both domains to find where the agent is actually loaded so stop/restart/uninstall and the runtime self-restart act on the live service regardless of which session installed it. Drop the Aqua session-type pin so the same headless unit loads in either domain.
The CLI can install the gateway into gui/<uid> or user/<uid>, but the desktop launcher only probed and controlled gui/<uid>. After a user-domain install it would miss the live job, kill the running listener as unmanaged, and bootstrap a duplicate GUI job or error out. Probe both domains (matching the Rust loaded_domain logic) and drive print/kickstart against whichever domain actually holds the service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gui/<uid>(Aqua sessions) oruser/<uid>(SSH/headless or the Aqua fallback), but the desktop launcher ingateway-process.tsstill only probed and controlledgui/<uid>.loaded_domainlogic) and runsprint/kickstartagainst whichever domain actually holds the service;bootstrapstill falls back to the GUI domain only when the agent is not loaded in any domain.Test plan
npm run dist:dirindesktop/garyx-desktop, then verify desktop startup/control against agui/<uid>install.user/<uid>install (SSH-reachable domain) — it should adopt the existing listener instead of killing it.