Skip to content

fix(status): detect gateway process when running as PID 1 in Docker/Kubernetes#4792

Closed
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/gateway-status-docker-pid1
Closed

fix(status): detect gateway process when running as PID 1 in Docker/Kubernetes#4792
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/gateway-status-docker-pid1

Conversation

@ygd58

@ygd58 ygd58 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #4776

Problem

hermes status reported gateway as "stopped" in Docker/Kubernetes because it only checked systemctl --user is-active, which returns "inactive" when gateway runs as PID 1 (not via systemd).

Fix

Added process-based fallback using pgrep when systemd reports inactive. Shows "direct process (non-systemd)" as manager label when detected this way.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the contribution, @ygd58! This fix has been superseded by a larger refactor already on main.

This is an automated hermes-sweeper review.

  • The PR patches a systemctl --user is-active block in hermes_cli/status.py at ~line 295, but that code no longer exists on main. The entire gateway status section was refactored to delegate to get_gateway_runtime_snapshot() in hermes_cli/gateway.py.
  • get_gateway_runtime_snapshot() already handles Docker/Kubernetes environments: it calls is_container() (hermes_constants.py:196) which checks /.dockerenv, /run/.containerenv, and /proc/1/cgroup. When inside a container, it returns manager="docker (foreground)" and derives liveness from find_gateway_pids() — no systemctl call is made.
  • GatewayRuntimeSnapshot.running (hermes_cli/gateway.py:55) is True whenever gateway_pids is non-empty, which correctly reflects a running PID-1 gateway process without any pgrep fallback needed.

The original issue #4776 is addressed by the current architecture. No further changes to status.py are needed for this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: hermes status reports Gateway as 'stopped' when running as PID 1 in Docker/Kubernetes

2 participants