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
- Set up two profiles:
router (default) and guest
- Install gateway services:
hermes gateway install # installs hermes-gateway.service (default profile)
hermes --profile guest gateway install # installs hermes-gateway-guest.service
- Start both services (they are systemd user services):
systemctl --user start hermes-gateway.service
systemctl --user start hermes-gateway-guest.service
- Enter the
router profile TUI and run:
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.
Bug Summary
When running
hermes gateway statusfrom 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
router(default) +guestprofilesReproduction Steps
router(default) andguestrouterprofile TUI and run:Expected Behavior
Actual Behavior
Root Cause Analysis
The
gateway statuscommand derives the systemd service name fromHERMES_HOMEviaget_service_name():https://github.com/NousResearch/hermes-agent/blob/main/hermes_cli/gateway.py#L4151
When running inside a profile TUI session,
HERMES_HOMEis set to the profile directory (e.g./home/user/.hermes/profiles/router). This causesget_service_name()to returnhermes-gateway-routerandget_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_HOMEconfirms the diagnosis:Suggested Fix
gateway status(and related service commands likerestart/stop/uninstall) should resolve the service name against the default Hermes root (get_default_hermes_root()) rather than the currentHERMES_HOMEwhen 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.