feat(review): wire the Discord anomaly-alerter into the ops cron tick - #8946
Conversation
runAnomalyAlerts (src/review/alerts.ts) was fully built and unit-tested but imported nowhere -- no cron handler referenced it, so the Discord anomaly channel sat dead while ops-wire's structured-log + PagerDuty path fired on every ops-alerts tick. Add src/review/alerts-wire.ts: a thin host adapter that builds the operator agent-config from env (GITHUB_APP_SLUG-or-loopover slug, the DISCORD_WEBHOOK_URL secret ref) and injects the native ops-port health/calibration snapshots the operator dashboard already reads, then calls runAnomalyAlerts. Invoke it from the same isOpsEnabled branch of the ops-alerts job that calls runOpsAlerts, so the Discord channel fires alongside PagerDuty on the real cron tick. The adapter fails safe (swallows a top-level error to a structured log), mirroring runOpsAlerts' 'never throws into the queue' contract: alerts.ts writes throttle-claim rows, so a storage error is possible, and an alerting side-channel must never break the cron. It self-gates on a configured DISCORD_WEBHOOK_URL, so an operator who has not wired a channel pays nothing. Closes JSONbored#8905
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8946 +/- ##
==========================================
+ Coverage 90.56% 90.62% +0.06%
==========================================
Files 96 98 +2
Lines 22490 22666 +176
Branches 3884 3933 +49
==========================================
+ Hits 20367 20542 +175
Misses 1945 1945
- Partials 178 179 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-26 14:17:10 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
feat(review): wire the Discord anomaly-alerter into the ops cron tick
runAnomalyAlerts (src/review/alerts.ts) was fully built and unit-tested but
imported nowhere -- no cron handler referenced it, so the Discord anomaly
channel sat dead while ops-wire's structured-log + PagerDuty path fired on
every ops-alerts tick.
Add src/review/alerts-wire.ts: a thin host adapter that builds the operator
agent-config from env (GITHUB_APP_SLUG-or-loopover slug, the DISCORD_WEBHOOK_URL
secret ref) and injects the native ops-port health/calibration snapshots the
operator dashboard already reads, then calls runAnomalyAlerts. Invoke it from
the same isOpsEnabled branch of the ops-alerts job that calls runOpsAlerts, so
the Discord channel fires alongside PagerDuty on the real cron tick.
The adapter fails safe (swallows a top-level error to a structured log),
mirroring runOpsAlerts' 'never throws into the queue' contract: alerts.ts
writes throttle-claim rows, so a storage error is possible, and an alerting
side-channel must never break the cron. It self-gates on a configured
DISCORD_WEBHOOK_URL, so an operator who has not wired a channel pays nothing.
Closes #8905
Validation
Verified locally on this branch before opening:
npm run typechecknpx turbo run build:tsc build:verifynpm run test:coverage— patch coverage 100.0% of changed lines