Repository navigation
Conversation
An alert can set renotifyIntervalMinutes: while it keeps firing, it notifies at most once every that many minutes. Unset keeps notifying on every evaluation. Each history record carries lastNotifiedAt forward, so the check in trySendNotification only reads the previous evaluation. Closes ClickHouse#2464 Co-authored-by: Niladri Adhikary <niladrix719@gmail.com>
|
@bcanvural is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: c563d7c The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PR Review
3 finding(s): 🔴 0 P0/P1 · 🟡 2 P2 · 🔵 1 P3 1 posted as inline comment(s) on the changed lines. 1 listed below. 1 P3 folded at the bottom. Findings outside the changed lines
🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit ba6f7de. Configure here.
Deep Review✅ No critical issues found. The change is cleanly additive and mirrors the existing 🟡 P2 — recommended
🔵 P3 nitpicks (2)
Reviewers (11): correctness, testing, maintainability, project-standards, api-contract, reliability, adversarial, kieran-typescript, agent-native, learnings-researcher, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
Ungrouped alerts and stale grouped alerts get their previous state from getLatestAlertHistories and the last-evaluation fallback, not from getPreviousAlertHistories, so the re-notify interval never applied to them. Also tests a grouped alert's per-group interval and the MCP save rules, and documents the new false return for evaluators.
|
Round 1, fixed in 29fc30b:
No change for these:
|
A silenced evaluation returned before the re-notify check and wrote no lastNotifiedAt, so a silence shorter than the interval made the alert notify again as soon as it ended. The time is now carried forward first. The MCP schema reuses alertRenotifyIntervalMinutesSchema.
| state === AlertState.ALERT ? alert.renotifyIntervalMinutes : undefined; | ||
| if (renotifyMinutes) { | ||
| const previous = previousMap.get(computeHistoryMapKey(alert.id, group)); | ||
| getOrCreateHistory(group).lastNotifiedAt = |
There was a problem hiding this comment.
🟡 P2 — lastNotifiedAt is lost when a still-breaching evaluation lands in PENDING, so the next ALERT notifies before the interval ends
Carry lastNotifiedAt forward wherever fired is carried for PENDING (the history.fired = previous?.fired === true branches at ~1687, ~1765, ~1825), and accept previous.state === PENDING && previous.fired in the check here. Today trySendNotification only runs for ALERT, and only reads the value back when previous.state === ALERT. With numConsecutiveWindows > 1, an evaluation that comes after a runner delay longer than (M-1) windows finds fewer than M-1 rows in getRecentAlertHistories. That row is written as PENDING without lastNotifiedAt, so the next ALERT evaluation notifies straight away even when, say, a 24h interval has not passed.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Leaving this one. It needs numConsecutiveWindows > 1 and a runner delay longer than the windows it counts, and the effect is one early repeat after that delay. Covering it means carrying the time through the PENDING branches too, which I'd rather do in a follow-up if wanted.
|
Rounds 2 and 3. Fixed in c563d7c:
No change for these:
From here I'll only fix P0/P1 bot findings. |

Closes #2464. Builds on #2754 by @niladrix719, which has been idle since July and now conflicts with main.
What
An alert can set
renotifyIntervalMinutes. While it keeps firing, it notifies at most once every that many minutes. A new breach after a resolve notifies at once, and resolve notifications are unchanged.It is opt-in: unset keeps today's behaviour of notifying on every evaluation. This is the difference from #2754, which changed the default to "notify once". The setting is in the UI under the alert's advanced schedule settings, in the internal and external APIs, and in
clickstack_save_alert. As with the note and the window count, an MCP update that omits it keeps the stored value.How
Each alert history record stores
lastNotifiedAt. A suppressed evaluation copies it forward, so the check only needs the previous evaluation's record, whichgetPreviousAlertHistoriesalready returns. The check is intrySendNotification, so threshold, grouped and evaluator alerts all go through it, and each group of a grouped alert keeps its own time.Two things work the same way as today's
firedflag and resolve notification:Tests
checkAlerts.int.test.ts: unset notifies on every evaluation; a 10 minute interval with 5 minute windows notifies, skips, notifies, skips, withlastNotifiedAtcarried forward; a new breach after a resolve notifies inside the interval.Note
Medium Risk
Changes alert notification dispatch and history persistence; incorrect interval logic could miss or duplicate webhooks, though behavior is opt-in and resolve paths are unchanged.
Overview
Adds an opt-in
renotifyIntervalMinuteson alerts so sustained firing can throttle repeat webhooks instead of notifying on every evaluation window. Unset/null preserves current behavior; resolve notifications are unchanged.The field is wired through common-utils validation, the Alert model, OpenAPI/external API, MCP
clickstack_save_alert(omit keeps stored value, like note/window count), and UI advanced schedule controls plus AlertPropertiesSummary.Evaluator behavior:
lastNotifiedAtis persisted on alert history;trySendNotificationcarries it from the previous row, skips sends inside the interval (skipped_renotify), and updates it when a send is attempted. Grouped alerts track the interval per group; silence during firing does not reset the clock.Provider/history reads now include
lastNotifiedAtin aggregated previous history for the check.Coverage includes
checkAlertsintegration (interval spacing, post-resolve re-alert, silence, per-group) and external API CRUD/validation (rejects0).Reviewed by Cursor Bugbot for commit c563d7c. Bugbot is set up for automated code reviews on this repo. Configure here.