The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): --enable leaves an installed memory provider loadable
Teknium512ebece93f8
diff --git a/hermes_cli/plugins_cmd_install.py b/hermes_cli/plugins_cmd_install.pyindex 82241111d5b..9e6443deb78 100644--- a/hermes_cli/plugins_cmd_install.py+++ b/hermes_cli/plugins_cmd_install.py@@ -594,7 +594,9 @@ def cmd_install()should_enable = False- if already_active:+ # already_active is PM's selection (plugins.enabled): it settles dependency consent, not memory.provider.+ # An explicit --enable still selects the provider, repairing installs that listed it in plugins.enabled.+ if already_active and not (is_memory_provider and enable):console.print("[dim]Replacement installed; plugin selection was not changed.[/dim]")elif is_memory_provider:_select_memory_provider(target.name, console, select=should_enable)@@ -648,6 +650,18 @@ def _select_memory_provider(name: str, console, *, select: bool) -> None:console.print(f"[red]✗[/red] Could not prepare {name}'s dependencies: {exc}")console.print("[dim]memory.provider is unchanged; run `hermes memory setup` after resolving it.[/dim]")return+ # The loader refuses a provider parked in plugins.disabled; lift that through the same admission transaction.+ from hermes_cli.plugins_admission import AdmissionRefused+ expected_config = _pc()._plugin_selection_version()+ disabled, aliases = _pc()._get_disabled_set(), _pc()._plugin_aliases(name)+ if disabled & aliases:+ try:+ _pc()._admit_and_save_plugin_sets(_pc()._get_enabled_set(), disabled - aliases,+ console=console, action=f"Re-enable '{name}'",+ expected_config=expected_config)+ except AdmissionRefused:+ console.print("[dim]memory.provider is unchanged.[/dim]")+ returnprevious = _pc()._get_current_memory_provider()_pc()._save_memory_provider(name)console.print(diff --git a/tests/hermes_cli/test_plugins_cmd_catalog.py b/tests/hermes_cli/test_plugins_cmd_catalog.pyindex bdf0a3c00b4..0f98693ab59 100644--- a/tests/hermes_cli/test_plugins_cmd_catalog.py+++ b/tests/hermes_cli/test_plugins_cmd_catalog.py@@ -369,9 +369,15 @@ def test_memory_category_install_activates_via_memory_provider_not_plugins_enablassert not any("plugins enable cat-plugin" in line for line in printed)-def test_url_install_of_a_memory_provider_dir_gets_the_provider_hint(world, tmp_path, monkeypatch):[email protected]("prior", [None, "disabled", "enabled"])+def test_url_install_of_a_memory_provider_dir_gets_the_provider_hint(world, tmp_path, monkeypatch, prior):"""A URL (non-catalog) install whose tree satisfies the memory-provider contract gets the same- provider activation path — the catalog category is a shortcut, not the only trigger."""+ provider activation path — the catalog category is a shortcut, not the only trigger. An explicit+ --enable must leave the provider loadable: a plugins.disabled entry would make the loader refuse it,+ and a reinstall must repair the old state that listed the provider in plugins.enabled instead."""+ from hermes_cli.config import load_config, save_config+ from plugins.memory import _explicitly_disabled, find_provider_dir+repo = tmp_path / "mem-repo"repo.mkdir()(repo / "plugin.yaml").write_text("name: mem-plugin\nversion: 1.0.0\ndescription: d\n")@@ -387,9 +393,16 @@ def test_url_install_of_a_memory_provider_dir_gets_the_provider_hint(world, tmp_monkeypatch.setattr(pc, "_console",lambda: type("C", (), {"print": staticmethod(_capture)})())- pc.cmd_install(repo.as_uri(), enable=True)+ if prior == "enabled":+ pc.cmd_install(repo.as_uri(), enable=False)+ if prior:+ cfg = load_config()+ cfg.setdefault("plugins", {})[prior] = ["mem-plugin"]+ save_config(cfg)+ pc.cmd_install(repo.as_uri(), enable=True, force=prior == "enabled")assert pc._get_current_memory_provider() == "mem-plugin"- assert pc._get_enabled_set() == set()+ assert pc._get_enabled_set() == ({"mem-plugin"} if prior == "enabled" else set())+ assert not _explicitly_disabled("mem-plugin", find_provider_dir("mem-plugin"))assert any("memory.provider" in line for line in printed)