Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Clear stale acknowledgements on Patrol regressions

rcourtman731d25516e35
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 2e8bf6a644..fb10746321 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -508,6 +508,10 @@ so the full-run seed/reconcile path must not auto-resolve them as
`Resource no longer exists in infrastructure` just because `ai-service` is not
present in the infrastructure snapshot. Those findings stay active until
Patrol actually succeeds or resolves them for a Patrol-owned reason.
+The shared findings lifecycle must also treat a regressed issue as a new active
+occurrence. When a resolved finding reappears, `internal/ai/findings.go` must
+clear any stale acknowledgement timestamp from the prior occurrence instead of
+carrying that acknowledgement forward onto the regressed active issue.
AI chat tool-name labels, pending-tool headers, and assistant status copy now
also route through the shared frontend identifier-label helper, so the chat
surfaces do not keep their own underscore-stripping behavior separate from
diff --git a/internal/ai/findings.go b/internal/ai/findings.go
index 8dfc8cec7d..47545a1522 100644
--- a/internal/ai/findings.go
+++ b/internal/ai/findings.go
@@ -958,9 +958,11 @@ func (s *FindingsStore) Add(f *Finding) bool {
if wasResolved {
prevResolvedAt := existing.ResolvedAt
prevResolveReason := existing.ResolveReason
+ hadAcknowledgement := existing.AcknowledgedAt != nil
existing.ResolvedAt = nil
existing.AutoResolved = false
existing.ResolveReason = ""
+ existing.AcknowledgedAt = nil
// Reset investigation loop metadata when a previously resolved issue reappears.
existing.InvestigationSessionID = ""
existing.InvestigationStatus = ""
@@ -977,6 +979,9 @@ func (s *FindingsStore) Add(f *Finding) bool {
if prevResolveReason != "" {
meta["previous_resolve_reason"] = prevResolveReason
}
+ if hadAcknowledgement {
+ meta["previous_acknowledged"] = "true"
+ }
s.appendLifecycleLocked(existing, "regressed", "Finding re-detected after resolution", string(FindingLoopStateResolved), string(FindingLoopStateDetected), meta)
if existing.IsActive() {
s.activeCounts[existing.Severity]++
diff --git a/internal/ai/findings_lifecycle_test.go b/internal/ai/findings_lifecycle_test.go
index 6396e51217..d8bc13dfcc 100644
--- a/internal/ai/findings_lifecycle_test.go
+++ b/internal/ai/findings_lifecycle_test.go
@@ -76,9 +76,66 @@ func TestFindingsStore_RegressionIncrementsAndRecordsLifecycleEvent(t *testing.T
if got.LastRegressionAt == nil {
t.Fatal("expected lastRegressionAt to be set")
}
+ if got.AcknowledgedAt != nil {
+ t.Fatal("expected acknowledgement to clear when the finding regresses")
+ }
+ foundRegressed := false
+ for _, e := range got.Lifecycle {
+ if e.Type == "regressed" {
+ foundRegressed = true
+ break
+ }
+ }
+ if !foundRegressed {
+ t.Fatal("expected regressed lifecycle event")
+ }
+}
+
+func TestFindingsStore_RegressionClearsPriorAcknowledgement(t *testing.T) {
+ store := NewFindingsStore()
+ f := &Finding{
+ ID: "lf-ack-regress",
+ ResourceID: "vm-202",
+ ResourceName: "api",
+ Severity: FindingSeverityWarning,
+ Category: FindingCategoryReliability,
+ Title: "Restart loop",
+ Description: "Service repeatedly restarts",
+ }
+ if !store.Add(f) {
+ t.Fatal("expected first add to create finding")
+ }
+ if !store.Acknowledge(f.ID) {
+ t.Fatal("expected acknowledge to succeed")
+ }
+ if !store.Resolve(f.ID, true) {
+ t.Fatal("expected resolve to succeed")
+ }
+ if store.Add(&Finding{
+ ID: f.ID,
+ ResourceID: "vm-202",
+ ResourceName: "api",
+ Severity: FindingSeverityWarning,
+ Category: FindingCategoryReliability,
+ Title: "Restart loop",
+ Description: "Service repeatedly restarts again",
+ }) {
+ t.Fatal("expected second add to update existing finding")
+ }
+
+ got := store.Get(f.ID)
+ if got == nil {
+ t.Fatal("expected finding to exist")
+ }
+ if got.AcknowledgedAt != nil {
+ t.Fatal("expected acknowledgement to clear after regression")
+ }
foundRegressed := false
for _, e := range got.Lifecycle {
if e.Type == "regressed" {
+ if e.Metadata["previous_acknowledged"] != "true" {
+ t.Fatal("expected regressed lifecycle event to note prior acknowledgement")
+ }
foundRegressed = true
break
}