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.

Add related finding recency to Assistant handoffs

rcourtman2fd85f62d340
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index b3284c3728..fec0b3b9e6 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -371,8 +371,9 @@ profile and assignment columns, but embedded table framing must route through
handoff context remain Patrol/AI review metadata and must not become agent
lifecycle state or fleet-control authority. Related root-cause or correlated
finding summaries resolved for the same Assistant handoff follow that same
- isolation rule: they may explain Patrol context to the model and seed
- model-only handoff resources, but they are not enrollment evidence,
+ isolation rule, including any recency or latest lifecycle facts attached to
+ those related summaries: they may explain Patrol context to the model and
+ seed model-only handoff resources, but they are not enrollment evidence,
command-websocket identity, agent command grants, or auto-approval policy.
Structured Assistant handoff action references from the same Patrol finding
remain AI/runtime review metadata only; lifecycle code must not treat
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index e2dceb2c83..f467fadbda 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -193,8 +193,10 @@ runtime cost control, and shared AI transport surfaces.
correlated finding IDs, Assistant may resolve those related findings through
the current unified finding store and include compact related-finding
summaries plus their structured handoff resources as model-only explanation
- context. Those related findings must be deduplicated, bounded, refreshed
- from current store state, and treated only as context for the same operator
+ context. Those summaries must carry current recency facts and latest
+ lifecycle state from the related record rather than only title/resource
+ prose. Those related findings must be deduplicated, bounded, refreshed from
+ current store state, and treated only as context for the same operator
conversation; they do not grant approval, lifecycle, disclosure, or
execution authority. If the referenced finding no longer resolves through
the current unified finding store, Assistant must invalidate the stored
@@ -963,10 +965,11 @@ latest lifecycle event, and governed action posture as operator guidance, while
leaving detailed lifecycle history, current resource-state, timeline,
related-finding, and action-audit hydration in the existing canonical AI
runtime handoff builders. Related root-cause and
-correlated finding records may be summarized from current unified finding state
-and may seed their own handoff resources for canonical policy, state, topology,
-and timeline hydration. That related context is explanation and review context
-only, not approval or execution authority. Detailed lifecycle events are
+correlated finding records may be summarized from current unified finding state,
+including their recency and latest lifecycle facts, and may seed their own
+handoff resources for canonical policy, state, topology, and timeline
+hydration. That related context is explanation and review context only, not
+approval or execution authority. Detailed lifecycle events are
likewise current Patrol review context only. The assembled briefing, lifecycle,
and related context are policy-sanitized by the chat handoff runtime before
prompt injection, so governed resource names, IDs, aliases, nodes, paths, and
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index c493f82d86..91ffdbcde1 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -317,8 +317,9 @@ the canonical monitored-system blocked payload.
briefing summarizing operator next steps, latest lifecycle event, and
governed action posture without raw command text. Related finding context
must resolve from the current unified finding store, stay bounded and
- deduplicated, and seed only structured handoff resources for canonical
- policy, state, topology, and timeline hydration. Chat execution owns
+ deduplicated, include current recency and latest lifecycle facts, and seed
+ only structured handoff resources for canonical policy, state, topology,
+ and timeline hydration. Chat execution owns
resource-policy sanitization of the assembled model-only handoff before
prompt injection, so API payload builders may pass structured product
context without turning raw resource identity into user-authored text or
@@ -787,10 +788,11 @@ the canonical monitored-system blocked payload.
handoff state, while the detailed lifecycle list must stay bounded and
model-only. Chat execution may also resolve root-cause and correlated finding
IDs from that current unified finding into compact related-finding summaries
- and structured handoff resources, but those related records remain
- model-only explanation context and must not become saved user text,
- disclosure authority, lifecycle authority, approval authority, or execution
- authority. Chat execution may also hydrate canonical
+ and structured handoff resources. Those related summaries may include the
+ related record's current recency and latest lifecycle facts, but those
+ related records remain model-only explanation context and must not become
+ saved user text, disclosure authority, lifecycle authority, approval
+ authority, or execution authority. Chat execution may also hydrate canonical
resource-policy context for those resources through unified-resource
resolution and shared policy presentation helpers, but the resulting handling
guidance is read-only, model-only context and must not become saved user text,
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 19a647409b..a28b3493c5 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -123,8 +123,9 @@ Patrol-specific presentation helpers.
When a Patrol finding declares root-cause or correlated finding IDs, the
Assistant handoff may also resolve those related findings through the current
unified finding store and summarize them as model-only context. Those
- related finding summaries may seed their own structured resources for the
- same canonical policy, state, topology, and timeline hydration, but Patrol
+ related finding summaries must include current recency and latest lifecycle
+ facts when present, and may seed their own structured resources for the same
+ canonical policy, state, topology, and timeline hydration, but Patrol
presentation must treat them as explanation for the current finding rather
than approval, lifecycle, disclosure, or execution authority.
Assistant handoffs from Patrol findings must also include a concise operator
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 065ab7a931..41f9c25fb5 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -429,10 +429,12 @@ bypass the API fail-closed execution gate.
handoff remain Patrol/AI review metadata and must not become backup recency,
restore support, or storage-local lifecycle state. Related root-cause or
correlated finding summaries resolved for that Assistant handoff are also
- adjacent AI/runtime explanation context only; storage and recovery surfaces
- must not reinterpret those related records or their seeded handoff resources
- as backup freshness, restore eligibility, recovery execution authority, or
- storage-local capability truth. Current resource-state, source-health,
+ adjacent AI/runtime explanation context only, including any recency or
+ latest lifecycle facts attached to those related summaries; storage and
+ recovery surfaces must not reinterpret those related records or their seeded
+ handoff resources as backup freshness, restore eligibility, recovery
+ execution authority, or storage-local capability truth. Current
+ resource-state, source-health,
incident, metric, and capability summaries carried by that handoff are also
adjacent AI/runtime context and must not become backup freshness, restore
eligibility, recovery execution authority, or storage-local capability
diff --git a/internal/api/ai_handler.go b/internal/api/ai_handler.go
index fdcc9dfd22..3b95e13295 100644
--- a/internal/api/ai_handler.go
+++ b/internal/api/ai_handler.go
@@ -949,6 +949,9 @@ func formatUnifiedRelatedFindingSummary(f *unified.UnifiedFinding) string {
if resource := formatUnifiedFindingBriefingResource(f); resource != "" {
parts = append(parts, "resource "+resource)
}
+ if recency := formatUnifiedFindingBriefingRecency(f); recency != "" {
+ parts = append(parts, "recency "+recency)
+ }
if investigation := formatUnifiedFindingBriefingInvestigation(f); investigation != "" {
parts = append(parts, "investigation "+investigation)
}
@@ -1053,6 +1056,48 @@ func formatUnifiedFindingBriefingPriority(f *unified.UnifiedFinding) string {
return strings.Join(parts, "; ")
}
+func formatUnifiedFindingBriefingRecency(f *unified.UnifiedFinding) string {
+ if f == nil {
+ return ""
+ }
+
+ parts := make([]string, 0, 8)
+ if !f.DetectedAt.IsZero() {
+ parts = append(parts, "detected "+f.DetectedAt.Format(time.RFC3339))
+ }
+ if !f.LastSeenAt.IsZero() {
+ parts = append(parts, "last seen "+f.LastSeenAt.Format(time.RFC3339))
+ }
+ if f.ResolvedAt != nil {
+ parts = append(parts, "resolved "+f.ResolvedAt.Format(time.RFC3339))
+ }
+ if f.SnoozedUntil != nil {
+ parts = append(parts, "snoozed until "+f.SnoozedUntil.Format(time.RFC3339))
+ }
+ if strings.TrimSpace(f.DismissedReason) != "" {
+ parts = append(parts, "dismissed "+strings.TrimSpace(f.DismissedReason))
+ }
+ if f.Suppressed {
+ parts = append(parts, "suppressed")
+ }
+ if f.TimesRaised > 1 {
+ parts = append(parts, fmt.Sprintf("raised %d times", f.TimesRaised))
+ }
+ if f.RegressionCount > 0 {
+ parts = append(parts, fmt.Sprintf("regressed %d times", f.RegressionCount))
+ }
+ if f.LastRegressionAt != nil {
+ parts = append(parts, "last regression "+f.LastRegressionAt.Format(time.RFC3339))
+ }
+ if f.AcknowledgedAt != nil {
+ parts = append(parts, "acknowledged "+f.AcknowledgedAt.Format(time.RFC3339))
+ }
+ if latestLifecycle := formatUnifiedFindingLatestLifecycleEvent(f.Lifecycle); latestLifecycle != "" {
+ parts = append(parts, "latest lifecycle "+latestLifecycle)
+ }
+ return strings.Join(parts, "; ")
+}
+
func formatUnifiedFindingBriefingInvestigation(f *unified.UnifiedFinding) string {
if f == nil {
return ""
diff --git a/internal/api/ai_handler_test.go b/internal/api/ai_handler_test.go
index 4cf14bf924..56561821be 100644
--- a/internal/api/ai_handler_test.go
+++ b/internal/api/ai_handler_test.go
@@ -680,6 +680,13 @@ func TestHandleChat_IncludesInvestigationRecordContext(t *testing.T) {
AIConfidence: 0.74,
InvestigationStatus: "completed",
InvestigationOutcome: "root_cause",
+ Lifecycle: []unified.UnifiedFindingLifecycleEvent{{
+ At: detectedAt.Add(-2 * time.Minute),
+ Type: "correlated",
+ Message: "Backup latency identified",
+ From: "detected",
+ To: "root_cause",
+ }},
})
store.AddFromAI(&unified.UnifiedFinding{
ID: "finding-storage",
@@ -743,8 +750,8 @@ func TestHandleChat_IncludesInvestigationRecordContext(t *testing.T) {
assert.Contains(t, reqArg.HandoffContext, "Root Cause ID: finding-root")
assert.Contains(t, reqArg.HandoffContext, "Correlated Finding 1: finding-storage")
assert.Contains(t, reqArg.HandoffContext, "[Related Finding Context]")
- assert.Contains(t, reqArg.HandoffContext, "Root Cause Finding: finding-root | Backup storage pressure (warning, capacity, active) | resource backup-store (storage) [storage-100] on pve-1 | investigation completed; outcome root_cause; ai confidence 0.74 | conclusion Backup storage pressure preceded the workload CPU saturation.")
- assert.Contains(t, reqArg.HandoffContext, "Correlated Finding 1: finding-storage | Datastore latency (warning, capacity, active) | resource vm-datastore (storage) [storage-200] on pve-2 | investigation completed; outcome resolved; confidence medium | conclusion Datastore latency recovered after backup completion.")
+ assert.Contains(t, reqArg.HandoffContext, "Root Cause Finding: finding-root | Backup storage pressure (warning, capacity, active) | resource backup-store (storage) [storage-100] on pve-1 | recency detected 2026-05-06T11:55:00Z; last seen 2026-05-06T12:02:00Z; latest lifecycle 2026-05-06T11:58:00Z | correlated | Backup latency identified | detected -> root_cause | investigation completed; outcome root_cause; ai confidence 0.74 | conclusion Backup storage pressure preceded the workload CPU saturation.")
+ assert.Contains(t, reqArg.HandoffContext, "Correlated Finding 1: finding-storage | Datastore latency (warning, capacity, active) | resource vm-datastore (storage) [storage-200] on pve-2 | recency detected 2026-05-06T11:56:00Z; last seen 2026-05-06T12:02:00Z | investigation completed; outcome resolved; confidence medium | conclusion Datastore latency recovered after backup completion.")
assert.Contains(t, reqArg.HandoffContext, "Related Finding Boundary: Related findings are current unified finding context for explanation only")
assert.Contains(t, reqArg.HandoffContext, "Remediation ID: remediation-123")
assert.Contains(t, reqArg.HandoffContext, "Last Investigated At: 2026-05-06T12:04:00Z")
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 1397667bc2..e8c27e1932 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -159,6 +159,8 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {
"appendUnifiedFindingRelatedContext(&b, f, lookup)",
"[Related Finding Context]",
"Related Finding Boundary",
+ "formatUnifiedFindingBriefingRecency(f)",
+ "latest lifecycle",
`appendChatContextLine(&b, "Remediation ID", f.RemediationID)`,
`appendChatContextLine(&b, "Last Investigated At", f.LastInvestigatedAt.Format(time.RFC3339))`,
`appendChatContextLine(&b, "Investigation Attempts", strconv.Itoa(f.InvestigationAttempts))`,