The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(kanban): dashboard Specify/Decompose resolve the profile's aux-LLM key (#123372, salvage #123384)
liuhao102411598aebe388
diff --git a/tests/plugins/test_kanban_dashboard_plugin.py b/tests/plugins/test_kanban_dashboard_plugin.pyindex 221772d38b2..aea5b9af2bd 100644--- a/tests/plugins/test_kanban_dashboard_plugin.py+++ b/tests/plugins/test_kanban_dashboard_plugin.py@@ -1037,6 +1037,64 @@ def test_specify_happy_path(client, monkeypatch):assert detail["title"] == "Polished"assert "**Goal**" in (detail["body"] or "")+# ---------------------------------------------------------------------------+# Aux-LLM endpoints under multiplexed hosting — profile secret scope (#123372)+# ---------------------------------------------------------------------------++def test_specify_resolves_each_profiles_key_under_multiplex(kanban_home, tmp_path, monkeypatch):+ """Specify / Decompose / Estimate reach the aux client with no agent turn, so under+ multi-profile hosting an unscoped provider-key read fails closed (``LLM error:+ UnscopedSecretError``). The plugin router is mounted the way ``_mount_plugin_api_routes``+ mounts every plugin router — behind ``_plugin_route_secret_scope`` — so the launch profile+ (A) and a ``?profile=`` request (B) each resolve their OWN key, and B never leaks into A."""+ import agent.secret_scope as ss+ from fastapi import Depends+ from hermes_cli import profiles+ from hermes_cli.web_server_dashboard import _plugin_route_secret_scope+ from tui_gateway import launch_profile_policy+ from unittest.mock import MagicMock++ (kanban_home / ".env").write_text("KANBAN_AUX_SCOPE_TEST_KEY=key-of-launch-a\n")+ profiles_root = tmp_path / "profiles"+ (profiles_root / "workerb").mkdir(parents=True)+ (profiles_root / "workerb" / ".env").write_text("KANBAN_AUX_SCOPE_TEST_KEY=key-of-worker-b\n")+ monkeypatch.setattr(profiles, "_get_default_hermes_home", lambda: kanban_home)+ monkeypatch.setattr(profiles, "_get_profiles_root", lambda: profiles_root)++ seen: list = []++ def fake_call_llm(**kwargs):+ seen.append(ss.get_secret("KANBAN_AUX_SCOPE_TEST_KEY"))+ resp = MagicMock()+ resp.choices = [MagicMock()]+ resp.choices[0].message.content = json.dumps({"title": "Polished", "body": "**Goal**\nDo it."})+ return resp++ monkeypatch.setattr("agent.auxiliary_client.call_llm", fake_call_llm)+ app = FastAPI()+ app.include_router(_load_plugin_router(), prefix="/api/plugins/kanban",+ dependencies=[Depends(_plugin_route_secret_scope)])+ client = TestClient(app)++ def _specify(profile=None):+ params = {"profile": profile} if profile else None+ task = client.post("/api/plugins/kanban/tasks", params=params,+ json={"title": "one-liner", "triage": True}).json()["task"]+ return client.post(f"/api/plugins/kanban/tasks/{task['id']}/specify", params=params,+ json={"author": "ui-tester"}).json()++ was_active, snapshot = ss.is_multiplex_active(), launch_profile_policy._snapshot+ ss.set_multiplex_active(True)+ try:+ for profile in (None, "workerb", None):+ body = _specify(profile)+ assert body["ok"] is True, body+ finally:+ ss.set_multiplex_active(was_active)+ launch_profile_policy._snapshot = snapshot+ assert seen == ["key-of-launch-a", "key-of-worker-b", "key-of-launch-a"]++# ---------------------------------------------------------------------------# Final result visibility for Done cards# ---------------------------------------------------------------------------