fix(launchd): add ThrottleInterval for faster gateway restart after update#9338
Open
lyr1cs wants to merge 1 commit into
Open
fix(launchd): add ThrottleInterval for faster gateway restart after update#9338lyr1cs wants to merge 1 commit into
lyr1cs wants to merge 1 commit into
Conversation
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>
20 tasks
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ThrottleInterval=10to the generated launchd plist template ingenerate_launchd_plist()Problem
When running
/updatefrom Telegram on macOS,hermes update --gatewaytriggers a gateway restart vialaunchd_restart(). The gateway exits with code 75 (GATEWAY_SERVICE_RESTART_EXIT_CODE), and launchd is expected to respawn it viaKeepAlive.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=30andRestartForceExitStatus=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 systemdRestartSec=30(slightly faster since launchd's mechanism is simpler).Test plan
pytest tests/hermes_cli/test_update_gateway_restart.py— 36 passed)/update🤖 Generated with Claude Code