hermes - 💡(How to fix) Fix hermes update via gateway leaves launchd service unrestarted on macOS [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

Root cause: Two pieces of code disagree about the exit-code contract.

Fix Action

Fixed

Code Example

<key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>
RAW_BUFFERClick to expand / collapse

Environment: macOS, hermes installed as a launchd user agent (~/Library/LaunchAgents/ai.hermes.gateway.plist).

Symptom: Triggering hermes update from within the gateway (e.g. via Telegram chat command) shuts down the gateway but does not bring it back. Manual hermes gateway start is required to recover. Status afterward shows LastExitStatus = 0.

Root cause: Two pieces of code disagree about the exit-code contract.

  1. The generated plist (hermes_cli/gateway.py:2846-2850) uses:
    <key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>
    i.e. only relaunch on a non-zero exit.
  2. launchd_restart() (hermes_cli/gateway.py:3021) prefers a graceful SIGUSR1-driven self-restart via _request_gateway_self_restart(). That path lets the gateway exit cleanly (status 0). launchd reads exit 0 as "success, do not relaunch" and leaves the service down.

Comparison: a SIGTERM-based restart leaves LastExitStatus = 15, which launchd does relaunch. So the "fallback" path works; the "graceful" path silently breaks recovery. The code comment at gateway.py:211 references RestartForceExitStatus=75 for systemd — the launchd side has no equivalent.

Suggested fixes (either is sufficient):

  • Have the graceful SIGUSR1 shutdown path exit with a non-zero status (e.g. 75) so it matches the systemd contract, or
  • Change the plist template to <key>KeepAlive</key><true/> (always relaunch unless explicitly bootout'd).

Repro: macOS, gateway installed as launchd agent, send update to gateway via Telegram. Then hermes gateway status → service not loaded.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix hermes update via gateway leaves launchd service unrestarted on macOS [1 pull requests]