The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(doctor): report a plugin listed in both plugins.enabled and plugins.disabled
Tekniumadb90501a6ae
diff --git a/hermes_cli/doctor.py b/hermes_cli/doctor.pyindex 43d3478c1fb..a50dbd0d4f8 100644--- a/hermes_cli/doctor.py+++ b/hermes_cli/doctor.py@@ -55,6 +55,7 @@ from hermes_cli.doctor_state import (_check_directory_structure,_check_memory_provider,_check_plugins_disabled_by_update,+ _check_plugins_in_both_lists,_check_profiles,_check_skills_hub,_check_state_db,@@ -126,6 +127,7 @@ DOCTOR_CHECKS = ((None, _check_npm_audit), ('API Connectivity', _check_api_connectivity),('Tool Availability', _check_tool_availability), ('Skills Hub', _check_skills_hub),('Memory Provider', _check_memory_provider), (None, _check_plugins_disabled_by_update),+ (None, _check_plugins_in_both_lists),('NeMo Relay Plugins', _check_relay_plugins),(None, _check_profiles),)diff --git a/hermes_cli/doctor_state.py b/hermes_cli/doctor_state.pyindex b144c6c7e8c..82e7caa55fd 100644--- a/hermes_cli/doctor_state.py+++ b/hermes_cli/doctor_state.py@@ -661,6 +661,25 @@ def _check_plugins_disabled_by_update(should_fix: bool, f: Finding) -> None:f"or run: hermes plugins enable {name}")+@doctor_check("") # best-effort: an unreadable config is the config check's finding+def _check_plugins_in_both_lists(should_fix: bool, f: Finding) -> None:+ """A plugin in both plugins.enabled and plugins.disabled loads nowhere (the disable wins). Older+ updates left plugins in that state when they had to turn them off."""+ from hermes_cli.doctor import HERMES_HOME+ from pm.plugins_state import read_home_selection+ plugins = (read_home_selection(HERMES_HOME) or {}).get("plugins") or {}+ disabled = set(plugins.get("disabled") or ())+ both = [name for name in plugins.get("enabled") or () if name in disabled]+ if not both:+ return+ _section("Plugins Listed as Both Enabled and Disabled")+ for name in both:+ check_warn(f"{name} will not load", "(plugins.disabled wins)")+ f.manual_issues.append(f"Plugin '{name}' is in both plugins.enabled and plugins.disabled, so it is off. "+ f"Turn it on with `hermes plugins enable {name}` (a memory provider also needs "+ f"memory.provider set), or keep it off with `hermes plugins disable {name}`")++@doctor_check("") # best-effort: profile enumeration must never break doctordef _check_profiles(should_fix: bool, f: Finding) -> None:from hermes_constants import PROFILE_ID_REdiff --git a/tests/hermes_cli/test_doctor_plugins_in_both_lists.py b/tests/hermes_cli/test_doctor_plugins_in_both_lists.pynew file mode 100644index 00000000000..a40cf75fa3c--- /dev/null+++ b/tests/hermes_cli/test_doctor_plugins_in_both_lists.py@@ -0,0 +1,21 @@+"""`hermes doctor` reports a plugin listed in both plugins.enabled and plugins.disabled.++Such a plugin loads nowhere because the disable wins. Older updates left plugins in that state when+they had to turn them off (#131216), and nothing else said so.+"""+from __future__ import annotations++from hermes_cli import doctor+from hermes_cli.doctor_state import _check_plugins_in_both_lists+++def test_plugin_in_both_lists_is_an_issue_with_the_command_that_settles_it(tmp_path, monkeypatch):+ home = tmp_path / ".hermes"+ home.mkdir()+ monkeypatch.setattr(doctor, "HERMES_HOME", home)+ (home / "config.yaml").write_text("plugins:\n enabled: [kept, both]\n disabled: [both, parked]\n", encoding="utf-8")++ finding = _check_plugins_in_both_lists(False)++ assert len(finding.manual_issues) == 1+ assert "'both'" in finding.manual_issues[0] and "hermes plugins enable both" in finding.manual_issues[0]