fix(gateway): self-heal missing launchd plist on start#3334
Closed
Bartok9 wants to merge 1 commit into
Closed
Conversation
When the launchd plist file is missing (manual cleanup, failed upgrade, launchd state drift), `hermes gateway start` now regenerates the plist, loads it, and starts the service instead of crashing with exit status 3. Previously, `refresh_launchd_plist_if_needed()` returned early if the plist was missing, and the recovery path in `launchd_start()` was skipped because it only triggered when the plist existed. Changes: - Check for missing plist at the start of `launchd_start()` - Regenerate and load the service definition if missing - Simplify the exception handler (plist existence check no longer needed) Fixes NousResearch#3318
Contributor
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
When the launchd plist file is missing (manual cleanup, failed upgrade, launchd state drift),
hermes gateway startnow regenerates the plist, loads it, and starts the service instead of crashing with exit status 3.Problem
Previously,
refresh_launchd_plist_if_needed()returned early if the plist was missing:And the recovery path in
launchd_start()was skipped because it only triggered when the plist existed:This meant users in the missing-plist state had to run
hermes gateway installmanually to recover.Solution
Check for missing plist at the start of
launchd_start()and self-heal:launchctl loadThis makes
hermes gateway startrobust to missing plists, regardless of how the plist disappeared.Testing
Added regression test:
test_launchd_start_recreates_missing_plist_and_loads_serviceFixes #3318