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 next steps into Assistant
rcourtman861e73e1288a
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 87be557e22..bf9e165fa7 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -356,10 +356,11 @@ the canonical monitored-system blocked payload.`internal/api/ai_handler.go`, `internal/api/ai_handler_test.go`, and`internal/api/contract_test.go` together. Patrol-originated handoffs mustkeep `[Operator Briefing]`, `[Finding Context]`, `[Finding Lifecycle- Context]`, structured handoff resources, related root-cause/correlation- finding context, and structured handoff actions model-only, with the- briefing summarizing operator next steps, latest lifecycle event, and- governed action posture without raw command text. Structured handoff action+ Context]`, structured handoff resources, safe route-owned next-step action+ labels, related root-cause/correlation finding context, and structured+ handoff actions model-only, with the briefing summarizing operator next+ steps, latest lifecycle event, and governed action posture without raw+ command text. Structured handoff actionreferences 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,diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 7501d31d6d..9c110a8dc7 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -951,9 +951,10 @@ prompt explain the same operator-facing priority.currently disabled, the helper must pass the bounded disabled reason invisible briefing and model-only context instead of presenting that action asavailable. Finding-level drawer opens may also pass one bounded- model-only finding context, one target resource reference, and one- `handoff_actions` reference for a live approval or proposed fix. It must not- expose raw command or execution payloads.+ model-only finding context, one target resource reference, one safe+ route-owned next-step action label/href, and one `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 1978db6aab..4fef8fd1c4 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -180,11 +180,12 @@ Patrol-specific presentation helpers.and safest-next-step review instead of generic incident discussion. Findinghandoffs must be assembled through the Patrol-owned handoff model so theprompt, visible briefing, model-only finding context, resource reference,- bounded action reference, and request-local approval-required posture stay in- sync. The model-only context may include current finding status, recurrence,- investigation record facts, evidence, verification, approval posture,- dry-run posture, proposed-fix summary, and target resource references without- raw command payloads. Inline Patrol approval actions in+ safe next-step action label, bounded action reference, and request-local+ approval-required posture stay in sync. The model-only context may include+ current finding status, recurrence, investigation record facts, evidence,+ verification, approval posture, dry-run posture, proposed-fix summary, target+ resource references, and safe route-owned next-step labels such as provider+ settings without raw command payloads. Inline Patrol approval actions in`frontend-modern/src/components/patrol/ApprovalSection.tsx` that openAssistant must follow that same Patrol-owned handoff model rather than aprompt-only local shortcut: pass approval ID/status/risk/target plus safediff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsxindex ee40c9dc5c..efe96c2f74 100644--- a/frontend-modern/src/components/AI/FindingsPanel.tsx+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx@@ -512,6 +512,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {);const proposedFix =latestInvestigationProposedFix || buildLiveApprovalProposedFixBriefing(pendingApproval);+ const nextStepAction = getFindingPrimaryActionPresentation(finding);const handoff = buildPatrolAssistantFindingHandoff({id: finding.id,title,@@ -534,6 +535,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {pendingApproval: pendingApprovalBriefing,proposedFix,investigationRecord: finding.investigationRecord,+ nextStepAction,});aiChatStore.openWithPrompt(handoff.prompt, handoff.context);};diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.tsindex 33435fc6b6..3d829b3600 100644--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts@@ -60,6 +60,10 @@ describe('FindingsPanel assistant handoff', () => {expect(findingsPanelSource).toContain('investigationRecord: finding.investigationRecord');expect(findingsPanelSource).toContain('pendingApproval: pendingApprovalBriefing');expect(findingsPanelSource).toContain('proposedFix,');+ expect(findingsPanelSource).toContain(+ 'const nextStepAction = getFindingPrimaryActionPresentation(finding);',+ );+ expect(findingsPanelSource).toContain('nextStepAction,');expect(findingsPanelSource).toContain('AIAPI.getInvestigation(finding.id)');expect(findingsPanelSource).toContain('await aiIntelligenceStore.loadPendingApprovals()');});diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.tsindex 21b6abd9f6..10bdabfbe1 100644--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts@@ -1262,6 +1262,10 @@ describe('patrolInvestigationContextModel', () => {resourceId: 'pulse-patrol-runtime',resourceName: 'Patrol runtime',resourceType: 'service',+ nextStepAction: {+ label: 'Open Patrol provider settings',+ href: '/settings/system-ai',+ },});expect(handoff.context).toMatchObject({@@ -1275,10 +1279,29 @@ describe('patrolInvestigationContextModel', () => {resourceId: 'pulse-patrol-runtime',resourceName: 'Patrol runtime',resourceType: 'service',+ nextStepActionLabel: 'Open Patrol provider settings',+ nextStepActionHref: '/settings/system-ai',actionReferenceCount: 0,},});+ expect(handoff.prompt).toContain(+ 'Patrol\'s visible next step is "Open Patrol provider settings"',+ );+ expect(handoff.context.briefing).toMatchObject({+ actionLabel: 'Open Patrol provider settings',+ suggestedPrompts: [+ 'Review Patrol next step',+ 'Explain current Patrol loop state',+ 'Check prerequisites before next step',+ ],+ });expect(handoff.context.handoffActions).toBeUndefined();+ expect(handoff.context.handoffContext).toContain(+ 'Patrol Next Step: Open Patrol provider settings',+ );+ expect(handoff.context.handoffContext).toContain(+ 'Patrol Next Step Route: /settings/system-ai',+ );expect(handoff.context.handoffContext).toContain('Operator Boundary: This Patrol finding handoff is model-only context',);diff --git a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.tsindex f6ac225fb3..e4f4d4596c 100644--- a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts+++ b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts@@ -80,6 +80,7 @@ export interface PatrolAssistantFindingPromptInput {pendingApproval?: PatrolAssistantApprovalBriefingInput | null;proposedFix?: PatrolAssistantProposedFixBriefingInput | null;investigationRecord?: InvestigationRecord | null;+ nextStepAction?: PatrolAssistantNextStepInput | null;}export interface PatrolAssistantApprovalBriefingInput {@@ -107,6 +108,11 @@ export interface PatrolAssistantProposedFixBriefingInput {destructive?: boolean | null;}+export interface PatrolAssistantNextStepInput {+ label?: string | null;+ href?: string | null;+}+export interface PatrolAssistantProposedFixBriefingSource {description?: string | null;riskLevel?: string | null;@@ -133,6 +139,7 @@ export interface PatrolAssistantFindingBriefingInput {pendingApproval?: PatrolAssistantApprovalBriefingInput | null;proposedFix?: PatrolAssistantProposedFixBriefingInput | null;investigationRecord?: InvestigationRecord | null;+ nextStepAction?: PatrolAssistantNextStepInput | null;}export interface PatrolAssistantFindingHandoffInput {@@ -157,6 +164,7 @@ export interface PatrolAssistantFindingHandoffInput {pendingApproval?: PatrolAssistantApprovalBriefingInput | null;proposedFix?: PatrolAssistantProposedFixBriefingInput | null;investigationRecord?: InvestigationRecord | null;+ nextStepAction?: PatrolAssistantNextStepInput | null;}export interface PatrolAssistantFindingModeInput {@@ -484,6 +492,7 @@ export function buildPatrolAssistantFindingPrompt(const description = normalizeText(input.description);const hasRecord = Boolean(input.investigationRecord?.id);const actionInstruction = buildPatrolAssistantFindingActionPromptInstruction(input);+ const nextStepAction = normalizePatrolAssistantNextStepAction(input.nextStepAction);let prompt = `I'd like to discuss this Patrol finding: "${title}" on ${subject}.`;if (hasRecord) {@@ -493,6 +502,9 @@ export function buildPatrolAssistantFindingPrompt(if (actionInstruction) {prompt += `\n\n${actionInstruction}`;}+ if (nextStepAction.label) {+ prompt += `\n\nPatrol's visible next step is "${nextStepAction.label}". Treat it as operator guidance for review, not an execution command.`;+ }if (description) {prompt += `\n\n${description}`;}@@ -608,6 +620,7 @@ export function buildPatrolAssistantFindingHandoff(const resource = buildPatrolFindingHandoffResource(input);const handoffResources = resource ? [resource] : [];const handoffActions = buildPatrolAssistantFindingHandoffActions(input);+ const nextStepAction = normalizePatrolAssistantNextStepAction(input.nextStepAction);return {prompt: buildPatrolAssistantFindingPrompt({@@ -619,6 +632,7 @@ export function buildPatrolAssistantFindingHandoff(pendingApproval: input.pendingApproval,proposedFix: input.proposedFix,investigationRecord: input.investigationRecord,+ nextStepAction: input.nextStepAction,}),context: {targetType: resource?.type,@@ -642,6 +656,7 @@ export function buildPatrolAssistantFindingHandoff(pendingApproval: input.pendingApproval,proposedFix: input.proposedFix,investigationRecord: input.investigationRecord,+ nextStepAction: input.nextStepAction,}),context: {source: 'pulse-patrol-finding',@@ -651,6 +666,8 @@ export function buildPatrolAssistantFindingHandoff(resourceName: resource?.name,resourceType: resource?.type,pendingApprovalId: normalizeApprovalBriefing(input.pendingApproval).id || undefined,+ nextStepActionLabel: nextStepAction.label || undefined,+ nextStepActionHref: nextStepAction.href || undefined,actionReferenceCount: handoffActions.length,},},@@ -2113,6 +2130,7 @@ function buildPatrolAssistantFindingModelContext(? `last regression ${normalizeText(input.lastRegressionAt)}`: undefined,].filter(isNonEmptyString);+ const nextStepAction = normalizePatrolAssistantNextStepAction(input.nextStepAction);const attentionReason = buildPatrolAssistantAttentionReason(input, record);const operatorDecision = buildPatrolAssistantOperatorDecision(input);const proposedFixFacts = proposedFix@@ -2169,6 +2187,8 @@ function buildPatrolAssistantFindingModelContext(formatContextLine('Action Preflight', pendingApproval.actionPreflight),formatContextLine('Dry-Run Posture', pendingApproval.actionDryRunSummary),formatContextLine('Proposed Fix', proposedFixFacts),+ formatContextLine('Patrol Next Step', nextStepAction.label),+ formatContextLine('Patrol Next Step Route', nextStepAction.href),formatContextLine('Operator Decision', operatorDecision),'Command Boundary: Command details stay in governed approval or remediation context; this model-only handoff may include command counts but not raw command text.','Operator Boundary: This Patrol finding handoff is model-only context for explanation and review. Diagnostics, remediation, and command execution require explicit governed approval.',@@ -2355,6 +2375,7 @@ export function buildPatrolAssistantFindingBriefing(const subject = normalizeText(input.subject) || 'affected resource';const pendingApproval = normalizeApprovalBriefing(input.pendingApproval);const proposedFix = record.proposedFix || normalizeProposedFixBriefing(input.proposedFix);+ const nextStepAction = normalizePatrolAssistantNextStepAction(input.nextStepAction);const approvalStatusParts = !record.hasRecord? [pendingApproval.status ? `${formatIdentifierLabel(pendingApproval.status)} approval` : '',@@ -2397,7 +2418,9 @@ export function buildPatrolAssistantFindingBriefing(evidence: [...record.evidenceSummaries, ...verificationLines].slice(0, 4),actionLabel:proposedFix?.description ||- (pendingApproval.id ? `Approval ${pendingApproval.id}` : undefined),+ (pendingApproval.id ? `Approval ${pendingApproval.id}` : undefined) ||+ nextStepAction.label ||+ undefined,commandSummary: proposedFix?.commandSummary,safetyNote: buildPatrolAssistantSafetyNote(proposedFix, pendingApproval),suggestedPrompts: buildPatrolFindingSuggestedPrompts(@@ -2452,11 +2475,14 @@ function buildPatrolFindingSuggestedPrompts(const hasRecurrence =normalizeNonNegativeCount(input.regressionCount) > 0 ||normalizeNonNegativeCount(input.timesRaised) > 1;+ const nextStepAction = normalizePatrolAssistantNextStepAction(input.nextStepAction);if (requiresApproval) {prompts.push('Review approval risk and next step');} else if (record.hasRecord) {prompts.push('Prioritize finding and safest next step');+ } else if (nextStepAction.label) {+ prompts.push('Review Patrol next step');} else {prompts.push('Explain current finding status');}@@ -2475,6 +2501,8 @@ function buildPatrolFindingSuggestedPrompts(prompts.push('Summarize remediation without command text');} else if (requiresApproval) {prompts.push('List approval prerequisites before action');+ } else if (nextStepAction.label) {+ prompts.push('Check prerequisites before next step');} else if (hasRecurrence) {prompts.push('Explain recurrence and what changed');} else if (hasLoopState) {@@ -2703,6 +2731,10 @@ function buildPatrolAssistantOperatorDecision(if (loopState.includes('investigat')) {return 'Wait for Patrol to finish the investigation before approving remediation.';}+ const nextStepAction = normalizePatrolAssistantNextStepAction(input.nextStepAction);+ if (nextStepAction.label) {+ return `Use Patrol's next step: ${nextStepAction.label}; review the finding context before changing settings or rerunning Patrol.`;+ }if (normalizeText(input.findingStatus).toLowerCase() === 'active') {return 'Continue investigation or monitoring; no governed action reference is ready.';}@@ -2760,6 +2792,15 @@ function normalizeProposedFixBriefing(return normalized;}+function normalizePatrolAssistantNextStepAction(+ action?: PatrolAssistantNextStepInput | null,+): Required<PatrolAssistantNextStepInput> {+ return {+ label: normalizeText(action?.label),+ href: normalizeText(action?.href),+ };+}+function formatPatrolAssistantProposedFixDetail(proposedFix?: PatrolInvestigationRecordPresentation['proposedFix'],): string | undefined {