Skip to content

fix: set event in foreach AlertDto path so incident resolution check runs#6213

Open
DragonBot00 wants to merge 2 commits intokeephq:mainfrom
DragonBot00:fix/incident-resolution-foreach-alertdto
Open

fix: set event in foreach AlertDto path so incident resolution check runs#6213
DragonBot00 wants to merge 2 commits intokeephq:mainfrom
DragonBot00:fix/incident-resolution-foreach-alertdto

Conversation

@DragonBot00
Copy link
Copy Markdown
Contributor

Fixes #6194

Problem: When enriching alerts to resolved via a workflow foreach loop with AlertDto objects, the incident resolution check is silently skipped.

Root Cause: In BaseProvider._enrich(), the event variable is set in the tuple path (line 221) but never set in the AlertDto path (line 223-224). The resolution check is gated on if event and should_check_incidents_resolution, so it always evaluates to False for AlertDto foreach.

Fix: One line - assign event = foreach_context in the isinstance(foreach_context, AlertDto) branch.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

@DragonBot00 is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. Bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Apr 6, 2026
@DragonBot00
Copy link
Copy Markdown
Contributor Author

Hi maintainers, this one-line fix resolves #6194 — incidents don't resolve when alerts are enriched via workflow foreach because the event variable is never set in the AlertDto path, silently skipping check_incident_resolution().

The root cause was confirmed by multiple community members. Would love to get this merged — it's been sitting for a few days. Thanks!

…runs

In BaseProvider._enrich(), when iterating over AlertDto objects in a
foreach loop, the event variable was never assigned. This caused
check_incident_resolution() to be silently skipped because the condition
if event and should_check_incidents_resolution evaluates to False.

The enrichment itself succeeds (alerts show as 'resolved' in the UI) but
the incident resolution check never runs, so incidents set to 'resolve on
all_resolved' stay active forever when alerts are resolved via workflow.

Fix: assign event = foreach_context in the AlertDto isinstance branch.

Fixes keephq#6194
@DragonBot00 DragonBot00 force-pushed the fix/incident-resolution-foreach-alertdto branch from 031a37a to a70b1f5 Compare April 7, 2026 22:48
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Apr 7, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.43%. Comparing base (5fc042d) to head (a70b1f5).
⚠️ Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6213      +/-   ##
==========================================
+ Coverage   46.41%   46.43%   +0.01%     
==========================================
  Files         176      176              
  Lines       18443    18463      +20     
==========================================
+ Hits         8561     8573      +12     
- Misses       9882     9890       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Incidents with "Resolve on all_resolved" do not resolve when alert is enriched via workflow

1 participant