Skip to content

The agent that grows with you

perf(cli): scan platform manifests only for names the cheap checks cannot place

kshitijk4poor16c59d0e7876
diff --git a/hermes_cli/toolset_validation.py b/hermes_cli/toolset_validation.py
index 5c15300045d..2eed2b6a704 100644
--- a/hermes_cli/toolset_validation.py
+++ b/hermes_cli/toolset_validation.py
@@ -54,16 +54,21 @@ def saved_toolset_resolver(config: dict) -> Callable[[str], bool]:
"""``is_valid_toolset`` for a saved ``platform_toolsets`` list, mirroring what
``tools_config._get_platform_tools`` lets through: registered toolsets, any configured MCP server
(a disabled one is inactive, not a typo), ``hermes-<platform>`` plugin-platform bundles and the
- ``no_mcp`` sentinel. Plugin-provided names are consulted last because resolving them may run
- plugin discovery, which a config without such names never needs."""
+ ``no_mcp`` sentinel. The manifest scan and the plugin lookup (which may run plugin discovery)
+ happen only for a name the cheaper checks cannot place."""
from functools import cache
- from hermes_cli.config import _platform_plugin_manifests
from toolsets import validate_toolset
mcp_servers = config.get("mcp_servers")
known = {str(name) for name in mcp_servers} if isinstance(mcp_servers, dict) else set()
- known |= {f"hermes-{name}" for name, _manifest in _platform_plugin_manifests()} | {"no_mcp"}
+ known.add("no_mcp")
+
+ @cache
+ def platform_bundles() -> frozenset:
+ from hermes_cli.config import _platform_plugin_manifests
+
+ return frozenset(f"hermes-{name}" for name, _manifest in _platform_plugin_manifests())
@cache
def plugin_names() -> frozenset:
@@ -71,7 +76,8 @@ def saved_toolset_resolver(config: dict) -> Callable[[str], bool]:
return frozenset(get_plugin_toolset_keys_nowait() | get_portable_mcp_server_names_nowait())
- return lambda name: validate_toolset(name) or name in known or name in plugin_names()
+ return lambda name: (validate_toolset(name) or name in known
+ or name in platform_bundles() or name in plugin_names())
def validate_platform_toolsets(
diff --git a/tests/hermes_cli/test_config_check_diagnostics.py b/tests/hermes_cli/test_config_check_diagnostics.py
index d7cf955a872..c0fca7b681b 100644
--- a/tests/hermes_cli/test_config_check_diagnostics.py
+++ b/tests/hermes_cli/test_config_check_diagnostics.py
@@ -3,6 +3,7 @@
from pathlib import Path
import hermes_cli.config as config_mod
+import hermes_cli.plugins as plugins_mod
from hermes_cli.config import DEFAULT_CONFIG, _cmd_config_check, _warn_invalid_platform_toolsets
@@ -21,6 +22,9 @@ def _check(home: Path, monkeypatch, capsys) -> str:
def test_config_check_and_migrate_agree_on_stale_platform_toolsets(tmp_path, monkeypatch, capsys):
+ # No plugin provides 'ghost'; keep host-installed plugins out of the verdict.
+ monkeypatch.setattr(plugins_mod, "get_plugin_toolset_keys_nowait", set)
+ monkeypatch.setattr(plugins_mod, "get_portable_mcp_server_names_nowait", set)
stale = _write_home(
tmp_path / "stale",
"platform_toolsets:\n"