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
Surface trust metrics on the Patrol page
rcourtman07d1ab51d12d
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex d01adadebf..155aa0dbbf 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -434,7 +434,11 @@ profile and assignment columns, but embedded table framing must route throughto the `previous_resolved_fix_summary` operational-memory field carried onfindings across regressions: lifecycle surfaces may render it in findingcontext but must not replay the recorded fix description as an installer- command, enrollment action, or fleet-control instruction. Assistant chat enrichment from+ command, enrollment action, or fleet-control instruction. The same+ scope applies to the `trust` block on the patrol-status response+ (`FindingsTrustSummary`): lifecycle surfaces may read it as adjacent+ operator context but must not derive enrollment, installer, or+ fleet-control authority from any of its counters. 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 4c0f6326f5..bd8ac40c9a 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -293,7 +293,11 @@ runtime cost control, and shared AI transport surfaces.auto-resolved, fix-verified, fix-failed, dismissed-as-noise,dismissed-as-expected, dismissed-as-later, suppressed,regressed-at-least-once). It is the data layer for trust metrics on- operator surfaces. The summary is intentionally a snapshot of the+ operator surfaces. `PatrolService.GetFindingsTrustSummary` exposes+ the same snapshot through the service boundary, and the+ patrol-status API response carries it under+ `PatrolStatusResponse.Trust` so the Patrol page can render a Trust+ strip without callers reaching past the service boundary. The summary is intentionally a snapshot of thein-memory store, not lifetime totals; once findings are cleaned upthey no longer contribute. Downstream surfaces must frame thecounts as current-state distribution rather than historicaldiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 23c7110438..c35836db2b 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -966,6 +966,17 @@ the canonical monitored-system blocked payload.persisted findings created by older binaries must adopt thefreshly-classified impact text on next re-detection rather thanpreserving the empty value.+ The patrol-status response (`PatrolStatusResponse`) carries an+ optional `trust` block of type `ai.FindingsTrustSummary` that+ surfaces the trust-metrics snapshot for the Patrol page. The block+ is populated when a patrol service is available and omitted+ otherwise; the JSON keys are `tracked`, `currently_active`,+ `resolved`, `auto_resolved`, `fix_verified`, `fix_failed`,+ `dismissed_as_noise`, `dismissed_as_expected`, `dismissed_as_later`,+ `suppressed`, and `regressed_at_least_once`. The TS API client+ carries a parallel `FindingsTrustSummary` interface in+ `frontend-modern/src/api/patrol.ts` and a `trust?` field on+ `PatrolStatus`. Snapshot semantics, not lifetime totals.The Patrol Assistant handoff carries an optional`intent` field of type `PatrolAssistantFindingIntent`(`'discuss' | 'explain'`) so contextual entry points on the findingdiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex b7462e0545..593487d3da 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -946,7 +946,13 @@ prompt explain the same operator-facing priority.`PatrolAssistantFindingIntent` parameter ('discuss' | 'explain') socontextual entry points can vary the seeded leading sentence withoutduplicating the structured-context attachment; shared drawer- primitives must not branch on intent themselves. That feature-owned+ primitives must not branch on intent themselves. Patrol-page+ surfaces may also render a Trust strip from+ `state.patrolStatus()?.trust`, but the strip must read field names+ that exist on `FindingsTrustSummary`; shared drawer/chrome+ primitives stay free of the trust shape so adding new trust signals+ goes through the contract first rather than per-shell branching.+ That feature-ownedpresentation helper is the single emitter for investigation-record`impact` and `rollback` fields: when an investigation record exists but those fieldsare empty, the helper emits explicit `Impact not assessed` anddiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex f17d42947a..ce0a7b32d0 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -259,6 +259,15 @@ Patrol-specific presentation helpers.The same panel also surfaces `investigation_record.confidence` as abadge in the collapsed finding row (next to the investigation outcomebadge) so operators can scan trust without expanding every card.+ The Patrol page renders a small Trust strip above the Findings/Runs+ tab bar that surfaces `state.patrolStatus()?.trust` (the+ FindingsTrustSummary block on the patrol-status response) as compact+ signals: fixes verified, auto-resolved, dismissed-as-noise,+ dismissed-as-expected, currently-active, and regressed-at-least-once.+ The strip is hidden when every signal is zero so a fresh install+ does not show an empty pill. The strip must read field names that+ exist on `FindingsTrustSummary`; new strip categories must extend+ that contract first rather than inventing per-page keys.Findings carry contextual Assistant entry points keyed on intent: thedefault "Discuss with Assistant" button opens an open-ended chathandoff, and a parallel "Explain" button opens the same handoff withdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 0b23a7c900..7942319104 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -242,6 +242,11 @@ bypass the API fail-closed execution gate.auto-apply the recorded fix description as a backup, restore, or storageremediation action; replaying a prior fix is the action broker'sauthority, not the storage/recovery surface's.+ The `trust` block on the patrol-status response+ (`FindingsTrustSummary`) follows the same scope: storage and recovery+ surfaces may read it as adjacent operator context but must not derive+ backup, restore, or storage remediation authority from any of its+ counters.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/frontend-modern/src/api/__tests__/patrol.test.ts b/frontend-modern/src/api/__tests__/patrol.test.tsindex 834be760a4..0fb07a8887 100644--- a/frontend-modern/src/api/__tests__/patrol.test.ts+++ b/frontend-modern/src/api/__tests__/patrol.test.ts@@ -277,4 +277,37 @@ describe('patrol api', () => {await expect(getPatrolRunWithToolCalls('run-3')).resolves.toBeNull();});++ it('preserves the FindingsTrustSummary block on patrol status responses', async () => {+ // The trust block surfaces FindingsStore.GetTrustSummary on the patrol+ // page. The TS mirror must round-trip the exact field names from the+ // backend snake_case payload so the workspace strip can read them.+ apiFetchJSONMock.mockResolvedValueOnce({+ runtime_state: 'active',+ healthy: true,+ summary: { critical: 0, warning: 1, watch: 0, info: 0 },+ trust: {+ tracked: 4,+ currently_active: 1,+ resolved: 2,+ auto_resolved: 1,+ fix_verified: 1,+ fix_failed: 0,+ dismissed_as_noise: 1,+ dismissed_as_expected: 0,+ dismissed_as_later: 0,+ suppressed: 0,+ regressed_at_least_once: 1,+ },+ } as any);++ await expect(getPatrolStatus()).resolves.toMatchObject({+ trust: {+ tracked: 4,+ fix_verified: 1,+ dismissed_as_noise: 1,+ regressed_at_least_once: 1,+ },+ });+ });});diff --git a/frontend-modern/src/api/patrol.ts b/frontend-modern/src/api/patrol.tsindex 145bd6be5b..9a7bc2c714 100644--- a/frontend-modern/src/api/patrol.ts+++ b/frontend-modern/src/api/patrol.ts@@ -184,6 +184,20 @@ export interface PatrolTriggerStatus {anomaly_triggers_enabled: boolean;}+export interface FindingsTrustSummary {+ tracked: number;+ currently_active: number;+ resolved: number;+ auto_resolved: number;+ fix_verified: number;+ fix_failed: number;+ dismissed_as_noise: number;+ dismissed_as_expected: number;+ dismissed_as_later: number;+ suppressed: number;+ regressed_at_least_once: number;+}+export interface PatrolStatus {runtime_state: PatrolRuntimeState;running: boolean;@@ -207,6 +221,7 @@ export interface PatrolStatus {upgrade_url?: string;readiness?: PatrolReadiness;summary: FindingsSummary;+ trust?: FindingsTrustSummary;}/**diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsxindex fb29ecbe61..cd2c70a460 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx@@ -42,6 +42,60 @@ export function PatrolIntelligenceWorkspace(props: { state: PatrolIntelligenceSt}}/>+ <Show+ when={(() => {+ const trust = state.patrolStatus()?.trust;+ if (!trust) return false;+ // Render only when at least one trust signal has non-zero value;+ // fresh installs with no findings should not show an empty strip.+ return (+ trust.fix_verified > 0 ||+ trust.auto_resolved > 0 ||+ trust.dismissed_as_noise > 0 ||+ trust.dismissed_as_expected > 0 ||+ trust.currently_active > 0+ );+ })()}+ >+ {(() => {+ const trust = state.patrolStatus()!.trust!;+ return (+ <div+ class="flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-1.5 rounded-md border border-border bg-surface-alt/40 text-[11px] text-muted"+ aria-label="Patrol trust summary"+ >+ <span class="font-medium uppercase tracking-[0.14em] text-[10px] text-muted/80">+ Trust+ </span>+ <Show when={trust.fix_verified > 0}>+ <span class="text-emerald-700 dark:text-emerald-300">+ {trust.fix_verified} fix{trust.fix_verified === 1 ? '' : 'es'} verified+ </span>+ </Show>+ <Show when={trust.auto_resolved > 0}>+ <span>{trust.auto_resolved} auto-resolved</span>+ </Show>+ <Show when={trust.dismissed_as_noise > 0}>+ <span class="text-amber-700 dark:text-amber-300">+ {trust.dismissed_as_noise} dismissed as noise+ </span>+ </Show>+ <Show when={trust.dismissed_as_expected > 0}>+ <span>{trust.dismissed_as_expected} expected</span>+ </Show>+ <Show when={trust.currently_active > 0}>+ <span>{trust.currently_active} active</span>+ </Show>+ <Show when={trust.regressed_at_least_once > 0}>+ <span class="text-amber-700 dark:text-amber-300">+ {trust.regressed_at_least_once} regressed+ </span>+ </Show>+ </div>+ );+ })()}+ </Show>+<div class="flex items-center gap-1 border-b border-border"><buttontype="button"diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.ts b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.tsnew file mode 100644index 0000000000..58447d1ad6--- /dev/null+++ b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceWorkspace.test.ts@@ -0,0 +1,30 @@+import { readFileSync } from 'node:fs';+import { resolve } from 'node:path';+import { describe, expect, it } from 'vitest';++const workspaceSource = readFileSync(+ resolve(__dirname, '..', 'PatrolIntelligenceWorkspace.tsx'),+ 'utf-8',+);++describe('PatrolIntelligenceWorkspace trust strip', () => {+ it('renders a Trust strip from state.patrolStatus().trust when at least one signal is non-zero', () => {+ // The Trust strip is the first operator-visible surface for the trust+ // metrics data layer (FindingsStore.GetTrustSummary). It must read from+ // state.patrolStatus()?.trust and gate visibility on at least one+ // non-zero signal so a fresh install does not show an empty strip.+ expect(workspaceSource).toContain('state.patrolStatus()?.trust');+ expect(workspaceSource).toContain('aria-label="Patrol trust summary"');+ expect(workspaceSource).toContain('trust.fix_verified');+ expect(workspaceSource).toContain('trust.auto_resolved');+ expect(workspaceSource).toContain('trust.dismissed_as_noise');+ });++ it('does not invent trust signals not on FindingsTrustSummary', () => {+ // The strip must read only fields defined on FindingsTrustSummary so+ // adding new strip categories goes through the contract update first.+ // No mention of arbitrary keys like "patrol_score" or "health_grade".+ expect(workspaceSource).not.toMatch(/trust\.patrol_score/);+ expect(workspaceSource).not.toMatch(/trust\.health_grade/);+ });+});diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.tsindex e971a08d39..c05d16afcf 100644--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts@@ -876,6 +876,31 @@ describe('patrolInvestigationContextModel', () => {expect(presentation.impact).toBe('');});+ it('does not let the patrol context model synthesize impact from trust counters', () => {+ // Trust counters (FindingsTrustSummary on the patrol-status response) are+ // an operator-page concern, not a per-finding context concern. The+ // investigation-context model must not derive impact, recommendation, or+ // any other per-finding text from trust counts; the source authoring rule+ // (see ai-runtime contract) forbids synthesis from severity, category,+ // OR aggregate counts. This test pins that boundary.+ const presentation = buildPatrolInvestigationRecordPresentation({+ id: 'rec-trust-isolation',+ finding_id: 'f-trust-isolation',+ subject: { resource_id: 'vm-9' },+ trigger: { detected_at: '2026-05-08T12:00:00Z' },+ status: 'completed',+ // Intentionally empty impact/rollback so the test reflects what the+ // model produces when only trust signals are available externally.+ evidence: [],+ verification: [],+ rollback: [],+ tools_used: [],+ started_at: '2026-05-08T12:00:00Z',+ });+ expect(presentation.impact).toBeFalsy();+ expect(presentation.rollbackSummaries).toEqual([]);+ });+it('seeds an explain-intent prompt with explanation framing rather than discussion framing', () => {const discussPrompt = buildPatrolAssistantFindingPrompt({title: 'Backup job failing',diff --git a/internal/ai/patrol_findings.go b/internal/ai/patrol_findings.goindex 0d5dcba461..9dcb6bb09a 100644--- a/internal/ai/patrol_findings.go+++ b/internal/ai/patrol_findings.go@@ -530,6 +530,12 @@ func (p *PatrolService) GetFindingsSummary() FindingsSummary {return p.findings.GetSummary()}+// GetFindingsTrustSummary returns a snapshot of how currently-tracked+// findings have resolved. See FindingsTrustSummary for snapshot semantics.+func (p *PatrolService) GetFindingsTrustSummary() FindingsTrustSummary {+ return p.findings.GetTrustSummary()+}+// ResolveFinding marks a finding as resolved with a resolution note// This is called when the AI successfully fixes an issuefunc (p *PatrolService) ResolveFinding(findingID string, resolutionNote string) error {diff --git a/internal/ai/patrol_test.go b/internal/ai/patrol_test.goindex 95800d865b..3bd7d6cef5 100644--- a/internal/ai/patrol_test.go+++ b/internal/ai/patrol_test.go@@ -722,6 +722,35 @@ func TestPatrolService_GetFindingsSummary(t *testing.T) {}}+func TestPatrolService_GetFindingsTrustSummary(t *testing.T) {+ // PatrolService.GetFindingsTrustSummary delegates to the FindingsStore-+ // level method. This verifies the accessor is wired correctly so+ // patrol-status responses can include the snapshot without callers+ // reaching past the service boundary.+ ps := NewPatrolService(nil, nil)++ ps.findings.Add(&Finding{+ ID: "f-active", Severity: FindingSeverityWarning,+ Category: FindingCategoryReliability, Title: "Active",+ })+ ps.findings.Add(&Finding{+ ID: "f-noise", Severity: FindingSeverityWarning,+ Category: FindingCategoryReliability, Title: "Noise",+ })+ ps.findings.Dismiss("f-noise", "not_an_issue", "")++ summary := ps.GetFindingsTrustSummary()+ if summary.Tracked != 2 {+ t.Errorf("Expected Tracked=2, got %d", summary.Tracked)+ }+ if summary.DismissedAsNoise != 1 {+ t.Errorf("Expected DismissedAsNoise=1, got %d", summary.DismissedAsNoise)+ }+ if summary.CurrentlyActive != 1 {+ t.Errorf("Expected CurrentlyActive=1, got %d", summary.CurrentlyActive)+ }+}+func TestPatrolService_GetRunHistory(t *testing.T) {ps := NewPatrolService(nil, nil)diff --git a/internal/api/ai_handlers.go b/internal/api/ai_handlers.goindex 2f5284edc5..2766e339ba 100644--- a/internal/api/ai_handlers.go+++ b/internal/api/ai_handlers.go@@ -4902,6 +4902,11 @@ type PatrolStatusResponse struct {Watch int `json:"watch"`Info int `json:"info"`} `json:"summary"`+ // Trust is a snapshot of how currently-tracked findings have resolved.+ // Operators use this to scan whether Patrol's analysis has been useful:+ // fix-verified and dismissed-as-noise grow as the system gets sharper.+ // Snapshot semantics, not lifetime totals; nil when no patrol service.+ Trust *ai.FindingsTrustSummary `json:"trust,omitempty"`Readiness *PatrolReadinessResponse `json:"readiness,omitempty"`}@@ -5205,6 +5210,9 @@ func (h *AISettingsHandler) HandleGetPatrolStatus(w http.ResponseWriter, r *httpresponse.Summary.Watch = summary.Watchresponse.Summary.Info = summary.Info+ trust := patrol.GetFindingsTrustSummary()+ response.Trust = &trust+if err := utils.WriteJSONResponse(w, response); err != nil {log.Error().Err(err).Msg("Failed to write patrol status response")}diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex d8724742c2..f32956e36e 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -2943,6 +2943,35 @@ func TestContract_FindingJSONSnapshot(t *testing.T) {assertJSONSnapshot(t, got, want)}+// TestContract_PatrolStatusTrustJSONSnapshot pins the canonical JSON shape+// for the trust snapshot block carried on the patrol-status response. The+// PatrolStatusResponse.Trust field surfaces FindingsTrustSummary on the+// operator-facing Patrol page so trust signals (fix verified, dismissed as+// noise, etc.) are scannable without expanding individual findings.+func TestContract_PatrolStatusTrustJSONSnapshot(t *testing.T) {+ trust := ai.FindingsTrustSummary{+ Tracked: 4,+ CurrentlyActive: 1,+ Resolved: 2,+ AutoResolved: 1,+ FixVerified: 1,+ FixFailed: 0,+ DismissedAsNoise: 1,+ DismissedAsExpected: 0,+ DismissedAsLater: 0,+ Suppressed: 0,+ RegressedAtLeastOnce: 1,+ }+ got, err := json.Marshal(trust)+ if err != nil {+ t.Fatalf("marshal trust summary: %v", err)+ }+ want := `{"tracked":4,"currently_active":1,"resolved":2,"auto_resolved":1,"fix_verified":1,"fix_failed":0,"dismissed_as_noise":1,"dismissed_as_expected":0,"dismissed_as_later":0,"suppressed":0,"regressed_at_least_once":1}`+ if string(got) != want {+ t.Fatalf("trust summary JSON drift:\n got: %s\nwant: %s", 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