Files
loki/docs/telegram-notifications.md
CatoandClaude Opus 5.5 3af2fec589 fix: what the Farmhouse end-to-end test broke — Live link, stuck Claude dialog, owner wording (#938)
* fix(sites): a site that goes live after registration is recorded, and its owner told

Registration wrote the live URL only if the site answered at that moment.
Farmhouse's first deploy failed, a later one succeeded, and nothing looked
again: no live URL, a Live link that opened the OrangeCat listing, and no word
to the owner. An hourly check (and the owner opening the project page) now
asks the same question registration asks and, the first time the answer is
yes, sends the owner their link that readies the widget.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(telemetry): six crons run hourly now that check-site-live does

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(runner): a Claude session showing a dialog is cleared before a prompt is sent into it

Farmhouse's parked session sat on Claude Code's "Teach auto mode about your
environment?" dialog. The owner's widget note was injected into the dialog,
nothing ran, and the run was NACKed 33s later while the widget said "On it".
Claude reports this itself ({status: waiting, waitingFor: "dialog open"}); the
runner now presses Escape and, if the dialog stays, starts a fresh session.

Also: on the box every live-session lookup used the dispatch's laptop path,
which no session has, so the generation check fell back to guessing from
screen activity. They now use the folder the agent really runs in, and the
reader accepts current CLIs' updatedAt.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(widget): owner mode reads as the owner's, and the agent is told the owner asked

The widget no longer asks the owner for a name/email and says what happens
("Your site: what you say here gets built and goes live"). The agent's brief
now opens with "The owner of <project> asked for this change" instead of
"Fix this visitor feedback" — still fenced as text from a browser.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(desktop): 0.8.35 — ships the dialog-clearing runner fix to Fleet Runner too

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(changelog): Fleet Runner 0.8.35

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 04:27:44 -07:00

13 KiB
Raw Permalink Blame History

Telegram notifications — the registry

This file is the SSOT for everything that reaches the operator's Telegram. If something pings the phone and is not listed here, that is a bug — and CI enforces it: scripts/ci/check-telegram-registry.sh fails when a file in this repo sends to Telegram (directly, via telegram-send.ts, or via the box's lib-alert.sh) without being registered below. Adding a notification = adding it here in the same PR. Removing one = removing its row.

The channel's contract (PR #443/#444): a message is worth sending only if the operator must act on it, wants the outcome, or asked for the digest. One incident is one message; reminders back off (30m → 2h → 8h → daily); recoveries name subjects, never keys; N events on one tick digest into one message; test runs (ALERT_DRY_RUN=1) never deliver.

Requested updates (the operator asked for these — keep them)

What arrives Trigger Source
📨 New visitor feedback (project, excerpt, link to inbox) A genuine visitor submits the feedback form (POST /api/feedback; AI/synthesizer filings stay silent) src/lib/feedback/notify-new.ts
✅ A fix reached the live site, or 🚨 a merged fix failed to deploy (project, the visitor's words, the pull request, the live page) The fix ledger sees a run's pull request TRANSITION into deployed or deploy-failed while the inbox is read — once per fix, never on re-reads. Says when Loki merged it automatically, because that is the fact an operator needs to keep trusting the switch src/lib/feedback/notify-shipped.ts
🌐 <project> is live (the site URL, plus the owner's link that readies the widget so what they say there gets built) A project with a repository but no live URL is found live — a green deploy of main AND a public response — by the hourly check-site-live cron or when the owner opens the project page. Once per project: the live URL it writes is what stops the check. Operator's own projects only; other owners get the same as a push src/lib/site-live-reconcile.ts
🧾 Waitlist signup / 📬 New subscriber (source, address) Someone joins a list via POST /api/newsletter — the studio site's /hire/ waitlist sends source: bitbaum-hire. Only a genuinely NEW row announces; a repeat signup stays silent. The operator must act on it: the page promises a human writes back when capacity opens src/lib/newsletter/notify-signup.ts
Run outcome: what an agent run concluded (root cause → action → remains) An orchestration run with notifyOnClose closes — includes every incident-dispatch remediation run src/lib/orchestration/notify-close.ts, src/lib/orchestration/gate-and-close.ts
Morning brief, evening wrap, weekly reflection, Monday digest, email deadlines, financial scan, life scorecard Loki's scheduled jobs — schedules live in their own SSOT: /home/openclaw/.openclaw/cron/jobs.json on bitbaum (edit via Loki, not here) off-repo: OpenClaw cron

Incidents (something is broken; a fix agent is already dispatched)

What arrives Trigger Source
🔴 DOWN: <unit> — <app error> → 🤖 fix agent dispatched A systemd unit fails and stays failed past the grace window scripts/hetzner/install-host-alerts.sh (notify-failure.sh)
⚙️ STILL FAILING: a; b (digest) / ✅ RECOVERED: a; b (digest) The 5-min sweep sees a unit failed on two consecutive ticks / recover scripts/hetzner/install-host-alerts.sh (host-check.sh)
🔧 FIXED (no action needed): <what was repaired> host-check auto-repaired an unreadable app .env and restarted the app scripts/hetzner/install-host-alerts.sh (host-check.sh)
💾 DISK / 🧠 MEM / 🐘 POSTGRES transitions Resource crosses its hysteresis band on the box scripts/hetzner/install-host-alerts.sh (host-check.sh)
🔴 DOWN: <app> (<url>) → HTTP <code> / ✅ RECOVERED (on-box) An app URL in targets.conf stops answering scripts/hetzner/install-watchdog.sh (watch.sh; also the external dead-man's-switch ping)
🔴 DOWN: <app> (<detail>) / ✅ RECOVERED: <app> (off-box) GitHub-side health sweep of every registered app — still reports when bitbaum itself is dead .github/workflows/fleet-uptime.yml (probe: scripts/hetzner/uptime-sweep.sh)
🚨 Loki deploy: <failure/rollback> A loki deploy fails or rolls back scripts/deploy-hetzner.sh
🧩 <app>: <runtime conformance finding> Deployed reality diverges from the register (wrong port, dead tunnel, inactive unit) scripts/hetzner/install-runtime-conformance.sh
🧪 <provider/model>: <n> failure(s) in 24h A model link keeps failing while the fallback chain hides it — Groq answered 400 to every structured Cat call for days and nothing said so scripts/hetzner/ai-provider-check.sh (installed by scripts/hetzner/install-ai-provider-watch.sh)
🧪 loki e2e FAILED: … / ✅ RECOVERED End-to-end check of the live site as the operator, ON DEMAND only since 2026-09-25 (no timer: it sends a real chat turn, and a timer may not spend the shared free AI tier): fleet question answered from the map, map published, dispatch returns to its thread (when the builder is authenticated) scripts/hetzner/loki-e2e-check.sh (installed by scripts/hetzner/install-loki-e2e-watch.sh; test: scripts/test/loki-loop-e2e.ts)
🔑 builder auth DISABLED / 🔌 builder probe got no answer / ✅ RECOVERED Hourly probe runs Claude Code with the box-runner’s own token; the token dies with the Claude account that minted it and every dispatch then hangs silently (2026-09-14) scripts/hetzner/builder-auth-check.sh (installed by scripts/hetzner/install-builder-auth-watch.sh)
🚫/🧟 agent-work findings Hourly sweep finds stranded/zombie agent work on the box scripts/hetzner/agent-work-check.sh (installed by scripts/hetzner/install-agent-work-watch.sh)
🧹/🚨 DISK GC non-routine outcome GC ran but the disk is still above the warn mark, or nothing was reclaimable (routine success is journal-only) scripts/hetzner/install-disk-gc.sh
Fleet refs audit findings Deployed refs diverge from expected across the fleet scripts/hetzner/install-fleet-refs-audit.sh
✗ register check findings Daily 09:15 (laptop): committed apps.conf register vs reality — at most one message per finding per day scripts/local/fleet-register-check

Threat detection (something changed that only an operator can judge)

Baselines are seeded silently on the first run; every row below fires on CHANGE only and ends with what to do. Blocking a web scanner is a response, not a message (fail2ban caddy-scan, journal only).

What arrives Trigger Source
🧱 FIREWALL DOWN / 🛡️ GUARD DOWN / 🔓 SSHD DRIFT / ✅ RECOVERED ufw, fail2ban or unattended-upgrades stops; sshd stops being keys-only (as sshd -T resolves it) scripts/hetzner/install-security-watch.sh (security-check.sh, 5-min timer)
📝 N SENSITIVE FILE(S) CHANGED: a, b, c (+k more) A file an intruder edits to persist changes hash, owner or mode: sshd/sudoers/authorized_keys/shadow/cron/PAM/ld.so.preload/Caddy/ufw/monitoring/systemd units/apt sources — one grouped message per tick scripts/hetzner/install-security-watch.sh (security-check.sh)
🔌 NEW PORT OPEN TO THE INTERNET / 👤 NEW PRIVILEGED ACCOUNT / 🐳 NEW CONTAINER / 🧨 NEW SETUID BINARY A non-loopback listener, a uid-0/shell/sudo/docker account, a container or a setuid binary appears that was not in the baseline scripts/hetzner/install-security-watch.sh (security-check.sh)
🔑 SSH LOGIN as <user> from <ip> / 🚨 SSH PASSWORD LOGIN ACCEPTED A key login from an IP never seen in 30 days of history that is not a GitHub Actions runner (api.github.com/meta, cached daily); any password login at all scripts/hetzner/install-security-watch.sh (security-check.sh)
☠️ SUSPICIOUS PROCESS A process executing from /tmp, /dev/shm or /var/tmp, or a known miner name scripts/hetzner/install-security-watch.sh (security-check.sh)
🗄️ OFFSITE BACKUP STALE / UNREACHABLE / ✅ RECOVERED Newest restic snapshot older than 30h, or restic cannot list them (hourly) scripts/hetzner/install-security-watch.sh (security-check.sh)
♻️ REBOOT PENDING for N days A kernel/security patch has waited on a reboot for more than a week (weekly at most) scripts/hetzner/install-security-watch.sh (security-check.sh)
🕵️ N SECRET(S) IN REPO <repo>: <type>×n / 🛡️ NEW CRITICAL DEPENDENCY ALERT(S) / 🌍 REPO NOW PUBLIC / 🔍 SECRET SCANNING OFF / 🧑‍💻 NEW ACCESS TO THE ORG / 🗝️ NEW DEPLOY KEY / 🎬 ACTIONS POLICY LOOSENED / 🐙 GITHUB CHECK BLIND Daily read of the GitHub org through the box's gh login; secret alerts are read per repo (the org endpoint is blind), forks are skipped, and N new alerts in one repo are ONE message — the per-alert version sent 100 on 2026-09-14. A call the token cannot make is skipped (journal), never read as a value scripts/hetzner/install-security-watch.sh (github-security-check.sh, daily 07:10)
🔌 laptop: NEW PORT / 🔓 laptop: sshd is RUNNING / 🖥️ laptop: screen lock off / 🛡️ laptop: upgrades OFF / 🔑 laptop: ~/.ssh changed / 👤 laptop: NEW LOGIN ACCOUNT / 🐙 laptop: gh identity changed / ♻️ laptop: reboot pending The operator's laptop (box SSH key, admin:org token, transcripts) every 30 min, on change only; delivered through the box's lib-alert.sh over SSH, desktop notification if the box is unreachable scripts/local/laptop-security-check (user timer laptop-security-check.timer)

Loki self-checks (the platform watching itself)

What arrives Trigger Source
Telemetry stale Runner telemetry stops arriving src/app/api/crons/check-telemetry/route.ts
Runner stalled / wrong version Box-runner stops claiming or lags the shipped version src/app/api/crons/check-runner-stall/route.ts, src/app/api/crons/check-runner-version/route.ts
Approvals waiting — with one-tap ✅ Approve / ✕ Reject / ✏️ Edit buttons when exactly one item is waiting, otherwise a link to the queue Proposed actions sit undecided for over an hour; one message per episode, never per draft src/app/api/crons/check-pending-approvals/route.ts
📋 <type> — needs your yes (the decision itself: what, when, where, plus Approve / Reject / Edit buttons) A draft is queued from something the operator asked for in words, and no standing approval covers it. Spontaneous proposals (check-ins, the advisor) never send this — they wait for the hourly digest above src/lib/actions/notify-decision.ts
📅 Booked — <event>, with a link into Google Calendar A calendar event really reaches executed (says so only after gog succeeded, which is usually minutes after approval and in a different process). Names the standing approval when one acted on the operator's behalf, so an action taken without asking is never silent src/lib/actions/notify-decision.ts, called from src/lib/actions/execute-action.ts and src/app/api/actions/drain-events/route.ts
Feedback needs you (stalled Implement / no agent / Check live) A dispatched fix is stuck or live and waiting for Confirm — one ping when the flag goes up src/app/api/crons/check-feedback-needs-you/route.ts, src/lib/feedback/notify-needs-you.ts
Model id rot A configured model id stops resolving src/app/api/crons/check-model-ids/route.ts
Run escalation A run needs the operator's decision to proceed src/db/queries/run-escalations.ts
📊 Ledger-ready (one-shot) Run ledger reaches the improver threshold; self-disables after firing scripts/hetzner/ledger-ready-gate.sh
🏷 Rescale window (hcloud) A bigger Hetzner tier becomes available for migration in fsn1 scripts/hetzner/hcloud-availability.sh

Off-repo senders (registered here, owned elsewhere)

Sender What Its own SSOT
Loki (OpenClaw) Conversation, briefings, reminders — everything conversational /home/openclaw/.openclaw/cron/jobs.json + OpenClaw config on bitbaum
orangecat repo orangecat.ch uptime alerts orangecat/.github/workflows/uptime.yml

Rules for adding a notification

  1. Ask the channel question first: must the operator act, is it an outcome they are waiting for, or did they ask for the digest? If none — journal, not Telegram.
  2. Route through the shared machinery — the only two blessed send paths: lib-alert.sh on the box (installed by scripts/hetzner/install-host-alerts.sh; use alert_once / alert_transition with a human subject) and src/lib/actions/telegram-send.ts in the app (self-only allowlist, fail-closed). A private curl to api.telegram.org repeats the 2026-08-28 register-check double-send and is a reviewable smell.
  3. Add the row here, in the same PR. CI (check-telegram-registry.sh) makes the omission fail loudly.
  4. Test sends never deliver: ALERT_DRY_RUN=1 (box), and never bare-run a sender "to see if it works" — 2026-08-28, a live test rang the phone with a message about nothing.