Skip to content

The agent that grows with you

fix(gateway): trim reap-grace docs and dead test state (#122533)

kshitijk4poor09472a30a770
diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py
index b66abd0f68e..711db052bf9 100644
--- a/hermes_cli/gateway.py
+++ b/hermes_cli/gateway.py
@@ -1778,8 +1778,8 @@ def _reap_unsupervised_gateway_orphans(
that a previous Desktop generation (or a concurrent ``gateway start``) just launched
is scan-visible but not yet record-visible, and the argv sweep cannot tell it from
a corpse. Reaping it writes a planned-stop marker it consumes seconds later — a clean
- exit 0 with no supervisor to revive it (#122533). Only the Desktop boot sweep passes a
- grace (it is the one caller that races a launch); stop/restart keep reaping at once.
+ exit 0 with no supervisor to revive it (#122533). The Desktop boot sweep passes a
+ grace; stop/restart keep reaping at once.
"""
try:
supervised_host = supports_systemd_services()
diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.py
index 7721ac8f713..fd1f4069ebb 100644
--- a/hermes_cli/web_server.py
+++ b/hermes_cli/web_server.py
@@ -241,13 +241,7 @@ async def _lifespan(app: "FastAPI"):
# one that would race the same credential (#77276). Runs
# unconditionally; protection of a healthy standalone gateway lives
# INSIDE the reaper (registration probed with cleanup_stale=False).
- # The grace covers the one race this call site creates: a gateway launched
- # moments ago by the previous Desktop generation (or a concurrent start)
- # is scan-visible but has not claimed gateway.pid/gateway.lock yet, and the
- # argv sweep would reap it — writing a planned-stop marker that the booting
- # gateway consumes seconds later, exiting 0 with no supervisor to revive it
- # (#122533). Same rule the serve-process reaper applies to an unrecorded
- # sibling (hermes_cli.dashboard_procs._REAP_MIN_AGE_SECONDS).
+ # Startup grace: spare a gateway still claiming gateway.pid/lock (#122533).
try:
from hermes_cli.dashboard_procs import _REAP_MIN_AGE_SECONDS
from hermes_cli.gateway import _reap_unsupervised_gateway_orphans
diff --git a/tests/hermes_cli/test_dashboard_admin_endpoints.py b/tests/hermes_cli/test_dashboard_admin_endpoints.py
index 1c81c8601cf..9efd110f279 100644
--- a/tests/hermes_cli/test_dashboard_admin_endpoints.py
+++ b/tests/hermes_cli/test_dashboard_admin_endpoints.py
@@ -1160,7 +1160,6 @@ def test_desktop_lifespan_reaps_orphans_with_a_startup_grace(monkeypatch):
seen = {}
def _fake_reap(extra_exclude=None, *, min_age_s=0.0):
- seen["extra_exclude"] = extra_exclude
seen["min_age_s"] = min_age_s
return False
@@ -1175,4 +1174,3 @@ def test_desktop_lifespan_reaps_orphans_with_a_startup_grace(monkeypatch):
pass
assert seen["min_age_s"] == _REAP_MIN_AGE_SECONDS
- assert _REAP_MIN_AGE_SECONDS > 0