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
Preserve previous successful fix across regressions
rcourtmanb5c8e008593f
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 222f3718d5..d01adadebf 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -430,7 +430,11 @@ profile and assignment columns, but embedded table framing must route throughto operator-facing finding fields like `impact` and `recommendation`propagated through that router conversion: lifecycle surfaces may renderthem in finding context but must not treat them as enrollment, installer,- or fleet-control authority for the named resource. Assistant chat enrichment from+ or fleet-control authority for the named resource. The same scope applies+ to the `previous_resolved_fix_summary` operational-memory field carried on+ findings across regressions: lifecycle surfaces may render it in finding+ context but must not replay the recorded fix description as an installer+ command, enrollment action, or fleet-control instruction. Assistant chat enrichment from`finding_id` follows the same rule: lifecycle-owned command execution andagent auto-approval policy stay canonical in the agent/runtime owners, notin Patrol investigation-record prompt text. Model-only Assistant handoffdiff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex d6e2b240de..307a9af790 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -287,7 +287,19 @@ runtime cost control, and shared AI transport surfaces.operational consequences (named workloads, jobs, recovery windows)and to leave `impact` empty rather than fabricate one when theconsequence is genuinely unknown; the runtime must not synthesize a- default in that case. When `/api/ai/chat` receives `finding_id`, the+ default in that case.+ Findings carry a `previous_resolved_fix_summary` field as+ operational memory across regressions: when a finding that had a+ resolved investigation with a proposed fix is re-detected,+ `FindingsStore.Add` captures+ `existing.InvestigationRecord.ProposedFix.Description` into the new+ field BEFORE clearing the investigation record, and the chat-context+ builder surfaces it as a "Previous Resolved Fix" line so Assistant+ sees what worked last time rather than treating each regression as a+ blank-slate diagnosis. The summary mirrors onto+ `unified.UnifiedFinding` and propagates through the Finding to+ UnifiedFinding conversion in `internal/api/router.go` and through+ `UnifiedStore.AddFromAI`'s update branch (non-empty overwrite). When `/api/ai/chat` receives `finding_id`, theruntime must enrich the provider turn from that durable record whilepreserving the user's authored prompt as the persisted conversationmessage; the model-only handoff may persist as session metadata sodiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex a818dbae83..14fda840b2 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -965,7 +965,17 @@ the canonical monitored-system blocked payload.alongside `description` and `recommendation` rather than dropping it;persisted findings created by older binaries must adopt thefreshly-classified impact text on next re-detection rather than- preserving the empty value+ preserving the empty value.+ `unified.UnifiedFinding` also carries a+ `previous_resolved_fix_summary` operational-memory field captured at+ regression time from+ `existing.InvestigationRecord.ProposedFix.Description`. The+ AddFromAI update branch must propagate non-empty+ `previous_resolved_fix_summary` into the existing finding using the+ same overwrite pattern as `description`, `impact`, and+ `recommendation`, and the Finding to UnifiedFinding conversion in+ `internal/api/router.go` must copy `f.PreviousResolvedFixSummary`+ alongside the other operator-facing stringsand the Assistant finding-context request contract, so `/api/ai/chat`payloads carrying `finding_id` may hydrate a structured investigationsummary from the unified finding, but raw proposed-fix commands must staydiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 4d5d47ab7a..54fc6085e9 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -178,7 +178,11 @@ regression protection.fields copied from Finding to UnifiedFinding through that router callback:the callback may pass them through as already-materialized strings but mustnot invoke models, persistence walks, or evidence aggregation to derive- them on the protected hot path.+ them on the protected hot path. The `previous_resolved_fix_summary`+ operational-memory field follows the same constraint: the router callback+ passes the already-captured string from `FindingsStore.Add` rather than+ reaching back into investigation history or persistence to re-derive it+ inside the request setup path.Patrol run Assistant handoff wiring in `internal/api/router.go` follows thesame protected hot-path rule: the shared callback may resolve one requestedPatrol run ID from the already-owned Patrol service and strip tool tracesdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 7c3e107bc0..0b23a7c900 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -236,6 +236,12 @@ bypass the API fail-closed execution gate.`internal/api/router.go` Finding to UnifiedFinding conversion: storage andrecovery surfaces may render them as adjacent finding context but must notreinterpret them as backup, restore, or storage remediation authority.+ The `previous_resolved_fix_summary` operational-memory field carried on+ findings across regressions follows the same scope: storage and recovery+ surfaces may render it as adjacent finding context but must not+ auto-apply the recorded fix description as a backup, restore, or storage+ remediation action; replaying a prior fix is the action broker's+ authority, not the storage/recovery surface's.Shared Patrol autonomy routes may also touch broad `internal/api/` wiring,but monitor-mode AI configuration and remediation entitlement responses stayAI runtime/API-contract owned and must not become recovery-local policy,diff --git a/internal/ai/findings.go b/internal/ai/findings.goindex 9784dcc2bf..8d555fa058 100644--- a/internal/ai/findings.go+++ b/internal/ai/findings.go@@ -104,28 +104,33 @@ const maxFindingLifecycleEvents = 50// Finding represents an AI-discovered insight about infrastructuretype Finding struct {- ID string `json:"id"`- Key string `json:"key,omitempty"` // Stable issue key for runbook matching- Severity FindingSeverity `json:"severity"`- Category FindingCategory `json:"category"`- ResourceID string `json:"resource_id"`- ResourceName string `json:"resource_name"`- ResourceType string `json:"resource_type"` // node, vm, container, docker, storage, agent, pbs, agent_raid- Node string `json:"node,omitempty"`- Title string `json:"title"`- Description string `json:"description"`- Impact string `json:"impact,omitempty"` // Operator-facing consequence-if-ignored statement- Recommendation string `json:"recommendation,omitempty"`- Evidence string `json:"evidence,omitempty"` // data/commands that led to this finding- Source string `json:"source,omitempty"` // "ai-analysis" for LLM findings, empty for rule-based- FailureCause string `json:"failure_cause,omitempty"`- DetectedAt time.Time `json:"detected_at"`- LastSeenAt time.Time `json:"last_seen_at"`- ResolvedAt *time.Time `json:"resolved_at,omitempty"`- AutoResolved bool `json:"auto_resolved"`- ResolveReason string `json:"resolve_reason,omitempty"` // Why the finding was resolved (e.g., "No longer detected by patrol")- AcknowledgedAt *time.Time `json:"acknowledged_at,omitempty"`- SnoozedUntil *time.Time `json:"snoozed_until,omitempty"` // Finding hidden until this time+ ID string `json:"id"`+ Key string `json:"key,omitempty"` // Stable issue key for runbook matching+ Severity FindingSeverity `json:"severity"`+ Category FindingCategory `json:"category"`+ ResourceID string `json:"resource_id"`+ ResourceName string `json:"resource_name"`+ ResourceType string `json:"resource_type"` // node, vm, container, docker, storage, agent, pbs, agent_raid+ Node string `json:"node,omitempty"`+ Title string `json:"title"`+ Description string `json:"description"`+ Impact string `json:"impact,omitempty"` // Operator-facing consequence-if-ignored statement+ // PreviousResolvedFixSummary preserves the description of the fix that+ // resolved this finding the last time it was active. Captured at+ // regression time before InvestigationRecord is cleared, so the next+ // investigation has operational memory of what worked previously.+ PreviousResolvedFixSummary string `json:"previous_resolved_fix_summary,omitempty"`+ Recommendation string `json:"recommendation,omitempty"`+ Evidence string `json:"evidence,omitempty"` // data/commands that led to this finding+ Source string `json:"source,omitempty"` // "ai-analysis" for LLM findings, empty for rule-based+ FailureCause string `json:"failure_cause,omitempty"`+ DetectedAt time.Time `json:"detected_at"`+ LastSeenAt time.Time `json:"last_seen_at"`+ ResolvedAt *time.Time `json:"resolved_at,omitempty"`+ AutoResolved bool `json:"auto_resolved"`+ ResolveReason string `json:"resolve_reason,omitempty"` // Why the finding was resolved (e.g., "No longer detected by patrol")+ AcknowledgedAt *time.Time `json:"acknowledged_at,omitempty"`+ SnoozedUntil *time.Time `json:"snoozed_until,omitempty"` // Finding hidden until this time// Link to alert if this finding was triggered by or attached to an alert.AlertIdentifier string `json:"-"`@@ -150,85 +155,87 @@ type Finding struct {}type findingJSON struct {- ID string `json:"id"`- Key string `json:"key,omitempty"`- Severity FindingSeverity `json:"severity"`- Category FindingCategory `json:"category"`- ResourceID string `json:"resource_id"`- ResourceName string `json:"resource_name"`- ResourceType string `json:"resource_type"`- Node string `json:"node,omitempty"`- Title string `json:"title"`- Description string `json:"description"`- Impact string `json:"impact,omitempty"`- Recommendation string `json:"recommendation,omitempty"`- Evidence string `json:"evidence,omitempty"`- Source string `json:"source,omitempty"`- FailureCause string `json:"failure_cause,omitempty"`- DetectedAt time.Time `json:"detected_at"`- LastSeenAt time.Time `json:"last_seen_at"`- ResolvedAt *time.Time `json:"resolved_at,omitempty"`- AutoResolved bool `json:"auto_resolved"`- ResolveReason string `json:"resolve_reason,omitempty"`- AcknowledgedAt *time.Time `json:"acknowledged_at,omitempty"`- SnoozedUntil *time.Time `json:"snoozed_until,omitempty"`- AlertIdentifier string `json:"alert_identifier,omitempty"`- DismissedReason string `json:"dismissed_reason,omitempty"`- UserNote string `json:"user_note,omitempty"`- TimesRaised int `json:"times_raised"`- Suppressed bool `json:"suppressed"`- InvestigationSessionID string `json:"investigation_session_id,omitempty"`- InvestigationStatus string `json:"investigation_status,omitempty"`- InvestigationOutcome string `json:"investigation_outcome,omitempty"`- LastInvestigatedAt *time.Time `json:"last_investigated_at,omitempty"`- InvestigationAttempts int `json:"investigation_attempts"`- InvestigationRecord *aicontracts.InvestigationRecord `json:"investigation_record,omitempty"`- LoopState string `json:"loop_state,omitempty"`- Lifecycle []FindingLifecycleEvent `json:"lifecycle,omitempty"`- RegressionCount int `json:"regression_count,omitempty"`- LastRegressionAt *time.Time `json:"last_regression_at,omitempty"`+ ID string `json:"id"`+ Key string `json:"key,omitempty"`+ Severity FindingSeverity `json:"severity"`+ Category FindingCategory `json:"category"`+ ResourceID string `json:"resource_id"`+ ResourceName string `json:"resource_name"`+ ResourceType string `json:"resource_type"`+ Node string `json:"node,omitempty"`+ Title string `json:"title"`+ Description string `json:"description"`+ Impact string `json:"impact,omitempty"`+ PreviousResolvedFixSummary string `json:"previous_resolved_fix_summary,omitempty"`+ Recommendation string `json:"recommendation,omitempty"`+ Evidence string `json:"evidence,omitempty"`+ Source string `json:"source,omitempty"`+ FailureCause string `json:"failure_cause,omitempty"`+ DetectedAt time.Time `json:"detected_at"`+ LastSeenAt time.Time `json:"last_seen_at"`+ ResolvedAt *time.Time `json:"resolved_at,omitempty"`+ AutoResolved bool `json:"auto_resolved"`+ ResolveReason string `json:"resolve_reason,omitempty"`+ AcknowledgedAt *time.Time `json:"acknowledged_at,omitempty"`+ SnoozedUntil *time.Time `json:"snoozed_until,omitempty"`+ AlertIdentifier string `json:"alert_identifier,omitempty"`+ DismissedReason string `json:"dismissed_reason,omitempty"`+ UserNote string `json:"user_note,omitempty"`+ TimesRaised int `json:"times_raised"`+ Suppressed bool `json:"suppressed"`+ InvestigationSessionID string `json:"investigation_session_id,omitempty"`+ InvestigationStatus string `json:"investigation_status,omitempty"`+ InvestigationOutcome string `json:"investigation_outcome,omitempty"`+ LastInvestigatedAt *time.Time `json:"last_investigated_at,omitempty"`+ InvestigationAttempts int `json:"investigation_attempts"`+ InvestigationRecord *aicontracts.InvestigationRecord `json:"investigation_record,omitempty"`+ LoopState string `json:"loop_state,omitempty"`+ Lifecycle []FindingLifecycleEvent `json:"lifecycle,omitempty"`+ RegressionCount int `json:"regression_count,omitempty"`+ LastRegressionAt *time.Time `json:"last_regression_at,omitempty"`}func (f Finding) MarshalJSON() ([]byte, error) {alertIdentifier := strings.TrimSpace(f.AlertIdentifier)return json.Marshal(findingJSON{- ID: f.ID,- Key: f.Key,- Severity: f.Severity,- Category: f.Category,- ResourceID: f.ResourceID,- ResourceName: f.ResourceName,- ResourceType: f.ResourceType,- Node: f.Node,- Title: f.Title,- Description: f.Description,- Impact: f.Impact,- Recommendation: f.Recommendation,- Evidence: f.Evidence,- Source: f.Source,- FailureCause: f.FailureCause,- DetectedAt: f.DetectedAt,- LastSeenAt: f.LastSeenAt,- ResolvedAt: f.ResolvedAt,- AutoResolved: f.AutoResolved,- ResolveReason: f.ResolveReason,- AcknowledgedAt: f.AcknowledgedAt,- SnoozedUntil: f.SnoozedUntil,- AlertIdentifier: alertIdentifier,- DismissedReason: f.DismissedReason,- UserNote: f.UserNote,- TimesRaised: f.TimesRaised,- Suppressed: f.Suppressed,- InvestigationSessionID: f.InvestigationSessionID,- InvestigationStatus: f.InvestigationStatus,- InvestigationOutcome: f.InvestigationOutcome,- LastInvestigatedAt: f.LastInvestigatedAt,- InvestigationAttempts: f.InvestigationAttempts,- InvestigationRecord: f.InvestigationRecord,- LoopState: f.LoopState,- Lifecycle: f.Lifecycle,- RegressionCount: f.RegressionCount,- LastRegressionAt: f.LastRegressionAt,+ ID: f.ID,+ Key: f.Key,+ Severity: f.Severity,+ Category: f.Category,+ ResourceID: f.ResourceID,+ ResourceName: f.ResourceName,+ ResourceType: f.ResourceType,+ Node: f.Node,+ Title: f.Title,+ Description: f.Description,+ Impact: f.Impact,+ PreviousResolvedFixSummary: f.PreviousResolvedFixSummary,+ Recommendation: f.Recommendation,+ Evidence: f.Evidence,+ Source: f.Source,+ FailureCause: f.FailureCause,+ DetectedAt: f.DetectedAt,+ LastSeenAt: f.LastSeenAt,+ ResolvedAt: f.ResolvedAt,+ AutoResolved: f.AutoResolved,+ ResolveReason: f.ResolveReason,+ AcknowledgedAt: f.AcknowledgedAt,+ SnoozedUntil: f.SnoozedUntil,+ AlertIdentifier: alertIdentifier,+ DismissedReason: f.DismissedReason,+ UserNote: f.UserNote,+ TimesRaised: f.TimesRaised,+ Suppressed: f.Suppressed,+ InvestigationSessionID: f.InvestigationSessionID,+ InvestigationStatus: f.InvestigationStatus,+ InvestigationOutcome: f.InvestigationOutcome,+ LastInvestigatedAt: f.LastInvestigatedAt,+ InvestigationAttempts: f.InvestigationAttempts,+ InvestigationRecord: f.InvestigationRecord,+ LoopState: f.LoopState,+ Lifecycle: f.Lifecycle,+ RegressionCount: f.RegressionCount,+ LastRegressionAt: f.LastRegressionAt,})}@@ -239,43 +246,44 @@ func (f *Finding) UnmarshalJSON(data []byte) error {}*f = Finding{- ID: payload.ID,- Key: payload.Key,- Severity: payload.Severity,- Category: payload.Category,- ResourceID: payload.ResourceID,- ResourceName: payload.ResourceName,- ResourceType: payload.ResourceType,- Node: payload.Node,- Title: payload.Title,- Description: payload.Description,- Impact: payload.Impact,- Recommendation: payload.Recommendation,- Evidence: payload.Evidence,- Source: payload.Source,- FailureCause: payload.FailureCause,- DetectedAt: payload.DetectedAt,- LastSeenAt: payload.LastSeenAt,- ResolvedAt: payload.ResolvedAt,- AutoResolved: payload.AutoResolved,- ResolveReason: payload.ResolveReason,- AcknowledgedAt: payload.AcknowledgedAt,- SnoozedUntil: payload.SnoozedUntil,- AlertIdentifier: strings.TrimSpace(payload.AlertIdentifier),- DismissedReason: payload.DismissedReason,- UserNote: payload.UserNote,- TimesRaised: payload.TimesRaised,- Suppressed: payload.Suppressed,- InvestigationSessionID: payload.InvestigationSessionID,- InvestigationStatus: payload.InvestigationStatus,- InvestigationOutcome: payload.InvestigationOutcome,- LastInvestigatedAt: payload.LastInvestigatedAt,- InvestigationAttempts: payload.InvestigationAttempts,- InvestigationRecord: payload.InvestigationRecord,- LoopState: payload.LoopState,- Lifecycle: payload.Lifecycle,- RegressionCount: payload.RegressionCount,- LastRegressionAt: payload.LastRegressionAt,+ ID: payload.ID,+ Key: payload.Key,+ Severity: payload.Severity,+ Category: payload.Category,+ ResourceID: payload.ResourceID,+ ResourceName: payload.ResourceName,+ ResourceType: payload.ResourceType,+ Node: payload.Node,+ Title: payload.Title,+ Description: payload.Description,+ Impact: payload.Impact,+ PreviousResolvedFixSummary: payload.PreviousResolvedFixSummary,+ Recommendation: payload.Recommendation,+ Evidence: payload.Evidence,+ Source: payload.Source,+ FailureCause: payload.FailureCause,+ DetectedAt: payload.DetectedAt,+ LastSeenAt: payload.LastSeenAt,+ ResolvedAt: payload.ResolvedAt,+ AutoResolved: payload.AutoResolved,+ ResolveReason: payload.ResolveReason,+ AcknowledgedAt: payload.AcknowledgedAt,+ SnoozedUntil: payload.SnoozedUntil,+ AlertIdentifier: strings.TrimSpace(payload.AlertIdentifier),+ DismissedReason: payload.DismissedReason,+ UserNote: payload.UserNote,+ TimesRaised: payload.TimesRaised,+ Suppressed: payload.Suppressed,+ InvestigationSessionID: payload.InvestigationSessionID,+ InvestigationStatus: payload.InvestigationStatus,+ InvestigationOutcome: payload.InvestigationOutcome,+ LastInvestigatedAt: payload.LastInvestigatedAt,+ InvestigationAttempts: payload.InvestigationAttempts,+ InvestigationRecord: payload.InvestigationRecord,+ LoopState: payload.LoopState,+ Lifecycle: payload.Lifecycle,+ RegressionCount: payload.RegressionCount,+ LastRegressionAt: payload.LastRegressionAt,}return nil}@@ -996,6 +1004,15 @@ func (s *FindingsStore) Add(f *Finding) bool {prevResolvedAt := existing.ResolvedAtprevResolveReason := existing.ResolveReasonhadAcknowledgement := existing.AcknowledgedAt != nil+ // Capture the prior successful fix as operational memory before+ // the investigation record is cleared. This preserves "what worked+ // last time" across regressions so the next investigation does+ // not start from blank context.+ if existing.InvestigationRecord != nil && existing.InvestigationRecord.ProposedFix != nil {+ if desc := strings.TrimSpace(existing.InvestigationRecord.ProposedFix.Description); desc != "" {+ existing.PreviousResolvedFixSummary = desc+ }+ }existing.ResolvedAt = nilexisting.AutoResolved = falseexisting.ResolveReason = ""diff --git a/internal/ai/findings_test.go b/internal/ai/findings_test.goindex 514c594262..713dfc3f9e 100644--- a/internal/ai/findings_test.go+++ b/internal/ai/findings_test.go@@ -4,6 +4,8 @@ import ("strings""testing""time"++ "github.com/rcourtman/pulse-go-rewrite/pkg/aicontracts")func TestFinding_IsActive(t *testing.T) {@@ -553,6 +555,66 @@ func TestFindingsStore_Add_UpdateExisting(t *testing.T) {}}+// TestFindingsStore_Add_CapturesPreviousResolvedFixOnRegression covers the+// regression branch: when a finding that had a resolved investigation with a+// proposed fix is re-detected, the prior fix description must be preserved on+// PreviousResolvedFixSummary as operational memory before InvestigationRecord+// is cleared. Without this capture the next investigation cannot reason about+// what worked last time.+func TestFindingsStore_Add_CapturesPreviousResolvedFixOnRegression(t *testing.T) {+ store := NewFindingsStore()++ // Initial detection+ store.Add(&Finding{+ ID: "f-regress",+ ResourceID: "vm-100",+ Severity: FindingSeverityWarning,+ Category: FindingCategoryReliability,+ Title: "Service stalled",+ Description: "Service stopped responding",+ })++ // Mark the finding as resolved with an investigation record carrying a+ // proposed fix, mimicking a successful Patrol-then-fix loop. UpdateInvestigationRecord+ // and ResolveWithReason mutate the canonical stored finding (Get returns a copy).+ store.UpdateInvestigationRecord("f-regress", &aicontracts.InvestigationRecord{+ ID: "investigation-1",+ FindingID: "f-regress",+ Status: aicontracts.InvestigationStatusCompleted,+ Outcome: aicontracts.OutcomeFixVerified,+ ProposedFix: &aicontracts.InvestigationRecordFix{+ ID: "fix-1",+ Description: "Restart the workload service after backup window clears",+ Commands: []string{"systemctl restart workload.service"},+ },+ Verification: []string{"Service is responsive within 60s"},+ ToolsUsed: []string{"ssh.exec"},+ })+ store.ResolveWithReason("f-regress", "verified-recovery")++ // Re-detection of the same finding triggers the regression branch.+ store.Add(&Finding{+ ID: "f-regress",+ ResourceID: "vm-100",+ Severity: FindingSeverityWarning,+ Category: FindingCategoryReliability,+ Title: "Service stalled",+ Description: "Service stopped responding again",+ })++ regressed := store.Get("f-regress")+ if regressed.RegressionCount != 1 {+ t.Fatalf("expected RegressionCount=1, got %d", regressed.RegressionCount)+ }+ if regressed.InvestigationRecord != nil {+ t.Fatalf("expected InvestigationRecord cleared on regression, got %#v", regressed.InvestigationRecord)+ }+ want := "Restart the workload service after backup window clears"+ if regressed.PreviousResolvedFixSummary != want {+ t.Fatalf("expected PreviousResolvedFixSummary=%q, got %q", want, regressed.PreviousResolvedFixSummary)+ }+}+// TestFindingsStore_Add_PropagatesImpactFieldOnUpdate covers the dedup-merge// path where a re-detected finding carries newly-authored Impact text. The// existing finding may have been persisted before Impact was a contract field,diff --git a/internal/ai/unified/alerts.go b/internal/ai/unified/alerts.goindex 5d9e56decb..af05248bdc 100644--- a/internal/ai/unified/alerts.go+++ b/internal/ai/unified/alerts.go@@ -68,19 +68,20 @@ type UnifiedFindingLifecycleEvent struct {// UnifiedFinding represents a unified finding that can originate from// threshold alerts, AI analysis, or other detection methodstype UnifiedFinding struct {- ID string `json:"id"`- Source FindingSource `json:"source"`- Severity UnifiedSeverity `json:"severity"`- Category UnifiedCategory `json:"category"`- ResourceID string `json:"resource_id"`- ResourceName string `json:"resource_name"`- ResourceType string `json:"resource_type"`- Node string `json:"node,omitempty"`- Title string `json:"title"`- Description string `json:"description"`- Impact string `json:"impact,omitempty"` // Operator-facing consequence-if-ignored statement- Recommendation string `json:"recommendation,omitempty"`- Evidence string `json:"evidence,omitempty"`+ ID string `json:"id"`+ Source FindingSource `json:"source"`+ Severity UnifiedSeverity `json:"severity"`+ Category UnifiedCategory `json:"category"`+ ResourceID string `json:"resource_id"`+ ResourceName string `json:"resource_name"`+ ResourceType string `json:"resource_type"`+ Node string `json:"node,omitempty"`+ Title string `json:"title"`+ Description string `json:"description"`+ Impact string `json:"impact,omitempty"` // Operator-facing consequence-if-ignored statement+ PreviousResolvedFixSummary string `json:"previous_resolved_fix_summary,omitempty"`+ Recommendation string `json:"recommendation,omitempty"`+ Evidence string `json:"evidence,omitempty"`// Threshold-specific fields (when Source == "threshold")AlertIdentifier string `json:"-"`@@ -125,99 +126,101 @@ type UnifiedFinding struct {}type unifiedFindingJSON struct {- ID string `json:"id"`- Source FindingSource `json:"source"`- Severity UnifiedSeverity `json:"severity"`- Category UnifiedCategory `json:"category"`- ResourceID string `json:"resource_id"`- ResourceName string `json:"resource_name"`- ResourceType string `json:"resource_type"`- Node string `json:"node,omitempty"`- Title string `json:"title"`- Description string `json:"description"`- Impact string `json:"impact,omitempty"`- Recommendation string `json:"recommendation,omitempty"`- Evidence string `json:"evidence,omitempty"`- AlertIdentifier string `json:"alert_identifier,omitempty"`- AlertType string `json:"alert_type,omitempty"`- Value float64 `json:"value,omitempty"`- Threshold float64 `json:"threshold,omitempty"`- IsThreshold bool `json:"is_threshold"`- AIContext string `json:"ai_context,omitempty"`- RootCauseID string `json:"root_cause_id,omitempty"`- CorrelatedIDs []string `json:"correlated_ids,omitempty"`- RemediationID string `json:"remediation_id,omitempty"`- AIConfidence float64 `json:"ai_confidence,omitempty"`- EnhancedByAI bool `json:"enhanced_by_ai"`- AIEnhancedAt *time.Time `json:"ai_enhanced_at,omitempty"`- InvestigationSessionID string `json:"investigation_session_id,omitempty"`- InvestigationStatus string `json:"investigation_status,omitempty"`- InvestigationOutcome string `json:"investigation_outcome,omitempty"`- LastInvestigatedAt *time.Time `json:"last_investigated_at,omitempty"`- InvestigationAttempts int `json:"investigation_attempts,omitempty"`- InvestigationRecord *aicontracts.InvestigationRecord `json:"investigation_record,omitempty"`- LoopState string `json:"loop_state,omitempty"`- Lifecycle []UnifiedFindingLifecycleEvent `json:"lifecycle,omitempty"`- RegressionCount int `json:"regression_count,omitempty"`- LastRegressionAt *time.Time `json:"last_regression_at,omitempty"`- DetectedAt time.Time `json:"detected_at"`- LastSeenAt time.Time `json:"last_seen_at"`- ResolvedAt *time.Time `json:"resolved_at,omitempty"`- AcknowledgedAt *time.Time `json:"acknowledged_at,omitempty"`- SnoozedUntil *time.Time `json:"snoozed_until,omitempty"`- DismissedReason string `json:"dismissed_reason,omitempty"`- UserNote string `json:"user_note,omitempty"`- Suppressed bool `json:"suppressed"`- TimesRaised int `json:"times_raised"`+ ID string `json:"id"`+ Source FindingSource `json:"source"`+ Severity UnifiedSeverity `json:"severity"`+ Category UnifiedCategory `json:"category"`+ ResourceID string `json:"resource_id"`+ ResourceName string `json:"resource_name"`+ ResourceType string `json:"resource_type"`+ Node string `json:"node,omitempty"`+ Title string `json:"title"`+ Description string `json:"description"`+ Impact string `json:"impact,omitempty"`+ PreviousResolvedFixSummary string `json:"previous_resolved_fix_summary,omitempty"`+ Recommendation string `json:"recommendation,omitempty"`+ Evidence string `json:"evidence,omitempty"`+ AlertIdentifier string `json:"alert_identifier,omitempty"`+ AlertType string `json:"alert_type,omitempty"`+ Value float64 `json:"value,omitempty"`+ Threshold float64 `json:"threshold,omitempty"`+ IsThreshold bool `json:"is_threshold"`+ AIContext string `json:"ai_context,omitempty"`+ RootCauseID string `json:"root_cause_id,omitempty"`+ CorrelatedIDs []string `json:"correlated_ids,omitempty"`+ RemediationID string `json:"remediation_id,omitempty"`+ AIConfidence float64 `json:"ai_confidence,omitempty"`+ EnhancedByAI bool `json:"enhanced_by_ai"`+ AIEnhancedAt *time.Time `json:"ai_enhanced_at,omitempty"`+ InvestigationSessionID string `json:"investigation_session_id,omitempty"`+ InvestigationStatus string `json:"investigation_status,omitempty"`+ InvestigationOutcome string `json:"investigation_outcome,omitempty"`+ LastInvestigatedAt *time.Time `json:"last_investigated_at,omitempty"`+ InvestigationAttempts int `json:"investigation_attempts,omitempty"`+ InvestigationRecord *aicontracts.InvestigationRecord `json:"investigation_record,omitempty"`+ LoopState string `json:"loop_state,omitempty"`+ Lifecycle []UnifiedFindingLifecycleEvent `json:"lifecycle,omitempty"`+ RegressionCount int `json:"regression_count,omitempty"`+ LastRegressionAt *time.Time `json:"last_regression_at,omitempty"`+ DetectedAt time.Time `json:"detected_at"`+ LastSeenAt time.Time `json:"last_seen_at"`+ ResolvedAt *time.Time `json:"resolved_at,omitempty"`+ AcknowledgedAt *time.Time `json:"acknowledged_at,omitempty"`+ SnoozedUntil *time.Time `json:"snoozed_until,omitempty"`+ DismissedReason string `json:"dismissed_reason,omitempty"`+ UserNote string `json:"user_note,omitempty"`+ Suppressed bool `json:"suppressed"`+ TimesRaised int `json:"times_raised"`}func (f UnifiedFinding) MarshalJSON() ([]byte, error) {alertIdentifier := strings.TrimSpace(f.AlertIdentifier)return json.Marshal(unifiedFindingJSON{- ID: f.ID,- Source: f.Source,- Severity: f.Severity,- Category: f.Category,- ResourceID: f.ResourceID,- ResourceName: f.ResourceName,- ResourceType: f.ResourceType,- Node: f.Node,- Title: f.Title,- Description: f.Description,- Impact: f.Impact,- Recommendation: f.Recommendation,- Evidence: f.Evidence,- AlertIdentifier: alertIdentifier,- AlertType: f.AlertType,- Value: f.Value,- Threshold: f.Threshold,- IsThreshold: f.IsThreshold,- AIContext: f.AIContext,- RootCauseID: f.RootCauseID,- CorrelatedIDs: f.CorrelatedIDs,- RemediationID: f.RemediationID,- AIConfidence: f.AIConfidence,- EnhancedByAI: f.EnhancedByAI,- AIEnhancedAt: f.AIEnhancedAt,- InvestigationSessionID: f.InvestigationSessionID,- InvestigationStatus: f.InvestigationStatus,- InvestigationOutcome: f.InvestigationOutcome,- LastInvestigatedAt: f.LastInvestigatedAt,- InvestigationAttempts: f.InvestigationAttempts,- InvestigationRecord: f.InvestigationRecord,- LoopState: f.LoopState,- Lifecycle: f.Lifecycle,- RegressionCount: f.RegressionCount,- LastRegressionAt: f.LastRegressionAt,- DetectedAt: f.DetectedAt,- LastSeenAt: f.LastSeenAt,- ResolvedAt: f.ResolvedAt,- AcknowledgedAt: f.AcknowledgedAt,- SnoozedUntil: f.SnoozedUntil,- DismissedReason: f.DismissedReason,- UserNote: f.UserNote,- Suppressed: f.Suppressed,- TimesRaised: f.TimesRaised,+ ID: f.ID,+ Source: f.Source,+ Severity: f.Severity,+ Category: f.Category,+ ResourceID: f.ResourceID,+ ResourceName: f.ResourceName,+ ResourceType: f.ResourceType,+ Node: f.Node,+ Title: f.Title,+ Description: f.Description,+ Impact: f.Impact,+ PreviousResolvedFixSummary: f.PreviousResolvedFixSummary,+ Recommendation: f.Recommendation,+ Evidence: f.Evidence,+ AlertIdentifier: alertIdentifier,+ AlertType: f.AlertType,+ Value: f.Value,+ Threshold: f.Threshold,+ IsThreshold: f.IsThreshold,+ AIContext: f.AIContext,+ RootCauseID: f.RootCauseID,+ CorrelatedIDs: f.CorrelatedIDs,+ RemediationID: f.RemediationID,+ AIConfidence: f.AIConfidence,+ EnhancedByAI: f.EnhancedByAI,+ AIEnhancedAt: f.AIEnhancedAt,+ InvestigationSessionID: f.InvestigationSessionID,+ InvestigationStatus: f.InvestigationStatus,+ InvestigationOutcome: f.InvestigationOutcome,+ LastInvestigatedAt: f.LastInvestigatedAt,+ InvestigationAttempts: f.InvestigationAttempts,+ InvestigationRecord: f.InvestigationRecord,+ LoopState: f.LoopState,+ Lifecycle: f.Lifecycle,+ RegressionCount: f.RegressionCount,+ LastRegressionAt: f.LastRegressionAt,+ DetectedAt: f.DetectedAt,+ LastSeenAt: f.LastSeenAt,+ ResolvedAt: f.ResolvedAt,+ AcknowledgedAt: f.AcknowledgedAt,+ SnoozedUntil: f.SnoozedUntil,+ DismissedReason: f.DismissedReason,+ UserNote: f.UserNote,+ Suppressed: f.Suppressed,+ TimesRaised: f.TimesRaised,})}@@ -228,50 +231,51 @@ func (f *UnifiedFinding) UnmarshalJSON(data []byte) error {}*f = UnifiedFinding{- ID: payload.ID,- Source: payload.Source,- Severity: payload.Severity,- Category: payload.Category,- ResourceID: payload.ResourceID,- ResourceName: payload.ResourceName,- ResourceType: payload.ResourceType,- Node: payload.Node,- Title: payload.Title,- Description: payload.Description,- Impact: payload.Impact,- Recommendation: payload.Recommendation,- Evidence: payload.Evidence,- AlertIdentifier: strings.TrimSpace(payload.AlertIdentifier),- AlertType: payload.AlertType,- Value: payload.Value,- Threshold: payload.Threshold,- IsThreshold: payload.IsThreshold,- AIContext: payload.AIContext,- RootCauseID: payload.RootCauseID,- CorrelatedIDs: payload.CorrelatedIDs,- RemediationID: payload.RemediationID,- AIConfidence: payload.AIConfidence,- EnhancedByAI: payload.EnhancedByAI,- AIEnhancedAt: payload.AIEnhancedAt,- InvestigationSessionID: payload.InvestigationSessionID,- InvestigationStatus: payload.InvestigationStatus,- InvestigationOutcome: payload.InvestigationOutcome,- LastInvestigatedAt: payload.LastInvestigatedAt,- InvestigationAttempts: payload.InvestigationAttempts,- InvestigationRecord: payload.InvestigationRecord,- LoopState: payload.LoopState,- Lifecycle: payload.Lifecycle,- RegressionCount: payload.RegressionCount,- LastRegressionAt: payload.LastRegressionAt,- DetectedAt: payload.DetectedAt,- LastSeenAt: payload.LastSeenAt,- ResolvedAt: payload.ResolvedAt,- AcknowledgedAt: payload.AcknowledgedAt,- SnoozedUntil: payload.SnoozedUntil,- DismissedReason: payload.DismissedReason,- UserNote: payload.UserNote,- Suppressed: payload.Suppressed,- TimesRaised: payload.TimesRaised,+ ID: payload.ID,+ Source: payload.Source,+ Severity: payload.Severity,+ Category: payload.Category,+ ResourceID: payload.ResourceID,+ ResourceName: payload.ResourceName,+ ResourceType: payload.ResourceType,+ Node: payload.Node,+ Title: payload.Title,+ Description: payload.Description,+ Impact: payload.Impact,+ PreviousResolvedFixSummary: payload.PreviousResolvedFixSummary,+ Recommendation: payload.Recommendation,+ Evidence: payload.Evidence,+ AlertIdentifier: strings.TrimSpace(payload.AlertIdentifier),+ AlertType: payload.AlertType,+ Value: payload.Value,+ Threshold: payload.Threshold,+ IsThreshold: payload.IsThreshold,+ AIContext: payload.AIContext,+ RootCauseID: payload.RootCauseID,+ CorrelatedIDs: payload.CorrelatedIDs,+ RemediationID: payload.RemediationID,+ AIConfidence: payload.AIConfidence,+ EnhancedByAI: payload.EnhancedByAI,+ AIEnhancedAt: payload.AIEnhancedAt,+ InvestigationSessionID: payload.InvestigationSessionID,+ InvestigationStatus: payload.InvestigationStatus,+ InvestigationOutcome: payload.InvestigationOutcome,+ LastInvestigatedAt: payload.LastInvestigatedAt,+ InvestigationAttempts: payload.InvestigationAttempts,+ InvestigationRecord: payload.InvestigationRecord,+ LoopState: payload.LoopState,+ Lifecycle: payload.Lifecycle,+ RegressionCount: payload.RegressionCount,+ LastRegressionAt: payload.LastRegressionAt,+ DetectedAt: payload.DetectedAt,+ LastSeenAt: payload.LastSeenAt,+ ResolvedAt: payload.ResolvedAt,+ AcknowledgedAt: payload.AcknowledgedAt,+ SnoozedUntil: payload.SnoozedUntil,+ DismissedReason: payload.DismissedReason,+ UserNote: payload.UserNote,+ Suppressed: payload.Suppressed,+ TimesRaised: payload.TimesRaised,}return nil}@@ -626,6 +630,9 @@ func (s *UnifiedStore) AddFromAI(finding *UnifiedFinding) (*UnifiedFinding, boolif finding.Impact != "" {existing.Impact = finding.Impact}+ if finding.PreviousResolvedFixSummary != "" {+ existing.PreviousResolvedFixSummary = finding.PreviousResolvedFixSummary+ }if finding.Evidence != "" {existing.Evidence = finding.Evidence}diff --git a/internal/api/ai_handler.go b/internal/api/ai_handler.goindex 32aca4fbe2..d5840fa0d5 100644--- a/internal/api/ai_handler.go+++ b/internal/api/ai_handler.go@@ -1002,6 +1002,12 @@ func buildUnifiedFindingChatContext(f *unified.UnifiedFinding, lookup unifiedFinif f.LastRegressionAt != nil {appendChatContextLine(&b, "Last Regression At", f.LastRegressionAt.Format(time.RFC3339))}+ // Surface the prior successful fix as operational memory so Assistant+ // and any AI investigation can reason about what worked previously+ // instead of treating each regression as a blank-slate diagnosis.+ if strings.TrimSpace(f.PreviousResolvedFixSummary) != "" {+ appendChatContextLine(&b, "Previous Resolved Fix", f.PreviousResolvedFixSummary)+ }appendChatContextLine(&b, "User Note", f.UserNote)if f.AcknowledgedAt != nil {appendChatContextLine(&b, "Finding Acknowledged At", f.AcknowledgedAt.Format(time.RFC3339))diff --git a/internal/api/ai_handler_test.go b/internal/api/ai_handler_test.goindex 1b434ec197..c2b261d43d 100644--- a/internal/api/ai_handler_test.go+++ b/internal/api/ai_handler_test.go@@ -1482,6 +1482,54 @@ func TestHandleChat_ClearsStoredFindingContextWhenFollowUpFindingMissing(t *testmockSvc.AssertExpectations(t)}+func TestBuildUnifiedFindingChatContext_SurfacesPreviousResolvedFix(t *testing.T) {+ // When a finding has regressed and the prior fix description was+ // preserved on PreviousResolvedFixSummary, the chat context must surface+ // it as operational memory so Assistant and any downstream investigation+ // reason about what worked previously instead of treating each+ // regression as a blank-slate diagnosis.+ finding := &unified.UnifiedFinding{+ ID: "f-regress",+ Source: unified.SourceAIPatrol,+ Severity: unified.SeverityWarning,+ Category: unified.CategoryReliability,+ ResourceID: "vm-100",+ Title: "Service stalled",+ Description: "Service stopped responding again",+ PreviousResolvedFixSummary: "Restart the workload service after backup window clears",+ }++ ctx := buildUnifiedFindingChatContext(finding, nil, nil)+ if !strings.Contains(ctx, "Previous Resolved Fix:") {+ t.Fatalf("expected chat context to include Previous Resolved Fix line, got: %s", ctx)+ }+ if !strings.Contains(ctx, "Restart the workload service after backup window clears") {+ t.Fatalf("expected chat context to include the prior fix description, got: %s", ctx)+ }+}++func TestBuildUnifiedFindingChatContext_OmitsPreviousResolvedFixWhenAbsent(t *testing.T) {+ // Findings that have not regressed (or regressed without a recorded+ // proposed fix) must not emit the Previous Resolved Fix line — the+ // shared appendChatContextLine helper drops empty values, but this+ // assertion pins the contract so future refactors do not turn the+ // missing-memory case into a confusing empty line.+ finding := &unified.UnifiedFinding{+ ID: "f-fresh",+ Source: unified.SourceAIPatrol,+ Severity: unified.SeverityWarning,+ Category: unified.CategoryReliability,+ ResourceID: "vm-200",+ Title: "Fresh issue",+ Description: "Newly detected issue",+ }++ ctx := buildUnifiedFindingChatContext(finding, nil, nil)+ if strings.Contains(ctx, "Previous Resolved Fix") {+ t.Fatalf("expected chat context to omit Previous Resolved Fix when absent, got: %s", ctx)+ }+}+func TestUnifiedFindingChatStatusLifecycleStates(t *testing.T) {now := time.Date(2026, 5, 6, 12, 0, 0, 0, time.UTC)resolvedAt := now.Add(-time.Minute)diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 7806bcc5e1..d8724742c2 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -2943,6 +2943,34 @@ func TestContract_FindingJSONSnapshot(t *testing.T) {assertJSONSnapshot(t, got, want)}+// TestContract_UnifiedFindingPreviousResolvedFixSummaryJSONSnapshot pins the+// canonical JSON shape for the operational-memory field that preserves the+// prior successful fix summary across regressions. The Finding to+// UnifiedFinding conversion in the API router must emit this field under+// the canonical "previous_resolved_fix_summary" key so Assistant context+// and operator surfaces can reason about "what worked last time."+func TestContract_UnifiedFindingPreviousResolvedFixSummaryJSONSnapshot(t *testing.T) {+ finding := unified.UnifiedFinding{+ ID: "uf-regress",+ Source: unified.SourceAIPatrol,+ Severity: unified.SeverityWarning,+ Category: unified.CategoryReliability,+ ResourceID: "vm-100",+ Title: "Service stalled",+ Description: "Service stopped responding again",+ PreviousResolvedFixSummary: "Restart the workload service after backup window clears",+ DetectedAt: time.Date(2026, 5, 8, 12, 0, 0, 0, time.UTC),+ LastSeenAt: time.Date(2026, 5, 8, 12, 5, 0, 0, time.UTC),+ }+ got, err := json.Marshal(finding)+ if err != nil {+ t.Fatalf("marshal unified finding: %v", err)+ }+ if !strings.Contains(string(got), `"previous_resolved_fix_summary":"Restart the workload service after backup window clears"`) {+ t.Fatalf("expected previous_resolved_fix_summary field in canonical UnifiedFinding payload, got %s", got)+ }+}+// TestContract_UnifiedFindingImpactJSONSnapshot pins the canonical JSON shape// for UnifiedFinding payloads carrying the operator-facing Impact field. The// AI engine populates Finding.Impact at detection time and the Finding todiff --git a/internal/api/router.go b/internal/api/router.goindex f8cdabadc8..5c51bb3808 100644--- a/internal/api/router.go+++ b/internal/api/router.go@@ -1708,38 +1708,39 @@ func (r *Router) startPatrolForContext(ctx context.Context, orgID string) bool {patrol.SetUnifiedFindingCallback(func(f *ai.Finding) bool {// Convert ai.Finding to unified.UnifiedFindinguf := &unified.UnifiedFinding{- ID: f.ID,- Source: unified.SourceAIPatrol,- Severity: unified.UnifiedSeverity(f.Severity),- Category: unified.UnifiedCategory(f.Category),- ResourceID: f.ResourceID,- ResourceName: f.ResourceName,- ResourceType: f.ResourceType,- Node: f.Node,- Title: f.Title,- Description: f.Description,- Impact: f.Impact,- Recommendation: f.Recommendation,- Evidence: f.Evidence,- DetectedAt: f.DetectedAt,- LastSeenAt: f.LastSeenAt,- ResolvedAt: f.ResolvedAt,- InvestigationSessionID: f.InvestigationSessionID,- InvestigationStatus: f.InvestigationStatus,- InvestigationOutcome: f.InvestigationOutcome,- LastInvestigatedAt: f.LastInvestigatedAt,- InvestigationAttempts: f.InvestigationAttempts,- InvestigationRecord: f.InvestigationRecord,- LoopState: f.LoopState,- Lifecycle: toUnifiedLifecycle(f.Lifecycle),- RegressionCount: f.RegressionCount,- LastRegressionAt: f.LastRegressionAt,- AcknowledgedAt: f.AcknowledgedAt,- SnoozedUntil: f.SnoozedUntil,- DismissedReason: f.DismissedReason,- UserNote: f.UserNote,- Suppressed: f.Suppressed,- TimesRaised: f.TimesRaised,+ ID: f.ID,+ Source: unified.SourceAIPatrol,+ Severity: unified.UnifiedSeverity(f.Severity),+ Category: unified.UnifiedCategory(f.Category),+ ResourceID: f.ResourceID,+ ResourceName: f.ResourceName,+ ResourceType: f.ResourceType,+ Node: f.Node,+ Title: f.Title,+ Description: f.Description,+ Impact: f.Impact,+ PreviousResolvedFixSummary: f.PreviousResolvedFixSummary,+ Recommendation: f.Recommendation,+ Evidence: f.Evidence,+ DetectedAt: f.DetectedAt,+ LastSeenAt: f.LastSeenAt,+ ResolvedAt: f.ResolvedAt,+ InvestigationSessionID: f.InvestigationSessionID,+ InvestigationStatus: f.InvestigationStatus,+ InvestigationOutcome: f.InvestigationOutcome,+ LastInvestigatedAt: f.LastInvestigatedAt,+ InvestigationAttempts: f.InvestigationAttempts,+ InvestigationRecord: f.InvestigationRecord,+ LoopState: f.LoopState,+ Lifecycle: toUnifiedLifecycle(f.Lifecycle),+ RegressionCount: f.RegressionCount,+ LastRegressionAt: f.LastRegressionAt,+ AcknowledgedAt: f.AcknowledgedAt,+ SnoozedUntil: f.SnoozedUntil,+ DismissedReason: f.DismissedReason,+ UserNote: f.UserNote,+ Suppressed: f.Suppressed,+ TimesRaised: f.TimesRaised,}_, isNew := unifiedStore.AddFromAI(uf)return isNew@@ -1771,38 +1772,39 @@ func (r *Router) startPatrolForContext(ctx context.Context, orgID string) bool {continue}uf := &unified.UnifiedFinding{- ID: f.ID,- Source: unified.SourceAIPatrol,- Severity: unified.UnifiedSeverity(f.Severity),- Category: unified.UnifiedCategory(f.Category),- ResourceID: f.ResourceID,- ResourceName: f.ResourceName,- ResourceType: f.ResourceType,- Node: f.Node,- Title: f.Title,- Description: f.Description,- Impact: f.Impact,- Recommendation: f.Recommendation,- Evidence: f.Evidence,- DetectedAt: f.DetectedAt,- LastSeenAt: f.LastSeenAt,- ResolvedAt: f.ResolvedAt,- InvestigationSessionID: f.InvestigationSessionID,- InvestigationStatus: f.InvestigationStatus,- InvestigationOutcome: f.InvestigationOutcome,- LastInvestigatedAt: f.LastInvestigatedAt,- InvestigationAttempts: f.InvestigationAttempts,- InvestigationRecord: f.InvestigationRecord,- LoopState: f.LoopState,- Lifecycle: toUnifiedLifecycle(f.Lifecycle),- RegressionCount: f.RegressionCount,- LastRegressionAt: f.LastRegressionAt,- AcknowledgedAt: f.AcknowledgedAt,- SnoozedUntil: f.SnoozedUntil,- DismissedReason: f.DismissedReason,- UserNote: f.UserNote,- Suppressed: f.Suppressed,- TimesRaised: f.TimesRaised,+ ID: f.ID,+ Source: unified.SourceAIPatrol,+ Severity: unified.UnifiedSeverity(f.Severity),+ Category: unified.UnifiedCategory(f.Category),+ ResourceID: f.ResourceID,+ ResourceName: f.ResourceName,+ ResourceType: f.ResourceType,+ Node: f.Node,+ Title: f.Title,+ Description: f.Description,+ Impact: f.Impact,+ PreviousResolvedFixSummary: f.PreviousResolvedFixSummary,+ Recommendation: f.Recommendation,+ Evidence: f.Evidence,+ DetectedAt: f.DetectedAt,+ LastSeenAt: f.LastSeenAt,+ ResolvedAt: f.ResolvedAt,+ InvestigationSessionID: f.InvestigationSessionID,+ InvestigationStatus: f.InvestigationStatus,+ InvestigationOutcome: f.InvestigationOutcome,+ LastInvestigatedAt: f.LastInvestigatedAt,+ InvestigationAttempts: f.InvestigationAttempts,+ InvestigationRecord: f.InvestigationRecord,+ LoopState: f.LoopState,+ Lifecycle: toUnifiedLifecycle(f.Lifecycle),+ RegressionCount: f.RegressionCount,+ LastRegressionAt: f.LastRegressionAt,+ AcknowledgedAt: f.AcknowledgedAt,+ SnoozedUntil: f.SnoozedUntil,+ DismissedReason: f.DismissedReason,+ UserNote: f.UserNote,+ Suppressed: f.Suppressed,+ TimesRaised: f.TimesRaised,}// Copy resolution timestamp if resolvedif f.ResolvedAt != nil || f.AutoResolved {