The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): a supervised serve backend no longer pins the fleet-restart warning on forever
teknium1e9197afd6ddb
diff --git a/hermes_cli/update_abort_recovery.py b/hermes_cli/update_abort_recovery.pyindex 26acc1f6c04..2a6b87b4dd1 100644--- a/hermes_cli/update_abort_recovery.py+++ b/hermes_cli/update_abort_recovery.py@@ -236,9 +236,11 @@ def _warn_stale_serve_runtimes(rows) -> None:def _owed_stale_serve_rows(rows) -> list[dict]:"""Survivors the updater itself owes a restart for. A Desktop-supervised serve is excluded: the- recovery pass is forbidden to restart it (it hosts the live Desktop chats), so counting it keeps- ``fleet_restart_pending`` armed forever with nothing that could ever discharge it. It is still- named by :func:`_warn_stale_serve_runtimes` and recorded in the receipt. See #111494."""+ recovery pass is forbidden to restart it (it hosts the live Desktop chats), so counting it would+ end every update with the Desktop open as incomplete/exit 1. It is still named by+ :func:`_warn_stale_serve_runtimes` and recorded in the receipt. See #111494. (The+ fleet-restart-pending marker draws the same boundary for its own inventory, so a supervisor-owned+ serve row no longer keeps that warning armed either.)"""return [row for row in (rows or []) if row.get("supervisor") != "desktop"]diff --git a/hermes_cli/update_cmd_fleet.py b/hermes_cli/update_cmd_fleet.pyindex 1e1de13c2dd..92306a44390 100644--- a/hermes_cli/update_cmd_fleet.py+++ b/hermes_cli/update_cmd_fleet.py@@ -154,6 +154,9 @@ def _receipt_reports_stale_runtime(receipt: dict, expected_sha: str | None = Non_SUPERVISED_SERVE_BACKENDS = frozenset({"manual-serve", "desktop", "systemd", "launchd", "windows-service", "service"})+# Backends whose supervisor restarts the process without any updater bookkeeping. ``manual-serve``+# is excluded: it owes a durable handoff (``defer_manual_serve``) before it stops counting.+_SUPERVISOR_OWNED_SERVE_BACKENDS = _SUPERVISED_SERVE_BACKENDS - {"manual-serve"}def _receipt_owed_gateways(receipt: dict, pending_manual: list[dict]) -> set[tuple[str, str]] | None:@@ -240,6 +243,13 @@ def _marker_only_restart_obsolete() -> bool:current on the checkout — there is no recorded owed set, so the fleet running the code on diskis the whole of the evidence the marker's warning can be about, even after HEAD moved past``expected_sha`` by an out-of-band pull.++ A serve/dashboard row whose supervisor owns the restart (Desktop backend, systemd/launchd+ unit, Windows service) is outside the gateway matrix's evidence, not evidence against it —+ the same boundary ``_receipt_owed_gateways`` draws for receipts (#115090) and the restart+ phase draws for the Desktop backend (#111494). Counting it made the warning permanently+ undischargeable on every host that runs a dashboard. A manual-serve row still needs its+ durable handoff (``defer_manual_serve``), and an unclassified backend stays fail-closed."""from hermes_cli.update_serve_obligations import defer_manual_serve@@ -263,7 +273,10 @@ def _marker_only_restart_obsolete() -> bool:for runtime in runtimes:if not isinstance(runtime, dict):return False- if runtime.get("kind") in ("serve", "dashboard") and defer_manual_serve(runtime):+ if runtime.get("kind") in ("serve", "dashboard") and (+ defer_manual_serve(runtime)+ or runtime.get("supervisor") in _SUPERVISOR_OWNED_SERVE_BACKENDS+ ):continueif runtime.get("kind") != "gateway":return Falsediff --git a/tests/hermes_cli/test_update_fleet_restart_pending.py b/tests/hermes_cli/test_update_fleet_restart_pending.pyindex cc6959048e8..567218fedaa 100644--- a/tests/hermes_cli/test_update_fleet_restart_pending.py+++ b/tests/hermes_cli/test_update_fleet_restart_pending.py@@ -792,6 +792,58 @@ def test_startup_warn_discharged_when_multiplexer_covers_owed_profiles(monkeypatassert update_cmd._pending_fleet_restart_needed() is False[email protected]("supervisor", ["desktop", "systemd", "launchd", "windows-service", "service"])+def test_startup_warn_discharged_when_inventory_holds_supervised_serve(monkeypatch, capsys, supervisor):+ """A supervised serve/dashboard row in the marker's inventory is its supervisor's to+ restart (#115090 for receipts, #111494 for the Desktop backend) — it must not make the+ gateway warning permanently undischargeable once every gateway serves the pulled SHA."""+ disk_sha = "e" * 40+ update_cmd._write_fleet_restart_pending_marker(+ expected_sha=disk_sha,+ runtimes=[+ {"kind": "gateway", "profile": "default", "pid": 42, "supervisor": "systemd"},+ {"kind": "serve", "profile": "default", "pid": 6161, "supervisor": supervisor,+ "detail": {"create_time": 1000.0}},+ ],+ )+ _patch_marker_sha(monkeypatch, disk_sha)+ monkeypatch.setattr(+ "hermes_cli.update_receipt.collect_fleet_versions",+ lambda **kwargs: [+ {"profile": "default", "pid": 42, "code_sha": disk_sha, "code_version": "0.21.0", "state": "current"}+ ],+ )++ update_cmd._warn_pending_fleet_restart_on_startup()++ assert capsys.readouterr().err == ""+ assert not update_cmd._fleet_restart_pending_marker_path().exists()+++def test_startup_warn_kept_when_inventory_holds_unclassified_serve(monkeypatch, capsys):+ """Fail-closed stays: a serve row no supervisor owns is still unsettled evidence."""+ disk_sha = "e" * 40+ update_cmd._write_fleet_restart_pending_marker(+ expected_sha=disk_sha,+ runtimes=[+ {"kind": "gateway", "profile": "default", "pid": 42, "supervisor": "systemd"},+ {"kind": "serve", "profile": "default", "pid": 6161, "supervisor": "manual"},+ ],+ )+ _patch_marker_sha(monkeypatch, disk_sha)+ monkeypatch.setattr(+ "hermes_cli.update_receipt.collect_fleet_versions",+ lambda **kwargs: [+ {"profile": "default", "pid": 42, "code_sha": disk_sha, "code_version": "0.21.0", "state": "current"}+ ],+ )++ update_cmd._warn_pending_fleet_restart_on_startup()++ assert "did not restart running gateways" in capsys.readouterr().err+ assert update_cmd._fleet_restart_pending_marker_path().exists()++@pytest.mark.parametrize("disk_sha, fleet",[