Skip to content

The agent that grows with you

fix(update): an argv value equal to "update" no longer suppresses paused-gateway recovery (review R5405535944-4-raw-update-argv)

Teknium5ba4a05ad257
diff --git a/hermes_cli/main.py b/hermes_cli/main.py
index b9e14dde54f..dcb4ee27f8b 100644
--- a/hermes_cli/main.py
+++ b/hermes_cli/main.py
@@ -3562,8 +3562,10 @@ def main():
_warn_pending_fleet_restart_on_startup()
except Exception:
pass
- from hermes_cli.update_pause_record import recover as _recover_paused_gateways
- _recover_paused_gateways() # a killed `hermes update` left gateways paused (Windows)
+ from hermes_cli.update_pause_record import recover as _recover_paused_gateways
+ # Unconditional: recover() itself skips the PARSED `update`/`gateway run` commands; a raw argv
+ # value equal to "update" (`--resume update`) is no reason to strand paused gateways.
+ _recover_paused_gateways() # a killed `hermes update` left gateways paused (Windows)
if _first_positional_argv() != "update":
from hermes_cli.boot_bootstrap import maybe_run_boot_bootstrap
diff --git a/tests/hermes_cli/test_update_pause_record.py b/tests/hermes_cli/test_update_pause_record.py
index 4df57760cbf..4a31f40b38f 100644
--- a/tests/hermes_cli/test_update_pause_record.py
+++ b/tests/hermes_cli/test_update_pause_record.py
@@ -213,6 +213,26 @@ def test_recovery_never_starts_gateways_under_an_update_that_took_the_checkout(t
assert out.splitlines()[:1] == ["resume ['default']"], f"the handed-back set was stranded: {out}"
[email protected]_system_guard_bypass
[email protected]("argv, recovers", [
+ (["--resume", "update", "--version"], True), # "update" is a session name here, not the command
+ (["update", "--help"], False), # the update adopts the set itself
+])
+def test_startup_recovery_follows_the_parsed_command_not_raw_argv(tmp_path, argv, recovers):
+ _orphan(tmp_path, {}) # nothing to start: a recovering launch just retires it
+ cli = _child("""
+ import sys
+ from hermes_cli.main import main
+ sys.argv = ["hermes", *sys.argv[1:]]
+ try:
+ main()
+ except SystemExit:
+ pass
+ """, *argv, env={"HERMES_HOME": str(tmp_path), "HOME": str(tmp_path / "home")})
+ out, _ = cli.communicate(timeout=120)
+ assert (_record_files(tmp_path) == []) is recovers, out
+
+
_HOLDER = """
import subprocess, sys, time
from hermes_cli.update_lock import UpdateLock