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 Assistant workflow activity on completed turns
rcourtman4b826d5403b3
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 87cd93f750..b71eb1c02a 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -506,6 +506,19 @@ remain visible/inspectable.turns, and selected-provider startup. These events are runtime progress, notAssistant-authored analysis, and they must not become keyword routers,explore pre-passes, or instructions that choose the model's next action.+ Backend-emitted `workflow_state` rows that explain real provider, context, or+ tool progress must remain visible in chronological transcript order after the+ turn completes or fails; only local prompt placeholders such as initial+ send/wait rows and unresolved interactive rows such as approvals, questions,+ and pending tools are cleared on terminal events. The referenced OpenCode+ source at fetched `origin/dev` commit+ `914a643ab26053df463ef78a1deadcdb223e8783` writes step, tool, and text parts+ as soon as they arrive in `packages/opencode/src/session/processor.ts` lines+ 151-162, 322-339, 443-466, and 787-806, then renders completed text parts+ from stored part state in `packages/ui/src/components/message-part.tsx` lines+ 1545-1551; Pulse adapts that part-style visibility by preserving real+ workflow activity as evidence rather than collapsing it into an invisible+ wait state.Selected-provider startup copy must describe the provider route as activelystarting the response (for example, `<Provider> is starting the response.`)rather than as a passive wait label, while preserving the samediff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsxindex 83f4d3e035..a7e32a3541 100644--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx@@ -25,7 +25,7 @@ import { QuestionCard } from './QuestionCard';import { ThinkingBlock } from './ThinkingBlock';import { getAssistantAnswerText } from './assistantAnswerText';import { stripAssistantOutputArtifacts } from './assistantOutputHygiene';-import { formatAssistantWorkflowStatus, isInitialRequestStartStatus } from './activeTurnStatus';+import { formatAssistantWorkflowStatus } from './activeTurnStatus';import { groupStreamEventsForDisplay } from './streamEventGrouping';import { createPacedWorkflowStatus, workflowStatusRenderKey } from './workflowStatusPresentation';import type {@@ -262,10 +262,7 @@ export const MessageItem: Component<MessageItemProps> = (props) => {const isConcreteStreamActivity = (evt: StreamDisplayEvent) => {switch (evt.type) {case 'workflow_status':- return (- !isInitialRequestStartStatus(evt.workflowStatus) &&- !!formatAssistantWorkflowStatus(evt.workflowStatus)- );+ return !!formatAssistantWorkflowStatus(evt.workflowStatus);case 'thinking':return !!evt.thinking?.trim();case 'content':@@ -286,12 +283,8 @@ export const MessageItem: Component<MessageItemProps> = (props) => {return false;}};- const hasConcreteStreamActivity = createMemo(() =>- groupedEvents().some(isConcreteStreamActivity),- );const shouldRenderWorkflowStatusEvent = (evt: StreamDisplayEvent) =>- !!formatAssistantWorkflowStatus(evt.workflowStatus) &&- (!isInitialRequestStartStatus(evt.workflowStatus) || !hasConcreteStreamActivity());+ !!formatAssistantWorkflowStatus(evt.workflowStatus);const renderableWorkflowStatusEvents = createMemo(() =>groupedEvents().filter((evt) => evt.type === 'workflow_status' && shouldRenderWorkflowStatusEvent(evt),diff --git a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsxindex 7d3b0de831..a7951b66f4 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx@@ -969,6 +969,83 @@ describe('MessageItem', () => {expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();});+ it('keeps completed transcript workflow activity visible after the turn finishes', () => {+ render(() => (+ <MessageItem+ message={makeMessage({+ role: 'assistant',+ content: 'Inventory has 3 devices.',+ isStreaming: false,+ pendingTools: [],+ streamEvents: [+ {+ type: 'workflow_status',+ workflowStatus: {+ phase: 'provider_start',+ message: 'OpenRouter is starting the response.',+ },+ },+ { type: 'content', content: 'Inventory has 3 devices.' },+ ],+ })}+ {...makeHandlers()}+ />+ ));++ expect(screen.getByText('OpenRouter is starting the response.')).toBeInTheDocument();+ expect(screen.getByText('Inventory has 3 devices.')).toBeInTheDocument();+ expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();+ });++ it('keeps completed request-start activity visible beside skipped tool evidence', () => {+ render(() => (+ <MessageItem+ message={makeMessage({+ role: 'assistant',+ content:+ 'I could not inspect the current resource because no resource context was attached to this chat turn.',+ isStreaming: false,+ pendingTools: [],+ streamEvents: [+ {+ type: 'workflow_status',+ workflowStatus: {+ phase: 'request_start',+ message: 'Preparing Pulse context.',+ },+ },+ {+ type: 'tool_cancel',+ toolId: 'fixture-tool-skipped',+ toolCancel: {+ id: 'fixture-tool-skipped',+ name: 'pulse_read',+ input:+ '{"action":"exec","target_host":"current_resource","command":"ls /dev | wc -l"}',+ rawInput: 'pulse_read(target_host="current_resource", command="ls /dev | wc -l")',+ reason: 'current_resource unavailable',+ },+ },+ {+ type: 'content',+ content:+ 'I could not inspect the current resource because no resource context was attached to this chat turn.',+ },+ ],+ })}+ {...makeHandlers()}+ />+ ));++ expect(screen.getByText('Preparing Pulse context.')).toBeInTheDocument();+ expect(screen.getByText('current_resource unavailable')).toBeInTheDocument();+ expect(+ screen.getByText(+ 'I could not inspect the current resource because no resource context was attached to this chat turn.',+ ),+ ).toBeInTheDocument();+ });+it('does not show cursor when streaming but there are pending tools', () => {const { container } = render(() => (<MessageItemdiff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.tsindex 0c5ce917e5..346b7804f0 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts@@ -2603,6 +2603,22 @@ describe('useChat', () => {dispose();});+ it('done event removes local prompt progress when no backend activity arrived', async () => {+ const { getFireEvent } = setupWithEventCapture();+ const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));++ await chat.sendMessage('hi');+ const fire = getFireEvent();++ fire({ type: 'done', data: {} });++ const assistant = chat.messages().find((m) => m.role === 'assistant')!;+ expect(assistant.streamEvents ?? []).toEqual([]);+ expect(assistant.workflowStatus).toBeUndefined();+ expect(assistant.workflowStatusHistory).toBeUndefined();+ dispose();+ });+it('processes done event with alternative token key names', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -2617,7 +2633,7 @@ describe('useChat', () => {dispose();});- it('done event removes unresolved interactive rows and neutral workflow activity', async () => {+ it('done event removes unresolved interactive rows while preserving workflow activity', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -2658,7 +2674,19 @@ describe('useChat', () => {expect(assistant.pendingTools).toEqual([]);expect(assistant.pendingApprovals).toEqual([]);expect(assistant.pendingQuestions).toEqual([]);- expect(assistant.streamEvents?.map((event) => event.type)).toEqual(['content']);+ expect(assistant.streamEvents?.map((event) => event.type)).toEqual([+ 'workflow_status',+ 'content',+ ]);+ expect(assistant.streamEvents?.[0]).toEqual(+ expect.objectContaining({+ type: 'workflow_status',+ workflowStatus: expect.objectContaining({+ phase: 'provider_start',+ message: 'OpenRouter is starting the response.',+ }),+ }),+ );dispose();});@@ -2679,7 +2707,7 @@ describe('useChat', () => {dispose();});- it('error event removes unresolved interactive rows and neutral workflow activity', async () => {+ it('error event removes unresolved interactive rows while preserving workflow activity', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -2721,7 +2749,19 @@ describe('useChat', () => {expect(assistant.pendingTools).toEqual([]);expect(assistant.pendingApprovals).toEqual([]);expect(assistant.pendingQuestions).toEqual([]);- expect(assistant.streamEvents?.map((event) => event.type)).toEqual(['content']);+ expect(assistant.streamEvents?.map((event) => event.type)).toEqual([+ 'workflow_status',+ 'content',+ ]);+ expect(assistant.streamEvents?.[0]).toEqual(+ expect.objectContaining({+ type: 'workflow_status',+ workflowStatus: expect.objectContaining({+ phase: 'provider_start',+ message: 'OpenRouter is starting the response.',+ }),+ }),+ );dispose();});@@ -3866,6 +3906,13 @@ describe('useChat', () => {await chat.sendMessage('hi');const fire = getFireEvent();+ fire({+ type: 'workflow_state',+ data: {+ phase: 'provider_start',+ message: 'OpenRouter is starting the response.',+ },+ });fire({ type: 'tool_start', data: { id: 'a', name: 'pulse_read', input: '{}' } });let assistant = chat.messages().find((m) => m.role === 'assistant')!;@@ -3885,6 +3932,15 @@ describe('useChat', () => {expect(assistant.streamEvents?.filter((event) => event.type === 'pending_tool')).toHaveLength(0,);+ expect(assistant.streamEvents?.[0]).toEqual(+ expect.objectContaining({+ type: 'workflow_status',+ workflowStatus: expect.objectContaining({+ phase: 'provider_start',+ message: 'OpenRouter is starting the response.',+ }),+ }),+ );expect(assistant.streamEvents?.filter((event) => event.type === 'tool_cancel')).toEqual([expect.objectContaining({type: 'tool_cancel',diff --git a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts b/frontend-modern/src/components/AI/Chat/hooks/useChat.tsindex c9b4419ae4..ce2025c07c 100644--- a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts+++ b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts@@ -257,13 +257,6 @@ export function useChat(options: UseChatOptions = {}) {return promise;};- const streamEventsWithoutWorkflowStatusRows = (- events: StreamDisplayEvent[] | undefined,- ): StreamDisplayEvent[] | undefined => {- if (!events) return events;- return events.filter((event) => event.type !== 'workflow_status');- };-const isLocalPromptProgressEvent = (event: StreamDisplayEvent) =>event.type === 'workflow_status' &&(event.workflowStatus?.phase === 'request_send' ||@@ -273,16 +266,15 @@ export function useChat(options: UseChatOptions = {}) {events: StreamDisplayEvent[] | undefined,): StreamDisplayEvent[] => (events || []).filter((event) => !isLocalPromptProgressEvent(event));- const streamEventsWithoutTransientRows = (+ const streamEventsWithoutUnresolvedInteractiveRows = (events: StreamDisplayEvent[] | undefined,): StreamDisplayEvent[] | undefined => {if (!events) return events;- return events.filter(+ return streamEventsWithoutLocalPromptProgressRows(events).filter((event) =>event.type !== 'pending_tool' &&event.type !== 'approval' &&- event.type !== 'question' &&- event.type !== 'workflow_status',+ event.type !== 'question',);};@@ -310,7 +302,7 @@ export function useChat(options: UseChatOptions = {}) {pendingApprovals: [],pendingQuestions: [],streamEvents: interruption- ? streamEventsWithoutTransientRows(msg.streamEvents)+ ? streamEventsWithoutUnresolvedInteractiveRows(msg.streamEvents): msg.streamEvents,workflowStatus: undefined,workflowStatusHistory: undefined,@@ -1379,7 +1371,7 @@ export function useChat(options: UseChatOptions = {}) {workflowStatusHistory: undefined,pendingTools: pendingTools.filter((tool) => !matchesTool(tool, tool.id)),streamEvents: replacePendingToolWithCancelEvent(- streamEventsWithoutWorkflowStatusRows(msg.streamEvents || []) || [],+ streamEventsWithoutLocalPromptProgressRows(msg.streamEvents),{...resolvedTool,updatedAt: now,@@ -1706,7 +1698,9 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: [],pendingApprovals: [],pendingQuestions: [],- streamEvents: streamEventsWithoutTransientRows(flushedMsg.streamEvents),+ streamEvents: streamEventsWithoutUnresolvedInteractiveRows(+ flushedMsg.streamEvents,+ ),tokens,workflowStatus: undefined,workflowStatusHistory: undefined,@@ -1720,7 +1714,9 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: [],pendingApprovals: [],pendingQuestions: [],- streamEvents: streamEventsWithoutTransientRows(flushedMsg.streamEvents),+ streamEvents: streamEventsWithoutUnresolvedInteractiveRows(+ flushedMsg.streamEvents,+ ),workflowStatus: undefined,workflowStatusHistory: undefined,};@@ -1738,7 +1734,7 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: [],pendingApprovals: [],pendingQuestions: [],- streamEvents: streamEventsWithoutTransientRows(msg.streamEvents),+ streamEvents: streamEventsWithoutUnresolvedInteractiveRows(msg.streamEvents),workflowStatus: undefined,workflowStatusHistory: undefined,error: errorMsg || 'Request failed',@@ -1969,7 +1965,7 @@ export function useChat(options: UseChatOptions = {}) {pendingTools: [],pendingApprovals: [],pendingQuestions: [],- streamEvents: streamEventsWithoutTransientRows(msg.streamEvents),+ streamEvents: streamEventsWithoutUnresolvedInteractiveRows(msg.streamEvents),workflowStatus: undefined,workflowStatusHistory: undefined,error: errorMessage,