fix(gateway): preserve launchd Hermes home on reinstall#32795
Open
gauravsaxena1997 wants to merge 1 commit into
Open
fix(gateway): preserve launchd Hermes home on reinstall#32795gauravsaxena1997 wants to merge 1 commit into
gauravsaxena1997 wants to merge 1 commit into
Conversation
0e42fdc to
52ab7ad
Compare
Contributor
Author
|
Refreshed this branch onto current main so the PR is no longer conflict/dirty. Local verification after rebase:\n\n- .venv/bin/python -m pytest tests/hermes_cli/test_gateway_service.py::TestLaunchdServiceRecovery -q\n\nResult: 11 passed. |
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.
What does this PR do?
Fixes the macOS LaunchAgent reinstall path so
hermes gateway installno longer silently resets an existing service from a customHERMES_HOMEback to the current shell/default Hermes home.The fix reads service-scoped values from the existing plist before regenerating it, then preserves:
EnvironmentVariables.HERMES_HOMEEnvironmentVariables.PATHEnvironmentVariables.VIRTUAL_ENVStandardOutPathStandardErrorPathThis keeps the repair/reinstall behavior intact while preventing an existing custom gateway home, path, venv, or log target from being overwritten by the caller's current environment. The stale-plist comparison also uses those preserved values so a valid custom-home plist does not keep looking outdated forever.
Related Issue
Fixes #32741
Type of Change
Changes Made
hermes_cli/gateway.py: add plist parsing for existing launchd service values and preserve those values during plist comparison, refresh, and force reinstall.tests/hermes_cli/test_gateway_service.py: add regression coverage for reinstalling an outdated LaunchAgent plist while preserving customHERMES_HOME,PATH,VIRTUAL_ENV, stdout log path, and stderr log path.How to Test
HERMES_HOME.hermes gateway installlater from an environment whereHERMES_HOMEis unset or different.Automated verification run locally:
scripts/run_tests.sh tests/hermes_cli/test_gateway_service.py -- -q -k launchd uv run ruff check . python scripts/check-windows-footguns.py --all git diff --checkResults:
I also tried the full
tests/hermes_cli/test_gateway_service.pyfile on macOS. The launchd tests passed, but six unrelated systemd tests fail on currentupstream/mainbefore this patch's launchd path because_preflight_user_systemd()rejects the local non-Linux D-Bus/systemd environment.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
Not applicable. This is covered by launchd plist regression tests.