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:
@@ -126,14 +126,14 @@ export function upsertAlerts(candidates: AlertCandidate[]): number {
|
|||||||
|
|
||||||
if (isSuppressed) continue;
|
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") {
|
if (existing.status === "closed") {
|
||||||
existing.status = "open";
|
existing.status = "open";
|
||||||
existing.closeReason = null;
|
existing.closeReason = null;
|
||||||
existing.closedAt = null;
|
existing.closedAt = null;
|
||||||
existing.suppressedUntil = null;
|
existing.suppressedUntil = null;
|
||||||
existing.firstSeen = nowISO; // treat as a new occurrence
|
|
||||||
existing.comments = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh content and lastSeen
|
// Refresh content and lastSeen
|
||||||
|
|||||||
Reference in New Issue
Block a user