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
Hydrate Assistant handoff resource policy context
rcourtman7df4588f6364
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex c40b2e05e1..8778167f2e 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -185,11 +185,16 @@ runtime cost control, and shared AI transport surfaces.references may persist as session model-context metadata for follow-up turns,but they remain references only; each turn must rehydrate them from thecurrent canonical unified-resource model before action validation can use- them. Assistant runtime may also hydrate recent changes for those handoff- resources from the canonical unified-resource timeline as model-only context- on each turn, but those timeline facts remain read-only explanation context- and do not grant action authority. The runtime may also persist structured- pending-action and approval references from the same investigation record as+ them. Assistant runtime may also hydrate canonical resource-policy context+ for those handoff resources, using the same unified-resource resolution and+ policy presentation helpers that govern mention prefetch and provider-bound+ redaction; that context remains model-only handling guidance, not saved user+ text or disclosure authority. Assistant runtime may also hydrate recent+ changes for those handoff resources from the canonical unified-resource+ timeline as model-only context on each turn, but those timeline facts remain+ read-only explanation context and do not grant action authority. The runtime+ may also persist structured pending-action and approval references from the+ same investigation record asmodel-context metadata, but those references are review context only: theymust not include raw command text, must not grant approval or executionauthority, and must route any operator decision back through the governeddiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex fa077a5cd3..ad4a4ccb7d 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -756,17 +756,22 @@ the canonical monitored-system blocked payload.affect session-scoped action validation. If stored for follow-up turns, theyremain model-context references rather than saved user text or actionauthority, and the runtime must re-resolve them against current canonical- resources before use. Chat execution may also hydrate recent changes for- those handoff resources from the canonical unified-resource timeline, but the- resulting context is read-only, model-only explanation data and must not- become saved user text or action authority. The backend may also carry- structured pending-action and approval references from the investigation- record into chat execution, but those references must omit raw proposed-fix- commands, remain model-only review context, and leave approval/execution- authority with the governed approval and remediation APIs. Chat execution may- refresh approval status snapshots for those references from the canonical- approval store, but that snapshot is read-only, org-scoped, and must not- expose or infer the raw command. Frontend handoff briefings must derive from+ resources before use. Chat execution may also hydrate canonical+ resource-policy context for those resources through unified-resource+ resolution and shared policy presentation helpers, but the resulting handling+ guidance is read-only, model-only context and must not become saved user text,+ disclosure authority, or action authority. Chat execution may also hydrate+ recent changes for those handoff resources from the canonical+ unified-resource timeline, but the resulting context is read-only, model-only+ explanation data and must not become saved user text or action authority. The+ backend may also carry structured pending-action and approval references from+ the investigation record into chat execution, but those references must omit+ raw proposed-fix commands, remain model-only review context, and leave+ approval/execution authority with the governed approval and remediation APIs.+ Chat execution may refresh approval status snapshots for those references+ from the canonical approval store, but that snapshot is read-only,+ org-scoped, and must not expose or infer the raw command. Frontend handoff+ briefings must derive fromthe same shared investigation payload rather than inventing a secondfinding-context transport shape.7. Keep Patrol summary payload consumers aligned on one assessment hierarchy: transport-driven Patrol summary surfaces may show supporting counts and outcomes, but the canonical assessment and verification states must remain singular and not be repeated as a second compact verdict stripdiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 2a656f3592..4aa45d5da9 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -109,9 +109,10 @@ Patrol-specific presentation helpers.approval's current status for review, but Patrol presentation must still keepcommand payloads inside governed approval/remediation context rather thanrendering them as handoff copy. Assistant may also enrich that same handoff- with recent canonical resource-timeline changes for explanation, but Patrol- must keep the visible finding and drawer briefing tied to the shared- investigation payload rather than forking a Patrol-local timeline summary.+ with canonical resource-policy guidance and recent canonical+ resource-timeline changes for explanation, but Patrol must keep the visible+ finding and drawer briefing tied to the shared investigation payload rather+ than forking a Patrol-local policy or timeline summary.## Current Statediff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.mdindex 4e6ec2cc95..70a25fa370 100644--- a/docs/release-control/v6/internal/subsystems/security-privacy.md+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md@@ -153,7 +153,7 @@ controls as normal product settings.behavior changes. Hosted commercial URL overrides must remain absoluteHTTP(S) URLs, with plain HTTP limited to loopback development origins.8. Keep the Data Handling settings surface neutral and non-commercial: it may show resource policy posture, local-only counts, and redaction coverage, but it must not advertise trials, upgrades, paid plans, or monitoring limits.-9. Keep operator-facing Data Handling posture aligned with runtime AI/context enforcement: `local-only` resource details must not be sent to external model prompts, and sensitive free-form alert, tool-result, investigation, and any retained legacy managed-model compatibility text must use the shared resource-policy redaction helper before leaving the local trust boundary. All provider-bound AI requests to non-local models must use the shared resource-policy sanitizer immediately before transport so later agentic turns cannot bypass the advertised handling posture.+9. Keep operator-facing Data Handling posture aligned with runtime AI/context enforcement: `local-only` resource details must not be sent to external model prompts, and sensitive free-form alert, tool-result, investigation, handoff context, and any retained legacy managed-model compatibility text must use the shared resource-policy redaction helper before leaving the local trust boundary. Assistant handoffs may surface canonical policy handling guidance for product-originated resources, but that guidance is model-only context and must not become disclosure authority. All provider-bound AI requests to non-local models must use the shared resource-policy sanitizer immediately before transport so later agentic turns cannot bypass the advertised handling posture.10. Keep the canonical and frontend-served privacy disclosures aligned withthe actual AI transport boundary: self-managed installs must describe localproviders as staying on the operator network, non-local providers as direct@@ -207,9 +207,11 @@ informational and non-commercial so free/self-hosted operators are not shownpaywall, trial, upgrade, or monitoring-limit prompts inside a privacy surface.That posture is now enforced at the AI provider boundary too: non-local modelrequests must be sanitized from the same resource-policy metadata that powers-the Data Handling surface. Hosted quickstart traffic is retired from the Pulse-runtime, so privacy governance must not describe a live public hosted-model-proxy for normal self-hosted v6 installs.+the Data Handling surface. Assistant finding handoffs may hydrate policy+guidance for the handed-over resources from that same metadata, but it remains+read-only model context and cannot authorize raw identifier disclosure. Hosted+quickstart traffic is retired from the Pulse runtime, so privacy governance must+not describe a live public hosted-model proxy for normal self-hosted v6 installs.That shared settings boundary now also has an explicit split of responsibilities:`frontend-modern/src/components/Settings/useSystemSettingsState.ts` remains thecanonical owner for customer-visible telemetry and auth/privacy runtime state,diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 595d25c80b..adef8cfa38 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -1423,14 +1423,21 @@ policy requires governed handling, the shared label helper now prefers thecanonical AI-safe summary for every redacted or local-only resource and onlyfalls back to the canonical redacted label if that governed summary ismissing, so path-only and IP-only redactions do not regress to raw identity-tokens in chat context. That same unified-resource contract now also owns the-canonical mention identity path for shared Assistant reads: chat surfaces must-carry the backend-issued unified resource ID for canonical `agent`, `vm`,-`storage`, and `app-container` records, and backend mention resolution must be-able to recover those resources by canonical ID and canonical name through the-shared read-state instead of relying on provider-local route families or-frontend reconstruction of VMware- or TrueNAS-specific coordinates.-leakage or over-redaction.+leakage or over-redaction in chat context. That same unified-resource contract+now also owns the canonical mention identity path for shared Assistant reads:+chat surfaces must carry the backend-issued unified resource ID for canonical+`agent`, `vm`, `storage`, and `app-container` records, and backend mention+resolution must be able to recover those resources by canonical ID and+canonical name through the shared read-state instead of relying on+provider-local route families or frontend reconstruction of VMware- or+TrueNAS-specific coordinates.+Assistant finding handoffs now resolve product-originated resource references+through the same canonical unified-resource helper before building policy+context, so handoff handling guidance uses `CanonicalGovernanceMetadata(...)`,+`ResourcePolicyLabel(...)`, and `ResourcePolicySummaryLines(...)` instead of+chat-local sensitivity inference. The resulting policy block is model-only+read guidance and must not become saved user text, disclosure authority, or+action authority.The frontend unified-resource hook now trusts backend canonical `policy` and`aiSafeSummary` values directly, so the canonical summary value staysaligned with the same policy-aware contract that governs sensitivity anddiff --git a/internal/ai/chat/service.go b/internal/ai/chat/service.goindex 6bd40d2b4a..88bf2c0322 100644--- a/internal/ai/chat/service.go+++ b/internal/ai/chat/service.go@@ -524,6 +524,10 @@ func (s *Service) ExecuteStream(ctx context.Context, req ExecuteRequest, callbaclog.Warn().Err(err).Str("session_id", session.ID).Msg("[ChatService] Failed to persist refreshed handoff action status")}}+ s.mu.RLock()+ handoffResourceProvider := s.unifiedResourceProvider+ s.mu.RUnlock()+ handoffContext = mergeHandoffResourcePolicyContext(handoffContext, handoffResources, handoffResourceProvider)handoffContext = mergeHandoffResourceTimelineContext(handoffContext, handoffResources, s.actionAuditStore, time.Now())handoffContext = mergeHandoffActionContext(handoffContext, handoffActions)injectHandoffContextIntoLatestUserMessage(messages, handoffContext)@@ -841,6 +845,84 @@ func injectHandoffContextIntoLatestUserMessage(messages []Message, handoffContex}}+func mergeHandoffResourcePolicyContext(handoffContext string, handoffResources []HandoffResource, provider tools.UnifiedResourceProvider) string {+ policyContext := buildHandoffResourcePolicyContext(handoffResources, provider)+ switch {+ case strings.TrimSpace(handoffContext) == "":+ return policyContext+ case policyContext == "":+ return strings.TrimSpace(handoffContext)+ default:+ return strings.TrimSpace(handoffContext) + "\n\n" + policyContext+ }+}++func buildHandoffResourcePolicyContext(handoffResources []HandoffResource, provider tools.UnifiedResourceProvider) string {+ resources := normalizeHandoffResources(handoffResources)+ if len(resources) == 0 || provider == nil {+ return ""+ }++ var b strings.Builder+ seen := make(map[string]struct{}, len(resources))+ count := 0+ for _, handoffResource := range resources {+ resource, ok := tools.CanonicalHandoffUnifiedResource(provider, handoffResource.ID, handoffResource.Name, handoffResource.Type, handoffResource.Node)+ if !ok {+ continue+ }+ key := strings.ToLower(strings.TrimSpace(string(resource.Type)) + "\x00" + strings.TrimSpace(resource.ID))+ if key == "\x00" {+ continue+ }+ if _, ok := seen[key]; ok {+ continue+ }+ seen[key] = struct{}{}++ policy, aiSafeSummary := unifiedresources.CanonicalGovernanceMetadata(&resource)+ if policy == nil && strings.TrimSpace(aiSafeSummary) == "" {+ continue+ }+ if b.Len() == 0 {+ b.WriteString("[Resource Policy Context]")+ }+ count++++ label := unifiedresources.ResourcePolicyLabel(resource.Name, aiSafeSummary, policy)+ if label == "" {+ label = "resource"+ }+ resourceType := strings.TrimSpace(string(unifiedresources.ContractResourceType(resource)))+ if resourceType == "" {+ resourceType = strings.TrimSpace(string(resource.Type))+ }++ contextLabel := "Resource Policy"+ if count > 1 {+ contextLabel = fmt.Sprintf("Resource Policy %d", count)+ }+ appendHandoffContextLine(&b, contextLabel, label)+ appendHandoffContextLine(&b, contextLabel+" Type", resourceType)+ for _, line := range unifiedresources.ResourcePolicySummaryLines(policy) {+ if line = strings.TrimSpace(line); line != "" {+ if b.Len() > 0 {+ b.WriteByte('\n')+ }+ b.WriteString(line)+ }+ }+ if summary := strings.TrimSpace(aiSafeSummary); summary != "" && summary != label {+ appendHandoffContextLine(&b, contextLabel+" AI-safe Summary", summary)+ }+ }+ if count == 0 {+ return ""+ }+ appendHandoffContextLine(&b, "Policy Boundary", "Resource policy is read-only data-handling context; local-only and redaction guidance must not be bypassed and does not grant approval or execution authority.")+ return strings.TrimSpace(b.String())+}+func mergeHandoffActionContext(handoffContext string, handoffActions []HandoffAction) string {actionContext := buildHandoffActionContext(handoffActions)switch {@@ -940,26 +1022,26 @@ func buildHandoffActionContext(handoffActions []HandoffAction) string {if len(actions) > 1 {label = fmt.Sprintf("Pending Action %d", idx+1)}- appendHandoffActionLine(&b, label+" Finding ID", action.FindingID)- appendHandoffActionLine(&b, label+" Record ID", action.RecordID)- appendHandoffActionLine(&b, label+" Approval ID", action.ApprovalID)- appendHandoffActionLine(&b, label+" Approval Status", action.ApprovalStatus)- appendHandoffActionLine(&b, label+" Approval Requested At", action.ApprovalRequestedAt)- appendHandoffActionLine(&b, label+" Approval Expires At", action.ApprovalExpiresAt)- appendHandoffActionLine(&b, label+" Approval Decided At", action.ApprovalDecidedAt)+ appendHandoffContextLine(&b, label+" Finding ID", action.FindingID)+ appendHandoffContextLine(&b, label+" Record ID", action.RecordID)+ appendHandoffContextLine(&b, label+" Approval ID", action.ApprovalID)+ appendHandoffContextLine(&b, label+" Approval Status", action.ApprovalStatus)+ appendHandoffContextLine(&b, label+" Approval Requested At", action.ApprovalRequestedAt)+ appendHandoffContextLine(&b, label+" Approval Expires At", action.ApprovalExpiresAt)+ appendHandoffContextLine(&b, label+" Approval Decided At", action.ApprovalDecidedAt)if action.ApprovalConsumed {- appendHandoffActionLine(&b, label+" Approval Consumed", "true")+ appendHandoffContextLine(&b, label+" Approval Consumed", "true")}- appendHandoffActionLine(&b, label+" Fix ID", action.FixID)- appendHandoffActionLine(&b, label+" Proposed Fix", action.Description)- appendHandoffActionLine(&b, label+" Risk", action.RiskLevel)+ appendHandoffContextLine(&b, label+" Fix ID", action.FixID)+ appendHandoffContextLine(&b, label+" Proposed Fix", action.Description)+ appendHandoffContextLine(&b, label+" Risk", action.RiskLevel)if action.Destructive {- appendHandoffActionLine(&b, label+" Destructive", "true")+ appendHandoffContextLine(&b, label+" Destructive", "true")}- appendHandoffActionLine(&b, label+" Target Host", action.TargetHost)- appendHandoffActionLine(&b, label+" Target Resource", formatHandoffActionResource(action))+ appendHandoffContextLine(&b, label+" Target Host", action.TargetHost)+ appendHandoffContextLine(&b, label+" Target Resource", formatHandoffActionResource(action))}- appendHandoffActionLine(&b, "Action Boundary", "Review and approval must stay in governed approval/remediation flows; this reference is not command authority and must not be used to infer raw command text.")+ appendHandoffContextLine(&b, "Action Boundary", "Review and approval must stay in governed approval/remediation flows; this reference is not command authority and must not be used to infer raw command text.")return strings.TrimSpace(b.String())}@@ -1023,7 +1105,7 @@ func formatHandoffActionTime(value time.Time) string {return value.UTC().Format(time.RFC3339)}-func appendHandoffActionLine(b *strings.Builder, label, value string) {+func appendHandoffContextLine(b *strings.Builder, label, value string) {value = strings.TrimSpace(value)if value == "" {returndiff --git a/internal/ai/chat/service_execute_additional_test.go b/internal/ai/chat/service_execute_additional_test.goindex 9e667bb759..991e0dc294 100644--- a/internal/ai/chat/service_execute_additional_test.go+++ b/internal/ai/chat/service_execute_additional_test.go@@ -259,6 +259,114 @@ func TestService_ExecuteStream_HandoffContextIsModelOnly(t *testing.T) {}}+func TestService_ExecuteStream_HandoffResourcePolicyContextIsModelOnly(t *testing.T) {+ tmpDir := t.TempDir()+ store, err := NewSessionStore(tmpDir)+ if err != nil {+ t.Fatalf("failed to create session store: %v", err)+ }++ state := models.StateSnapshot{+ VMs: []models.VM{{+ ID: "vm:node1:104",+ VMID: 104,+ Name: "finance-vm",+ Node: "node1",+ Status: "running",+ IPAddresses: []string{"10.0.0.40"},+ Tags: []string{"pii"},+ }},+ }+ registry := unifiedresources.NewRegistry(nil)+ registry.IngestSnapshot(state)+ vmResources := registry.ListByType(unifiedresources.ResourceTypeVM)+ if len(vmResources) != 1 {+ t.Fatalf("expected one canonical VM resource, got %d", len(vmResources))+ }+ vmResource := vmResources[0]+ unifiedProvider := unifiedresources.NewUnifiedAIAdapter(registry)++ executor := tools.NewPulseToolExecutor(tools.ExecutorConfig{UnifiedResourceProvider: unifiedProvider})+ var capturedMessages []providers.Message+ provider := &stubServiceProvider{+ streamFn: func(ctx context.Context, req providers.ChatRequest, callback providers.StreamCallback) error {+ capturedMessages = append([]providers.Message(nil), req.Messages...)+ callback(providers.StreamEvent{+ Type: "content",+ Data: providers.ContentEvent{Text: "noted"},+ })+ callback(providers.StreamEvent{+ Type: "done",+ Data: providers.DoneEvent{InputTokens: 1, OutputTokens: 1},+ })+ return nil+ },+ }+ loop := NewAgenticLoop(provider, executor, "system")++ svc := &Service{+ cfg: &config.AIConfig{ChatModel: "openai:test"},+ sessions: store,+ executor: executor,+ agenticLoop: loop,+ provider: provider,+ unifiedResourceProvider: unifiedProvider,+ started: true,+ }++ req := ExecuteRequest{+ SessionID: "sess-handoff-policy",+ Prompt: "What happened?",+ HandoffContext: "[Finding Context]\nID: finding-123\nConclusion: finance-vm is overloaded.",+ HandoffResources: []HandoffResource{{+ ID: vmResource.ID,+ Name: "finance-vm",+ Type: "vm",+ Node: "node1",+ }},+ }+ if err := svc.ExecuteStream(context.Background(), req, func(StreamEvent) {}); err != nil {+ t.Fatalf("ExecuteStream failed: %v", err)+ }++ stored, err := store.GetMessages("sess-handoff-policy")+ if err != nil {+ t.Fatalf("GetMessages failed: %v", err)+ }+ if len(stored) == 0 {+ t.Fatal("expected stored messages")+ }+ if stored[0].Content != "What happened?" {+ t.Fatalf("stored user message = %q, want clean prompt", stored[0].Content)+ }+ if strings.Contains(stored[0].Content, "Resource Policy Context") {+ t.Fatalf("stored user message should not include resource policy context: %q", stored[0].Content)+ }++ if len(capturedMessages) == 0 {+ t.Fatal("expected provider messages")+ }+ modelUserContent := capturedMessages[len(capturedMessages)-1].Content+ if !strings.Contains(modelUserContent, "[Resource Policy Context]") {+ t.Fatalf("model user content missing resource policy context: %q", modelUserContent)+ }+ if !strings.Contains(modelUserContent, "Policy: sensitivity=Restricted, routing=Local Only") {+ t.Fatalf("model user content missing canonical policy summary: %q", modelUserContent)+ }+ if !strings.Contains(modelUserContent, "Redactions: Hostname, IP Address, Platform ID, Alias") {+ t.Fatalf("model user content missing canonical redaction summary: %q", modelUserContent)+ }+ if !strings.Contains(modelUserContent, "Policy Boundary: Resource policy is read-only data-handling context") {+ t.Fatalf("model user content missing policy boundary: %q", modelUserContent)+ }+ if !strings.Contains(modelUserContent, "redacted by policy") {+ t.Fatalf("external provider request should redact raw governed resource identity: %q", modelUserContent)+ }+ if strings.Contains(modelUserContent, "finance-vm") || strings.Contains(modelUserContent, "10.0.0.40") {+ t.Fatalf("model user content leaked governed resource identity: %q", modelUserContent)+ }+}+func TestService_ExecuteStream_ReusesModelHandoffContextAcrossFollowUps(t *testing.T) {installTestApprovalStore(t, &approval.ApprovalRequest{ID: "approval-123",diff --git a/internal/ai/tools/tools_query.go b/internal/ai/tools/tools_query.goindex 055de0a102..63e9ca955e 100644--- a/internal/ai/tools/tools_query.go+++ b/internal/ai/tools/tools_query.go@@ -2544,14 +2544,16 @@ func canonicalStorageRegistration(resource unifiedresources.Resource) (ResourceR}, true}-// CanonicalHandoffResourceRegistration resolves a product-originated resource-// handoff into the same governed registration shape used by explicit resource-// reads. It intentionally fails closed when the resource cannot be found in the-// unified provider, because invented registrations would bypass capability and-// executor policy.-func CanonicalHandoffResourceRegistration(provider UnifiedResourceProvider, resourceID, resourceName, resourceType, node string) (ResourceRegistration, bool) {+// CanonicalHandoffUnifiedResource resolves a product-originated resource handoff+// into the canonical unified-resource record used by downstream governance.+func CanonicalHandoffUnifiedResource(provider UnifiedResourceProvider, resourceID, resourceName, resourceType, node string) (unifiedresources.Resource, bool) {+ resource, _, ok := canonicalHandoffUnifiedResource(provider, resourceID, resourceName, resourceType, node)+ return resource, ok+}++func canonicalHandoffUnifiedResource(provider UnifiedResourceProvider, resourceID, resourceName, resourceType, node string) (unifiedresources.Resource, string, bool) {if provider == nil {- return ResourceRegistration{}, false+ return unifiedresources.Resource{}, "", false}refs := appendUniqueStrings(nil, resourceID, resourceName)@@ -2567,27 +2569,54 @@ func CanonicalHandoffResourceRegistration(provider UnifiedResourceProvider, resocase "agent", "docker-host":refs = appendUniqueStrings(refs, node)if resource, ok := findCanonicalResourceByReference(provider.GetByType(unifiedresources.ResourceTypeAgent), refs...); ok {- return canonicalAgentRegistration(resource)+ return resource, normalizedType, true}case "vm":if resource, ok := findCanonicalGuestResourceByReferences(provider, "vm", refs...); ok {- return canonicalGuestRegistration("vm", resource)+ return resource, normalizedType, true}case "system-container", "lxc":if resource, ok := findCanonicalGuestResourceByReferences(provider, "system-container", refs...); ok {- return canonicalGuestRegistration("system-container", resource)+ return resource, normalizedType, true}case "app-container":if resource, ok := findCanonicalAppContainerResourceByReferences(provider, refs...); ok {- return resolvedAppContainerRegistration(resource)+ return resource, normalizedType, true}case "storage":if resource, ok := findCanonicalResourceByReference(canonicalStoragePoolResources(provider), refs...); ok {- return canonicalStorageRegistration(resource)+ return resource, normalizedType, true}}- return ResourceRegistration{}, false+ return unifiedresources.Resource{}, normalizedType, false+}++// CanonicalHandoffResourceRegistration resolves a product-originated resource+// handoff into the same governed registration shape used by explicit resource+// reads. It intentionally fails closed when the resource cannot be found in the+// unified provider, because invented registrations would bypass capability and+// executor policy.+func CanonicalHandoffResourceRegistration(provider UnifiedResourceProvider, resourceID, resourceName, resourceType, node string) (ResourceRegistration, bool) {+ resource, normalizedType, ok := canonicalHandoffUnifiedResource(provider, resourceID, resourceName, resourceType, node)+ if !ok {+ return ResourceRegistration{}, false+ }++ switch normalizedType {+ case "agent", "docker-host":+ return canonicalAgentRegistration(resource)+ case "vm":+ return canonicalGuestRegistration("vm", resource)+ case "system-container", "lxc":+ return canonicalGuestRegistration("system-container", resource)+ case "app-container":+ return resolvedAppContainerRegistration(resource)+ case "storage":+ return canonicalStorageRegistration(resource)+ default:+ return ResourceRegistration{}, false+ }}func findCanonicalResourceByReference(resources []unifiedresources.Resource, references ...string) (unifiedresources.Resource, bool) {diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 3e07d8f7d9..beb015bc57 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -167,10 +167,13 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {"sessions.SetModelHandoffActions(session.ID, handoffActions)","sessions.GetModelHandoffActions(session.ID)","refreshHandoffActionApprovalStatus(handoffActions, s.orgID)",+ "mergeHandoffResourcePolicyContext(handoffContext, handoffResources, handoffResourceProvider)","mergeHandoffResourceTimelineContext(handoffContext, handoffResources, s.actionAuditStore, time.Now())","handoffContext = mergeHandoffActionContext(handoffContext, handoffActions)","s.hydrateHandoffResources(session.ID, handoffResources, sessions, unifiedResourceProvider)","injectHandoffContextIntoLatestUserMessage(messages, handoffContext)",+ "Resource Policy Context",+ "Policy Boundary","Timeline Boundary","Approval Status","Action Boundary",@@ -215,6 +218,9 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {if !strings.Contains(toolsQueryText, "func CanonicalHandoffResourceRegistration(provider UnifiedResourceProvider") {t.Fatal("AI tools runtime must own canonical handoff resource registration")}+ if !strings.Contains(toolsQueryText, "func CanonicalHandoffUnifiedResource(provider UnifiedResourceProvider") {+ t.Fatal("AI tools runtime must own canonical handoff unified resource resolution")+ }}func TestContract_ProxmoxSetupScriptUsesPrivilegeSeparatedTokenACLs(t *testing.T) {