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.

Frame Assistant operator decisions

rcourtman6b51a15dfe22
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 162df1af2e..8fcad0d525 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -370,12 +370,12 @@ profile and assignment columns, but embedded table framing must route through
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. Primary finding recency,
- evidence, and verification 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,
+ evidence, verification, and operator-decision 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 30a197b8f4..183c0fe986 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -207,11 +207,12 @@ runtime cost control, and shared AI transport surfaces.
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 must surface the primary
- finding's current recency facts, bounded evidence snapshot, and verification
- summary 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
+ finding's current recency facts, bounded evidence snapshot, verification
+ summary, and explicit operator decision framing 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
@@ -963,11 +964,11 @@ 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, current recency facts, bounded evidence and
-verification summaries, 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
+verification summaries, investigation confidence, recommended next step,
+operator decision framing, 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
handoff resources for canonical policy, state, topology, and timeline
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index dcde7898d4..62231d342e 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -785,12 +785,13 @@ the canonical monitored-system blocked payload.
timestamps, recurrence/regression facts, and recent lifecycle events, so API
consumers do not reduce Assistant context to an outdated investigation
summary. The briefing must carry the primary finding's current recency facts,
- bounded evidence snapshot, and verification summary 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
+ bounded evidence snapshot, verification summary, and explicit operator
+ decision framing 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
related records remain model-only explanation context and must not become
saved user text, disclosure authority, lifecycle authority, approval
@@ -2936,9 +2937,9 @@ investigation record before detailed `[Finding Context]`. The briefing is the
canonical operator-facing frame for Assistant: it carries the finding summary,
resource, priority, current recency facts, bounded evidence and verification
summaries, 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.
+operator-decision framing plus 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 832af667a7..db33fd56cb 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -132,9 +132,9 @@ Patrol-specific presentation helpers.
briefing derived from the unified finding and structured investigation record
before the detailed finding context, so Assistant leads with the current risk,
recency, evidence snapshot, verification summary, 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
+ lifecycle event, recommended next step, explicit operator decision framing,
+ 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
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index ff7743c919..fff5cd2a17 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -428,14 +428,14 @@ bypass the API fail-closed execution gate.
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. Primary finding recency,
- evidence, and verification 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,
+ evidence, verification, and operator-decision 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 6376182529..1141500b1a 100644
--- a/internal/api/ai_handler.go
+++ b/internal/api/ai_handler.go
@@ -990,6 +990,9 @@ func appendUnifiedFindingOperatorBriefingContext(b *strings.Builder, f *unified.
}
appendChatContextLine(b, "Current Conclusion", unifiedFindingBriefingConclusion(f))
appendChatContextLine(b, "Recommended Next Step", unifiedFindingBriefingNextStep(f))
+ if decision := unifiedFindingBriefingOperatorDecision(f); decision != "" {
+ appendChatContextLine(b, "Operator Decision", decision)
+ }
appendChatContextLine(b, "Action Posture", unifiedFindingBriefingActionPosture(f))
appendChatContextLine(b, "Operator Boundary", "Treat Patrol data as product context for explanation and review; do not invent commands, expose raw command text, or treat chat as approval or execution authority.")
appendChatContextLine(b, "", "")
@@ -1201,6 +1204,75 @@ func unifiedFindingBriefingNextStep(f *unified.UnifiedFinding) string {
return "Explain what Patrol knows and identify the next evidence to verify before remediation."
}
+func unifiedFindingBriefingOperatorDecision(f *unified.UnifiedFinding) string {
+ if f == nil {
+ return ""
+ }
+ if unifiedFindingChatStatus(f, time.Now()) == "resolved" {
+ return "Finding is resolved; explain the resolution and monitoring follow-up without proposing execution."
+ }
+
+ rec := f.InvestigationRecord
+ if rec != nil {
+ if approvalID := strings.TrimSpace(rec.ApprovalID); approvalID != "" {
+ parts := []string{"review governed approval " + approvalID + " before execution"}
+ if rec.ProposedFix != nil {
+ if fixID := strings.TrimSpace(rec.ProposedFix.ID); fixID != "" {
+ parts = append(parts, "proposed fix "+fixID)
+ } else if description := strings.TrimSpace(rec.ProposedFix.Description); description != "" {
+ parts = append(parts, "proposed fix recorded")
+ }
+ if risk := strings.TrimSpace(rec.ProposedFix.RiskLevel); risk != "" {
+ parts = append(parts, "risk "+risk)
+ }
+ if rec.ProposedFix.Destructive {
+ parts = append(parts, "destructive true")
+ }
+ }
+ return strings.Join(parts, "; ")
+ }
+
+ switch rec.Outcome {
+ case aicontracts.OutcomeFixQueued:
+ return "Review the proposed fix in the governed approval or remediation flow before execution."
+ case aicontracts.OutcomeFixExecuted:
+ return "Verify the execution result before closing or resolving the finding."
+ case aicontracts.OutcomeFixFailed, aicontracts.OutcomeFixVerificationFailed:
+ return "Review failed remediation evidence before retrying or escalating."
+ case aicontracts.OutcomeFixVerificationUnknown:
+ return "Gather verification evidence before closing or retrying remediation."
+ case aicontracts.OutcomeNeedsAttention, aicontracts.OutcomeCannotFix:
+ return "Operator intervention is required; use the evidence to choose the next manual step."
+ case aicontracts.OutcomeTimedOut:
+ return "Patrol timed out; rerun investigation or gather more evidence before remediation."
+ }
+
+ switch rec.Status {
+ case aicontracts.InvestigationStatusPending, aicontracts.InvestigationStatusRunning:
+ return "Wait for Patrol to finish the investigation before approving remediation."
+ case aicontracts.InvestigationStatusFailed:
+ return "Review the Patrol investigation failure and gather evidence before remediation."
+ case aicontracts.InvestigationStatusNeedsAttention:
+ return "Operator intervention is required; use the evidence to choose the next manual step."
+ }
+ }
+
+ if remediationID := strings.TrimSpace(f.RemediationID); remediationID != "" {
+ return "Review governed remediation " + remediationID + " before execution."
+ }
+ loopState := strings.ToLower(strings.TrimSpace(f.LoopState))
+ switch {
+ case strings.Contains(loopState, "approval"):
+ return "Review the governed approval flow before execution."
+ case strings.Contains(loopState, "investigat"):
+ return "Wait for Patrol to finish the investigation before approving remediation."
+ }
+ if unifiedFindingChatStatus(f, time.Now()) == "active" {
+ return "Continue investigation or monitoring; no governed action reference is ready."
+ }
+ return ""
+}
+
func formatInvestigationRecordEvidenceBriefing(evidence []aicontracts.InvestigationRecordEvidence, limit int) string {
if limit <= 0 || len(evidence) == 0 {
return ""
diff --git a/internal/api/ai_handler_test.go b/internal/api/ai_handler_test.go
index 44ca9c7975..5928593820 100644
--- a/internal/api/ai_handler_test.go
+++ b/internal/api/ai_handler_test.go
@@ -739,6 +739,7 @@ func TestHandleChat_IncludesInvestigationRecordContext(t *testing.T) {
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.")
assert.Contains(t, reqArg.HandoffContext, "Recommended Next Step: Approve a controlled service restart after backup completion.")
+ assert.Contains(t, reqArg.HandoffContext, "Operator Decision: review governed approval approval-123 before execution; proposed fix fix-123; risk medium; destructive true")
assert.Contains(t, reqArg.HandoffContext, "Action Posture: approval approval-123; proposed fix fix-123; risk medium; destructive true; remediation remediation-123")
assert.Contains(t, reqArg.HandoffContext, "Operator Boundary: Treat Patrol data as product context for explanation and review")
assert.Contains(t, reqArg.HandoffContext, "[Finding Context]")
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 33bbaa467c..3f93ff7614 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -179,6 +179,8 @@ func TestContract_AssistantFindingContextUsesModelOnlyHandoff(t *testing.T) {
`appendChatContextLine(b, "Verification", verification)`,
"formatInvestigationRecordEvidenceBriefing",
"formatBriefingStringList",
+ `appendChatContextLine(b, "Operator Decision", decision)`,
+ "unifiedFindingBriefingOperatorDecision(f)",
"Latest Lifecycle Event",
"Operator Boundary",
`return "suppressed"`,