openclaw-watchdog

Watchdog for Rob’s OpenClaw gateway — 5-min root cron, /opt/scripts/openclaw-watchdog.sh, shared state/alert lib watchdog-lib.sh (/var/run/watchdog-state.json, log /var/log/openclaw-watchdog.log).

v4 (2026-07-26, commit f9f664e): WhatsApp CHANNEL health. The 2026-07-23 session revocation went unalerted for 3+ days — the container stayed healthy so Checks 1–8 never fired, while the gateway logged “session logged out” once then “health-monitor: skipping restart, terminal disconnect” every 5 min.

  • Check 10 — terminal disconnect / logged out: greps the last 20 min of gateway logs; the last matching event (session logged out | terminal disconnect | starting provider) decides state, so a re-pair counts as recovery even with stale disconnect lines in-window. No auto-heal possible (human must re-link) — alert only.
  • Check 11 — wrong-account pairing: compares the most recent starting provider (+N) line (full log history) against Rob’s expected +16672742864. Added because the 2026-07-26 re-pair linked +12028683616 and the provider-start log line was the only tell.
  • Alerting: both SMS Dustin directly via Telnyx (rob-heartbeat pattern; creds from /opt/unlikely-api/.env, payload via temp file) — deliberately NOT send_alert(), whose API→WhatsApp path is exactly what’s broken during a channel outage. Once per outage + recovery SMS, deduped via state fields wa_channel_down.sms_alerted / wa_wrong_account.alerted_number. WATCHDOG_SMS_DRY_RUN=1 for testing.

Verified live 2026-07-26: 23:35 run caught the (real, ongoing) wrong-account pairing and sent one SMS; 23:40 run detected again, sent nothing (dedupe).

v3 (2026-04-29) context: gateway-only architecture; liveness is rob-heartbeat.sh’s job.

Related: Docker-Stack, scheduler-watchdog