Skip to main content

report-alert

report-alert is an internal, scheduled-caller-only fallback notification for a blocked or degraded SABLE report. It exists so a report that cannot complete still tells someone, using the same approved Resend sender and recipient allowlist board delivery uses - there is no path for a caller to supply its own recipients.

Access

Only a cron caller (isCronCaller, verified with x-cron-secret) may invoke this function - there is no admin/lead JWT path, because this is not a UI-triggered action.

Delivery mode: shadow vs. live

{ "delivery_mode": "shadow" }

In shadow mode, the alert goes to only the first recipient in the allowlist - a controlled test of the alert path without paging everyone. In live mode, it goes to the full recipient list from BOARD_RECIPIENTS. Anything other than an explicit "live" value defaults to shadow.

Payload

FieldPurpose
kindWhat kind of report is alerting (defaults to "scheduled")
report_dateThe report date the alert concerns
phaseWhich workflow phase failed
messageHuman-readable reason, capped at 1000 characters
coverageOptional connector-coverage detail, capped at 1000 characters
dedupe_keyDefaults to kind:report_date:phase - used to avoid re-alerting on the exact same failure

The function fails closed (503) if RESEND_API_KEY, RESEND_FROM, or the recipient list is not configured - an alert about a broken report should never itself depend on a misconfiguration succeeding silently.

Where it's called from

Trigger.dev's report pipeline calls this as its own fallback when the primary board-generation workflow cannot complete - see Board Reliability And Cutover for the pipeline this backstops, and Incident Response for how a missing alert channel is treated (fail loud, not silently pass).

Where the code lives

  • sable-agents-demo/supabase/functions/report-alert/index.ts
  • sable-agents-demo/supabase/functions/_shared/cron_auth.ts - isCronCaller
  • sable-agents-demo/trigger/reports.ts, watchdog.ts