Skip to content

The agent that grows with you

fix(plugins): one plugin's unexpected error no longer stops update-all

Teknium349e4f7e620e
diff --git a/hermes_cli/plugins_cmd_update_all.py b/hermes_cli/plugins_cmd_update_all.py
index 7bf1eafd667..b1df35b0b36 100644
--- a/hermes_cli/plugins_cmd_update_all.py
+++ b/hermes_cli/plugins_cmd_update_all.py
@@ -10,6 +10,7 @@ Sibling of :mod:`hermes_cli.plugins_cmd` (the facade is imported late, never at
from __future__ import annotations
+import logging
import sys
from dataclasses import dataclass, field
from typing import Any
@@ -18,6 +19,7 @@ from typing import Any
# re-pins to the reviewed sha, a tracked git install pulls. A pip row is a PyPI distribution that
# Hermes never upgrades (#132494), so offering it would promise an update nothing applies.
_UPDATE_KIND = {"catalog": "catalog re-pin", "git": "git pull"}
+logger = logging.getLogger(__name__)
def _pc():
@@ -76,6 +78,10 @@ def _update_one(row, console, *, interactive: bool) -> tuple[str, str]:
except _pc().PluginOperationError as exc:
console.print(f"[red]Error:[/red] {escape(str(exc))}")
return "failed", _short(str(exc))
+ except Exception as exc: # per-plugin batch boundary: a feed timeout or crash must not stop the rest
+ logger.warning("update of plugin %s failed", row.name, exc_info=True)
+ console.print(f"[red]Error:[/red] {escape(type(exc).__name__)}: {escape(str(exc))}")
+ return "failed", _short(f"{type(exc).__name__}: {exc}")
if not moved:
return "current", ""
return "updated", f"{(row.current or '')[:8]}..{(row.latest or '')[:8]}"
diff --git a/tests/hermes_cli/test_plugins_update_all.py b/tests/hermes_cli/test_plugins_update_all.py
index dd359ea2ec5..80e3bfafacf 100644
--- a/tests/hermes_cli/test_plugins_update_all.py
+++ b/tests/hermes_cli/test_plugins_update_all.py
@@ -33,7 +33,7 @@ def fleet(monkeypatch, tmp_path):
def fake_update(name, target, console, *, interactive=True):
calls.append((name, interactive))
if name == "cat":
- raise plugins_cmd.PluginOperationError("catalog pin refused")
+ raise TimeoutError("catalog pin refused") # not a typed refusal: the batch must still go on
return True
monkeypatch.setenv("HERMES_HOME", str(tmp_path))