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.

Surface previous resolved fix on the finding card

rcourtman7a92602bcc80
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index bd8ac40c9a..28f029fa80 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -315,7 +315,12 @@ runtime cost control, and shared AI transport surfaces.
blank-slate diagnosis. The summary mirrors onto
`unified.UnifiedFinding` and propagates through the Finding to
UnifiedFinding conversion in `internal/api/router.go` and through
- `UnifiedStore.AddFromAI`'s update branch (non-empty overwrite). When `/api/ai/chat` receives `finding_id`, the
+ `UnifiedStore.AddFromAI`'s update branch (non-empty overwrite). The
+ TS API client mirrors the field on `UnifiedFindingRecord` and
+ `Finding`, the aiIntelligence store normalizer copies it through as
+ `previousResolvedFixSummary`, and `FindingsPanel.tsx` renders it on
+ the expanded finding card so the operator sees the memory cue
+ inline rather than only inside Assistant chat context. When `/api/ai/chat` receives `finding_id`, the
runtime must enrich the provider turn from that durable record while
preserving the user's authored prompt as the persisted conversation
message; the model-only handoff may persist as session metadata so
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index c35836db2b..4170c2d5bd 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -985,6 +985,14 @@ the canonical monitored-system blocked payload.
(investigation record, operational memory, pending approval,
proposed fix, next-step action) must be attached identically across
intents; only the seed prompt's framing varies.
+ The TS API client mirrors the
+ `previous_resolved_fix_summary` field on both `UnifiedFindingRecord`
+ (in `frontend-modern/src/api/ai.ts`) and `Finding`
+ (in `frontend-modern/src/api/patrol.ts`), and the store normalizer
+ promotes it to the camelCase `previousResolvedFixSummary` on the
+ store-level `UnifiedFinding` so finding-card render code can read
+ it. Without this mirror, the field stays backend-only and operators
+ cannot see "what worked last time" without opening Assistant.
`unified.UnifiedFinding` also carries a
`previous_resolved_fix_summary` operational-memory field captured at
regression time from
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index ce0a7b32d0..4633ec0e26 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -259,6 +259,15 @@ Patrol-specific presentation helpers.
The same panel also surfaces `investigation_record.confidence` as a
badge in the collapsed finding row (next to the investigation outcome
badge) so operators can scan trust without expanding every card.
+ `FindingsPanel.tsx` also renders the
+ `previousResolvedFixSummary` operational-memory field directly on
+ the expanded finding card with emerald-accented styling, so
+ operators see "what worked last time" inline without having to
+ open Assistant. The summary lives on the finding shell
+ (`UnifiedFinding`/`Finding`), not on the per-record investigation
+ presentation; the Patrol-owned investigation-context model must not
+ absorb it into impact, verification, or rollback (those represent
+ the current investigation, not history).
The Patrol page renders a small Trust strip above the Findings/Runs
tab bar that surfaces `state.patrolStatus()?.trust` (the
FindingsTrustSummary block on the patrol-status response) as compact
diff --git a/frontend-modern/src/api/__tests__/ai.test.ts b/frontend-modern/src/api/__tests__/ai.test.ts
index 9a60f77f95..7b536cef0f 100644
--- a/frontend-modern/src/api/__tests__/ai.test.ts
+++ b/frontend-modern/src/api/__tests__/ai.test.ts
@@ -146,6 +146,35 @@ describe('AIAPI', () => {
expect(record!.trigger.cause).toBe('storage_quota_exceeded');
});
+ it('preserves previous_resolved_fix_summary on UnifiedFinding payloads for operational memory', async () => {
+ // The previous-fix summary is captured at regression time and surfaced
+ // both in chat context and on the finding card. The TS API client must
+ // round-trip the snake_case field so the store normalizer can promote
+ // it to the camelCase previousResolvedFixSummary on UnifiedFinding.
+ apiFetchJSONMock.mockResolvedValue({
+ findings: [
+ {
+ id: 'f-regress',
+ resource_id: 'vm-100',
+ source: 'ai-patrol',
+ severity: 'warning',
+ category: 'reliability',
+ title: 'Service stalled',
+ description: 'Service stopped responding again',
+ previous_resolved_fix_summary:
+ 'Restart the workload service after backup window clears',
+ detected_at: '2026-05-08T12:00:00Z',
+ },
+ ],
+ count: 1,
+ } as any);
+
+ const result = await AIAPI.getUnifiedFindings();
+ expect(result.findings[0].previous_resolved_fix_summary).toBe(
+ 'Restart the workload service after backup window clears',
+ );
+ });
+
it('preserves UnifiedFinding-level impact text alongside description and recommendation', async () => {
apiFetchJSONMock.mockResolvedValue({
findings: [
diff --git a/frontend-modern/src/api/ai.ts b/frontend-modern/src/api/ai.ts
index 353a9810f0..bc0708bffb 100644
--- a/frontend-modern/src/api/ai.ts
+++ b/frontend-modern/src/api/ai.ts
@@ -421,6 +421,7 @@ export interface UnifiedFindingRecord {
title: string;
description: string;
impact?: string;
+ previous_resolved_fix_summary?: string;
recommendation?: string;
evidence?: string;
alertIdentifier?: string;
diff --git a/frontend-modern/src/api/patrol.ts b/frontend-modern/src/api/patrol.ts
index 9a7bc2c714..b62eecf271 100644
--- a/frontend-modern/src/api/patrol.ts
+++ b/frontend-modern/src/api/patrol.ts
@@ -28,6 +28,7 @@ export interface Finding {
title: string;
description: string;
impact?: string;
+ previous_resolved_fix_summary?: string;
recommendation?: string;
evidence?: string;
detected_at: string;
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index 89ca307f5b..c1d67103fb 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -910,6 +910,14 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
<span class="font-medium">Recommendation:</span> {finding.recommendation}
</p>
</Show>
+ <Show when={finding.previousResolvedFixSummary}>
+ <p class="text-sm text-base-content mt-2 px-2 py-1 rounded border border-emerald-200 bg-emerald-50/40 dark:border-emerald-800 dark:bg-emerald-950/30">
+ <span class="font-medium text-emerald-800 dark:text-emerald-300">
+ Last time this resolved:
+ </span>{' '}
+ {finding.previousResolvedFixSummary}
+ </p>
+ </Show>
<Show when={(finding.regressionCount || 0) > 0}>
<p class="text-xs text-amber-700 dark:text-amber-300 mt-2">
Regressions: {finding.regressionCount}
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index 0a2ea9db31..e1c897a451 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -76,6 +76,16 @@ describe('FindingsPanel assistant handoff', () => {
expect(findingsPanelSource).not.toContain('Rollback: `');
});
+ it('renders previousResolvedFixSummary as operational memory in the expanded card', () => {
+ // The previous-fix summary is captured at regression time and surfaced
+ // in chat context for Assistant. The expanded card must also show it
+ // directly so operators see "what worked last time" without opening
+ // Assistant. The styling is intentionally distinct (emerald accent) so
+ // it reads as a positive memory cue rather than another alert.
+ expect(findingsPanelSource).toContain('finding.previousResolvedFixSummary');
+ expect(findingsPanelSource).toContain('Last time this resolved');
+ });
+
it('exposes an Explain entry point that seeds Assistant with an explanation prompt', () => {
// The Explain button is a contextual entry point parallel to "Discuss with
// Assistant" but with an intent that produces explanation framing rather
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
index c05d16afcf..03d01ccecb 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
@@ -876,6 +876,33 @@ describe('patrolInvestigationContextModel', () => {
expect(presentation.impact).toBe('');
});
+ it('keeps previous-fix operational memory at the finding shell, not in record presentation', () => {
+ // Operational memory (previousResolvedFixSummary) lives on the finding
+ // shell and is rendered by FindingsPanel as a distinct row. The
+ // investigation-record presentation must not absorb it into impact,
+ // verification, or rollback — those represent the CURRENT investigation,
+ // not history. This test pins the boundary so future refactors do not
+ // collapse the per-record schema with the per-finding memory shell.
+ const presentation = buildPatrolInvestigationRecordPresentation({
+ id: 'rec-prev-fix-isolation',
+ finding_id: 'f-prev-fix-isolation',
+ subject: { resource_id: 'vm-9' },
+ trigger: { detected_at: '2026-05-08T12:00:00Z' },
+ status: 'completed',
+ evidence: [],
+ verification: [],
+ rollback: [],
+ tools_used: [],
+ started_at: '2026-05-08T12:00:00Z',
+ });
+ // The presentation shape exposes confidence, conclusion, impact,
+ // recommendedAction, etc., but no previousResolvedFixSummary field —
+ // that lives on UnifiedFinding/Finding shells, not InvestigationRecord.
+ const opaque = presentation as unknown as Record<string, unknown>;
+ expect(opaque.previousResolvedFixSummary).toBeUndefined();
+ expect(opaque.previous_resolved_fix_summary).toBeUndefined();
+ });
+
it('does not let the patrol context model synthesize impact from trust counters', () => {
// Trust counters (FindingsTrustSummary on the patrol-status response) are
// an operator-page concern, not a per-finding context concern. The
diff --git a/frontend-modern/src/stores/aiIntelligence.ts b/frontend-modern/src/stores/aiIntelligence.ts
index ba63bdb7ce..56bcfb2742 100644
--- a/frontend-modern/src/stores/aiIntelligence.ts
+++ b/frontend-modern/src/stores/aiIntelligence.ts
@@ -142,6 +142,7 @@ export interface UnifiedFinding {
title: string;
description: string;
impact?: string;
+ previousResolvedFixSummary?: string;
recommendation?: string;
detectedAt: string;
lastSeenAt?: string;
@@ -206,6 +207,7 @@ function normalizeUnifiedFindingRecord(item: UnifiedFindingRecord, now: number):
title: item.title,
description: item.description,
impact: item.impact,
+ previousResolvedFixSummary: item.previous_resolved_fix_summary,
recommendation: item.recommendation,
detectedAt: item.detected_at,
lastSeenAt: item.last_seen_at || item.detected_at,
@@ -245,6 +247,7 @@ function normalizePatrolFindingRecord(item: PatrolFinding, now: number): Unified
title: item.title,
description: item.description,
impact: item.impact,
+ previousResolvedFixSummary: item.previous_resolved_fix_summary,
recommendation: item.recommendation,
detectedAt: item.detected_at,
lastSeenAt: item.last_seen_at || item.detected_at,