Skip to content

fix(profiles): detect systemd-managed gateways in profile list/show - #26731

Open
Zyrixtrex wants to merge 1 commit into
NousResearch:mainfrom
Zyrixtrex:fix/profile-systemd-gateway-detection
Open

fix(profiles): detect systemd-managed gateways in profile list/show#26731
Zyrixtrex wants to merge 1 commit into
NousResearch:mainfrom
Zyrixtrex:fix/profile-systemd-gateway-detection

Conversation

@Zyrixtrex

Copy link
Copy Markdown
Contributor

Summary

hermes profile list and hermes profile show <name> could report Gateway: stopped
even when the gateway was actually running as a systemd-managed service.

This happened because profile status checks only looked at gateway.pid.
For host-side systemd setups, that could miss a live gateway that other Hermes
surfaces already detected correctly.

What changed

  • Extend hermes_cli.gateway service-name/unit-path helpers to accept an explicit hermes_home
  • Update hermes_cli.profiles._check_gateway_running() to:
    • keep the existing gateway.pid check first
    • fall back to systemd service status when no PID-backed gateway is found
  • Add regression coverage for:
    • default profile with active systemd user service
    • named profile with profile-scoped service name
    • installed but inactive service remaining False

Reproduction

  1. Run Hermes Gateway as a systemd user service
  2. Confirm hermes gateway status reports it as running
  3. Run hermes profile list or hermes profile show default

Before this change:

  • profile surfaces could incorrectly show Gateway: stopped

After this change:

  • profile surfaces correctly report the gateway as running

Files changed

  • hermes_cli/gateway.py
  • hermes_cli/profiles.py
  • tests/hermes_cli/test_profiles.py

How to test

uv run pytest tests/hermes_cli/test_profiles.py -q -n0

110 passed

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery labels May 16, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing with #20488 — both fix hermes profile list/show missing systemd-managed gateways (closes #20254). Both modify hermes_cli/profiles.py and tests/hermes_cli/test_profiles.py; this PR additionally updates hermes_cli/gateway.py helpers. One should be closed in favor of the other.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for addressing the profile-status/systemd mismatch. The premise remains live on current main: hermes_cli/profiles.py:699-729 has PID and runtime-state checks but no systemd service-status fallback, and the #20254 discussion documents why the runtime-state path still misses bare systemd hermes processes.

Problems

  • Current main added a profile-scoped runtime-state fallback in hermes_cli/profiles.py:721-729 after this PR's base. Replacing _check_gateway_running() with the PR version would discard that existing container/launch-service path.
  • The new tests should be integrated with the current regression set at tests/hermes_cli/test_profiles.py:1669-1810, which protects live-state, stopped-state, and cross-profile PID-reuse behavior.

Suggested changes

  • Salvage the systemd lookup as a third fallback after the current PID and gateway_state.json checks.
  • Keep the existing runtime-state tests and add the active/inactive systemd cases to that combined behavior.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/profiles Multi-profile isolation, HERMES_HOME scoping labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants