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
feat(patrol): allow reopening dismissed findings
[email protected]647d0625311c
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 43da91a438..366603aa0b 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -48,6 +48,10 @@ initial notification target into the notification manager. This adjacentalerts/notifications wiring grants no agent enrollment, reporting, removal,profile, update, probe-assignment, or command authority and must not mutatehost-agent state.+The shared `internal/api/ai_handlers.go` route may also reopen a dismissed+Patrol finding and mirror that state into the unified findings store. This is+AI finding-state management only; it grants no agent enrollment, report,+profile, update, removal, command, or fleet-control authority.The JSON-excluded Proxmox VM/LXC I/O-rate validity fields carried by`internal/models/models.go` are likewise monitoring-owned sidecar evidence.They distinguish a valid idle interval from an unknown rate for history,diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 066e8d849e..119ae22f3a 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -35,6 +35,11 @@ read-state is available and the shared Proxmox guest CPU-percent normalizer forlegacy snapshot fallback. It must not independently rescale by configured coresor substitute a linked in-guest host-agent CPU value, so Patrol evaluates thesame guest observation as dashboard, alerts, and history.+Dismissed Patrol findings remain durable operator history. Reopening a+finding-backed suppression row must use the canonical undismiss transition:+clear dismissal, suppression, acknowledgement, and reminder state; preserve the+operator note; append an `undismissed` lifecycle event; and immediately mirror+the reopened state into the unified findings projection.Interactive Assistant invocation authority is fail-closed and request-local.The `read_only` presentation means no model-invokable durable Pulse-state ordiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex a57384648d..83736b96d1 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -29,6 +29,11 @@ The accepted values are `all`, `email`, `webhook`, and `apprise`; the backendnormalizes aliases and invalid values before responding, persisting, andupdating the live notification runtime. Escalation levels use the same valuevocabulary but remain independent of the initial target.+`DELETE /api/ai/patrol/suppressions/finding_{findingID}` is the canonical+reopen path for a dismissed Patrol finding. It removes the finding-backed+suppression row, preserves the operator note, clears dismissal state in both+the Patrol and unified stores, and returns not-found when the row is not+currently dismissed or suppressed.Physical-disk payloads preserve optional SMART counter presence, includingexplicit zero values, and expose provider vendor metadata without convertingmissing data into health. Unified-resource clients may request bounded serverdiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 3d4f4b3e6d..0333c88c2c 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -27,6 +27,11 @@ The alert schedule's initial-delivery selector composes `SettingsPanel` andexposes the same email, webhook, Apprise, and all-destination labels used byescalation. It must not introduce a page-local select shell or a seconddestination-label map.+The centralized Findings surface loads active and historical Patrol findings,+keeps operator notes editable (including clearing a note with an empty value),+and exposes `Reopen finding` only for dismissed rows. Reopening uses the+finding-backed suppression removal API, refreshes both unified and Patrol+history, and must not discard the saved note.Platform-owned workload controls extend the shared `WorkloadsFilter` viewoptions rather than creating page-local toolbar shells. The Proxmox overviewdiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex fc518d60aa..3d87fc0275 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -18,6 +18,11 @@Own the Patrol intelligence route shell, feature surface, local stateorchestration, findings and approval presentation, run-history rendering, andPatrol-specific presentation helpers.+The centralized Findings surface loads full history for its All and Resolved+filters, keeps saved operator notes editable and clearable, and offers+`Reopen finding` only on dismissed findings. Reopening removes the+finding-backed suppression row, refreshes both Patrol and unified finding+sources, and retains the note as operator context.## Canonical Filesdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 8fee147e90..527bb27f49 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -39,6 +39,10 @@ The shared alerts API may persist and apply `schedule.initialNotify` for email,webhook, or Apprise delivery. That notification routing is not storage-health,backup, recovery-point, restore, or protection evidence; storage/recoverysurfaces must not infer product state from the selected destination.+The shared AI handlers may reopen dismissed Patrol findings and synchronize+the unified finding projection. That finding-state transition does not create,+delete, validate, or restore recovery points and must not be treated as+storage-health, backup, restore, or protection evidence.The shared Proxmox config discovery path likewise persists powered-off clustermembers and separates membership from member API reachability. Storage andrecovery consumers may use the resulting provider-scoped node/instancediff --git a/frontend-modern/src/api/__tests__/patrol.test.ts b/frontend-modern/src/api/__tests__/patrol.test.tsindex 6076227922..c56df7a531 100644--- a/frontend-modern/src/api/__tests__/patrol.test.ts+++ b/frontend-modern/src/api/__tests__/patrol.test.ts@@ -12,6 +12,7 @@ import {getPatrolRunHistoryWithToolCalls,getPatrolRunWithToolCalls,createSuppressionRuleFromFinding,+ reopenFinding,resolveFinding,triggerPatrolRun,createPatrolAutopilotAcknowledgement,@@ -386,6 +387,17 @@ describe('patrol api', () => {});});+ it('reopens a dismissed finding through its finding-backed suppression row', async () => {+ apiFetchJSONMock.mockResolvedValueOnce({ success: true, message: 'ok' } as any);++ await reopenFinding('finding/reopen 123');++ expect(apiFetchJSONMock).toHaveBeenCalledWith(+ '/api/ai/patrol/suppressions/finding_finding%2Freopen%20123',+ { method: 'DELETE' },+ );+ });+it('refuses to create broad suppression rules from a finding shortcut', async () => {await expect(createSuppressionRuleFromFinding({diff --git a/frontend-modern/src/api/patrol.ts b/frontend-modern/src/api/patrol.tsindex 9cf008877f..e20b338477 100644--- a/frontend-modern/src/api/patrol.ts+++ b/frontend-modern/src/api/patrol.ts@@ -410,6 +410,21 @@ export async function dismissFinding(});}+/**+ * Reopen a dismissed finding.+ *+ * Dismissed findings are exposed by the backend as finding-backed suppression+ * rows, so removing that row performs the canonical undismiss transition.+ */+export async function reopenFinding(+ findingId: string,+): Promise<{ success: boolean; message: string }> {+ return apiFetchJSON(+ `/api/ai/patrol/suppressions/${encodeURIComponent(`finding_${findingId}`)}`,+ { method: 'DELETE' },+ );+}+/*** Create a permanent suppression rule from a finding.*diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsxindex 2c8bfb68ac..819bea3624 100644--- a/frontend-modern/src/components/AI/FindingsPanel.tsx+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx@@ -675,6 +675,18 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {setDismissingId(null);};+ const handleReopen = async (finding: UnifiedFinding, e: Event) => {+ e.stopPropagation();+ setActionLoading(finding.id);+ const ok = await aiIntelligenceStore.reopenFinding(finding.id);+ setActionLoading(null);+ if (ok) {+ notificationStore.success('Finding reopened');+ } else {+ notificationStore.error('Failed to reopen finding');+ }+ };+const handleSnooze = async (finding: UnifiedFinding, durationHours: number, e: Event) => {e.stopPropagation();setActionLoading(finding.id);@@ -1805,6 +1817,16 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {</button></Show></Show>+ <Show when={finding.status === 'dismissed'}>+ <button+ type="button"+ onClick={(e) => handleReopen(finding, e)}+ class="rounded px-2 py-1 text-left text-blue-700 hover:bg-blue-50 disabled:opacity-50 dark:text-blue-300 dark:hover:bg-blue-900"+ disabled={actionLoading() === finding.id}+ >+ Reopen finding+ </button>+ </Show></div></details></Show>diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.tsindex 0b61023fe2..749a043670 100644--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts@@ -283,6 +283,14 @@ describe('FindingsPanel assistant handoff', () => {expect(findingsPanelSource).toContain('Finding marked resolved');});+ it('lets operators reopen dismissed findings from the centralized Findings view', () => {+ expect(findingsPanelSource).toContain('handleReopen');+ expect(findingsPanelSource).toContain('aiIntelligenceStore.reopenFinding(finding.id)');+ expect(findingsPanelSource).toContain("finding.status === 'dismissed'");+ expect(findingsPanelSource).toContain('Reopen finding');+ expect(findingsPanelSource).toContain('Finding reopened');+ });+it('fails closed before creating a per-finding suppression rule without concrete scope', () => {// Empty resource/category fields are backend wildcards. The per-finding// shortcut must not turn missing metadata into a broad suppression rule.diff --git a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligence.test.tsindex c49953297e..86734f0bcb 100644--- a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts+++ b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts@@ -15,6 +15,7 @@ vi.mock('@/api/patrol', () => ({acknowledgeFinding: vi.fn(),snoozeFinding: vi.fn(),dismissFinding: vi.fn(),+ reopenFinding: vi.fn(),resolveFinding: vi.fn(),setFindingNote: vi.fn(),}));@@ -33,7 +34,7 @@ vi.mock('@/stores/sessionPresentationPolicy', () => ({}));import { AIAPI } from '@/api/ai';-import { getPatrolFindings, resolveFinding } from '@/api/patrol';+import { getPatrolFindings, reopenFinding, resolveFinding } from '@/api/patrol';import { aiIntelligenceStore } from '@/stores/aiIntelligence';import { presentationPolicyIsDemoMode } from '@/stores/sessionPresentationPolicy';@@ -299,6 +300,19 @@ describe('aiIntelligenceStore', () => {expect(getPatrolFindings).toHaveBeenCalledTimes(1);});+ it('reopens a dismissed finding and refreshes full Patrol history', async () => {+ vi.mocked(reopenFinding).mockResolvedValueOnce({ success: true, message: 'ok' } as never);+ vi.mocked(AIAPI.getUnifiedFindings).mockResolvedValueOnce({ findings: [] } as never);+ vi.mocked(getPatrolFindings).mockResolvedValueOnce([]);++ const ok = await aiIntelligenceStore.reopenFinding('finding-reopen');++ expect(ok).toBe(true);+ expect(reopenFinding).toHaveBeenCalledWith('finding-reopen');+ expect(AIAPI.getUnifiedFindings).toHaveBeenCalledTimes(1);+ expect(getPatrolFindings).toHaveBeenCalledWith({ includeResolved: true, limit: 200 });+ });+it('promotes remind_at on dismissed-as-will_fix_later patrol findings to camelCase remindAt', async () => {// The store-level UnifiedFinding is what render code consumes; if the// normalizer drops remind_at, the dismiss confirmation panel and thediff --git a/frontend-modern/src/stores/aiIntelligence.ts b/frontend-modern/src/stores/aiIntelligence.tsindex e3c12514fe..93c030c2aa 100644--- a/frontend-modern/src/stores/aiIntelligence.ts+++ b/frontend-modern/src/stores/aiIntelligence.ts@@ -15,6 +15,7 @@ import {resolveFinding,snoozeFinding,dismissFinding,+ reopenFinding,setFindingNote,getPatrolFindings,type Finding as PatrolFinding,@@ -664,6 +665,17 @@ export const aiIntelligenceStore = {}},+ async reopenFinding(findingId: string) {+ try {+ await reopenFinding(findingId);+ await Promise.all([this.loadFindings(), this.loadPatrolFindings({ includeResolved: true })]);+ return true;+ } catch (e) {+ logger.error('Failed to reopen finding:', e);+ return false;+ }+ },+async setFindingNote(findingId: string, note: string) {try {await setFindingNote(findingId, note);diff --git a/internal/ai/findings.go b/internal/ai/findings.goindex 6e07909629..7852ce1f12 100644--- a/internal/ai/findings.go+++ b/internal/ai/findings.go@@ -2243,6 +2243,13 @@ func (s *FindingsStore) Undismiss(id string) bool {return false}+ s.undismissLocked(f)+ s.mu.Unlock()+ s.scheduleSave()+ return true+}++func (s *FindingsStore) undismissLocked(f *Finding) {// Clear dismissal statef.DismissedReason = ""f.Suppressed = false@@ -2257,10 +2264,6 @@ func (s *FindingsStore) Undismiss(id string) bool {s.activeCounts[f.Severity]++}s.syncLoopStateLocked(f)-- s.mu.Unlock()- s.scheduleSave()- return true}// UpdateInvestigationRecord stores the durable investigation record for a finding.@@ -2934,15 +2937,10 @@ func (s *FindingsStore) DeleteSuppressionRule(ruleID string) bool {if strings.HasPrefix(ruleID, "finding_") {findingID := strings.TrimPrefix(ruleID, "finding_")if f, exists := s.findings[findingID]; exists && (f.Suppressed || f.DismissedReason != "") {- // Un-suppress/undismiss the finding- wasActive := f.IsActive()- f.Suppressed = false- f.DismissedReason = ""- f.AcknowledgedAt = nil- // If it wasn't active before but is now, increment count- if !wasActive && f.IsActive() {- s.activeCounts[f.Severity]++- }+ // Finding-backed suppression rows are the management surface for+ // dismissed findings. Use the canonical transition so reopening+ // also clears RemindAt and records an undismissed lifecycle event.+ s.undismissLocked(f)s.mu.Unlock()s.scheduleSave()return truediff --git a/internal/ai/findings_coverage_test.go b/internal/ai/findings_coverage_test.goindex c938df9ca0..f332040741 100644--- a/internal/ai/findings_coverage_test.go+++ b/internal/ai/findings_coverage_test.go@@ -822,11 +822,13 @@ func TestFindingsStore_DeleteSuppressionRule_Explicit(t *testing.T) {func TestFindingsStore_DeleteSuppressionRule_ReactivatesFinding(t *testing.T) {store := NewFindingsStore()+ remindAt := time.Now().Add(24 * time.Hour)store.findings["f1"] = &Finding{ID: "f1",Severity: FindingSeverityWarning,DismissedReason: "not_an_issue",Suppressed: true,+ RemindAt: &remindAt,}store.activeCounts[FindingSeverityWarning] = 0@@ -836,4 +838,11 @@ func TestFindingsStore_DeleteSuppressionRule_ReactivatesFinding(t *testing.T) {if store.activeCounts[FindingSeverityWarning] != 1 {t.Errorf("expected active count to increment, got %d", store.activeCounts[FindingSeverityWarning])}+ reopened := store.Get("f1")+ if reopened.RemindAt != nil {+ t.Fatalf("expected reopen to clear reminder, got %v", reopened.RemindAt)+ }+ if got := reopened.Lifecycle[len(reopened.Lifecycle)-1].Type; got != "undismissed" {+ t.Fatalf("expected undismissed lifecycle event, got %q", got)+ }}diff --git a/internal/ai/unified/alerts.go b/internal/ai/unified/alerts.goindex 22c4ef28a0..f0932f6e33 100644--- a/internal/ai/unified/alerts.go+++ b/internal/ai/unified/alerts.go@@ -990,6 +990,28 @@ func (s *UnifiedStore) Dismiss(findingID, reason, note string) bool {return true}+// Undismiss reopens a dismissed finding while preserving its operator note.+// The Patrol findings store remains authoritative for lifecycle history; this+// mirror keeps the unified findings projection immediately consistent.+func (s *UnifiedStore) Undismiss(findingID string) bool {+ s.mu.Lock()++ f, ok := s.findings[findingID]+ if !ok || (f.DismissedReason == "" && !f.Suppressed) {+ s.mu.Unlock()+ return false+ }++ f.DismissedReason = ""+ f.Suppressed = false+ f.AcknowledgedAt = nil+ f.RemindAt = nil++ s.mu.Unlock()+ s.scheduleSave()+ return true+}+// Snooze snoozes a finding for the specified durationfunc (s *UnifiedStore) Snooze(findingID string, duration time.Duration) bool {s.mu.Lock()diff --git a/internal/ai/unified/alerts_test.go b/internal/ai/unified/alerts_test.goindex 5a7b4ea0f3..f386745712 100644--- a/internal/ai/unified/alerts_test.go+++ b/internal/ai/unified/alerts_test.go@@ -411,6 +411,49 @@ func TestUnifiedStore_Dismiss(t *testing.T) {}}+func TestUnifiedStore_Undismiss(t *testing.T) {+ store := NewUnifiedStore(DefaultAlertToFindingConfig())+ finding, _ := store.AddFromAlert(&SimpleAlertAdapter{+ AlertIdentifier: "alert-undismiss",+ AlertType: "cpu",+ AlertLevel: "warning",+ ResourceID: "vm-101",+ ResourceName: "web-server",+ Value: 85.5,+ Threshold: 80.0,+ StartTime: time.Now(),+ LastSeen: time.Now(),+ })++ if store.Undismiss(finding.ID) {+ t.Fatal("expected an active finding not to be reopened")+ }+ if !store.Dismiss(finding.ID, "not_an_issue", "keep this note") {+ t.Fatal("expected dismiss to succeed")+ }+ remindAt := time.Now().Add(time.Hour)+ store.mu.Lock()+ store.findings[finding.ID].RemindAt = &remindAt+ store.mu.Unlock()++ if !store.Undismiss(finding.ID) {+ t.Fatal("expected dismissed finding to reopen")+ }+ reopened := store.Get(finding.ID)+ if reopened.DismissedReason != "" || reopened.Suppressed || reopened.AcknowledgedAt != nil {+ t.Fatalf("dismissal state was not cleared: %+v", reopened)+ }+ if reopened.RemindAt != nil {+ t.Fatalf("expected reminder to clear, got %v", reopened.RemindAt)+ }+ if reopened.UserNote != "keep this note" {+ t.Fatalf("expected operator note to survive reopen, got %q", reopened.UserNote)+ }+ if !reopened.IsActive() {+ t.Fatal("expected reopened finding to be active")+ }+}+func TestUnifiedStore_Snooze(t *testing.T) {store := NewUnifiedStore(DefaultAlertToFindingConfig())diff --git a/internal/api/ai_handlers.go b/internal/api/ai_handlers.goindex 25c8c0890f..f70e816878 100644--- a/internal/api/ai_handlers.go+++ b/internal/api/ai_handlers.go@@ -7569,19 +7569,31 @@ func (h *AISettingsHandler) HandleDeleteSuppressionRule(w http.ResponseWriter, r}findings := patrol.GetFindings()+ isFindingRule := strings.HasPrefix(ruleID, "finding_")if !findings.DeleteSuppressionRule(ruleID) {http.Error(w, "Rule not found", http.StatusNotFound)return}+ if isFindingRule {+ findingID := strings.TrimPrefix(ruleID, "finding_")+ if unifiedStore := h.GetUnifiedStoreForOrg(GetOrgID(r.Context())); unifiedStore != nil {+ unifiedStore.Undismiss(findingID)+ }+ }+log.Info().Str("rule_id", ruleID).Msg("AI Patrol: Suppression rule deleted")+ message := "Suppression rule deleted"+ if isFindingRule {+ message = "Finding reopened"+ }response := map[string]interface{}{"success": true,- "message": "Suppression rule deleted",+ "message": message,}if err := utils.WriteJSONResponse(w, response); err != nil {diff --git a/internal/api/ai_handlers_patrol_actions_additional_test.go b/internal/api/ai_handlers_patrol_actions_additional_test.goindex 66b34277a2..eb62d1a508 100644--- a/internal/api/ai_handlers_patrol_actions_additional_test.go+++ b/internal/api/ai_handlers_patrol_actions_additional_test.go@@ -730,6 +730,43 @@ func TestHandleDismissFinding_ValidReason(t *testing.T) {}}+func TestHandleDeleteSuppressionRule_ReopensFindingInBothStores(t *testing.T) {+ handler, patrol, unifiedStore, _ := setupAIHandlerWithPatrol(t)++ detectedAt := time.Now().Add(-3 * time.Hour)+ addPatrolFinding(t, patrol, "finding-reopen", detectedAt)+ addUnifiedFinding(unifiedStore, "finding-reopen", detectedAt)+ if !patrol.GetFindings().Dismiss("finding-reopen", "expected_behavior", "known load test") {+ t.Fatal("expected patrol finding dismissal to succeed")+ }+ if !unifiedStore.Dismiss("finding-reopen", "expected_behavior", "known load test") {+ t.Fatal("expected unified finding dismissal to succeed")+ }++ req := newLoopbackRequest(http.MethodDelete, "/api/ai/patrol/suppressions/finding_finding-reopen", nil)+ rec := httptest.NewRecorder()++ handler.HandleDeleteSuppressionRule(rec, req)++ if rec.Code != http.StatusOK {+ t.Fatalf("status = %d, want 200", rec.Code)+ }+ patrolFinding := patrol.GetFindings().Get("finding-reopen")+ if patrolFinding == nil || patrolFinding.DismissedReason != "" || patrolFinding.Suppressed {+ t.Fatalf("expected patrol finding to be reopened: %+v", patrolFinding)+ }+ if patrolFinding.UserNote != "known load test" {+ t.Fatalf("expected patrol note to survive reopen, got %q", patrolFinding.UserNote)+ }+ unifiedFinding := unifiedStore.Get("finding-reopen")+ if unifiedFinding == nil || unifiedFinding.DismissedReason != "" || unifiedFinding.Suppressed {+ t.Fatalf("expected unified finding to be reopened: %+v", unifiedFinding)+ }+ if unifiedFinding.UserNote != "known load test" {+ t.Fatalf("expected unified note to survive reopen, got %q", unifiedFinding.UserNote)+ }+}+func TestHandleSuppressFinding_SetsSuppressed(t *testing.T) {handler, patrol, unifiedStore, learningStore := setupAIHandlerWithPatrol(t)