Fix/auto resolve grouped alerts#2624
Conversation
🦋 Changeset detectedLatest commit: 06dda40 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
|
@Aryainguz is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR fixes grouped alerts that could stay stuck after later buckets recovered. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (13): Last reviewed commit: "Merge branch 'main' into fix/auto-resolv..." | Re-trigger Greptile |
…and update webhook dependency check to filter by type
…otification resolution logic
Deep Review✅ No critical issues found. The core state-machine fix is sound: 🟡 P2 — recommended
🔵 P3 nitpicks (6)
Reviewers (8): correctness, adversarial, security, testing, reliability, kieran-typescript, maintainability, project-standards. Testing gaps:
|
|
Thanks for the contribution, overall LGTM! One change to flag during testing: Same-tick breach-then-recover fires two notifications When one evaluation tick backfills multiple buckets and a group breaches in an early bucket but recovers by the final bucket, the run sends two notifications: an I actually think the two-notification behaviour is the right default here, silently auto-resolving would hide that a threshold was crossed at all, and "it breached at 22:05 and has since recovered" is useful for on-call awareness and postmortems. So let's keep it as-is. The one thing I'd ask before merge: since this is now intentional (and easy to accidentally regress into a silent resolve later), let's pin it with a regression test that asserts both the count and the order: Open to being talked out of it though - if you feel two back-to-back messages read as flapping and would rather collapse to a single ALERT that notes the value is already back to normal, I'm fine with that direction too. But absent a strong case, let's keep both + add the test. |
@brandon-pereira agreed, I've added the regression test to pin the two notification behaviors, the test simulates a single evaluation tick processing back to back breach and recovery buckets, asserting that both the ALERT and RESOLVED notifications are emitted in the correct order and that the final persisted state correctly settles back to OK. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ng grouped alerts
…ving the single-notification constraint during breaches
…ebhook call on resolution
|
@Aryainguz can you please check the failing integration test when you get time? thank you! |
@brandon-pereira The zero-fill test was asserting the wrong final state. Period 3 has 1 log and the alert fires when
|

The Bug
When an alert with a
Group Byclause evaluates multiple time windows (buckets) in a single cron execution tick, if the first bucket triggered anALERT, but the last bucket did not exceed the threshold, the alert history state was never explicitly reset toOKinside the evaluation loop.Fixes #2623
As a result, the alert history retained the
ALERTstate for that tick, failing to trigger thesendNotificationIfResolvedlogic. The alert remained permanently stuck in theALERTstate even after the underlying metrics returned to normal levels. (See the original developerTODOatpackages/api/src/tasks/checkAlerts/index.ts:1293calling out this edge case).The Fix
Implemented the explicit state reset inside the threshold evaluation
elseblock:Verification
OK.checkAlertstest suite.@hyperdx/api: patch).Local Validations :