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.

Update Patrol provider setup guidance

rcourtman19cd28d17a51
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index b816f6fb6d..c3da28372e 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -104,6 +104,9 @@ runtime cost control, and shared AI transport surfaces.
surfaced as the synthetic Patrol runtime finding, and preserved on patrol
run records as structured error summary/detail instead of collapsing to
generic analysis-failed copy.
+ Unavailable-provider blocked states must direct operators to Assistant &
+ Patrol provider settings and tool-capable Patrol model selection, not
+ legacy `Settings > Pulse Assistant` copy.
4. Keep discovery scheduling authoritative through `internal/config/ai.go`: `discovery_enabled` and `discovery_interval_hours` must govern both lightweight infrastructure discovery and deep service-discovery background loops
5. Preserve auditability for outbound model-bound context exports and keep the export record aligned with the prompt boundary that actually reaches the provider
External provider-bound unified-resource context must enforce the same
@@ -1180,6 +1183,9 @@ The Patrol runtime now also exports a canonical `runtime_state` alongside
legacy managed-credit block conditions remain part of the governed runtime
contract instead of being inferred later from the last successful patrol
summary.
+When missing provider configuration blocks Patrol, `blocked_reason` must point
+to Assistant & Patrol provider settings and tool-capable Patrol model
+selection.
That runtime-state contract must be derived from live Patrol runtime inputs,
not only from the last failed run attempt, and the backend must clear any stale
managed-credit block once a provider or local model configuration returns.
diff --git a/internal/ai/patrol_coverage_test.go b/internal/ai/patrol_coverage_test.go
index 9f754ad209..8716b24e7d 100644
--- a/internal/ai/patrol_coverage_test.go
+++ b/internal/ai/patrol_coverage_test.go
@@ -203,3 +203,21 @@ func TestPatrol_RunPatrol_AIRequired(t *testing.T) {
t.Error("Expected error count > 0 or unhealthy status when chat service unavailable")
}
}
+
+func TestPatrol_RunPatrol_AIUnavailableUsesProviderSettingsGuidance(t *testing.T) {
+ stateProvider := &mockStateProvider{
+ state: models.StateSnapshot{
+ Nodes: []models.Node{
+ {ID: "node1", Name: "node1", Status: "online"},
+ },
+ },
+ }
+ ps := NewPatrolService(nil, stateProvider)
+
+ ps.runPatrol(context.Background())
+
+ status := ps.GetStatus()
+ if status.BlockedReason != patrolProviderNotConfiguredReason {
+ t.Fatalf("blocked reason = %q, want %q", status.BlockedReason, patrolProviderNotConfiguredReason)
+ }
+}
diff --git a/internal/ai/patrol_run.go b/internal/ai/patrol_run.go
index f0630b9c98..ffe41a1550 100644
--- a/internal/ai/patrol_run.go
+++ b/internal/ai/patrol_run.go
@@ -365,7 +365,7 @@ func (p *PatrolService) runPatrolWithTrigger(ctx context.Context, trigger Trigge
// Check if we can run LLM analysis (AI-only patrol)
if !canRunLLM {
- reason := "AI not configured - set up a provider in Settings > Pulse Assistant"
+ reason := patrolProviderNotConfiguredReason
if aiServiceEnabled && !llmAllowed {
reason = "circuit breaker is open"
GetPatrolMetrics().RecordCircuitBlock()
@@ -768,7 +768,7 @@ func (p *PatrolService) runScopedPatrol(ctx context.Context, scope PatrolScope)
canRunLLM := aiServiceEnabled && llmAllowed
if !canRunLLM {
- reason := "AI not configured - set up a provider in Settings > Pulse Assistant"
+ reason := patrolProviderNotConfiguredReason
if aiServiceEnabled && !llmAllowed {
reason = "circuit breaker is open"
GetPatrolMetrics().RecordCircuitBlock()
diff --git a/internal/ai/patrol_run_additional_test.go b/internal/ai/patrol_run_additional_test.go
index a173bae244..14e6014179 100644
--- a/internal/ai/patrol_run_additional_test.go
+++ b/internal/ai/patrol_run_additional_test.go
@@ -204,7 +204,7 @@ func TestPatrolService_RunScopedPatrol_EarlyPaths(t *testing.T) {
ps.stateProvider = mockPatrolStateProvider{state: models.StateSnapshot{Nodes: []models.Node{{ID: "node1", Name: "node1"}}}}
ps.runScopedPatrol(context.Background(), PatrolScope{ResourceIDs: []string{"node1"}, ResourceTypes: []string{"node"}})
status := ps.GetStatus()
- if status.BlockedReason == "" {
- t.Fatalf("expected blocked reason when AI unavailable")
+ if status.BlockedReason != patrolProviderNotConfiguredReason {
+ t.Fatalf("blocked reason = %q, want %q", status.BlockedReason, patrolProviderNotConfiguredReason)
}
}
diff --git a/internal/ai/patrol_runtime_failure.go b/internal/ai/patrol_runtime_failure.go
index c2e2954513..e7aabbbc59 100644
--- a/internal/ai/patrol_runtime_failure.go
+++ b/internal/ai/patrol_runtime_failure.go
@@ -7,6 +7,7 @@ import (
)
const patrolRuntimeFailureDetailLimit = 2000
+const patrolProviderNotConfiguredReason = "Patrol provider not configured - open Assistant & Patrol provider settings, configure a provider, and choose a Patrol model that supports tools"
type patrolRuntimeFailure struct {
Title string