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 handoff timelines through canonical resources
rcourtman0b6768feb53a
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex bddc0917e3..b4646a44db 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -195,10 +195,12 @@ runtime cost control, and shared AI transport surfaces.but those topology facts remain read-only explanation context and do notgrant action authority. Assistant runtime may also hydrate recent changes forthose 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+ model-only context on each turn; it must resolve product-originated handoff+ references through the canonical unified-resource provider before querying+ timeline changes, with raw handoff IDs used only as a compatibility fallback.+ 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 0ea57b5451..9bd9cb424e 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -765,9 +765,12 @@ the canonical monitored-system blocked payload.unified-resource relationship presentation and parent-edge synthesis, buttopology context is read-only and must not become saved user text or actionauthority. 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+ resources from the canonical unified-resource timeline, but it must resolve+ product-originated resource references through the canonical unified-resource+ provider before querying timeline changes, with raw handoff IDs used only as a+ compatibility fallback. 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 structuredpending-action and approval references from the investigation record into chatexecution, but those references must omit raw proposed-fix commands, remainmodel-only review context, and leave approval/execution authority with thediff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 88eb7b877a..8681bc7389 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -110,10 +110,12 @@ Patrol-specific presentation helpers.command payloads inside governed approval/remediation context rather thanrendering them as handoff copy. Assistant may also enrich that same handoffwith canonical resource-policy guidance, canonical resource-relationship- context, 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, topology, or- timeline summary.+ context, and recent canonical resource-timeline changes for explanation;+ Assistant resolves those timeline lookups through the current canonical+ unified-resource model before falling back to handoff IDs. Patrol must keep+ the visible finding and drawer briefing tied to the shared investigation+ payload rather than forking a Patrol-local policy, topology, or timeline+ summary.## Current Statediff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 636bd22aae..c70be60008 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -1000,6 +1000,13 @@ canonical parent edge through `ResourceRelationshipsWithCanonicalParent(...)`,and call `FormatResourceRelationshipContext(...)` rather than rebuildingrelationship markdown in chat or Patrol-local helpers. The resulting topologyblock remains model-only explanation context, not action authority.+Assistant finding handoffs are also part of the canonical resource-timeline+contract: when recent-change context is hydrated for a handoff resource, chat+execution should resolve the resource through the current unified-resource+provider before calling `GetRecentChangesFiltered(...)`, with raw handoff IDs+used only as a compatibility fallback. That keeps Patrol-originated discussion+anchored to canonical resource identity instead of lane-local IDs or display+names.The same shared relationship presenter also owns the compact change-timelinerelationship summary used by resource change records, so change `from` and`to` values stay aligned with the canonical relationship labels instead ofdiff --git a/internal/ai/chat/service.go b/internal/ai/chat/service.goindex d8a644d349..05cc66d95d 100644--- a/internal/ai/chat/service.go+++ b/internal/ai/chat/service.go@@ -529,7 +529,7 @@ func (s *Service) ExecuteStream(ctx context.Context, req ExecuteRequest, callbacs.mu.RUnlock()handoffContext = mergeHandoffResourcePolicyContext(handoffContext, handoffResources, handoffResourceProvider)handoffContext = mergeHandoffResourceRelationshipContext(handoffContext, handoffResources, handoffResourceProvider)- handoffContext = mergeHandoffResourceTimelineContext(handoffContext, handoffResources, s.actionAuditStore, time.Now())+ handoffContext = mergeHandoffResourceTimelineContext(handoffContext, handoffResources, handoffResourceProvider, s.actionAuditStore, time.Now())handoffContext = mergeHandoffActionContext(handoffContext, handoffActions)injectHandoffContextIntoLatestUserMessage(messages, handoffContext)@@ -1003,8 +1003,8 @@ func mergeHandoffActionContext(handoffContext string, handoffActions []HandoffAc}}-func mergeHandoffResourceTimelineContext(handoffContext string, handoffResources []HandoffResource, store unifiedresources.ResourceStore, now time.Time) string {- timelineContext := buildHandoffResourceTimelineContext(handoffResources, store, now)+func mergeHandoffResourceTimelineContext(handoffContext string, handoffResources []HandoffResource, provider tools.UnifiedResourceProvider, store unifiedresources.ResourceStore, now time.Time) string {+ timelineContext := buildHandoffResourceTimelineContext(handoffResources, provider, store, now)switch {case strings.TrimSpace(handoffContext) == "":return timelineContext@@ -1015,9 +1015,9 @@ func mergeHandoffResourceTimelineContext(handoffContext string, handoffResources}}-func buildHandoffResourceTimelineContext(handoffResources []HandoffResource, store unifiedresources.ResourceStore, now time.Time) string {- resources := normalizeHandoffResources(handoffResources)- if len(resources) == 0 || store == nil {+func buildHandoffResourceTimelineContext(handoffResources []HandoffResource, provider tools.UnifiedResourceProvider, store unifiedresources.ResourceStore, now time.Time) string {+ resourceIDs := canonicalHandoffTimelineResourceIDs(handoffResources, provider)+ if len(resourceIDs) == 0 || store == nil {return ""}if now.IsZero() {@@ -1029,13 +1029,9 @@ func buildHandoffResourceTimelineContext(handoffResources []HandoffResource, stototalLimit = 8)since := now.Add(-24 * time.Hour)- changes := make([]unifiedresources.ResourceChange, 0, len(resources)*perResourceLimit)+ changes := make([]unifiedresources.ResourceChange, 0, len(resourceIDs)*perResourceLimit)seen := make(map[string]struct{})- for _, resource := range resources {- resourceID := strings.TrimSpace(resource.ID)- if resourceID == "" {- continue- }+ for _, resourceID := range resourceIDs {recent, err := store.GetRecentChangesFiltered(resourceID, since, perResourceLimit, unifiedresources.ResourceChangeFilters{IncludeRelated: true})if err != nil {log.Debug().@@ -1070,6 +1066,39 @@ func buildHandoffResourceTimelineContext(handoffResources []HandoffResource, storeturn contextText + "\nTimeline Boundary: Recent changes are read-only canonical resource timeline context; they are not approval or execution authority."}+func canonicalHandoffTimelineResourceIDs(handoffResources []HandoffResource, provider tools.UnifiedResourceProvider) []string {+ resources := normalizeHandoffResources(handoffResources)+ if len(resources) == 0 {+ return nil+ }++ ids := make([]string, 0, len(resources))+ seen := make(map[string]struct{}, len(resources))+ for _, handoffResource := range resources {+ resourceID := strings.TrimSpace(handoffResource.ID)+ if provider != nil {+ if resource, ok := tools.CanonicalHandoffUnifiedResource(provider, handoffResource.ID, handoffResource.Name, handoffResource.Type, handoffResource.Node); ok {+ if canonicalID := strings.TrimSpace(resource.ID); canonicalID != "" {+ resourceID = canonicalID+ }+ }+ }+ if resourceID == "" {+ continue+ }+ key := strings.ToLower(resourceID)+ if _, ok := seen[key]; ok {+ continue+ }+ seen[key] = struct{}{}+ ids = append(ids, resourceID)+ }+ if len(ids) == 0 {+ return nil+ }+ return ids+}+func handoffResourceTimelineChangeKey(change unifiedresources.ResourceChange) string {if id := strings.TrimSpace(change.ID); id != "" {return iddiff --git a/internal/ai/chat/service_execute_additional_test.go b/internal/ai/chat/service_execute_additional_test.goindex d54d8a60f4..ac01d7dc55 100644--- a/internal/ai/chat/service_execute_additional_test.go+++ b/internal/ai/chat/service_execute_additional_test.go@@ -707,7 +707,7 @@ func TestBuildHandoffResourceTimelineContextUsesRelatedCanonicalChanges(t *testiID: "vm-100",Name: "web-server",Type: "vm",- }}, store, now)+ }}, nil, store, now)if !strings.Contains(contextText, "vm-100: **State transition** running") {t.Fatalf("timeline context missing direct change: %q", contextText)}@@ -719,6 +719,44 @@ func TestBuildHandoffResourceTimelineContextUsesRelatedCanonicalChanges(t *testi}}+func TestBuildHandoffResourceTimelineContextResolvesCanonicalResourceReferences(t *testing.T) {+ now := time.Now()+ store := unifiedresources.NewMemoryStore()+ if err := store.RecordChange(unifiedresources.ResourceChange{+ ID: "change-canonical",+ ResourceID: "vm:node1:104",+ ObservedAt: now.Add(-3 * time.Minute),+ Kind: unifiedresources.ChangeStateTransition,+ From: "running",+ To: "degraded",+ SourceType: unifiedresources.SourcePulseDiff,+ SourceAdapter: unifiedresources.AdapterProxmox,+ Confidence: unifiedresources.ConfidenceHigh,+ }); err != nil {+ t.Fatalf("RecordChange failed: %v", err)+ }++ provider := handoffUnifiedProvider{resources: map[unifiedresources.ResourceType][]unifiedresources.Resource{+ unifiedresources.ResourceTypeVM: {{+ ID: "vm:node1:104",+ Type: unifiedresources.ResourceTypeVM,+ Name: "finance-vm",+ Status: unifiedresources.StatusOnline,+ }},+ }}++ contextText := buildHandoffResourceTimelineContext([]HandoffResource{{+ Name: "finance-vm",+ Type: "vm",+ }}, provider, store, now)+ if !strings.Contains(contextText, "vm:node1:104: **State transition** running") {+ t.Fatalf("timeline context missing provider-resolved canonical change: %q", contextText)+ }+ if !strings.Contains(contextText, "Timeline Boundary: Recent changes are read-only canonical resource timeline context") {+ t.Fatalf("timeline context missing boundary: %q", contextText)+ }+}+func TestRefreshHandoffActionApprovalStatusRejectsCrossOrgApproval(t *testing.T) {installTestApprovalStore(t, &approval.ApprovalRequest{ID: "approval-cross-org",diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 082d44a144..11a66e0ef2 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -169,7 +169,7 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {"refreshHandoffActionApprovalStatus(handoffActions, s.orgID)","mergeHandoffResourcePolicyContext(handoffContext, handoffResources, handoffResourceProvider)","mergeHandoffResourceRelationshipContext(handoffContext, handoffResources, handoffResourceProvider)",- "mergeHandoffResourceTimelineContext(handoffContext, handoffResources, s.actionAuditStore, time.Now())",+ "mergeHandoffResourceTimelineContext(handoffContext, handoffResources, handoffResourceProvider, s.actionAuditStore, time.Now())","handoffContext = mergeHandoffActionContext(handoffContext, handoffActions)","s.hydrateHandoffResources(session.ID, handoffResources, sessions, unifiedResourceProvider)","injectHandoffContextIntoLatestUserMessage(messages, handoffContext)",