Skip to content

fix: show whether the scheduled alert evaluator is running - #683

Merged
cursor[bot] merged 1 commit into
developfrom
cursor/alert-rules-evaluator-f4fb
Sep 25, 2026
Merged

cursor[bot] merged 1 commit into
developfrom
cursor/alert-rules-evaluator-f4fb

Conversation

@unjica

@unjica unjica commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Base branch: open feature and fix PRs against develop. Do not merge to production until the Railway cron below exists.

Summary

TT-010 is a missing production service, not a bug in rule evaluation. NO_EVENTS and HEARTBEAT only run inside runScheduledAlertRuleEvaluation. Production Railway statuses on v1.17.20 (and earlier releases) list api, dasboard, retention-cron, and alert-webhook-worker. There is no alert-rules-evaluator service, and the repo does not auto-provision one.

This PR does not move evaluation into the API process. Each successful evaluator sweep writes a ScheduledJobHeartbeat row. GET /health (when HEALTH_CHECK_DATABASE=true) adds alert_rules_evaluator: ok, stale, or never. That field does not change ok or the HTTP status, so a missing cron cannot take the API down.

ERROR_COUNT, NEW_ERROR_GROUP, and AFFECTED_USERS stay ingest-only.

Railway step required before this helps production

Create a new service. Do not reuse brief-worker, the API, or retention.

Setting Value
Root Directory apps/api
Builder Railpack
Start command node dist/jobs/run-alert-rules-evaluator.js
Cron */5 * * * *
DATABASE_URL Same as the API

After the first successful run, logs should include "job":"alert-rules-evaluator","ok":true, and /health should show "alert_rules_evaluator":"ok".

How to test

pnpm lint && pnpm test && pnpm build

Checklist

  • Tests pass
  • Lint passes
  • Build succeeds
  • CHANGELOG [Unreleased]
  • Migration 20260925170000_scheduled_job_heartbeat (API migrates before listen)
  • Not deployed

Security / privacy

Heartbeat stores only a job name and timestamp. No alert payloads.

Open in Web Open in Cursor 

Scheduled rules never fire unless the separate evaluator cron runs.
Each successful sweep now writes a heartbeat that /health reports
without failing the API when the cron is missing.

Co-authored-by: Sanja Malovic <[email protected]>
@unjica
unjica marked this pull request as ready for review September 25, 2026 17:35
@cursor
cursor Bot merged commit c36c72f into develop Sep 25, 2026
9 checks passed
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.

2 participants