The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(web_server): discover root user plugins under profile-scoped processes
Teknium1e6717baf248
diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.pyindex c9863c49365..b3048cc1e6b 100644--- a/hermes_cli/web_server.py+++ b/hermes_cli/web_server.py@@ -17412,8 +17412,25 @@ def _discover_dashboard_plugins() -> list:# theme YAML): resolve them from the process launch home so they don't# vanish when a request is scoped to another profile via a context-local# HERMES_HOME override (e.g. embedded /chat under --open-profile).- search_dirs = [- (get_process_hermes_home() / "plugins", "user"),+ #+ # #87197: when the process itself is profile-scoped (``--profile <name>``+ # sets ``HERMES_HOME=<root>/profiles/<name>``), the launch home is the+ # profile directory, which has no ``plugins/`` — user plugins are+ # installed in the hermes root (``~/.hermes/plugins``). Scan the default+ # root as well (``get_default_hermes_root()`` unwraps+ # ``<root>/profiles/<name>`` → ``<root>`` and returns a custom+ # ``HERMES_HOME`` unchanged when it *is* the root), mirroring how+ # ``hermes_cli.plugins`` resolves plugin install locations. The+ # ``seen_names`` dedupe below keeps profile-local plugins (if any)+ # authoritative over same-named root plugins.+ from hermes_constants import get_default_hermes_root++ user_plugin_roots = [get_process_hermes_home() / "plugins"]+ root_plugins = get_default_hermes_root() / "plugins"+ if root_plugins.resolve(strict=False) != user_plugin_roots[0].resolve(strict=False):+ user_plugin_roots.append(root_plugins)+ search_dirs = [(d, "user") for d in user_plugin_roots]+ search_dirs += [(bundled_root / "memory", "bundled"),(bundled_root, "bundled"),]diff --git a/tests/hermes_cli/test_web_server.py b/tests/hermes_cli/test_web_server.pyindex 04c375e32e1..42e3860dd6b 100644--- a/tests/hermes_cli/test_web_server.py+++ b/tests/hermes_cli/test_web_server.py@@ -3962,6 +3962,51 @@ class TestDashboardPluginManifestExtensions:reset_hermes_home_override(token)assert any(p["name"] == "skin-home" for p in plugins)+ def test_user_plugins_found_under_profile_scoped_process(self, tmp_path, monkeypatch):+ """Regression #87197: a profile-scoped process (``--profile <name>``+ sets HERMES_HOME=<root>/profiles/<name>) must still discover user+ plugins installed in the hermes root's plugins/ directory."""+ root = tmp_path / "hermes-root"+ profile_home = root / "profiles" / "presale"+ profile_home.mkdir(parents=True)+ self._write_plugin(root, "meeting-intelligence", {+ "name": "meeting-intelligence",+ "label": "Meeting Intelligence",+ "tab": {"path": "/meetings"},+ "entry": "dist/index.js",+ })++ monkeypatch.setenv("HERMES_HOME", str(profile_home))+ from hermes_cli import web_server+ plugins = web_server._discover_dashboard_plugins()+ assert any(p["name"] == "meeting-intelligence" for p in plugins)++ def test_profile_local_plugin_wins_over_root_plugin(self, tmp_path, monkeypatch):+ """A same-named plugin in the profile home takes precedence over the+ root copy (seen_names dedupe, profile scanned first)."""+ root = tmp_path / "hermes-root"+ profile_home = root / "profiles" / "presale"+ profile_home.mkdir(parents=True)+ self._write_plugin(profile_home, "dupe", {+ "name": "dupe",+ "label": "Profile Copy",+ "tab": {"path": "/from-profile"},+ "entry": "dist/index.js",+ })+ self._write_plugin(root, "dupe", {+ "name": "dupe",+ "label": "Root Copy",+ "tab": {"path": "/from-root"},+ "entry": "dist/index.js",+ })++ monkeypatch.setenv("HERMES_HOME", str(profile_home))+ from hermes_cli import web_server+ plugins = web_server._discover_dashboard_plugins()+ entries = [p for p in plugins if p["name"] == "dupe"]+ assert len(entries) == 1+ assert entries[0]["tab"]["path"] == "/from-profile"+