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.

Tighten VMware control wording boundaries

rcourtmanac9375a34b0e
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 741d541e10..57b25ac5eb 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -213,6 +213,12 @@ emit `pulse_control` guest instructions for it, shared resource registrations
must stay limited to read-side actions, and any attempted `pulse_control`
restart/stop/shutdown path must fail as a read-only denial instead of falling
through to legacy guest resolution or provider-local control assumptions.
+That same boundary also governs shared Assistant wording in
+`internal/ai/chat/service.go` and `internal/ai/tools/tools_control.go`: the
+base system prompt and `pulse_control` schema/description must not claim that a
+generic `vm` or `system-container` is controllable. Shared AI text must describe
+control as capability-gated and explicitly allow read-only platform variants
+such as VMware phase-1 guests.
That same VMware AI rule also includes the investigation path. Alarm, health,
event, task, metrics-history, and snapshot-tree context for VMware-backed
resources must stay reachable through those same shared read/query surfaces
diff --git a/internal/ai/chat/service.go b/internal/ai/chat/service.go
index bbe63840d5..35a6a32dfe 100644
--- a/internal/ai/chat/service.go
+++ b/internal/ai/chat/service.go
@@ -1409,7 +1409,7 @@ func (s *Service) buildSystemPrompt() string {
## CAPABILITIES
- pulse_query: Find resources (VMs, containers, hosts) and their locations
- pulse_discovery: Get service details, config paths, ports, bind mounts
-- pulse_control: Run commands on hosts, containers, and VMs
+- pulse_control: Run commands on hosts and control only resources that explicitly support shared Pulse actions
- pulse_docker: Manage Docker containers
- pulse_file_edit: Read and edit configuration files
- pulse_question: Ask the user for missing information using a structured prompt (interactive only)
@@ -1427,6 +1427,7 @@ func (s *Service) buildSystemPrompt() string {
## TOOL SELECTION
- pulse_control and pulse_docker are WRITE tools — they change infrastructure state.
+- Not every VM or container supports control. Some API-backed platforms are read-only even when the resource type is "vm" or "system-container".
- ONLY use write tools when the user explicitly asks you to perform an action.
- For status checks or monitoring, use pulse_query or pulse_read instead.
- If you are missing critical information (target, risky choice, preference), use pulse_question to ask structured questions.
diff --git a/internal/ai/chat/service_tooling_test.go b/internal/ai/chat/service_tooling_test.go
index 4c385347f2..5d039b8d30 100644
--- a/internal/ai/chat/service_tooling_test.go
+++ b/internal/ai/chat/service_tooling_test.go
@@ -147,6 +147,22 @@ func TestFilterToolsForPrompt_BroadInfraKeepsStorage(t *testing.T) {
}
}
+func TestBuildSystemPrompt_DoesNotClaimGenericVMControl(t *testing.T) {
+ svc := &Service{}
+
+ prompt := svc.buildSystemPrompt()
+
+ if strings.Contains(prompt, "Run commands on hosts, containers, and VMs") {
+ t.Fatalf("expected system prompt to avoid blanket VM control claim, got %q", prompt)
+ }
+ if !strings.Contains(prompt, "Not every VM or container supports control") {
+ t.Fatalf("expected system prompt to call out read-only resource platforms, got %q", prompt)
+ }
+ if !strings.Contains(prompt, "control only resources that explicitly support shared Pulse actions") {
+ t.Fatalf("expected system prompt to describe capability-bound pulse_control usage, got %q", prompt)
+ }
+}
+
func TestFilterToolsForPrompt_RecoveryOnlyKeepsStorage(t *testing.T) {
exec := tools.NewPulseToolExecutor(tools.ExecutorConfig{
RecoveryPointsProvider: &fakeRecoveryPointsProvider{points: []recovery.RecoveryPoint{{
diff --git a/internal/ai/tools/control_resource_test.go b/internal/ai/tools/control_resource_test.go
index b687d4e5eb..43df531720 100644
--- a/internal/ai/tools/control_resource_test.go
+++ b/internal/ai/tools/control_resource_test.go
@@ -3,6 +3,7 @@ package tools
import (
"context"
"encoding/json"
+ "strings"
"testing"
"time"
@@ -58,6 +59,32 @@ func TestPulseToolExecutor_ListTools_IncludesPulseControlForNativeAppProvider(t
}
}
+func TestPulseToolExecutor_ListTools_PulseControlDescriptionStaysCapabilityBounded(t *testing.T) {
+ executor := NewPulseToolExecutor(ExecutorConfig{
+ StateProvider: &mockStateProvider{},
+ AgentServer: &mockAgentServer{},
+ ControlLevel: ControlLevelControlled,
+ })
+
+ tools := executor.ListTools()
+ for _, tool := range tools {
+ if tool.Name != "pulse_control" {
+ continue
+ }
+ if !strings.Contains(tool.Description, "explicitly advertise shared Pulse actions") {
+ t.Fatalf("expected pulse_control description to stay capability-bounded, got %q", tool.Description)
+ }
+ if !strings.Contains(tool.Description, "read-only") {
+ t.Fatalf("expected pulse_control description to warn about read-only resources, got %q", tool.Description)
+ }
+ if action := tool.InputSchema.Properties["action"].Description; !strings.Contains(action, "resolved resource's shared action set") {
+ t.Fatalf("expected pulse_control action schema to describe shared action gating, got %q", action)
+ }
+ return
+ }
+ t.Fatalf("expected pulse_control to be available, got %+v", tools)
+}
+
func TestExecuteControlResource_TrueNASAppUsesNativeActionProvider(t *testing.T) {
provider := newTrueNASUnifiedQueryProvider(t)
resolved := &mockResolvedContext{
diff --git a/internal/ai/tools/tools_control.go b/internal/ai/tools/tools_control.go
index cac85213f3..1329e1d630 100644
--- a/internal/ai/tools/tools_control.go
+++ b/internal/ai/tools/tools_control.go
@@ -21,7 +21,7 @@ func (e *PulseToolExecutor) registerControlTools() {
e.registry.Register(RegisteredTool{
Definition: Tool{
Name: "pulse_control",
- Description: `WRITE operations: control canonical resources (VMs, system containers, supported app-containers) or execute state-modifying commands. For read-only operations use pulse_read. For Docker-only workflows use pulse_docker.`,
+ Description: `WRITE operations: control canonical resources that explicitly advertise shared Pulse actions (for example Proxmox guests and supported app-containers) or execute state-modifying commands. Some canonical resources are read-only and will reject pulse_control even when their type is vm or system-container. For read-only operations use pulse_read. For Docker-only workflows use pulse_docker.`,
InputSchema: InputSchema{
Type: "object",
Properties: map[string]PropertySchema{
@@ -40,7 +40,7 @@ func (e *PulseToolExecutor) registerControlTools() {
},
"action": {
Type: "string",
- Description: "For guest/resource: start, stop, shutdown, restart, delete (availability depends on resource type)",
+ Description: "For guest/resource: start, stop, shutdown, restart, delete (availability depends on the resolved resource's shared action set)",
Enum: []string{"start", "stop", "shutdown", "restart", "delete"},
},
"command": {