The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): a damaged install-metadata file no longer stops the scheduled check
alt-glitch300a3977ed7a
diff --git a/hermes_cli/plugins_cadence.py b/hermes_cli/plugins_cadence.pyindex 9c2d2b21de8..260d7806d7a 100644--- a/hermes_cli/plugins_cadence.py+++ b/hermes_cli/plugins_cadence.py@@ -200,8 +200,9 @@ def _run_check_locked() -> list:check_ok = Truewarning = ""- checked_installs = snapshot_installs(plugins_dir)+ checked_installs: dict = {}try:+ checked_installs = snapshot_installs(plugins_dir)results = run_checks_fn(plugins_dir)except Exception:warning = "plugin update check failed"diff --git a/hermes_cli/plugins_provenance.py b/hermes_cli/plugins_provenance.pyindex c753fe00b0e..200ff0ebcc2 100644--- a/hermes_cli/plugins_provenance.py+++ b/hermes_cli/plugins_provenance.py@@ -50,7 +50,7 @@ def read_sidecar_rows(plugins_dir: Path) -> dict:return {}try:data = json.loads(sidecar.read_text(encoding="utf-8-sig"))- except (OSError, json.JSONDecodeError):+ except (OSError, ValueError): # ValueError: bad JSON and bytes that are not UTF-8return {}return data if isinstance(data, dict) else {}diff --git a/tests/hermes_cli/test_plugins_cadence.py b/tests/hermes_cli/test_plugins_cadence.pyindex 94222a5eda3..ca22a120760 100644--- a/tests/hermes_cli/test_plugins_cadence.py+++ b/tests/hermes_cli/test_plugins_cadence.py@@ -73,6 +73,27 @@ def test_run_writes_receipt_and_marker(homed):assert len(calls) == 1+def test_damaged_install_records_do_not_stop_the_scheduled_check(homed):+ """An install-metadata file that is not valid UTF-8 used to raise out of the pre-check snapshot,+ before the check could write its receipt or marker, so every housekeeping tick retried silently.+ A damaged file now reads as no records: the check still runs, records its receipt and backs off."""+ import pm.receipt as receipts++ plugins = homed / "plugins"+ plugins.mkdir()+ (plugins / ".install-metadata.json").write_bytes(b"\xff\xfe{not utf-8")+ calls = []++ def checks(directory):+ calls.append(directory)+ return [_Result("plug", update_available=True)]++ assert cad.run_scheduled_check(run_checks_fn=checks, plugins_dir=plugins)[0].name == "plug"+ assert receipts.latest()["outcome"] == "updates-available"+ assert cad.run_scheduled_check(run_checks_fn=checks, plugins_dir=plugins) is None+ assert len(calls) == 1++@pytest.mark.parametrize('enabled', [False, True])def test_auto_apply_selects_only_updateable_git_and_persists_receipt(homed, enabled, caplog):from pm import receipt