Files
loki/scripts
CatoandClaude Sonnet 5.5 6142cb16f2 feat(ops): tell the operator when the gateway behind WhatsApp and Telegram dies (#1214)
* feat(ops): tell the operator when the gateway behind WhatsApp and Telegram dies

WhatsApp and the Telegram chat are both carried by the OpenClaw gateway
on bitbaum; Loki has no inbound channel of its own. It died on
2026-10-08 (the box rebooted, the openclaw user's systemd manager stayed
dead) and nothing said so for a week: the host health sweep had stopped
watching it the same day, believing it retired. Forwarding a message to
WhatsApp for the calendar just stopped working.

A check-gateway cron (every 10 min) probes the gateway. Any HTTP answer
is up; a refused connection or a timeout is down. Down raises one
gateway_down alert per outage (deduped) and one Telegram message — sent
through the Bot API directly, so it works while the gateway is the thing
that is down — naming the fix (run the "OpenClaw gateway up" workflow).
When it answers again the alert falls and one recovery message says so,
so the next outage is not swallowed by a flag that never fell.

Pure logic (lib/gateway-health.ts) is pinned by scripts/test/
gateway-health.ts, including that the probe uses a referenced timer (the
first version of the test "passed" by never finishing, because
AbortSignal.timeout's timer is unreferenced). The alert type is
registered with its producer, the timer is installed by
install-hetzner-crons.sh, the Telegram sender has its registry row, and
the cron calls no model (no-free-background-ai walks it).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJJp6XiUkeEVzjDaBmWjL3

* docs(changelog): gateway-down alert

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-15 05:33:28 -07:00
..
…
…
…