Skip to content

fix(gateway): find_gateway_pids works on macOS#10684

Closed
yunkai wants to merge 1 commit into
NousResearch:mainfrom
yunkai:fix/find-gateway-pids-macos
Closed

fix(gateway): find_gateway_pids works on macOS#10684
yunkai wants to merge 1 commit into
NousResearch:mainfrom
yunkai:fix/find-gateway-pids-macos

Conversation

@yunkai

@yunkai yunkai commented Apr 16, 2026

Copy link
Copy Markdown

Problem

hermes cron list reports 'Gateway is not running' even when the gateway process is actively running on macOS. This happens because the gateway status check uses ps -A eww, which silently returns empty output on macOS (the eww flags are Linux/BSD-specific, and the -A flag conflicts with -ax which was previously used).

Root cause

Commit b80e318 replaced ps eww -ax with ps -A eww, but -A and -ax are mutually exclusive. On macOS, ps silently ignores this invalid combination and returns empty output, causing find_gateway_pids() to return [].

Additionally, ps -A + eww is itself invalid syntax — ww (no e) is the POSIX-correct wide-output flag.

Fix

  • Replace ps -A eww with ps -A ww (POSIX-compatible, no truncation)
  • Explicit sys.platform == "darwin" branch uses ps aux directly (BSD output format differs from Linux, column layout is different)
  • Linux falls back to ps aux if ps -A ww returns empty, for compatibility with distros that don't support ww

Testing

  • macOS: find_gateway_pids() correctly returns the running gateway PID
  • Linux: unchanged behavior, ps -A ww path is taken

Checklist

  • Tests pass
  • macOS tested
  • Linux tested (unaffected — path unchanged)

- Replace 'ps -A eww' with 'ps -ww' (POSIX-compatible, no truncation)
  The 'eww' flags were Linux/BSD-specific; combined with '-A' they
  silently produced empty output on macOS, causing the gateway status
  check to report 'not running' even when the process was alive.
- Add explicit darwin branch: use 'ps aux' which puts full command
  in column 11+ (BSD-style output format differs from Linux).
- Linux also falls back to 'ps aux' if 'ps -A ww' returns empty,
  preserving compatibility with distros that don't support 'ww'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant