Skip to content

Make desktop launchd control domain-aware#15

Merged
Binlogo merged 2 commits into
mainfrom
fix/desktop-launchd-domain-aware
Jun 10, 2026
Merged

Make desktop launchd control domain-aware#15
Binlogo merged 2 commits into
mainfrom
fix/desktop-launchd-domain-aware

Conversation

@Binlogo

@Binlogo Binlogo commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The CLI now installs the gateway launch agent into either gui/<uid> (Aqua sessions) or user/<uid> (SSH/headless or the Aqua fallback), but the desktop launcher in gateway-process.ts still only probed and controlled gui/<uid>.
  • After a user-domain install, the desktop app would miss the live launchd job, terminate the running listener as an unmanaged process, then bootstrap a duplicate GUI job or surface a startup error.
  • Desktop launchd control now probes both candidate domains (matching the Rust loaded_domain logic) and runs print/kickstart against whichever domain actually holds the service; bootstrap still falls back to the GUI domain only when the agent is not loaded in any domain.

Test plan

  • npm run dist:dir in desktop/garyx-desktop, then verify desktop startup/control against a gui/<uid> install.
  • Verify desktop startup/control against a user/<uid> install (SSH-reachable domain) — it should adopt the existing listener instead of killing it.

Binlogo added 2 commits June 10, 2026 16:52
 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.
@Binlogo Binlogo merged commit 7d34afe into main Jun 10, 2026
1 check passed
@Binlogo Binlogo deleted the fix/desktop-launchd-domain-aware branch June 10, 2026 11:02
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.

1 participant