The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(serve): only "no such process" from ps means the Desktop parent is gone
kshitijk4poore7eed649a6fb
diff --git a/hermes_cli/web_server_lifecycle.py b/hermes_cli/web_server_lifecycle.pyindex d84e752c67d..b9eb0d9c441 100644--- a/hermes_cli/web_server_lifecycle.py+++ b/hermes_cli/web_server_lifecycle.py@@ -75,10 +75,10 @@ def _process_start_marker(pid: int) -> str:marker = result.stdout.strip()if result.returncode == 0 and marker:return f"ps:{marker}"- stderr_lower = result.stderr.lower()- if (result.returncode == 1 and not marker) or any(- msg in stderr_lower for msg in ("no such process", "not found")- ):+ # rc==1 with empty output is the portable "no such pid"; "No such process" widens that for ps+ # builds that say so explicitly. Any other failure stays an OSError so the watchdog degrades to+ # pid liveness instead of exiting on a healthy backend.+ if (result.returncode == 1 and not marker) or "no such process" in result.stderr.lower():raise ProcessLookupError(pid)raise OSError(f"ps could not inspect PID {pid}: {result.stderr.strip()}")diff --git a/tests/hermes_cli/test_serve_parent_watchdog.py b/tests/hermes_cli/test_serve_parent_watchdog.pyindex 1324c30f32b..4ad394a9766 100644--- a/tests/hermes_cli/test_serve_parent_watchdog.py+++ b/tests/hermes_cli/test_serve_parent_watchdog.py@@ -191,22 +191,19 @@ def test_parent_watchdog_degrades_to_pid_liveness_when_marker_probe_raises_oserrassert _is_serve_orphaned(4242, marker, pid_exists=lambda _pid: True,process_start_marker=broken_marker_probe) is False--def test_parent_watchdog_detects_dead_parent_on_process_lookup_error():- """#80204: ``ProcessLookupError`` from the marker probe means the parent is gone, whatever- a (possibly recycled) pid liveness check says."""def lookup_error_probe(pid: int) -> str:raise ProcessLookupError(pid)- assert _is_serve_orphaned(4242, "ps:Thu Aug 20 22:33:11 2026", pid_exists=lambda _pid: True,+ # ProcessLookupError is conclusive on its own, whatever a recycled-pid liveness check says.+ assert _is_serve_orphaned(4242, marker, pid_exists=lambda _pid: True,process_start_marker=lookup_error_probe) is True@pytest.mark.macos_onlydef test_ps_marker_probe_classifies_missing_process_vs_other_ps_failures(monkeypatch):- """The darwin ``ps`` probe raises ``ProcessLookupError`` only for a missing-process message;- any other non-zero exit stays a plain ``OSError`` so the watchdog degrades instead of killing- a healthy backend."""+ """The darwin ``ps`` probe raises ``ProcessLookupError`` only for an explicit missing-process+ message; any other unknown failure stays a plain ``OSError`` so the watchdog degrades instead+ of killing a healthy backend."""import subprocessfrom hermes_cli import web_server_lifecycle