From b1cab5eeb8aaee20b76b3a102f45c3cfb2c5628e Mon Sep 17 00:00:00 2001 From: rcourtman Date: Mon, 8 Jun 2026 02:41:25 +0100 Subject: [PATCH] Keep Assistant queue state out of active status text --- .../AI/Chat/__tests__/AIChat.test.tsx | 17 ++++++++++++----- .../AI/Chat/__tests__/activeTurnStatus.test.ts | 9 ++++++--- .../src/components/AI/Chat/activeTurnStatus.ts | 13 ++++--------- .../src/components/AI/Chat/index.tsx | 13 ++++++++++--- 4 files changed, 32 insertions(+), 20 deletions(-) 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 9a22a4553..32c0680a5 100644 --- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx +++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx @@ -5679,16 +5679,20 @@ describe('AIChat', () => { ]); const status = screen.getByLabelText('Assistant active turn status'); - await waitFor(() => - expect(status).toHaveTextContent('Preparing Pulse context. · 1 follow-up queued'), + await waitFor(() => expect(status).toHaveTextContent('Preparing Pulse context.')); + expect(status).not.toHaveTextContent('follow-up queued'); + expect(screen.getByLabelText('Queued follow-up messages')).toHaveTextContent( + '1 follow-up queued', ); expect(status).not.toHaveTextContent('OpenRouter is starting the response.'); await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_PACE_MS); - expect(status).toHaveTextContent('Reading current Pulse inventory. · 1 follow-up queued'); + expect(status).toHaveTextContent('Reading current Pulse inventory.'); + expect(status).not.toHaveTextContent('follow-up queued'); await vi.advanceTimersByTimeAsync(WORKFLOW_STATUS_PACE_MS); - expect(status).toHaveTextContent('OpenRouter is starting the response. · 1 follow-up queued'); + expect(status).toHaveTextContent('OpenRouter is starting the response.'); + expect(status).not.toHaveTextContent('follow-up queued'); expect(status).not.toHaveTextContent('Preparing Pulse context.'); expect(status).not.toHaveTextContent('Reading current Pulse inventory.'); }); @@ -5842,7 +5846,10 @@ describe('AIChat', () => { expect(activityDock).toContainElement(screen.getByLabelText('Assistant active turn status')); expect(screen.getByLabelText('Assistant active turn status')).toHaveTextContent( - 'Generating response · 1 follow-up queued', + 'Generating response', + ); + expect(screen.getByLabelText('Assistant active turn status')).not.toHaveTextContent( + 'follow-up queued', ); expect(activityDock).toContainElement(screen.getByLabelText('Queued follow-up messages')); expect(screen.getByText('1 follow-up queued')).toBeInTheDocument(); 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 56e648bc4..570c00442 100644 --- a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts +++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts @@ -61,7 +61,8 @@ describe('getAssistantActiveTurnStatus', () => { ), ).toEqual({ type: 'thinking', - text: 'Sending prompt · 1 follow-up queued', + text: 'Sending prompt', + queuedFollowUpCount: 1, startedAt: 1_000, }); }); @@ -82,7 +83,8 @@ describe('getAssistantActiveTurnStatus', () => { ), ).toEqual({ type: 'thinking', - text: 'OpenRouter is starting the response. · 2 follow-ups queued', + text: 'OpenRouter is starting the response.', + queuedFollowUpCount: 2, startedAt: 1_000, }); }); @@ -1016,7 +1018,8 @@ describe('getAssistantActiveTurnStatus', () => { ), ).toEqual({ type: 'generating', - text: 'Generating response · 2 follow-ups queued', + text: 'Generating response', + queuedFollowUpCount: 2, }); }); diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts index f375220f2..3fa224d77 100644 --- a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts +++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts @@ -15,6 +15,7 @@ export interface AssistantActiveTurnStatus { text: string; type: AssistantActiveTurnStatusKind; startedAt?: number; + queuedFollowUpCount?: number; } interface AssistantActiveTurnStatusCandidate extends AssistantActiveTurnStatus { @@ -581,21 +582,15 @@ export const getAssistantQueuedFollowUpCount = (messages: ChatMessage[]): number 0, ); -export const getAssistantQueuedFollowUpStatusSuffix = (messages: ChatMessage[]): string => { - const count = getAssistantQueuedFollowUpCount(messages); - if (count <= 0) return ''; - return ` · ${count} ${count === 1 ? 'follow-up' : 'follow-ups'} queued`; -}; - export const withAssistantQueuedFollowUpStatus = ( status: AssistantActiveTurnStatus, messages: ChatMessage[], ): AssistantActiveTurnStatus => { - const suffix = getAssistantQueuedFollowUpStatusSuffix(messages); - if (!suffix) return status; + const count = getAssistantQueuedFollowUpCount(messages); + if (count <= 0) return status; return { ...status, - text: `${status.text}${suffix}`, + queuedFollowUpCount: count, }; }; diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx index bc296d588..47317ed80 100644 --- a/frontend-modern/src/components/AI/Chat/index.tsx +++ b/frontend-modern/src/components/AI/Chat/index.tsx @@ -2437,6 +2437,9 @@ export const AIChat: Component = (props) => { currentStatusNow(), ); }); + const activityDockQueuedFollowUpCount = createMemo(() => + Math.max(currentStatus()?.queuedFollowUpCount || 0, chat.queuedFollowUpCount()), + ); createEffect(() => { const status = currentStatus(); if (!status?.startedAt) return; @@ -4491,7 +4494,7 @@ export const AIChat: Component = (props) => { when={ currentStatus() || autonomousWarningVisible() || - chat.queuedFollowUpCount() > 0 + activityDockQueuedFollowUpCount() > 0 } >
= (props) => {
- 0}> + 0}>
= (props) => {