From a7152b0a67fed7e4f03e31c949c428e0e8ec5e07 Mon Sep 17 00:00:00 2001 From: twentyOne2x Date: Thu, 9 Jul 2026 08:01:43 +0200 Subject: [PATCH] Sync leoclean skills during deploy --- deploy/auto-deploy.sh | 11 ++++++++++- deploy/deploy.sh | 7 ++++++- tests/test_teleo_agent_systemd.py | 12 ++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/deploy/auto-deploy.sh b/deploy/auto-deploy.sh index c20d1e4..93a9ba1 100755 --- a/deploy/auto-deploy.sh +++ b/deploy/auto-deploy.sh @@ -16,6 +16,7 @@ PIPELINE_DIR="/opt/teleo-eval/pipeline" TELEGRAM_DIR="/opt/teleo-eval/telegram" DIAGNOSTICS_DIR="/opt/teleo-eval/diagnostics" AGENT_STATE_DIR="/opt/teleo-eval/ops/agent-state" +LEOCLEAN_SKILLS_DIR="/home/teleo/.hermes/profiles/leoclean/skills" SYSTEMD_DIR="/etc/systemd/system" STAMP_FILE="/opt/teleo-eval/.last-deploy-sha" LOG_TAG="auto-deploy" @@ -93,12 +94,16 @@ rsync "${RSYNC_OPTS[@]}" telegram/ "$TELEGRAM_DIR/" rsync "${RSYNC_OPTS[@]}" diagnostics/ "$DIAGNOSTICS_DIR/" rsync "${RSYNC_OPTS[@]}" agent-state/ "$AGENT_STATE_DIR/" rsync "${RSYNC_OPTS[@]}" tests/ "$PIPELINE_DIR/tests/" +if [ -d hermes-agent/leoclean-skills/vps ]; then + mkdir -p "$LEOCLEAN_SKILLS_DIR" + rsync "${RSYNC_OPTS[@]}" hermes-agent/leoclean-skills/vps/ "$LEOCLEAN_SKILLS_DIR/" +fi [ -f research/research-session.sh ] && rsync "${RSYNC_OPTS[@]}" research/research-session.sh /opt/teleo-eval/research-session.sh # Safety net: ensure synced .sh files are executable after rsync. # Keep this bounded to deploy-owned paths: /opt/teleo-eval also contains # backups and generated state that may be unreadable by the deploy user. -for dir in "$PIPELINE_DIR" "$TELEGRAM_DIR" "$DIAGNOSTICS_DIR" "$AGENT_STATE_DIR"; do +for dir in "$PIPELINE_DIR" "$TELEGRAM_DIR" "$DIAGNOSTICS_DIR" "$AGENT_STATE_DIR" "$LEOCLEAN_SKILLS_DIR"; do [ -d "$dir" ] || continue find "$dir" -maxdepth 3 -name '*.sh' -not -perm -u+x -exec chmod +x {} + done @@ -154,10 +159,14 @@ if [ "$OLD_SHA" != "none" ]; then if git diff --name-only "$OLD_SHA" "$NEW_SHA" -- diagnostics/ 2>/dev/null | grep -q '\.py$'; then add_restart teleo-diagnostics fi + if git diff --name-only "$OLD_SHA" "$NEW_SHA" -- hermes-agent/leoclean-skills/vps/ 2>/dev/null | grep -q .; then + add_restart_if_unit_active leoclean-gateway + fi else RESTART="teleo-pipeline teleo-diagnostics" add_restart_if_unit_active teleo-agent@leo add_restart_if_unit_exists teleo-agent@leo-wallet-test + add_restart_if_unit_active leoclean-gateway fi if [ -n "$RESTART" ]; then diff --git a/deploy/deploy.sh b/deploy/deploy.sh index 2a87728..c9ab2e0 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -10,6 +10,7 @@ VPS_PIPELINE="/opt/teleo-eval/pipeline" VPS_TELEGRAM="/opt/teleo-eval/telegram" VPS_DIAGNOSTICS="/opt/teleo-eval/diagnostics" VPS_AGENT_STATE="/opt/teleo-eval/ops/agent-state" +VPS_LEOCLEAN_SKILLS="/home/teleo/.hermes/profiles/leoclean/skills" VPS_SYSTEMD="/etc/systemd/system" REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" @@ -91,6 +92,10 @@ echo "=== Agent state ===" rsync "${RSYNC_OPTS[@]}" "$REPO_ROOT/agent-state/" "$VPS_HOST:$VPS_AGENT_STATE/" echo "" +echo "=== Leoclean skills ===" +rsync "${RSYNC_OPTS[@]}" "$REPO_ROOT/hermes-agent/leoclean-skills/vps/" "$VPS_HOST:$VPS_LEOCLEAN_SKILLS/" +echo "" + echo "=== Research session ===" rsync "${RSYNC_OPTS[@]}" "$REPO_ROOT/research/research-session.sh" "$VPS_HOST:/opt/teleo-eval/research-session.sh" echo "" @@ -113,6 +118,6 @@ echo "Deploy complete." if $RESTART; then echo "" echo "=== Restarting services ===" - ssh "$VPS_HOST" "sudo systemctl restart teleo-pipeline teleo-diagnostics; if systemctl is-active --quiet teleo-agent@leo.service; then sudo systemctl restart teleo-agent@leo; fi; if systemctl list-units --all --full teleo-agent@leo-wallet-test.service --no-legend | grep -q .; then sudo systemctl restart teleo-agent@leo-wallet-test; fi" + ssh "$VPS_HOST" "sudo systemctl restart teleo-pipeline teleo-diagnostics; if systemctl is-active --quiet teleo-agent@leo.service; then sudo systemctl restart teleo-agent@leo; fi; if systemctl list-units --all --full teleo-agent@leo-wallet-test.service --no-legend | grep -q .; then sudo systemctl restart teleo-agent@leo-wallet-test; fi; if systemctl is-active --quiet leoclean-gateway.service; then sudo systemctl restart leoclean-gateway; fi" echo "Services restarted." fi diff --git a/tests/test_teleo_agent_systemd.py b/tests/test_teleo_agent_systemd.py index 64b8c2c..57c51b3 100644 --- a/tests/test_teleo_agent_systemd.py +++ b/tests/test_teleo_agent_systemd.py @@ -78,3 +78,15 @@ def test_deploy_scripts_install_systemd_units_and_enable_agent_healthcheck(): assert 'VPS_SYSTEMD="/etc/systemd/system"' in manual_deploy assert "teleo-agent-healthcheck.timer" in manual_deploy + + +def test_deploy_scripts_sync_leoclean_skills_and_restart_gateway_when_active(): + auto_deploy = (REPO_ROOT / "deploy" / "auto-deploy.sh").read_text() + manual_deploy = (REPO_ROOT / "deploy" / "deploy.sh").read_text() + + assert 'LEOCLEAN_SKILLS_DIR="/home/teleo/.hermes/profiles/leoclean/skills"' in auto_deploy + assert 'hermes-agent/leoclean-skills/vps/' in auto_deploy + assert 'add_restart_if_unit_active leoclean-gateway' in auto_deploy + assert 'VPS_LEOCLEAN_SKILLS="/home/teleo/.hermes/profiles/leoclean/skills"' in manual_deploy + assert 'hermes-agent/leoclean-skills/vps/' in manual_deploy + assert 'systemctl is-active --quiet leoclean-gateway.service' in manual_deploy