Skip to content

The agent that grows with you

fix(update): never settle the host obligation on an incomplete run

kshitijk4poor5165b6624f0b
diff --git a/hermes_cli/update_cmd_fleet_verify.py b/hermes_cli/update_cmd_fleet_verify.py
index 86db6cd98da..8917ce57c6b 100644
--- a/hermes_cli/update_cmd_fleet_verify.py
+++ b/hermes_cli/update_cmd_fleet_verify.py
@@ -386,13 +386,14 @@ def _verify_fleet_after_update(restart, *, _pre_update_plan, _windows_gateway_re
if _active is not None:
_active.data["runtime_outcomes"] = _runtime_outcomes
- if not _gateway_owed:
+ if not restart.incomplete:
with _best_effort('Owed-gateway check failed: %s'):
+ # Only on an otherwise-complete run: the check can settle (clear) the host obligation,
+ # which an incomplete run must not do mid-verification. An incomplete run keeps the
+ # obligation armed anyway, and the startup warning names any older owed gateway.
if _named_gateways_still_owed():
# A gateway a previous run could not restart is still not serving HEAD (nothing
# live to restart this time): keep owing it rather than clearing the obligation.
- # Checked even when a serve unit already made the run incomplete, so the follow-up
- # still names the gateway (#141021).
print(" ⚠ A gateway owed a restart by a previous update is still not serving this checkout.")
restart.incomplete = _gateway_owed = True
if getattr(restart, "stopped_unmapped_pids", None):
diff --git a/tests/hermes_cli/test_update_system_dashboard_unit.py b/tests/hermes_cli/test_update_system_dashboard_unit.py
index 2e2d4160f8a..51881d5e5ff 100644
--- a/tests/hermes_cli/test_update_system_dashboard_unit.py
+++ b/tests/hermes_cli/test_update_system_dashboard_unit.py
@@ -195,11 +195,14 @@ def test_dashboard_stopped_and_not_brought_back_is_not_called_still_running(monk
assert "still run pre-update code" not in reason and "hermes gateway restart" not in reason
-def test_previously_owed_gateway_is_still_named_beside_a_failed_dashboard_unit(monkeypatch):
- monkeypatch.setattr(fleet_verify, "_named_gateways_still_owed", lambda: True)
- _refreshed, receipt = _verify(monkeypatch, _restart())
- reason = receipt["followups"][0]["reason"]
- assert "hermes gateway restart" in reason and "hermes-dashboard" in reason
+def test_incomplete_run_never_settles_the_host_obligation_mid_verification(monkeypatch):
+ """The owed-gateway check can clear the host obligation; on a run a failed dashboard unit already
+ made incomplete it must not run (round-2 review): the obligation stays exactly as armed."""
+ calls = []
+ monkeypatch.setattr(fleet_verify, "_named_gateways_still_owed", lambda: calls.append(1) or False)
+ _verify(monkeypatch, _restart())
+ assert calls == []
+ assert update_cmd_fleet._fleet_restart_obligation_armed() is True
def _unit_dashboard_plan():