#!/bin/zsh # Push perfcheck to the m4mini watchdog, where the nightly godcheck cron runs it. # # Idempotent — re-run it whenever bench.py or run_fleet.py changes, otherwise the fleet keeps # being measured by the old benchmark. Accumulated state (history/baselines/pending) is NEVER # overwritten: on the first deploy the local history is seeded across so the baselines carry # over, and after that the m4mini's copy is authoritative. # # Lives beside godcheck (~/godcheck/perfcheck) rather than in ~/MODELBEAST, to match how # godcheck itself is a standalone script and to keep the cron independent of the repo state. set -u W=m4mini@100.124.220.31 DEST=godcheck/perfcheck HERE=${0:A:h} echo "==> deploying perfcheck to $W:~/$DEST" ssh -o ConnectTimeout=10 -o BatchMode=yes "$W" "mkdir -p ~/$DEST" scp -q "$HERE/bench.py" "$HERE/run_fleet.py" "$W:$DEST/" ssh -o ConnectTimeout=10 -o BatchMode=yes "$W" "chmod +x ~/$DEST/run_fleet.py" # Seed history only if the watchdog has none, so a redeploy never clobbers real history. # # Tested on OUTPUT, never on ssh's exit status: the m4mini is the one node in the fleet with # Tailscale SSH enabled (`RunSSH: true`), and tailscaled handles the session itself rather than # sshd — it does not propagate the remote exit code. `ssh m4mini "exit 7"` returns 0, so every # `if ssh m4mini test ...` silently succeeds. Every other node propagates correctly. (godcheck # is output-based throughout and is unaffected.) have=$(ssh -o ConnectTimeout=10 -o BatchMode=yes "$W" "test -s ~/$DEST/history.jsonl && echo YES") if [ "$have" = "YES" ]; then echo "==> watchdog already has history — left untouched" elif [ -s "$HERE/history.jsonl" ]; then echo "==> seeding history.jsonl (first deploy)" scp -q "$HERE/history.jsonl" "$W:$DEST/" fi echo "==> smoke test (one node)" ssh -o ConnectTimeout=10 -o BatchMode=yes "$W" "cd ~/$DEST && /usr/bin/python3 run_fleet.py --only m4mini --quiet" echo "==> done"