Conversation
…emplates An incident created from a criteria whose incident template has no `id` could never be auto-resolved — not by an incoming payload reporting the key recovered, and not by series absence. `CriteriaIncident.id` is declared required, but the write path accepts templates without one, and API- and Terraform-authored criteria routinely omit it. The create path already handles that (it sets `createdIncidentTemplateId` only when the id is present) and so does the dedupe match, which normalises both sides to `undefined` so a created incident still matches itself on the next cycle. Both resolution paths did not. `resolveSeriesIncidentsByFingerprint` and both branches of `shouldCloseIncident` returned early whenever `createdIncidentTemplateId` was NULL, so those incidents were created correctly, deduplicated correctly, carried a correct `seriesFingerprint` — and then stayed open forever with nothing logged to say why. Replace the three hard gates with one `isAutoResolveIncidentTemplate` helper that normalises both sides to `undefined`, mirroring the dedupe path. This stays exact: an incident whose template id is NULL matches only an id-less auto-resolve template on the same criteria, never an unrelated one that does carry an id. It also heals monitors already in this state, which a provider-side fix alone cannot do. Refs OneUptime#3390
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
4 tasks
…olve master landed its own fix for id-less incident templates while this branch was open (`isAutoResolveConfiguredForIncident`), alongside the per-series breaching helpers. It resolves the same bug with a looser rule: an incident with no `createdIncidentTemplateId` is matched against its creating criteria as a whole rather than against an id-less template entry, and a test on master pins that behaviour. Keep master's rule and its per-series control flow, drop this branch's `isAutoResolveIncidentTemplate` helper, and route the two gates master did not touch — `resolveSeriesIncidentsByFingerprint` and `shouldCloseIncident`'s cross-criteria path, both of which still returned early on a NULL template id — through master's helper. That is what remains of this branch: one rule, applied on every resolution path. Tests updated to the merged semantics.
p-paul
marked this pull request as draft
September 21, 2026 13:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title of this pull request?
fix: auto-resolve incidents from id-less criteria incident templates
Small Description?
Incidents created from id-less criteria incident templates can never auto-resolve (#3390). Both resolution paths hard-gate on
createdIncidentTemplateId, which the create path leaves NULL when the template has noid— a state the write path accepts and the dedupe path explicitly supports, yet which was silently unresolvable forever.This was previously submitted together with #3394 as one PR; it has been split so each fix can be reviewed and merged on its own. This half touches two files and carries no migration.
CriteriaIncident.idis declared required, but the write path accepts templates without one, and API- and Terraform-authored criteria routinely omit it. The create path already handles that (setscreatedIncidentTemplateIdonly when the id is present) and so does the dedupe match, which normalises both sides toundefined. The resolution paths did not:resolveSeriesIncidentsByFingerprint—if (!createdCriteriaId || !createdIncidentTemplateId) { continue; }shouldCloseIncident— the same gate, in both of its branchesSo incidents were created correctly, deduplicated correctly, carried a correct
seriesFingerprint— and stayed open forever with nothing logged to say why.The three hard gates become one
isAutoResolveIncidentTemplate()helper that normalises both sides toundefined, mirroring the dedupe path. It stays exact: an incident whose template id is NULL matches only an id-less auto-resolve template on the same criteria, never an unrelated one that carries an id. This also heals monitors already in this state, which a provider-side fix alone cannot do.Pull Request Checklist:
closes #XXXXin your comment to auto-close the issue that your PR fixes (if such).Related Issue?
closes #3390
Tests
IdLessIncidentTemplateAutoResolve.test.ts— 10 tests, all passing. Three of them fail on the pre-fix code, one per broken resolution path; the other seven pin that the fix does not over-resolve:The full
Tests/Server/Utils/Monitordirectory (67 suites / 1378 tests) also passes.Scope
Two files:
Common/Server/Utils/Monitor/MonitorIncident.tsand the new test. No schema change, no migration, no API surface change.