The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(process): log a supervisor that will not exit on release; the SIGKILL daemon test waits on the condition
kshitijk4poor9857b35c226f
diff --git a/hermes_cli/process_identity.py b/hermes_cli/process_identity.pyindex 6f04c640221..6378c11d3bd 100644--- a/hermes_cli/process_identity.py+++ b/hermes_cli/process_identity.py@@ -18,6 +18,7 @@ import jsonimport loggingimport osimport platform+import subprocessimport sysimport threadingimport time@@ -803,8 +804,6 @@ _POSIX_SH = "/bin/sh" if os.path.exists("/bin/sh") else "/system/bin/sh"def _spawn_supervisor():"""Start the per-process supervisor, or None if it cannot be started."""- import subprocess-try:# start_new_session=True is load-bearing: shutdown paths killpg this process's own group,# which would kill the supervisor before it could reap anything. close_fds keeps the write@@ -898,6 +897,6 @@ def update_supervised_pgids(verb: str, pgids) -> None:# Reap it, or the exited supervisor stays a zombie until the next Popen in this process.try:proc.wait(timeout=5)- except Exception:- pass+ except subprocess.TimeoutExpired:+ logger.warning("owner-death supervisor pid %s did not exit 5 s after release", proc.pid)_supervisor = Nonediff --git a/tests/tools/test_browser_use_cli_owned_daemon.py b/tests/tools/test_browser_use_cli_owned_daemon.pyindex 3ae8ec567e0..4bb1516296c 100644--- a/tests/tools/test_browser_use_cli_owned_daemon.py+++ b/tests/tools/test_browser_use_cli_owned_daemon.py@@ -10,14 +10,22 @@ import jsonimport osimport subprocessimport sys-import timefrom pathlib import Pathimport pytestfrom hermes_cli import process_identity+from tests.waiting import wait_untilfrom tools import browser_use_cli++def _group_alive(pgid: int) -> bool:+ try:+ os.killpg(pgid, 0) # windows-footgun: ok — posix-marked test+ except ProcessLookupError:+ return False+ return True+pytestmark = pytest.mark.platforms("posix")# A stand-in harness daemon: the real module name on argv (the identity check reads argv), detached@@ -126,15 +134,8 @@ def test_a_sigkilled_owner_takes_its_harness_daemon_with_it(tmp_path):daemon_pid = int(owner.stdout.readline())owner.kill()owner.wait(timeout=10)- deadline = time.monotonic() + 15- while time.monotonic() < deadline:- try:- os.killpg(daemon_pid, 0) # windows-footgun: ok — posix-marked test- except ProcessLookupError:- break- time.sleep(0.05)- else:- pytest.fail("the harness daemon outlived kill -9 of the Hermes process that drove it")+ wait_until(lambda: not _group_alive(daemon_pid), timeout=15,+ what="the harness daemon to die with the kill -9'd Hermes process that drove it")finally:if daemon_pid is not None:try: