Skip to content

✓ Gateway is running (PID: 1896, 1893, 8140) (Running manually, not as a system service) To install as a service: hermes gateway install sudo hermes gateway install --system falsely reports 'Running manually' when gateway is actually a systemd user service #16264

@533626

Description

@533626

Bug Summary

When running hermes gateway status from inside a profile TUI session, it incorrectly prints "Running manually, not as a system service" even though the gateway is actively running as a systemd user service.

Environment

  • OS: Debian GNU/Linux (forky/sid)
  • hermes-agent: latest main (as of 2026-04-27)
  • Profile setup: router (default) + guest profiles

Reproduction Steps

  1. Set up two profiles: router (default) and guest
  2. Install gateway services:
    hermes gateway install           # installs hermes-gateway.service (default profile)
    hermes --profile guest gateway install   # installs hermes-gateway-guest.service
  3. Start both services (they are systemd user services):
    systemctl --user start hermes-gateway.service
    systemctl --user start hermes-gateway-guest.service
  4. Enter the router profile TUI and run:
    hermes gateway status

Expected Behavior

● hermes-gateway.service - Hermes Agent Gateway - Messaging Platform Integration
     Active: active (running) since ...
   Main PID: 1896 (python)
...
✓ User gateway service is running

Actual Behavior

✓ Gateway is running (PID: 1896, 1893)
  (Running manually, not as a system service)

To install as a service:
  hermes gateway install
  sudo hermes gateway install --system

Root Cause Analysis

The gateway status command derives the systemd service name from HERMES_HOME via get_service_name():

https://github.com/NousResearch/hermes-agent/blob/main/hermes_cli/gateway.py#L4151

When running inside a profile TUI session, HERMES_HOME is set to the profile directory (e.g. /home/user/.hermes/profiles/router). This causes get_service_name() to return hermes-gateway-router and get_systemd_unit_path() to look for:

  • ~/.config/systemd/user/hermes-gateway-router.service (does NOT exist)

But the actual installed service file is:

  • ~/.config/systemd/user/hermes-gateway.service (exists, because the default profile installs with empty suffix)

Since the file check fails, the code falls through to the "manually running" branch:

https://github.com/NousResearch/hermes-agent/blob/main/hermes_cli/gateway.py#L4157-L4162

Verification

Running with explicit HERMES_HOME confirms the diagnosis:

# Wrong — from profile TUI
$ hermes gateway status
✓ Gateway is running (PID: 1896, 1893)
  (Running manually, not as a system service)

# Correct — overriding HERMES_HOME to default root
$ HERMES_HOME=/home/user/.hermes hermes gateway status
● hermes-gateway.service - Hermes Agent Gateway - Messaging Platform Integration
     Active: active (running) since Mon 2026-04-27 07:43:29 CST
   Main PID: 1896 (python)
...
✓ User gateway service is running

Suggested Fix

gateway status (and related service commands like restart/stop/uninstall) should resolve the service name against the default Hermes root (get_default_hermes_root()) rather than the current HERMES_HOME when checking for existing systemd units, or at least fall back to checking the default service name when the profile-scoped name is missing.

Alternatively, get_service_name() could return an empty suffix for the default active profile to maintain consistency between installation and status checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/cliCLI entry point, hermes_cli/, setup wizardcomp/gatewayGateway runner, session dispatch, deliverytype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions