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.

Clarify Patrol Assistant briefing facts

rcourtman3a6b07d56ef6
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index baaec8304e..23726831fd 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -2024,7 +2024,11 @@ references used to seed canonical approval and action-audit refresh.
product handoffs, currently including Patrol run kind, run ID, safe run
type/status, a runtime-failure boolean rather than runtime failure detail, and
safe Patrol recommended next-step/action labels plus whitelisted app-route
-hrefs when the browser handoff already owns that route.
+hrefs when the browser handoff already owns that route. Frontend-visible
+Patrol assessment briefings may render those same safe recommendation fields as
+separate title, reason, and route-action facts, but they must not introduce new
+browser-owned authority beyond the structured handoff metadata and bounded
+chat context.
Frontend handoff builders may send these fields for owned alert, incident,
Patrol assessment, Patrol finding, or Patrol run-history context, but the
backend must not
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index da07a71a41..ec1c26e8c3 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -961,7 +961,11 @@ prompt explain the same operator-facing priority.
finding-level handoffs; if a source-owned Patrol recommendation action is
currently disabled, the helper must pass the bounded disabled reason in
visible briefing and model-only context instead of presenting that action as
- available. Finding-level drawer opens may also pass one bounded
+ available. Assessment recommendation briefings must keep the safe
+ recommendation title, reason, and route-owned action as separate visible
+ drawer facts so the shared Assistant shell presents operator guidance
+ without parsing a compressed context sentence. Finding-level drawer opens
+ may also pass one bounded
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
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 8adea4bc9a..8ba56b418f 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -277,7 +277,9 @@ Patrol-specific presentation helpers.
text is withheld; live handoffs must send those safe fields through
structured `handoff_metadata` where available, and the browser must use
them for restored drawer copy without receiving the private model-only
- handoff context.
+ handoff context. Assessment Assistant drawer briefings must present the safe
+ recommended step title, reason, and route-owned action as separate operator
+ facts instead of compressing them into an opaque context sentence.
When the current Patrol assessment is coverage-incomplete with no active
infrastructure finding, the same handoff model must frame the briefing as a
verification gap: the prompt leads with what scoped activity did and did not
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
index 27af4fc6ee..d5f9881ff2 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
@@ -470,6 +470,13 @@ describe('patrolInvestigationContextModel', () => {
actionLabel: 'Recommended: Open Patrol provider settings',
actionHref: '/settings/system-ai',
});
+ expect(handoff.context.briefing?.detailLines).toEqual(
+ expect.arrayContaining([
+ 'Recommended next step: Restore Patrol visibility',
+ 'Reason: Fix the Patrol runtime issue before treating the assessment as current.',
+ 'Available action: Open Patrol provider settings',
+ ]),
+ );
expect(handoff.context.handoffContext).toContain(
'Recommended Next Step Action: Open Patrol provider settings (open_provider_settings)',
);
@@ -520,8 +527,12 @@ describe('patrolInvestigationContextModel', () => {
safetyNote:
'Assistant can explain the gap; full Patrol runs, diagnostics, and remediation remain operator-controlled. Run Patrol is currently unavailable: Patrol is already running.',
});
- expect((handoff.context.briefing?.detailLines ?? []).join(' ')).toContain(
- 'action Run Patrol unavailable: Patrol is already running',
+ expect(handoff.context.briefing?.detailLines).toEqual(
+ expect.arrayContaining([
+ 'Recommended next step: Verify full coverage',
+ 'Reason: Run a full Patrol sweep before treating this assessment as an all-clear.',
+ 'Action unavailable: Run Patrol - Patrol is already running',
+ ]),
);
});
diff --git a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts
index 12cb51a405..ee3c060bda 100644
--- a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts
+++ b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts
@@ -846,8 +846,8 @@ function buildPatrolAssessmentAssistantBriefing(
const latestRun = formatAssessmentLatestRun(input);
const contextSummary = normalizeText(input.investigationContext?.summaryText);
const recommendedNextStep = normalizeAssessmentRecommendedNextStep(input.recommendedNextStep);
- const recommendedNextStepLine =
- formatAssessmentRecommendedNextStepDetailLine(recommendedNextStep);
+ const recommendedNextStepLines =
+ formatAssessmentRecommendedNextStepDetailLines(recommendedNextStep);
const findings = normalizeAssessmentFindings(input.activeFindings);
const recentChanges = normalizeAssessmentRecentChanges(input.supportingEvidence?.recentChanges);
const correlations = normalizeAssessmentCorrelations(input.supportingEvidence?.correlations);
@@ -866,9 +866,9 @@ function buildPatrolAssessmentAssistantBriefing(
title: 'Patrol assessment attached',
subject: title,
statusLabel: [health, attentionSummary].filter(isNonEmptyString).join(' · ') || undefined,
- detailLines: [description, recommendedNextStepLine, verification, latestRun, contextSummary]
+ detailLines: [description, ...recommendedNextStepLines, verification, latestRun, contextSummary]
.filter(isNonEmptyString)
- .slice(0, 5),
+ .slice(0, 7),
evidence: [...findingEvidence.slice(0, 3), ...supportingEvidence].slice(0, 5),
actionLabel: actionPosture.actionLabel,
actionHref: actionPosture.actionHref,
@@ -908,13 +908,13 @@ function formatAssessmentRecommendedNextStepActionInstruction(
return `available Patrol-owned action: ${recommendedNextStep.actionLabel}`;
}
-function formatAssessmentRecommendedNextStepActionDetail(
+function formatAssessmentRecommendedNextStepActionBriefingDetail(
recommendedNextStep: NormalizedPatrolAssessmentRecommendedNextStep,
): string | undefined {
if (!recommendedNextStep.actionLabel) return undefined;
return recommendedNextStep.actionDisabledReason
- ? `action ${recommendedNextStep.actionLabel} unavailable: ${recommendedNextStep.actionDisabledReason}`
- : `action ${recommendedNextStep.actionLabel}`;
+ ? `Action unavailable: ${recommendedNextStep.actionLabel} - ${recommendedNextStep.actionDisabledReason}`
+ : `Available action: ${recommendedNextStep.actionLabel}`;
}
function formatAssessmentRecommendedNextStepActionAvailability(
@@ -934,20 +934,16 @@ function formatAssessmentRecommendationSafetyNote(
return `${base} ${recommendedNextStep.actionLabel} is currently unavailable: ${recommendedNextStep.actionDisabledReason}.`;
}
-function formatAssessmentRecommendedNextStepDetailLine(
+function formatAssessmentRecommendedNextStepDetailLines(
recommendedNextStep?: NormalizedPatrolAssessmentRecommendedNextStep,
-): string | undefined {
- if (!recommendedNextStep) return undefined;
+): string[] {
+ if (!recommendedNextStep) return [];
- return formatBriefingStringList(
- [
- `Recommended next step: ${recommendedNextStep.title}`,
- recommendedNextStep.description,
- formatAssessmentRecommendedNextStepActionDetail(recommendedNextStep),
- ],
- 3,
- 'recommendation facts',
- );
+ return [
+ `Recommended next step: ${recommendedNextStep.title}`,
+ recommendedNextStep.description ? `Reason: ${recommendedNextStep.description}` : undefined,
+ formatAssessmentRecommendedNextStepActionBriefingDetail(recommendedNextStep),
+ ].filter(isNonEmptyString);
}
function getAssessmentRecommendedNextStepActionHref(