fix(gateway): fix and verify launchd startup with external homes - #78150
Open
izumi0uu wants to merge 2 commits into
Open
fix(gateway): fix and verify launchd startup with external homes#78150izumi0uu wants to merge 2 commits into
izumi0uu wants to merge 2 commits into
Conversation
Build on NousResearch#78141 by preserving the real macOS user-home log path across profiles, creating it only on service-management paths, and requiring launchd PID plus matching Hermes runtime readiness before reporting install/start success.
13 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.
What does this PR do?
Fixes both launchd failure modes reported in #78129:
launchd-owned stdout/stderr now live under the real macOS user's boot-volume log directory:
This prevents launchd's pre-exec redirect open from failing with
EX_CONFIG 78whenHERMES_HOMEis on a non-boot volume. Hermes' application-managed logs underHERMES_HOME/logsare unchanged.hermes gateway installandhermes gateway startno longer report success merely becausebootstraporkickstartreturned zero. They wait up to 60 seconds for launchd to expose a PID and for that same PID's Hermes runtime state to becomerunning.This builds on #78141. Its
deb3c4eaacommit is retained as the first commit so RerankerGuo's authorship is preserved; the follow-up commit adds readiness verification and tightens profile/user-home handling.Related Issue
Fixes #78129
Builds on #78141
Type of Change
Why this is the right fix
StandardOutPathandStandardErrorPathare launchd infrastructure, so they use the platform-standard user log location instead of following potentially external Hermes state._launchd_user_home(), not the possibly profile-overriddenHOME, and remains isolated by the existing profile-scoped launchd label.gateway_state.jsonfrom an old PID cannot produce a false success.startup_failedstate exits immediately; a timeout exits non-zero and prints bothlaunchctl printand the launchd stderr path.launchd_restart()is intentionally unchanged because restart readiness is already covered by fix(gateway): wait for launchd restart readiness in-band (#56524) #56908.Changes Made
hermes_cli/gateway.pyLibrary/Logs.launchctl list <label>and require matching Hermes runtime readiness.tests/hermes_cli/test_gateway_service.pyHERMES_HOMEplist generation.How to Test
HERMES_HOMEon a non-boot volume.hermes gateway installorhermes gateway start.~/Library/Logs/<label>/, while Hermes application logs remain underHERMES_HOME/logs.gateway_state=runningruntime record.launchctl printcommand plusgateway.stderr.logpath.Validation
Parent-commit reproduction tests:
HERMES_HOME/logs.Post-fix checks on macOS 26.5.2:
Checklist
Code
pytest tests/ -qand all tests passDocumentation & Housekeeping
cli-config.yaml.exampleupdate: N/A; no config keys changedCONTRIBUTING.md/AGENTS.mdupdate: N/A; no architecture or workflow changedRemaining Risk
A live launchd E2E run with
HERMES_HOMEon a physically separate volume was not performed locally. The path failure is covered by plist regression tests and the issue's controlled reproduction; launchd/runtime convergence is covered with command-path tests.