The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(doctor): judge plugins in both lists by the loader's own gate
Teknium571d64ef8815
diff --git a/hermes_cli/doctor_state.py b/hermes_cli/doctor_state.pyindex 82e7caa55fd..1fb68122d4e 100644--- a/hermes_cli/doctor_state.py+++ b/hermes_cli/doctor_state.py@@ -664,12 +664,9 @@ def _check_plugins_disabled_by_update(should_fix: bool, f: Finding) -> None:@doctor_check("") # best-effort: an unreadable config is the config check's findingdef _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]+ updates left plugins in that state when they had to turn them off. Judged by the loader's gate."""+ from hermes_cli.plugins_discovery import plugins_in_both_lists+ both = plugins_in_both_lists()if not both:return_section("Plugins Listed as Both Enabled and Disabled")diff --git a/hermes_cli/plugins_discovery.py b/hermes_cli/plugins_discovery.pyindex 6d18a7cc538..ffa552531b6 100644--- a/hermes_cli/plugins_discovery.py+++ b/hermes_cli/plugins_discovery.py@@ -254,6 +254,17 @@ class ManifestGate:log: Optional[tuple] = None # (level, message, *args)+IN_BOTH_LISTS = "listed in both plugins.enabled and plugins.disabled — disabled wins"+++def plugins_in_both_lists() -> list[str]:+ """Keys of the plugins the loader skips because both lists name them, by the loader's own+ config read and name matching (path key, bare leaf, manifest name)."""+ winners = resolve_manifest_winners(collect_directory_manifests())+ disabled, enabled = _get_disabled_plugins(), _get_enabled_plugins()+ return [key for key, manifest in winners.items() if gate_manifest(manifest, disabled, enabled).error == IN_BOTH_LISTS]++def gate_manifest(manifest: PluginManifest, disabled: set[str], enabled: Optional[set[str]]) -> ManifestGate:@@ -280,7 +291,7 @@ def gate_manifest(# Contradictory config (#131980): the disable wins, but a silent DEBUG skip hides the# conflict — the plugin "loads nowhere" while plugins.enabled still lists it. Fail loud.return _placeholder(- "listed in both plugins.enabled and plugins.disabled — disabled wins",+ IN_BOTH_LISTS,logging.WARNING,"Plugin '%s' is listed in both plugins.enabled and plugins.disabled; the disable ""wins and it will not load — remove it from one of the two lists",diff --git a/tests/hermes_cli/test_doctor_plugins_in_both_lists.py b/tests/hermes_cli/test_doctor_plugins_in_both_lists.pyindex a40cf75fa3c..103952c4732 100644--- a/tests/hermes_cli/test_doctor_plugins_in_both_lists.py+++ b/tests/hermes_cli/test_doctor_plugins_in_both_lists.py@@ -5,17 +5,22 @@ they had to turn them off (#131216), and nothing else said so."""from __future__ import annotations-from hermes_cli import doctorfrom hermes_cli.doctor_state import _check_plugins_in_both_listsdef test_plugin_in_both_lists_is_an_issue_with_the_command_that_settles_it(tmp_path, monkeypatch):+ """Doctor sees what the loader skips, under any spelling the loader matches."""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")+ for rel, name in (("obs/intake", "intake-probe"), ("kept", "kept"), ("parked", "parked")):+ plugin = home / "plugins" / rel+ plugin.mkdir(parents=True)+ (plugin / "plugin.yaml").write_text(f"name: {name}\nversion: '1.0'\n", encoding="utf-8")+ (plugin / "__init__.py").write_text("def register(ctx):\n pass\n", encoding="utf-8")+ (home / "config.yaml").write_text(+ "plugins:\n enabled: [kept, intake-probe]\n disabled: [obs/intake, parked]\n", encoding="utf-8")+ monkeypatch.setenv("HERMES_HOME", str(home))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]+ assert "hermes plugins enable obs/intake" in finding.manual_issues[0]