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.

Move Assistant live status to the footer, keep the transcript clean (OpenCode model)

rcourtmanf68a75f012ac
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 8632ca5d19..09a0ca5641 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -73,12 +73,25 @@ tools, failed tools, and completed-turn tool details must remain
visible/inspectable; failed output may render inline because it is actionable.
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. Frontend
-display code may refresh elapsed-time suffixes while a turn is active, but
-status selection must read the current workflow status directly rather than
+model. CANONICAL (supersedes the per-row transcript-status rules elsewhere in
+this contract): live workflow status is FOOTER-OWNED and must never be narrated
+into the scrolling transcript. OpenCode keeps "the model is doing X" in a single
+pinned footer line and puts only durable artifacts (user text, reasoning, tool
+calls, the answer) in the timeline; Pulse mirrors that by rendering the latest
+replacing workflow status ONLY in the activity dock above the composer
+(`currentStatus` / `assistant-activity-dock` in
+`frontend-modern/src/components/AI/Chat/index.tsx`) and never as a transcript
+row or message-header chip — `shouldRenderWorkflowStatusEvent` and
+`shouldShowHeaderWorkflowStatus` in
+`frontend-modern/src/components/AI/Chat/MessageItem.tsx` are hard-`false`. The
+dock must stay up for the whole turn: it is gated on the streaming assistant
+message (`assistantTurnActive`), not `chat.isLoading()`, because loading flips
+false at visible-turn-complete and would make the footer flash and vanish.
+History may persist for audit/session state, but the dock renders the latest
+replacing status immediately. Pulse must not replay stale status history through
+artificial timers when the stream already has a newer workflow/tool state.
+Frontend display code may refresh elapsed-time suffixes while a turn is active,
+but status selection must read the current workflow status directly rather than
deriving an older display status from `workflowStatusHistory`.
1. Add or change chat runtime, Patrol orchestration, findings generation, or remediation behavior through `internal/ai/`
@@ -2328,6 +2341,23 @@ block updates its text node rather than being rebuilt. The morph is a rendering
optimization only — `renderMarkdown` remains the sole sanitization gate and the
morph must never be fed unsanitized HTML.
+Live workflow status is footer-owned, not a transcript artifact (the OpenCode
+restraint model — see the canonical statement in Extension Points, which
+supersedes the older per-row transcript-status rules in this contract). Earlier
+Pulse rendered "Preparing context / Reading inventory / Counting / Waiting for
+assistant / retrying" both as transcript rows AND in the activity dock, so the
+chat narrated every internal step into the timeline. Now `MessageItem` never
+renders workflow status — neither the per-event `role="status"` row
+(`shouldRenderWorkflowStatusEvent` is `false`) nor the early-phase header chip
+(`shouldShowHeaderWorkflowStatus` is `false`). The transcript carries only
+durable artifacts (reasoning, tool calls, model-route rows, the answer). The
+single live "assistant is working" indicator is the activity dock above the
+composer, which shows a spinner + the current status + the model route + Stop.
+The dock is gated on `assistantTurnActive` (loading OR a streaming assistant
+message) rather than `chat.isLoading()` so it persists for the whole turn:
+`isLoading` flips false at visible-turn-complete, which previously made the dock
+flash its status for a frame and vanish.
+
Assistant slash-command availability is part of the command runtime contract,
not only visual polish. The OpenCode reference at fetched `origin/dev` commit
`c495635` filters prompt slash commands through the registered command catalog
diff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
index 555ebb9471..06b86c4dce 100644
--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx
+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
@@ -281,8 +281,15 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
return false;
}
};
- const shouldRenderWorkflowStatusEvent = (evt: StreamDisplayEvent) =>
- !!formatAssistantWorkflowStatus(evt.workflowStatus);
+ // Live workflow status ("Preparing context", "Reading inventory", "Counting
+ // results", retrying, ...) is transient working-state, not a transcript
+ // artifact. OpenCode keeps that in a single pinned footer spinner and never
+ // narrates it into the scrolling timeline; Pulse surfaces the same live status
+ // in the activity dock above the composer (currentStatus in index.tsx). So the
+ // transcript itself shows only durable artifacts — reasoning, tool calls, and
+ // the answer — and never renders workflow_status rows. Keep the predicate so
+ // the gating/grouping code paths stay intact, but never render the row.
+ const shouldRenderWorkflowStatusEvent = (_evt: StreamDisplayEvent) => false;
const isRenderableStreamEvent = (evt: StreamDisplayEvent) => {
switch (evt.type) {
case 'thinking':
@@ -452,12 +459,19 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
const workflowStatusText = createMemo(() =>
formatWorkflowStatus(currentWorkflowStatus(), true),
);
+ // Workflow status is footer-owned (the activity dock in index.tsx), never shown
+ // in the transcript — not as a per-event row (shouldRenderWorkflowStatusEvent)
+ // and not as this early-phase header chip. During the empty-content window the
+ // transcript stays blank while the dock spinner conveys the live status, which
+ // is the OpenCode model. Keep the predicate so its inputs stay referenced, but
+ // never render the chip.
const shouldShowHeaderWorkflowStatus = () =>
props.message.isStreaming &&
!isWaitingForFirstToken() &&
!visibleMessageContent().trim() &&
!hasRenderableStreamEvents() &&
- !!workflowStatusText();
+ !!workflowStatusText() &&
+ false;
const interruptionLabel = createMemo(() => {
switch (props.message.interruption) {
case 'replaced':
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 32a866dfb7..9208e15929 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
@@ -2,7 +2,6 @@ import { describe, expect, it, vi, afterEach } from 'vitest';
import { cleanup, render, screen, fireEvent, waitFor } from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
import { MessageItem } from '../MessageItem';
-import { WORKFLOW_STATUS_PACE_MS } from '../workflowStatusDisplay';
import type { ChatMessage, PendingApproval, PendingQuestion, StreamDisplayEvent } from '../types';
// Mock child components to isolate MessageItem logic
@@ -725,7 +724,7 @@ describe('MessageItem', () => {
expect(screen.queryByText(/pulse_query/)).not.toBeInTheDocument();
});
- it('shows live workflow progress as a transcript activity row', () => {
+ it('does not render live workflow progress as a transcript row (footer-owned)', () => {
render(() => (
<MessageItem
message={makeMessage({
@@ -757,19 +756,11 @@ describe('MessageItem', () => {
/>
));
- expect(
- screen.getByText(
- 'Selected route connection failed before any output; retrying. · attempt 2/3 · retrying in 1.2s',
- ),
- ).toBeInTheDocument();
- expect(screen.getByRole('status')).toHaveAttribute('data-status-kind', 'retrying');
+ expect(screen.queryByRole('status')).not.toBeInTheDocument();
expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
});
- it('counts down provider retry workflow rows while the turn is live', () => {
- vi.useFakeTimers();
- vi.setSystemTime(2_300);
-
+ it('does not render provider retry workflow rows in the transcript (footer-owned)', () => {
render(() => (
<MessageItem
message={makeMessage({
@@ -803,18 +794,10 @@ describe('MessageItem', () => {
/>
));
- expect(
- screen.getByText(
- /Selected route connection failed before any output; retrying\. · attempt 2\/3 · retrying in 1\.9s/,
- ),
- ).toBeInTheDocument();
- expect(screen.getByRole('status')).toHaveAttribute('data-status-kind', 'retrying');
+ expect(screen.queryByRole('status')).not.toBeInTheDocument();
});
- it('paces replacing workflow activity through one live transcript row', async () => {
- vi.useFakeTimers();
- vi.setSystemTime(1_200);
-
+ it('does not render replacing workflow activity in the transcript (footer-owned)', () => {
const workflowStatusHistory = [
{
phase: 'request_start',
@@ -854,24 +837,10 @@ describe('MessageItem', () => {
/>
));
- expect(screen.getByText(/Preparing Pulse context\./)).toBeInTheDocument();
- expect(screen.queryByText(/Waiting for assistant\./)).not.toBeInTheDocument();
-
- await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_PACE_MS);
- expect(screen.getByText(/Reading current Pulse inventory\./)).toBeInTheDocument();
-
- await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_PACE_MS);
- expect(screen.getByText(/Waiting for assistant\./)).toBeInTheDocument();
- expect(screen.queryByText(/Preparing Pulse context\./)).not.toBeInTheDocument();
- expect(
- screen.queryByText(/Reading current Pulse inventory\./),
- ).not.toBeInTheDocument();
+ expect(screen.queryByRole('status')).not.toBeInTheDocument();
});
- it('paces provider retry workflow activity into the live transcript status', async () => {
- vi.useFakeTimers();
- vi.setSystemTime(1_200);
-
+ it('does not render provider retry workflow activity in the transcript (footer-owned)', () => {
const workflowStatusHistory = [
{
phase: 'request_start',
@@ -913,23 +882,10 @@ describe('MessageItem', () => {
/>
));
- expect(screen.getByText('Preparing Pulse context.')).toBeInTheDocument();
-
- await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_PACE_MS);
- expect(screen.getByText('Waiting for assistant.')).toBeInTheDocument();
-
- await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_PACE_MS);
- expect(
- screen.getByText(/Selected route connection failed before any output; retrying\. · attempt 2\/3/),
- ).toBeInTheDocument();
- expect(screen.queryByText('Preparing Pulse context.')).not.toBeInTheDocument();
- expect(screen.queryByText('Waiting for assistant.')).not.toBeInTheDocument();
+ expect(screen.queryByRole('status')).not.toBeInTheDocument();
});
- it('keeps separated transcript workflow rows tied to their own streamed status', () => {
- vi.useFakeTimers();
- vi.setSystemTime(2_000);
-
+ it('does not render separated workflow rows in the transcript while keeping tool evidence (footer-owned)', () => {
const workflowStatusHistory = [
{
phase: 'context',
@@ -977,9 +933,9 @@ describe('MessageItem', () => {
/>
));
- expect(screen.getByText('Reading current Pulse inventory.')).toBeInTheDocument();
+ expect(screen.queryByText('Reading current Pulse inventory.')).not.toBeInTheDocument();
expect(screen.getByText('3 devices found')).toBeInTheDocument();
- expect(screen.getByText('Waiting for assistant.')).toBeInTheDocument();
+ expect(screen.queryByText('Waiting for assistant.')).not.toBeInTheDocument();
expect(screen.queryByText(/pulse_query/)).not.toBeInTheDocument();
});
@@ -1006,7 +962,7 @@ describe('MessageItem', () => {
expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
});
- it('keeps transcript workflow activity visible before streamed content', () => {
+ it('does not render workflow activity as a transcript row before streamed content (footer-owned)', () => {
render(() => (
<MessageItem
message={makeMessage({
@@ -1029,12 +985,12 @@ describe('MessageItem', () => {
/>
));
- expect(screen.getByText('Waiting for assistant.')).toBeInTheDocument();
+ expect(screen.queryByText('Waiting for assistant.')).not.toBeInTheDocument();
expect(screen.getByText('Partial answer')).toBeInTheDocument();
expect(screen.queryByText('Thinking...')).not.toBeInTheDocument();
});
- it('keeps completed transcript workflow activity visible after the turn finishes', () => {
+ it('does not render completed workflow activity as a transcript row after the turn finishes (footer-owned)', () => {
render(() => (
<MessageItem
message={makeMessage({
@@ -1057,12 +1013,12 @@ describe('MessageItem', () => {
/>
));
- expect(screen.getByText('Waiting for assistant.')).toBeInTheDocument();
+ expect(screen.queryByText('Waiting for assistant.')).not.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', () => {
+ it('does not render request-start activity as a transcript row beside skipped tool evidence (footer-owned)', () => {
render(() => (
<MessageItem
message={makeMessage({
@@ -1102,7 +1058,7 @@ describe('MessageItem', () => {
/>
));
- expect(screen.getByText('Preparing Pulse context.')).toBeInTheDocument();
+ expect(screen.queryByText('Preparing Pulse context.')).not.toBeInTheDocument();
expect(screen.getByText('current_resource unavailable')).toBeInTheDocument();
expect(
screen.getByText(
@@ -1214,7 +1170,7 @@ describe('MessageItem', () => {
).toHaveTextContent('Using Qwen 3.7 Plus via OpenRouter');
});
- it('keeps request-start progress visible next to selected model route evidence', () => {
+ it('does not render request-start progress as a transcript row next to selected model route evidence (footer-owned)', () => {
const events: StreamDisplayEvent[] = [
{
type: 'model_switch',
@@ -1254,7 +1210,7 @@ describe('MessageItem', () => {
expect(
screen.getByRole('status', { name: 'Assistant model route selected' }),
).toHaveTextContent('Using Qwen 3.7 Plus via OpenRouter');
- expect(screen.getByText(/Preparing Pulse context\./)).toBeInTheDocument();
+ expect(screen.queryByText(/Preparing Pulse context\./)).not.toBeInTheDocument();
});
it('renders model route switches with previous and next routes', () => {
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index c09e86e4f7..b453e02957 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -2434,8 +2434,25 @@ export const AIChat: Component<AIChatProps> = (props) => {
return '';
});
+ // The activity dock is Pulse's single live "assistant is working" footer (the
+ // OpenCode model: live status lives in a pinned footer, never narrated into the
+ // transcript). It must stay up for the whole turn. `chat.isLoading()` flips
+ // false at visible-turn-complete (as soon as the answer is shown), which is too
+ // early — so the dock would flash its status for a moment and vanish. Gate the
+ // dock on the streaming assistant message instead, which stays true until the
+ // turn fully settles.
+ const assistantTurnActive = createMemo(() => {
+ if (chat.isLoading()) return true;
+ const messages = chat.messages();
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
+ const message = messages[index];
+ if (message.role === 'assistant') return message.isStreaming !== false;
+ if (message.role === 'user') return false;
+ }
+ return false;
+ });
const activeAssistantMessage = createMemo(() => {
- if (!chat.isLoading()) return undefined;
+ if (!assistantTurnActive()) return undefined;
const messages = chat.messages();
for (let index = messages.length - 1; index >= 0; index -= 1) {
const message = messages[index];
@@ -2464,7 +2481,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
});
const pacedActiveWorkflowStatus = createPacedWorkflowStatus(
activeWorkflowStatusHistory,
- () => chat.isLoading() && activeWorkflowStatusHistory().length > 1,
+ () => assistantTurnActive() && activeWorkflowStatusHistory().length > 1,
activeWorkflowStatusPaceSequenceKey,
);
const messagesWithPacedActiveWorkflowStatus = createMemo(() => {
@@ -2489,7 +2506,7 @@ export const AIChat: Component<AIChatProps> = (props) => {
const currentStatus = createMemo(() => {
return getAssistantActiveTurnStatus(
messagesWithPacedActiveWorkflowStatus(),
- chat.isLoading(),
+ assistantTurnActive(),
currentStatusNow(),
);
});