fix(hermes): recover stale coordinator panes
Some checks failed
Tests / Declarative: Post Actions failed: 2, passed: 167

This commit is contained in:
jenkins 2026-08-09 02:50:38 -03:00
parent 25462c33ac
commit 724fb1e077
2 changed files with 26 additions and 2 deletions

View File

@ -449,7 +449,21 @@ spec:
done
pane_file=/opt/data/herdr/coordinator-pane-id
pane="$(cat "${pane_file}" 2>/dev/null || true)"
if [ -z "${pane}" ] || ! herdr pane get "${pane}" >/dev/null 2>&1; then
pane_live=no
if [ -n "${pane}" ]; then
for attempt in $(seq 1 20); do
if herdr pane process-info --pane "${pane}" >/dev/null 2>&1; then
pane_live=yes
break
fi
sleep 1
done
fi
if [ "${pane_live}" != "yes" ]; then
if [ -n "${pane}" ]; then
workspace="${pane%%:*}"
herdr workspace close "${workspace}" >/dev/null 2>&1 || true
fi
created="$(herdr workspace create \
--cwd /opt/data/workspace \
--label coordinator \
@ -466,7 +480,10 @@ spec:
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")')"
if [ "${coordinator_running}" != "yes" ]; then
herdr pane run "${pane}" /opt/hermes/.venv/bin/hermes
herdr agent start coordinator \
--kind hermes \
--pane "${pane}" \
--timeout 60000
fi
wait "${server_pid}"
env:

View File

@ -199,6 +199,13 @@ def test_agent_installs_hermes_integration_before_startup():
env = {item["name"]: item["value"] for item in containers[name]["env"]}
assert "/opt/hermes/.venv/bin" in env["PATH"].split(":")
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 "herdr agent start coordinator" in server_command
assert "--kind hermes" in server_command
assert "--timeout 60000" in server_command
def test_agent_mounts_auto_router_into_both_hermes_runtimes():
deployment = yaml.safe_load((HERMES / "agent-deployment.yaml").read_text())