From 80bb60f24b4449bd1d1bd514261406d9d2a4cfa2 Mon Sep 17 00:00:00 2001 From: codex Date: Wed, 26 Aug 2026 21:53:10 +0200 Subject: [PATCH] ops: harden v20r1 monitor (correct hyperliquid-testnet.xyz host, DNS-aware venue-truth probe, heartbeat-tail dedup) --- prod/ops/v20r1_monitor.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/prod/ops/v20r1_monitor.sh b/prod/ops/v20r1_monitor.sh index 1d8b36f..1a89830 100644 --- a/prod/ops/v20r1_monitor.sh +++ b/prod/ops/v20r1_monitor.sh @@ -1,19 +1,24 @@ #!/usr/bin/env bash -# v20r1 monitor — sandbox ops helper (now repo-tracked: prod/ops/). +# v20r1 monitor — sandbox ops helper (repo-tracked: prod/ops/). # Run anytime to snapshot: process, lease, heartbeat, FORCE_ENGAGE cadence, -# and independent HL testnet truth (unsigned /info — same source of truth the -# kernel's HlVenueTruthSupplier uses). Testnet-only; reads only. +# and independent HL testnet truth (unsigned /info — the same host the kernel's +# HlVenueTruthSupplier reads: hl/venue_truth.py + hl/instrument_provider.py). +# Testnet-only; reads only. No system code/data is touched by this helper. # # Usage: /mnt/dolphinng5_predict/prod/ops/v20r1_monitor.sh (or from anywhere) # -# NOTE: v20r1-specific constants (signer, spool, PIDs) are hardcoded; when a new -# campaign boots, bump ADDR/SPOOL and the PID pair in section [1]. +# NOTE: v20r1-specific constants (signer, spool, PIDs, HL host) are hardcoded; +# when a new campaign boots, bump ADDR/LOG/PID_*. The HL host is the canonical +# testnet hostname from prod/hl/config.py resolve_urls() => 'api.hyperliquid-testnet.xyz' +# (liquid, NOT 'hyperlight'). A typo'd host resolves as NXDOMAIN and would +# silently block venue truth — see section [5] error handling below. set -u ADDR="0x6af790574E5E9EA067FB4Ce7458B429039cE3f96" LOG="/root/dolphin_logs/uv_journal_runs/f13_terminal_slot_release_v20r1_20260826/runner.log" LEASE="/tmp/flight13_hl_testnet_single_writer.lock" PID_WRAPPER=790059 # `timeout --signal=TERM 8h launch_flight13_testnet.sh` PID_KERNEL=790060 # `/root/uv-wt/f13-hl/.f13_boot.py` +HL_API="https://api.hyperliquid-testnet.xyz/info" # canonical testnet host (liquid, not hyperlight) echo "=== v20r1 @ $(date -u +%FT%TZ) ===" @@ -23,22 +28,22 @@ ps -p "$PID_WRAPPER","$PID_KERNEL" -o pid,ppid,stat,etime,args 2>/dev/null || ec echo "[2] EXCLUSIVE-WRITER LEASE (${LEASE})" ls -la "$LEASE" 2>/dev/null && cat "$LEASE" 2>/dev/null || echo " !! lease file absent" -echo "[3] HEARTBEAT (runner.log tail — TPSL ticker + latest BAR)" -tail -n 12 "$LOG" 2>/dev/null | grep -vE "RuntimeWarning|stddev|warnings.warn|c /= stddev|numpy" || echo " (log unreadable)" +echo "[3] HEARTBEAT (runner.log tail — TPSL ticker + latest BAR; stale-metadata noise excluded here, surfaced in [6])" +tail -n 12 "$LOG" 2>/dev/null | grep -vE "RuntimeWarning|stddev|warnings.warn|c /= stddev|numpy|stale.*metadata" || echo " (log unreadable)" echo "[4] FORCE_ENGAGE cadence (synthetic SHORT firehose)" printf ' synthetic-enter log lines: '; grep -c "FORCE_ENGAGE: SYNTHETIC ENTER" "$LOG" 2>/dev/null || echo 0 grep "in_flight=" "$LOG" 2>/dev/null | tail -n 1 | sed 's/^/ last in_flight: /' -echo "[5] INDEPENDENT HL TESTNET TRUTH (unsigned /info) — signer ${ADDR}" -# Probe captures curl exit+http code separately from the body so a DNS/TLS -# outage (the current failure mode: api.hyperlight-testnet.xyz NXDOMAIN across -# resolvers) is reported as UNREACHABLE — not a misleading JSON parse error. +echo "[5] INDEPENDENT HL TESTNET TRUTH (unsigned /info) — signer ${ADDR} @ ${HL_API}" +# Capture curl exit + HTTP code SEPARATELY from the body so a DNS/TLS failure +# prints UNREACHABLE — not a misleading JSON "Expecting value" parse error +# (which previously masked a bad hostname as a parse quirk). _hl_info() { # $1 = HL /info type (openOrders | clearinghouseState | userFills | allMids) local ef bf code rc ef=$(mktemp); bf=$(mktemp) code=$(curl -sS --max-time 12 -o "$bf" -w "%{http_code}" \ - -X POST https://api.hyperlight-testnet.xyz/info \ + -X POST "$HL_API" \ -H 'Content-Type: application/json' \ -d "{\"type\":\"$1\",\"user\":\"$ADDR\"}" 2>"$ef"); rc=$? if [ "$rc" -ne 0 ] || [ "${code:-000}" = "000" ]; then