Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Align scoped Patrol runtime assessments

rcourtman50cfa11f20b8
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index cdccacfc6c..b358063e0d 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -6313,6 +6313,12 @@ synthetic `ai-service` runtime failure just as a successful full Patrol run
does, without loosening ordinary scoped finding reconciliation for
infrastructure issues. A soft-warning preflight where the provider responds but
the model does not emit a tool call is not sufficient recovery evidence.
+Because the synthetic runtime finding is seeded into scoped runs as Patrol-wide
+health evidence, the run's finding adapter must also expose and accept a
+terminal assessment for that finding even though `ai-service` is not part of
+the caller-requested inventory scope. This is the sole lifecycle-scope
+exception; it does not grant infrastructure action authority, and the existing
+manual-action prohibitions remain in force.
The same selected-route preflight is part of the live Patrol readiness gate,
not merely settings-page diagnostics. A completed matching billing, quota,
authentication, connection, unsupported-tool, or timeout failure makes Patrol
diff --git a/internal/ai/patrol_findings.go b/internal/ai/patrol_findings.go
index 8c38f594de..5a3e82a502 100644
--- a/internal/ai/patrol_findings.go
+++ b/internal/ai/patrol_findings.go
@@ -706,6 +706,14 @@ func (a *patrolFindingCreatorAdapter) findingInCurrentScope(finding *Finding) bo
if finding == nil {
return false
}
+ // Runtime findings are deliberately seeded into every Patrol run because
+ // they describe Patrol's own ability to observe the requested scope rather
+ // than an inventory resource. Keep lifecycle scope aligned with that seed:
+ // the model may record a terminal assessment, while the existing runtime
+ // finding guards still prohibit manual or infrastructure remediation.
+ if patrolFindingUsesSyntheticRuntimeResource(finding) {
+ return true
+ }
if len(a.findingScope) > 0 {
return a.findingScope[finding.ResourceID] || a.findingScope[finding.ResourceName]
}
diff --git a/internal/ai/patrol_findings_additional_test.go b/internal/ai/patrol_findings_additional_test.go
index 9ab98b4702..ef458f580b 100644
--- a/internal/ai/patrol_findings_additional_test.go
+++ b/internal/ai/patrol_findings_additional_test.go
@@ -1563,6 +1563,38 @@ func TestPatrolFindingAdapterSeparatesRequestedLifecycleScopeFromEvidenceScope(t
}
}
+func TestPatrolFindingAdapterCanAssessSeededRuntimeFindingDuringScopedRun(t *testing.T) {
+ state := newPatrolRuntimeState(models.StateSnapshot{
+ VMs: []models.VM{{ID: "vm-requested", Name: "requested", VMID: 501}},
+ })
+ ps := NewPatrolService(nil, nil)
+ runtimeFinding := &Finding{
+ ID: patrolRuntimeFindingKey, Key: patrolRuntimeFindingKey,
+ Severity: FindingSeverityWarning, Category: FindingCategoryReliability,
+ ResourceID: patrolRuntimeResourceID, ResourceName: "Pulse Patrol Service",
+ ResourceType: "service", Title: "Pulse Patrol provider interrupted",
+ }
+ ps.findings.Add(runtimeFinding)
+
+ adapter := newPatrolFindingCreatorAdapterState(ps, state)
+ adapter.setFindingScope([]string{"vm-requested"})
+ active := adapter.GetActiveFindings("", "")
+ if len(active) != 1 || active[0].ID != runtimeFinding.ID {
+ t.Fatalf("active findings = %+v, want seeded Patrol runtime finding", active)
+ }
+ if err := adapter.AssessFinding(tools.PatrolFindingAssessmentInput{
+ FindingID: runtimeFinding.ID, Verdict: "uncertain",
+ Evidence: "the prior provider interruption is not infrastructure evidence",
+ Reason: "the current scoped run has not completed yet",
+ }); err != nil {
+ t.Fatalf("assess seeded runtime finding in scoped run: %v", err)
+ }
+ assessments := adapter.getAssessments()
+ if len(assessments) != 1 || assessments[0].FindingID != runtimeFinding.ID || assessments[0].Verdict != "uncertain" {
+ t.Fatalf("runtime finding assessments = %+v", assessments)
+ }
+}
+
func TestPatrolFindingAdapterDistinguishesSameRunCreationFromExistingRereport(t *testing.T) {
ps := NewPatrolService(nil, nil)
input := tools.PatrolFindingInput{