Skip to content

feat(review): wire the fully-built Discord anomaly-alerting module into the real cron path #8905

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

src/review/alerts.ts's header says "On each cron tick, snapshot agent health and push a THROTTLED Discord alert when something drifts." It has 15+ dedicated test cases (test/unit/alerts.test.ts) covering throttling, claim races, and send paths. Repo-wide grep shows runAnomalyAlerts/src/review/alerts is imported nowhere except its own test -- no cron handler, no route, nothing in src/index.ts references it. It appears to sit alongside (not replaced by) ops-wire.ts's runOpsAlerts (structured log + PagerDuty), which IS wired -- Discord and PagerDuty are different notification channels serving the same underlying anomaly signal.

Requirements

Wire runAnomalyAlerts into the same cron tick that already calls runOpsAlerts, so the built-and-tested Discord alerting channel actually fires alongside the PagerDuty path. Do not delete src/review/alerts.ts as part of this issue -- wiring it in is the requested fix; removal would require a separate confirmation that the channel is genuinely unwanted, which is out of scope here. Note: this issue should land after (or together with) the fix for notification_deliveries table collision, since alerts.ts currently writes to a colliding table name that must be corrected first for this wiring to work correctly (see the linked sub-issue).

Deliverables

  • runAnomalyAlerts is called from the same cron entry point that calls runOpsAlerts
  • A test confirming the cron tick invokes both runOpsAlerts and runAnomalyAlerts

All of the above Deliverables are required in the same PR unless the deliverable text itself states otherwise.

Test Coverage Requirements

src/** -- 99%+ patch coverage, branch-counted, on the new cron wiring.

Expected Outcome

The fully-built, already-tested Discord anomaly-alerting channel actually fires on real cron ticks, alongside the existing PagerDuty path, instead of sitting dead in the codebase.

Links & Resources

  • src/review/alerts.ts
  • test/unit/alerts.test.ts
  • src/review/ops-wire.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions