Skip to content

fix: fallback to user launchd domain on macOS - #8749

Closed
jescalan wants to merge 5 commits into
NousResearch:mainfrom
jescalan:fix/launchd-domain-fallback-submit
Closed

jescalan wants to merge 5 commits into
NousResearch:mainfrom
jescalan:fix/launchd-domain-fallback-submit

Conversation

@jescalan

@jescalan jescalan commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

On macOS, Hermes currently assumes launchd commands should always target gui/<uid>. That works from GUI-attached shells, but it fails in some background/user-session contexts where launchctl print gui/<uid> returns Domain does not support specified action even though the per-user launchd domain is available.

This change makes launchd domain selection probe both domains and choose the first one that is actually accessible:

  • prefer gui/<uid> when it is available
  • fall back to user/<uid> when the GUI domain is not accessible
  • preserve the historical gui/<uid> default if probing is inconclusive

Testing

Added targeted coverage for the domain-selection helper:

  • returns user/<uid> when gui/<uid> is unavailable but user/<uid> works
  • keeps gui/<uid> as the fallback when both probes fail

Impact

This makes hermes gateway start and related launchd operations more reliable across macOS execution contexts without changing behavior for the normal GUI-attached case.

@jescalan
jescalan force-pushed the fix/launchd-domain-fallback-submit branch from 10bafdd to a75a816 Compare April 14, 2026 23:05
@jescalan
jescalan force-pushed the fix/launchd-domain-fallback-submit branch from 79f0350 to 81dc56a Compare April 15, 2026 17:12
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels Apr 28, 2026
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for the macOS launchd investigation. This is an automated hermes-sweeper review; the requested behavior is now implemented on current main.

  • hermes_cli/gateway.py:3524 probes gui/<uid> and then user/<uid>, with a Background/SSH-safe user/<uid> fallback at hermes_cli/gateway.py:3586.
  • tests/hermes_cli/test_gateway_service.py:1399 covers the exact gui-unavailable/user-available case, alongside GUI preference, managername fallback, and caching coverage.
  • The implementation landed in a8f404b29fa9ffde4ba4763e2bc30a077f430fa0 (fix(gateway): probe launchd domain instead of hardcoding user/<uid> (#40831)), following the superseding macOS launchd work in merged PR fix(gateway): user launchd domain + Background session, detached fallback (macOS 26) #40581.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants