keep icon indicating copy to clipboard operation
keep copied to clipboard

Fix incident auto-resolve workflows not triggering

Open sanyo4ever opened this issue 2 months ago โ€ข 5 comments

Pull Request: Fix incident auto-resolve workflows not triggering ๐Ÿ› Problem When incidents are automatically resolved (via the "resolve when all alerts resolve" setting), workflow triggers with type: incident and events: [updated] were not being executed. This only affected auto-resolution; manual resolution worked correctly. ๐Ÿ” Root Cause The resolve_incident_if_require() method in keep/api/bl/incidents_bl.py (lines 432-472) was updating the incident status in the database but not calling send_workflow_event() to trigger workflows. Compare with: change_status() method (line 474+) - triggers workflows โœ… __postprocess_alerts_change() method (line 338) - triggers workflows โœ… resolve_incident_if_require() - missing workflow trigger โŒ โœ… Solution Added three missing operations to resolve_incident_if_require() after the incident status is updated: Set end_time - Records when the incident was resolved (consistent with manual resolution) Trigger workflows - Calls send_workflow_event(incident_dto, "updated") to execute incident workflows Update clients - Calls update_client_on_incident_change() to notify UI via Pusher ๐Ÿ“ Changes File: keep/api/bl/incidents_bl.py Lines modified: 460-474 Lines added: 13 ๐Ÿงช Testing Before fix: Created incident from UptimeKuma alert Enabled "Resolve incident when all alerts resolve" Alert resolved โ†’ Incident auto-resolved โ†’ Workflows did not trigger โŒ After fix: Same scenario โ†’ Incident auto-resolved โ†’ Workflows triggered successfully โœ… Verified logs show: "Incident auto-resolved, triggering workflows" ๐Ÿ“Š Impact Low risk: Only adds functionality, doesn't change existing behavior Backward compatible: Existing workflows will now work as expected Consistent: Makes auto-resolve behave identically to manual resolve ๐Ÿ”— Related This ensures parity between manual and automatic incident resolution, allowing users to reliably trigger notifications (Slack, PagerDuty, etc.) when incidents are resolved via automation.

sanyo4ever avatar Oct 21 '25 13:10 sanyo4ever

Skipped: This PR does not target one of your configured branches: (refactor/2512-nextjs-15)

greptile-apps[bot] avatar Oct 21 '25 13:10 greptile-apps[bot]

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

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 21 '25 13:10 vercel[bot]

No linked issues found. Please add the corresponding issues in the pull request description.
Use GitHub automation to close the issue when a PR is merged

github-actions[bot] avatar Oct 21 '25 13:10 github-actions[bot]

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Oct 21 '25 13:10 CLAassistant

Hey there and thank you for opening this pull request! ๐Ÿ‘‹๐Ÿผ

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Fix incident auto-resolve workflows not triggering". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

github-actions[bot] avatar Oct 21 '25 13:10 github-actions[bot]