Skip to content

fix(launchd): add ThrottleInterval for faster gateway restart after update#9338

Open
lyr1cs wants to merge 1 commit into
NousResearch:mainfrom
lyr1cs:fix/launchd-throttle-interval
Open

fix(launchd): add ThrottleInterval for faster gateway restart after update#9338
lyr1cs wants to merge 1 commit into
NousResearch:mainfrom
lyr1cs:fix/launchd-throttle-interval

Conversation

@lyr1cs

@lyr1cs lyr1cs commented Apr 14, 2026

Copy link
Copy Markdown

Summary

  • Add ThrottleInterval=10 to the generated launchd plist template in generate_launchd_plist()
  • Add tests to verify the ThrottleInterval key and value are present in the generated plist

Problem

When running /update from Telegram on macOS, hermes update --gateway triggers a gateway restart via launchd_restart(). The gateway exits with code 75 (GATEWAY_SERVICE_RESTART_EXIT_CODE), and launchd is expected to respawn it via KeepAlive.SuccessfulExit=false.

However, without ThrottleInterval, launchd uses its default exponential back-off for process restarts. If the gateway has restarted recently (e.g. during the update cycle), launchd delays the next restart by progressively longer intervals — observed delays of 1-2 hours in practice, during which the bot is completely unresponsive.

The systemd unit already handles this correctly with RestartSec=30 and RestartForceExitStatus=75, but the launchd plist was missing the equivalent setting.

Fix

Add <key>ThrottleInterval</key><integer>10</integer> to the launchd plist template, capping the restart delay at 10 seconds. This matches the intent of the systemd RestartSec=30 (slightly faster since launchd's mechanism is simpler).

Test plan

  • Existing tests pass (pytest tests/hermes_cli/test_update_gateway_restart.py — 36 passed)
  • New tests verify ThrottleInterval presence and value
  • Verified on macOS (Darwin 24.6.0, launchd) — gateway restarts within 10s after /update

🤖 Generated with Claude Code

The systemd unit includes RestartSec=30 and RestartForceExitStatus=75 to
ensure quick recovery after `hermes update` triggers a service restart.
The launchd plist was missing the equivalent ThrottleInterval setting,
causing macOS to use its default exponential back-off which can delay
gateway restarts by minutes (observed 1-2 hours in practice).

Add ThrottleInterval=10 so launchd restarts the gateway within 10 seconds
after an update-triggered exit (code 75).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants