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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Resolve canonical Patrol discovery targets
rcourtman580093155f90
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex d0719329d0..180b6c32bf 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -3112,6 +3112,12 @@ Qualification floor: Patrol model launch and product-claim qualification must usShared or remote labs must use exact-run-labelled disposable resources,two-pass cleanup, full Docker inventory comparison including images, andmust never manufacture faults in production infrastructure.+ Read-only investigation tools that accept canonical resource IDs must+ resolve provider coordinates internally before calling provider-owned+ discovery or inspection paths. A model must not need to infer a Docker+ container ID or substitute a display name after `pulse_query` returns a+ canonical `app-container` ID; cross-tool identity translation is an AI+ runtime responsibility.Patrol autonomous-loop floor: Watch must preserve model-owned investigationwhile requiring an accepted structured outcome for every active finding thediff --git a/internal/ai/tools/tools_discovery.go b/internal/ai/tools/tools_discovery.goindex 59e89bd902..752b334620 100644--- a/internal/ai/tools/tools_discovery.go+++ b/internal/ai/tools/tools_discovery.go@@ -31,7 +31,7 @@ func (e *PulseToolExecutor) registerDiscoveryTools() {},"resource_id": {Type: "string",- Description: "For get/run: resource identifier (VMID, container name, hostname)",+ Description: "For get/run: canonical resource ID or provider identifier (VMID, container ID/name, hostname); Pulse resolves canonical app-container IDs to the runtime identity",},"target_id": {Type: "string",@@ -276,6 +276,21 @@ func (e *PulseToolExecutor) normalizeDiscoveryResourceRequest(args map[string]inreturn discoveryResourceRequest{}, NewErrorResult(fmt.Errorf("target_id is required - use the node/agent field from search or get_resource results")), false}+ // App-container identity is canonical at the model boundary, while the+ // discovery provider is keyed by the runtime's stable container ID. Resolve+ // that coordinate here so a model never has to reverse-engineer Pulse's+ // canonical ID or substitute a display name. This mirrors pulse_query's+ // app-container resolution and keeps read-only investigation tools+ // composable when one tool feeds another.+ if resourceType == "app-container" {+ if resource, providerID, found := findCanonicalAppContainerResource(e.unifiedResourceProvider, resourceID); found {+ resourceID = providerID+ if registration, ok := resolvedAppContainerRegistration(resource); ok {+ e.registerResolvedResourceWithExplicitAccess(registration)+ }+ }+ }+// For system-container and VM types, resourceID should be a numeric VMID.// If a name was passed, try to resolve it to a VMID from typed ReadState.if resourceType == "system-container" || resourceType == "vm" {diff --git a/internal/ai/tools/tools_discovery_test.go b/internal/ai/tools/tools_discovery_test.goindex 7f0c538a52..b662a1970c 100644--- a/internal/ai/tools/tools_discovery_test.go+++ b/internal/ai/tools/tools_discovery_test.go@@ -4,8 +4,10 @@ import ("context""encoding/json""errors"+ "strings""testing"+ "github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources""github.com/stretchr/testify/assert")@@ -164,6 +166,7 @@ func TestPulseDiscoveryToolSchemaIncludesRunAction(t *testing.T) {actionSchema := discoveryTool.InputSchema.Properties["action"]assert.Contains(t, actionSchema.Enum, "run")assert.Contains(t, discoveryTool.Description, `action="run" forces a fresh discovery run`)+ assert.Contains(t, discoveryTool.InputSchema.Properties["resource_id"].Description, "canonical resource ID")}func TestCanonicalDiscoveryResourceType(t *testing.T) {@@ -358,6 +361,44 @@ func TestExecuteGetDiscovery_CanonicalAppContainerUsesDockerProviderType(t *testassert.Equal(t, "http://192.0.2.10:8080", payload["suggested_url"])}+func TestExecuteGetDiscovery_ResolvesCanonicalAppContainerIDForProvider(t *testing.T) {+ const canonicalID = "app-container-e5593f5074d6cd7f"+ providerID := strings.Repeat("3", 64)+ discovery := &stubDiscoveryProvider{getResp: &ResourceDiscoveryInfo{+ ID: "docker:agent-1:" + providerID,+ ResourceType: "docker",+ ResourceID: providerID,+ TargetID: "agent-1",+ Hostname: "docker-host-1",+ }}+ exec := NewPulseToolExecutor(ExecutorConfig{+ DiscoveryProvider: discovery,+ UnifiedResourceProvider: &stubUnifiedResourceProvider{resources: []unifiedresources.Resource{{+ ID: canonicalID,+ Type: unifiedresources.ResourceTypeAppContainer,+ Technology: "docker",+ Name: "worker",+ Status: unifiedresources.StatusOffline,+ ParentName: "docker-host-1",+ Docker: &unifiedresources.DockerData{+ ContainerID: providerID,+ ContainerState: "exited",+ },+ }}},+ })++ result, err := exec.executeGetDiscovery(context.Background(), map[string]interface{}{+ "resource_type": "app-container",+ "resource_id": canonicalID,+ "target_id": "agent-1",+ })+ assert.NoError(t, err)+ assert.False(t, result.IsError)+ assert.Equal(t, "docker", discovery.lastGetResourceType)+ assert.Equal(t, "agent-1", discovery.lastGetTargetID)+ assert.Equal(t, providerID, discovery.lastGetResourceID)+}+func TestBuildDiscoveryToolResponse_IncludesBindMounts(t *testing.T) {req := discoveryResourceRequest{resourceType: "app-container",