Skip to content

[Bug]: gateway status reports running when only a different profile's gateway is alive #19113

@cixuuz

Description

@cixuuz

Bug Description

When running multiple gateway profiles (e.g. default and wx1), hermes --profile wx1 gateway status incorrectly reports the gateway as running even when only the default profile's gateway is alive (and vice versa).

This happens in the non-service (manual process) code path where find_gateway_pids() feeds into the status display.

Steps to Reproduce

  1. Start the default gateway: hermes gateway run --replace
  2. Start a second profile gateway: hermes --profile wx1 gateway run --replace
  3. Stop the wx1 gateway: hermes --profile wx1 gateway stop
  4. Check wx1 status: hermes --profile wx1 gateway status

Expected Behavior

✗ Gateway is not running

To start:
  hermes --profile wx1 gateway run

Actual Behavior

✓ Gateway is running (PID: <default gateway PID>)
  (Running manually, not as a system service)

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

It picks up the default profile's PID and claims wx1 is running.

Root Cause

In hermes_cli/gateway.py, the status subcommand (line ~4417) calls get_gateway_runtime_snapshot()find_gateway_pids()_scan_gateway_pids(). The profile-matching logic in _matches_current_profile() can match processes from other profiles when the default gateway wasn't started with an explicit --profile flag.

Suggested Improvement

In addition to fixing the profile filtering, consider showing all profiles in the status output for better visibility:

Gateway Status:
  ✓ default  — PID 155469
  ✗ wx1      — not running

The building blocks already exist — find_profile_gateway_processes() (line 382) scans all profiles and maps PIDs, and ProfileInfo in profiles.py already has a gateway_running field. They just aren't used in the status display.

Related Issues

Environment

  • OS: Amazon Linux 2
  • Running gateways manually (no systemd service)
  • Two profiles: default (Discord) and wx1

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