Skip to content

The agent that grows with you

fix(plugins): a "y" at the install prompt loads the plugin into the running gateway

Teknium0af496ae76ae
diff --git a/hermes_cli/plugins_cmd_install.py b/hermes_cli/plugins_cmd_install.py
index 19c260e8e4f..e0062e36a7c 100644
--- a/hermes_cli/plugins_cmd_install.py
+++ b/hermes_cli/plugins_cmd_install.py
@@ -686,6 +686,7 @@ def cmd_install(
# 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.
+ activate = bool(enable) # also set by a "y" at the Enable-now prompt below
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:
@@ -701,6 +702,7 @@ def cmd_install(
"after resolving the conflict.[/dim]"
)
else:
+ activate = True
console.print(
f"[green]✓[/green] Plugin [bold]{installed_name}[/bold] enabled.",
)
@@ -716,8 +718,10 @@ def cmd_install(
declared_caps = _pc()._declared_capabilities_from_manifest(installed_manifest, installed_name)
if declared_caps:
_pc()._run_capability_consent(console, installed_name, declared_caps, context="install")
- if enable and not is_memory_provider:
+ if activate and not is_memory_provider:
# Loads it into the running gateway now (handlers live) or says what needs a restart (#87770).
+ # A "y" at the Enable-now prompt counts: without the nudge the gateway never loads the plugin
+ # (its MCP servers stay absent from every session) and nothing tells the user to restart.
from hermes_cli.plugins_activation import report_activation
report_activation(console, installed_name)
console.print()
diff --git a/tests/hermes_cli/test_plugin_install_prompt_activation.py b/tests/hermes_cli/test_plugin_install_prompt_activation.py
new file mode 100644
index 00000000000..133e8c72c85
--- /dev/null
+++ b/tests/hermes_cli/test_plugin_install_prompt_activation.py
@@ -0,0 +1,32 @@
+"""Enabling a plugin at the install prompt loads it where it can go live, like ``--enable`` does."""
+import os
+import subprocess
+
+import hermes_yaml as yaml
+
+from hermes_cli import plugins_activation, plugins_cmd
+from tests.pm.test_plugin_survival_contract import admission_env
+
+
+def test_yes_at_the_enable_prompt_activates_the_plugin_in_running_processes(admission_env, monkeypatch): # health: allow F811 -- pytest injects the imported admission_env fixture by parameter name
+ """A "y" at "Enable now?" enables the plugin AND nudges the running gateway / Desktop backend
+ (report_activation), exactly like ``--enable``. Without the nudge a gateway started before the
+ install never loads the plugin, so its MCP servers are missing from every session it serves."""
+ root, home = admission_env
+ source = root / 'plugin-source'
+ source.mkdir()
+ (source / 'plugin.yaml').write_text(yaml.safe_dump({'name': 'prompt-enabled-plugin'}), encoding='utf-8')
+ (source / '__init__.py').write_text('def register(ctx):\n pass\n', encoding='utf-8')
+ env = {k: v for k, v in os.environ.items() if k not in {'GIT_DIR', 'GIT_WORK_TREE', 'GIT_INDEX_FILE'}}
+ for args in [('init', '-q'), ('add', '.'), ('-c', 'user.name=test', '-c', '[email protected]', 'commit', '-qm', 'fixture')]:
+ subprocess.run(['git', *args], cwd=source, env=env, check=True, capture_output=True, timeout=30)
+ monkeypatch.setattr(plugins_cmd, '_is_tty', lambda: True)
+ monkeypatch.setattr(plugins_cmd, '_ask_yes', lambda *a, **k: True)
+ activated = []
+ monkeypatch.setattr(plugins_activation, 'report_activation', lambda console, name: activated.append(name))
+
+ plugins_cmd.cmd_install(source.as_uri(), allow_removed=True)
+
+ enabled = yaml.safe_load((home / 'config.yaml').read_text(encoding='utf-8'))['plugins']['enabled']
+ assert 'prompt-enabled-plugin' in enabled
+ assert activated == ['prompt-enabled-plugin']