Skip to content

feat(bot): add a /status command that names the failing layer - #87

Merged
matthew-demidoff merged 2 commits into
masterfrom
feat/bot-status-command
Sep 6, 2026
Merged

feat(bot): add a /status command that names the failing layer#87
matthew-demidoff merged 2 commits into
masterfrom
feat/bot-status-command

Conversation

@matthew-demidoff

Copy link
Copy Markdown
Member

Summary

  • /status in the alert chat (or from the admin in a private chat) replies with a layer-by-layer breakdown and a verdict: UP, DEGRADED or DOWN, plus the layer to blame (host app, worker, tunnel, Cloudflare edge) or a note that a remaining failure is on the caller's side
  • the bot probes the app's readiness from inside, cloudflared's /ready, the external monitor's recorded state, and Cloudflare's public status page, in parallel with bounded timeouts; the request path is walked from the origin outwards and the first broken layer wins
  • the monitor Worker gains a token-gated GET /status returning its checks and heartbeats with its own clock, so heartbeat ages do not depend on the host clock
  • node index.js --status prints the same report from a shell; the command is ignored outside the gated chats
  • compose passes ALERT_TELEGRAM_CHAT_ID, MONITOR_STATUS_URL and CLOUDFLARED_READY_URL to the bot; CI builds the bot image and imports the new module; docs and runbook updated, including a --no-deps note for rebuilding the worker or bot without recreating the app

Verification

  • unit tests cover the command gate and every verdict branch (host down, unreachable app, tunnel without connections, edge failure with a Cloudflare incident, stale worker, unreachable or unconfigured monitor, shell run)
  • deployed: the Worker route answers 404 without, with a wrong token, or on POST, and 200 JSON with the right token; docker compose exec bot node index.js --status in production printed a complete report with all layers ok and Cloudflare's current minor incident shown

In the alert chat (or from the admin in private), /status probes each layer between a user and the service and blames the first broken one: the app's readiness from inside, cloudflared's edge connections, the public probes and heartbeats as the external monitor sees them, and Cloudflare's own status page. The Worker gains a token-gated GET /status that returns its recorded state. node index.js --status prints the same report from a shell.
@matthew-demidoff
matthew-demidoff merged commit f1ab249 into master Sep 6, 2026
5 checks passed
@matthew-demidoff
matthew-demidoff deleted the feat/bot-status-command branch September 6, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant