fix(hermes): prune duplicate coordinator workspaces
Some checks failed
Tests / Declarative: Post Actions failed: 2, passed: 168

This commit is contained in:
jenkins 2026-08-09 03:21:00 -03:00
parent efca8d9bd7
commit 8bf363de6f
2 changed files with 10 additions and 0 deletions

View File

@ -476,6 +476,13 @@ spec:
'import json,sys; print(json.load(sys.stdin)["result"]["root_pane"]["pane_id"])')"
printf '%s\n' "${pane}" > "${pane_file}"
fi
active_workspace="${pane%%:*}"
coordinator_workspaces="$(herdr workspace list | /opt/hermes/.venv/bin/python -c \
'import json,sys; active=sys.argv[1]; payload=json.load(sys.stdin); print(" ".join(item["workspace_id"] for item in payload["result"]["workspaces"] if item.get("label") == "coordinator" and item["workspace_id"] != active))' \
"${active_workspace}")"
for stale_workspace in ${coordinator_workspaces}; do
herdr workspace close "${stale_workspace}" >/dev/null 2>&1 || true
done
process_info="$(herdr pane process-info --pane "${pane}" 2>/dev/null || printf '%s\n' '{"result":{"process_info":{"foreground_processes":[]}}}')"
coordinator_running="$(printf '%s' "${process_info}" | /opt/hermes/.venv/bin/python -c \
'import json,sys; processes=json.load(sys.stdin)["result"]["process_info"].get("foreground_processes", []); print("yes" if any("hermes" in " ".join(str(p.get(k) or "") for k in ("name", "argv0", "cmdline")) for p in processes) else "no")')"

View File

@ -202,6 +202,9 @@ def test_agent_installs_hermes_integration_before_startup():
server_command = containers["herdr-server"]["command"][-1]
assert 'herdr pane process-info --pane "${pane}"' in server_command
assert 'herdr workspace close "${workspace}"' in server_command
assert 'item.get("label") == "coordinator"' in server_command
assert 'item["workspace_id"] != active' in server_command
assert 'herdr workspace close "${stale_workspace}"' in server_command
assert "herdr agent start coordinator" in server_command
assert "--kind hermes" in server_command
assert "--timeout 60000" in server_command