Skip to content

The agent that grows with you

Merge branch 'simp/r3-19-A1' into simp/integration3

Teknium96e2d44d1617
diff --cc hermes_cli/gateway.py
index 42ddbb75474,60424ad0175..c2b9fa3314f
--- a/hermes_cli/gateway.py
+++ b/hermes_cli/gateway.py
@@@ -1634,23 -1752,17 +1630,18 @@@ def _reaper_exclusion_pids(extra_exclud
with contextlib.suppress(Exception):
own |= _get_service_pids(all_profiles=True)
# Exempt the recorded gateway PID and its parent chain (on Windows the Scheduled-Task bootstrap's
- # ``gateway run`` argv matches the scan). Use the RAW pidfile + lock records, not only the
- # validated probe: get_running_pid returns None on any validation hiccup — exactly when a healthy
- # standalone gateway would be hard-killed. For a KILL exclusion list a stale PID at worst spares
- # one process; a false-negative kills a live gateway.
+ # ``gateway run`` argv matches the scan; killing it takes the gateway down). Use the RAW pidfile +
+ # lock records, not only the validated probe: get_running_pid returns None on any validation
+ # hiccup — exactly when a healthy standalone gateway would be hard-killed (Windows SIGTERM is
+ # TerminateProcess, no drain). For a KILL exclusion list a stale PID at worst spares one process;
+ # a false negative kills a live gateway. The probe still supplies the runtime-status fallback PID.
try:
from gateway.status import _pid_from_record, _read_gateway_lock_record, _read_pid_record, get_running_pid
-
- recorded_pids = set()
- for _record in (_read_pid_record(), _read_gateway_lock_record()):
- _raw_pid = _pid_from_record(_record)
- if _raw_pid and _raw_pid > 0:
- recorded_pids.add(_raw_pid)
- _probed = get_running_pid(cleanup_stale=False)
- if _probed and _probed > 0:
- recorded_pids.add(_probed)
+ recorded_pids = {_pid_from_record(rec) for rec in (_read_pid_record(), _read_gateway_lock_record())}
+ recorded_pids.add(get_running_pid(cleanup_stale=False))
for recorded in recorded_pids:
+ if not recorded or recorded <= 0:
+ continue
own.add(recorded)
try:
import psutil # type: ignore