From 81ce945450ac46480980a613b886c6e61e34149d Mon Sep 17 00:00:00 2001 From: Byrn Tong <26782336+cixuuz@users.noreply.github.com> Date: Sun, 3 May 2026 07:08:02 +0000 Subject: [PATCH] fix(gateway): show other profiles in `gateway status` to prevent confusion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When multiple gateway profiles are running (e.g. default and wx1), `hermes gateway status` can be misleading — stopping one profile's gateway and checking status may still show the other profile's process without indicating which profile it belongs to. Add `_print_other_profiles_gateway_status()` which displays running gateways from other profiles at the bottom of the status output: Other profiles: ✓ wx1 — PID 166893 This uses the existing `find_profile_gateway_processes()` and `get_active_profile_name()` — no new dependencies. Closes #19113 Related: #4402, #4587 --- hermes_cli/gateway.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py index af4044492..39fc7476b 100644 --- a/hermes_cli/gateway.py +++ b/hermes_cli/gateway.py @@ -690,6 +690,32 @@ def _print_gateway_process_mismatch(snapshot: GatewayRuntimeSnapshot) -> None: print(" can refuse to start another copy until this process stops.") +def _print_other_profiles_gateway_status() -> None: + """Print a summary of gateway status across all profiles. + + Shown at the bottom of ``hermes gateway status`` output so users with + multiple profiles can tell at a glance which gateways are running and + avoid confusing another profile's process with the current one. + """ + try: + from hermes_cli.profiles import get_active_profile_name + + current = get_active_profile_name() + other_processes = [ + p for p in find_profile_gateway_processes() + if p.profile != current + ] + if not other_processes: + return + + print() + print("Other profiles:") + for proc in other_processes: + print(f" ✓ {proc.profile:<16s} — PID {proc.pid}") + except Exception: + pass + + def kill_gateway_processes(force: bool = False, exclude_pids: set | None = None, all_profiles: bool = False) -> int: """Kill any running gateway processes. Returns count killed. @@ -4456,6 +4482,9 @@ def _gateway_command_inner(args): print(" hermes gateway install # Install as user service") print(" sudo hermes gateway install --system # Install as boot-time system service") + # Show other profiles' gateway status for multi-profile awareness + _print_other_profiles_gateway_status() + elif subcmd == "migrate-legacy": # Stop, disable, and remove legacy Hermes gateway unit files from # pre-rename installs (e.g. hermes.service). Profile units and