The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): stop crediting unmanaged serve runtimes with a gateway's restart
chelsealong806878612a62
diff --git a/hermes_cli/update_inventory.py b/hermes_cli/update_inventory.pyindex be03530f7df..be2889189e7 100644--- a/hermes_cli/update_inventory.py+++ b/hermes_cli/update_inventory.py@@ -464,17 +464,31 @@ def match_runtime_outcomes(if r is None:continueoutcome = "unaccounted"+ # The bare "hermes-gateway" unit name is gateway-specific: a+ # serve/dashboard runtime that merely shares the default+ # profile is a different process the gateway restart never+ # touched, and must not borrow its outcome (#100479).if r.profile in relaunched or r.profile in external:outcome = "restarted"elif r.pid is not None and r.pid in killed:outcome = "stopped"elif any(- r.profile in unit or (r.profile == "default" and "hermes-gateway" in unit)+ r.profile in unit+ or (+ r.kind == "gateway"+ and r.profile == "default"+ and "hermes-gateway" in unit+ )for unit in failed_set):outcome = "failed"elif any(- r.profile in svc or (r.profile == "default" and "hermes-gateway" in svc)+ r.profile in svc+ or (+ r.kind == "gateway"+ and r.profile == "default"+ and "hermes-gateway" in svc+ )for svc in restarted_set):outcome = "restarted"diff --git a/tests/hermes_cli/test_restart_plan_reconciliation.py b/tests/hermes_cli/test_restart_plan_reconciliation.pyindex eebe427728c..15d53cf1755 100644--- a/tests/hermes_cli/test_restart_plan_reconciliation.py+++ b/tests/hermes_cli/test_restart_plan_reconciliation.py@@ -159,6 +159,28 @@ def test_external_supervisor_counts_as_restarted():assert outcomes[0]["outcome"] == "restarted"+def test_unmanaged_serve_runtime_under_default_profile_is_unaccounted():+ """#100479: an sshd-spawned `serve --isolated` has no systemd unit and+ shares the default profile with the gateway. A gateway-only restart+ must not be read as covering it — it must trip the tripwire instead."""+ serve_runtime = RuntimeRecord(+ kind="serve",+ profile="default",+ pid=900,+ supervisor="manual-serve",+ restart_via=_restart_mechanism("manual-serve", "default"),+ )+ outcomes = match_runtime_outcomes(+ _plan(_rt("default", 100, supervisor="systemd"), serve_runtime),+ restarted_services=["hermes-gateway"], relaunched_profiles=[],+ externally_supervised_profiles=[], killed_pids=set(), failed_units=[],+ )+ by_pid = {o["pid"]: o["outcome"] for o in outcomes}+ assert by_pid[100] == "restarted"+ assert by_pid[900] == "unaccounted"+ assert report_unaccounted_runtimes(outcomes) is True++def test_mixed_fleet_only_the_missed_one_escalates(capsys):outcomes = match_runtime_outcomes(_plan(