Preserve alert history when reopening

When a closed alert reopens (condition still present, no active
cooldown), keep firstSeen and comments intact. The alert is the same
incident continuing — closing and reopening should not erase history.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-12 11:40:42 -04:00
parent 6fa246d3c4
commit bf83c1a779

View File

@@ -126,14 +126,14 @@ export function upsertAlerts(candidates: AlertCandidate[]): number {
if (isSuppressed) continue;
// Re-open if previously closed (manually or resolved) and not suppressed
// Re-open if previously closed (manually or resolved) and not suppressed.
// Preserve firstSeen and comments — this is the same incident continuing,
// not a brand new one.
if (existing.status === "closed") {
existing.status = "open";
existing.closeReason = null;
existing.closedAt = null;
existing.suppressedUntil = null;
existing.firstSeen = nowISO; // treat as a new occurrence
existing.comments = [];
}
// Refresh content and lastSeen