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
Carry Patrol finding actions into Assistant handoffs
rcourtmanc5362438c1b5
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 91a851d528..7262f8cd4b 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -471,7 +471,10 @@ the canonical monitored-system blocked payload.and finding-level first-turn prompt emphasis may be derived from the samebounded metadata only so Assistant starts by reviewing approval status, risk,dry-run posture, proposed-fix posture, and safest next step without receiving- raw command or execution payloads+ raw command or execution payloads; finding-level handoffs may also send one+ bounded `handoff_actions` entry for that governed approval or proposed fix so+ the Assistant runtime can refresh action posture from IDs and safe summaries+ instead of relying on pasted chat textand the dedicated `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` owner, so recent-change counts and governed policy-posture fallbacks normalize once at the shared store boundary instead of as Patrol-hook-local payload repairand the shared `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` card, so learned correlations and correlation context stay rendered through one governed frontend card instead of separate page-local list loopsand the same shared correlation card's ordering and truncation rule, so callers pass raw correlations instead of encoding their own top-N sort behaviordiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex d7490f7735..f815e20262 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -822,8 +822,9 @@ frontend primitive boundary.a Patrol summary prompt builder. The Patrol helper may turn those same safereferences into visible action labels, safety notes, and approval-awaresuggested prompts or first-turn prompt emphasis for assessment and- finding-level handoffs, but it must not expose raw command or execution- payloads.+ finding-level handoffs; finding-level drawer opens may also pass one bounded+ `handoff_actions` reference for a live approval or proposed fix. It must not+ expose raw command or execution payloads.Thedrawer may render a genericcontext-briefing band from `frontend-modern/src/stores/aiChat.ts`, butdiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 066385e0b9..26ce1dc022 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -164,7 +164,11 @@ Patrol-specific presentation helpers.posture. The initial visible prompt for a Patrol finding must lead with thatgoverned approval or proposed-fix review instruction when safe metadata isattached, so the operator starts from approval status, risk, dry-run posture,- and safest-next-step review instead of generic incident discussion. Inline+ and safest-next-step review instead of generic incident discussion. Finding+ handoffs may also attach a bounded model-only action reference for that same+ live approval or proposed fix, carrying approval ID/status/risk, action plan+ identity/policy/expiry, dry-run posture, proposed-fix summary, and target+ resource references without raw command payloads. InlinePatrol approval actions that open Assistant must follow thesame rule: pass approval ID/status/risk/target plus safe summary/countmetadata as review context, force the request-local approval-required mode,diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsxindex 112240714c..cf789d54b0 100644--- a/frontend-modern/src/components/AI/FindingsPanel.tsx+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx@@ -19,6 +19,7 @@ import { notificationStore } from '@/stores/notifications';import { aiChatStore } from '@/stores/aiChat';import {buildPatrolAssistantFindingBriefing,+ buildPatrolAssistantFindingHandoffActions,buildPatrolAssistantFindingPrompt,buildPatrolAssistantApprovalBriefingInput,buildPatrolAssistantProposedFixBriefingInput,@@ -513,6 +514,22 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {proposedFix,investigationRecord: finding.investigationRecord,});+ const handoffActions = buildPatrolAssistantFindingHandoffActions({+ id: finding.id,+ title,+ description: finding.description,+ severity: finding.severity,+ status: finding.status,+ resourceId: finding.resourceId,+ resourceName: finding.resourceName,+ resourceType: finding.resourceType,+ investigationStatus: finding.investigationStatus,+ investigationOutcome: finding.investigationOutcome,+ loopState: finding.loopState,+ pendingApproval: pendingApprovalBriefing,+ proposedFix,+ investigationRecord: finding.investigationRecord,+ });const requiresApprovalMode = patrolAssistantFindingHandoffRequiresApprovalMode({investigationOutcome: finding.investigationOutcome,remediationId: finding.remediationPlanId,@@ -524,6 +541,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {targetId: finding.resourceId,findingId: finding.id,briefing,+ handoffActions: handoffActions.length > 0 ? handoffActions : undefined,autonomousMode: requiresApprovalMode ? false : undefined,});};diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.tsindex c65dbcf6f8..a09dd6e3a0 100644--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts@@ -45,6 +45,7 @@ const patrolWorkspaceSource = readFileSync(describe('FindingsPanel assistant handoff', () => {it('routes Patrol investigation records into the Assistant briefing context', () => {expect(findingsPanelSource).toContain('buildPatrolAssistantFindingBriefing');+ expect(findingsPanelSource).toContain('buildPatrolAssistantFindingHandoffActions');expect(findingsPanelSource).toContain('buildPatrolAssistantApprovalBriefingInput');expect(findingsPanelSource).toContain('buildPatrolAssistantProposedFixBriefingInput');expect(findingsPanelSource).toContain('briefing,');@@ -53,6 +54,9 @@ describe('FindingsPanel assistant handoff', () => {expect(findingsPanelSource).toContain('investigationRecord: finding.investigationRecord');expect(findingsPanelSource).toContain('pendingApproval: pendingApprovalBriefing');expect(findingsPanelSource).toContain('proposedFix,');+ expect(findingsPanelSource).toContain(+ 'handoffActions: handoffActions.length > 0 ? handoffActions : undefined',+ );expect(findingsPanelSource).toContain('AIAPI.getInvestigation(finding.id)');expect(findingsPanelSource).toContain('await aiIntelligenceStore.loadPendingApprovals()');expect(findingsPanelSource).toContain('patrolAssistantFindingHandoffRequiresApprovalMode');diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.tsindex 206545da56..eb66ec541a 100644--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts@@ -4,6 +4,7 @@ import type { RemediationPlan } from '@/api/ai';import {buildPatrolAssessmentAssistantHandoff,buildPatrolAssistantFindingBriefing,+ buildPatrolAssistantFindingHandoffActions,buildPatrolAssistantFindingPrompt,buildPatrolAssistantProposedFixBriefingInput,buildPatrolInvestigationContextSummary,@@ -510,6 +511,75 @@ describe('patrolInvestigationContextModel', () => {expect(prompt).not.toContain('systemctl restart nginx');});+ it('builds finding-level Assistant handoff actions without raw command text', () => {+ const actions = buildPatrolAssistantFindingHandoffActions({+ id: 'finding-1',+ title: 'Nginx down',+ resourceId: 'agent-1',+ resourceName: 'node-1',+ resourceType: 'agent',+ pendingApproval: {+ id: 'approval-1',+ status: 'pending',+ riskLevel: 'high',+ requestedAt: '2026-05-06T12:00:00Z',+ expiresAt: '2026-05-06T12:10:00Z',+ targetName: 'node-1',+ actionId: 'restart-nginx',+ actionApprovalPolicy: 'operator',+ actionPlanExpiresAt: '2026-05-06T12:10:00Z',+ actionPlanMessage: 'Restart nginx after validating load balancer drain.',+ actionPreflight: 'Would restart nginx on node-1.',+ actionDryRunSummary: 'One service restart would be attempted.',+ },+ proposedFix: buildPatrolAssistantProposedFixBriefingInput({+ description: 'Restart nginx',+ commands: ['systemctl restart nginx'],+ riskLevel: 'high',+ targetHost: 'node-1',+ destructive: false,+ }),+ });++ expect(actions).toEqual([+ {+ findingId: 'finding-1',+ recordId: undefined,+ approvalId: 'approval-1',+ approvalStatus: 'pending',+ approvalRequestedAt: '2026-05-06T12:00:00Z',+ approvalExpiresAt: '2026-05-06T12:10:00Z',+ actionId: 'restart-nginx',+ actionApprovalPolicy: 'operator',+ actionRequiresApproval: true,+ actionPlanExpiresAt: '2026-05-06T12:10:00Z',+ actionPlanMessage: 'Restart nginx after validating load balancer drain.',+ actionPreflight: 'Would restart nginx on node-1.',+ actionDryRunSummary: 'One service restart would be attempted.',+ fixId: undefined,+ description: 'Restart nginx',+ riskLevel: 'high',+ destructive: false,+ targetHost: 'node-1',+ targetResourceId: 'agent-1',+ targetResourceName: 'node-1',+ targetResourceType: 'agent',+ targetNode: undefined,+ },+ ]);+ expect(JSON.stringify(actions)).not.toContain('systemctl restart nginx');+ });++ it('skips finding-level Assistant handoff actions when no governed action exists', () => {+ expect(+ buildPatrolAssistantFindingHandoffActions({+ id: 'finding-1',+ title: 'High CPU usage',+ resourceId: 'agent-1',+ }),+ ).toEqual([]);+ });+it('builds a drawer briefing for Assistant handoff without exposing raw commands', () => {const approvalRequestedAt = new Date(Date.now() - 60_000).toISOString();const approvalExpiresAt = new Date(Date.now() + 10 * 60_000).toISOString();diff --git a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.tsindex d4db5a1cec..1e618aa810 100644--- a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts+++ b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts@@ -454,6 +454,13 @@ export function buildPatrolAssessmentAssistantHandoff(};}+export function buildPatrolAssistantFindingHandoffActions(+ finding: PatrolAssessmentAssistantFindingInput,+): AIChatHandoffAction[] {+ const action = buildPatrolFindingHandoffAction(finding);+ return action ? [action] : [];+}+function buildPatrolAssessmentAssistantPrompt(input: PatrolAssessmentAssistantHandoffInput,title: string,@@ -796,60 +803,66 @@ function buildPatrolAssessmentHandoffActions(for (const finding of normalizeAssessmentFindings(input.activeFindings)) {if (actions.length >= MAX_ASSESSMENT_HANDOFF_ACTIONS) break;+ const action = buildPatrolFindingHandoffAction(finding);+ if (action) actions.push(action);+ }- const pendingApproval = normalizeApprovalBriefing(finding.pendingApproval);- const proposedFix = normalizeProposedFixBriefing(finding.proposedFix);- const record = finding.investigationRecord;- const recordFix = record?.proposed_fix;- const approvalId = pendingApproval.id || normalizeText(record?.approval_id);- const fixId = normalizeText(recordFix?.id);- const description =- normalizeText(proposedFix?.description) || normalizeText(recordFix?.description);-- if (!approvalId && !fixId && !description && !pendingApproval.actionId) {- continue;- }+ return actions;+}- actions.push({- findingId: normalizeText(finding.id) || normalizeText(record?.finding_id) || undefined,- recordId: normalizeText(record?.id) || undefined,- approvalId: approvalId || undefined,- approvalStatus: pendingApproval.status || undefined,- approvalRequestedAt: pendingApproval.requestedAt || undefined,- approvalExpiresAt: pendingApproval.expiresAt || undefined,- actionId: pendingApproval.actionId || undefined,- actionApprovalPolicy: pendingApproval.actionApprovalPolicy || undefined,- actionRequiresApproval: Boolean(approvalId),- actionPlanExpiresAt: pendingApproval.actionPlanExpiresAt || undefined,- actionPlanMessage: pendingApproval.actionPlanMessage || undefined,- actionPreflight: pendingApproval.actionPreflight || undefined,- actionDryRunSummary: pendingApproval.actionDryRunSummary || undefined,- fixId: fixId || undefined,- description: description || undefined,- riskLevel:- pendingApproval.riskLevel ||- normalizeText(finding.proposedFix?.riskLevel) ||- normalizeText(recordFix?.risk_level) ||- undefined,- destructive: Boolean(proposedFix?.destructive || recordFix?.destructive),- targetHost:- normalizeText(proposedFix?.targetHost) ||- normalizeText(recordFix?.target_host) ||- pendingApproval.targetName ||- undefined,- targetResourceId:- normalizeText(finding.resourceId || record?.subject?.resource_id) || undefined,- targetResourceName:- normalizeText(finding.resourceName || record?.subject?.resource_name) ||- pendingApproval.targetName ||- undefined,- targetResourceType:- normalizeText(finding.resourceType || record?.subject?.resource_type) || undefined,- targetNode: normalizeText(record?.subject?.node) || undefined,- });+function buildPatrolFindingHandoffAction(+ finding: PatrolAssessmentAssistantFindingInput,+): AIChatHandoffAction | undefined {+ const pendingApproval = normalizeApprovalBriefing(finding.pendingApproval);+ const proposedFix = normalizeProposedFixBriefing(finding.proposedFix);+ const record = finding.investigationRecord;+ const recordFix = record?.proposed_fix;+ const approvalId = pendingApproval.id || normalizeText(record?.approval_id);+ const fixId = normalizeText(recordFix?.id);+ const description =+ normalizeText(proposedFix?.description) || normalizeText(recordFix?.description);++ if (!approvalId && !fixId && !description && !pendingApproval.actionId) {+ return undefined;}- return actions;+ return {+ findingId: normalizeText(finding.id) || normalizeText(record?.finding_id) || undefined,+ recordId: normalizeText(record?.id) || undefined,+ approvalId: approvalId || undefined,+ approvalStatus: pendingApproval.status || undefined,+ approvalRequestedAt: pendingApproval.requestedAt || undefined,+ approvalExpiresAt: pendingApproval.expiresAt || undefined,+ actionId: pendingApproval.actionId || undefined,+ actionApprovalPolicy: pendingApproval.actionApprovalPolicy || undefined,+ actionRequiresApproval: Boolean(approvalId),+ actionPlanExpiresAt: pendingApproval.actionPlanExpiresAt || undefined,+ actionPlanMessage: pendingApproval.actionPlanMessage || undefined,+ actionPreflight: pendingApproval.actionPreflight || undefined,+ actionDryRunSummary: pendingApproval.actionDryRunSummary || undefined,+ fixId: fixId || undefined,+ description: description || undefined,+ riskLevel:+ pendingApproval.riskLevel ||+ normalizeText(finding.proposedFix?.riskLevel) ||+ normalizeText(recordFix?.risk_level) ||+ undefined,+ destructive: Boolean(proposedFix?.destructive || recordFix?.destructive),+ targetHost:+ normalizeText(proposedFix?.targetHost) ||+ normalizeText(recordFix?.target_host) ||+ pendingApproval.targetName ||+ undefined,+ targetResourceId:+ normalizeText(finding.resourceId || record?.subject?.resource_id) || undefined,+ targetResourceName:+ normalizeText(finding.resourceName || record?.subject?.resource_name) ||+ pendingApproval.targetName ||+ undefined,+ targetResourceType:+ normalizeText(finding.resourceType || record?.subject?.resource_type) || undefined,+ targetNode: normalizeText(record?.subject?.node) || undefined,+ };}function normalizeAssessmentFindings(