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
Align Patrol coverage caveats with full runs
rcourtman3cbd49cb546d
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 28514ac078..1976640d0c 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -1090,6 +1090,11 @@ the canonical monitored-system blocked payload.new API surface. The label stays optional when coverage is zero, saysverified only for successful full patrols, and uses neutral checked wordingfor errored full patrols or scoped activity.+ The primary Patrol assessment copy uses that same run-history-backed+ coverage truth when reconciling AI summary coverage factors: a successful+ full run with non-zero `resources_checked` suppresses stale+ coverage-incomplete wording, while scoped, missing, zero-coverage, or errored+ runs still allow the coverage caveat to surface.and 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/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex c6dab654f2..cd946eef52 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -1303,7 +1303,9 @@ returns `resourcesCheckedLabel` from the latest completed run. Render codemust gate on `<Show when={recency().resourcesCheckedLabel}>` (truthy) sozero-coverage runs do not surface a misleading coverage phrase, failed orscoped runs use neutral checked wording, and only successful full patrols read-as verified.+as verified. The primary Patrol assessment shell must pass the same run-history+facts into `getPatrolAssessmentPresentation` so assessment coverage caveats do+not contradict the header's verified full-run coverage state.`frontend-modern/src/utils/discoveryPresentation.ts` owns resource discoverycommand guidance targets. Discovery surfaces that need to tell operators where@@ -2500,6 +2502,10 @@ transport fact and use `Last activity` for scoped or verification work insteadof collapsing both timestamps back into a generic `Last run` label. Coveragephrases on those recency surfaces must come from the Patrol recency presenterinstead of hardcoding verified wording in the shell.+That same run-history ownership applies to assessment caveats: Patrol summary+shells should not present `Recent coverage is incomplete` when the shared+recency/verification helpers already prove a successful full patrol with+non-zero resource coverage.That same Patrol shell should make scoped trigger policy legible withoutanother navigation step. `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`should present alert-triggered and anomaly-triggered Patrol toggles as distinctdiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex cb39652fce..2c4fe5e2ee 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -88,6 +88,10 @@ Patrol-specific presentation helpers.from the same current findings state. Patrol-owned runtime issues must staydistinct from infrastructure findings in assessment copy rather than beingdescribed as infrastructure warning findings about Patrol itself.+ Assessment coverage caveats must also reconcile against current run-history+ proof: a stale coverage factor or prediction must not claim recent coverage+ is incomplete when the latest completed full Patrol run successfully checked+ real resources.Recency coverage copy must also come from the shared presentation helper:use verified wording only for successful full patrols, and use neutralchecked wording for failed full patrols or scoped activity.diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsxindex 326be867d4..4c9c98825b 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx@@ -114,6 +114,7 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStatcriticalFindings: summaryStats().criticalFindings,warningFindings: summaryStats().warningFindings,activeFindings: state.activePatrolFindings(),+ runs: state.patrolRunHistory.value() ?? [],}),);const assessmentShellPresentation = createMemo(() =>diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsxindex 898f4c9405..f918091206 100644--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx@@ -1369,6 +1369,114 @@ describe('AIIntelligence entitlement gating', () => {).not.toBeInTheDocument();});+ it('does not repeat stale coverage caveats after a successful full patrol verified resources', async () => {+ hasFeatureMock.mockReturnValue(true);+ licenseStatusMock.mockReturnValue({ subscription_state: 'active' });+ getPatrolStatusMock.mockResolvedValue(defaultPatrolStatus({ license_required: false }));+ getPatrolRunHistoryMock.mockResolvedValue([+ {+ id: 'run-full-success',+ started_at: '2026-03-12T09:56:00Z',+ completed_at: '2026-03-12T09:57:00Z',+ duration_ms: 60000,+ type: 'patrol',+ trigger_reason: 'manual',+ scope_resource_ids: [],+ effective_scope_resource_ids: [],+ scope_resource_types: [],+ resources_checked: 58,+ nodes_checked: 0,+ guests_checked: 0,+ docker_checked: 0,+ storage_checked: 0,+ hosts_checked: 0,+ truenas_checked: 0,+ pbs_checked: 0,+ pmg_checked: 0,+ kubernetes_checked: 0,+ new_findings: 1,+ existing_findings: 0,+ rejected_findings: 0,+ resolved_findings: 0,+ auto_fix_count: 0,+ findings_summary: '1 warning',+ finding_ids: ['finding-1'],+ error_count: 0,+ status: 'issues_found',+ triage_flags: 0,+ tool_call_count: 0,+ },+ ]);+ intelligenceState.findings = [+ {+ id: 'finding-1',+ source: 'ai-patrol',+ isThreshold: false,+ status: 'active',+ severity: 'warning',+ resourceId: 'backup-1',+ resourceName: 'delly',+ resourceType: 'backup',+ title: 'Backup failed',+ detectedAt: '2026-03-12T09:57:00Z',+ },+ ];+ intelligenceState.summary = {+ timestamp: '2026-03-12T10:00:00Z',+ overall_health: {+ score: 85,+ grade: 'B',+ trend: 'stable',+ factors: [+ {+ name: 'Patrol coverage incomplete',+ impact: -0.35,+ description:+ 'Patrol coverage is incomplete: recent activity was limited to scoped runs and ended with errors, so overall health is not fully verified.',+ category: 'coverage',+ },+ ],+ prediction:+ 'Recent Patrol runs encountered errors, so the current health summary may be incomplete.',+ },+ findings_count: {+ critical: 0,+ warning: 1,+ watch: 0,+ info: 0,+ total: 1,+ },+ predictions_count: 0,+ recent_changes_count: 0,+ learning: {+ resources_with_knowledge: 0,+ total_notes: 0,+ resources_with_baselines: 0,+ patterns_detected: 0,+ correlations_learned: 0,+ incidents_tracked: 0,+ },+ };++ render(() => <AIIntelligence />);++ await waitFor(() => {+ expect(screen.getByText(/verified 58 resources/i)).toBeInTheDocument();+ expect(+ screen.getByText(+ 'Patrol surfaced 1 active warning finding in your infrastructure. Review the active findings for more detail.',+ ),+ ).toBeInTheDocument();+ });++ expect(+ screen.queryByText(+ 'Recent Patrol runs encountered errors, so the current health summary may be incomplete.',+ ),+ ).not.toBeInTheDocument();+ expect(screen.queryByText(/Recent coverage is also incomplete/i)).not.toBeInTheDocument();+ });+it('surfaces the recent activity mix in the verification summary when scoped runs are creating noise', async () => {hasFeatureMock.mockReturnValue(true);licenseStatusMock.mockReturnValue({ subscription_state: 'active' });diff --git a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.tsindex 68e459f325..b1f82291ef 100644--- a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts@@ -160,7 +160,7 @@ describe('getPatrolSummaryPresentation', () => {},],prediction:- 'Patrol coverage is incomplete: recent activity was limited to scoped runs and ended with errors, so overall health is not fully verified.',+ 'Recent Patrol runs encountered errors, so the current health summary may be incomplete.',},warningFindings: 1,}),@@ -174,6 +174,54 @@ describe('getPatrolSummaryPresentation', () => {});});+ it('drops stale coverage caveats after a successful full patrol verified resources', () => {+ expect(+ getPatrolAssessmentPresentation({+ overallHealth: {+ score: 85,+ grade: 'B',+ trend: 'stable',+ factors: [+ {+ name: 'Patrol coverage incomplete',+ impact: -0.35,+ description: 'Patrol coverage is incomplete.',+ category: 'coverage',+ },+ ],+ prediction:+ 'Patrol coverage is incomplete: recent activity was limited to scoped runs and ended with errors, so overall health is not fully verified.',+ },+ warningFindings: 1,+ activeFindings: [+ {+ status: 'active',+ severity: 'warning',+ resourceId: 'backup-1',+ resourceName: 'delly',+ title: 'Backup failed',+ },+ ] as never,+ runs: [+ {+ completed_at: '2026-03-12T10:00:00Z',+ type: 'patrol',+ resources_checked: 58,+ error_count: 0,+ status: 'issues_found',+ },+ ] as never,+ }),+ ).toEqual({+ title: 'Issues detected',+ description:+ 'Patrol surfaced 1 active warning finding in your infrastructure. Review the active findings for more detail.',+ eyebrow: 'Patrol assessment',+ compactLabel: 'Issues detected',+ tone: 'warning',+ });+ });+it('keeps Patrol runtime issues distinct from infrastructure warning findings', () => {expect(getPatrolAssessmentPresentation({diff --git a/frontend-modern/src/utils/patrolSummaryPresentation.ts b/frontend-modern/src/utils/patrolSummaryPresentation.tsindex 994ca09bbc..dd0d7ff304 100644--- a/frontend-modern/src/utils/patrolSummaryPresentation.ts+++ b/frontend-modern/src/utils/patrolSummaryPresentation.ts@@ -441,21 +441,56 @@ function predictionReadsAsAllClear(prediction: string | undefined): boolean {);}+function predictionReadsAsCoverageGap(prediction: string | undefined): boolean {+ const normalized = String(prediction || '')+ .trim()+ .toLowerCase();+ if (!normalized) return false;++ return (+ normalized.includes('coverage is incomplete') ||+ normalized.includes('coverage incomplete') ||+ normalized.includes('not fully verified') ||+ normalized.includes('limited to scoped runs') ||+ normalized.includes('limited to targeted') ||+ normalized.includes('runs encountered errors') ||+ normalized.includes('ended with errors') ||+ normalized.includes('summary may be incomplete')+ );+}++function hasSuccessfulFullCoverageRun(runs: PatrolRunRecord[] | undefined): boolean {+ const recentFullRun = (runs ?? [])+ .filter((run) => isCompletedPatrolRun(run))+ .find((run) => isFullPatrolRun(run));+ return Boolean(+ recentFullRun && !hasRunErrors(recentFullRun) && (recentFullRun.resources_checked || 0) > 0,+ );+}+function getFindingAssessmentDescription(args: {criticalFindings?: number;warningFindings?: number;overallHealth?: IntelligenceHealthScore;activeFindings?: PatrolAssessmentFinding[];+ runs?: PatrolRunRecord[];}): string {const criticalFindings = args.criticalFindings ?? 0;const warningFindings = args.warningFindings ?? 0;- const hasCoverageGap = Boolean(+ const hasVerifiedFullCoverage = hasSuccessfulFullCoverageRun(args.runs);+ const hasCoverageGapFactor = Boolean(args.overallHealth?.factors.some((factor) => factor.category === 'coverage'),);+ const hasCoverageGap = hasCoverageGapFactor && !hasVerifiedFullCoverage;const classified = classifyActiveFindings(args.activeFindings);const activeRuntimeFindings = (args.activeFindings ?? []).filter((finding) => finding.status === 'active' && isPatrolRuntimeFinding(finding),);+ const shouldUsePrediction = (prediction: string | undefined): prediction is string => {+ if (!prediction) return false;+ if (predictionReadsAsAllClear(prediction)) return false;+ return !(hasVerifiedFullCoverage && predictionReadsAsCoverageGap(prediction));+ };if (classified.infrastructureTotal === 0 && classified.runtimeTotal === 1) {const runtimeFinding = activeRuntimeFindings[0];@@ -470,7 +505,7 @@ function getFindingAssessmentDescription(args: {}const prediction = args.overallHealth?.prediction?.trim();- if (prediction && !predictionReadsAsAllClear(prediction)) {+ if (shouldUsePrediction(prediction)) {return prediction;}@@ -508,7 +543,7 @@ function getFindingAssessmentDescription(args: {}const prediction = args.overallHealth?.prediction?.trim();- if (prediction && !predictionReadsAsAllClear(prediction)) {+ if (shouldUsePrediction(prediction)) {return prediction;}@@ -587,8 +622,10 @@ export function getPatrolAssessmentPresentation(args: {criticalFindings?: number;warningFindings?: number;activeFindings?: PatrolAssessmentFinding[];+ runs?: PatrolRunRecord[];}): PatrolAssessmentPresentation {const classified = classifyActiveFindings(args.activeFindings);+ const hasVerifiedFullCoverage = hasSuccessfulFullCoverageRun(args.runs);if (args.runtimeState === 'blocked' ||@@ -645,7 +682,10 @@ export function getPatrolAssessmentPresentation(args: {};}- if (args.overallHealth?.factors.some((factor) => factor.category === 'coverage')) {+ if (+ args.overallHealth?.factors.some((factor) => factor.category === 'coverage') &&+ !hasVerifiedFullCoverage+ ) {return {title: 'Coverage incomplete',description: getCoverageDescription(args.overallHealth),@@ -656,10 +696,13 @@ export function getPatrolAssessmentPresentation(args: {}if (args.overallHealth && args.overallHealth.grade !== 'A') {+ const prediction = args.overallHealth.prediction?.trim();return {title: 'Health requires attention',description:- args.overallHealth.prediction?.trim() || 'Patrol assessment still needs attention.',+ prediction && !(hasVerifiedFullCoverage && predictionReadsAsCoverageGap(prediction))+ ? prediction+ : 'Patrol assessment still needs attention.',eyebrow: 'Patrol assessment',compactLabel: 'Health requires attention',tone: getHealthSummaryTone(args.overallHealth),