The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): note pre_restart_pids' per-PID data model gap, pin the matching-start_time path
chelsealong2812d6121ba5
diff --git a/hermes_cli/update_receipt.py b/hermes_cli/update_receipt.pyindex 9a0f85f602b..7f5a1dd9671 100644--- a/hermes_cli/update_receipt.py+++ b/hermes_cli/update_receipt.py@@ -391,6 +391,12 @@ def collect_fleet_versions(# stop, startup failure, stale record from a long-dead# gateway) keeps the historical no-row behavior so the# feature's rollout can't false-positive.+ #+ # ``_pre_restart`` is a bare set of PIDs, not (pid, start_time)+ # pairs, so a recycled PID from gateway A landing in B's stale+ # record could still mislabel B as down if A's PID happened to+ # be in the pre-restart snapshot — inherent to the snapshot's+ # data model, not something this guard can fix on its own.gw_state = record.get("gateway_state")if (pid in _pre_restartdiff --git a/tests/hermes_cli/test_fleet_matrix_down_state.py b/tests/hermes_cli/test_fleet_matrix_down_state.pyindex 8c403e46bf6..0519e30c259 100644--- a/tests/hermes_cli/test_fleet_matrix_down_state.py+++ b/tests/hermes_cli/test_fleet_matrix_down_state.py@@ -95,6 +95,27 @@ def test_recycled_pid_is_not_reported_stale(monkeypatch, tmp_path):assert fleet[0]["state"] == "down"+def test_matching_start_time_is_still_live(monkeypatch, tmp_path):+ """A record whose start_time matches the live process is not recycled."""+ from gateway.status import _get_process_start_time++ pid = os.getpid()+ _setup(+ monkeypatch,+ tmp_path,+ {+ "pid": pid,+ "start_time": _get_process_start_time(pid),+ "gateway_state": "running",+ "code_sha": "HEADSHA",+ "kind": "hermes-gateway",+ },+ )+ fleet = ur.collect_fleet_versions(pre_restart_pids=[pid])+ assert len(fleet) == 1+ assert fleet[0]["state"] == "current"++def test_live_gateway_rows_unchanged(monkeypatch, tmp_path):"""The live-pid path is untouched by the down-state addition."""_setup(