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 evidence cues to Assistant briefings

rcourtmanc50f051e13ad
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index fec0b3b9e6..abc85db57a 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -369,11 +369,12 @@ profile and assignment columns, but embedded table framing must route through
lifecycle transition. Unified finding lifecycle facts, latest lifecycle
event briefing lines, and detailed lifecycle context included in Assistant
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, 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,
+ lifecycle state or fleet-control authority. Primary finding recency facts in
+ the operator briefing and related root-cause or correlated finding summaries
+ resolved for the same Assistant handoff follow that same 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 f467fadbda..2ed939bb9a 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -206,10 +206,11 @@ runtime cost control, and shared AI transport surfaces.
resolved, snoozed, dismissed or suppressed state, detection/last-seen/
resolved timestamps, recurrence, regression, and recent lifecycle events so
Assistant explains the current Patrol record rather than only the original
- investigation narrative. The operator briefing may surface the latest
- lifecycle event as the current handoff state, and detailed lifecycle events
- must stay in a bounded `[Finding Lifecycle Context]` block with an explicit
- model-only boundary. Assistant runtime may also hydrate canonical
+ investigation narrative. The operator briefing must surface the primary
+ finding's current recency facts before investigation guidance, may surface
+ the latest lifecycle event as the current handoff state, and detailed
+ lifecycle events must stay in a bounded `[Finding Lifecycle Context]` block
+ with an explicit model-only boundary. Assistant runtime may also hydrate canonical
resource-policy context for those handoff resources, using the same
unified-resource resolution and policy presentation helpers that govern
mention prefetch and provider-bound redaction; that context remains
@@ -960,10 +961,11 @@ top-N slices.
Assistant finding handoffs now also receive a model-only operator briefing
derived from the current unified finding and structured Patrol investigation
record before the lower-level finding context. That briefing must summarize the
-finding, resource, priority, investigation confidence, recommended next step,
-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
+finding, resource, priority, current recency facts, investigation confidence,
+recommended next step, 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,
including their recency and latest lifecycle facts, and may seed their own
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 91ffdbcde1..a42ab8683d 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -784,9 +784,10 @@ the canonical monitored-system blocked payload.
snoozed/dismissed/suppressed status, detection/last-seen/resolution
timestamps, recurrence/regression facts, and recent lifecycle events, so API
consumers do not reduce Assistant context to an outdated investigation
- summary. The briefing may carry the latest lifecycle event as the current
- handoff state, while the detailed lifecycle list must stay bounded and
- model-only. Chat execution may also resolve root-cause and correlated finding
+ summary. The briefing must carry the primary finding's current recency facts
+ before investigation guidance and may carry the latest lifecycle event as the
+ current 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. Those related summaries may include the
related record's current recency and latest lifecycle facts, but those
@@ -2932,10 +2933,10 @@ The `/api/ai/chat` finding handoff contract must also include a model-only
`[Operator Briefing]` generated from the unified finding and structured Patrol
investigation record before detailed `[Finding Context]`. The briefing is the
canonical operator-facing frame for Assistant: it carries the finding summary,
-resource, priority, investigation confidence, recommended next step, and
-approval/proposed-fix posture without raw command text, and the downstream chat
-service then hydrates live resource state, timeline, and action audit context
-around that same handoff.
+resource, priority, current recency facts, investigation confidence,
+recommended next step, and approval/proposed-fix posture without raw command
+text, and the downstream chat service then hydrates live resource state,
+timeline, and action audit context around that same handoff.
Patrol run-history serialization and persistence must also preserve full field
parity across API responses and restart boundaries, including
`pmg_checked`, `rejected_findings`, `triage_flags`, `triage_skipped_llm`, and
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index a28b3493c5..59062ea10d 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -131,10 +131,10 @@ Patrol-specific presentation helpers.
Assistant handoffs from Patrol findings must also include a concise operator
briefing derived from the unified finding and structured investigation record
before the detailed finding context, so Assistant leads with the current risk,
- conclusion, latest lifecycle event, recommended next step, and governed
- approval/proposed-fix posture instead of behaving like a generic chat over a
- pasted incident dump. The assembled handoff must still pass through the
- Assistant runtime's
+ recency, conclusion, latest lifecycle event, recommended next step, and
+ governed approval/proposed-fix posture instead of behaving like a generic
+ chat over a pasted incident dump. The assembled handoff must still pass
+ through the Assistant runtime's
resource-policy sanitizer before prompt injection, so Patrol-owned prose
cannot leak governed resource names, IDs, aliases, nodes, paths, or
addresses outside the canonical policy boundary.
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 41f9c25fb5..873d9951bc 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -427,14 +427,14 @@ bypass the API fail-closed execution gate.
review metadata only. Unified finding lifecycle facts, latest lifecycle
event briefing lines, and detailed lifecycle context carried by the same
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, 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,
+ restore support, or storage-local lifecycle state. Primary finding recency
+ facts in the operator briefing and related root-cause or correlated finding
+ summaries resolved for that Assistant handoff are also 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 3b95e13295..e41320fc40 100644
--- a/internal/api/ai_handler.go
+++ b/internal/api/ai_handler.go
@@ -977,6 +977,7 @@ func appendUnifiedFindingOperatorBriefingContext(b *strings.Builder, f *unified.
appendChatContextLine(b, "Finding", formatUnifiedFindingBriefingFinding(f))
appendChatContextLine(b, "Resource", formatUnifiedFindingBriefingResource(f))
appendChatContextLine(b, "Priority", formatUnifiedFindingBriefingPriority(f))
+ appendChatContextLine(b, "Recency", formatUnifiedFindingBriefingRecencyFacts(f))
appendChatContextLine(b, "Investigation", formatUnifiedFindingBriefingInvestigation(f))
if latestLifecycle := formatUnifiedFindingLatestLifecycleEvent(f.Lifecycle); latestLifecycle != "" {
appendChatContextLine(b, "Latest Lifecycle Event", latestLifecycle)
@@ -1061,6 +1062,18 @@ func formatUnifiedFindingBriefingRecency(f *unified.UnifiedFinding) string {
return ""
}
+ parts := nonEmptyStrings(formatUnifiedFindingBriefingRecencyFacts(f))
+ if latestLifecycle := formatUnifiedFindingLatestLifecycleEvent(f.Lifecycle); latestLifecycle != "" {
+ parts = append(parts, "latest lifecycle "+latestLifecycle)
+ }
+ return strings.Join(parts, "; ")
+}
+
+func formatUnifiedFindingBriefingRecencyFacts(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))
@@ -1092,9 +1105,6 @@ func formatUnifiedFindingBriefingRecency(f *unified.UnifiedFinding) string {
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, "; ")
}
diff --git a/internal/api/ai_handler_test.go b/internal/api/ai_handler_test.go
index 56561821be..abccea2bdf 100644
--- a/internal/api/ai_handler_test.go
+++ b/internal/api/ai_handler_test.go
@@ -732,6 +732,7 @@ func TestHandleChat_IncludesInvestigationRecordContext(t *testing.T) {
assert.Contains(t, reqArg.HandoffContext, "Finding: High CPU usage (critical, performance, active)")
assert.Contains(t, reqArg.HandoffContext, "Resource: web-server (vm) [vm-100] on pve-1")
assert.Contains(t, reqArg.HandoffContext, "Priority: critical performance; status active; loop awaiting_approval; raised 3 times; regressed 2 times")
+ assert.Contains(t, reqArg.HandoffContext, "Recency: detected 2026-05-06T12:00:00Z; last seen 2026-05-06T12:02:00Z; raised 3 times; regressed 2 times; last regression 2026-05-06T12:06:00Z")
assert.Contains(t, reqArg.HandoffContext, "Investigation: completed; outcome fix_queued; confidence high; attempts 1")
assert.Contains(t, reqArg.HandoffContext, "Latest Lifecycle Event: 2026-05-06T12:03:00Z | investigation_completed | Fix queued for approval | investigating -> fix_queued")
assert.Contains(t, reqArg.HandoffContext, "Current Conclusion: Backup job saturated CPU.")
@@ -856,6 +857,7 @@ func TestHandleChat_RefreshesStoredFindingContextForFollowUp(t *testing.T) {
assert.Equal(t, "What changed?", reqArg.Prompt)
assert.Contains(t, reqArg.HandoffContext, "[Finding Context]")
assert.Contains(t, reqArg.HandoffContext, "Finding Status: resolved")
+ assert.Contains(t, reqArg.HandoffContext, "Recency: detected 2026-05-06T12:30:00Z; last seen 2026-05-06T13:00:00Z; resolved 2026-05-06T13:00:00Z")
assert.Contains(t, reqArg.HandoffContext, "Finding Detected At: 2026-05-06T12:30:00Z")
assert.Contains(t, reqArg.HandoffContext, "Finding Last Seen At: 2026-05-06T13:00:00Z")
assert.Contains(t, reqArg.HandoffContext, "Finding Resolved At: 2026-05-06T13:00:00Z")
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index e8c27e1932..b3255542b1 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -173,6 +173,8 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {
"Lifecycle Boundary",
"appendUnifiedFindingOperatorBriefingContext(&b, f)",
"[Operator Briefing]",
+ `appendChatContextLine(b, "Recency", formatUnifiedFindingBriefingRecencyFacts(f))`,
+ "formatUnifiedFindingBriefingRecencyFacts(f)",
"Latest Lifecycle Event",
"Operator Boundary",
`return "suppressed"`,