Skip to content

feat(alerting): Sentry alerting integration with provider-agnostic interface#1001

Merged
zbigniewsobiecki merged 1 commit intodevfrom
feature/alerting-sentry-integration
Mar 23, 2026
Merged

feat(alerting): Sentry alerting integration with provider-agnostic interface#1001
zbigniewsobiecki merged 1 commit intodevfrom
feature/alerting-sentry-integration

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • New alerting integration category with Sentry as first provider — trigger handlers for issue alerts (event_alert) and metric alerts (metric_alert) fire the alerting agent
  • Provider-agnostic naming throughout the agent-facing layer: alertIssueId / alertOrgId / alertIssueUrl (AgentInput fields), GetAlertingIssue / GetAlertingEventDetail / ListAlertingEvents (gadgets), alertingIssue (context step) — adding a second provider (PagerDuty, Datadog) won't require prompt changes
  • Sentry webhook handler refactored to use createWebhookHandler factory, gaining webhook logging to webhook_logs and opt-in HMAC-SHA256 signature verification (Sentry-Hook-Signature header)
  • Missing gadget added: ListAlertingEvents class was absent despite core function and CLI tool existing — llmist agents can now call it
  • Quality fixes: formatSentryEvent complexity reduced from 34→~8 (extracted 5 section helpers), dead _client caching variable removed from sentry/client.ts, Sentry branding removed from formatted output strings

Provider-agnostic design

Follows the PM analogy: Trello "card" + JIRA "issue" → "work item". Applied here:

Sentry-specific Generic (agent-facing)
sentryIssueId alertIssueId
sentryOrgSlug alertOrgId
GetSentryIssue GetAlertingIssue
context step sentryIssue alertingIssue

Sentry internals (client URLs, SentryEvent type, organizationSlug in the HTTP client) stay Sentry-named — the abstraction boundary is the agent-facing interface.

Test plan

  • verifySentrySignature — 9 tests (valid sig, empty body, tampered body, garbage sig, timing-safe length check, prefix format difference from GitHub/JIRA)
  • SentryIssueAlertTrigger — 15 tests (matches/handle, all title fallback paths, issue ID from issue_url, missing config, disabled trigger)
  • SentryMetricAlertTrigger — 12 tests (matches/handle, severity filter, warning/critical actions, fallback titles, web_url)
  • registerBuiltInTriggers — Sentry triggers now mocked and verified by name
  • Full unit suite: 6367 tests pass (up from 6326 before this PR)
  • Lint: clean (biome check .)
  • Typecheck: clean (tsc --noEmit)

🤖 Generated with Claude Code

…c interface

Introduces Sentry as the first alerting provider under a new 'alerting'
integration category, using provider-agnostic naming throughout so that
adding a second provider (PagerDuty, Datadog, etc.) requires no prompt
or interface changes.

## Provider-agnostic naming (the PM analogy)
Like how Trello "card" + JIRA "issue" are abstracted to "work item" in
the PM category, Sentry-specific language is hidden behind the alerting
namespace at every agent-facing layer:

- AgentInput fields: `alertIssueId`, `alertOrgId`, `alertIssueUrl`
- Gadgets: `GetAlertingIssue`, `GetAlertingEventDetail`, `ListAlertingEvents`
- CLI tools: `get-alerting-issue`, `get-alerting-event`, `list-alerting-events`
- Context step: `alertingIssue` (was `sentryIssue`)
- Agent YAML prompts: no Sentry-specific language

Sentry internals (client, types, HMAC verification) remain Sentry-named
as the abstraction boundary stops at the agent-facing interface.

## New capabilities
- `alerting:read` capability with all three gadgets (GetAlertingIssue,
  GetAlertingEventDetail, ListAlertingEvents) — ListAlertingEvents was
  previously missing despite having a CLI tool and core function
- Sentry webhook handler via `createWebhookHandler` factory, gaining
  webhook logging to `webhook_logs` and opt-in HMAC-SHA256 signature
  verification (`Sentry-Hook-Signature` header, raw hex format)
- `verifySentrySignature` in signatureVerification.ts (timing-safe)
- `verifySentryWebhookSignature` in webhookVerification.ts reads
  `webhook_secret` from the alerting integration credential

## Fixes
- `formatSentryEvent` cognitive complexity reduced from 34 to ~8 by
  extracting five section helpers (appendEventMeta, appendEventTags,
  appendEventRequest, appendEventUser, appendEventStacktrace)
- Removed dead `_client` caching variable from sentry/client.ts
- Removed Sentry branding from formatted output strings

## Tests
- 41 new/updated tests: verifySentrySignature (9), SentryIssueAlertTrigger
  (15), SentryMetricAlertTrigger (12), builtins registration (1 new + mock)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 368e39d into dev Mar 23, 2026
8 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the feature/alerting-sentry-integration branch March 23, 2026 16:50
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.

1 participant