The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): make catalog known_issues informational, not a fail-closed gate
happy5318113a63e8539c
diff --git a/hermes_cli/plugin_catalog.py b/hermes_cli/plugin_catalog.pyindex 2ef213abb26..09057524df4 100644--- a/hermes_cli/plugin_catalog.py+++ b/hermes_cli/plugin_catalog.py@@ -91,7 +91,7 @@ class PluginCatalogEntry:title: str = "" # human name ("NVIDIA App"); empty = derived from ``name``onboarding: bool = False # curated: offered on the desktop onboarding cardcapabilities: CatalogCapabilities = field(default_factory=CatalogCapabilities)- known_issues: List[str] = field(default_factory=list) # #124037: gates install; drivers come from plugin-catalog/*.yaml+ known_issues: List[str] = field(default_factory=list) # #124058: informational; drivers come from plugin-catalog/*.yaml@propertydef install_identifier(self) -> str:@@ -501,4 +501,9 @@ def entry_capability_summary(entry: PluginCatalogEntry) -> str:bits.append(f"Platforms: {', '.join(entry.platforms)}.")if entry.requires_hermes:bits.append(f"Requires Hermes {entry.requires_hermes}.")+ if entry.known_issues:+ # #124058: informational — the catalog documents traps (unsupported+ # install-method/mode combinations); surface them at install prompts+ # without blocking the install.+ bits.append(f"Known issues: {'; '.join(entry.known_issues)}.")return " ".join(bits)diff --git a/hermes_cli/plugins_cmd_install.py b/hermes_cli/plugins_cmd_install.pyindex 7090c7a46fc..e0fd422ef14 100644--- a/hermes_cli/plugins_cmd_install.py+++ b/hermes_cli/plugins_cmd_install.py@@ -421,18 +421,13 @@ def cmd_install(else:console.print("[yellow]Warning:[/yellow] custom (unreviewed) source — not from the Hermes catalog.")if entry is not None and entry.known_issues:- # #124037: catalog entries may document known traps (unsupported- # install-method/mode combinations, retired lazy-install paths, ...).- # A trap the catalog itself documents must not be installed silently —- # non-interactive (non-TTY) runs fail closed; interactive runs require- # explicit confirmation.+ # #124058: informational only — the catalog documents traps+ # (unsupported install-method/mode combinations, retired lazy-install+ # paths, ...) that the user should see before installing. They never+ # block the install; the guard belongs at the mode-selection seam+ # (#122341 / #123771 remove the root cause on main).for issue in entry.known_issues:console.print(f"[yellow]Known issue:[/yellow] {issue}")- console.print(- "[bold red]This catalog entry documents known issues. "- "Install proceeds only with explicit confirmation.[/bold red]")- if not (_pc()._is_tty() and _pc()._ask_yes(" Continue install anyway? [y/N]: ")):- _pc()._fail(console, "[red]Install cancelled — the catalog entry documents known issues.[/red]")if allow_removed:console.print("[bold red]WARNING:[/bold red] [red]--allow-removed set — skipping the catalog kill-list check. "@@ -556,14 +551,12 @@ def dashboard_install_plugin(if entry is None:return {"ok": False, "error": f"'{catalog_name}' is not in the Hermes plugin catalog."}if entry.known_issues:- # #124037: no GUI bypass — an entry whose own catalog documents- # known traps is refused outright on this non-interactive path.- return {- "ok": False,- "error": "refused: this catalog entry documents known issues that cannot be confirmed "- f"in a non-interactive install: {'; '.join(entry.known_issues)}",- "known_issues": list(entry.known_issues),- }+ # #124058: informational only — a documented trap must not install+ # silently, but the gate belongs at the mode-selection seam, not+ # the install entry (teknium1 review on #124037; #122341/#123771+ # remove the root cause). Surface the text; never refuse.+ for issue in entry.known_issues:+ warnings.append(f"Known issue: {issue}")identifier = entry.install_identifierelse:warnings.append("Custom (unreviewed) source — not from the Hermes catalog.")@@ -618,4 +611,5 @@ def dashboard_install_plugin("python_dependencies": deps,"missing_env": [s["name"] for s in _pc()._missing_env_specs(installed_manifest)],"after_install_path": str(ap) if ap.exists() else None, "enabled": enable, **activated,+ "known_issues": list(entry.known_issues) if entry else [],}diff --git a/scripts/validate_plugin_catalog.py b/scripts/validate_plugin_catalog.pyindex d1bdbda5d91..c5da7f113b2 100755--- a/scripts/validate_plugin_catalog.py+++ b/scripts/validate_plugin_catalog.py@@ -72,6 +72,7 @@ KNOWN_KEYS = {"capabilities","title","onboarding",+ "known_issues",}# Cosmetic labels attached to the pin. ``version`` is never parsed; ``image`` and ``screenshots``# may only point at GitHub so the Desktop catalog browser and the docs site never fetch fromdiff --git a/tests/hermes_cli/test_124037_catalog_known_issues_gate.py b/tests/hermes_cli/test_124037_catalog_known_issues_gate.pyindex 8fb2dcbacab..4aa4fd76e61 100644--- a/tests/hermes_cli/test_124037_catalog_known_issues_gate.py+++ b/tests/hermes_cli/test_124037_catalog_known_issues_gate.py@@ -1,28 +1,22 @@-"""#124037: plugin catalog entries that document known traps must gate installs.--The catalog (``plugin-catalog/hindsight.yaml``) already documents in prose-that ``local_embedded`` mode is unsupported on PM-managed Hermes with the-current pin (it calls the retired lazy-install path for ``hindsight-all`` and-loops update takeovers), yet ``hermes plugins install`` and the dashboard-install path accept the entry with no gate.--This adds a machine-readable ``known_issues`` list to catalog entries and a-fail-closed gate: non-interactive installs refuse; interactive installs print-the issues and require explicit confirmation.+"""#124058: catalog ``known_issues`` is an informational field.++The catalog (``plugin-catalog/hindsight.yaml``) documents in prose that+``local_embedded`` mode is unsupported on PM-managed Hermes with the current+pin (it calls the retired lazy-install path for ``hindsight-all`` and loops+update takeovers). The field is machine-readable but informational: it must+parse and round-trip, and the install summaries must surface the text — it+must never block an install (the guard belongs at the mode-selection seam;+see teknium1's review on #124037 and #122341 / #123771)."""-import pytestfrom pathlib import Path-# Local-env workaround (#124037 tests): the checkout's venv python3 is a-# symlink into <home>/hermes-agent/.hermes-runtime/..., so stdlib zoneinfo's-# first import (sysconfig._safe_realpath(sys.executable)) trips the-# real-home IO guard after it installs. Importing here — during collection,-# before any autouse guard fixture — caches the module. CI pythons are not-# symlinked into the home, so this is a no-op there.-import zoneinfo # noqa: F401 (cached for the moa-loop fixture)--from hermes_cli.plugin_catalog import PluginCatalogEntry, entry_from_mapping, load_catalog+from hermes_cli.plugin_catalog import (+ PluginCatalogEntry,+ entry_capability_summary,+ entry_from_mapping,+ load_catalog,+)def _entry(**overrides):@@ -37,150 +31,61 @@ def _entry(**overrides):return entry_from_mapping(base, "test-entry")-# ── catalog parsing ──────────────────────────────────────────────────────────---class TestCatalogParsing:- def test_entry_from_mapping_parses_known_issues(self):- entry = _entry(known_issues=["First issue.", "Second issue."])- assert entry is not None- assert entry.known_issues == ["First issue.", "Second issue."]-- def test_entry_from_mapping_missing_known_issues_defaults_empty(self):- entry = _entry()- assert entry is not None- assert entry.known_issues == []-- def test_entry_to_dict_round_trips_known_issues(self):- entry = _entry(known_issues=["Trap."])- assert entry.to_dict()["known_issues"] == ["Trap."]-- def test_live_catalog_hindsight_declares_known_issues(self):- entries = load_catalog()- hindsight = next((e for e in entries if e.name == "hindsight"), None)- assert hindsight is not None, "hindsight entry must exist in plugin-catalog/"- assert hindsight.known_issues, (- "hindsight.yaml must declare known_issues for its documented local-embedded trap"- )---# ── cmd_install gate ─────────────────────────────────────────────────────────---class TestCmdInstallGate:- def test_non_tty_refuses_when_entry_has_known_issues(self, monkeypatch):- from hermes_cli.plugins_cmd import cmd_install-- entry = _entry(known_issues=["Local embedded mode is not supported on PM-managed Hermes."])- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.looks_like_catalog_name", lambda _id: True)- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.resolve_catalog_name", lambda _id, _c: entry)- monkeypatch.setattr("hermes_cli.plugins_cmd._is_tty", lambda: False)- installed = []- monkeypatch.setattr(- "hermes_cli.plugins_cmd_catalog.install_catalog_entry",- lambda *a, **k: installed.append(1),- )-- with pytest.raises(SystemExit) as exc_info:- cmd_install("hindsight")- assert exc_info.value.code == 1- assert installed == [], "install must not proceed without explicit confirmation"-- def test_tty_yes_proceeds(self, monkeypatch):- from hermes_cli.plugins_cmd import cmd_install-- entry = _entry(known_issues=["Trap."])- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.looks_like_catalog_name", lambda _id: True)- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.resolve_catalog_name", lambda _id, _c: entry)- monkeypatch.setattr("hermes_cli.plugins_cmd._is_tty", lambda: True)- monkeypatch.setattr("hermes_cli.plugins_cmd._ask_yes", lambda _p, **k: True)- monkeypatch.setattr(- "hermes_cli.plugins_cmd_catalog.install_catalog_entry",- lambda *a, **k: (Path("/tmp/hindsight-target"), {"requires_env": []}, "hindsight"),- )- monkeypatch.setattr("hermes_cli.plugins_cmd._display_after_install", lambda *a, **k: None)- monkeypatch.setattr(- "hermes_cli.plugins_cmd_catalog.raise_if_removed", lambda *a: None)- monkeypatch.setattr("hermes_cli.plugins_cmd._resolve_git_url",- lambda _id: ("https://github.com/vectorize-io/hindsight.git", ""))- monkeypatch.setattr("hermes_cli.plugins_cmd._looks_like_plugin_dir", lambda _t: True)- monkeypatch.setattr("hermes_cli.plugins_cmd_install._prompt_plugin_env_vars", lambda _m, _c: None)- monkeypatch.setattr("hermes_cli.plugins_cmd._python_dependency_summary", lambda *a, **k: None)- monkeypatch.setattr("pm.workspace.enabled_plugin_dirs", lambda: [])-- cmd_install("hindsight", force=True, enable=False, no_deps=True) # confirmed → should not raise-- def test_tty_no_cancels(self, monkeypatch):- from hermes_cli.plugins_cmd import cmd_install-- entry = _entry(known_issues=["Trap."])- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.looks_like_catalog_name", lambda _id: True)- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.resolve_catalog_name", lambda _id, _c: entry)- monkeypatch.setattr("hermes_cli.plugins_cmd._is_tty", lambda: True)- monkeypatch.setattr("hermes_cli.plugins_cmd._ask_yes", lambda _p, **k: False)- installed = []- monkeypatch.setattr(- "hermes_cli.plugins_cmd_catalog.install_catalog_entry", lambda *a, **k: installed.append(1))-- with pytest.raises(SystemExit) as exc_info:- cmd_install("hindsight")- assert exc_info.value.code == 1- assert installed == []-- def test_custom_source_install_is_not_gated(self, monkeypatch):- from hermes_cli.plugins_cmd import cmd_install-- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.looks_like_catalog_name", lambda _id: False)- monkeypatch.setattr("hermes_cli.plugins_cmd._resolve_git_url",- lambda _i: ("https://github.com/x/y.git", None))- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.raise_if_removed", lambda *a: None)- monkeypatch.setattr("hermes_cli.plugins_cmd._install_plugin_core",- lambda *a, **k: (Path("/tmp/target"), {"name": "y"}, "y"))- monkeypatch.setattr("hermes_cli.plugins_cmd._looks_like_plugin_dir", lambda _t: False)- monkeypatch.setattr("hermes_cli.plugins_cmd._is_tty", lambda: False)- monkeypatch.setattr("hermes_cli.plugins_cmd._display_after_install", lambda *a, **k: None)- monkeypatch.setattr("hermes_cli.plugins_cmd_install._prompt_plugin_env_vars", lambda _m, _c: None)- monkeypatch.setattr("pm.workspace.enabled_plugin_dirs", lambda: [])-- home = "/tmp/hermes-test-home-124037-custom"- monkeypatch.setattr("hermes_cli.plugins_cmd._plugins_dir", lambda: None)-- cmd_install("owner/repo") # 不应 raise —— custom source 不过 known-issue 闸---# ── dashboard install gate ───────────────────────────────────────────────────---class TestDashboardInstallGate:- def test_dashboard_refuses_known_issues_entry(self, monkeypatch):- from hermes_cli.plugins_cmd_install import dashboard_install_plugin-- entry = _entry(known_issues=["Trap on managed installs."])- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.get_live_catalog_entry", lambda _n: entry)- installed = []- monkeypatch.setattr(- "hermes_cli.plugins_cmd_catalog.install_catalog_entry", lambda *a, **k: installed.append(1))-- result = dashboard_install_plugin("", force=False, enable=True, catalog_name="hindsight")- assert result["ok"] is False- assert "known issues" in result["error"]- assert installed == [], "dashboard install must refuse known-issues entries"-- def test_dashboard_unaffected_without_known_issues(self, monkeypatch):- from hermes_cli.plugins_cmd_install import dashboard_install_plugin-- entry = _entry()- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.get_live_catalog_entry", lambda _n: entry)- monkeypatch.setattr("hermes_cli.plugins_cmd._resolve_git_url",- lambda _i: ("https://github.com/vectorize-io/hindsight.git", None))- monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.raise_if_removed", lambda *a: None)- monkeypatch.setattr(- "hermes_cli.plugins_cmd_catalog.install_catalog_entry",- lambda *a, **k: (Path("/tmp/hindsight-target"), {"manifest": 1}, "hindsight"))- monkeypatch.setattr("hermes_cli.plugins_cmd._python_dependency_summary", lambda _t, w: None)- monkeypatch.setattr("hermes_cli.plugins_cmd._set_plugin_enabled", lambda *a, **k: None)- monkeypatch.setattr("hermes_cli.plugins_cmd._missing_env_specs", lambda _m: [])- monkeypatch.setattr("hermes_cli.plugins_activation.activate_plugin_now", lambda _n: {})-- result = dashboard_install_plugin("", force=False, enable=False, catalog_name="hindsight")- assert result.get("ok") is True\ No newline at end of file+def test_known_issues_parse_round_trip(tmp_path):+ """known_issues parses from dict and YAML into the entry and to_dict rewrites it identically."""+ entry = _entry(known_issues=["First issue.", "Second issue."])+ assert isinstance(entry, PluginCatalogEntry)+ assert entry.known_issues == ["First issue.", "Second issue."]+ assert entry.to_dict()["known_issues"] == ["First issue.", "Second issue."]++ # YAML → entry → to_dict: structural round-trip on a scratch catalog, so+ # the test never pins the prose of the live hindsight entry.+ catalog_dir = tmp_path / "catalog"+ catalog_dir.mkdir()+ (catalog_dir / "hindsight.yaml").write_text(+ "name: hindsight\n"+ "repo: https://github.com/vectorize-io/hindsight\n"+ "sha: 176f8c2de1369f569c489b831d143b78128b5535\n"+ "description: test entry\n"+ "maintainer: vectorize-io\n"+ "known_issues:\n"+ " - 'Trap one.'\n"+ " - 'Trap two.'\n"+ )+ loaded = load_catalog(catalog_dir)+ assert len(loaded) == 1+ assert loaded[0].known_issues == ["Trap one.", "Trap two."]+ assert loaded[0].to_dict()["known_issues"] == ["Trap one.", "Trap two."]++ # Missing key defaults to an empty list; to_dict always emits the key.+ assert _entry().known_issues == []+ assert _entry().to_dict()["known_issues"] == []+++def test_install_summary_shows_known_issues(monkeypatch):+ """The dashboard install result and capability summary surface the text; install still proceeds."""+ from hermes_cli.plugins_cmd_install import dashboard_install_plugin++ entry = _entry(known_issues=["Local embedded mode is not supported on PM-managed Hermes."])+ monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.get_live_catalog_entry", lambda _n: entry)+ monkeypatch.setattr(+ "hermes_cli.plugins_cmd._resolve_git_url",+ lambda _i: ("https://github.com/vectorize-io/hindsight.git", None))+ monkeypatch.setattr("hermes_cli.plugins_cmd_catalog.raise_if_removed", lambda *a: None)+ monkeypatch.setattr(+ "hermes_cli.plugins_cmd_catalog.install_catalog_entry",+ lambda *a, **k: (Path("/tmp/hindsight-target"), {"manifest": 1}, "hindsight"))+ monkeypatch.setattr("hermes_cli.plugins_cmd._python_dependency_summary", lambda _t, w: None)+ monkeypatch.setattr("hermes_cli.plugins_cmd._set_plugin_enabled", lambda *a, **k: None)+ monkeypatch.setattr("hermes_cli.plugins_cmd._missing_env_specs", lambda _m: [])+ monkeypatch.setattr("hermes_cli.plugins_activation.activate_plugin_now", lambda _n: {})++ result = dashboard_install_plugin("", force=False, enable=False, catalog_name="hindsight")+ assert result["ok"] is True # informational — the install is not refused+ assert result["known_issues"] == ["Local embedded mode is not supported on PM-managed Hermes."]+ assert any(w.startswith("Known issue:") for w in result["warnings"])++ # The catalog capability summary (shown at install/enable prompts and in the UI) carries the text.+ summary = entry_capability_summary(entry)+ assert "Known issues:" in summary+ assert "Local embedded mode is not supported on PM-managed Hermes." in summary