Skip to content

The agent that grows with you

fix(tools): recognize unloaded platform plugins

Kuxin3935c04c0fae
diff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.py
index e1acba78576..178c07b05fd 100644
--- a/hermes_cli/tools_config.py
+++ b/hermes_cli/tools_config.py
@@ -642,7 +642,7 @@ def _get_platform_tools(config: dict, platform: str, *, include_default_mcp_serv
enabled_toolsets = _prune_toolsets_stripped_by_disabled(enabled_toolsets, disabled_names)
if explicitly_configured and toolset_names:
- _warn_all_invalid_platform_toolsets(platform, toolset_names)
+ _warn_all_invalid_platform_toolsets(platform, toolset_names, config)
return enabled_toolsets
@@ -753,13 +753,14 @@ def _merge_mcp_servers(
return result | explicit_mcp_servers
-def _warn_all_invalid_platform_toolsets(platform: str, explicit: list) -> None:
+def _warn_all_invalid_platform_toolsets(platform: str, explicit: list, config: dict) -> None:
"""Warn once when an explicit platform list has only invalid names (``hermes`` for ``hermes-cli`` → no
native tools), at session tool resolution rather than only in update/doctor."""
- from toolsets import validate_toolset
+ from hermes_cli.toolset_validation import saved_toolset_resolver
named = [str(t) for t in explicit if isinstance(t, str) and t]
- if named and not any(validate_toolset(t) for t in named) and platform not in _warned_invalid_platform_toolsets:
+ is_valid_toolset = saved_toolset_resolver(config)
+ if named and not any(is_valid_toolset(t) for t in named) and platform not in _warned_invalid_platform_toolsets:
_warned_invalid_platform_toolsets.add(platform)
logger.warning(
"platform '%s' has no valid toolsets configured (unknown "
diff --git a/hermes_cli/toolset_validation.py b/hermes_cli/toolset_validation.py
index 822caddb6b0..f7ad5e007cf 100644
--- a/hermes_cli/toolset_validation.py
+++ b/hermes_cli/toolset_validation.py
@@ -55,8 +55,8 @@ def saved_toolset_resolver(config: dict) -> Callable[[str], bool]:
``tools_config._get_platform_tools`` lets through: registered toolsets, any configured MCP server by
its ``mcp-<server>`` toolset name or bare alias (neither is registered before MCP discovery; a
disabled server is inactive, not a typo), ``hermes-<platform>`` plugin-platform bundles and the
- ``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."""
+ ``no_mcp`` sentinel. The manifest/catalog scans and the plugin lookup (which may run plugin
+ discovery) happen only for a name the cheaper checks cannot place."""
from functools import cache
from toolsets import validate_toolset
@@ -68,8 +68,14 @@ def saved_toolset_resolver(config: dict) -> Callable[[str], bool]:
@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())
+ from hermes_cli.plugin_catalog import CATALOG_TIERS, load_catalog
+
+ manifest_names = {name for name, _manifest in _platform_plugin_manifests()}
+ catalog_names = {
+ entry.name for entry in load_catalog()
+ if entry.category == "platform" and entry.tier in CATALOG_TIERS
+ }
+ return frozenset(f"hermes-{name}" for name in manifest_names | catalog_names)
@cache
def plugin_names() -> frozenset:
diff --git a/tests/hermes_cli/test_tools_config.py b/tests/hermes_cli/test_tools_config.py
index 9d791547a65..60ea358cf18 100644
--- a/tests/hermes_cli/test_tools_config.py
+++ b/tests/hermes_cli/test_tools_config.py
@@ -55,6 +55,20 @@ def test_valid_platform_toolsets_no_runtime_warning(caplog):
assert not any("#38798" in r.getMessage() for r in caplog.records)
[email protected]("platform", ["teams", "google_chat", "homeassistant"])
+def test_unloaded_plugin_platform_toolset_no_runtime_warning(caplog, platform):
+ """Bundled and catalog plugin-platform entries are valid before plugin loading."""
+ import hermes_cli.tools_config as _tc
+
+ _tc._warned_invalid_platform_toolsets.discard(platform)
+ config = {"platform_toolsets": {platform: [f"hermes-{platform}"]}}
+
+ with caplog.at_level(logging.WARNING, logger="hermes_cli.tools_config"):
+ _get_platform_tools(config, platform)
+
+ assert not any("#38798" in r.getMessage() for r in caplog.records)
+
+
def test_partially_valid_platform_toolsets_no_runtime_warning(caplog):
"""When at least one configured toolset is valid, tools still resolve, so
the runtime zero-tools warning must not fire (the migration-time check still