mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
fix(cli): add missing subprocess.run() timeouts in gateway CLI (#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 #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 commit is contained in:
parent
ab086a320b
commit
786970925e
3 changed files with 75 additions and 54 deletions
|
|
@ -40,7 +40,7 @@ def test_systemd_status_warns_when_linger_disabled(monkeypatch, tmp_path, capsys
|
|||
monkeypatch.setattr(gateway, "get_systemd_unit_path", lambda system=False: unit_path)
|
||||
monkeypatch.setattr(gateway, "get_systemd_linger_status", lambda: (False, ""))
|
||||
|
||||
def fake_run(cmd, capture_output=False, text=False, check=False):
|
||||
def fake_run(cmd, capture_output=False, text=False, check=False, **kwargs):
|
||||
if cmd[:4] == ["systemctl", "--user", "status", gateway.get_service_name()]:
|
||||
return SimpleNamespace(returncode=0, stdout="", stderr="")
|
||||
if cmd[:3] == ["systemctl", "--user", "is-active"]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue