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
Author Impact on AI-generated Patrol findings via tool schema
rcourtmanf530c76d177f
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex c13a5d7b15..d6e2b240de 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -275,7 +275,19 @@ runtime cost control, and shared AI transport surfaces.(`internal/ai/patrol_findings.go`) populates `record.Rollback` from`remediationEngine.GetPlanForFinding` when the engine and an activeplan are present. Rollback must remain absent rather than fabricated- when no plan exists, mirroring the impact rule. When `/api/ai/chat` receives `finding_id`, the+ when no plan exists, mirroring the impact rule.+ LLM-generated AI patrol findings author impact through the+ `patrol_report_finding` tool schema in+ `internal/ai/tools/tools_patrol.go`: the tool exposes an optional+ `impact` parameter, `PatrolFindingInput.Impact` carries it through,+ and `patrolFindingCreatorAdapter.CreateFinding` writes it onto+ `Finding.Impact` so the LLM's authored consequence-if-ignored copy+ flows through the same propagation path used by curated catalogs.+ The patrol system prompt instructs the LLM to author concrete+ operational consequences (named workloads, jobs, recovery windows)+ and to leave `impact` empty rather than fabricate one when the+ consequence is genuinely unknown; the runtime must not synthesize a+ default in that case. 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/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsxindex 538b99653d..3920f9473b 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx@@ -172,7 +172,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {const { getByTestId, queryByText } = render(() => <ResourceDetailDrawer resource={resource} />);const headerBadges = getByTestId('resource-header-badges');- expect(within(headerBadges).getByText('Unraid')).toBeInTheDocument();+ expect(within(headerBadges).getByText('Unraid 7.2.2')).toBeInTheDocument();expect(queryByText('K8s')).toBeNull();});diff --git a/internal/ai/patrol_ai.go b/internal/ai/patrol_ai.goindex 4810eab50d..3cfb04c2bf 100644--- a/internal/ai/patrol_ai.go+++ b/internal/ai/patrol_ai.go@@ -906,7 +906,9 @@ Instructions:2. For each signal below, determine if it is a genuine issue requiring attention.3. If yes, call patrol_report_finding with complete details.4. If not actionable or already covered by an existing finding, skip it.-5. Do NOT investigate further — use only the evidence provided below.`+5. Do NOT investigate further — use only the evidence provided below.++When reporting, set ` + "`impact`" + ` to the concrete consequence-if-ignored — name the affected workloads, jobs, or recovery windows. Leave it empty rather than fabricating one if the consequence is genuinely unknown.`}// buildEvalUserPrompt formats the unmatched signals into a user prompt for the evaluation pass.@@ -1140,6 +1142,14 @@ These are for Patrol-specific findings (trends, capacity, config issues). SimpleIf everything looks healthy, report no findings. Report findings for issues that require human planning or intervention — capacity risks, misconfigurations, reliability gaps, optimization opportunities, or emerging trends. Do NOT report simple threshold breaches (high CPU, high memory, high disk, resource down) — those are handled by the alerting system.+## Authoring Impact (consequence-if-ignored)++Every finding you report should answer "what specifically happens if the operator does nothing?" Pass that answer in the optional ` + "`impact`" + ` field of patrol_report_finding.++- Be concrete and operational: name the affected workloads, jobs, recovery windows, or service paths. "Nightly backups will be skipped; restore window grows by one day per skip" is good. "This is bad" is not.+- Do NOT echo severity or category. The operator already sees "warning" or "capacity"; impact must add information.+- Do NOT fabricate consequences when you genuinely do not know. Leave ` + "`impact`" + ` empty rather than inventing one. The frontend will render an explicit "Impact not assessed" placeholder, which is more useful than guessed copy.+## Final Summary FormatAfter completing your investigation, write a concise summary using this structure:diff --git a/internal/ai/patrol_findings.go b/internal/ai/patrol_findings.goindex 9582d070c9..0d5dcba461 100644--- a/internal/ai/patrol_findings.go+++ b/internal/ai/patrol_findings.go@@ -771,6 +771,7 @@ func (a *patrolFindingCreatorAdapter) CreateFinding(input tools.PatrolFindingInpResourceType: input.ResourceType,Title: input.Title,Description: input.Description,+ Impact: input.Impact,Recommendation: input.Recommendation,Evidence: input.Evidence,Source: "ai-analysis",diff --git a/internal/ai/tools/executor.go b/internal/ai/tools/executor.goindex 16a7e6f49d..b07eeb9fb7 100644--- a/internal/ai/tools/executor.go+++ b/internal/ai/tools/executor.go@@ -112,6 +112,7 @@ type PatrolFindingInput struct {ResourceType string `json:"resource_type"`Title string `json:"title"`Description string `json:"description"`+ Impact string `json:"impact,omitempty"`Recommendation string `json:"recommendation,omitempty"`Evidence string `json:"evidence,omitempty"`}diff --git a/internal/ai/tools/tools_patrol.go b/internal/ai/tools/tools_patrol.goindex 5f8443b3bb..74e55209c0 100644--- a/internal/ai/tools/tools_patrol.go+++ b/internal/ai/tools/tools_patrol.go@@ -58,6 +58,10 @@ Returns: {"ok": true, "finding_id": "...", "is_new": true/false} on success.`,Type: "string",Description: "Detailed description of the issue found",},+ "impact": {+ Type: "string",+ Description: "Operator-facing consequence-if-ignored statement: what specifically happens, and to which workloads or jobs, if the operator does nothing. Concrete operational consequences only — do not echo severity or category. Leave empty if the consequence is genuinely unknown rather than fabricating one.",+ },"recommendation": {Type: "string",Description: "Specific actionable recommendation for the operator",@@ -218,6 +222,7 @@ func handlePatrolReportFinding(_ context.Context, e *PulseToolExecutor, args map}// Extract optional fields+ impact, _ := args["impact"].(string)recommendation, _ := args["recommendation"].(string)evidence, _ := args["evidence"].(string)@@ -230,6 +235,7 @@ func handlePatrolReportFinding(_ context.Context, e *PulseToolExecutor, args mapResourceType: resourceType,Title: title,Description: description,+ Impact: impact,Recommendation: recommendation,Evidence: evidence,}diff --git a/internal/ai/tools/tools_patrol_test.go b/internal/ai/tools/tools_patrol_test.goindex 6444cdf3bb..425080e124 100644--- a/internal/ai/tools/tools_patrol_test.go+++ b/internal/ai/tools/tools_patrol_test.go@@ -145,6 +145,45 @@ func TestHandlePatrolReportFinding_ValidInput(t *testing.T) {assert.Equal(t, "CPU at 92% over 15 minutes", input.Evidence)}+func TestHandlePatrolReportFinding_PassesImpactWhenAuthored(t *testing.T) {+ creator := &mockPatrolFindingCreator{checked: true}+ exec := newPatrolTestExecutor(creator)++ args := validReportArgs()+ args["impact"] = "Customer-facing latency rises and request queue depth grows; sustained CPU pressure will time out user requests."++ result, err := handlePatrolReportFinding(context.Background(), exec, args)+ require.NoError(t, err)++ var parsed map[string]interface{}+ require.NoError(t, json.Unmarshal([]byte(extractText(result)), &parsed))+ assert.Equal(t, true, parsed["ok"])++ require.Len(t, creator.createCalls, 1)+ assert.Equal(t,+ "Customer-facing latency rises and request queue depth grows; sustained CPU pressure will time out user requests.",+ creator.createCalls[0].Impact,+ )+}++func TestHandlePatrolReportFinding_LeavesImpactEmptyWhenOmitted(t *testing.T) {+ creator := &mockPatrolFindingCreator{checked: true}+ exec := newPatrolTestExecutor(creator)++ // validReportArgs intentionally omits impact, mirroring the LLM choosing+ // to leave it empty rather than fabricating one. The contract is that an+ // omitted impact is honored verbatim — no default copy is synthesized.+ result, err := handlePatrolReportFinding(context.Background(), exec, validReportArgs())+ require.NoError(t, err)++ var parsed map[string]interface{}+ require.NoError(t, json.Unmarshal([]byte(extractText(result)), &parsed))+ assert.Equal(t, true, parsed["ok"])++ require.Len(t, creator.createCalls, 1)+ assert.Equal(t, "", creator.createCalls[0].Impact)+}+func TestHandlePatrolReportFinding_AcceptsPhysicalDiskResourceType(t *testing.T) {creator := &mockPatrolFindingCreator{checked: true}exec := newPatrolTestExecutor(creator)