Skip to content

[FEAT] #512: Slack Integration for Smart Alerts via alert_smart_alert()#525

Open
adityakryadav wants to merge 2 commits into
sreerevanth:mainfrom
adityakryadav:feat/512-slack-smart-alerts
Open

[FEAT] #512: Slack Integration for Smart Alerts via alert_smart_alert()#525
adityakryadav wants to merge 2 commits into
sreerevanth:mainfrom
adityakryadav:feat/512-slack-smart-alerts

Conversation

@adityakryadav

Copy link
Copy Markdown
Contributor

Summary

Closes #512.
The existing AlertingEngine could already send Slack notifications for raw AgentEvent and AbuseEvent objects, but there was no way for the Human-in-the-Loop layer to surface a free-form "Smart Alert" with a link back to the dashboard.

Changes

  • agentwatch/alerting/engine.py - Added alert_smart_alert(alert_text, dashboard_link) to AlertingEngine:
    • Sends a rich Slack Block Kit message with a bold header, alert body text, and a clickable "Review on Dashboard" link.
    • Respects the existing SLACK_WEBHOOK_URL env var wiring (set in .env / Docker Compose).
    • Reuses the existing _post() helper (retries, signing, timeout).

Usage

engine = AlertingEngine(AlertingConfig(slack_webhook_url=os.getenv("SLACK_WEBHOOK_URL")))
await engine.alert_smart_alert(
    alert_text="Anomalous tool-call spike detected: 47 calls/min (threshold: 20).",
    dashboard_link="https://your-dashboard.example.com/sessions/abc123",
)

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@adityakryadav, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 04c08f11-12b6-4ba7-8b3d-ef867ee3886c

📥 Commits

Reviewing files that changed from the base of the PR and between a871b5a and 9e9c14b.

📒 Files selected for processing (2)
  • agentwatch/alerting/engine.py
  • tests/test_multiagent.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🧪 PR Test Results

Check Result
Tests (pytest tests/) ✅ success
Lint (ruff check .) ✅ success
Coverage (agentwatch) 73.59%

Python 3.12 · commit 9e9c14b

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

@adityakryadav is attempting to deploy a commit to the sreerevanth's projects Team on Vercel.

A member of the Team first needs to authorize it.

@sreerevanth sreerevanth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! I like the direction of adding Slack notifications, but I don't think this PR is ready to merge yet.

A few things I'd like to see addressed before merging:

This introduces a new public alerting feature but doesn't include any dedicated tests. Please add unit tests covering the Slack payload generation, successful delivery, and the behavior when no Slack webhook is configured.
alert_smart_alert() is very specific to a single feature. Since this lives in the shared alerting engine, I'd prefer a more generic alerting interface rather than adding feature-specific methods directly to the engine.
The method returns a pagerduty status even though PagerDuty isn't used anywhere in this implementation. Either implement PagerDuty handling or remove the unused field from the return value to avoid confusion.

Once these points are addressed, I'd be happy to take another look. Thanks again for the contribution!

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.

[Feat] Slack Integration for Human-in-the-Loop Smart Alerts

2 participants