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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Preserve Patrol handoff session identity
rcourtman7392f1719046
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 662dcb8348..3b27090d41 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -238,7 +238,18 @@ 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 soAssistant explains the current Patrol record rather than only the original- investigation narrative. The operator briefing must surface the primary+ investigation narrative. The saved-session handoff envelope must also+ preserve first-class Patrol source identity when product callers provide+ safe metadata. Patrol assessment handoffs remain `patrol_assessment`+ whole-surface review sessions even when their bounded action references+ name individual findings; the session list must not infer a+ `patrol_finding` identity from those action references once metadata is+ present. Patrol configuration failure handoffs remain+ `patrol_configuration_failure` sessions and may expose only the safe+ runtime-failure boolean needed for browser presentation. Run-specific+ fields stay reserved for `patrol_run` handoffs, while hidden model context,+ command payloads, preflight output, and action results remain+ backend-owned. The operator briefing must surface the primaryfinding's current attention reason, recency facts, bounded evidencesnapshot, verification summary, and explicit operator decision framingbefore investigation guidance, may surface the latest lifecycle event asdiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex bfa5bf348f..4159d847fa 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -208,7 +208,14 @@ product API routes free of maintainer commercial analytics.`handoff_summary` projection needed by the browser to mark and restore ascoped handoff. The payload must not expose provider-bound model context,raw commands, preflight output, action results, or remediation command- descriptions.+ descriptions. That safe projection owns Patrol handoff identity as data,+ not browser inference: `kind` may identify `patrol_assessment`,+ `patrol_configuration_failure`, `patrol_run`, `patrol_finding`, or generic+ `scoped_context`; assessment and configuration-failure sessions must not be+ collapsed into one finding because a safe action reference contains a+ finding ID. `patrol_configuration_failure` may carry only the+ runtime-failure boolean needed for drawer/session presentation, and+ run-specific fields remain reserved for `patrol_run`.34. `internal/api/ai_handlers.go` shared with `ai-runtime`: AI settings and remediation handlers are both an AI runtime control surface and a canonical API payload contract boundary.35. `internal/api/ai_intelligence_handlers.go` shared with `ai-runtime`: AI intelligence handlers are both an AI runtime control surface and a canonical API payload contract boundary.36. `internal/api/config_setup_handlers.go` shared with `agent-lifecycle`: auto-register and setup handlers are both an agent lifecycle control surface and a canonical API payload contract boundary.diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 1eedd67e20..fba47a0402 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -192,7 +192,13 @@ work extends shared components instead of creating new local variants.action context rather than pending approval. A restored Patrol run summarymust remain visibly sourced to Pulse Patrol, restore a `patrol-run` targetplus run ID/type/status/runtime-failure presentation only, and must not- rehydrate model-only runtime failure detail into browser context.+ rehydrate model-only runtime failure detail into browser context. Restored+ Patrol assessment and Patrol configuration-failure sessions follow the same+ safe-summary rule: the drawer may restore source label, title, target type,+ status badge, action label, and suggested prompts from `handoff_summary`, but+ it must not infer a finding target from bounded action references or+ reconstruct hidden model context, provider details, retry payloads, commands,+ preflight output, or action results in the browser.Session-load and new-conversation transitions must be success-bound: if theunderlying session operation fails, the shared drawer store must not clear orreplace the current scoped handoff context.diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex e233c24a21..7c9ff8d30c 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -250,7 +250,11 @@ Patrol-specific presentation helpers.lead with approval/action review when governed references are attached, andframe Assistant as explanation, prioritization, and safe next-step reviewrather than a generic reactive chat- box.+ box. That whole-surface assessment handoff must send safe+ `handoff_metadata.kind=patrol_assessment` so saved Assistant sessions restore+ as current-assessment context instead of becoming generic scoped context or+ an accidental single-finding session because one bounded action reference+ names a finding.Patrol run-history entries may also open Assistant for a selected run, butthat handoff must flow through the same Patrol-owned investigation-contextmodel rather than a row-local prompt. The handoff may pass bounded run@@ -355,7 +359,11 @@ a generic `Failed to save advanced settings` toast. That inline failure mayhandoff to Assistant only as model-only explanation context: raw command,script, credential, and provider-detail payloads stay redacted, Assistant openswith `autonomousMode:false`, and the configuration panel closes so the operator-is not left behind an overlapping popover.+is not left behind an overlapping popover. Configuration-failure handoffs+must send safe `handoff_metadata.kind=patrol_configuration_failure` plus only+the runtime-failure boolean needed for drawer/session presentation, so the+saved session restores as a Patrol configuration issue without carrying raw+provider, credential, command, or retry payloads into the browser.The readiness contract now applies before Patrol work is admitted, not onlyafter a page render: recoverable Patrol provider/model settings saves mustpersist and echo structured readiness cause metadata, manual run requests mustdiff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsxindex b65ff4e361..284a2ab20d 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx@@ -607,17 +607,15 @@ describe('AIChat', () => {});it('refreshes sessions before opening the picker', async () => {- mockAIChatAPI.listSessions- .mockResolvedValueOnce([])- .mockResolvedValueOnce([- {- id: 's-fresh',- title: 'Fresh session',- created_at: '',- updated_at: '',- message_count: 1,- },- ]);+ mockAIChatAPI.listSessions.mockResolvedValueOnce([]).mockResolvedValueOnce([+ {+ id: 's-fresh',+ title: 'Fresh session',+ created_at: '',+ updated_at: '',+ message_count: 1,+ },+ ]);renderChat();await waitFor(() => {@@ -849,6 +847,113 @@ describe('AIChat', () => {expect(mockAiChatStore.clearContext).not.toHaveBeenCalled();});+ it('restores Patrol assessment handoff state without pinning to one finding', async () => {+ mockAIChatAPI.listSessions.mockResolvedValue([+ {+ id: 's-patrol-assessment',+ title: 'Assessment follow-up',+ created_at: '',+ updated_at: '',+ message_count: 3,+ handoff_summary: {+ kind: 'patrol_assessment',+ has_model_context: true,+ resource_count: 2,+ action_count: 0,+ requires_approval: false,+ },+ },+ ]);++ renderChat();+ await waitFor(() => {+ expect(mockAIChatAPI.listSessions).toHaveBeenCalled();+ });+ fireEvent.click(screen.getByTitle('Pulse Assistant sessions'));++ await waitFor(() => {+ expect(screen.getByText('Pulse Patrol')).toBeInTheDocument();+ expect(screen.getByText('Assessment context')).toBeInTheDocument();+ });++ fireEvent.click(screen.getByText('Assessment follow-up'));++ await waitFor(() => {+ expect(mockAiChatStore.setContext).toHaveBeenCalledWith(+ expect.objectContaining({+ targetType: 'patrol-assessment',+ targetId: 'pulse-patrol-assessment',+ findingId: undefined,+ autonomousMode: false,+ context: expect.objectContaining({+ kind: 'patrol_assessment',+ findingId: undefined,+ }),+ briefing: expect.objectContaining({+ sourceLabel: 'Pulse Patrol',+ title: 'Patrol assessment handoff',+ subject: 'Current Patrol assessment',+ actionLabel: 'Review Patrol assessment',+ }),+ }),+ );+ });+ });++ it('restores Patrol configuration failure handoff state as a runtime issue', async () => {+ mockAIChatAPI.listSessions.mockResolvedValue([+ {+ id: 's-patrol-config',+ title: 'Configuration follow-up',+ created_at: '',+ updated_at: '',+ message_count: 2,+ handoff_summary: {+ kind: 'patrol_configuration_failure',+ runtime_failure: true,+ has_model_context: true,+ resource_count: 0,+ action_count: 0,+ requires_approval: false,+ },+ },+ ]);++ renderChat();+ await waitFor(() => {+ expect(mockAIChatAPI.listSessions).toHaveBeenCalled();+ });+ fireEvent.click(screen.getByTitle('Pulse Assistant sessions'));++ await waitFor(() => {+ expect(screen.getByText('Pulse Patrol')).toBeInTheDocument();+ expect(screen.getAllByText('Runtime issue').length).toBeGreaterThan(0);+ });++ fireEvent.click(screen.getByText('Configuration follow-up'));++ await waitFor(() => {+ expect(mockAiChatStore.setContext).toHaveBeenCalledWith(+ expect.objectContaining({+ targetType: 'patrol-configuration',+ targetId: 'pulse-patrol-configuration',+ autonomousMode: false,+ context: expect.objectContaining({+ kind: 'patrol_configuration_failure',+ runtimeFailure: true,+ }),+ briefing: expect.objectContaining({+ sourceLabel: 'Pulse Patrol',+ title: 'Patrol configuration failure',+ subject: 'Patrol configuration',+ actionLabel: 'Review Patrol configuration issue',+ statusLabel: 'runtime issue',+ }),+ }),+ );+ });+ });+it('shows completed Patrol actions as action context instead of pending approval', async () => {mockAIChatAPI.listSessions.mockResolvedValue([{diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsxindex ec14bd2c99..c703f24f16 100644--- a/frontend-modern/src/components/AI/Chat/index.tsx+++ b/frontend-modern/src/components/AI/Chat/index.tsx@@ -84,8 +84,17 @@ const isPatrolFindingSessionHandoff = (summary: ChatSessionHandoffSummary) =>const isPatrolRunSessionHandoff = (summary: ChatSessionHandoffSummary) =>summary.kind === 'patrol_run' || Boolean(summary.run_id);+const isPatrolAssessmentSessionHandoff = (summary: ChatSessionHandoffSummary) =>+ summary.kind === 'patrol_assessment';++const isPatrolConfigurationFailureSessionHandoff = (summary: ChatSessionHandoffSummary) =>+ summary.kind === 'patrol_configuration_failure';+const isPatrolSessionHandoff = (summary: ChatSessionHandoffSummary) =>- isPatrolFindingSessionHandoff(summary) || isPatrolRunSessionHandoff(summary);+ isPatrolFindingSessionHandoff(summary) ||+ isPatrolRunSessionHandoff(summary) ||+ isPatrolAssessmentSessionHandoff(summary) ||+ isPatrolConfigurationFailureSessionHandoff(summary);const getSessionHandoffSourceLabel = (summary: ChatSessionHandoffSummary) =>isPatrolSessionHandoff(summary) ? 'Pulse Patrol' : 'Pulse Assistant';@@ -111,6 +120,9 @@ const formatSessionHandoffStatus = (summary: ChatSessionHandoffSummary) => {summary.runtime_failure ? 'runtime issue' : undefined,]).join(' · ');}+ if (isPatrolConfigurationFailureSessionHandoff(summary)) {+ return summary.runtime_failure ? 'runtime issue' : '';+ }return compactText([summary.last_known_approval_status? `approval ${formatIdentifierLabel(summary.last_known_approval_status)}`@@ -130,6 +142,8 @@ const getSessionHandoffBadgeLabel = (summary: ChatSessionHandoffSummary) => {if (isPatrolRunSessionHandoff(summary)) {return summary.runtime_failure ? 'Runtime issue' : 'Run context';}+ if (isPatrolConfigurationFailureSessionHandoff(summary)) return 'Runtime issue';+ if (isPatrolAssessmentSessionHandoff(summary)) return 'Assessment context';return summary.has_model_context ? 'Context attached' : 'Scoped handoff';};@@ -149,23 +163,41 @@ const buildSessionHandoffContext = (session?: ChatSession): AIChatContext | undeconst runStatus = summary.run_status?.trim() || undefined;const isPatrolFinding = isPatrolFindingSessionHandoff(summary);const isPatrolRun = isPatrolRunSessionHandoff(summary);+ const isPatrolAssessment = isPatrolAssessmentSessionHandoff(summary);+ const isPatrolConfigurationFailure = isPatrolConfigurationFailureSessionHandoff(summary);const title = isPatrolRun? runId? `Patrol run ${runId}`: 'Patrol run handoff'- : isPatrolFinding- ? resourceLabel- ? `Patrol finding on ${resourceLabel}`- : findingId- ? `Patrol finding ${findingId}`- : 'Patrol finding handoff'- : resourceLabel- ? `Assistant handoff for ${resourceLabel}`- : 'Assistant handoff';+ : isPatrolAssessment+ ? 'Patrol assessment handoff'+ : isPatrolConfigurationFailure+ ? 'Patrol configuration failure'+ : isPatrolFinding+ ? resourceLabel+ ? `Patrol finding on ${resourceLabel}`+ : findingId+ ? `Patrol finding ${findingId}`+ : 'Patrol finding handoff'+ : resourceLabel+ ? `Assistant handoff for ${resourceLabel}`+ : 'Assistant handoff';return {- targetType: isPatrolRun ? 'patrol-run' : summary.primary_resource?.type,- targetId: isPatrolRun ? runId : summary.primary_resource?.id,+ targetType: isPatrolRun+ ? 'patrol-run'+ : isPatrolAssessment+ ? 'patrol-assessment'+ : isPatrolConfigurationFailure+ ? 'patrol-configuration'+ : summary.primary_resource?.type,+ targetId: isPatrolRun+ ? runId+ : isPatrolAssessment+ ? 'pulse-patrol-assessment'+ : isPatrolConfigurationFailure+ ? 'pulse-patrol-configuration'+ : summary.primary_resource?.id,context: {source: 'session_handoff_summary',kind: summary.kind,@@ -189,7 +221,15 @@ const buildSessionHandoffContext = (session?: ChatSession): AIChatContext | undesourceLabel,title,subject:- isPatrolRun && runId ? `Run ${runId}` : findingId ? `Finding ${findingId}` : undefined,+ isPatrolRun && runId+ ? `Run ${runId}`+ : isPatrolAssessment+ ? 'Current Patrol assessment'+ : isPatrolConfigurationFailure+ ? 'Patrol configuration'+ : findingId+ ? `Finding ${findingId}`+ : undefined,statusLabel:statusLabel ||(summary.requires_approval ? 'approval required' : undefined) ||@@ -207,13 +247,17 @@ const buildSessionHandoffContext = (session?: ChatSession): AIChatContext | unde]),actionLabel: summary.requires_approval? 'Approval required'- : isPatrolRun && summary.runtime_failure- ? 'Review Patrol runtime issue'- : isPatrolRun- ? 'Review Patrol run'- : actionCount > 0- ? 'Governed action context'- : undefined,+ : isPatrolConfigurationFailure+ ? 'Review Patrol configuration issue'+ : isPatrolAssessment+ ? 'Review Patrol assessment'+ : isPatrolRun && summary.runtime_failure+ ? 'Review Patrol runtime issue'+ : isPatrolRun+ ? 'Review Patrol run'+ : actionCount > 0+ ? 'Governed action context'+ : undefined,commandSummary: statusLabel? isPatrolRun? `Run state: ${statusLabel}`@@ -236,13 +280,25 @@ const buildSessionHandoffContext = (session?: ChatSession): AIChatContext | unde'What changed during this run?','What should I verify next?',]- : isPatrolFinding+ : isPatrolConfigurationFailure? [- 'What changed since this finding was opened?',- 'What evidence supports this finding?',- 'What should I verify next?',+ 'Explain this Patrol configuration issue',+ 'What should I check before retrying?',+ 'What should I change before the next run?',]- : ['Summarize this handoff', 'What needs attention?', 'What should I verify next?'],+ : isPatrolAssessment+ ? [+ 'Prioritize findings and safest next step',+ 'Explain recent changes and correlations',+ 'What should I verify next?',+ ]+ : isPatrolFinding+ ? [+ 'What changed since this finding was opened?',+ 'What evidence supports this finding?',+ 'What should I verify next?',+ ]+ : ['Summarize this handoff', 'What needs attention?', 'What should I verify next?'],},};};diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.tsindex 785ccb00ef..38d26d1ac5 100644--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts@@ -265,6 +265,9 @@ describe('patrolInvestigationContextModel', () => {{ id: 'vm-100', name: 'web-server', type: 'vm', node: 'pve-1' },{ id: 'backup-job', name: 'Nightly backup job', type: 'job', node: undefined },]);+ expect(handoff.context.handoffMetadata).toEqual({+ kind: 'patrol_assessment',+ });expect(handoff.context.briefing).toMatchObject({sourceLabel: 'Pulse Patrol',title: 'Patrol assessment attached',diff --git a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.tsindex 45cd0aa9e0..d86ff29224 100644--- a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts+++ b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts@@ -513,6 +513,9 @@ export function buildPatrolAssessmentAssistantHandoff(handoffContext,handoffResources: buildPatrolAssessmentHandoffResources(input),handoffActions: handoffActions.length > 0 ? handoffActions : undefined,+ handoffMetadata: {+ kind: 'patrol_assessment',+ },briefing: buildPatrolAssessmentAssistantBriefing(input),context: {source: 'pulse-patrol-assessment',diff --git a/frontend-modern/src/types/ai.ts b/frontend-modern/src/types/ai.tsindex 7e4cc9324b..f925fae960 100644--- a/frontend-modern/src/types/ai.ts+++ b/frontend-modern/src/types/ai.ts@@ -365,6 +365,10 @@ export interface AIChatSessionHandoffResource {export interface AIChatSessionHandoffSummary {kind?: string;finding_id?: string;+ run_id?: string;+ run_type?: string;+ run_status?: string;+ runtime_failure?: boolean;has_model_context: boolean;resource_count?: number;primary_resource?: AIChatSessionHandoffResource;diff --git a/internal/ai/chat/session.go b/internal/ai/chat/session.goindex 4ade9d6a6d..4e5cac534b 100644--- a/internal/ai/chat/session.go+++ b/internal/ai/chat/session.go@@ -151,7 +151,9 @@ func trimHandoffMetadataField(value string, maxRunes int) string {func NormalizeHandoffMetadata(metadata HandoffMetadata) HandoffMetadata {kind := strings.ToLower(trimHandoffMetadataField(metadata.Kind, 64))switch kind {- case sessionHandoffKindPatrolRun:+ case sessionHandoffKindPatrolAssessment,+ sessionHandoffKindPatrolConfigurationFailure,+ sessionHandoffKindPatrolRun:default:return HandoffMetadata{}}@@ -233,9 +235,11 @@ func modelContextEmpty(modelContext *sessionModelContext) bool {}const (- sessionHandoffKindPatrolFinding = "patrol_finding"- sessionHandoffKindPatrolRun = "patrol_run"- sessionHandoffKindScopedContext = "scoped_context"+ sessionHandoffKindPatrolAssessment = "patrol_assessment"+ sessionHandoffKindPatrolConfigurationFailure = "patrol_configuration_failure"+ sessionHandoffKindPatrolFinding = "patrol_finding"+ sessionHandoffKindPatrolRun = "patrol_run"+ sessionHandoffKindScopedContext = "scoped_context")func handoffActionCurrentlyRequiresApproval(action HandoffAction) bool {@@ -269,7 +273,7 @@ func modelContextHandoffSummary(modelContext *sessionModelContext) *SessionHandometadata = inferPatrolRunHandoffMetadata(modelContext.HandoffContext)}findingID := strings.TrimSpace(modelContext.HandoffFindingID)- if findingID == "" {+ if findingID == "" && metadata.Kind == "" {for _, action := range actions {if strings.TrimSpace(action.FindingID) != "" {findingID = strings.TrimSpace(action.FindingID)@@ -279,10 +283,10 @@ func modelContextHandoffSummary(modelContext *sessionModelContext) *SessionHando}kind := sessionHandoffKindScopedContext- if findingID != "" {+ if metadata.Kind != "" {+ kind = metadata.Kind+ } else if findingID != "" {kind = sessionHandoffKindPatrolFinding- } else if metadata.Kind == sessionHandoffKindPatrolRun {- kind = sessionHandoffKindPatrolRun}summary := &SessionHandoffSummary{@@ -300,6 +304,8 @@ func modelContextHandoffSummary(modelContext *sessionModelContext) *SessionHandosummary.RunID = ""summary.RunType = ""summary.RunStatus = ""+ }+ if kind != sessionHandoffKindPatrolRun && kind != sessionHandoffKindPatrolConfigurationFailure {summary.RuntimeFailure = false}if !modelContext.UpdatedAt.IsZero() {diff --git a/internal/ai/chat/session_additional_test.go b/internal/ai/chat/session_additional_test.goindex 7c6d4d944a..1d32773f8f 100644--- a/internal/ai/chat/session_additional_test.go+++ b/internal/ai/chat/session_additional_test.go@@ -500,6 +500,89 @@ func TestSessionStore_ListIncludesSafePatrolRunHandoffSummary(t *testing.T) {}}+func TestSessionStore_ListKeepsPatrolAssessmentHandoffIdentity(t *testing.T) {+ store, err := NewSessionStore(t.TempDir())+ if err != nil {+ t.Fatalf("failed to create session store: %v", err)+ }++ session, err := store.Create()+ if err != nil {+ t.Fatalf("failed to create session: %v", err)+ }++ if err := store.SetModelHandoffEnvelope(session.ID, "", "[Patrol Assessment Context]\nSource: Pulse Patrol current assessment", nil, []HandoffAction{{+ FindingID: "finding-123",+ ApprovalID: "approval-123",+ ApprovalStatus: "pending",+ FixID: "fix-123",+ Description: "Restart the workload service",+ RiskLevel: "high",+ TargetResourceID: "vm-100",+ }}, HandoffMetadata{+ Kind: "patrol_assessment",+ }); err != nil {+ t.Fatalf("SetModelHandoffEnvelope failed: %v", err)+ }++ sessions, err := store.List()+ if err != nil {+ t.Fatalf("List failed: %v", err)+ }+ if len(sessions) != 1 || sessions[0].HandoffSummary == nil {+ t.Fatalf("sessions = %#v, want one session with handoff summary", sessions)+ }++ summary := sessions[0].HandoffSummary+ if summary.Kind != sessionHandoffKindPatrolAssessment {+ t.Fatalf("handoff kind = %q, want %q", summary.Kind, sessionHandoffKindPatrolAssessment)+ }+ if summary.FindingID != "" {+ t.Fatalf("finding ID = %q, want assessment summary not pinned to one action finding", summary.FindingID)+ }+ if summary.ActionCount != 1 || !summary.RequiresApproval {+ t.Fatalf("action summary = %#v, want assessment action posture preserved", summary)+ }+ if summary.LastKnownApprovalStatus != "pending" || summary.LastKnownActionRisk != "high" {+ t.Fatalf("approval posture = %#v, want safe action summary", summary)+ }+}++func TestSessionStore_ListKeepsPatrolConfigurationFailureHandoffIdentity(t *testing.T) {+ store, err := NewSessionStore(t.TempDir())+ if err != nil {+ t.Fatalf("failed to create session store: %v", err)+ }++ session, err := store.Create()+ if err != nil {+ t.Fatalf("failed to create session: %v", err)+ }++ if err := store.SetModelHandoffEnvelope(session.ID, "", "[Patrol Configuration Failure Context]\nSource: Pulse Patrol configuration surface", nil, nil, HandoffMetadata{+ Kind: "patrol_configuration_failure",+ RuntimeFailure: true,+ }); err != nil {+ t.Fatalf("SetModelHandoffEnvelope failed: %v", err)+ }++ sessions, err := store.List()+ if err != nil {+ t.Fatalf("List failed: %v", err)+ }+ if len(sessions) != 1 || sessions[0].HandoffSummary == nil {+ t.Fatalf("sessions = %#v, want one session with handoff summary", sessions)+ }++ summary := sessions[0].HandoffSummary+ if summary.Kind != sessionHandoffKindPatrolConfigurationFailure || !summary.RuntimeFailure {+ t.Fatalf("handoff summary = %#v, want configuration failure runtime identity", summary)+ }+ if summary.RunID != "" || summary.RunStatus != "" {+ t.Fatalf("run fields = %#v, want no Patrol run identity for configuration failure", summary)+ }+}+func TestModelContextHandoffSummaryInfersPatrolRunMetadataForExistingSessions(t *testing.T) {summary := modelContextHandoffSummary(&sessionModelContext{HandoffContext: strings.Join([]string{diff --git a/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts b/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.tsindex edce47bcd8..9d88d0fa2a 100644--- a/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts+++ b/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts@@ -120,6 +120,37 @@ test.describe("Patrol Assistant operator briefing", () => {updated_at: "2026-05-06T12:10:00Z",},};+ const patrolAssessmentHandoffSession = {+ id: "session-patrol-assessment",+ title: "Assessment follow-up",+ created_at: "2026-05-06T12:05:00Z",+ updated_at: "2026-05-06T12:11:00Z",+ message_count: 1,+ handoff_summary: {+ kind: "patrol_assessment",+ has_model_context: true,+ resource_count: 2,+ action_count: 0,+ requires_approval: false,+ updated_at: "2026-05-06T12:11:00Z",+ },+ };+ const patrolConfigurationFailureHandoffSession = {+ id: "session-patrol-configuration",+ title: "Configuration follow-up",+ created_at: "2026-05-06T12:06:00Z",+ updated_at: "2026-05-06T12:12:00Z",+ message_count: 1,+ handoff_summary: {+ kind: "patrol_configuration_failure",+ runtime_failure: true,+ has_model_context: true,+ resource_count: 0,+ action_count: 0,+ requires_approval: false,+ updated_at: "2026-05-06T12:12:00Z",+ },+ };await page.route("**/api/security/status", async (route) => {await route.fulfill({@@ -220,6 +251,8 @@ test.describe("Patrol Assistant operator briefing", () => {handoffSession,contextOnlyHandoffSession,patrolRunHandoffSession,+ patrolAssessmentHandoffSession,+ patrolConfigurationFailureHandoffSession,]),});});@@ -661,6 +694,41 @@ test.describe("Patrol Assistant operator briefing", () => {runAssistantContext.getByText("No endpoints found"),).toHaveCount(0);+ await page.getByTitle("Pulse Assistant sessions").click();+ await expect(page.getByText("Assessment follow-up")).toBeVisible();+ await expect(page.getByText("Assessment context").last()).toBeVisible();+ await page.getByText("Assessment follow-up").click();++ const restoredAssessmentAssistantContext =+ page.getByLabel("Assistant context");+ await expect(restoredAssessmentAssistantContext).toBeVisible();+ await expect(restoredAssessmentAssistantContext).toContainText(+ "Patrol assessment handoff",+ );+ await expect(restoredAssessmentAssistantContext).toContainText(+ "Current Patrol assessment",+ );+ await expect(restoredAssessmentAssistantContext).toContainText(+ "Review Patrol assessment",+ );++ await page.getByTitle("Pulse Assistant sessions").click();+ await expect(page.getByText("Configuration follow-up")).toBeVisible();+ await expect(page.getByText("Runtime issue").last()).toBeVisible();+ await page.getByText("Configuration follow-up").click();++ const configurationAssistantContext = page.getByLabel("Assistant context");+ await expect(configurationAssistantContext).toBeVisible();+ await expect(configurationAssistantContext).toContainText(+ "Patrol configuration failure",+ );+ await expect(configurationAssistantContext).toContainText(+ "Patrol configuration",+ );+ await expect(configurationAssistantContext).toContainText(+ "Review Patrol configuration issue",+ );+includePendingApproval = false;await page.reload({ waitUntil: "domcontentloaded" });await expect(page.getByRole("button", { name: "Findings" })).toBeVisible();