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.

Restrict Patrol grounding to infrastructure evidence

rcourtmanacef44e162a9
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index e213062d57..283b0b3a74 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -73,7 +73,13 @@ persistence. An unset attempt ceiling does not weaken that rule: reaching the
independent model-turn limit with no successful result fails closed before the
generic final-summary fallback. The side-effect-free action-capability lookup is planning
metadata, not infrastructure evidence: it neither consumes the evidence budget
-nor satisfies this grounding gate. If the provider returns prose without a tool call, core
+nor satisfies this grounding gate. The shared
+`agentcapabilities.IsPatrolInfrastructureEvidenceToolName` vocabulary admits
+only canonical query, discovery, metrics, storage, Docker, Kubernetes, deep-read,
+and PMG observations. Alert/finding state, retained knowledge, and generated
+summaries may help interpret evidence but cannot consume the evidence budget,
+satisfy grounding, or unlock proposal authority by themselves. If the provider
+returns prose without a tool call, core
must discard that prose as a durable conclusion and allow one bounded repair
turn that requires a successful structured result from the same advertised evidence
manifest. The repair is generic and carries no platform-, incident-, or
@@ -7458,8 +7464,11 @@ the relevant subsystem evidence tool, and only the investigation-owned
capability lookup and typed proposal sink. The type is not model-authored and
cannot add a tool outside the already-projected investigation profile. Unknown
types keep the full safe investigation profile, but that fallback is not a
-validation bypass: it must still contain real evidence, the capability lookup,
-and the proposal sink before inference. Known types intersect their evidence
+validation bypass: it must still contain a tool from the shared closed
+infrastructure-evidence vocabulary, the capability lookup, and the proposal
+sink before inference. Synthesis, retained knowledge, alert/finding state, and
+planning tools do not satisfy that requirement. Known types intersect their
+evidence
ceiling with tools that are actually available after profile
projection, so a deployment without an agent-routed or native `pulse_read`
adapter still investigates from canonical query and subsystem evidence. At
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index c403346faf..bdac2d1c3e 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -4160,7 +4160,8 @@ lookup/proposal tools. It is not a client-selectable execution profile, cannot
add authority, and is never inferred from prompt text. Empty or unknown types
retain the full governed investigation profile so an additive resource kind
cannot silently lose evidence access. That full-profile fallback still fails
-before inference unless it contains at least one evidence tool, the
+before inference unless it contains at least one tool from the shared closed
+infrastructure-evidence vocabulary, the
side-effect-free capability lookup, and the typed proposal sink; additive type
compatibility does not bypass the investigation boundary. Scoped Watch uses the
same shared typed mapping after exact canonical scope resolution, with detection
@@ -9521,7 +9522,10 @@ investigation projection. That projection intersects optional evidence tools
with the runtime-available governed profile, while requiring at least one
evidence tool plus the capability lookup and typed proposal sink. Unknown and
empty resource types retain the full governed profile but undergo the same
-mandatory-tool validation before inference. The bridge's
+mandatory-tool validation before inference. The shared evidence classifier
+accepts only canonical query, discovery, metrics, storage, Docker, Kubernetes,
+deep-read, and PMG observations; alert/finding reads, knowledge, summaries, and
+proposal planning cannot satisfy the bridge's grounding requirement. The bridge's
`evidence_calls` value remains attempted-call budget accounting; the core chat
runtime separately requires a successful evidence result before it exposes the
proposal sink or accepts a completed investigation. Failed and policy-blocked
diff --git a/internal/agentcapabilities/patrol_scope_tools.go b/internal/agentcapabilities/patrol_scope_tools.go
index 66e075ea4c..5bac3e8a40 100644
--- a/internal/agentcapabilities/patrol_scope_tools.go
+++ b/internal/agentcapabilities/patrol_scope_tools.go
@@ -2,6 +2,28 @@ package agentcapabilities
import "strings"
+// IsPatrolInfrastructureEvidenceToolName reports whether a provider tool can
+// return fresh canonical or provider-observed infrastructure evidence for a
+// Patrol investigation. Planning, synthesis, retained knowledge, and finding
+// lifecycle reads are deliberately outside this closed vocabulary: they may
+// help explain evidence, but cannot satisfy the grounding gate or unlock a
+// typed remediation proposal by themselves.
+func IsPatrolInfrastructureEvidenceToolName(name string) bool {
+ switch strings.TrimSpace(name) {
+ case PulseQueryToolName,
+ PulseDiscoveryToolName,
+ PulseMetricsToolName,
+ PulseStorageToolName,
+ PulseDockerToolName,
+ PulseKubernetesToolName,
+ PulseReadToolName,
+ PulsePMGToolName:
+ return true
+ default:
+ return false
+ }
+}
+
// PatrolEvidenceToolNamesForResourceTypes returns the smallest useful
// read-only evidence surface for an exact, core-resolved Patrol resource
// scope. The bool is false when the scope is empty or contains an unknown
diff --git a/internal/agentcapabilities/types_test.go b/internal/agentcapabilities/types_test.go
index 73b4973cc0..9d44649da0 100644
--- a/internal/agentcapabilities/types_test.go
+++ b/internal/agentcapabilities/types_test.go
@@ -27,6 +27,37 @@ func TestPatrolScopedDetectionDefersOptionalDeepReadsToInvestigation(t *testing.
}
}
+func TestPatrolInfrastructureEvidenceToolVocabularyExcludesDerivedContext(t *testing.T) {
+ for _, name := range []string{
+ PulseQueryToolName,
+ PulseDiscoveryToolName,
+ PulseMetricsToolName,
+ PulseStorageToolName,
+ PulseDockerToolName,
+ PulseKubernetesToolName,
+ PulseReadToolName,
+ PulsePMGToolName,
+ } {
+ if !IsPatrolInfrastructureEvidenceToolName(name) {
+ t.Fatalf("canonical infrastructure evidence tool %q was not classified as evidence", name)
+ }
+ }
+
+ for _, name := range []string{
+ "",
+ PulseAlertsToolName,
+ PulseKnowledgeToolName,
+ PulseSummarizeToolName,
+ PatrolGetFindingsToolName,
+ PatrolActionCapabilitiesToolName,
+ PatrolProposeActionToolName,
+ } {
+ if IsPatrolInfrastructureEvidenceToolName(name) {
+ t.Fatalf("derived or planning tool %q was classified as infrastructure evidence", name)
+ }
+ }
+}
+
func TestDefaultApprovalPolicyDescriptionUsesSharedPolicyVocabulary(t *testing.T) {
cases := []struct {
policy ApprovalPolicy
diff --git a/internal/ai/chat/agentic_additional_test.go b/internal/ai/chat/agentic_additional_test.go
index 56200d924e..2d62b6f2e8 100644
--- a/internal/ai/chat/agentic_additional_test.go
+++ b/internal/ai/chat/agentic_additional_test.go
@@ -120,6 +120,10 @@ func TestPatrolDetectionInferenceAllowanceDoesNotConstrainInvestigation(t *testi
func TestInvestigationEvidenceBudgetHelpers(t *testing.T) {
available := []providers.Tool{
{Name: agentcapabilities.PulseQueryToolName},
+ {Name: agentcapabilities.PulseAlertsToolName},
+ {Name: agentcapabilities.PulseKnowledgeToolName},
+ {Name: agentcapabilities.PulseSummarizeToolName},
+ {Name: agentcapabilities.PatrolGetFindingsToolName},
{Name: agentcapabilities.PatrolProposeActionToolName},
{Name: agentcapabilities.PatrolActionCapabilitiesToolName},
}
@@ -136,6 +140,16 @@ func TestInvestigationEvidenceBudgetHelpers(t *testing.T) {
if isInvestigationEvidenceTool(agentcapabilities.PatrolActionCapabilitiesToolName) {
t.Fatal("capability lookup must not count as infrastructure evidence")
}
+ for _, name := range []string{
+ agentcapabilities.PulseAlertsToolName,
+ agentcapabilities.PulseKnowledgeToolName,
+ agentcapabilities.PulseSummarizeToolName,
+ agentcapabilities.PatrolGetFindingsToolName,
+ } {
+ if isInvestigationEvidenceTool(name) {
+ t.Fatalf("derived context tool %q must not count as infrastructure evidence", name)
+ }
+ }
if got := investigationEvidenceCheckpoint(15); got != 8 {
t.Fatalf("checkpoint(15) = %d, want 8", got)
}
diff --git a/internal/ai/chat/agentic_investigation_budget.go b/internal/ai/chat/agentic_investigation_budget.go
index 57eb7edf92..8aaa9320e0 100644
--- a/internal/ai/chat/agentic_investigation_budget.go
+++ b/internal/ai/chat/agentic_investigation_budget.go
@@ -2,7 +2,6 @@ package chat
import (
"fmt"
- "strings"
"github.com/rcourtman/pulse-go-rewrite/internal/agentcapabilities"
"github.com/rcourtman/pulse-go-rewrite/internal/ai/providers"
@@ -43,12 +42,7 @@ func applyInvestigationOutputLimitRecoveryRequest(req *providers.ChatRequest, pr
}
func isInvestigationEvidenceTool(name string) bool {
- switch strings.TrimSpace(name) {
- case "", agentcapabilities.PatrolProposeActionToolName, agentcapabilities.PatrolActionCapabilitiesToolName:
- return false
- default:
- return true
- }
+ return agentcapabilities.IsPatrolInfrastructureEvidenceToolName(name)
}
func investigationEvidenceTools(available []providers.Tool) []providers.Tool {
diff --git a/internal/ai/chat/service_filter_test.go b/internal/ai/chat/service_filter_test.go
index 685ae894fc..cf0d18ce8d 100644
--- a/internal/ai/chat/service_filter_test.go
+++ b/internal/ai/chat/service_filter_test.go
@@ -142,10 +142,13 @@ func TestRestrictInvestigationProviderToolsRequiresEvidenceAndProposalBoundary(t
want: agentcapabilities.PatrolActionCapabilitiesToolName,
},
{
- name: "unknown type missing evidence",
+ name: "unknown type has only derived context",
resourceType: "future-resource-kind",
tools: []providers.Tool{
- {Name: ""},
+ {Name: agentcapabilities.PulseAlertsToolName},
+ {Name: agentcapabilities.PulseKnowledgeToolName},
+ {Name: agentcapabilities.PulseSummarizeToolName},
+ {Name: agentcapabilities.PatrolGetFindingsToolName},
{Name: agentcapabilities.PatrolActionCapabilitiesToolName},
{Name: agentcapabilities.PatrolProposeActionToolName},
},