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
Centralize governed mention summary gate
rcourtmanad77ea030288
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 79b8b1d9c9..ec10dab891 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -119,6 +119,9 @@ The governed mention formatter must also render the policy line and redactionlist through the shared unified-resource policy presentation helper so thechat prefetch path stays aligned with the same canonical sensitivity, routing,and redaction labels used by the AI summary and resource drawer.+The decision to show that governed mention block now comes from the shared+unified-resource policy helper as well, so the local gate stays aligned with+the same routing and redaction rules as the rendered summary itself.The same governed-context rule also applies to the main unified AI resourceoverview: infrastructure, workload, alert-label, and top-consumer summariesmust not leak raw resource names, cluster labels, IP addresses, or unresolveddiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 889bcbe49e..bfb9201a4e 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -203,6 +203,9 @@ The same shared policy presentation helper now also formats governed mentionpolicy lines and redaction lists for AI chat prefetch, so prompt contextstays aligned with the canonical sensitivity, routing, and redaction labelsinstead of rebuilding them in lane-local helpers.+The same helper now also owns the governed-summary gate for mention+prefetching, so the decision to surface the block follows the same canonical+local-only and redaction rules as the rendered policy text.The same shared policy helper also owns the `aiSafeSummary` decision andredaction predicates used by AI chat knowledge extraction and resourcecontext rendering, so governed labels and summary selection stay rooted indiff --git a/internal/ai/chat/context_prefetch.go b/internal/ai/chat/context_prefetch.goindex 4fa8859ae4..28b10bbdc8 100644--- a/internal/ai/chat/context_prefetch.go+++ b/internal/ai/chat/context_prefetch.go@@ -905,13 +905,7 @@ func mentionAISafeSummary(resource *unifiedresources.Resource) string {}func (m ResourceMention) requiresGovernedSummary() bool {- if m.Policy == nil {- return false- }- if m.Policy.Routing.Scope == unifiedresources.ResourceRoutingScopeLocalOnly {- return true- }- return len(m.Policy.Routing.Redact) > 0+ return unifiedresources.ResourcePolicyRequiresGovernedSummary(m.Policy)}func formatGovernedMentionSummary(sb *strings.Builder, mention ResourceMention) {diff --git a/internal/ai/chat/context_prefetch_additional_test.go b/internal/ai/chat/context_prefetch_additional_test.goindex b97039180e..e25564012a 100644--- a/internal/ai/chat/context_prefetch_additional_test.go+++ b/internal/ai/chat/context_prefetch_additional_test.go@@ -410,7 +410,7 @@ func TestContextPrefetcher_PrefetchRestrictedMentionSkipsDiscoveryAndPaths(t *teif !strings.Contains(ctx.Summary, "local-only context") {t.Fatalf("expected aiSafeSummary local-only wording, got %q", ctx.Summary)}- if !strings.Contains(ctx.Summary, "routing=local-only") {+ if !strings.Contains(ctx.Summary, "routing=Local Only") {t.Fatalf("expected policy routing in summary, got %q", ctx.Summary)}if strings.Contains(ctx.Summary, "customer-db") {@@ -421,6 +421,33 @@ func TestContextPrefetcher_PrefetchRestrictedMentionSkipsDiscoveryAndPaths(t *te}}+func TestResourceMentionRequiresGovernedSummaryUsesSharedHelper(t *testing.T) {+ if (ResourceMention{}).requiresGovernedSummary() {+ t.Fatal("expected empty mention to not require governed summary")+ }++ if !(ResourceMention{+ Policy: &unifiedresources.ResourcePolicy{+ Routing: unifiedresources.ResourceRoutingPolicy{+ Scope: unifiedresources.ResourceRoutingScopeLocalOnly,+ },+ },+ }).requiresGovernedSummary() {+ t.Fatal("expected local-only policy to require governed summary")+ }++ if !(ResourceMention{+ Policy: &unifiedresources.ResourcePolicy{+ Routing: unifiedresources.ResourceRoutingPolicy{+ Scope: unifiedresources.ResourceRoutingScopeLocalFirst,+ Redact: []unifiedresources.ResourceRedactionHint{unifiedresources.ResourceRedactionHostname},+ },+ },+ }).requiresGovernedSummary() {+ t.Fatal("expected redacted policy to require governed summary")+ }+}+func TestContextPrefetcher_FormatContextSummary_GovernedMention(t *testing.T) {prefetcher := NewContextPrefetcher(newTestReadState(models.StateSnapshot{}), nil)diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.goindex df62d94dc9..d2e46c6895 100644--- a/internal/unifiedresources/code_standards_test.go+++ b/internal/unifiedresources/code_standards_test.go@@ -361,6 +361,9 @@ func TestResourcePolicyLabelHelpersUsedByAIConsumers(t *testing.T) {"unifiedresources.ResourcePolicyLabel(","unifiedresources.ResourcePolicyRedactedValue(",},+ filepath.Join("..", "ai", "chat", "context_prefetch.go"): {+ "unifiedresources.ResourcePolicyRequiresGovernedSummary(m.Policy)",+ },filepath.Join("..", "ai", "resource_export.go"): {"unifiedresources.ResourceRedactionLabelsFromHints(redactionHints)",},@@ -378,6 +381,7 @@ func TestResourcePolicyLabelHelpersUsedByAIConsumers(t *testing.T) {"func ResourcePolicyRedactedValue(value string, policy *ResourcePolicy, hints ...ResourceRedactionHint) string","const ResourcePolicyRedactedLabel = \"redacted by policy\"","func ResourceRedactionLabelsFromHints(hints []ResourceRedactionHint) []string",+ "func ResourcePolicyRequiresGovernedSummary(policy *ResourcePolicy) bool","func ResourceDisplayName(resource Resource) string",},}diff --git a/internal/unifiedresources/policy_metadata_test.go b/internal/unifiedresources/policy_metadata_test.goindex b0e5dd1235..4565823735 100644--- a/internal/unifiedresources/policy_metadata_test.go+++ b/internal/unifiedresources/policy_metadata_test.go@@ -210,6 +210,33 @@ func TestResourcePolicyRedactsAndUsesAISafeSummary(t *testing.T) {}}+func TestResourcePolicyRequiresGovernedSummary(t *testing.T) {+ if ResourcePolicyRequiresGovernedSummary(nil) {+ t.Fatal("expected nil policy to not require governed summary")+ }++ if ResourcePolicyRequiresGovernedSummary(&ResourcePolicy{}) {+ t.Fatal("expected empty policy to not require governed summary")+ }++ if !ResourcePolicyRequiresGovernedSummary(&ResourcePolicy{+ Routing: ResourceRoutingPolicy{+ Scope: ResourceRoutingScopeLocalOnly,+ },+ }) {+ t.Fatal("expected local-only policy to require governed summary")+ }++ if !ResourcePolicyRequiresGovernedSummary(&ResourcePolicy{+ Routing: ResourceRoutingPolicy{+ Scope: ResourceRoutingScopeLocalFirst,+ Redact: []ResourceRedactionHint{ResourceRedactionHostname},+ },+ }) {+ t.Fatal("expected redacted policy to require governed summary")+ }+}+func TestResourcePolicyLabelHelpers(t *testing.T) {policy := &ResourcePolicy{Sensitivity: ResourceSensitivityRestricted,diff --git a/internal/unifiedresources/policy_presentation.go b/internal/unifiedresources/policy_presentation.goindex 5992da9976..512262766b 100644--- a/internal/unifiedresources/policy_presentation.go+++ b/internal/unifiedresources/policy_presentation.go@@ -266,3 +266,15 @@ func ResourcePolicyUsesAISafeSummary(summary string, policy *ResourcePolicy) booResourceRedactionPlatformID,)}++// ResourcePolicyRequiresGovernedSummary reports whether the policy requires a+// governed mention or prompt summary instead of raw resource identity fields.+func ResourcePolicyRequiresGovernedSummary(policy *ResourcePolicy) bool {+ if policy == nil {+ return false+ }+ if policy.Routing.Scope == ResourceRoutingScopeLocalOnly {+ return true+ }+ return len(policy.Routing.Redact) > 0+}