fix(hermes): prune duplicate coordinator workspaces
Some checks failed
Tests / Declarative: Post Actions failed: 2, passed: 168
Some checks failed
Tests / Declarative: Post Actions failed: 2, passed: 168
This commit is contained in:
parent
efca8d9bd7
commit
8bf363de6f
@ -476,6 +476,13 @@ spec:
|
|||||||
'import json,sys; print(json.load(sys.stdin)["result"]["root_pane"]["pane_id"])')"
|
'import json,sys; print(json.load(sys.stdin)["result"]["root_pane"]["pane_id"])')"
|
||||||
printf '%s\n' "${pane}" > "${pane_file}"
|
printf '%s\n' "${pane}" > "${pane_file}"
|
||||||
fi
|
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":[]}}}')"
|
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 \
|
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")')"
|
'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")')"
|
||||||
|
|||||||
@ -202,6 +202,9 @@ def test_agent_installs_hermes_integration_before_startup():
|
|||||||
server_command = containers["herdr-server"]["command"][-1]
|
server_command = containers["herdr-server"]["command"][-1]
|
||||||
assert 'herdr pane process-info --pane "${pane}"' in server_command
|
assert 'herdr pane process-info --pane "${pane}"' in server_command
|
||||||
assert 'herdr workspace close "${workspace}"' 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 "herdr agent start coordinator" in server_command
|
||||||
assert "--kind hermes" in server_command
|
assert "--kind hermes" in server_command
|
||||||
assert "--timeout 60000" in server_command
|
assert "--timeout 60000" in server_command
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user