From 5a715f79642d1b3c821829749fd02d071066c93c Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Wed, 24 Jun 2026 19:30:59 -0400 Subject: [PATCH] chore(agent-team): deploy-r720.sh handles the dashboard frontend path Adds SYNC_WEB=1 to /sh-deploy-r720's script: build agent-team/web/dist on the Mac (box Node too old for Vite), rsync it with --delete (clears stale hashed bundles), force a status-service restart, and verify the served index.html references the freshly-built bundle. Also stops the verify step false-failing on the known benign draft-pr-monitor 'gh'-missing traceback (strips that block before judging the journal; is-active/NRestarts/threads remain the authoritative crash-loop signals). --- agent-team/scripts/deploy-r720.sh | 47 +++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/agent-team/scripts/deploy-r720.sh b/agent-team/scripts/deploy-r720.sh index 6012b16..e7ab7db 100755 --- a/agent-team/scripts/deploy-r720.sh +++ b/agent-team/scripts/deploy-r720.sh @@ -30,7 +30,13 @@ # langchain-* model stack, or models.py fails to import and # the non-Claude review/scan/build silently never run). # SYNC_HANDBOOK=1 also rsync the engineering handbook (WS5 context_provider). +# SYNC_WEB=1 also (re)deploy the dashboard SPA: build web/dist ON THE MAC +# (the box Node is too old for Vite 5+), rsync it with --delete +# (clears stale content-hashed bundles), and force a status- +# service restart + a served-bundle verify. Set this whenever +# agent-team/web changed. # RESTART_STATUS=1 also restart agent-team-status.service (the LAN dashboard). +# Implied by SYNC_WEB=1. # ASSUME_SNAPSHOT=1 skip the interactive snapshot prompt (you confirmed it # out of band). Do NOT set this casually. set -euo pipefail @@ -91,6 +97,17 @@ if [ "${SYNC_HANDBOOK:-0}" = "1" ]; then fi fi +if [ "${SYNC_WEB:-0}" = "1" ]; then + say "2d. build the dashboard SPA on the Mac + rsync web/dist (box Node too old for Vite)" + WEB="${REPO}/agent-team/web" + [ -d "${WEB}" ] || { err "no web/ dir under ${REPO}/agent-team"; exit 1; } + # Build on the Mac (npm ci only if deps are missing), then ship the whole dist + # with --delete so old hashed bundles don't linger on the box. + ( cd "${WEB}" && { [ -d node_modules ] || npm ci; } && npm run build ) + rsync -az --delete "${WEB}/dist/" "${BOX}:orchestrator/agent-team/web/dist/" + RESTART_STATUS=1 # the dashboard must restart to serve the new bundle +fi + # ── 2c. Pre-restart import sanity (catch the crash before it loops) ────────── say "2c. Pre-restart import sanity" $SSH 'cd ~/orchestrator/agent-team && . .venv/bin/activate && \ @@ -118,8 +135,13 @@ OK=1 [ "${STATE}" = "active" ] || { err "is-active=${STATE} (expected active; 'activating' = crash-loop)"; OK=0; } [ "${NRESTARTS_AFTER}" -le "${NRESTARTS_BEFORE}" ] || { err "NRestarts climbed (${NRESTARTS_BEFORE}->${NRESTARTS_AFTER}) = crash-loop"; OK=0; } [ "${THREADS}" -ge 5 ] || { err "thread count ${THREADS} (~6 expected; Socket Mode listener may be down)"; OK=0; } -if $SSH "journalctl -u ${SVC} --since '30 seconds ago' --no-pager" | grep -Eiq 'traceback|error'; then - err "journal shows Traceback/error in the last 30s"; OK=0 +# Strip the KNOWN-BENIGN draft-pr-monitor 'gh'-missing traceback (the box lacks the +# gh CLI; it fail-safes and fires every ~30s) before judging the journal, else every +# deploy false-fails. See feedback_r720_agent_team_deploy. +JOURNAL="$($SSH "journalctl -u ${SVC} --since '30 seconds ago' --no-pager")" +CLEAN="$(printf '%s\n' "${JOURNAL}" | sed "/Traceback (most recent call last):/,/No such file or directory: 'gh'/d")" +if printf '%s\n' "${CLEAN}" | grep -Eiq 'traceback|error'; then + err "journal shows a (non-'gh') Traceback/error in the last 30s"; OK=0 fi if [ "${OK}" != "1" ]; then @@ -136,5 +158,26 @@ ROLLBACK_MSG fi say "VERIFY PASSED — coordinator active, no restart climb, listener up." + +# ── 4b. Frontend verify (only when the dashboard service was (re)started) ───── +if [ "${RESTART_STATUS:-0}" = "1" ]; then + say "4b. Verify the dashboard (agent-team-status.service)" + sleep 2 + SSTATE=$($SSH "systemctl is-active agent-team-status.service" || true) + HTTP=$($SSH "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8770/" || echo 000) + echo "status-service is-active=${SSTATE} dashboard http=${HTTP}" + [ "${SSTATE}" = "active" ] || err "agent-team-status.service is ${SSTATE} (expected active)" + [ "${HTTP}" = "200" ] || err "dashboard returned http ${HTTP} (expected 200)" + if [ "${SYNC_WEB:-0}" = "1" ]; then + # Confirm the box actually serves the bundle we just built (no stale dist). + BUNDLE=$(grep -oE 'assets/index-[A-Za-z0-9_-]+\.js' "${REPO}/agent-team/web/dist/index.html" | head -1) + if [ -n "${BUNDLE}" ] && $SSH "curl -s http://127.0.0.1:8770/" | grep -q "${BUNDLE}"; then + echo "served index.html references the freshly-built ${BUNDLE} ✓" + else + err "served index.html does NOT reference the new bundle (${BUNDLE:-?}) — stale dist?" + fi + fi +fi + echo "Reminder: merges to main remain held (deploy-before-merge)." say "Done." -- 2.50.1