diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx index d906eca98..d84c8a388 100644 --- a/frontend-modern/src/components/AI/FindingsPanel.tsx +++ b/frontend-modern/src/components/AI/FindingsPanel.tsx @@ -518,7 +518,7 @@ export const FindingsPanel: Component = (props) => { const openFindingInAssistant = async ( finding: UnifiedFinding, - intent: 'discuss' | 'explain' | 'investigate' | 'why', + intent: 'discuss' | 'explain' | 'investigate' | 'why' | 'verify_fix', ) => { await aiIntelligenceStore.loadPendingApprovals(); const subject = getFindingSubjectPresentation(finding).label; @@ -569,7 +569,10 @@ export const FindingsPanel: Component = (props) => { aiChatStore.openWithPrompt(handoff.prompt, { ...handoff.context, autoSendInitialPrompt: - intent === 'explain' || intent === 'investigate' || intent === 'why', + intent === 'explain' || + intent === 'investigate' || + intent === 'why' || + intent === 'verify_fix', }); }; @@ -604,6 +607,34 @@ export const FindingsPanel: Component = (props) => { await openFindingInAssistant(finding, 'why'); }; + // Verify fix is the post-remediation check. After a fix has been + // executed against this finding, the operator asks the Assistant + // whether it actually worked — confirming the underlying condition + // cleared rather than trusting the fix command's exit code. Only + // meaningful when a fix has been applied (see hasAppliedFix). + const handleVerifyFixFinding = async (finding: UnifiedFinding, e: Event) => { + e.stopPropagation(); + await openFindingInAssistant(finding, 'verify_fix'); + }; + + // True when the finding has an investigation outcome indicating that + // some remediation step has run against it — anything past "fix + // queued." For these states, Verify fix is a meaningful action; for + // fix_queued (still awaiting approval) and earlier states there is + // nothing applied yet to verify, and for fix_failed the fix didn't + // complete so verification doesn't apply. + const hasAppliedFix = (finding: UnifiedFinding): boolean => { + switch (finding.investigationOutcome) { + case 'fix_executed': + case 'fix_verified': + case 'fix_verification_failed': + case 'fix_verification_unknown': + return true; + default: + return false; + } + }; + // Copy a Markdown summary of the finding to the clipboard so the operator // can paste it into a chat, ticket, or incident channel. The shape mirrors // the seven-question schema (title + impact + recommendation + trust @@ -1240,6 +1271,24 @@ export const FindingsPanel: Component = (props) => { Why + + +