The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): stop seeding and flagging plugin-platform toolset rows (teams, google_chat)
Teknium06662ba995ac
diff --git a/cli-config.yaml.example b/cli-config.yaml.exampleindex 4b8419b619a..a6527d9d01a 100644--- a/cli-config.yaml.example+++ b/cli-config.yaml.example@@ -1457,8 +1457,7 @@ platform_toolsets:signal: [hermes-signal]qqbot: [hermes-qqbot]yuanbao: [hermes-yuanbao]- teams: [hermes-teams]- google_chat: [hermes-google_chat]+ # Plugin platforms (teams, google_chat, ...) need no row: they default to hermes-<platform> once loaded.# =============================================================================# Gateway Platform Settingsdiff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.pyindex 178c07b05fd..2f5f07595cc 100644--- a/hermes_cli/tools_config.py+++ b/hermes_cli/tools_config.py@@ -755,12 +755,22 @@ 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`` → no- native tools), at session tool resolution rather than only in update/doctor."""+ native 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.+ The own-bundle check runs first because this is reached on every schema build (the kanban gate+ resolves every saved platform row), and the resolver's manifest scan is filesystem I/O."""from hermes_cli.toolset_validation import saved_toolset_resolver+ if 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:+ returnis_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:+ if not any(is_valid_toolset(t) for t in named):_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.pyindex f7ad5e007cf..f0048111f08 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 byits ``mcp-<server>`` toolset name or bare alias (neither is registered before MCP discovery; adisabled server is inactive, not a typo), ``hermes-<platform>`` plugin-platform bundles and the- ``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."""+ ``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 cachefrom toolsets import validate_toolset@@ -68,14 +68,8 @@ def saved_toolset_resolver(config: dict) -> Callable[[str], bool]:@cachedef platform_bundles() -> frozenset:from hermes_cli.config import _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)+ return frozenset(f"hermes-{name}" for name, _manifest in _platform_plugin_manifests())@cachedef plugin_names() -> frozenset:@@ -129,7 +123,10 @@ def validate_platform_toolsets(for name in toolsets:if not isinstance(name, str) or not name:continue- if not is_valid_toolset(name):+ # 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: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.pynew file mode 100644index 00000000000..f356ec93ac6--- /dev/null+++ b/tests/hermes_cli/test_plugin_platform_toolset_rows.py@@ -0,0 +1,86 @@+"""``platform_toolsets`` rows for plugin platforms (teams, google_chat, homeassistant) that the installers+seeded from cli-config.yaml.example: inert until the plugin loads, so they must not log the #38798+"no valid toolsets" error, while a genuinely invalid row still does."""++import json+import logging++import pytest++# The rows cli-config.yaml.example seeded into every install (install.sh, install.ps1, the Docker hook,+# `hermes doctor --fix`), plus Home Assistant's from before it left core. None of these platforms is set up.+_SEEDED_ROWS = {+ "cli": ["hermes-cli"],+ "telegram": ["hermes-telegram"],+ "homeassistant": ["hermes-homeassistant"],+ "teams": ["hermes-teams"],+ "google_chat": ["hermes-google_chat"],+}+++def _write_config(home, platform_toolsets):+ # JSON is valid YAML, and the CI test env has no pyyaml.+ (home / "config.yaml").write_text(json.dumps({"platform_toolsets": platform_toolsets}), encoding="utf-8")+++def _toolset_errors(caplog):+ return [r.getMessage() for r in caplog.records if "#38798" in r.getMessage()]++[email protected](autouse=True)+def _fresh_warning_latch():+ import hermes_cli.tools_config as tc++ tc._warned_invalid_platform_toolsets.clear()+ yield+ tc._warned_invalid_platform_toolsets.clear()+++def test_seeded_plugin_platform_rows_log_nothing_on_schema_build(caplog):+ """The kanban gate runs on every schema build and skills scan and resolves every saved row."""+ from hermes_constants import get_hermes_home+ from tools.kanban_tools import _profile_has_kanban_toolset++ _write_config(get_hermes_home(), _SEEDED_ROWS)+ with caplog.at_level(logging.WARNING, logger="hermes_cli.tools_config"):+ _profile_has_kanban_toolset()++ assert _toolset_errors(caplog) == []+++def test_invalid_plugin_platform_row_still_warns(caplog):+ from hermes_constants import get_hermes_home+ from tools.kanban_tools import _profile_has_kanban_toolset++ _write_config(get_hermes_home(), {"cli": ["hermes-cli"], "teams": ["hermes-tems"]})+ with caplog.at_level(logging.WARNING, logger="hermes_cli.tools_config"):+ _profile_has_kanban_toolset()++ errors = _toolset_errors(caplog)+ assert len(errors) == 1 and "'teams'" in errors[0] and "hermes-tems" in errors[0], errors+++def test_seeded_config_rows_need_no_plugin():+ """A config.yaml seeded the way the installers seed it names only toolsets that resolve without any+ plugin loaded: a plugin platform falls back to ``hermes-<platform>`` on its own."""+ from hermes_cli.config import read_raw_config, seed_config_file+ from hermes_constants import get_hermes_home+ from toolsets import validate_toolset++ assert seed_config_file(get_hermes_home() / "config.yaml") is True+ rows = read_raw_config().get("platform_toolsets") or {}+ unresolved = {p: names for p, names in rows.items() if not all(validate_toolset(n) for n in names)}+ assert unresolved == {}+++def test_config_check_accepts_seeded_rows_of_uninstalled_plugin_platforms():+ """`hermes config check` and the update-time check judge the same rows the same way: Home Assistant's+ catalog plugin is not installed here, and its seeded row is inert, not an unknown toolset."""+ from hermes_cli.toolset_validation import saved_toolset_resolver, validate_platform_toolsets++ config = {"platform_toolsets": _SEEDED_ROWS}+ assert validate_platform_toolsets(_SEEDED_ROWS, saved_toolset_resolver(config)) == []++ 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