The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
chore(process): comments and a test match the thread-start fallback
kshitijk4poore0658e21d14d
diff --git a/hermes_cli/process_identity.py b/hermes_cli/process_identity.pyindex 0e2e753e0a0..ee4e5e6cb62 100644--- a/hermes_cli/process_identity.py+++ b/hermes_cli/process_identity.py@@ -910,7 +910,7 @@ def _watch_supervisor(proc) -> None:# health: allow HX012 -- the thread waitpid()s one child and touches only process-global supervisor statethreading.Thread(target=wait_then_restart, name="owner-death-supervisor-waiter", daemon=True).start()except Exception:- # The supervisor still works; it is only reaped at our exit and not restarted if killed.+ # The supervisor still works; it is left a zombie until we exit and is not restarted if killed.logger.debug("Could not start the owner-death supervisor's waiter", exc_info=True)@@ -973,7 +973,7 @@ def _start_supervisor_locked():proc.stdin.write("".join(f"register {pgid}\n" for pgid in _supervised_pgids))proc.stdin.flush()except (BrokenPipeError, ValueError, OSError):- _supervisor = None # its waiter reaps it; the next registration change retries+ _supervisor = None # its waiter (if it has one) reaps it; the next registration change retriesreturn Nonereturn procdiff --git a/tests/hermes_cli/test_process_identity_supervisor.py b/tests/hermes_cli/test_process_identity_supervisor.pyindex cfabfd36250..f05b7c8c0ba 100644--- a/tests/hermes_cli/test_process_identity_supervisor.py+++ b/tests/hermes_cli/test_process_identity_supervisor.py@@ -943,11 +943,12 @@ def test_a_process_that_cannot_start_a_thread_still_gets_its_child_and_releases_def no_threads(*_a, **_kw):raise RuntimeError("can't start new thread")- monkeypatch.setattr(_threading.Thread, "start", no_threads)- child = process_identity.spawn_owned([sys.executable, "-c", "pass"], purpose="test")- child.wait(timeout=10)- supervisor = process_identity._supervisor- process_identity.release_process_group_once_empty(child.pid, proc=child, timeout=5)+ with monkeypatch.context() as patched:+ patched.setattr(_threading.Thread, "start", no_threads) # only around the spawn and release+ child = process_identity.spawn_owned([sys.executable, "-c", "pass"], purpose="test")+ assert child.wait(timeout=10) == 0, "spawn_owned did not hand back a working child"+ supervisor = process_identity._supervisor+ process_identity.release_process_group_once_empty(child.pid, proc=child, timeout=5)assert process_identity._supervisor is None, "with no timer thread the supervisor is released at once"if supervisor is not None:supervisor.wait(timeout=10)