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
Make Assistant idle liveness route-aware
rcourtman23f520f7e739
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex e67d407f5b..cd4bcf89c1 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -1190,7 +1190,10 @@ remain visible/inspectable.status/header status rather than a dead-looking wait state or a dumped listof transient phases. Hide or collapse unsafe details and bulky outputs, butdo not hide the fact that Pulse is running a local read, invoking a governed- tool, or waiting on a provider. If a query-only+ tool, or waiting on a provider. Stream-idle heartbeats must inherit the+ selected provider/model route when Pulse has that route, so the visible row+ reads as route-specific liveness instead of falling back to generic+ Assistant waiting copy. If a query-onlyturn still reaches a model-owned `pulse_query` topology call, omitting`summary_only` must default to summary-only before execution; detailedtopology remains available in the full governed path or when the model@@ -2199,6 +2202,11 @@ transcript row and the active-turn composer footer so the two live surfaces showthe latest canonical workflow state immediately. The transcript and footertherefore show current motion while the provider is starting, retrying, orreasoning, but completed answers do not retain stale internal-progress prose.+Stream-idle heartbeats are part of that same visible workflow state. When the+frontend knows the selected provider/model route from the backend workflow event+or the streaming assistant message, the idle heartbeat must render as+route-specific liveness such as `OpenRouter is still working; waiting for more+response data.` instead of reverting to generic Assistant waiting copy.Prompt dispatch itself is also a visible live state: before any backendworkflow event returns, the frontend seeds the active assistant turn with alocal `request_send` / `Sending prompt.` workflow row after any selected-modeldiff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.tsindex 3e367adeff..5d4fa41e25 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts@@ -1563,6 +1563,8 @@ describe('useChat', () => {data: {phase: 'provider_start',message: 'OpenRouter is starting the response.',+ provider: 'openrouter',+ model: 'openrouter:qwen/qwen3.7-plus',},});fire({@@ -1577,18 +1579,61 @@ describe('useChat', () => {expect(assistant.workflowStatus).toEqual(expect.objectContaining({phase: 'stream_idle',- message: 'Assistant is still working; waiting for the next stream event.',+ message: 'OpenRouter is still working; waiting for more response data.',+ provider: 'openrouter',+ model: 'openrouter:qwen/qwen3.7-plus',}),);- expect(assistant.streamEvents).toHaveLength(1);- expect(assistant.streamEvents?.[0]).toEqual(+ expect(assistant.streamEvents?.filter((event) => event.type === 'model_switch')).toEqual([+ expect.objectContaining({+ type: 'model_switch',+ model: 'openrouter:qwen/qwen3.7-plus',+ modelEvent: 'selected',+ }),+ ]);+ expect(assistant.streamEvents?.filter((event) => event.type === 'workflow_status')).toEqual([expect.objectContaining({type: 'workflow_status',workflowStatus: expect.objectContaining({phase: 'stream_idle',- message: 'Assistant is still working; waiting for the next stream event.',+ message: 'OpenRouter is still working; waiting for more response data.',+ provider: 'openrouter',+ model: 'openrouter:qwen/qwen3.7-plus',}),}),+ ]);++ dispose();+ });++ it('uses the selected model route in idle progress before provider startup confirms the route', async () => {+ const { getFireEvent } = setupWithEventCapture();+ const { value: chat, dispose } = withRoot(() =>+ useChat({+ sessionId: 's',+ defaultModel: () => 'openrouter:qwen/qwen3.7-plus',+ }),+ );++ await chat.sendMessage('hi');+ const fire = getFireEvent();++ fire({+ type: 'workflow_state',+ data: {+ phase: 'stream_idle',+ message: 'Assistant is still working; waiting for the next stream event.',+ },+ });++ const assistant = chat.messages().find((m) => m.role === 'assistant')!;+ expect(assistant.workflowStatus).toEqual(+ expect.objectContaining({+ phase: 'stream_idle',+ message: 'OpenRouter is still working; waiting for more response data.',+ provider: 'openrouter',+ model: 'openrouter:qwen/qwen3.7-plus',+ }),);dispose();diff --git a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts b/frontend-modern/src/components/AI/Chat/hooks/useChat.tsindex 3d452529f8..5e447bd833 100644--- a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts+++ b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts@@ -11,6 +11,7 @@ import {import { notificationStore } from '@/stores/notifications';import { logger } from '@/utils/logger';import { normalizeChatToolName } from '@/utils/chatIdentifiers';+import { getAIProviderDisplayName, getProviderFromModelId } from '@/utils/aiProviderPresentation';import {appendVisibleTextBeforeAssistantOutputArtifacts,createAssistantOutputArtifactStreamState,@@ -167,6 +168,8 @@ export function useChat(options: UseChatOptions = {}) {a.message === b.message &&(a.state || '') === (b.state || '') &&(a.tool || '') === (b.tool || '') &&+ (a.provider || '') === (b.provider || '') &&+ (a.model || '') === (b.model || '') &&(a.attempt || 0) === (b.attempt || 0) &&(a.maxAttempts || 0) === (b.maxAttempts || 0) &&(a.retryAfterMs || 0) === (b.retryAfterMs || 0);@@ -185,13 +188,38 @@ export function useChat(options: UseChatOptions = {}) {const isStreamIdleWorkflowStatus = (status?: WorkflowStatus) => status?.phase === 'stream_idle';+ const workflowStatusProvider = (+ message: Pick<ChatMessage, 'model' | 'workflowStatus'> | undefined,+ status: WorkflowStatus | undefined,+ ) => {+ const provider = status?.provider?.trim() || message?.workflowStatus?.provider?.trim();+ if (provider) return provider;+ const model =+ status?.model?.trim() || message?.workflowStatus?.model?.trim() || message?.model?.trim();+ return model ? getProviderFromModelId(model) : '';+ };+// stream_idle is transport liveness, but it must be visible as the latest// active progress state instead of leaving the user on a stale phase label.const visibleWorkflowStatusForHeartbeat = (- _current: WorkflowStatus | undefined,+ message: Pick<ChatMessage, 'model' | 'workflowStatus'> | undefined,next: WorkflowStatus,): WorkflowStatus => {- return next;+ if (!isStreamIdleWorkflowStatus(next)) return next;++ const provider = workflowStatusProvider(message, next);+ if (!provider) return next;++ return {+ ...next,+ provider,+ model:+ next.model?.trim() ||+ message?.workflowStatus?.model?.trim() ||+ message?.model?.trim() ||+ undefined,+ message: `${getAIProviderDisplayName(provider)} is still working; waiting for more response data.`,+ };};const setAssistantWorkflowStatus = (@@ -204,7 +232,7 @@ export function useChat(options: UseChatOptions = {}) {prev.map((msg) => {if (msg.id !== assistantId) return msg;if (msg.isStreaming === false) return msg;- const visibleStatus = visibleWorkflowStatusForHeartbeat(msg.workflowStatus, workflowStatus);+ const visibleStatus = visibleWorkflowStatusForHeartbeat(msg, workflowStatus);if (workflowStatusesMatch(msg.workflowStatus, visibleStatus)) return msg;return { ...msg, workflowStatus: visibleStatus };}),@@ -236,12 +264,14 @@ export function useChat(options: UseChatOptions = {}) {return events.filter((event) => event.type !== 'workflow_status');};- const isLocalPromptSendEvent = (event: StreamDisplayEvent) =>- event.type === 'workflow_status' && event.workflowStatus?.phase === 'request_send';+ const isLocalPromptProgressEvent = (event: StreamDisplayEvent) =>+ event.type === 'workflow_status' &&+ (event.workflowStatus?.phase === 'request_send' ||+ event.workflowStatus?.phase === 'request_wait');- const streamEventsWithoutLocalPromptSendRows = (+ const streamEventsWithoutLocalPromptProgressRows = (events: StreamDisplayEvent[] | undefined,- ): StreamDisplayEvent[] => (events || []).filter((event) => !isLocalPromptSendEvent(event));+ ): StreamDisplayEvent[] => (events || []).filter((event) => !isLocalPromptProgressEvent(event));const streamEventsWithoutTransientRows = (events: StreamDisplayEvent[] | undefined,@@ -402,7 +432,7 @@ export function useChat(options: UseChatOptions = {}) {const events =nextEvent.type === 'workflow_status' || nextEvent.type === 'model_switch'? msg.streamEvents || []- : streamEventsWithoutLocalPromptSendRows(msg.streamEvents);+ : streamEventsWithoutLocalPromptProgressRows(msg.streamEvents);// For content events, merge consecutive content into oneif (nextEvent.type === 'content' && events.length > 0) {@@ -454,9 +484,11 @@ export function useChat(options: UseChatOptions = {}) {msg: ChatMessage,workflowStatus: WorkflowStatus,): ChatMessage => {- const events = msg.streamEvents || [];+ const events = isLocalPromptProgressEvent({ type: 'workflow_status', workflowStatus })+ ? msg.streamEvents || []+ : streamEventsWithoutLocalPromptProgressRows(msg.streamEvents);const now = Date.now();- const visibleStatus = visibleWorkflowStatusForHeartbeat(msg.workflowStatus, workflowStatus);+ const visibleStatus = visibleWorkflowStatusForHeartbeat(msg, workflowStatus);const nextEvent = withStreamEventTiming({type: 'workflow_status',@@ -504,8 +536,9 @@ export function useChat(options: UseChatOptions = {}) {};}+ const msgWithFilteredEvents = { ...msg, streamEvents: events };return {- ...addStreamEvent(msg, nextEvent),+ ...addStreamEvent(msgWithFilteredEvents, nextEvent),workflowStatusHistory: appendWorkflowStatusHistory(msg.workflowStatusHistory, visibleStatus),};};@@ -541,7 +574,7 @@ export function useChat(options: UseChatOptions = {}) {const model = route.trim();if (!model) return msg;const failedModel = options.failedModel?.trim();- const streamEvents = streamEventsWithoutLocalPromptSendRows(msg.streamEvents);+ const streamEvents = streamEventsWithoutLocalPromptProgressRows(msg.streamEvents);const duplicate = streamEvents.some((event) =>event.type === 'model_switch' &&@@ -962,6 +995,8 @@ export function useChat(options: UseChatOptions = {}) {if (!message) return null;const state = typeof record.state === 'string' ? record.state.trim() : '';const tool = typeof record.tool === 'string' ? record.tool.trim() : '';+ const provider = typeof record.provider === 'string' ? record.provider.trim() : '';+ const model = extractWorkflowModel(record);const attempt = positiveNumber(record.attempt);const maxAttempts = positiveNumber(record.max_attempts ?? record.maxAttempts);const retryAfterMs = positiveNumber(record.retry_after_ms ?? record.retryAfterMs);@@ -971,6 +1006,8 @@ export function useChat(options: UseChatOptions = {}) {phase: phase || undefined,state: state || undefined,tool: tool || undefined,+ provider: provider || undefined,+ model: model || undefined,attempt,maxAttempts,retryAfterMs,@@ -1198,26 +1235,22 @@ export function useChat(options: UseChatOptions = {}) {: null;if (!workflowStatus && !routeEvent) return;- if (routeEvent) {- setMessages((prev) =>- prev.map((msg) => {- if (msg.id !== assistantId) return msg;- return withModelRouteEvent(msg, routeEvent.model, {+ setMessages((prev) =>+ prev.map((msg) => {+ if (msg.id !== assistantId) return msg;+ let next = msg;+ if (routeEvent) {+ next = withModelRouteEvent(next, routeEvent.model, {modelEvent: routeEvent.modelEvent,});- }),- );- }- if (workflowStatus) {- setMessages((prev) =>- prev.map((msg) => {- if (msg.id !== assistantId) return msg;- if (msg.isStreaming === false) return msg;- return withWorkflowStatusEvent(msg, workflowStatus);- }),- );- setAssistantWorkflowStatus(assistantId, requestId, workflowStatus);- }+ }+ if (workflowStatus && next.isStreaming !== false) {+ next = withWorkflowStatusEvent(next, workflowStatus);+ }+ return next;+ }),+ );+ if (workflowStatus) setAssistantWorkflowStatus(assistantId, requestId, workflowStatus);return;}diff --git a/frontend-modern/src/components/AI/Chat/types.ts b/frontend-modern/src/components/AI/Chat/types.tsindex 1f6ca52b55..5c448b7ff2 100644--- a/frontend-modern/src/components/AI/Chat/types.ts+++ b/frontend-modern/src/components/AI/Chat/types.ts@@ -137,6 +137,8 @@ export interface WorkflowStatus {message: string;state?: string;tool?: string;+ provider?: string;+ model?: string;attempt?: number;maxAttempts?: number;retryAfterMs?: number;