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 discovery prompt governance

rcourtman6f37c8d0ef7c
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 04cb82dafc..9f8520ccd3 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -186,7 +186,10 @@ runtime cost control, and shared AI transport surfaces.
registry. Tool prompts and approval surfaces must derive read, mixed, write,
and approval-policy claims from `internal/ai/tools/registry.go` and
`internal/ai/tools/executor.go` instead of maintaining hand-written
- prompt-only tool lists, and frontend approval cards must surface backend
+ prompt-only tool lists. Fallback Assistant governance text and Patrol
+ system-prompt tool summaries must mirror the same registry-owned capability
+ shape, including `pulse_discovery` read-or-refresh behavior, instead of
+ presenting stale read-only summaries. Frontend approval cards must surface backend
approval risk/description without hiding a pending approval when skip or
deny fails. Action-producing tools must also persist the unified
`ActionPlan.Preflight` dry-run boundary through
diff --git a/internal/ai/chat/service.go b/internal/ai/chat/service.go
index 09de2fe614..955bb220d2 100644
--- a/internal/ai/chat/service.go
+++ b/internal/ai/chat/service.go
@@ -2750,9 +2750,9 @@ func fallbackAssistantToolGovernance() []tools.ToolGovernanceDescriptor {
},
{
Name: "pulse_discovery",
- ActionMode: tools.ToolActionRead,
- ApprovalPolicy: "no approval required",
- Summary: "Reads discovered service details, config paths, ports, and bind mounts.",
+ ActionMode: tools.ToolActionMixed,
+ ApprovalPolicy: "no approval required; run uses read-only evidence collection and updates the discovery cache",
+ Summary: "Reads or refreshes discovered service paths, ports, and bind mounts for known resources.",
},
{
Name: "pulse_control",
diff --git a/internal/ai/chat/service_tooling_test.go b/internal/ai/chat/service_tooling_test.go
index ba00496c72..72ba83e7b6 100644
--- a/internal/ai/chat/service_tooling_test.go
+++ b/internal/ai/chat/service_tooling_test.go
@@ -166,6 +166,19 @@ func TestBuildSystemPrompt_DoesNotClaimGenericVMControl(t *testing.T) {
}
}
+func TestBuildToolGovernancePromptSection_FallbackDiscoveryMatchesRunContract(t *testing.T) {
+ svc := &Service{}
+
+ prompt := svc.buildToolGovernancePromptSection()
+
+ if !strings.Contains(prompt, "pulse_discovery: mode=mixed") {
+ t.Fatalf("expected fallback governance to classify pulse_discovery as mixed, got %q", prompt)
+ }
+ if !strings.Contains(prompt, "run uses read-only evidence collection and updates the discovery cache") {
+ t.Fatalf("expected fallback governance to describe discovery refresh behavior, got %q", prompt)
+ }
+}
+
func TestToolsForExecutionMode_RecoveryOnlyKeepsStorage(t *testing.T) {
exec := tools.NewPulseToolExecutor(tools.ExecutorConfig{
RecoveryPointsProvider: &fakeRecoveryPointsProvider{points: []recovery.RecoveryPoint{{
diff --git a/internal/ai/patrol_ai.go b/internal/ai/patrol_ai.go
index bb6ff5aa35..5200e36004 100644
--- a/internal/ai/patrol_ai.go
+++ b/internal/ai/patrol_ai.go
@@ -855,7 +855,7 @@ You have access to the following tools to investigate infrastructure:
**Deep Investigation:**
- pulse_read — Read-only command execution, file reads, log tailing
-- pulse_discovery — Infrastructure discovery details
+- pulse_discovery — Read or refresh discovered service details, config paths, ports, and bind mounts
- pulse_knowledge — User notes, incidents, event correlations
**Patrol Reporting:**
diff --git a/internal/ai/patrol_ai_more_test.go b/internal/ai/patrol_ai_more_test.go
index f5b195b13e..3413bc0063 100644
--- a/internal/ai/patrol_ai_more_test.go
+++ b/internal/ai/patrol_ai_more_test.go
@@ -176,6 +176,9 @@ func TestGetPatrolSystemPrompt_ModeSwitch(t *testing.T) {
if !strings.Contains(prompt, "Auto-Fix Mode") || !strings.Contains(prompt, "Governed read and control tools are available") {
t.Fatalf("expected auto-fix prompt, got: %s", prompt)
}
+ if !strings.Contains(prompt, "pulse_discovery") || !strings.Contains(prompt, "Read or refresh discovered service details") {
+ t.Fatalf("expected patrol prompt to expose discovery refresh capability, got: %s", prompt)
+ }
svc.cfg = &config.AIConfig{PatrolAutoFix: false}
prompt = ps.getPatrolSystemPrompt()