Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(alerts): retain automatic acknowledgement across refires
pulse-triage[bot]9f2d98ad7656
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex fd7a30e865..22dfcd255b 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -15,6 +15,18 @@## Purpose+### Automatic acknowledgement lifecycle++Cleanup-triggered acknowledgement uses the same canonical retention records and+reducer acknowledgement state as manual acknowledgement. It survives subsequent+metric evaluation and a short recovery/refire within the existing retention+window. Cleanup requests active-state persistence when it acknowledges alerts;+callbacks remain outside the manager lock. No retention duration is extended.+`TestAutoAcknowledgementSurvivesMetricEvaluation` in+`internal/alerts/reducer_parity_ack_test.go` verifies cleanup, the next metric+sample and a short recovery/refire. This is synthetic lifecycle proof, not+installed notification-destination acceptance.+Mobile incident drawers transfer their exact context to Assistant and closethrough the shared explicit handoff callback. Keeping the source drawer aboveAssistant, or dropping its occurrence identity to make navigation work, failsdiff --git a/internal/alerts/active_cleanup.go b/internal/alerts/active_cleanup.goindex 6ee7a70dd3..34d0935692 100644--- a/internal/alerts/active_cleanup.go+++ b/internal/alerts/active_cleanup.go@@ -38,6 +38,14 @@ func (m *Manager) Cleanup(maxAge time.Duration) {ackTime := nowalert.AckTime = &ackTimealert.AckUser = "system-auto"+ // Preserve the same recurrence retention and reducer state as a+ // manual acknowledgement, not just the active alert's display.+ m.setAckRecordNoLock(alert, id, ackRecord{+ acknowledged: true,+ user: "system-auto",+ time: ackTime,+ })+ m.mirrorAcknowledgeNoLock(alert, "system-auto", ackTime)autoAcked = append(autoAcked, alert.Clone())if recordAlertAcknowledged != nil {@@ -213,6 +221,9 @@ func (m *Manager) Cleanup(maxAge time.Duration) {m.mu.Unlock()+ if len(autoAcked) > 0 {+ m.saveActiveAlertsAsync("auto acknowledge")+ }for _, alert := range autoAcked {m.safeCallAcknowledgedCallback(alert, "system-auto")}diff --git a/internal/alerts/reducer_parity_ack_test.go b/internal/alerts/reducer_parity_ack_test.goindex f37b8fa44f..934a35f753 100644--- a/internal/alerts/reducer_parity_ack_test.go+++ b/internal/alerts/reducer_parity_ack_test.go@@ -229,3 +229,36 @@ func TestReducerParityWithManagerAckLifecycle(t *testing.T) {})}}++func TestAutoAcknowledgementSurvivesMetricEvaluation(t *testing.T) {+ m := newTestManager(t)+ m.mu.Lock()+ m.config.TimeThresholds = map[string]int{}+ m.config.SuppressionWindow = 0+ m.config.MinimumDelta = 0+ m.config.AutoAcknowledgeAfterHours = 2+ m.mu.Unlock()+ threshold := &HysteresisThreshold{Trigger: 80, Clear: 70}+ evaluate := func(value float64) {+ m.checkMetric("auto-ack-resource", "Resource", "node", "instance", "guest", "usage", value, threshold, nil)+ }+ evaluate(90)+ key := buildCanonicalStateID("auto-ack-resource", "metric-threshold:usage")+ m.mu.Lock()+ m.activeAlerts[key].StartTime = time.Now().Add(-3 * time.Hour)+ m.mu.Unlock()+ m.Cleanup(time.Hour)+ assertAcknowledged := func(stage string) {+ t.Helper()+ alerts := m.GetActiveAlerts()+ if len(alerts) != 1 || !alerts[0].Acknowledged || alerts[0].AckUser != "system-auto" || alerts[0].AckTime == nil {+ t.Fatalf("%s: automatic acknowledgement lost: %+v", stage, alerts)+ }+ }+ assertAcknowledged("cleanup")+ evaluate(85)+ assertAcknowledged("next evaluation")+ evaluate(60)+ evaluate(90)+ assertAcknowledged("short recovery and refire")+}