Skip to content

The agent that grows with you

fix(process): fold scripts/check findings on the Greptile folds

kshitijk4poor5ba94077282c
diff --git a/hermes_cli/process_identity.py b/hermes_cli/process_identity.py
index ed076fbb5f4..65913add905 100644
--- a/hermes_cli/process_identity.py
+++ b/hermes_cli/process_identity.py
@@ -219,11 +219,11 @@ def spawned_by_this_process(pid: int) -> bool:
the Hermes whose command actually started it: the CLI it ran was given ``spawn_env`` and the
daemon inherited it. A pid file proves what a process is, not who started it. Fails closed:
an unreadable environment (another user, a race) is not ours."""
- try:
- import psutil
+ import psutil
+ try:
tag = parse_spawn_tag(psutil.Process(int(pid)).environ().get(SPAWN_ENV_VAR))
- except Exception:
+ except (psutil.Error, OSError):
return False
if tag is None or tag.spawner_pid != os.getpid():
return False
@@ -915,7 +915,7 @@ def stop_owned_group_survivors(pgid: int, *, proc=None, grace: float = 3.0) -> b
with _supervisor_lock:
owned = pgid in _supervised_pgids
if owned:
- for sig, wait in ((signal.SIGTERM, grace), (signal.SIGKILL, 1.0)):
+ for sig, wait in ((signal.SIGTERM, grace), (signal.SIGKILL, 1.0)): # windows-footgun: ok — POSIX-only, returned above
if release_process_group_once_empty(pgid, proc=proc, timeout=0):
return True
try:
diff --git a/tui_gateway/slash_worker.py b/tui_gateway/slash_worker.py
index a53b7285a0d..46a9960ec6c 100644
--- a/tui_gateway/slash_worker.py
+++ b/tui_gateway/slash_worker.py
@@ -58,6 +58,7 @@ def _start_legacy_parent_watchdog(parent_pid: int, *, poll_s: float = 2.0, grace
time.sleep(0.05)
os._exit(0)
+ # health: allow HX012 -- the loop only reads getppid() and calls os._exit; no profile-scoped state
threading.Thread(target=_loop, daemon=True, name="slash-legacy-parent-watchdog").start()
diff --git a/tui_gateway/slash_worker_client.py b/tui_gateway/slash_worker_client.py
index c9c8a4fc260..4912f00c469 100644
--- a/tui_gateway/slash_worker_client.py
+++ b/tui_gateway/slash_worker_client.py
@@ -175,7 +175,7 @@ def _stop_worker_group(proc) -> None:
# that already died leaves its group to the owner-death supervisor rather than risk signalling
# a recycled pgid.
if proc.poll() is None:
- for sig in (signal.SIGTERM, signal.SIGKILL):
+ for sig in (signal.SIGTERM, signal.SIGKILL): # windows-footgun: ok — POSIX-only, Windows returned above
# Members that outlive the leader keep the group (and its number) alive.
with contextlib.suppress(OSError):
os.killpg(pgid, sig) # windows-footgun: ok — POSIX-only, Windows returned above