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
Align Assistant briefings with handoff actions
rcourtmanbf0e4e16ac54
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 8a0a337aa9..f752b864d7 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -387,6 +387,10 @@ profile and assignment columns, but embedded table framing must route throughproof, or auto-approval policy. Any approval or action-audit status snapshotrefreshed for Assistant review remains read-only AI/runtime context and mustnot become command-websocket authority or lifecycle execution state.+ Assistant operator-decision and action-posture briefing text derived from+ those same recovered handoff action references stays under that review-only+ boundary; lifecycle surfaces must not reinterpret a clearer approval posture+ as install, enrollment, or command-execution authority.The same isolation rule applies to CSRF token-store behavior in`internal/api/csrf_store.go`: lifecycle-adjacent browser flows may rely onthe shared API/security layer to keep parallel replacement-token retriesdiff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex cbfff2e7c2..6d96f8e49b 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -246,10 +246,14 @@ runtime cost control, and shared AI transport surfaces.does not yet carry the latest approval ID. Those references are reviewcontext only: they must not include raw command text, must not grantapproval or execution authority, and must route any operator decision back- through the governed approval/remediation flow. When those references include- an approval ID, Assistant runtime may refresh a current status snapshot from- the canonical approval store on each turn, but it must enforce org scoping- and still omit the approval command payload.+ through the governed approval/remediation flow. The operator briefing's+ decision and action-posture text must derive from those same structured+ action references after live-approval recovery, so Assistant does not tell+ the operator that no governed action is ready while a recovered approval is+ present. When those references include an approval ID, Assistant runtime may+ refresh a current status snapshot from the canonical approval store on each+ turn, but it must enforce org scoping and still omit the approval command+ payload.When those references resolve to a governed action plan or action audit,Assistant runtime must hydrate the canonical action ID, lifecycle state,requester, capability, approval policy, plan expiry, preflight/dry-rundiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 3993a336e2..b6dc0c9baf 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -320,7 +320,10 @@ the canonical monitored-system blocked payload.references may use the current live Patrol investigation-fix approval forthe finding when that approval is newer than the approval ID on the durablerecord, but the payload may carry only IDs, status/risk/target metadata, and- fix/action references, never the approval command payload. Related finding+ fix/action references, never the approval command payload. The operator+ decision and action-posture lines in the briefing must derive from those+ same structured action references after recovery so the briefing cannot+ contradict the handoff action payload. Related findingcontext must resolve from the current unified finding store, stay boundedand deduplicated, include current recency and latest lifecycle facts, andseed only structured handoff resources for canonical policy, state,@@ -841,8 +844,11 @@ the canonical monitored-system blocked payload.and remediation APIs. Chat execution may refresh approval status snapshots forthose references from the canonical approval store, but that snapshot isread-only, org-scoped, and must not expose or infer the raw command. When the- reference resolves to a governed action plan or action- audit, chat execution must hydrate the canonical action ID, lifecycle state,+ API handoff builder recovers a live approval, the model-only operator+ briefing must use that recovered action reference for operator-decision and+ action-posture text instead of falling back to stale investigation-record+ approval posture. When the reference resolves to a governed action plan or+ action audit, chat execution must hydrate the canonical action ID, lifecycle state,requester, capability, approval policy, plan expiry, preflight/dry-runsummary, and terminal success/failure state from the action-audit store soAPI consumers do not mistake the original approval snapshot for current@@ -2958,8 +2964,11 @@ canonical operator-facing frame for Assistant: it carries the finding summary,resource, priority, current attention reason, current recency facts, boundedevidence and verification summaries, investigation confidence, recommended nextstep, and operator-decision framing plus approval/proposed-fix posture without-raw command text. Patrol's frontend Assistant drawer briefing must use that same-operator frame for visible handoffs from findings, while the downstream chat+raw command text. That approval/proposed-fix posture must come from the same+structured action reference sent to chat execution, including any recovered live+Patrol approval, so visible and model-only handoffs stay consistent. Patrol's+frontend Assistant drawer briefing must use that same operator frame for+visible handoffs from findings, while the downstream chatservice hydrates live resource state, timeline, and action audit context aroundthat same handoff. Frontend Patrol handoff helpers may consume current pendingapproval list payloads only as safe metadata for that visible briefing: approvaldiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 3cd9ce1f23..9f8e5895a3 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -112,6 +112,9 @@ Patrol-specific presentation helpers.the durable record lacks the current approval reference, but Patrolpresentation must still keep command payloads inside governedapproval/remediation context rather than rendering them as handoff copy.+ Assistant's operator decision and approval/proposed-fix posture must derive+ from the same structured handoff action after that recovery, so the+ briefing cannot contradict the action reference passed to chat execution.Assistant may also hydrate the referenced action plan or action audit so thehandoff explains current action lifecycle state, requester, capability,approval policy, plan expiry, preflight/dry-run posture, and terminal@@ -152,7 +155,9 @@ Patrol-specific presentation helpers.for that finding, the visible Assistant briefing may include only safeapproval metadata such as approval ID, pending status, risk, requested time,expiry, and target label; it must not copy the approval command payload into- Assistant drawer prose. The assembled handoff must still pass+ Assistant drawer prose. The model-only runtime briefing must apply that same+ recovered approval reference when framing the operator decision and action+ posture. The assembled handoff must still passthrough the Assistant runtime'sresource-policy sanitizer before prompt injection, so Patrol-owned prosecannot leak governed resource names, IDs, aliases, nodes, paths, ordiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 2fd7f1b349..55e45f9163 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -1058,6 +1058,12 @@ resource or mention type that still reaches shared AI handlers must collapseto canonical `agent` before storage/recovery-adjacent links, filters, ordrill-ins consume it, so those surfaces never inherit a second live host-typecontract from chat or alert investigation ingress.+Assistant operator-decision and action-posture briefing text assembled from+recovered Patrol handoff action references is also AI/runtime review context+only. Storage and recovery may consume that explanation as incident context,+but they must not reinterpret a recovered approval or clearer proposed-fix+posture as backup freshness, restore authority, recovery proof, or+storage-local remediation execution state.That same storage ownership also includes the shared storage-source presentationcontract in `frontend-modern/src/utils/storageSources.ts`: storage pages andcross-surface storage links must reuse one canonical ordering, label, tone, anddiff --git a/internal/api/ai_handler.go b/internal/api/ai_handler.goindex c1e593f428..77a648e9cd 100644--- a/internal/api/ai_handler.go+++ b/internal/api/ai_handler.go@@ -794,13 +794,13 @@ type unifiedRelatedFindingContext struct {Finding *unified.UnifiedFinding}-func buildUnifiedFindingChatContext(f *unified.UnifiedFinding, lookup unifiedFindingLookup) string {+func buildUnifiedFindingChatContext(f *unified.UnifiedFinding, lookup unifiedFindingLookup, handoffActions []chat.HandoffAction) string {if f == nil {return ""}var b strings.Builder- appendUnifiedFindingOperatorBriefingContext(&b, f)+ appendUnifiedFindingOperatorBriefingContext(&b, f, handoffActions)appendChatContextLine(&b, "[Finding Context]", "")appendChatContextLine(&b, "ID", f.ID)appendChatContextLine(&b, "Title", f.Title)@@ -961,7 +961,7 @@ func formatUnifiedRelatedFindingSummary(f *unified.UnifiedFinding) string {return strings.Join(parts, " | ")}-func appendUnifiedFindingOperatorBriefingContext(b *strings.Builder, f *unified.UnifiedFinding) {+func appendUnifiedFindingOperatorBriefingContext(b *strings.Builder, f *unified.UnifiedFinding, handoffActions []chat.HandoffAction) {if b == nil || f == nil {return}@@ -993,10 +993,10 @@ func appendUnifiedFindingOperatorBriefingContext(b *strings.Builder, f *unified.}appendChatContextLine(b, "Current Conclusion", unifiedFindingBriefingConclusion(f))appendChatContextLine(b, "Recommended Next Step", unifiedFindingBriefingNextStep(f))- if decision := unifiedFindingBriefingOperatorDecision(f); decision != "" {+ if decision := unifiedFindingBriefingOperatorDecision(f, handoffActions); decision != "" {appendChatContextLine(b, "Operator Decision", decision)}- appendChatContextLine(b, "Action Posture", unifiedFindingBriefingActionPosture(f))+ appendChatContextLine(b, "Action Posture", unifiedFindingBriefingActionPosture(f, handoffActions))appendChatContextLine(b, "Operator Boundary", "Treat Patrol data as product context for explanation and review; do not invent commands, expose raw command text, or treat chat as approval or execution authority.")appendChatContextLine(b, "", "")}@@ -1280,7 +1280,7 @@ func unifiedFindingBriefingNextStep(f *unified.UnifiedFinding) string {return "Explain what Patrol knows and identify the next evidence to verify before remediation."}-func unifiedFindingBriefingOperatorDecision(f *unified.UnifiedFinding) string {+func unifiedFindingBriefingOperatorDecision(f *unified.UnifiedFinding, handoffActions []chat.HandoffAction) string {if f == nil {return ""}@@ -1288,6 +1288,12 @@ func unifiedFindingBriefingOperatorDecision(f *unified.UnifiedFinding) string {return "Finding is resolved; explain the resolution and monitoring follow-up without proposing execution."}+ if action, ok := unifiedFindingPrimaryHandoffAction(f, handoffActions); ok {+ if decision := unifiedFindingHandoffActionOperatorDecision(action); decision != "" {+ return decision+ }+ }+rec := f.InvestigationRecordif rec != nil {if approvalID := strings.TrimSpace(rec.ApprovalID); approvalID != "" {@@ -1410,11 +1416,21 @@ func formatBriefingStringList(values []string, limit int, itemName string) strinreturn strings.Join(parts, "; ")}-func unifiedFindingBriefingActionPosture(f *unified.UnifiedFinding) string {+func unifiedFindingBriefingActionPosture(f *unified.UnifiedFinding, handoffActions []chat.HandoffAction) string {if f == nil {return ""}+ if action, ok := unifiedFindingPrimaryHandoffAction(f, handoffActions); ok {+ if posture := unifiedFindingHandoffActionPosture(action); posture != "" {+ parts := []string{posture}+ if remediationID := strings.TrimSpace(f.RemediationID); remediationID != "" {+ parts = append(parts, "remediation "+remediationID)+ }+ return strings.Join(parts, "; ")+ }+ }+rec := f.InvestigationRecordparts := make([]string, 0, 5)if rec != nil {@@ -1444,6 +1460,102 @@ func unifiedFindingBriefingActionPosture(f *unified.UnifiedFinding) string {return strings.Join(parts, "; ")}+func unifiedFindingPrimaryHandoffAction(f *unified.UnifiedFinding, handoffActions []chat.HandoffAction) (chat.HandoffAction, bool) {+ if len(handoffActions) == 0 {+ return chat.HandoffAction{}, false+ }+ findingID := ""+ if f != nil {+ findingID = strings.TrimSpace(f.ID)+ }+ for _, action := range handoffActions {+ if !handoffActionHasBriefingValue(action) {+ continue+ }+ actionFindingID := strings.TrimSpace(action.FindingID)+ if findingID == "" || strings.EqualFold(actionFindingID, findingID) {+ return action, true+ }+ }+ return chat.HandoffAction{}, false+}++func handoffActionHasBriefingValue(action chat.HandoffAction) bool {+ for _, value := range []string{+ action.ApprovalID,+ action.ApprovalStatus,+ action.ActionID,+ action.ActionState,+ action.FixID,+ action.Description,+ } {+ if strings.TrimSpace(value) != "" {+ return true+ }+ }+ return action.Destructive || action.ApprovalConsumed || action.ActionRequiresApproval+}++func unifiedFindingHandoffActionOperatorDecision(action chat.HandoffAction) string {+ parts := make([]string, 0, 6)+ if approvalID := strings.TrimSpace(action.ApprovalID); approvalID != "" {+ parts = append(parts, "review governed approval "+approvalID+" before execution")+ } else if actionID := strings.TrimSpace(action.ActionID); actionID != "" {+ parts = append(parts, "review governed action "+actionID+" before execution")+ } else if strings.TrimSpace(action.FixID) != "" || strings.TrimSpace(action.Description) != "" {+ parts = append(parts, "review the proposed fix before execution")+ }+ if status := strings.TrimSpace(action.ApprovalStatus); status != "" {+ parts = append(parts, "approval status "+status)+ }+ if state := strings.TrimSpace(action.ActionState); state != "" {+ parts = append(parts, "action state "+state)+ }+ if fixID := strings.TrimSpace(action.FixID); fixID != "" {+ parts = append(parts, "proposed fix "+fixID)+ } else if description := strings.TrimSpace(action.Description); description != "" {+ parts = append(parts, "proposed fix recorded")+ }+ if risk := strings.TrimSpace(action.RiskLevel); risk != "" {+ parts = append(parts, "risk "+risk)+ }+ if action.Destructive {+ parts = append(parts, "destructive true")+ }+ return strings.Join(parts, "; ")+}++func unifiedFindingHandoffActionPosture(action chat.HandoffAction) string {+ parts := make([]string, 0, 8)+ if approvalID := strings.TrimSpace(action.ApprovalID); approvalID != "" {+ parts = append(parts, "approval "+approvalID)+ }+ if status := strings.TrimSpace(action.ApprovalStatus); status != "" {+ parts = append(parts, "approval status "+status)+ }+ if action.ApprovalConsumed {+ parts = append(parts, "approval consumed true")+ }+ if actionID := strings.TrimSpace(action.ActionID); actionID != "" {+ parts = append(parts, "action "+actionID)+ }+ if state := strings.TrimSpace(action.ActionState); state != "" {+ parts = append(parts, "action state "+state)+ }+ if fixID := strings.TrimSpace(action.FixID); fixID != "" {+ parts = append(parts, "proposed fix "+fixID)+ } else if description := strings.TrimSpace(action.Description); description != "" {+ parts = append(parts, "proposed fix recorded")+ }+ if risk := strings.TrimSpace(action.RiskLevel); risk != "" {+ parts = append(parts, "risk "+risk)+ }+ if action.Destructive {+ parts = append(parts, "destructive true")+ }+ return strings.Join(parts, "; ")+}+func unifiedFindingChatStatus(f *unified.UnifiedFinding, now time.Time) string {if f == nil {return ""@@ -2014,9 +2126,9 @@ func (h *AIHandler) HandleChat(w http.ResponseWriter, r *http.Request) {if store != nil {if f := store.Get(findingID); f != nil {findingResolved = true- handoffContext = buildUnifiedFindingChatContext(f, store)- handoffResources = buildUnifiedFindingHandoffResources(f, store)handoffActions = buildUnifiedFindingHandoffActions(f, orgID)+ handoffContext = buildUnifiedFindingChatContext(f, store, handoffActions)+ handoffResources = buildUnifiedFindingHandoffResources(f, store)}}if !findingResolved {diff --git a/internal/api/ai_handler_test.go b/internal/api/ai_handler_test.goindex 6694cbde6c..21af3a722c 100644--- a/internal/api/ai_handler_test.go+++ b/internal/api/ai_handler_test.go@@ -913,6 +913,9 @@ func TestHandleChat_RecoversLivePatrolApprovalForFindingHandoffAction(t *testingTargetResourceType: "vm",TargetNode: "pve-1",}}, reqArg.HandoffActions)+ assert.Contains(t, reqArg.HandoffContext, "Operator Decision: review governed approval approval-live before execution; proposed fix fix-123; risk high; destructive true")+ assert.Contains(t, reqArg.HandoffContext, "Action Posture: approval approval-live; proposed fix fix-123; risk high; destructive true")+ assert.NotContains(t, reqArg.HandoffContext, "Action Posture: proposed fix fix-123; risk medium")assert.NotContains(t, reqArg.HandoffContext, "systemctl restart workload.service")assert.NotContains(t, fmt.Sprintf("%#v", reqArg.HandoffActions), "systemctl restart workload.service")})diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 8465da8aee..c8c6d944fc 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -142,9 +142,9 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {for _, required := range []string{`svc.GetModelHandoffFindingID(ctx, req.SessionID)`,`svc.ClearModelHandoffContext(ctx, sessionID)`,- "handoffContext = buildUnifiedFindingChatContext(f, store)",- "handoffResources = buildUnifiedFindingHandoffResources(f, store)","handoffActions = buildUnifiedFindingHandoffActions(f, orgID)",+ "handoffContext = buildUnifiedFindingChatContext(f, store, handoffActions)",+ "handoffResources = buildUnifiedFindingHandoffResources(f, store)","livePatrolApprovalForFinding(f.ID, orgID)",`appendChatContextLine(&b, "Finding Status", unifiedFindingChatStatus(f, time.Now()))`,`appendChatContextLine(&b, "Finding Detected At", f.DetectedAt.Format(time.RFC3339))`,@@ -172,7 +172,7 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {"formatUnifiedFindingLatestLifecycleEvent(f.Lifecycle)","[Finding Lifecycle Context]","Lifecycle Boundary",- "appendUnifiedFindingOperatorBriefingContext(&b, f)",+ "appendUnifiedFindingOperatorBriefingContext(&b, f, handoffActions)","[Operator Briefing]",`appendChatContextLine(b, "Recency", formatUnifiedFindingBriefingRecencyFacts(f))`,"formatUnifiedFindingBriefingRecencyFacts(f)",@@ -183,7 +183,8 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {"formatInvestigationRecordEvidenceBriefing","formatBriefingStringList",`appendChatContextLine(b, "Operator Decision", decision)`,- "unifiedFindingBriefingOperatorDecision(f)",+ "unifiedFindingBriefingOperatorDecision(f, handoffActions)",+ "unifiedFindingPrimaryHandoffAction(f, handoffActions)","Latest Lifecycle Event","Operator Boundary",`return "suppressed"`,