diff --git a/services/hermes/agent-deployment.yaml b/services/hermes/agent-deployment.yaml index dbe05aa3b..a7cd046cc 100644 --- a/services/hermes/agent-deployment.yaml +++ b/services/hermes/agent-deployment.yaml @@ -515,6 +515,19 @@ spec: if herdr status server >/dev/null 2>&1; then break; fi sleep 1 done + legacy_hermes_panes="$(/opt/data/tools/bin/herdr agent list | \ + /opt/hermes/.venv/bin/python -c ' + import json + import sys + + payload = json.load(sys.stdin) + for agent in payload.get("result", {}).get("agents", []): + if agent.get("agent") == "hermes" and agent.get("pane_id"): + print(agent["pane_id"]) + ')" + for pane in ${legacy_hermes_panes}; do + /opt/data/tools/bin/herdr pane close "${pane}" >/dev/null 2>&1 || true + done wait "${server_pid}" env: - {name: HERMES_HOME, value: /opt/data} diff --git a/testing/tests/test_hermes_herdr.py b/testing/tests/test_hermes_herdr.py index 7c39e0bf9..06e248829 100644 --- a/testing/tests/test_hermes_herdr.py +++ b/testing/tests/test_hermes_herdr.py @@ -581,6 +581,8 @@ def test_agent_installs_hermes_integration_before_startup(): server_command = containers["herdr-server"]["command"][-1] assert "herdr server" in server_command + assert 'agent.get("agent") == "hermes"' in server_command + assert 'herdr pane close "${pane}"' in server_command assert "herdr agent start coordinator" not in server_command assert "/opt/coordinator/herdr_tab_router.py" not in server_command