fix(cli): add missing subprocess.run() timeouts in gateway CLI - #5424
Merged
Conversation
All 35 subprocess.run() calls in hermes_cli/gateway.py lacked timeout parameters. If systemctl, launchctl, loginctl, wmic, or ps blocks, hermes gateway start/stop/restart/status/install/uninstall hangs indefinitely with no feedback. Timeouts tiered by operation type: - 10s: instant queries (is-active, status, list, ps, tail, journalctl) - 30s: fast lifecycle (daemon-reload, enable, start, bootstrap, kickstart) - 90s: graceful shutdown (stop, restart, bootout, kickstart -k) — exceeds our TimeoutStopSec=60 to avoid premature timeout during shutdown Special handling: _is_service_running() and launchd_status() catch TimeoutExpired and treat it as not-running/not-loaded, consistent with how non-zero return codes are already handled. Inspired by PR #3732 (dlkakbs) and issue #4057 (SHL0MS). Reimplemented on current main which has significantly changed launchctl handling (bootout/bootstrap/kickstart vs legacy load/unload/start/stop).
This was referenced Apr 6, 2026
Tommyeds
pushed a commit
to Tommyeds/hermes-agent
that referenced
this pull request
Apr 12, 2026
…esearch#5424) All 35 subprocess.run() calls in hermes_cli/gateway.py lacked timeout parameters. If systemctl, launchctl, loginctl, wmic, or ps blocks, hermes gateway start/stop/restart/status/install/uninstall hangs indefinitely with no feedback. Timeouts tiered by operation type: - 10s: instant queries (is-active, status, list, ps, tail, journalctl) - 30s: fast lifecycle (daemon-reload, enable, start, bootstrap, kickstart) - 90s: graceful shutdown (stop, restart, bootout, kickstart -k) — exceeds our TimeoutStopSec=60 to avoid premature timeout during shutdown Special handling: _is_service_running() and launchd_status() catch TimeoutExpired and treat it as not-running/not-loaded, consistent with how non-zero return codes are already handled. Inspired by PR NousResearch#3732 (dlkakbs) and issue NousResearch#4057 (SHL0MS). Reimplemented on current main which has significantly changed launchctl handling (bootout/bootstrap/kickstart vs legacy load/unload/start/stop).
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
…esearch#5424) All 35 subprocess.run() calls in hermes_cli/gateway.py lacked timeout parameters. If systemctl, launchctl, loginctl, wmic, or ps blocks, hermes gateway start/stop/restart/status/install/uninstall hangs indefinitely with no feedback. Timeouts tiered by operation type: - 10s: instant queries (is-active, status, list, ps, tail, journalctl) - 30s: fast lifecycle (daemon-reload, enable, start, bootstrap, kickstart) - 90s: graceful shutdown (stop, restart, bootout, kickstart -k) — exceeds our TimeoutStopSec=60 to avoid premature timeout during shutdown Special handling: _is_service_running() and launchd_status() catch TimeoutExpired and treat it as not-running/not-loaded, consistent with how non-zero return codes are already handled. Inspired by PR NousResearch#3732 (dlkakbs) and issue NousResearch#4057 (SHL0MS). Reimplemented on current main which has significantly changed launchctl handling (bootout/bootstrap/kickstart vs legacy load/unload/start/stop).
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…esearch#5424) All 35 subprocess.run() calls in hermes_cli/gateway.py lacked timeout parameters. If systemctl, launchctl, loginctl, wmic, or ps blocks, hermes gateway start/stop/restart/status/install/uninstall hangs indefinitely with no feedback. Timeouts tiered by operation type: - 10s: instant queries (is-active, status, list, ps, tail, journalctl) - 30s: fast lifecycle (daemon-reload, enable, start, bootstrap, kickstart) - 90s: graceful shutdown (stop, restart, bootout, kickstart -k) — exceeds our TimeoutStopSec=60 to avoid premature timeout during shutdown Special handling: _is_service_running() and launchd_status() catch TimeoutExpired and treat it as not-running/not-loaded, consistent with how non-zero return codes are already handled. Inspired by PR NousResearch#3732 (dlkakbs) and issue NousResearch#4057 (SHL0MS). Reimplemented on current main which has significantly changed launchctl handling (bootout/bootstrap/kickstart vs legacy load/unload/start/stop).
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…esearch#5424) All 35 subprocess.run() calls in hermes_cli/gateway.py lacked timeout parameters. If systemctl, launchctl, loginctl, wmic, or ps blocks, hermes gateway start/stop/restart/status/install/uninstall hangs indefinitely with no feedback. Timeouts tiered by operation type: - 10s: instant queries (is-active, status, list, ps, tail, journalctl) - 30s: fast lifecycle (daemon-reload, enable, start, bootstrap, kickstart) - 90s: graceful shutdown (stop, restart, bootout, kickstart -k) — exceeds our TimeoutStopSec=60 to avoid premature timeout during shutdown Special handling: _is_service_running() and launchd_status() catch TimeoutExpired and treat it as not-running/not-loaded, consistent with how non-zero return codes are already handled. Inspired by PR NousResearch#3732 (dlkakbs) and issue NousResearch#4057 (SHL0MS). Reimplemented on current main which has significantly changed launchctl handling (bootout/bootstrap/kickstart vs legacy load/unload/start/stop).
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…esearch#5424) All 35 subprocess.run() calls in hermes_cli/gateway.py lacked timeout parameters. If systemctl, launchctl, loginctl, wmic, or ps blocks, hermes gateway start/stop/restart/status/install/uninstall hangs indefinitely with no feedback. Timeouts tiered by operation type: - 10s: instant queries (is-active, status, list, ps, tail, journalctl) - 30s: fast lifecycle (daemon-reload, enable, start, bootstrap, kickstart) - 90s: graceful shutdown (stop, restart, bootout, kickstart -k) — exceeds our TimeoutStopSec=60 to avoid premature timeout during shutdown Special handling: _is_service_running() and launchd_status() catch TimeoutExpired and treat it as not-running/not-loaded, consistent with how non-zero return codes are already handled. Inspired by PR NousResearch#3732 (dlkakbs) and issue NousResearch#4057 (SHL0MS). Reimplemented on current main which has significantly changed launchctl handling (bootout/bootstrap/kickstart vs legacy load/unload/start/stop).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All 35
subprocess.run()calls inhermes_cli/gateway.pylacked timeout parameters. If systemctl, launchctl, loginctl, wmic, or ps blocks (D-Bus unavailable, WMI stuck, launchd unresponsive),hermes gateway start/stop/restart/status/install/uninstallhangs indefinitely.Inspired by PR #3732 (credit to @dlkakbs). Partially addresses #4057.
Timeout tiers
is-active,status,list,ps aux,wmic,journalctl -n 20,tail -20,loginctl show-userdaemon-reload,enable/disable,start,bootstrap,kickstart,enable-linger,kill SIGTERMstop,restart,bootout,kickstart -kTimeoutStopSec=60in systemd unit to avoid premature timeout during graceful shutdownSpecial handling
_is_service_running()andlaunchd_status()wrap queries intry/except TimeoutExpiredand treat timeout as not-running/not-loaded — consistent with how non-zero return codes are already handled.Test results
**kwargsfor the new timeout parameterhermes gateway status,find_gateway_pids(),_is_service_running(),get_systemd_linger_status()all return correctly