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.

Preserve queued Assistant workflow pacing

rcourtman9b77bc50574c
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index eef015daeb..72604138a6 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -2205,6 +2205,14 @@ Queued follow-up pressure is part of that active-turn state: the frontend
derives the count from queued user transcript turns, appends it to the primary
active Assistant headline while a turn is running, and keeps the separate
queued-follow-up row actionable for reorder/cancel operations.
+That suffix must compose with live workflow pacing rather than disabling it:
+when backend workflow states arrive in a burst, the active headline still walks
+through the paced status sequence while retaining the queued follow-up count.
+This preserves the OpenCode-referenced live-part feel from
+`packages/tui/src/routes/session/index.tsx` lines 1492-1503 and the running
+tool metadata updates in `packages/opencode/src/session/tools.ts` lines 54-63,
+while adapting the interaction to Pulse's single active-turn plus queued
+follow-up safety model.
Assistant command access follows the same OpenCode-referenced footer principle:
commands are reachable from prompt-adjacent chrome, not only from a hidden slash
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 92ab1b7bc8..0fec329228 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -5284,6 +5284,79 @@ describe('AIChat', () => {
expect(status).not.toHaveTextContent('Reading current Pulse inventory with pulse_query.');
});
+ it('paces burst workflow progress without dropping queued follow-up pressure', async () => {
+ vi.useFakeTimers();
+ vi.setSystemTime(1_200);
+ 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: 'OpenRouter is starting the response.',
+ startedAt: 1_200,
+ },
+ ];
+ mockChat.isLoading.mockImplementation(() => isLoading());
+ mockChat.messages.mockImplementation(() => messages());
+ mockChat.queuedFollowUpCount.mockReturnValue(1);
+ renderChat();
+
+ setIsLoading(true);
+ setMessages([
+ {
+ id: 'assistant-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,
+ },
+ ],
+ },
+ {
+ id: 'queued-user-1',
+ role: 'user' as const,
+ content: 'follow up',
+ timestamp: new Date(),
+ delivery: 'queued',
+ },
+ ]);
+
+ 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.');
+ });
+
it('keeps pending tool progress visible in the active turn status', () => {
mockChat.isLoading.mockReturnValue(true);
mockChat.messages.mockReturnValue([
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
index bbdc58fbf2..376b508905 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
@@ -1,5 +1,9 @@
import { describe, expect, it } from 'vitest';
-import { formatAssistantWorkflowStatus, getAssistantActiveTurnStatus } from '../activeTurnStatus';
+import {
+ formatAssistantWorkflowStatus,
+ getAssistantActiveTurnStatus,
+ withAssistantQueuedFollowUpStatus,
+} from '../activeTurnStatus';
import type { ChatMessage } from '../types';
const assistantMessage = (overrides: Partial<ChatMessage> = {}): ChatMessage => ({
@@ -66,6 +70,27 @@ describe('getAssistantActiveTurnStatus', () => {
});
});
+ it('applies queued follow-up pressure to an existing active status', () => {
+ expect(
+ withAssistantQueuedFollowUpStatus(
+ {
+ type: 'thinking',
+ text: 'OpenRouter is starting the response.',
+ startedAt: 1_000,
+ },
+ [
+ assistantMessage({ isStreaming: true }),
+ userMessage({ id: 'user-2', content: 'First follow-up', delivery: 'queued' }),
+ userMessage({ id: 'user-3', content: 'Second follow-up', delivery: 'queued' }),
+ ],
+ ),
+ ).toEqual({
+ type: 'thinking',
+ text: 'OpenRouter is starting the response. · 2 follow-ups queued',
+ startedAt: 1_000,
+ });
+ });
+
it('surfaces the current pending tool from active message state', () => {
const startedAt = Date.now() - 5_000;
expect(
diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
index 0eb5ea4661..93de6485f4 100644
--- a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
+++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
@@ -573,24 +573,24 @@ const initialRequestStatus = (
};
};
-const queuedFollowUpCount = (messages: ChatMessage[]): number =>
+export const getAssistantQueuedFollowUpCount = (messages: ChatMessage[]): number =>
messages.reduce(
(count, message) =>
message.role === 'user' && message.delivery === 'queued' ? count + 1 : count,
0,
);
-const queuedFollowUpSuffix = (messages: ChatMessage[]): string => {
- const count = queuedFollowUpCount(messages);
+export const getAssistantQueuedFollowUpStatusSuffix = (messages: ChatMessage[]): string => {
+ const count = getAssistantQueuedFollowUpCount(messages);
if (count <= 0) return '';
return ` · ${count} ${count === 1 ? 'follow-up' : 'follow-ups'} queued`;
};
-const withQueuedFollowUpStatus = (
+export const withAssistantQueuedFollowUpStatus = (
status: AssistantActiveTurnStatus,
messages: ChatMessage[],
): AssistantActiveTurnStatus => {
- const suffix = queuedFollowUpSuffix(messages);
+ const suffix = getAssistantQueuedFollowUpStatusSuffix(messages);
if (!suffix) return status;
return {
...status,
@@ -607,7 +607,7 @@ export const getAssistantActiveTurnStatus = (
const assistantMessage = [...messages].reverse().find((message) => message.role === 'assistant');
if (!assistantMessage) {
- return withQueuedFollowUpStatus(initialRequestStatus(messages), messages);
+ return withAssistantQueuedFollowUpStatus(initialRequestStatus(messages), messages);
}
const statusCandidates: AssistantActiveTurnStatusCandidate[] = [];
@@ -647,7 +647,7 @@ export const getAssistantActiveTurnStatus = (
);
if (freshestStatus) {
- return withQueuedFollowUpStatus(
+ return withAssistantQueuedFollowUpStatus(
{
type: freshestStatus.type,
text: freshestStatus.text,
@@ -658,11 +658,11 @@ export const getAssistantActiveTurnStatus = (
}
if (hasVisibleAssistantOutput(assistantMessage)) {
- return withQueuedFollowUpStatus(
+ return withAssistantQueuedFollowUpStatus(
{ type: 'generating', text: 'Generating response' },
messages,
);
}
- return withQueuedFollowUpStatus(initialRequestStatus(messages, assistantMessage), messages);
+ return withAssistantQueuedFollowUpStatus(initialRequestStatus(messages, assistantMessage), messages);
};
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index ccdeedaad9..bf6a5e451c 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -150,7 +150,11 @@ import { AssistantCommandHelpDialog } from './AssistantCommandHelpDialog';
import { ModelSelector } from './ModelSelector';
import { MentionAutocomplete, type MentionResource } from './MentionAutocomplete';
import { SlashCommandAutocomplete } from './SlashCommandAutocomplete';
-import { formatAssistantWorkflowStatus, getAssistantActiveTurnStatus } from './activeTurnStatus';
+import {
+ formatAssistantWorkflowStatus,
+ getAssistantActiveTurnStatus,
+ withAssistantQueuedFollowUpStatus,
+} from './activeTurnStatus';
import { getLastAssistantAnswerText } from './assistantAnswerText';
import {
getNextAssistantRecentModelRoute,
@@ -2490,15 +2494,24 @@ export const AIChat: Component<AIChatProps> = (props) => {
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 !== latestWorkflowText ||
- status.type !== expectedType ||
+ status.text !== latestWorkflowStatus.text ||
+ status.type !== latestWorkflowStatus.type ||
(statusStartedAt !== undefined &&
workflowStartedAt !== undefined &&
statusStartedAt !== workflowStartedAt)
@@ -2508,12 +2521,15 @@ export const AIChat: Component<AIChatProps> = (props) => {
const pacedText = formatAssistantWorkflowStatus(pacedWorkflowStatus, currentStatusNow());
if (!pacedText) return status;
- return {
- ...status,
- type: pacedWorkflowStatus.tool ? 'tool' : 'thinking',
- text: pacedText,
- startedAt: pacedWorkflowStatus.startedAt,
- };
+ return withAssistantQueuedFollowUpStatus(
+ {
+ ...status,
+ type: pacedWorkflowStatus.tool ? 'tool' : 'thinking',
+ text: pacedText,
+ startedAt: pacedWorkflowStatus.startedAt,
+ },
+ messages,
+ );
});
createEffect(() => {
const status = currentStatus();