Skip to content

The agent that grows with you

fix(plugins): skip foreign-harness manifest dirs during discovery

liuhao1024c60693278ab5
diff --git a/hermes_cli/plugins_discovery.py b/hermes_cli/plugins_discovery.py
index 79c9f691fda..21d5850696f 100644
--- a/hermes_cli/plugins_discovery.py
+++ b/hermes_cli/plugins_discovery.py
@@ -27,6 +27,13 @@ logger = logging.getLogger("hermes_cli.plugins")
ENTRY_POINTS_GROUP = "hermes_agent.plugins"
ENTRY_POINT_CAPABILITIES_GROUP = "hermes_agent.plugin_capabilities"
+# Per-harness manifest directories plugin repos ship for OTHER agent harnesses (e.g. obra/superpowers keeps one
+# plugin.json per harness). Their plugin.json is not an Agent Plugins v1 manifest and can never validate, so
+# parsing it on every discovery pass only spams warnings (#101962).
+_FOREIGN_HARNESS_MANIFEST_DIRS = frozenset({
+ ".claude-plugin", ".codex-plugin", ".cursor-plugin", ".devin-plugin", ".kimi-plugin",
+})
+
def _select_entry_point_group(entry_points: Any, group: str) -> list:
"""Return one metadata entry-point group across supported Python APIs."""
@@ -121,6 +128,9 @@ def scan_directory(
if child.name.startswith("__") and child.name.endswith("__"):
logger.debug("Skipping dunder plugin path %s", child)
continue
+ if child.name in _FOREIGN_HARNESS_MANIFEST_DIRS:
+ logger.debug("Skipping %s (foreign-harness manifest convention)", child)
+ continue
# pathlib.Path.is_dir() swallows OSError, but injected Path-likes
# and test doubles can still raise. Fail closed per child.
try:
diff --git a/tests/hermes_cli/test_plugin_scanner_recursion.py b/tests/hermes_cli/test_plugin_scanner_recursion.py
index 4a0614f9592..8ac876f43d2 100644
--- a/tests/hermes_cli/test_plugin_scanner_recursion.py
+++ b/tests/hermes_cli/test_plugin_scanner_recursion.py
@@ -8,6 +8,7 @@ still opt-in; exclusive kind skipped; unknown kinds → standalone warning).
from __future__ import annotations
+import json
from pathlib import Path
from typing import Any, Dict
@@ -113,6 +114,74 @@ class TestCategoryNamespaceRecursion:
assert non_bundled == []
+# ── Foreign-harness manifest dirs (#101962) ────────────────────────────────
+
+
+class TestForeignHarnessManifestDirs:
+ def test_foreign_harness_dirs_skipped_without_warnings(
+ self, tmp_path, monkeypatch, caplog
+ ):
+ """Multi-harness plugin repos (e.g. obra/superpowers) ship one
+ ``plugin.json`` per OTHER agent harness inside ``.claude-plugin/``,
+ ``.codex-plugin/`` etc. Those manifests can never satisfy the Agent
+ Plugins v1 schema, so scanning them warned on every discovery pass.
+ They must be skipped silently; the plugin's real Hermes manifest
+ (``.hermes-plugin/plugin.yaml``) is still discovered."""
+ import os
+ hermes_home = Path(os.environ["HERMES_HOME"]) # set by hermetic conftest fixture
+ sp = hermes_home / "plugins" / "superpowers"
+ (sp / ".hermes-plugin").mkdir(parents=True)
+ (sp / ".hermes-plugin" / "plugin.yaml").write_text(
+ yaml.dump(
+ {
+ "name": "superpowers",
+ "version": "6.3.0",
+ "description": "multi-harness plugin",
+ }
+ )
+ )
+ for harness in (
+ ".claude-plugin",
+ ".codex-plugin",
+ ".cursor-plugin",
+ ".devin-plugin",
+ ".kimi-plugin",
+ ):
+ harness_dir = sp / harness
+ harness_dir.mkdir(parents=True)
+ (harness_dir / "plugin.json").write_text(
+ json.dumps({"name": "superpowers", "version": "6.3.0"})
+ )
+
+ with caplog.at_level("WARNING", logger="hermes_cli.plugins"):
+ mgr = PluginManager()
+ mgr.discover_and_load()
+
+ assert "superpowers/.hermes-plugin" in mgr._plugins
+ parse_warnings = [
+ r for r in caplog.records if "Failed to parse" in r.getMessage()
+ ]
+ assert parse_warnings == []
+
+ def test_broken_portable_plugin_still_warns(self, tmp_path, monkeypatch, caplog):
+ """A genuinely broken portable plugin.json (not a foreign-harness
+ convention directory) must still surface its parse warning."""
+ import os
+ hermes_home = Path(os.environ["HERMES_HOME"]) # set by hermetic conftest fixture
+ broken = hermes_home / "plugins" / "broken-portable"
+ broken.mkdir(parents=True)
+ (broken / "plugin.json").write_text(json.dumps({"name": "broken"}))
+
+ with caplog.at_level("WARNING", logger="hermes_cli.plugins"):
+ mgr = PluginManager()
+ mgr.discover_and_load()
+
+ assert any(
+ "Failed to parse" in r.getMessage() and "broken-portable" in r.getMessage()
+ for r in caplog.records
+ )
+
+
# ── Kind parsing ───────────────────────────────────────────────────────────