The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): exempt only known platforms' own bundles from the toolset warning
Teknium8e0b489266c2
diff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.pyindex 466d9ff797c..0370a4b453e 100644--- a/hermes_cli/tools_config.py+++ b/hermes_cli/tools_config.py@@ -756,20 +756,19 @@ def _merge_mcp_servers(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`` → nonative tools), at session tool resolution rather than only in update/doctor. Names are judged the way- ``hermes config check`` judges them, and the platform's own ``hermes-<platform>`` bundle always counts:- a plugin platform has no sessions to leave toolless until its plugin loads, and once it loads the- registry resolves the bundle. Installs seeded from cli-config.yaml.example carry such rows (``teams``,- ``google_chat``, and ``homeassistant`` before it left core) whether or not the platform is set up.+ ``hermes config check`` judges them, and a known platform's own ``hermes-<platform>`` bundle always+ counts (``is_known_platform_bundle``): a plugin platform has no sessions to leave toolless until its+ plugin loads, and once it loads the registry resolves the bundle.The own-bundle and registered-toolset checks run first because this is reached on every schema build(the kanban gate resolves every saved platform row) and on bypass launches that must not read profileplugin state; the resolver's manifest scan and plugin lookup run only for names those cannot place."""- from hermes_cli.toolset_validation import saved_toolset_resolver+ from hermes_cli.toolset_validation import is_known_platform_bundle, saved_toolset_resolverfrom toolsets import validate_toolsetif platform in _warned_invalid_platform_toolsets:returnnamed = [str(t) for t in explicit if isinstance(t, str) and t]- if not named or _platform_default_toolset(platform) in named or any(validate_toolset(t) for t in named):+ if not named or any(validate_toolset(t) or is_known_platform_bundle(platform, t) for t in named):returnis_valid_toolset = saved_toolset_resolver(config)if not any(is_valid_toolset(t) for t in named):diff --git a/hermes_cli/toolset_validation.py b/hermes_cli/toolset_validation.pyindex f0048111f08..35833189548 100644--- a/hermes_cli/toolset_validation.py+++ b/hermes_cli/toolset_validation.py@@ -1,6 +1,7 @@"""Validation for the ``platform_toolsets`` config section."""import ast+from functools import cachefrom typing import Callable, List, Optionalfrom hermes_cli.platforms import PLATFORMS@@ -35,6 +36,33 @@ def _platform_default_toolset(platform: object) -> str:return info.default_toolset if info is not None else f"hermes-{platform}"+@cache+def _bundled_platform_names() -> frozenset:+ from hermes_cli.config import _platform_manifest_paths++ return frozenset(name for name, path, _kind, _st in _platform_manifest_paths(source="bundled") if path)+++def is_known_platform_bundle(platform: object, name: str) -> bool:+ """True when ``name`` is the ``hermes-<platform>`` bundle of a platform Hermes knows: builtin, shipped+ under ``plugins/platforms``, a platform that left core for a catalog plugin, or one a loaded plugin+ registered. Installs seeded from cli-config.yaml.example carry such rows for platforms nobody set up+ (teams, google_chat, homeassistant), inert until the plugin loads. A misspelt platform key naming its+ own bundle (``telegarm: [hermes-telegarm]``) is not known, so it is still reported."""+ if name != _platform_default_toolset(platform):+ return False+ key = str(platform)+ if key in PLATFORMS or key in _bundled_platform_names():+ return True+ from hermes_cli.left_core_migration import LEFT_CORE++ if any(feature.platform == key for feature in LEFT_CORE):+ return True+ from gateway.platform_registry import platform_registry++ return platform_registry.is_registered(key)++def _platform_default_is_valid(platform: object, default_toolset: str, is_valid_toolset: Callable[[str], bool],is_allowed_for_platform: Callable[[str, str], bool]) -> bool:@@ -123,10 +151,7 @@ def validate_platform_toolsets(for name in toolsets:if not isinstance(name, str) or not name:continue- # The platform's own bundle is never a typo: a plugin platform has no sessions until its plugin- # loads, and then the registry resolves it. Installs seeded from cli-config.yaml.example carry- # such rows for platforms nobody set up (teams, google_chat, homeassistant before it left core).- if not is_valid_toolset(name) and name != default:+ if not is_valid_toolset(name) and not is_known_platform_bundle(platform, name):hint = f" — did you mean '{default}'?" if default_valid else ""warnings.append(f"platform '{platform}' references unknown toolset '{name}'{hint}")elif is_allowed_for_platform(name, str(platform)):diff --git a/tests/hermes_cli/test_plugin_platform_toolset_rows.py b/tests/hermes_cli/test_plugin_platform_toolset_rows.pyindex f356ec93ac6..1cfce58b4de 100644--- a/tests/hermes_cli/test_plugin_platform_toolset_rows.py+++ b/tests/hermes_cli/test_plugin_platform_toolset_rows.py@@ -84,3 +84,20 @@ def test_config_check_accepts_seeded_rows_of_uninstalled_plugin_platforms():typo = {"platform_toolsets": {"cli": ["hermes-cli"], "homeassistant": ["hermes-homeasistant"]}}warnings = validate_platform_toolsets(typo["platform_toolsets"], saved_toolset_resolver(typo))assert any("unknown toolset 'hermes-homeasistant'" in w for w in warnings), warnings+++def test_misspelt_platform_key_naming_its_own_bundle_still_warns(caplog):+ """Only a KNOWN platform's own bundle is exempt: ``telegarm: [hermes-telegarm]`` is a typo of the key,+ and both the session-time check and `hermes config check` still report it."""+ from hermes_cli.tools_config import _get_platform_tools+ from hermes_cli.toolset_validation import saved_toolset_resolver, validate_platform_toolsets++ rows = {"cli": ["hermes-cli"], "telegarm": ["hermes-telegarm"]}+ config = {"platform_toolsets": rows}+ with caplog.at_level(logging.WARNING, logger="hermes_cli.tools_config"):+ _get_platform_tools(config, "telegarm")++ errors = _toolset_errors(caplog)+ assert len(errors) == 1 and "'telegarm'" in errors[0], errors+ warnings = validate_platform_toolsets(rows, saved_toolset_resolver(config))+ assert any("unknown toolset 'hermes-telegarm'" in w for w in warnings), warnings