The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): read the launch profile's plugin lists with its own secrets
unsupportedpastelsecc96b894f8e
diff --git a/hermes_cli/web_server_dashboard.py b/hermes_cli/web_server_dashboard.pyindex 3e4ed29e1f9..b6ed033fb79 100644--- a/hermes_cli/web_server_dashboard.py+++ b/hermes_cli/web_server_dashboard.py@@ -813,11 +813,15 @@ def _plugin_api_mount_skip_reason(plugin: dict[str, Any], enabled_set: set, disa@contextmanagerdef _launch_profile_scope():- """Resolve config as the launch profile's, whichever profile the request is scoped to."""+ """Resolve config as the launch profile's, whichever profile the request is scoped to: home and+ secrets switch together, so the launch config's ``${VAR}`` refs (and its last-good copy) never+ expand through another profile's secrets."""from hermes_constants import reset_hermes_home_override, set_hermes_home_override+ from hermes_cli.web_server_profiles import _config_profile_scopetoken = set_hermes_home_override(None)try:- yield+ with _config_profile_scope(None):+ yieldfinally:reset_hermes_home_override(token)diff --git a/tests/hermes_cli/test_plugin_api_consent_gate.py b/tests/hermes_cli/test_plugin_api_consent_gate.pyindex 6d655774365..0133e08f085 100644--- a/tests/hermes_cli/test_plugin_api_consent_gate.py+++ b/tests/hermes_cli/test_plugin_api_consent_gate.py@@ -197,6 +197,31 @@ def test_hot_mount_keeps_the_launch_profiles_isolation(daemon):assert not imported.exists() and daemon.hosted == ["iso-probe"]+def test_launch_consent_read_under_a_secondary_grant_keeps_the_launch_secrets(daemon, monkeypatch):+ """A secondary profile's plugin socket binds that profile's secrets before the gate reads the+ launch profile's lists. That read must expand the launch config's ``${VAR}`` refs with the+ launch profile's secrets: otherwise the launch home's last-good config holds the secondary's+ values, and the launch profile is served them once its config.yaml stops parsing."""+ from hermes_cli.config import load_config+ from hermes_cli.web_server_profiles import _config_profile_scope++ monkeypatch.delenv("PLG_SCOPE_PROBE", raising=False)+ _install(daemon.launch, "scope-probe")+ config = {"plugins": {"enabled": ["scope-probe"], "disabled": []}, "scope_probe": "${PLG_SCOPE_PROBE}"}+ (daemon.launch / "config.yaml").write_text(json.dumps(config))+ (daemon.launch / ".env").write_text("PLG_SCOPE_PROBE=launch-value\n")+ _plugins(daemon.beta, enabled=["scope-probe"])+ (daemon.beta / ".env").write_text("PLG_SCOPE_PROBE=beta-value\n")+ assert daemon.client.get("/api/plugins/scope-probe/ping", headers=daemon.owner).status_code == 200+ with daemon.client.websocket_connect("/api/plugins/scope-probe/events", headers=daemon.beta_ticket()) as ws:+ assert ws.receive_text() == "hello"++ (daemon.launch / "config.yaml").write_text("plugins: [unclosed\n")++ with _config_profile_scope(None):+ assert load_config()["scope_probe"] == "launch-value"++def test_profile_selector_cannot_run_a_plugin_on_a_profile_that_disabled_it(daemon):"""``?profile=`` with the session token binds the selected profile's scope for the handler, sothat profile's opt-out holds there exactly as it does for its own ticket, HTTP and WebSocket."""