fix(gateway): unify gateway status across CLI surfaces (salvaged from #11167)#11896
Merged
Conversation
This was referenced Apr 18, 2026
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.
hermes gateway status,hermes status,hermes dump, and the profile gateway-running check now agree on whether a gateway is live.Root cause
Each surface had its own liveness check — systemd/launchd service probe,
psscan, or a bareos.killprobe — whilehermes gateway runrelied onget_running_pid()reading the profile-scoped PID file. A service-stopped-but-manual-process-running setup would show "not running" from status and simultaneously refusehermes gateway runbecause the PID file found a live instance.Changes
gateway/status.py:get_running_pid()/is_gateway_running()accept an explicitpid_path+cleanup_stalekwarg so other profiles' PID files aren't deleted by a check on the current profile.hermes_cli/gateway.py: newGatewayRuntimeSnapshotdataclass +get_gateway_runtime_snapshot()as the single source of truth for gateway liveness.find_gateway_pids()now seeds from the profile PID file before scanningps.hermes gateway status: aftersystemd_status/launchd_status, prints a mismatch warning when the service is inactive but a gateway process is running for this profile.hermes_cli/status.pyandhermes_cli/dump.py: replace per-platform if-ladders with the shared snapshot.hermes_cli/profiles.py:_check_gateway_running()delegates toget_running_pid()withcleanup_stale=Falseinstead of a weaker custom probe.Plus AUTHOR_MAP entry for Sara Reynolds.
Validation
hermes gateway runrunrefuses to startos.kill— matches any live PIDGatewayRuntimeSnapshotTargeted tests: 209 passed (gateway/test_status, test_gateway*, test_profiles, test_status, test_runtime_health, test_container_aware_cli).
Live E2E:
hermes gateway statusandhermes statusexercised against the isolated HERMES_HOME on a host with an active systemd gateway — both correctly read the live service state via the new snapshot path. Mismatch warning verified via direct function call with simulated service-inactive + manual-process state.Credit
Original PR: #11167 by @snreynolds — cherry-picked with authorship preserved. Supersedes #9559 (@LevSky22, narrower docker-focused fix) and #11445 (@Hyena0x, narrower macOS-focused fix).