From 80c1f8bdfe3ba6ebc5e0e5e9bc1cd888d6d899a9 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 4 Dec 2026 16:26:05 +0000 Subject: [PATCH] Status: count forge post failures over the last hour, and a runbook line per /status field (sc-9145) forge_posts_failed counted the last day, so one failure held an alert red for a day and hid the next. docs/deploy.md's Monitoring section listed fields /status no longer has; it now gives every field's Gatus condition, what a red check means and what to do, and why the rest don't alert. The webhook redelivery and platform addresses heartbeats join the scheduler list. --- app/src/http/status.rs | 7 +++-- docs/deploy.md | 63 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/app/src/http/status.rs b/app/src/http/status.rs index a918694d..8b85d8b8 100644 --- a/app/src/http/status.rs +++ b/app/src/http/status.rs @@ -184,7 +184,7 @@ async fn numbers() -> laravel::Result> { AS empty_groups, \ (SELECT COUNT(*) FROM gallery_purge_failures WHERE created_at > now() - interval '7 days')::BIGINT \ AS gallery_purges_failed, \ - (SELECT COUNT(*) FROM failed_jobs WHERE failed_at > now() - interval '24 hours' \ + (SELECT COUNT(*) FROM failed_jobs WHERE failed_at > now() - interval '1 hour' \ AND (payload LIKE '%forge.check%' OR payload LIKE '%forge.pr_comment%'))::BIGINT AS forge_posts_failed, \ (SELECT COUNT(*) FROM jobs WHERE attempts >= 3 \ AND (payload LIKE '%forge.check%' OR payload LIKE '%forge.pr_comment%'))::BIGINT AS forge_posts_retrying, \ @@ -223,9 +223,10 @@ async fn numbers() -> laravel::Result> { "empty_groups": get("empty_groups")?, // Gallery purges that used up their retries in the last week: Cloudflare may serve stale screenshots. "gallery_purges_failed": get("gallery_purges_failed")?, - // Checks and pull request comments the forge refused until they used up their retries, in the last day: a pull + // Checks and pull request comments the forge refused until they used up their retries, in the last hour: a pull // request then waits for a VisualCI check that never comes. Always 0 (3 Dec 2026: GitHub refused every check - // waiting for review for hours, and nothing alerted). + // waiting for review for hours, and nothing alerted). An hour, not a day, so one failure alerts for an hour and + // then clears, rather than hiding the next one for a day (sc-9145). "forge_posts_failed": get("forge_posts_failed")?, // Posts on their third try or later, still retrying: a refusal that's about to become a failure. "forge_posts_retrying": get("forge_posts_retrying")?, diff --git a/docs/deploy.md b/docs/deploy.md index c2f11158..b8a2916c 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -103,14 +103,66 @@ GitLab is parked in app/: production sets none of its variables (`GITLAB_CLIENT_ ## Monitoring -- Gatus on `https://api.visualci.com/status`: `[STATUS] == 200`, `[BODY].oldest_render_seconds < 900`, - `[BODY].oldest_processing_seconds < 1800`, `[BODY].oldest_unnotified_feedback_seconds < 3600` (feedback not yet emailed to support; 0 without email), `[BODY].oldest_unnotified_signup_seconds < 3600` (a new sign-up the team wasn't told about; the email goes when the person answers "How did you hear" or ten minutes after sign-up), `[BODY].oldest_forge_sync_seconds < 7200`, `[BODY].oldest_receiving_seconds < 7200` (a GitHub-derived membership not rechecked by the hourly forge sync). A stuck renderer shows as an old queued render; a stuck worker as a build - stuck processing. Alerts go where the cluster's go, with an agent listening. +Gatus (talira-ai/infra `k3s/resources/gatus/internal.yaml`, applied by talira infra) checks +`https://api.visualci.com/status` every minute and alerts to Matrix `#infrastructure-alerts`, where an agent listens. +`[STATUS] == 200` on every check. One line per field: the condition, what a red check means, and what to do. + +- `oldest_render_seconds < 900`: a render queued for 15 minutes. The renderers stopped polling or all crashed: check + the renderer pods' logs and restarts, and `renders_queued`. +- `oldest_processing_seconds < 600`: a build processing for 10 minutes (a healthy one takes seconds). A worker is + stuck or there are too few of them: check the worker pods, then `visualci-app queue:failed`; the builds sweep runs + a build again 3 minutes after its last progress. +- `oldest_receiving_seconds < 7200`: a build still receiving after two hours. The builds sweep (every minute) fails + one after an hour without uploads, so the sweep or the scheduler stopped: check the scheduler pod and the + "Abandoned builds" heartbeat. Under two hours is a normal abandoned upload waiting for the sweep. +- `oldest_forge_sync_seconds < 7200`: a GitHub-derived membership unchecked for two hours. The hourly forge sync + stopped or keeps failing: check the "Forge access sync" heartbeat and the scheduler's logs. +- `empty_groups == 0`: a build reads a group of snapshots from another build that has no rows for it: lost data. + Run `visualci-app groups:check` for the builds named, and find what deleted the rows before fixing the build. +- `live_listener != stale`: the web pod's LISTEN connection stopped hearing its own probes, so open pages and + `--wait` hear nothing. Restart the web pod named in the logs, then look for the database connection drop. +- `stalled_repository_import_seconds < 600`: a repository pick with no progress for 10 minutes. The worker stopped or + the job died: check the worker pods and `queue:failed`. +- `oldest_sign_in_sync_seconds < 120`, twice in a row: a GitHub sign-in's repository listing waiting two minutes. The + `sign-in` queue's worker (worker-sign-in) is stuck or gone: restart it. +- `oldest_deleted_project_unpurged_seconds < 691200`, every 5 minutes, twice in a row: a deleted project past 8 days + and not purged, so its data outlives the promise. The queued purge and the daily 02:00 sweep both stopped: check + `queue:failed` and the scheduler, then purge it. +- `forge_posts_failed == 0`: a check or pull request comment GitHub refused until its retries ran out, in the last + hour; a pull request then waits for a check that never comes. Read the job's error in `failed_jobs`: a 422 or 403 + is usually the GitHub App's permissions or a check GitHub won't accept; retry with `queue:retry ` once fixed. + It clears an hour after the last failure. +- `oldest_access_recheck_seconds < 5400`: someone a webhook queued for an access recheck has waited 90 minutes. The + debounced recheck takes them in about 2 minutes and the hourly forge sync anyway, so both stopped: check the + worker and the forge sync heartbeat. +- `oldest_deferred_webhook_seconds < 600`, twice in a row: a GitHub delivery held over its installation's rate limit + has waited 10 minutes. The drain (every minute) stopped, or one installation is flooding: check the scheduler and + which installation the deferred rows belong to. +- `github_hook_addresses_seconds >= 0` and `< 7200`: GitHub's webhook source addresses weren't refreshed for two + hours (`-1`: never read), so new GitHub addresses would be refused. The five-minute refresh is failing: check the + scheduler's logs for `RefreshGithubHookAddresses` and that `api.github.com/meta` answers. +- `platform_addresses_seconds >= 0` and `< 172800`: OpenAI's published egress ranges weren't refreshed for two days + (`-1`: never read), so agent platforms' address checks run on old ranges. The hourly refresh is failing: check its + heartbeat ("Platform addresses") and the scheduler's logs. + +Fields with no alert, and why: + +- `renders_queued`, `builds_processing`, `live_streams_open`, `last_render_seconds_ago`: load, not failure; the ages + above alert on the same problems without paging on a busy hour or a quiet night. +- `forge_posts_retrying`: posts still retrying, which most often succeed; the ones that don't show in + `forge_posts_failed`. +- `gallery_purges_failed`: a 7-day count, so one failure would hold a check red for a week; it's a Prometheus warning + (`k3s/resources/visualci/podmonitors.yaml`) instead. +- `oauth_registrations_refused_last_hour` and `oauth_platform_unverified_used_today`: refused registrations are the + limits doing their job; they're for investigating a report, and a limit that needs raising shows as a support + request first. +- `commit`, `ok`: what's deployed, and that the body was built. + - The CNPG backup heartbeat, as Talira's. - The scheduler (`schedule:work`; `app/src/console/mod.rs` and the `schedule.job` calls next to each job) runs these, each pushing its result to its own Gatus external endpoint (`VISUALCI__HEARTBEAT_URL` and `_TOKEN`), which alerts on a failed run and on a run that doesn't come: - - every five minutes, the builds sweep (`BUILDS_EXPIRE`, "VisualCI / Abandoned builds"): fails builds that received + - every minute, the builds sweep (`BUILDS_EXPIRE`, "VisualCI / Abandoned builds"): fails builds that received nothing for an hour and concludes their checks, closes idle local builds and runs stuck ones again; `oldest_receiving_seconds` on `/status` stays under two hours while it runs. A project's new build also expires its own abandoned ones, and the GitHub App's `workflow_run` webhook closes a build at once when the GitHub Actions @@ -118,6 +170,9 @@ GitLab is parked in app/: production sets none of its variables (`GITLAB_CLIENT_ - hourly, the forge sync (`FORGE_SYNC`, "VisualCI / Forge access sync"): rechecks every GitHub-derived membership, unlinks projects whose linker lost the repository and closes deleted branches; `oldest_forge_sync_seconds` on `/status` also catches a person left unchecked; + - every ten minutes, webhook redelivery (`WEBHOOK_REDELIVERY`, "VisualCI / Webhook redelivery"): asks GitHub to + deliver again what it failed to deliver; hourly, the platform addresses refresh (`PLATFORM_ADDRESSES`, + "VisualCI / Platform addresses"): reads OpenAI's published egress ranges; - every five minutes, email delivery (`EMAILS`); every minute, sign-up notices (`SIGNUPS`) and the live-update check (`LIVE`); daily, device sign-in pruning (`DEVICE_PRUNE`); - daily at 03:00 UTC, image retention (`retention:prune`, `RETENTION`); at 04:00, the groups check (`groups:check`,