diff --git a/hermes_cli/update_cmd_windows.py b/hermes_cli/update_cmd_windows.py index 1f8a7d82fd..1a85a6d80c 100644 --- a/hermes_cli/update_cmd_windows.py +++ b/hermes_cli/update_cmd_windows.py @@ -976,8 +976,12 @@ def _cold_start_attested_profiles(token: dict) -> None: gateway_windows._write_start_attestation(ready_pids, f"cold-start after update (profile {name})", home=home) print(f"\n✓ Gateway profile {name} started via cold-start after update (PID: {ready_pids[0]})") token["cold_start_profiles"].pop(name, None) - if not token["cold_start_profiles"]: - token.pop("cold_start_profiles", None) + if token["cold_start_profiles"]: + # Surface the miss like the active-profile cold-start does: the merged outcome marks the update + # incomplete instead of reporting success with a profile still down. + raise RuntimeError("Windows gateway cold-start was not verified for profile(s): " + + ", ".join(sorted(token["cold_start_profiles"]))) + token.pop("cold_start_profiles", None) def _cold_start_windows_gateway_after_update(token: dict | None = None) -> bool: @@ -1219,16 +1223,18 @@ def _resume_windows_gateways_after_update(token: dict | None) -> None: _cold_start_attested_profiles(token) token["resume_needed"] = False return - _cold_start_attested_profiles(token) relaunched, unmapped_relaunched = _relaunch_paused_gateways(token, profiles, unmapped) if relaunched or unmapped_relaunched: _verify_relaunched_gateways_alive(token, profiles, unmapped) - token["resume_needed"] = False if relaunched: print(f"\n ✓ Restarting Windows gateway profile(s): {', '.join(relaunched)}") if unmapped_relaunched: lead = "" if relaunched else "\n" print(f"{lead} ✓ Restarting {unmapped_relaunched} unmapped Windows gateway process(es)") + # After the paused profiles are back: a dead-attested sibling that fails to cold-start must not + # keep the profiles that WERE running from being relaunched. + _cold_start_attested_profiles(token) + token["resume_needed"] = False def _resume_windows_gateways_and_merge_outcome(outcome, _windows_gateway_resume, gateway_mode: bool): diff --git a/tests/hermes_cli/test_windows_gateway_cold_start_desktop_lifecycle.py b/tests/hermes_cli/test_windows_gateway_cold_start_desktop_lifecycle.py index 14312d1ef3..fd3c29d595 100644 --- a/tests/hermes_cli/test_windows_gateway_cold_start_desktop_lifecycle.py +++ b/tests/hermes_cli/test_windows_gateway_cold_start_desktop_lifecycle.py @@ -298,21 +298,6 @@ def test_dead_attested_default_is_cold_started_beside_running_beta(monkeypatch, assert "Gateway profile default started via cold-start after update (PID: 4242)" in out -def test_no_attested_profile_leaves_the_pause_token_unchanged(monkeypatch, tmp_path): - _running_beta_pause_fixture(monkeypatch, tmp_path) - - token = update_cmd._pause_windows_gateways_for_update() - - assert "cold_start_profiles" not in token - assert token["profiles"] == {"beta": 777} - spawned = [] - monkeypatch.setattr(gateway_windows, "_spawn_detached", lambda **k: spawned.append(k) or 4242) - monkeypatch.setattr(gateway_windows, "_write_start_attestation", lambda *a, **k: None) - update_cmd._resume_windows_gateways_after_update(token) - assert spawned == [] - assert token["relaunched_profiles"] == ["beta"] - - def test_every_dead_attested_profile_is_cold_started_when_nothing_runs(monkeypatch, tmp_path): """Nothing running, active profile exited cleanly (plan → None), ``beta`` dead-attested: beta still gets a token and a spawn. And when BOTH owe a spawn, the fleet-wide active cold-start runs FIRST —