The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(process): a supervisor killed by a signal is restarted however young it is
kshitijk4poorddd9d06a538a
diff --git a/hermes_cli/process_identity.py b/hermes_cli/process_identity.pyindex ac0f1a100fe..cfdd9846e6f 100644--- a/hermes_cli/process_identity.py+++ b/hermes_cli/process_identity.py@@ -853,8 +853,9 @@ def _spawn_supervisor():return proc-# A supervisor that dies sooner than this after starting cannot stay up (a broken install): the waiter-# leaves it to the next registration change instead of restarting it in a loop.+# A supervisor that EXITS sooner than this after starting cannot stay up (a broken install: sh exiting+# 2 or 127): the waiter leaves it to the next registration change instead of restarting it in a loop.+# One killed by a signal is restarted whatever its age._SUPERVISOR_RESTART_MIN_UPTIME_S = 5.0@@ -878,7 +879,7 @@ def _watch_supervisor(proc) -> None:_prune_dead_supervised_pgids()if not _supervised_pgids:return- restart = time.monotonic() - started >= _SUPERVISOR_RESTART_MIN_UPTIME_S+ restart = proc.returncode < 0 or time.monotonic() - started >= _SUPERVISOR_RESTART_MIN_UPTIME_Slogger.warning("owner-death supervisor exited (status %s) with %d process group(s) registered; %s",proc.returncode, len(_supervised_pgids),diff --git a/tests/hermes_cli/test_process_identity_supervisor.py b/tests/hermes_cli/test_process_identity_supervisor.pyindex 26c40bacf41..13610f6336f 100644--- a/tests/hermes_cli/test_process_identity_supervisor.py+++ b/tests/hermes_cli/test_process_identity_supervisor.py@@ -871,10 +871,10 @@ def test_a_released_supervisor_leaves_no_zombie_child():def test_a_supervisor_killed_on_its_own_is_restarted_with_every_group_replayed(monkeypatch):"""``pkill -f hermes`` (or the OOM killer) can take the supervisor out while this process lives.Its waiter restarts it at once and replays the registered groups, so they still die with us even- if no registration change ever comes; it is also reaped, never left a zombie."""+ if no registration change ever comes; it is also reaped, never left a zombie. A signal death is+ restarted however young the supervisor is (a new one starts after every idle period)."""import psutil- monkeypatch.setattr(process_identity, "_SUPERVISOR_RESTART_MIN_UPTIME_S", 0.0)child = subprocess.Popen(_VICTIM, start_new_session=True)try:process_identity.own_process_groups([child.pid])