The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): report a corrupt snapshot manifest instead of raising
kshitijk4poor54c23c88f922
diff --git a/hermes_cli/cli_snapshot.py b/hermes_cli/cli_snapshot.pyindex 4f31497a076..ccf7ff1797c 100644--- a/hermes_cli/cli_snapshot.py+++ b/hermes_cli/cli_snapshot.py@@ -47,7 +47,7 @@ def restore_snapshot_command(cli, parts):local_db.close()cli._session_db = Nonerestored = restore_quick_snapshot(snap_id)- except (GatewayClientError, OSError) as exc:+ except (GatewayClientError, OSError, ValueError) as exc: # ValueError: a corrupt manifest.jsonlogger.warning("Snapshot restore failed: %s", exc, exc_info=True)return _pr(f" {_t('snapshot.restore_incomplete', snapshot_id=snap_id)}", f" {exc}")if restored:diff --git a/tests/hermes_cli/test_gateway_snapshot_restore_guards.py b/tests/hermes_cli/test_gateway_snapshot_restore_guards.pyindex 2f4e8cfd433..4b6750864c4 100644--- a/tests/hermes_cli/test_gateway_snapshot_restore_guards.py+++ b/tests/hermes_cli/test_gateway_snapshot_restore_guards.py@@ -30,6 +30,11 @@ def _restore_error(sid):raise OSError("fixture restore refused")+def _corrupt_manifest(sid):+ import json+ return json.loads("{") # what a truncated manifest.json raises out of the restore++@pytest.mark.parametrize("case, restore, supervisor, expected", [("restored", lambda sid: True, "manual", "Restored state from"),("restore-error", _restore_error, "manual", "fixture restore refused"),@@ -38,6 +43,7 @@ def _restore_error(sid):("invalid-id", lambda sid: False, "manual", "Snapshot not found: ../outside"),("other-pid-paused", None, "manual", "Gateway refused the snapshot maintenance handoff"),("satellite-unserve-error", None, "manual", "nothing was restored. Park the profile with `hermes -p state"),+ ("corrupt-manifest", _corrupt_manifest, "manual", "was not fully restored"),# A remote gateway's chat restores this host's snapshot offline, as on main, and stays connected.("remote", lambda sid: True, None, "Restart recommended"),])