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
- Start the default gateway:
hermes gateway run --replace
- Start a second profile gateway:
hermes --profile wx1 gateway run --replace
- Stop the
wx1 gateway: hermes --profile wx1 gateway stop
- 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
Bug Description
When running multiple gateway profiles (e.g.
defaultandwx1),hermes --profile wx1 gateway statusincorrectly reports the gateway as running even when only thedefaultprofile'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
hermes gateway run --replacehermes --profile wx1 gateway run --replacewx1gateway:hermes --profile wx1 gateway stopwx1status:hermes --profile wx1 gateway statusExpected Behavior
Actual Behavior
It picks up the default profile's PID and claims
wx1is running.Root Cause
In
hermes_cli/gateway.py, the status subcommand (line ~4417) callsget_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--profileflag.Suggested Improvement
In addition to fixing the profile filtering, consider showing all profiles in the status output for better visibility:
The building blocks already exist —
find_profile_gateway_processes()(line 382) scans all profiles and maps PIDs, andProfileInfoinprofiles.pyalready has agateway_runningfield. They just aren't used in the status display.Related Issues
gateway stopkills all profile gateways instead of current profilekill_gateway_processes()andrelease_all_scoped_locks()are profile-blindgateway rundetects calling CLI process as running gateway instanceEnvironment
default(Discord) andwx1