Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🫡 fix: Keep Pending Steering Within the Chat Column (#16621)
lia-by-librechat[bot]d11a6ecdc4ae
diff --git a/client/src/components/Chat/Messages/Content/Parts/PendingSteers.tsx b/client/src/components/Chat/Messages/Content/Parts/PendingSteers.tsxindex bb0f5cdbdb..94fbbb9dad 100644--- a/client/src/components/Chat/Messages/Content/Parts/PendingSteers.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/PendingSteers.tsx@@ -4,6 +4,7 @@ import { useQueryClient } from '@tanstack/react-query';import { QueryKeys, type TMessage } from 'librechat-data-provider';import type { SteerReceiptState } from '~/components/Chat/Steering/Receipt';import useSteerCancel, { useSteerMoveToQueue, useSteerRehome } from '~/hooks/Chat/useSteerCancel';+import { getMessageRowWidthClass } from '~/components/Chat/Messages/ui/MessageRow';import EscalateNowButton from '~/components/Chat/Input/EscalateNowButton';import { useMessagePartsHost } from '~/Providers/MessagePartsHostContext';import useSteerEscalate from '~/hooks/Chat/useSteerEscalate';@@ -30,9 +31,10 @@ interface PendingSteersProps {/** The pane rendering this tree: its sibling selection picks the branch the* pause check reads, which another pane's selection would get wrong. */index?: number;+ fullWidth?: boolean;}-function PendingSteers({ conversationId, index = 0 }: PendingSteersProps) {+function PendingSteers({ conversationId, index = 0, fullWidth = false }: PendingSteersProps) {const localize = useLocalize();const { useToast, usePendingSteers, useSteerEscalating, usePaneConversationId } =useMessagePartsHost();@@ -131,7 +133,12 @@ function PendingSteers({ conversationId, index = 0 }: PendingSteersProps) {};return (- <div role="list" aria-label={localize('com_ui_steer_in_flight')} data-testid="pending-steers">+ <div+ role="list"+ aria-label={localize('com_ui_steer_in_flight')}+ className={cn('mx-auto min-w-0 px-4', getMessageRowWidthClass({ fullWidth }))}+ data-testid="pending-steers"+ >{steers.map((steer) => {const deliveryUncertain = steer.deliveryUncertain === true;const retrySafe = !isLegacyDeliveryUncertain(steer);@@ -156,7 +163,7 @@ function PendingSteers({ conversationId, index = 0 }: PendingSteersProps) {receiptState={receiptState}/>{steer.status === 'failed' ? (- <div className="-mt-2 mb-2 flex items-center gap-3 pl-9 text-xs">+ <div className="-mt-2 mb-2 flex flex-wrap items-center justify-end gap-3 text-xs">{quoteCount > 0 && (<span className="text-text-secondary flex items-center gap-0.5"><TextQuote className="h-3.5 w-3.5" aria-hidden="true" />@@ -202,12 +209,7 @@ function PendingSteers({ conversationId, index = 0 }: PendingSteersProps) {)}</div>) : (- <div className="text-text-secondary -mt-2 mb-2 flex items-center gap-2 pl-9 text-xs">- <span>- {localize(- steer.preempt === true ? 'com_ui_steer_in_flight_preempt' : 'com_ui_sending',- )}- </span>+ <div className="text-text-secondary -mt-2 mb-2 flex flex-wrap items-center justify-end gap-2 text-xs">{/* Only a `pending` steer can be armed: `sending` has no server idyet, and one already interrupting has nothing left to escalate. */}{steer.status === 'pending' && steer.preempt !== true && (diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsxindex 88ec9779b5..0109213308 100644--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx@@ -46,9 +46,14 @@ jest.mock('~/hooks/Chat/useSteerCancel', () => ({useSteerRehome: () => mockRehome,}));-jest.mock('../SteerPart', () => ({+jest.mock('~/Providers', () => ({+ useShareContext: () => ({}),+ useFileMapContext: () => ({}),+}));++jest.mock('~/components/Chat/Messages/Content/MarkdownLite', () => ({__esModule: true,- default: ({ steer }: { steer: string }) => <div data-testid="steer-part">{steer}</div>,+ default: ({ content }: { content: string }) => <span>{content}</span>,}));const CONVO_ID = 'convo-1';@@ -69,6 +74,7 @@ function renderPending(pane?: { index: number; siblingKeyId: string; otherConversationId: string },/** Pane 0 still names the previous chat while this one renders from cache. */stalePaneConversationId?: string,+ fullWidth = false,) {/* The escalation control resolves the cache through the branch-awarelatest-message hook, using the same providers the chat view supplies. */@@ -107,7 +113,7 @@ function renderPending(set(store.pendingSteersByConvoId(CONVO_ID), steers);}}>- <PendingSteers conversationId={CONVO_ID} index={pane?.index} />+ <PendingSteers conversationId={CONVO_ID} index={pane?.index} fullWidth={fullWidth} /></RecoilRoot></JotaiProvider></QueryClientProvider>@@ -126,10 +132,68 @@ describe('PendingSteers', () => {expect(container).toBeEmptyDOMElement();});- it('renders a dimmed steer part with sending status', () => {- renderPending([pending()]);+ it.each([+ ['sending', { status: 'sending' as const }, 'com_ui_steer_sending'],+ ['delivered', { status: 'pending' as const }, 'com_ui_steer_delivered'],+ [+ 'interrupting',+ { status: 'pending' as const, preempt: true },+ 'com_ui_steer_in_flight_preempt',+ ],+ ])('renders one %s status beneath the bubble', (receiptState, over, label) => {+ renderPending([pending(over)]);+expect(screen.getByTestId('steer-part')).toHaveTextContent('change of plan');- expect(screen.getByText('com_ui_sending')).toBeInTheDocument();+ expect(screen.getByRole('listitem')).toHaveClass('opacity-60');+ expect(screen.getByTestId('steer-receipt')).toHaveAttribute('data-receipt-state', receiptState);+ expect(screen.getAllByText(label)).toHaveLength(1);+ expect(screen.queryByText('com_ui_sending')).not.toBeInTheDocument();+ if (receiptState !== 'sending') {+ expect(screen.queryByText('com_ui_steer_sending')).not.toBeInTheDocument();+ }+ });++ it('keeps delivered controls available and aligned with the bubble', () => {+ renderPending([pending({ status: 'pending' })]);++ expect(screen.getByTestId('steer-escalate-now')).toBeEnabled();+ expect(screen.getByRole('button', { name: 'com_ui_convert_to_queue' })).toBeEnabled();+ const cancel = screen.getByRole('button', { name: 'com_ui_cancel' });+ expect(cancel).toBeEnabled();+ expect(cancel.parentElement).toHaveClass('flex-wrap', 'justify-end');+ expect(cancel.parentElement).not.toHaveClass('pl-9');+ });++ it('aligns failed-steer recovery actions with the bubble and allows wrapping', () => {+ renderPending([pending({ status: 'failed' })]);++ const retry = screen.getByRole('button', { name: 'com_ui_retry' });+ expect(retry.parentElement).toHaveClass('flex-wrap', 'justify-end');+ expect(retry.parentElement).not.toHaveClass('pl-9');+ });++ it.each(['sending', 'pending', 'failed'] as const)(+ 'constrains %s steers to the centered message column with mobile gutters',+ (status) => {+ renderPending([pending({ status })]);++ expect(screen.getByTestId('pending-steers')).toHaveClass(+ 'mx-auto',+ 'w-full',+ 'px-4',+ 'sm:px-2',+ 'md:max-w-3xl',+ 'xl:max-w-4xl',+ );+ },+ );++ it('uses the host-supplied full-width preference without imposing a narrower column', () => {+ renderPending([pending()], undefined, undefined, undefined, undefined, true);++ const list = screen.getByTestId('pending-steers');+ expect(list).toHaveClass('mx-auto', 'w-full', 'max-w-full', 'px-4', 'sm:px-2');+ expect(list).not.toHaveClass('md:max-w-3xl', 'xl:max-w-4xl');});it('offers retry and send-as-new on failure', () => {diff --git a/client/src/components/Chat/Messages/MessagesView.tsx b/client/src/components/Chat/Messages/MessagesView.tsxindex 684c479846..8e0e80c961 100644--- a/client/src/components/Chat/Messages/MessagesView.tsx+++ b/client/src/components/Chat/Messages/MessagesView.tsx@@ -197,7 +197,11 @@ function MessagesViewContent({* and Escalate actions would mutate that run while sitting at* the destination thread's tail. */}{treeConversationId != null && (- <PendingSteers conversationId={treeConversationId} index={index} />+ <PendingSteers+ conversationId={treeConversationId}+ index={index}+ fullWidth={maximizeChatSpace}+ />)}<div id="messages-end" className="group h-0 w-full shrink-0" ref={messagesEndRef} /></div>diff --git a/client/src/components/Chat/Messages/__tests__/MessagesView.spec.tsx b/client/src/components/Chat/Messages/__tests__/MessagesView.spec.tsxindex 6d87d0c508..370e1aac15 100644--- a/client/src/components/Chat/Messages/__tests__/MessagesView.spec.tsx+++ b/client/src/components/Chat/Messages/__tests__/MessagesView.spec.tsx@@ -3,6 +3,8 @@ import { render, screen } from '@testing-library/react';import type { TMessage } from 'librechat-data-provider';let mockMessagesKey = 'convo-1';+let mockMaximizeChatSpace = false;+let mockFlatThread = false;jest.mock('jotai', () => ({...jest.requireActual('jotai'),@@ -46,7 +48,7 @@ jest.mock('~/hooks/Messages/useThreadRows', () => ({}));jest.mock('~/components/Chat/Subagents/surface', () => ({- useChatSurface: () => ({ showScrollButton: false, maximizeChatSpace: false }),+ useChatSurface: () => ({ showScrollButton: false, maximizeChatSpace: mockMaximizeChatSpace }),}));jest.mock('~/store/autoScroll', () => ({ autoScrollAtom: {} }));@@ -56,7 +58,9 @@ jest.mock('~/store', () => ({}));jest.mock('../Thread', () => ({- FLAT_THREAD: false,+ get FLAT_THREAD() {+ return mockFlatThread;+ },ThreadList: () => <div data-testid="flat-thread" />,}));@@ -67,8 +71,12 @@ jest.mock('../MultiMessage', () => ({jest.mock('../Content/Parts/PendingSteers', () => ({__esModule: true,- default: ({ conversationId }: { conversationId: string }) => (- <div data-testid="pending-steers" data-conversation-id={conversationId} />+ default: ({ conversationId, fullWidth }: { conversationId: string; fullWidth: boolean }) => (+ <div+ data-testid="pending-steers"+ data-conversation-id={conversationId}+ data-full-width={String(fullWidth)}+ />),}));@@ -101,6 +109,8 @@ const messageTree = [describe('MessagesView pending steers', () => {beforeEach(() => {mockMessagesKey = 'convo-1';+ mockMaximizeChatSpace = false;+ mockFlatThread = false;});it('keeps the failed-steer surface mounted in the recursive renderer', () => {@@ -111,6 +121,29 @@ describe('MessagesView pending steers', () => {expect(screen.queryByTestId('flat-thread')).not.toBeInTheDocument();});+ it.each([false, true])(+ 'passes the host chat width preference (%s) to pending steers',+ (fullWidth) => {+ mockMaximizeChatSpace = fullWidth;+ render(<MessagesView messagesTree={messageTree} messages={messageTree} />);++ expect(screen.getByTestId('pending-steers')).toHaveAttribute(+ 'data-full-width',+ String(fullWidth),+ );+ },+ );++ it('passes the full-width preference in the flat renderer too', () => {+ mockMaximizeChatSpace = true;+ mockFlatThread = true;+ render(<MessagesView messagesTree={messageTree} messages={messageTree} />);++ expect(screen.getByTestId('flat-thread')).toBeInTheDocument();+ expect(screen.getByTestId('pending-steers')).toHaveAttribute('data-full-width', 'true');+ expect(screen.queryByTestId('multi-message')).not.toBeInTheDocument();+ });+it('keys the pending surface to the rendered tree, not the lagging context', () => {/** Warm-cache navigation renders the destination tree while the Recoil* conversation still names the source chat. Cancel and Escalate must actdiff --git a/e2e/specs/mock/scenarios/composer-redesign.spec.ts b/e2e/specs/mock/scenarios/composer-redesign.spec.tsindex 4e2880dee9..183540aeaa 100644--- a/e2e/specs/mock/scenarios/composer-redesign.spec.ts+++ b/e2e/specs/mock/scenarios/composer-redesign.spec.ts@@ -190,7 +190,10 @@ test.describe('composer redesign contracts', () => {.getByTestId('pending-steers').getByRole('listitem').filter({ hasText: 'pending steer' });- await expect(bubble).toContainText('Sending');+ await expect(bubble.getByTestId('steer-receipt')).toHaveAttribute(+ 'data-receipt-state',+ 'delivered',+ );await bubble.getByRole('button', { name: 'Cancel', exact: true }).click();await expect(bubble).toHaveCount(0);await expect(messagesView(page).getByText('pending steer', { exact: true })).toHaveCount(0);@@ -207,7 +210,10 @@ test.describe('composer redesign contracts', () => {.getByTestId('pending-steers').getByRole('listitem').filter({ hasText: 'pending steer' });- await expect(bubble).toContainText('Sending');+ await expect(bubble.getByTestId('steer-receipt')).toHaveAttribute(+ 'data-receipt-state',+ 'delivered',+ );await bubble.getByRole('button', { name: 'Cancel', exact: true }).click();await expect(bubble).toHaveCount(0);await expect(messageInput(page)).toHaveValue('pending steer');@@ -224,7 +230,10 @@ test.describe('composer redesign contracts', () => {.getByTestId('pending-steers').getByRole('listitem').filter({ hasText: 'pending steer' });- await expect(bubble).toContainText('Sending');+ await expect(bubble.getByTestId('steer-receipt')).toHaveAttribute(+ 'data-receipt-state',+ 'delivered',+ );/** A draft staged while the cancel is in flight owns the composer. The* reclaimed steer is a different message: gluing the two together would* send one submission the user never wrote, so it becomes a queued@@ -250,13 +259,35 @@ test.describe('composer redesign contracts', () => {}) => {await openComposer(page);await startRun(page, `pending-status-${Date.now()}`);- await messageInput(page).fill('pending status');- await page.getByTestId('during-run-send-button').click();+ let releaseRequest: () => void = () => {};+ const requestGate = new Promise<void>((resolve) => {+ releaseRequest = resolve;+ });+ await page.route('**/api/agents/chat/steer', async (route) => {+ await requestGate;+ await route.fallback();+ });const bubble = page.getByTestId('pending-steers').getByRole('listitem').filter({ hasText: 'pending status' });- await expect(bubble).toBeVisible();- await expect(bubble).toContainText('Sending');+ const receipt = bubble.getByTestId('steer-receipt');+ try {+ await messageInput(page).fill('pending status');+ await page.getByTestId('during-run-send-button').click();+ await expect(bubble).toBeVisible();+ await expect(receipt).toHaveAttribute('data-receipt-state', 'sending');+ await expect(bubble.getByText(/^Sending/)).toHaveCount(1);+ } finally {+ releaseRequest();+ }+ await expect(receipt).toHaveAttribute('data-receipt-state', 'delivered');+ await expect(bubble.getByText(/^Sending/)).toHaveCount(0);+ await expect(bubble.getByRole('button', { name: 'Cancel', exact: true })).toBeEnabled();+ await expect(+ messagesView(page).locator(+ '[data-testid="steer-part"]:not([data-testid="pending-steers"] *)',+ ),+ ).toHaveCount(0);});});diff --git a/e2e/specs/mock/steering-escalation.spec.ts b/e2e/specs/mock/steering-escalation.spec.tsindex e3aa388b31..c44ff9c064 100644--- a/e2e/specs/mock/steering-escalation.spec.ts+++ b/e2e/specs/mock/steering-escalation.spec.ts@@ -1,4 +1,6 @@import { expect, test } from '@playwright/test';+import { mkdirSync } from 'node:fs';+import path from 'node:path';import type { Page, Response } from '@playwright/test';import {MOCK_ENDPOINTS,@@ -141,56 +143,121 @@ test.describe('escalating waiting messages to an interrupt', () => {await expect(queuedRows(page)).toHaveCount(0);});- test('waiting steer bubble arms in place via POST /chat/steer/arm and seals mid-stream', async ({- page,- }) => {- test.setTimeout(150000);- const label = uniqueLabel('bubble-arm');- const steerText = `Armed waiting steer ${label}`;-- await page.goto(NEW_CHAT_PATH, { timeout: 10000 });- await selectMockEndpoint(page, MOCK_ENDPOINTS[0]);- await establishConversation(page, `bubble-arm-setup-${label}`);-- const run = await sendMessage(page, `E2E_SLOW_REPLY:${label}`);- expect(run.ok()).toBeTruthy();- await expect(messagesView(page).getByText('chunk-010')).toBeVisible({ timeout: 15000 });-- // An ORDINARY steer (plain Enter, preference off): with no tool boundary- // in this stream it stays acknowledged-and-waiting as a bubble.- await typeDuringRun(page, steerText);- const [steerResponse] = await Promise.all([- page.waitForResponse(isSteerRequest, { timeout: 15000 }),- messageInput(page).press('Enter'),- ]);- expect(steerResponse.status()).toBe(202);- expect(((await steerResponse.json()) as { preempt?: boolean }).preempt).toBeFalsy();- const bubble = inFlightSteers(page).filter({ hasText: steerText });- await expect(bubble).toBeVisible({ timeout: 10000 });-- // Escalate via the bubble's always-visible arrow control: ONE atomic- // in-place arm.- const [armResponse] = await Promise.all([- page.waitForResponse(isArmRequest, { timeout: 15000 }),- bubble.getByTestId('steer-escalate-now').click(),- ]);- expect(armResponse.status()).toBe(200);- expect(((await armResponse.json()) as { armed?: boolean }).armed).toBe(true);-- // The stream can consume the armed steer before the HTTP response arrives.- // Whether waiting or already applied, it must no longer offer escalation.- await expect(bubble.getByTestId('steer-escalate-now')).toHaveCount(0);-- // The armed steer seals mid-stream and injects with no tool boundary.- await expect(appliedSteerParts(page).filter({ hasText: steerText })).toHaveCount(1, {- timeout: 90000,+ for (const fullWidth of [false, true]) {+ test(`waiting steer bubble arms in place via POST /chat/steer/arm and seals mid-stream (${fullWidth ? 'full' : 'default'} width)`, async ({+ page,+ }) => {+ test.setTimeout(150000);+ const label = uniqueLabel('bubble-arm');+ const steerText = `Armed waiting steer ${label}`;++ await page.addInitScript((value) => {+ localStorage.setItem('maximizeChatSpace', JSON.stringify(value));+ }, fullWidth);+ await page.goto(NEW_CHAT_PATH, { timeout: 10000 });+ await selectMockEndpoint(page, MOCK_ENDPOINTS[0]);+ await establishConversation(page, `bubble-arm-setup-${label}`);++ const run = await sendMessage(page, `E2E_SLOW_REPLY:${label}`);+ expect(run.ok()).toBeTruthy();+ await expect(messagesView(page).getByText('chunk-010')).toBeVisible({ timeout: 15000 });++ // An ORDINARY steer (plain Enter, preference off): with no tool boundary+ // in this stream it stays acknowledged-and-waiting as a bubble.+ await typeDuringRun(page, steerText);+ const [steerResponse] = await Promise.all([+ page.waitForResponse(isSteerRequest, { timeout: 15000 }),+ messageInput(page).press('Enter'),+ ]);+ expect(steerResponse.status()).toBe(202);+ expect(((await steerResponse.json()) as { preempt?: boolean }).preempt).toBeFalsy();+ const bubble = inFlightSteers(page).filter({ hasText: steerText });+ await expect(bubble).toBeVisible({ timeout: 10000 });+ await expect(bubble.getByTestId('steer-receipt')).toHaveAttribute(+ 'data-receipt-state',+ 'delivered',+ );++ for (const width of [1520, 1024, 390]) {+ await page.setViewportSize({ width, height: 900 });+ const captureDir = process.env.E2E_CAPTURE_DIR;+ if (captureDir) {+ mkdirSync(captureDir, { recursive: true });+ await page.screenshot({+ path: path.join(+ captureDir,+ `pending-steer-${fullWidth ? 'full' : 'default'}-${width}.png`,+ ),+ animations: 'disabled',+ });+ }+ await expect(bubble.getByText(/^Sending/)).toHaveCount(0);+ await expect(+ bubble.getByRole('button', { name: 'Queue for after the response' }),+ ).toBeEnabled();+ const cancel = bubble.getByRole('button', { name: 'Cancel', exact: true });+ const bubbleBox = await bubble.locator('.user-turn').boundingBox();+ const cancelBox = await cancel.boundingBox();+ if (bubbleBox == null || cancelBox == null) {+ throw new Error('The pending steer bubble and its controls must have measurable bounds.');+ }+ await expect+ .poll(+ async () => {+ const messageBounds = await messageTurns(page)+ .first()+ .evaluate((row) => {+ const box = row.getBoundingClientRect();+ const style = getComputedStyle(row);+ return {+ left: box.left + parseFloat(style.paddingLeft),+ right: box.right - parseFloat(style.paddingRight),+ };+ });+ const part = await bubble.getByTestId('steer-part').boundingBox();+ if (part == null) return Infinity;+ return Math.max(+ Math.abs(part.x - messageBounds.left),+ Math.abs(part.x + part.width - messageBounds.right),+ );+ },+ { message: 'Pending steers must match the ordinary message column bounds' },+ )+ .toBeLessThan(2);+ expect(+ Math.abs(cancelBox.x + cancelBox.width - bubbleBox.x - bubbleBox.width),+ ).toBeLessThan(2);+ expect(cancelBox.y).toBeGreaterThanOrEqual(bubbleBox.y + bubbleBox.height);+ expect(await cancel.locator('..').evaluate((row) => getComputedStyle(row).flexWrap)).toBe(+ 'wrap',+ );+ }+ await page.setViewportSize({ width: 1280, height: 900 });++ // Escalate via the bubble's always-visible arrow control: ONE atomic+ // in-place arm.+ const [armResponse] = await Promise.all([+ page.waitForResponse(isArmRequest, { timeout: 15000 }),+ bubble.getByTestId('steer-escalate-now').click(),+ ]);+ expect(armResponse.status()).toBe(200);+ expect(((await armResponse.json()) as { armed?: boolean }).armed).toBe(true);++ // The stream can consume the armed steer before the HTTP response arrives.+ // Whether waiting or already applied, it must no longer offer escalation.+ await expect(bubble.getByTestId('steer-escalate-now')).toHaveCount(0);++ // The armed steer seals mid-stream and injects with no tool boundary.+ await expect(appliedSteerParts(page).filter({ hasText: steerText })).toHaveCount(1, {+ timeout: 90000,+ });+ await expect(inFlightSteers(page)).toHaveCount(0);+ await expect(messagesView(page).getByText(SLOW_REPLY_LAST_CHUNK)).toHaveCount(0);+ await expect(messagesView(page).getByText('chunk-010')).toBeVisible();+ await expectModelContinuation(page, label, steerText);+ await expect(messageTurns(page)).toHaveCount(4);});- await expect(inFlightSteers(page)).toHaveCount(0);- await expect(messagesView(page).getByText(SLOW_REPLY_LAST_CHUNK)).toHaveCount(0);- await expect(messagesView(page).getByText('chunk-010')).toBeVisible();- await expectModelContinuation(page, label, steerText);- await expect(messageTurns(page)).toHaveCount(4);- });+ }test('always-interrupt toggle in a waiting row menu makes plain Enter preempt', async ({page,