The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): warn loudly when a plugin is in both enabled and disabled lists
liuhao1024f9da99aefc49
diff --git a/hermes_cli/plugins_discovery.py b/hermes_cli/plugins_discovery.pyindex a7d4aafc4a2..6d18a7cc538 100644--- a/hermes_cli/plugins_discovery.py+++ b/hermes_cli/plugins_discovery.py@@ -276,6 +276,15 @@ def gate_manifest()return _placeholder(error, logging.WARNING, "Refusing to load removed Hermes Relay plugin '%s'; %s", error)if names & disabled:+ if enabled and names & enabled:+ # 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",+ 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",+ )return _placeholder("disabled via config", logging.DEBUG, "Skipping disabled plugin '%s'")# Exclusive plugins (memory providers) have their own activation path; record only.if manifest.kind == "exclusive":diff --git a/tests/hermes_cli/test_plugins_cmd_activation_keys.py b/tests/hermes_cli/test_plugins_cmd_activation_keys.pyindex fde00c1af12..6a723a3d480 100644--- a/tests/hermes_cli/test_plugins_cmd_activation_keys.py+++ b/tests/hermes_cli/test_plugins_cmd_activation_keys.py@@ -174,6 +174,31 @@ def test_cli_enable_on_a_fresh_config_writes_no_toolset_list(home):_restart_backend()+def test_plugin_in_both_lists_warns_instead_of_silent_debug_skip(home):+ """A plugin listed in both plugins.enabled and plugins.disabled loads nowhere silently (#131980):+ the disable still wins, but the gate must surface the contradiction at WARNING with both config+ keys named, instead of the DEBUG skip that is invisible during normal operation."""+ import logging++ _write_plugin(home / "plugins", "obs/intake", "intake-probe")+ manifest = next(m for m in collect_directory_manifests() if m.name == "intake-probe")++ conflicting = gate_manifest(manifest, {"obs/intake"}, {"obs/intake"})+ assert conflicting.action == "placeholder"+ assert conflicting.error == "listed in both plugins.enabled and plugins.disabled — disabled wins"+ assert conflicting.log[0] == logging.WARNING+ assert "plugins.enabled" in conflicting.log[1] and "plugins.disabled" in conflicting.log[1]++ # Cross-form contradiction (path key in one list, manifest name in the other) is caught too —+ # the gate matches either identifier, so the warning must not depend on identical spelling.+ cross = gate_manifest(manifest, {"obs/intake"}, {"intake-probe"})+ assert cross.log[0] == logging.WARNING++ # A plain disable with no overlap stays a quiet DEBUG skip — no behavior change.+ plain = gate_manifest(manifest, {"obs/intake"}, {"other/plugin"})+ assert plain.error == "disabled via config" and plain.log[0] == logging.DEBUG++def test_status_reports_bundled_defaults_and_the_live_memory_provider(home):"""Bundled backends (auto-load) and the plugin selected by ``memory.provider`` run without a``plugins.enabled`` entry; status must not call them "not enabled" (#73131, #82898)."""diff --git a/tests/plugins/test_disk_cleanup_plugin.py b/tests/plugins/test_disk_cleanup_plugin.pyindex f8f53aac84d..951e876115d 100644--- a/tests/plugins/test_disk_cleanup_plugin.py+++ b/tests/plugins/test_disk_cleanup_plugin.py@@ -682,7 +682,8 @@ class TestBundledDiscovery:def test_disabled_beats_enabled(self, _isolate_env):- """plugins.disabled wins even if the plugin is also in plugins.enabled."""+ """plugins.disabled wins even if the plugin is also in plugins.enabled — and the+ contradiction is surfaced (#131980), not absorbed as a plain disable."""import hermes_yaml as yamlcfg_path = _isolate_env / "config.yaml"cfg_path.write_text(yaml.safe_dump({@@ -696,7 +697,7 @@ class TestBundledDiscovery:mgr.discover_and_load()loaded = mgr._plugins["disk-cleanup"]assert not loaded.enabled- assert loaded.error == "disabled via config"+ assert loaded.error == "listed in both plugins.enabled and plugins.disabled — disabled wins"def test_memory_and_context_engine_subdirs_skipped(self, _isolate_env):"""Bundled scan must NOT pick up plugins/memory or plugins/context_engine