fix(api): prevent Slack notification failures when alert message exceeds 3000 chars #3473
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.33) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.33 · 154 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.302
Real PR Conversation Timeline
1 comments
"Review active on #3473"
general
weight: 0.35
github-actions[bot]
Fixes #3452
Summary of changes
1. Prevent Slack Webhook Notification Delivery Failures on Long Alert Messages:
- Slack section blocks enforce a strict 3000-character limit on the
text.textfield.- For inline alerts,
buildAlertMessageTemplateHdxLinkgenerates a chart explorer link containing the entire serializedchartConfigin query parameters. On alerts with multiple series or complex queries, this URL exceeds 2500+ characters, causing<${message.hdxLink} | ${message.title}>\n${message.body}to surpass Slack's 3000-character limit and fail delivery withWEBHOOK_ERROR.- Added
formatSlackSectionTextandgetFallbackHdxLinkinpackages/api/src/tasks/checkAlerts/transports/slack.ts:- If the formatted text exceeds 3000 characters, it falls back to the concise
${origin}/alertslink.- If the text still exceeds 3000 characters (e.g. from a very large message body), it safely truncates the body with an ellipsis (
...) so total block text never exceeds 3000 characters.2. Tests:
- Added comprehensive unit tests in
packages/api/src/tasks/checkAlerts/transports/__tests__/slack.test.ts.Signed-off-by: Mohd Quamar Tyagi <347892697+Tyagiquamar@users.noreply.github.com>