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.

Restore Assistant handoff session summaries

rcourtman296251461630
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 5cda02698e..90ebe4f8ff 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -79,7 +79,10 @@ runtime cost control, and shared AI transport surfaces.
instead of generic dashboard briefs. Source-owned handoff helpers may attach
bounded suggested prompts to that briefing, but those prompts are only input
starters; they must not auto-submit, bypass approval mode, or carry raw
- command payloads.
+ command payloads. Reloaded Assistant sessions may consume the backend-owned
+ `handoff_summary` only as safe presentation state and a Patrol finding
+ pointer; hidden model context, command payloads, preflight data, and action
+ results stay backend-owned and must not be reconstructed in the browser.
9. Add or change public AI overview wording through `docs/AI.md`; it may
describe Assistant and Patrol capabilities, but it must not revive legacy
commercial shorthand such as `incident memory` as a current product promise.
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index dc08fdd9a3..9b8402210a 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -196,6 +196,11 @@ product API routes free of maintainer commercial analytics.
page-local payload ownership.
32. `internal/api/agent_install_command_shared.go` shared with `agent-lifecycle`: agent install command assembly is both an agent lifecycle control surface and a canonical API payload contract boundary.
33. `internal/api/ai_handler.go` shared with `ai-runtime`: Pulse Assistant handlers are both an AI runtime control surface and a canonical API payload contract boundary.
+ Assistant session list payloads may expose only the safe
+ `handoff_summary` projection needed by the browser to mark and restore a
+ scoped handoff. The payload must not expose provider-bound model context,
+ raw commands, preflight output, action results, or remediation command
+ descriptions.
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.md
index 38ad32b4d4..ae11ef502d 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -177,6 +177,11 @@ work extends shared components instead of creating new local variants.
6. `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx` shared with `security-privacy`: the security overview settings surface is both a security/privacy control surface and a canonical settings-shell presentation boundary.
7. `frontend-modern/src/routing/routePreload.ts` shared with `performance-and-scalability`: the app-shell route preload registry is both a canonical frontend shell boundary and an authenticated hot-path performance boundary.
8. `frontend-modern/src/stores/aiChat.ts` shared with `ai-runtime`: the assistant drawer and session store is both an AI runtime control surface and a canonical app-shell presentation boundary.
+ Assistant session pickers and reloads must restore only safe
+ `handoff_summary` presentation state from the session list. Loading a plain
+ session or starting a new conversation must clear stale scoped handoff
+ briefing state so Patrol and alert context does not visually leak between
+ conversations.
9. `frontend-modern/src/utils/platformSupportManifest.generated.ts` shared with `unified-resources`: the generated platform support projection is both a canonical unified-resource platform union boundary and a shared frontend source/platform vocabulary boundary.
10. `frontend-modern/src/utils/sourcePlatforms.ts` shared with `unified-resources`: the source platform normalizer is both a canonical unified-resource source adapter boundary and a shared frontend source/platform vocabulary boundary.
That shared boundary must preserve `availability` as the agentless
diff --git a/frontend-modern/src/api/__tests__/aiChat.test.ts b/frontend-modern/src/api/__tests__/aiChat.test.ts
index 9d74da5f62..2d0b0ffd8c 100644
--- a/frontend-modern/src/api/__tests__/aiChat.test.ts
+++ b/frontend-modern/src/api/__tests__/aiChat.test.ts
@@ -15,14 +15,48 @@ vi.mock('@/utils/logger', () => ({
}));
import { AIChatAPI } from '@/api/aiChat';
-import { apiFetch } from '@/utils/apiClient';
+import { apiFetch, apiFetchJSON } from '@/utils/apiClient';
import { logger } from '@/utils/logger';
describe('AIChatAPI', () => {
const apiFetchMock = vi.mocked(apiFetch);
+ const apiFetchJSONMock = vi.mocked(apiFetchJSON);
beforeEach(() => {
apiFetchMock.mockReset();
+ apiFetchJSONMock.mockReset();
+ });
+
+ it('preserves safe handoff summaries on listed chat sessions', async () => {
+ const session = {
+ id: 'session-operator-briefing',
+ title: 'High CPU follow-up',
+ created_at: '2026-05-06T12:00:00Z',
+ updated_at: '2026-05-06T12:08:00Z',
+ message_count: 2,
+ handoff_summary: {
+ kind: 'patrol_finding',
+ finding_id: 'finding-operator-briefing',
+ has_model_context: true,
+ resource_count: 1,
+ primary_resource: {
+ id: 'host:web-server',
+ name: 'web-server',
+ type: 'host',
+ node: 'pve-1',
+ },
+ action_count: 1,
+ requires_approval: true,
+ last_known_approval_status: 'pending',
+ last_known_action_state: 'awaiting_approval',
+ last_known_action_risk: 'high',
+ updated_at: '2026-05-06T12:08:00Z',
+ },
+ };
+ apiFetchJSONMock.mockResolvedValueOnce([session]);
+
+ await expect(AIChatAPI.listSessions()).resolves.toEqual([session]);
+ expect(apiFetchJSONMock).toHaveBeenCalledWith('/api/ai/sessions');
});
it('clears read timeout timers when chat stream reads complete', async () => {
diff --git a/frontend-modern/src/api/aiChat.ts b/frontend-modern/src/api/aiChat.ts
index 40c5b0395f..fa942cee45 100644
--- a/frontend-modern/src/api/aiChat.ts
+++ b/frontend-modern/src/api/aiChat.ts
@@ -12,6 +12,7 @@ export interface ChatSession {
created_at: string;
updated_at: string;
message_count: number;
+ handoff_summary?: ChatSessionHandoffSummary;
}
export type ChatMentionType = 'vm' | 'system-container' | 'app-container' | 'agent' | 'storage';
@@ -30,6 +31,27 @@ export interface ChatHandoffResource {
node?: string;
}
+export interface ChatSessionHandoffResource {
+ id?: string;
+ name?: string;
+ type?: string;
+ node?: string;
+}
+
+export interface ChatSessionHandoffSummary {
+ kind?: string;
+ finding_id?: string;
+ has_model_context: boolean;
+ resource_count?: number;
+ primary_resource?: ChatSessionHandoffResource;
+ action_count?: number;
+ requires_approval?: boolean;
+ last_known_approval_status?: string;
+ last_known_action_state?: string;
+ last_known_action_risk?: string;
+ updated_at?: string;
+}
+
export interface ChatHandoffAction {
findingId?: string;
recordId?: string;
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
index cd08713434..84f75de1b9 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -72,18 +72,20 @@ const {
error: vi.fn(),
};
+ const emptyChatContext = () => ({
+ initialPrompt: undefined,
+ findingId: undefined,
+ autonomousMode: undefined,
+ context: undefined,
+ briefing: undefined,
+ handoffContext: undefined,
+ handoffResources: undefined,
+ handoffActions: undefined,
+ });
+
const mockAiChatStore = {
isOpenSignal: vi.fn(() => true),
- context: {
- initialPrompt: undefined,
- findingId: undefined,
- autonomousMode: undefined,
- context: undefined,
- briefing: undefined,
- handoffContext: undefined,
- handoffResources: undefined,
- handoffActions: undefined,
- } as {
+ context: emptyChatContext() as {
initialPrompt?: string;
findingId?: string;
autonomousMode?: boolean;
@@ -113,6 +115,12 @@ const {
suggestedPrompts?: string[];
};
},
+ setContext: vi.fn((context: any) => {
+ mockAiChatStore.context = context;
+ }),
+ clearContext: vi.fn(() => {
+ mockAiChatStore.context = emptyChatContext();
+ }),
clearInitialPrompt: vi.fn(),
clearFindingId: vi.fn(),
};
@@ -531,6 +539,24 @@ describe('AIChat', () => {
});
});
+ it('clears scoped handoff context when starting a new session', async () => {
+ mockAiChatStore.context = {
+ findingId: 'finding-old',
+ autonomousMode: false,
+ briefing: {
+ sourceLabel: 'Pulse Patrol',
+ title: 'Old finding handoff',
+ },
+ };
+
+ renderChat();
+ fireEvent.click(screen.getByText('New'));
+
+ await waitFor(() => {
+ expect(mockAiChatStore.clearContext).toHaveBeenCalledTimes(1);
+ });
+ });
+
it('opens session picker on click', () => {
renderChat();
fireEvent.click(screen.getByTitle('Pulse Assistant sessions'));
@@ -571,6 +597,92 @@ describe('AIChat', () => {
fireEvent.click(screen.getByText('Session One'));
expect(mockChat.loadSession).toHaveBeenCalledWith('s1');
});
+
+ it('restores safe Patrol handoff state from a loaded session summary', async () => {
+ mockAIChatAPI.listSessions.mockResolvedValue([
+ {
+ id: 's-patrol',
+ title: 'High CPU follow-up',
+ created_at: '',
+ updated_at: '',
+ message_count: 4,
+ handoff_summary: {
+ kind: 'patrol_finding',
+ finding_id: 'finding-operator-briefing',
+ has_model_context: true,
+ resource_count: 1,
+ primary_resource: {
+ id: 'host:web-server',
+ name: 'web-server',
+ type: 'host',
+ node: 'pve-1',
+ },
+ action_count: 1,
+ requires_approval: true,
+ last_known_approval_status: 'pending',
+ last_known_action_state: 'awaiting_approval',
+ last_known_action_risk: 'medium',
+ },
+ },
+ ]);
+
+ renderChat();
+ await waitFor(() => {
+ expect(mockAIChatAPI.listSessions).toHaveBeenCalled();
+ });
+ fireEvent.click(screen.getByTitle('Pulse Assistant sessions'));
+
+ expect(screen.getByText('Pulse Patrol')).toBeInTheDocument();
+ expect(screen.getByText('Approval required')).toBeInTheDocument();
+ expect(screen.getByText(/approval pending/)).toBeInTheDocument();
+
+ fireEvent.click(screen.getByText('High CPU follow-up'));
+
+ await waitFor(() => {
+ expect(mockChat.loadSession).toHaveBeenCalledWith('s-patrol');
+ expect(mockAiChatStore.setContext).toHaveBeenCalledWith(
+ expect.objectContaining({
+ findingId: 'finding-operator-briefing',
+ autonomousMode: false,
+ briefing: expect.objectContaining({
+ sourceLabel: 'Pulse Patrol',
+ title: 'Patrol finding on web-server',
+ subject: 'Finding finding-operator-briefing',
+ actionLabel: 'Approval required',
+ }),
+ }),
+ );
+ });
+ const restoredContext = mockAiChatStore.setContext.mock.calls[0]?.[0];
+ expect(restoredContext.handoffContext).toBeUndefined();
+ expect(restoredContext.handoffActions).toBeUndefined();
+ });
+
+ it('clears stale handoff context when loading a plain session', async () => {
+ mockAiChatStore.context = {
+ findingId: 'finding-old',
+ autonomousMode: false,
+ briefing: {
+ sourceLabel: 'Pulse Patrol',
+ title: 'Old finding handoff',
+ },
+ };
+ mockAIChatAPI.listSessions.mockResolvedValue([
+ { id: 's1', title: 'Session One', created_at: '', updated_at: '', message_count: 5 },
+ ]);
+
+ renderChat();
+ await waitFor(() => {
+ expect(mockAIChatAPI.listSessions).toHaveBeenCalled();
+ });
+ fireEvent.click(screen.getByTitle('Pulse Assistant sessions'));
+ fireEvent.click(screen.getByText('Session One'));
+
+ await waitFor(() => {
+ expect(mockChat.loadSession).toHaveBeenCalledWith('s1');
+ expect(mockAiChatStore.clearContext).toHaveBeenCalledTimes(1);
+ });
+ });
});
// ── Initialization (onMount) ─────────────────────────────────────────
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index b332a17d47..5eeda9338c 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -10,9 +10,9 @@ import {
} from 'solid-js';
import { unwrap } from 'solid-js/store';
import { AIAPI } from '@/api/ai';
-import { AIChatAPI, type ChatSession } from '@/api/aiChat';
+import { AIChatAPI, type ChatSession, type ChatSessionHandoffSummary } from '@/api/aiChat';
import { notificationStore } from '@/stores/notifications';
-import { aiChatStore } from '@/stores/aiChat';
+import { aiChatStore, type AIChatContext } from '@/stores/aiChat';
import {
aiRuntimeModels,
aiRuntimeModelsError,
@@ -72,6 +72,128 @@ interface AIChatProps {
onClose: () => void;
}
+const compactText = (items: Array<string | undefined>): string[] =>
+ items.filter((item): item is string => typeof item === 'string' && item.trim().length > 0);
+
+const pluralizeCount = (count: number, singular: string, plural: string) =>
+ `${count} ${count === 1 ? singular : plural}`;
+
+const isPatrolSessionHandoff = (summary: ChatSessionHandoffSummary) =>
+ summary.kind === 'patrol_finding' || Boolean(summary.finding_id);
+
+const getSessionHandoffSourceLabel = (summary: ChatSessionHandoffSummary) =>
+ isPatrolSessionHandoff(summary) ? 'Pulse Patrol' : 'Pulse Assistant';
+
+const formatSessionHandoffResourceLabel = (summary: ChatSessionHandoffSummary) => {
+ const resource = summary.primary_resource;
+ const label = resource?.name?.trim() || resource?.id?.trim() || '';
+ if (label) return label;
+ return formatIdentifierLabel(resource?.type, { fallback: '' });
+};
+
+const formatSessionHandoffResourceDetail = (summary: ChatSessionHandoffSummary) => {
+ const label = formatSessionHandoffResourceLabel(summary);
+ const node = summary.primary_resource?.node?.trim();
+ if (label && node) return `${label} on ${node}`;
+ return label;
+};
+
+const formatSessionHandoffStatus = (summary: ChatSessionHandoffSummary) =>
+ compactText([
+ summary.last_known_approval_status
+ ? `approval ${formatIdentifierLabel(summary.last_known_approval_status)}`
+ : undefined,
+ summary.last_known_action_state
+ ? `action ${formatIdentifierLabel(summary.last_known_action_state)}`
+ : undefined,
+ summary.last_known_action_risk
+ ? `${formatIdentifierLabel(summary.last_known_action_risk)} risk`
+ : undefined,
+ ]).join(' · ');
+
+const getSessionHandoffBadgeLabel = (summary: ChatSessionHandoffSummary) => {
+ if (summary.requires_approval) return 'Approval required';
+ if ((summary.action_count ?? 0) > 0) return 'Action context';
+ return summary.has_model_context ? 'Context attached' : 'Scoped handoff';
+};
+
+const buildSessionHandoffContext = (session?: ChatSession): AIChatContext | undefined => {
+ const summary = session?.handoff_summary;
+ if (!summary) return undefined;
+
+ const sourceLabel = getSessionHandoffSourceLabel(summary);
+ const resourceLabel = formatSessionHandoffResourceLabel(summary);
+ const resourceDetail = formatSessionHandoffResourceDetail(summary);
+ const statusLabel = formatSessionHandoffStatus(summary);
+ const actionCount = summary.action_count ?? 0;
+ const resourceCount = summary.resource_count ?? 0;
+ const findingId = summary.finding_id?.trim() || undefined;
+ const requiresApproval = Boolean(summary.requires_approval || actionCount > 0);
+ const isPatrol = isPatrolSessionHandoff(summary);
+ const title = isPatrol
+ ? resourceLabel
+ ? `Patrol finding on ${resourceLabel}`
+ : findingId
+ ? `Patrol finding ${findingId}`
+ : 'Patrol finding handoff'
+ : resourceLabel
+ ? `Assistant handoff for ${resourceLabel}`
+ : 'Assistant handoff';
+
+ return {
+ targetType: summary.primary_resource?.type,
+ targetId: summary.primary_resource?.id,
+ context: {
+ source: 'session_handoff_summary',
+ kind: summary.kind,
+ findingId,
+ hasModelContext: summary.has_model_context,
+ resourceCount,
+ actionCount,
+ requiresApproval: summary.requires_approval ?? false,
+ lastKnownApprovalStatus: summary.last_known_approval_status,
+ lastKnownActionState: summary.last_known_action_state,
+ lastKnownActionRisk: summary.last_known_action_risk,
+ updatedAt: summary.updated_at,
+ },
+ findingId,
+ ...(requiresApproval ? { autonomousMode: false } : {}),
+ briefing: {
+ sourceLabel,
+ title,
+ subject: findingId ? `Finding ${findingId}` : undefined,
+ statusLabel: statusLabel || (summary.requires_approval ? 'approval required' : undefined),
+ detailLines: compactText([
+ resourceDetail ? `Resource: ${resourceDetail}` : undefined,
+ resourceCount > 1
+ ? pluralizeCount(resourceCount, 'linked resource', 'linked resources')
+ : undefined,
+ actionCount > 0
+ ? pluralizeCount(actionCount, 'governed action', 'governed actions')
+ : undefined,
+ summary.requires_approval ? 'Approval required before action' : undefined,
+ ]),
+ actionLabel: summary.requires_approval
+ ? 'Approval required'
+ : actionCount > 0
+ ? 'Governed action context'
+ : undefined,
+ commandSummary: statusLabel ? `Last known state: ${statusLabel}` : undefined,
+ safetyNote:
+ actionCount > 0
+ ? 'Detailed command payloads stay in governed approval context.'
+ : undefined,
+ suggestedPrompts: isPatrol
+ ? [
+ '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?'],
+ },
+ };
+};
+
/**
* AIChat - Main chat panel component.
*
@@ -785,12 +907,20 @@ export const AIChat: Component<AIChatProps> = (props) => {
// New conversation
const handleNewConversation = async () => {
await chat.newSession();
+ aiChatStore.clearContext?.();
setShowSessions(false);
};
// Load session
const handleLoadSession = async (sessionId: string) => {
+ const session = sessions().find((candidate) => candidate.id === sessionId);
await chat.loadSession(sessionId);
+ const restoredContext = buildSessionHandoffContext(session);
+ if (restoredContext) {
+ aiChatStore.setContext(restoredContext);
+ } else {
+ aiChatStore.clearContext?.();
+ }
setShowSessions(false);
};
@@ -1085,6 +1215,25 @@ export const AIChat: Component<AIChatProps> = (props) => {
<div class="text-xs text-muted">
{session.message_count} messages
</div>
+ <Show when={session.handoff_summary}>
+ {(summary) => (
+ <div class="mt-1 flex max-w-full flex-wrap gap-1.5">
+ <span class="rounded border border-blue-200 bg-blue-50 px-1.5 py-0.5 text-[10px] font-medium text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200">
+ {getSessionHandoffSourceLabel(summary())}
+ </span>
+ <span class="rounded border border-border bg-surface-alt px-1.5 py-0.5 text-[10px] text-muted">
+ {getSessionHandoffBadgeLabel(summary())}
+ </span>
+ <Show when={formatSessionHandoffStatus(summary())}>
+ {(status) => (
+ <span class="max-w-full truncate rounded border border-border bg-surface-alt px-1.5 py-0.5 text-[10px] text-muted">
+ {status()}
+ </span>
+ )}
+ </Show>
+ </div>
+ )}
+ </Show>
</div>
<button
type="button"
diff --git a/frontend-modern/src/types/ai.ts b/frontend-modern/src/types/ai.ts
index e1f1d98bd6..49b04ea2ef 100644
--- a/frontend-modern/src/types/ai.ts
+++ b/frontend-modern/src/types/ai.ts
@@ -332,10 +332,32 @@ export interface AIChatSession {
}
// Summary returned by list endpoint (no messages)
+export interface AIChatSessionHandoffResource {
+ id?: string;
+ name?: string;
+ type?: string;
+ node?: string;
+}
+
+export interface AIChatSessionHandoffSummary {
+ kind?: string;
+ finding_id?: string;
+ has_model_context: boolean;
+ resource_count?: number;
+ primary_resource?: AIChatSessionHandoffResource;
+ action_count?: number;
+ requires_approval?: boolean;
+ last_known_approval_status?: string;
+ last_known_action_state?: string;
+ last_known_action_risk?: string;
+ updated_at?: string;
+}
+
export interface AIChatSessionSummary {
id: string;
title: string;
message_count: number;
created_at: string;
updated_at: string;
+ handoff_summary?: AIChatSessionHandoffSummary;
}
diff --git a/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts b/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts
index 87c46e69ff..203668780c 100644
--- a/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts
+++ b/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts
@@ -50,6 +50,31 @@ test.describe("Patrol Assistant operator briefing", () => {
let includePendingApproval = true;
let includeUnifiedInvestigationRecord = true;
let includeInvestigationProposedFix = false;
+ const handoffSession = {
+ id: "session-operator-briefing",
+ title: "High CPU follow-up",
+ created_at: "2026-05-06T12:00:00Z",
+ updated_at: "2026-05-06T12:08:00Z",
+ message_count: 2,
+ handoff_summary: {
+ kind: "patrol_finding",
+ finding_id: "finding-operator-briefing",
+ has_model_context: true,
+ resource_count: 1,
+ primary_resource: {
+ id: "host:web-server",
+ name: "web-server",
+ type: "host",
+ node: "pve-1",
+ },
+ action_count: 1,
+ requires_approval: true,
+ last_known_approval_status: "pending",
+ last_known_action_state: "awaiting_approval",
+ last_known_action_risk: "high",
+ updated_at: "2026-05-06T12:08:00Z",
+ },
+ };
await page.route("**/api/security/status", async (route) => {
await route.fulfill({
@@ -122,6 +147,21 @@ test.describe("Patrol Assistant operator briefing", () => {
});
});
+ await page.route("**/api/ai/sessions/*/messages", async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify([
+ {
+ id: "msg-operator-briefing",
+ role: "assistant",
+ content: "Previous governed finding context.",
+ timestamp: "2026-05-06T12:08:00Z",
+ },
+ ]),
+ });
+ });
+
await page.route("**/api/ai/sessions", async (route) => {
if (route.request().method() !== "GET") {
await route.continue();
@@ -131,7 +171,7 @@ test.describe("Patrol Assistant operator briefing", () => {
await route.fulfill({
status: 200,
contentType: "application/json",
- body: JSON.stringify([]),
+ body: JSON.stringify([handoffSession]),
});
});
@@ -447,7 +487,7 @@ test.describe("Patrol Assistant operator briefing", () => {
await expect(assessmentAssistantContext).toContainText("High risk");
await expect(
assessmentAssistantContext.getByRole("button", {
- name: "Summarize governed remediation risks",
+ name: "Review pending approvals and safest next step",
}),
).toBeVisible();
await expect(
@@ -509,6 +549,28 @@ test.describe("Patrol Assistant operator briefing", () => {
await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
+ await page.getByTitle("Pulse Assistant sessions").click();
+ await expect(page.getByText("High CPU follow-up")).toBeVisible();
+ await expect(page.getByText("Pulse Patrol").last()).toBeVisible();
+ await expect(page.getByText("Approval required").last()).toBeVisible();
+ await expect(page.getByText(/approval pending/).last()).toBeVisible();
+ await page.getByText("High CPU follow-up").click();
+
+ const reloadedAssistantContext = page.getByLabel("Assistant context");
+ await expect(reloadedAssistantContext).toBeVisible();
+ await expect(reloadedAssistantContext).toContainText(
+ "Patrol finding on web-server",
+ );
+ await expect(reloadedAssistantContext).toContainText(
+ "Finding finding-operator-briefing",
+ );
+ await expect(reloadedAssistantContext).toContainText(
+ "Last known state: approval pending",
+ );
+ await expect(
+ reloadedAssistantContext.getByText("systemctl restart workload.service"),
+ ).toHaveCount(0);
+
includePendingApproval = false;
await page.reload({ waitUntil: "domcontentloaded" });
await expect(page.getByRole("button", { name: "Findings" })).toBeVisible();