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.

Align Assistant live workflow status

rcourtman691decb8453b
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 349c70a0b1..e1ba93381e 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -70,6 +70,12 @@ is still streaming and newer concrete activity has arrived. Pending tools,
skipped/canceled tools, failed tools, and completed-turn tool details must
remain visible/inspectable.
+Assistant live workflow status follows OpenCode's current-state timeline
+model: history may persist for audit/session state, but live transcript rows
+and the active-turn footer render the latest replacing workflow status
+immediately. Pulse must not replay stale status history through artificial
+timers when the stream already has a newer workflow/tool state.
+
1. Add or change chat runtime, Patrol orchestration, findings generation, or remediation behavior through `internal/ai/`
2. Add or change canonical AI provider config, provider-scoped model selection, or runtime auth/base-URL defaults through `internal/config/ai.go`.
Ollama request keep-alive is a provider runtime option owned by this path:
@@ -1206,14 +1212,18 @@ remain visible/inspectable.
metadata, provider internals, and shell command claims remain out of scope
for normal inventory answers. The Assistant transcript should show compact
activity as work happens: local context reads, governed tool names, provider
- routing, fallback, and first-token waiting must appear as a replacing live
- status/header status rather than a dead-looking wait state or a dumped list
- of transient phases. Hide or collapse unsafe details and bulky outputs, but
- do not hide the fact that Pulse is running a local read, invoking a governed
- 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-only
+ routing, fallback, and first-token waiting must appear as the latest
+ replacing live status/header status rather than a dead-looking wait state, a
+ dumped list of transient phases, or a delayed replay of stale status history.
+ This adapts the referenced OpenCode source at fetched `origin/dev` commit
+ `914a643`, where the app session timeline derives visible activity from the
+ current session status and streamed message/tool parts instead of pacing old
+ status labels back through the UI. Hide or collapse unsafe details and bulky
+ outputs, but do not hide the fact that Pulse is running a local read,
+ invoking a governed 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-only
turn still reaches a model-owned `pulse_query` topology call, omitting
`summary_only` must default to summary-only before execution; detailed
topology remains available in the full governed path or when the model
diff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
index a7e32a3541..55ae560433 100644
--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx
+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
@@ -27,7 +27,6 @@ import { getAssistantAnswerText } from './assistantAnswerText';
import { stripAssistantOutputArtifacts } from './assistantOutputHygiene';
import { formatAssistantWorkflowStatus } from './activeTurnStatus';
import { groupStreamEventsForDisplay } from './streamEventGrouping';
-import { createPacedWorkflowStatus, workflowStatusRenderKey } from './workflowStatusPresentation';
import type {
ChatMessage,
ModelRouteRecoveryOption,
@@ -285,27 +284,6 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
};
const shouldRenderWorkflowStatusEvent = (evt: StreamDisplayEvent) =>
!!formatAssistantWorkflowStatus(evt.workflowStatus);
- const renderableWorkflowStatusEvents = createMemo(() =>
- groupedEvents().filter(
- (evt) => evt.type === 'workflow_status' && shouldRenderWorkflowStatusEvent(evt),
- ),
- );
- const latestRenderableWorkflowStatusEventKey = createMemo(() => {
- const workflowEvents = renderableWorkflowStatusEvents();
- return workflowStatusRenderKey(workflowEvents[workflowEvents.length - 1]?.workflowStatus);
- });
- const pacedWorkflowStatus = createPacedWorkflowStatus(
- () => [...(props.message.workflowStatusHistory || []), props.message.workflowStatus],
- { enabled: () => props.message.isStreaming === true },
- );
- const shouldPaceWorkflowStatusRow = (evt: StreamDisplayEvent) =>
- props.message.isStreaming === true &&
- renderableWorkflowStatusEvents().length === 1 &&
- workflowStatusRenderKey(evt.workflowStatus) === latestRenderableWorkflowStatusEventKey();
- const workflowStatusForEvent = (evt: StreamDisplayEvent): WorkflowStatus | undefined => {
- if (!shouldPaceWorkflowStatusRow(evt)) return evt.workflowStatus;
- return pacedWorkflowStatus.status() || evt.workflowStatus;
- };
const isRenderableStreamEvent = (evt: StreamDisplayEvent) => {
switch (evt.type) {
case 'thinking':
@@ -386,9 +364,10 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
!props.message.content.trim() &&
!hasRenderableStreamEvents() &&
!props.message.error;
+ const currentWorkflowStatus = () => props.message.workflowStatus;
const [statusNow, setStatusNow] = createSignal(Date.now());
createEffect(() => {
- const status = pacedWorkflowStatus.status();
+ const status = currentWorkflowStatus();
if (!props.message.isStreaming || !status?.startedAt) return;
setStatusNow(Date.now());
const interval = window.setInterval(() => setStatusNow(Date.now()), 1000);
@@ -410,7 +389,7 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
return `${message}${elapsedSuffix}`;
};
const workflowStatusText = createMemo(() =>
- formatWorkflowStatus(pacedWorkflowStatus.status(), true),
+ formatWorkflowStatus(currentWorkflowStatus(), true),
);
const shouldShowHeaderWorkflowStatus = () =>
props.message.isStreaming &&
@@ -601,7 +580,7 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
const contentText = () =>
stripAssistantOutputArtifacts(evt?.content || '').text;
const visibleWorkflowStatus = () =>
- evt?.type === 'workflow_status' ? workflowStatusForEvent(evt) : undefined;
+ evt?.type === 'workflow_status' ? evt.workflowStatus : undefined;
return (
<Switch>
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 7350535603..37abb41dc3 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -5316,9 +5316,7 @@ describe('AIChat', () => {
expect(status).not.toHaveTextContent('Using Qwen: Qwen3.7 Plus via OpenRouter');
});
- it('paces burst workflow progress in the active turn status footer', async () => {
- vi.useFakeTimers();
- vi.setSystemTime(1_200);
+ it('shows the latest replacing workflow progress in the active turn status footer', () => {
const [isLoading, setIsLoading] = createSignal(false);
const [messages, setMessages] = createSignal<ChatMessage[]>([]);
const workflowStatusHistory = [
@@ -5365,22 +5363,12 @@ describe('AIChat', () => {
]);
const status = screen.getByLabelText('Assistant active turn status');
- expect(status).toHaveTextContent('Preparing Pulse context.');
- expect(status).not.toHaveTextContent('OpenRouter is starting the response.');
-
- await vi.advanceTimersByTimeAsync(650);
- expect(status).toHaveTextContent('Reading current Pulse inventory.');
- expect(status).not.toHaveTextContent('pulse_query');
-
- await vi.advanceTimersByTimeAsync(650);
expect(status).toHaveTextContent('OpenRouter is starting the response.');
expect(status).not.toHaveTextContent('Preparing Pulse context.');
- expect(status).not.toHaveTextContent('Reading current Pulse inventory with pulse_query.');
+ expect(status).not.toHaveTextContent('Reading current Pulse inventory.');
});
- it('paces burst workflow progress without dropping queued follow-up pressure', async () => {
- vi.useFakeTimers();
- vi.setSystemTime(1_200);
+ it('shows latest replacing workflow progress without dropping queued follow-up pressure', () => {
const [isLoading, setIsLoading] = createSignal(false);
const [messages, setMessages] = createSignal<ChatMessage[]>([]);
const workflowStatusHistory = [
@@ -5435,16 +5423,9 @@ describe('AIChat', () => {
]);
const status = screen.getByLabelText('Assistant active turn status');
- expect(status).toHaveTextContent('Preparing Pulse context. · 1 follow-up queued');
- expect(status).not.toHaveTextContent('OpenRouter is starting the response.');
-
- await vi.advanceTimersByTimeAsync(650);
- expect(status).toHaveTextContent('Reading current Pulse inventory. · 1 follow-up queued');
- expect(status).not.toHaveTextContent('pulse_query');
-
- await vi.advanceTimersByTimeAsync(650);
expect(status).toHaveTextContent('OpenRouter is starting the response. · 1 follow-up queued');
expect(status).not.toHaveTextContent('Preparing Pulse context.');
+ expect(status).not.toHaveTextContent('Reading current Pulse inventory.');
});
it('keeps pending tool progress visible in the active turn status', () => {
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
index a7951b66f4..e74203243e 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
@@ -801,7 +801,7 @@ describe('MessageItem', () => {
).toBeInTheDocument();
});
- it('paces burst workflow activity through one live transcript row', async () => {
+ it('shows the latest replacing workflow activity in one live transcript row', () => {
vi.useFakeTimers();
vi.setSystemTime(1_200);
@@ -844,21 +844,11 @@ describe('MessageItem', () => {
/>
));
- expect(screen.getByText('Preparing Pulse context.')).toBeInTheDocument();
- expect(screen.queryByText(/OpenRouter is starting the response\./)).not.toBeInTheDocument();
-
- await vi.advanceTimersByTimeAsync(650);
-
- expect(screen.getByText('Reading current Pulse inventory.')).toBeInTheDocument();
- expect(
- screen.queryByText(/Reading current Pulse inventory with pulse_query\./),
- ).not.toBeInTheDocument();
- expect(screen.queryByText(/OpenRouter is starting the response\./)).not.toBeInTheDocument();
-
- await vi.advanceTimersByTimeAsync(650);
-
expect(screen.getByText('OpenRouter is starting the response.')).toBeInTheDocument();
expect(screen.queryByText(/Preparing Pulse context\./)).not.toBeInTheDocument();
+ expect(
+ screen.queryByText(/Reading current Pulse inventory\./),
+ ).not.toBeInTheDocument();
});
it('keeps separated transcript workflow rows tied to their own streamed status', () => {
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index c753b5f840..6a1dc73a6e 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -151,9 +151,7 @@ import { ModelSelector } from './ModelSelector';
import { MentionAutocomplete, type MentionResource } from './MentionAutocomplete';
import { SlashCommandAutocomplete } from './SlashCommandAutocomplete';
import {
- formatAssistantWorkflowStatus,
getAssistantActiveTurnStatus,
- withAssistantQueuedFollowUpStatus,
} from './activeTurnStatus';
import { getLastAssistantAnswerText } from './assistantAnswerText';
import {
@@ -174,7 +172,6 @@ import {
formatAssistantTranscript,
hasAssistantTranscriptContent,
} from './transcriptExport';
-import { createPacedWorkflowStatus } from './workflowStatusPresentation';
import type {
ChatMessage,
ModelRouteRecoveryOption,
@@ -2349,61 +2346,9 @@ export const AIChat: Component<AIChatProps> = (props) => {
}
return undefined;
});
- const displayedActiveWorkflowStatus = createPacedWorkflowStatus(
- () => {
- const message = activeAssistantMessage();
- if (!message) return [];
- return [...(message.workflowStatusHistory || []), message.workflowStatus];
- },
- { enabled: () => chat.isLoading() },
- ).status;
const [currentStatusNow, setCurrentStatusNow] = createSignal(Date.now());
const currentStatus = createMemo(() => {
- const status = getAssistantActiveTurnStatus(
- chat.messages(),
- chat.isLoading(),
- currentStatusNow(),
- );
- const message = activeAssistantMessage();
- const latestWorkflow = message?.workflowStatus;
- const pacedWorkflowStatus = displayedActiveWorkflowStatus();
- if (!status || !latestWorkflow || !pacedWorkflowStatus) return status;
- const messages = chat.messages();
-
- const latestWorkflowText = formatAssistantWorkflowStatus(latestWorkflow, currentStatusNow());
- const expectedType = latestWorkflow.tool ? 'tool' : 'thinking';
- const statusStartedAt = status.startedAt;
- const workflowStartedAt = latestWorkflow.startedAt;
- const latestWorkflowStatus = withAssistantQueuedFollowUpStatus(
- {
- type: expectedType,
- text: latestWorkflowText,
- ...(workflowStartedAt !== undefined ? { startedAt: workflowStartedAt } : {}),
- },
- messages,
- );
- if (
- !latestWorkflowText ||
- status.text !== latestWorkflowStatus.text ||
- status.type !== latestWorkflowStatus.type ||
- (statusStartedAt !== undefined &&
- workflowStartedAt !== undefined &&
- statusStartedAt !== workflowStartedAt)
- ) {
- return status;
- }
-
- const pacedText = formatAssistantWorkflowStatus(pacedWorkflowStatus, currentStatusNow());
- if (!pacedText) return status;
- return withAssistantQueuedFollowUpStatus(
- {
- ...status,
- type: pacedWorkflowStatus.tool ? 'tool' : 'thinking',
- text: pacedText,
- startedAt: pacedWorkflowStatus.startedAt,
- },
- messages,
- );
+ return getAssistantActiveTurnStatus(chat.messages(), chat.isLoading(), currentStatusNow());
});
createEffect(() => {
const status = currentStatus();
diff --git a/frontend-modern/src/components/AI/Chat/workflowStatusPresentation.ts b/frontend-modern/src/components/AI/Chat/workflowStatusPresentation.ts
deleted file mode 100644
index 9a50e04676..0000000000
--- a/frontend-modern/src/components/AI/Chat/workflowStatusPresentation.ts
+++ /dev/null
@@ -1,165 +0,0 @@
-import {
- createEffect,
- createMemo,
- createSignal,
- onCleanup,
- untrack,
- type Accessor,
-} from 'solid-js';
-import { formatAssistantWorkflowStatus } from './activeTurnStatus';
-import type { WorkflowStatus } from './types';
-
-export const ASSISTANT_WORKFLOW_STATUS_BURST_VISIBLE_MS = 650;
-
-export const workflowStatusRenderKey = (status?: WorkflowStatus) =>
- status
- ? [
- status?.phase || '',
- status?.message || '',
- status?.state || '',
- status?.tool || '',
- status?.attempt || 0,
- status?.maxAttempts || 0,
- status?.retryAfterMs || 0,
- status?.startedAt || 0,
- ].join('\u001f')
- : '';
-
-export const normalizeWorkflowStatusSequence = (statuses: Array<WorkflowStatus | undefined>) => {
- const sequence: WorkflowStatus[] = [];
- for (const status of statuses) {
- if (!status || !formatAssistantWorkflowStatus(status)) continue;
- const previous = sequence[sequence.length - 1];
- if (workflowStatusRenderKey(previous) === workflowStatusRenderKey(status)) continue;
- sequence.push(status);
- }
- return sequence;
-};
-
-export const latestWorkflowStatus = (statuses: WorkflowStatus[]) =>
- statuses.length > 0 ? statuses[statuses.length - 1] : undefined;
-
-interface PacedWorkflowStatusOptions {
- enabled?: Accessor<boolean>;
- visibleMs?: number;
-}
-
-interface PacedWorkflowStatus {
- sequence: Accessor<WorkflowStatus[]>;
- status: Accessor<WorkflowStatus | undefined>;
- pacing: Accessor<boolean>;
-}
-
-export const createPacedWorkflowStatus = (
- getStatuses: Accessor<Array<WorkflowStatus | undefined>>,
- options: PacedWorkflowStatusOptions = {},
-): PacedWorkflowStatus => {
- const sequence = createMemo(() => normalizeWorkflowStatusSequence(getStatuses()));
- const [displayedStatusKey, setDisplayedStatusKey] = createSignal('');
- const [pacing, setPacing] = createSignal(false);
- const visibleMs = options.visibleMs ?? ASSISTANT_WORKFLOW_STATUS_BURST_VISIBLE_MS;
- let lastSequenceFingerprint = '';
- let lastSequenceLength = 0;
- let advanceTimer: number | undefined;
-
- const clearAdvanceTimer = () => {
- if (advanceTimer !== undefined) {
- window.clearTimeout(advanceTimer);
- advanceTimer = undefined;
- }
- };
-
- const showLatest = (keys: string[]) => {
- clearAdvanceTimer();
- setDisplayedStatusKey(keys[keys.length - 1] || '');
- setPacing(false);
- };
-
- const scheduleAdvance = (keys: string[], currentIndex: number) => {
- clearAdvanceTimer();
- if (currentIndex >= keys.length - 1) {
- setPacing(false);
- return;
- }
-
- setPacing(true);
- advanceTimer = window.setTimeout(() => {
- const nextIndex = Math.min(currentIndex + 1, keys.length - 1);
- setDisplayedStatusKey(keys[nextIndex] || '');
- scheduleAdvance(keys, nextIndex);
- }, visibleMs);
- };
-
- createEffect(() => {
- const statuses = sequence();
- const keys = statuses.map(workflowStatusRenderKey);
- const fingerprint = keys.join('\u001e');
- const previousFingerprint = lastSequenceFingerprint;
- const previousLength = lastSequenceLength;
- const sequenceChanged = fingerprint !== previousFingerprint;
- const addedCount = sequenceChanged ? Math.max(0, statuses.length - previousLength) : 0;
- const enabled = options.enabled?.() ?? true;
-
- lastSequenceFingerprint = fingerprint;
- lastSequenceLength = statuses.length;
-
- if (statuses.length === 0) {
- clearAdvanceTimer();
- setDisplayedStatusKey('');
- setPacing(false);
- return;
- }
-
- if (!enabled) {
- showLatest(keys);
- return;
- }
-
- const currentKey = untrack(displayedStatusKey);
- const currentIndex = keys.indexOf(currentKey);
- if (currentIndex === -1) {
- const initialIndex = statuses.length > 1 ? 0 : statuses.length - 1;
- setDisplayedStatusKey(keys[initialIndex] || '');
- if (initialIndex < statuses.length - 1) {
- scheduleAdvance(keys, initialIndex);
- } else {
- clearAdvanceTimer();
- setPacing(false);
- }
- return;
- }
-
- if (currentIndex >= statuses.length - 1) {
- clearAdvanceTimer();
- setPacing(false);
- return;
- }
-
- const pendingCount = statuses.length - currentIndex - 1;
- const shouldPace = untrack(pacing) || addedCount > 1 || pendingCount > 1;
- if (shouldPace) {
- scheduleAdvance(keys, currentIndex);
- return;
- }
-
- showLatest(keys);
- });
-
- onCleanup(clearAdvanceTimer);
-
- const status = createMemo<WorkflowStatus | undefined>(() => {
- const statuses = sequence();
- const key = displayedStatusKey();
- if (key) {
- const matched = statuses.find((candidate) => workflowStatusRenderKey(candidate) === key);
- if (matched) return matched;
- }
- return latestWorkflowStatus(statuses);
- });
-
- return {
- sequence,
- status,
- pacing,
- };
-};