Skip to content

alert-rules-evaluator: cron ticks skipped (~48 min gap on 2026-10-21) #852

Open

Description

@unjica

Railway deploy logs for the alert-rules-evaluator service show the cron container starting every ~5 min, then no start between 07:10:33Z and 07:58:56Z on 2026-10-21 (about 9 missed ticks). The api's /health reports alert_rules_evaluator ok during this time, so health doesn't detect skipped ticks.

The logs only show 'Starting Container' with no per-tick output, so the cause is unknown: a Railway cron skip, or an overlapping or hung run.

Acceptance:

  • Log a start/finish line per tick with duration and the number of rules evaluated.
  • Make /health (or a staleness check) report stale when the last completed tick is more than 15 min old.
  • Investigate whether a run can hang (timeouts on DB and webhook calls) and add a run timeout.

Reported by the Competitor & Pain-Point Monitor and confirmed from the Railway logs.

Activity

  1. unjica commented on Oct 21, 2026

    @unjica
    CollaboratorAuthor

    QA verification 2026-10-21 (CEST), prod 1.22.12, deployment b6e226b9 unchanged, no redeploy/restart/config change.

    Cadence: Railway "Starting Container" at 11:31:28, 11:35:39, 11:40:23, 11:45:52, 11:50:06, 11:55:24, 12:00:53, 12:05:14, 12:10:25, 12:15:29 and 12:20:48. That's 11 ticks with a max gap of 5:29, none over 8 min. The previous tick was 09:10:26, so the stall lasted about 2h21m.

    E2E alert: a QA NO_EVENTS rule (5 min window) created at 11:45:41 fired at 11:45:52. Exactly one email arrived (From and Reply-To [email protected], DKIM resend) and exactly one webhook with a valid x-telemetry-signature. The delivery record is SUCCESS, attempt 1, HTTP 200. No duplicates through 12:22. Rule and webhook deleted.

    Still open here: /health has no timestamp or stale check. The evaluator logs nothing after "Starting Container" (no result or duration), and there's no per-run timeout. The stall cause is still unproven.

  2. unjica commented on Oct 30, 2026

    @unjica
    CollaboratorAuthor

    Tracking on the Telemetry Tracker Development project (P1, Backlog).

    • Development: Grok Bot (Dev & Releases)
    • Reproduction and verification: QA / Product Reliability
    • Next step: QA reproduction of the missed ticks. Development starts once it's reproduced.
  3. unjica commented on Oct 30, 2026

    @unjica
    CollaboratorAuthor

    QA repro attempt 2026-10-30 (CET), prod API v1.22.25. Read-only: no infra, config or deploy changes. Existing QA project only.

    Expected cadence (repo): Railway cron */5 * * * * (docs/RAILWAY.md, docs/RELEASE.md). ALERT_RULES_SCHEDULE_INTERVAL_MINUTES defaults to 5. /health → alert_rules_evaluator reports stale when the last heartbeat is older than 2× the interval (apps/api/src/lib/health.ts, readAlertRulesEvaluatorStatus).

    Method: I created NO_EVENTS rules (5 min window, for an event that's never sent) one after another. Each rule fires on the first evaluator tick after it's created, so each firedAt marks one tick. Rule N+1 was created right after rule N fired, and each rule was deleted after it fired. I polled alert-events every 10 s and /health every ~30 s.

    Run Rule created firedAt (CET) Gap from previous tick
    1 18:16:57 18:20:30 n/a
    2 18:20:49 18:25:36 5:06
    3 18:25:54 18:30:59 5:23

    /health: 25/25 readings ok on 1.22.25 (18:16–18:31).

    Result: not reproduced on current prod. Ticks land at the expected ~5 min cadence, plus Railway start jitter, with no skipped tick in this window. This is a ~15 min sample, so it can't rule out an intermittent stall like the 2026-10-21 ones (about 48 min, then about 2h21m).

    Notes for the acceptance items (code on main e5ece31, not verified on prod logs):

    • The stale check already exists in code (threshold 2× interval = 10 min). The 10-21 report says /health stayed ok during the gap, which doesn't fit that threshold unless the API's interval setting differs or a heartbeat was written. Worth checking before adding a new check.
    • The CLI prints one JSON result line per sweep, but the 10-21 Railway logs showed nothing after "Starting Container". Worth confirming that the log line reaches Railway.
    • There's still no per-run timeout in run-alert-rules-evaluator.ts.

    Test rules are deleted. QA will re-verify after any fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions