Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Normalize Patrol runtime finding titles

rcourtman5580458e3db0
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 69328c2b22..17e2fcfed0 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -172,6 +172,11 @@ subject labels, so Patrol-owned synthetic service findings render as
`Patrol runtime` rather than leaking backend resource internals like
`Pulse Patrol Service (service)` into the primary findings row or assistant
handoff prompts.
+That same title presentation contract should normalize Patrol-owned finding
+titles too. The primary findings row, assistant handoff copy, and inline
+approval surfaces should present runtime findings as `Insufficient API credits`
+rather than repeating the product prefix as `Pulse Patrol: Insufficient API
+credits` once the surrounding UI already makes the Patrol context explicit.
That same finding presentation contract should own the primary remediation path
for Patrol-owned runtime findings as well. Expanded runtime-finding rows should
offer the same direct `Open AI Settings` action that the top assessment uses,
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index ec4d9172bb..d8b9e6e5e2 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -48,6 +48,7 @@ import {
getFindingManualControlsPresentation,
getFindingPrimaryActionPresentation,
getFindingSubjectPresentation,
+ getFindingTitlePresentation,
getFindingRecencyPresentation,
hasFindingInvestigationDetails,
getInvestigationOutcomeBadgeClasses,
@@ -371,8 +372,9 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
const handleDiscussWithAssistant = (finding: UnifiedFinding, e: Event) => {
e.stopPropagation();
const subject = getFindingSubjectPresentation(finding).label;
+ const title = getFindingTitlePresentation(finding).label;
aiChatStore.openWithPrompt(
- `I'd like to discuss this Patrol finding: "${finding.title}" on ${subject}.\n\n${finding.description}`,
+ `I'd like to discuss this Patrol finding: "${title}" on ${subject}.\n\n${finding.description}`,
{ targetType: finding.resourceType, targetId: finding.resourceId, findingId: finding.id },
);
};
@@ -380,9 +382,10 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
const handleOpenPlanInAssistant = (finding: UnifiedFinding, plan: RemediationPlan, e: Event) => {
e.stopPropagation();
const subject = getFindingSubjectPresentation(finding).label;
+ const title = getFindingTitlePresentation(finding).label;
let prompt = `Pulse Patrol generated a remediation plan for a finding. Please help me apply it safely.\n\n`;
- prompt += `**Finding:** ${finding.title} on ${subject}\n`;
+ prompt += `**Finding:** ${title} on ${subject}\n`;
if (plan.title) prompt += `**Plan:** ${plan.title}\n`;
if (plan.risk_level) prompt += `**Risk level:** ${plan.risk_level}\n`;
if (plan.description) prompt += `\n**Plan context:** ${plan.description}\n`;
@@ -413,6 +416,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
const renderFindingItem = (finding: UnifiedFinding, showSourceBadge: boolean = false) => {
const recency = getFindingRecencyPresentation(finding);
const subject = getFindingSubjectPresentation(finding);
+ const title = getFindingTitlePresentation(finding);
const manualControls = getFindingManualControlsPresentation(finding);
const severityPresentation = getFindingSeverityPresentation(finding);
@@ -551,7 +555,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
finding.status === 'active' ? 'text-base-content' : 'text-muted'
}`}
>
- {finding.title}
+ {title.label}
</span>
</div>
{/* Resource info */}
@@ -977,7 +981,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
<ApprovalSection
findingId={finding.id}
investigationOutcome={finding.investigationOutcome}
- findingTitle={finding.title}
+ findingTitle={getFindingTitlePresentation(finding).label}
resourceName={finding.resourceName}
resourceType={finding.resourceType}
resourceId={finding.resourceId}
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index 24004856fa..de18910dcb 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -10,6 +10,7 @@ import {
getFindingManualControlsPresentation,
getFindingPrimaryActionPresentation,
getFindingSubjectPresentation,
+ getFindingTitlePresentation,
getPatrolFindingClassification,
getFindingSeverityCompactLabel,
getFindingSeveritySortOrder,
@@ -331,6 +332,32 @@ describe('aiFindingPresentation', () => {
});
});
+ describe('findingTitlePresentation', () => {
+ it('strips the product prefix from Patrol runtime finding titles', () => {
+ expect(
+ getFindingTitlePresentation({
+ resourceId: 'ai-service',
+ resourceName: 'Pulse Patrol Service',
+ title: 'Pulse Patrol: Insufficient API credits',
+ }),
+ ).toEqual({
+ label: 'Insufficient API credits',
+ });
+ });
+
+ it('keeps infrastructure finding titles unchanged', () => {
+ expect(
+ getFindingTitlePresentation({
+ resourceId: 'vm-101',
+ resourceName: 'db-01',
+ title: 'Disk nearly full',
+ }),
+ ).toEqual({
+ label: 'Disk nearly full',
+ });
+ });
+ });
+
describe('findingManualControlsPresentation', () => {
it('disables generic feedback controls for patrol runtime findings', () => {
expect(
@@ -479,6 +506,14 @@ describe('aiFindingPresentation', () => {
expect(findingsPanelSource).toContain('severityPresentation.label');
});
+ it('routes visible finding titles through the shared title presentation helper', () => {
+ expect(findingsPanelSource).toContain('const title = getFindingTitlePresentation(finding);');
+ expect(findingsPanelSource).toContain('{title.label}');
+ expect(findingsPanelSource).toContain(
+ 'findingTitle={getFindingTitlePresentation(finding).label}',
+ );
+ });
+
it('uses the shared finding subject presentation instead of raw patrol service resource tokens', () => {
expect(findingsPanelSource).toContain('const subject = getFindingSubjectPresentation(finding);');
expect(findingsPanelSource).toContain('{subject.label} - {recency.label}');
diff --git a/frontend-modern/src/utils/aiFindingPresentation.ts b/frontend-modern/src/utils/aiFindingPresentation.ts
index 223963dbf7..e7fdf4ca56 100644
--- a/frontend-modern/src/utils/aiFindingPresentation.ts
+++ b/frontend-modern/src/utils/aiFindingPresentation.ts
@@ -211,6 +211,10 @@ export interface FindingSubjectPresentation {
label: string;
}
+export interface FindingTitlePresentation {
+ label: string;
+}
+
export interface FindingPrimaryActionPresentation {
label: string;
href: string;
@@ -365,6 +369,20 @@ export const getFindingSubjectPresentation = (
};
};
+export const getFindingTitlePresentation = (
+ finding: Pick<UnifiedFinding, 'resourceId' | 'resourceName' | 'title'>,
+): FindingTitlePresentation => {
+ const rawTitle = String(finding.title || '').trim();
+ if (!isPatrolRuntimeFinding(finding)) {
+ return { label: rawTitle };
+ }
+
+ const normalizedTitle = rawTitle.replace(/^Pulse Patrol:\s*/i, '').trim();
+ return {
+ label: normalizedTitle || rawTitle || 'Patrol runtime issue',
+ };
+};
+
export const getFindingPrimaryActionPresentation = (
finding: Pick<UnifiedFinding, 'resourceId' | 'resourceName' | 'title'>,
): FindingPrimaryActionPresentation | undefined => {