Skip to content

fix(gateway): recover stale launchd service state#1614

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
PeterFile:fix/launchd-service-recovery
Mar 17, 2026
Merged

fix(gateway): recover stale launchd service state#1614
teknium1 merged 1 commit into
NousResearch:mainfrom
PeterFile:fix/launchd-service-recovery

Conversation

@PeterFile

Copy link
Copy Markdown
Contributor

Closes #1613

What changed

  • repair stale systemd and launchd service definitions during hermes gateway install instead of skipping whenever a local file already exists
  • reload launchd jobs on hermes gateway start when launchctl start fails because the job is unloaded
  • make launchd_restart() tolerate an unloaded job and reuse the new start recovery path
  • stop hermes gateway restart from silently falling back to a foreground gateway when a configured service manager restart failed
  • extend launchd status so it reports the local plist path, whether the service definition is stale, and that the service is present locally but not loaded
  • add regression tests for stale install repair, launchd start recovery, launchd status diagnostics, and restart failure handling

Why

  • a local plist/unit file existing is not enough; it can still be stale or unloaded after repo moves, failed loads, or partial service breakage
  • the previous foreground fallback hid real background service failures and made recovery look successful when it was not
  • users need status output that distinguishes "not installed" from "installed locally but stale/unloaded"

Breaking changes

  • None

Testing

  • python -m pytest -o addopts='' tests/hermes_cli/test_gateway_service.py tests/hermes_cli/test_update_gateway_restart.py -q
  • manual read-only check on macOS: python -m hermes_cli.main gateway status

Platform

  • macOS 15.6 / Darwin 24.6.0 x86_64
  • Python 3.11.14

Repair stale launchd/systemd definitions during install and
teach launchd start to reload unloaded jobs before retrying.

Stop masking service restart failures by falling back to a
foreground gateway when a configured service manager is still
broken.

Refs: NousResearch#1613
@PeterFile PeterFile changed the title Recover stale gateway service state fix(gateway): recover stale launchd service state Mar 17, 2026
@teknium1 teknium1 merged commit c3ca68d into NousResearch:main Mar 17, 2026
1 check passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…ce-recovery

fix(gateway): recover stale launchd service state
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ce-recovery

fix(gateway): recover stale launchd service state
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…ce-recovery

fix(gateway): recover stale launchd service state
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…ce-recovery

fix(gateway): recover stale launchd service state
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.

[Bug]: gateway should recover unloaded launchd jobs and report stale service state

2 participants