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.

Show latest Assistant workflow status

rcourtmand5f7ccdfe6c2
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index b2abdcddba..d0825ecc29 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -318,13 +318,13 @@ runtime cost control, and shared AI transport surfaces.
Assistant evidence. Workflow status is live
progress, not answer content or a delayed walkthrough; each new
`workflow_state` replaces the canonical active status immediately. The
- browser may retain a bounded in-flight presentation history of those replaced
- labels and pace one visible workflow row through them when backend/network
- coalescing would otherwise make the row jump straight to the last state. The
- active-turn composer footer must use that same paced workflow-label
- presentation when its current status is workflow-derived, so the footer does
- not jump straight to the last coalesced preparation/provider state while the
- transcript row is still stepping through the same live sequence.
+ browser may retain a bounded in-flight history of those replaced labels for
+ state continuity, but the live transcript row and active-turn composer
+ footer must render the latest workflow status immediately rather than
+ replaying stale preparation/provider labels after backend or network
+ coalescing. Older neutral statuses may disappear when replaced by newer
+ status, tool, reasoning, or answer evidence; that replacement is the intended
+ motion signal.
That history must stay live-only: once visible assistant text, tool progress,
approvals, questions, terminal `done`, terminal `error`, or explicit Stop
take over, stale workflow text and the presentation history must clear so
@@ -403,13 +403,15 @@ runtime cost control, and shared AI transport surfaces.
`packages/ui/src/components/message-part.tsx` so Pulse feels active without
delaying copy/export, tool boundaries, approvals, or audit evidence.
Live workflow labels follow that same presentation-layer constraint: the
- canonical SSE/store state remains the latest typed `workflow_state`, while a
- bounded live-only browser history paces a single replacing activity row
- through recent states. This adapts OpenCode's status/title motion in
- `packages/ui/src/components/tool-status-title.tsx` and timeline thinking
- row treatment in `packages/app/src/pages/session/message-timeline.data.ts`
- at fetched `origin/dev` commit `4519a1da329c1a4fc384054e7203ba7d06928205`;
- Pulse uses it only for short workflow labels, not for audit evidence,
+ canonical SSE/store state remains the latest typed `workflow_state`, and the
+ browser must render that latest status immediately instead of replaying an
+ older live-only history. This follows the current OpenCode TUI event
+ mutation model at fetched `origin/dev` commit
+ `06d7840d1d42c9815d2d2e45e7fa4090ca4e3577`, especially
+ `packages/opencode/src/cli/cmd/tui/context/sync-v2.tsx`, where
+ `session.next.step.started`, text deltas, and tool progress mutate the
+ current assistant state event-by-event. Pulse uses the bounded status
+ history only to preserve reducer continuity, not to delay audit evidence,
approvals, tool boundaries, transcript export, or completed/restored
messages.
Completed Assistant tool rows follow the same source-anchored display policy:
@@ -1719,14 +1721,13 @@ frontend `workflow_status` display event: each incoming backend
same typed status, and visible assistant content, reasoning, tool,
approval/question, terminal `done`, and terminal `error` events clear that row.
The frontend now also keeps a bounded live-only `workflowStatusHistory` for the
-active assistant message so one row can visibly step through bursty preparation,
-context, provider-start, retry, and fallback labels instead of showing them all
-only after the final state arrives. The shared workflow-status presentation
-helper owns both the transcript row and the active-turn composer footer so the
-two live surfaces advance through the same short sequence before settling on the
-latest canonical workflow state. The transcript and footer therefore show
-current motion while the provider is starting, retrying, or reasoning, but
-completed answers do not retain stale internal-progress prose.
+active assistant message so the reducer preserves state continuity while
+backend preparation, context, provider-start, retry, and fallback labels are
+being replaced. The shared workflow-status presentation helper owns both the
+transcript row and the active-turn composer footer so the two live surfaces show
+the latest canonical workflow state immediately. The transcript and footer
+therefore show current motion while the provider is starting, retrying, or
+reasoning, but completed answers do not retain stale internal-progress prose.
Primary nav moved to governed platform/runtime destinations on 2026-05-16 and
was clarified on 2026-05-25 through `frontend-modern/src/App.tsx` and
diff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
index c6e85d9956..ab9115541d 100644
--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx
+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
@@ -28,7 +28,7 @@ import { stripAssistantOutputArtifacts } from './assistantOutputHygiene';
import { formatAssistantWorkflowStatus } from './activeTurnStatus';
import { groupStreamEventsForDisplay } from './streamEventGrouping';
import {
- createPacedWorkflowStatus,
+ latestWorkflowStatus,
normalizeWorkflowStatusSequence,
} from './workflowStatusPresentation';
import type {
@@ -362,14 +362,9 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
const WorkflowStatusText: Component<{
status?: WorkflowStatus;
includeElapsed?: boolean;
- paceKey: string;
}> = (statusProps) => {
const statuses = createMemo(() => workflowStatusSequence(statusProps.status));
- const displayedStatus = createPacedWorkflowStatus(
- () => statuses(),
- () => props.message.isStreaming === true,
- () => statusProps.paceKey,
- );
+ const displayedStatus = createMemo(() => latestWorkflowStatus(statuses()));
const text = createMemo(() =>
formatWorkflowStatus(displayedStatus(), statusProps.includeElapsed),
);
@@ -491,11 +486,7 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
>
<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-blue-500 animate-pulse" />
<span class="truncate">
- <WorkflowStatusText
- status={props.message.workflowStatus}
- includeElapsed
- paceKey={`${props.message.id}:workflow-header`}
- />
+ <WorkflowStatusText status={props.message.workflowStatus} includeElapsed />
</span>
</span>
</Show>
@@ -533,11 +524,7 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
</span>
<Show when={workflowStatusText()} fallback={<span>Thinking...</span>}>
<span>
- <WorkflowStatusText
- status={props.message.workflowStatus}
- includeElapsed
- paceKey={`${props.message.id}:workflow-inline`}
- />
+ <WorkflowStatusText status={props.message.workflowStatus} includeElapsed />
</span>
</Show>
</div>
@@ -586,7 +573,6 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
<WorkflowStatusText
status={evt.workflowStatus}
includeElapsed={props.message.isStreaming}
- paceKey={`${props.message.id}:workflow-row`}
/>
</span>
</div>
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 baee1dc5da..18c4a6a418 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -3,7 +3,6 @@ import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-li
import { Show, createSignal } from 'solid-js';
import type { ChatMessage, ModelInfo, ModelRouteRecoveryOption } from '../types';
import type { QueuedFollowUp } from '../hooks/useChat';
-import { WORKFLOW_STATUS_RENDER_PACE_MS } from '../workflowStatusPresentation';
// ── Hoisted mocks (vi.mock factories reference these) ──────────────────────
@@ -4456,69 +4455,56 @@ describe('AIChat', () => {
expect(screen.queryByText('Generating response...')).not.toBeInTheDocument();
});
- it('paces burst workflow progress in the active turn status footer', async () => {
- vi.useFakeTimers();
- try {
- const [isLoading, setIsLoading] = createSignal(false);
- const [messages, setMessages] = createSignal<ChatMessage[]>([]);
- const workflowStatusHistory = [
- {
- phase: 'request_start',
- message: 'Preparing Pulse context.',
- startedAt: 1_000,
- },
- {
- phase: 'context',
- message: 'Reading current Pulse inventory with pulse_query.',
- tool: 'pulse_query',
- startedAt: 1_100,
- },
- {
- phase: 'provider_start',
- message: 'Sent request to OpenRouter; waiting for the first token.',
- startedAt: 1_200,
- },
- ];
- mockChat.isLoading.mockImplementation(() => isLoading());
- mockChat.messages.mockImplementation(() => messages());
- renderChat();
-
- await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_RENDER_PACE_MS * 5);
- setIsLoading(true);
- setMessages([
- {
- id: 'msg-1',
- role: 'assistant' as const,
- content: '',
- timestamp: new Date(),
- isStreaming: true,
- workflowStatusHistory,
- workflowStatus: workflowStatusHistory[2],
- streamEvents: [
- {
- type: 'workflow_status',
- workflowStatus: workflowStatusHistory[2],
- startedAt: 1_200,
- updatedAt: 1_200,
- },
- ],
- },
- ]);
-
- const status = screen.getByLabelText('Assistant active turn status');
- expect(status).toHaveTextContent('Preparing Pulse context.');
- expect(status).not.toHaveTextContent('Sent request to OpenRouter');
+ it('shows the latest burst workflow progress immediately in the active turn status footer', () => {
+ const [isLoading, setIsLoading] = createSignal(false);
+ const [messages, setMessages] = createSignal<ChatMessage[]>([]);
+ const workflowStatusHistory = [
+ {
+ phase: 'request_start',
+ message: 'Preparing Pulse context.',
+ startedAt: 1_000,
+ },
+ {
+ phase: 'context',
+ message: 'Reading current Pulse inventory with pulse_query.',
+ tool: 'pulse_query',
+ startedAt: 1_100,
+ },
+ {
+ phase: 'provider_start',
+ message: 'Sent request to OpenRouter; waiting for the first token.',
+ startedAt: 1_200,
+ },
+ ];
+ mockChat.isLoading.mockImplementation(() => isLoading());
+ mockChat.messages.mockImplementation(() => messages());
+ renderChat();
- await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_RENDER_PACE_MS);
- expect(status).toHaveTextContent('Reading current Pulse inventory with pulse_query.');
+ setIsLoading(true);
+ setMessages([
+ {
+ id: 'msg-1',
+ role: 'assistant' as const,
+ content: '',
+ timestamp: new Date(),
+ isStreaming: true,
+ workflowStatusHistory,
+ workflowStatus: workflowStatusHistory[2],
+ streamEvents: [
+ {
+ type: 'workflow_status',
+ workflowStatus: workflowStatusHistory[2],
+ startedAt: 1_200,
+ updatedAt: 1_200,
+ },
+ ],
+ },
+ ]);
- await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_RENDER_PACE_MS);
- expect(status).toHaveTextContent(
- 'Sent request to OpenRouter; waiting for the first token.',
- );
- } finally {
- vi.useRealTimers();
- }
+ const status = screen.getByLabelText('Assistant active turn status');
+ expect(status).toHaveTextContent('Sent request to OpenRouter; waiting for the first token.');
+ expect(status).not.toHaveTextContent('Preparing Pulse context.');
+ expect(status).not.toHaveTextContent('Reading current Pulse inventory with pulse_query.');
});
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 ec13163b52..195476c03d 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
@@ -630,8 +630,7 @@ describe('MessageItem', () => {
expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
});
- it('paces burst workflow activity through one live transcript row', async () => {
- vi.useFakeTimers();
+ it('shows the latest burst workflow activity through one live transcript row', () => {
const workflowStatusHistory = [
{
phase: 'request_start',
@@ -671,17 +670,10 @@ describe('MessageItem', () => {
/>
));
- expect(screen.getByText(/Preparing Pulse context\./)).toBeInTheDocument();
+ expect(screen.queryByText(/Preparing Pulse context\./)).not.toBeInTheDocument();
expect(
- screen.queryByText(/Sent request to OpenRouter; waiting for the first token\./),
+ screen.queryByText(/Reading current Pulse inventory with pulse_query\./),
).not.toBeInTheDocument();
-
- await vi.advanceTimersByTimeAsync(420);
- expect(
- screen.getByText(/Reading current Pulse inventory with pulse_query\./),
- ).toBeInTheDocument();
-
- await vi.advanceTimersByTimeAsync(420);
expect(
screen.getByText(/Sent request to OpenRouter; waiting for the first token\./),
).toBeInTheDocument();
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index 9dd11f8822..3427c1100f 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -166,7 +166,7 @@ import {
hasAssistantTranscriptContent,
} from './transcriptExport';
import {
- createPacedWorkflowStatus,
+ latestWorkflowStatus,
normalizeWorkflowStatusSequence,
} from './workflowStatusPresentation';
import type {
@@ -2023,13 +2023,8 @@ export const AIChat: Component<AIChatProps> = (props) => {
message.workflowStatus,
]);
});
- const displayedActiveWorkflowStatus = createPacedWorkflowStatus(
- () => activeWorkflowStatusSequence(),
- () => chat.isLoading() && !!activeAssistantMessage(),
- () => {
- const message = activeAssistantMessage();
- return message ? `${message.id}:workflow-footer` : '';
- },
+ const displayedActiveWorkflowStatus = createMemo(() =>
+ latestWorkflowStatus(activeWorkflowStatusSequence()),
);
const currentStatus = createMemo(() => {
const status = getAssistantActiveTurnStatus(chat.messages(), chat.isLoading());
diff --git a/frontend-modern/src/components/AI/Chat/workflowStatusPresentation.ts b/frontend-modern/src/components/AI/Chat/workflowStatusPresentation.ts
index 88eb4d895d..d0170d3f93 100644
--- a/frontend-modern/src/components/AI/Chat/workflowStatusPresentation.ts
+++ b/frontend-modern/src/components/AI/Chat/workflowStatusPresentation.ts
@@ -1,9 +1,6 @@
-import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js';
import { formatAssistantWorkflowStatus } from './activeTurnStatus';
import type { WorkflowStatus } from './types';
-export const WORKFLOW_STATUS_RENDER_PACE_MS = 420;
-
export const workflowStatusRenderKey = (status?: WorkflowStatus) =>
status
? [
@@ -29,99 +26,5 @@ export const normalizeWorkflowStatusSequence = (statuses: Array<WorkflowStatus |
return sequence;
};
-interface PacedWorkflowStatusClock {
- firstKey: string;
- startedAt: number;
-}
-
-const pacedWorkflowStatusCache = new Map<string, PacedWorkflowStatusClock>();
-const pacedWorkflowStatusCleanupTimers = new Map<string, ReturnType<typeof setTimeout>>();
-
-const cancelPacedWorkflowStatusCleanup = (key: string) => {
- const timer = pacedWorkflowStatusCleanupTimers.get(key);
- if (!timer) return;
- clearTimeout(timer);
- pacedWorkflowStatusCleanupTimers.delete(key);
-};
-
-const deletePacedWorkflowStatusCache = (key: string) => {
- cancelPacedWorkflowStatusCleanup(key);
- pacedWorkflowStatusCache.delete(key);
-};
-
-const schedulePacedWorkflowStatusCleanup = (key: string) => {
- cancelPacedWorkflowStatusCleanup(key);
- pacedWorkflowStatusCleanupTimers.set(
- key,
- setTimeout(() => {
- pacedWorkflowStatusCleanupTimers.delete(key);
- pacedWorkflowStatusCache.delete(key);
- }, 1000),
- );
-};
-
-export const createPacedWorkflowStatus = (
- getStatuses: () => WorkflowStatus[],
- live: () => boolean,
- cacheKey: () => string,
-) => {
- const [now, setNow] = createSignal(Date.now());
- let interval: ReturnType<typeof setInterval> | undefined;
-
- createEffect(() => {
- const statuses = getStatuses();
- if (!live()) {
- if (interval) {
- clearInterval(interval);
- interval = undefined;
- }
- const key = cacheKey();
- if (key) deletePacedWorkflowStatusCache(key);
- return;
- }
-
- const key = cacheKey();
- if (key) {
- cancelPacedWorkflowStatusCleanup(key);
- }
-
- if (statuses.length > 1 && !interval) {
- interval = setInterval(() => setNow(Date.now()), WORKFLOW_STATUS_RENDER_PACE_MS);
- } else if (statuses.length <= 1 && interval) {
- clearInterval(interval);
- interval = undefined;
- }
- });
-
- onCleanup(() => {
- if (interval) {
- clearInterval(interval);
- }
- const key = cacheKey();
- if (key) schedulePacedWorkflowStatusCleanup(key);
- });
-
- return createMemo(() => {
- const statuses = getStatuses();
- if (statuses.length === 0) return undefined;
- if (!live()) return statuses[statuses.length - 1];
- if (statuses.length === 1) return statuses[0];
-
- const key = cacheKey();
- const firstKey = workflowStatusRenderKey(statuses[0]);
- if (!key || !firstKey) return statuses[0];
-
- const cached = pacedWorkflowStatusCache.get(key);
- const startedAt = cached?.firstKey === firstKey ? cached.startedAt : Date.now();
- if (!cached || cached.firstKey !== firstKey) {
- pacedWorkflowStatusCache.set(key, { firstKey, startedAt });
- }
- const currentTime = Math.max(now(), startedAt);
-
- const index = Math.min(
- statuses.length - 1,
- Math.floor(Math.max(0, currentTime - startedAt) / WORKFLOW_STATUS_RENDER_PACE_MS),
- );
- return statuses[index] || statuses[statuses.length - 1];
- });
-};
+export const latestWorkflowStatus = (statuses: WorkflowStatus[]) =>
+ statuses.length > 0 ? statuses[statuses.length - 1] : undefined;