Skip to content

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

🥤 fix: Keep Pending Code Steers Within the Composer (#16446)

lia-by-librechat[bot]ae71af665605
diff --git a/client/src/components/Chat/Input/InFlightSteers.tsx b/client/src/components/Chat/Input/InFlightSteers.tsx
index 12623319b0..87e3d96973 100644
--- a/client/src/components/Chat/Input/InFlightSteers.tsx
+++ b/client/src/components/Chat/Input/InFlightSteers.tsx
@@ -461,7 +461,7 @@ const InFlightSteer = memo(function InFlightSteer({
/* pointer-events-auto: the overlay container disables events so wheeling
* over the gaps reaches the messages behind; each bubble re-enables them
* for its own controls and internal scroll. */
- className="group pointer-events-auto flex flex-col items-end gap-1.5"
+ className="group pointer-events-auto flex max-w-full flex-col items-end gap-1.5"
>
{(images.length > 0 || others.length > 0) && (
<div className="flex flex-wrap items-center justify-end gap-2">
diff --git a/e2e/specs/mock/steering.spec.ts b/e2e/specs/mock/steering.spec.ts
index d3bee372b1..c0e163083c 100644
--- a/e2e/specs/mock/steering.spec.ts
+++ b/e2e/specs/mock/steering.spec.ts
@@ -156,6 +156,104 @@ test.describe('mid-run steering and queuing', () => {
await expect(queuedRows(page)).toHaveCount(0);
});
+ test('keeps a pending fenced-code steer inside the composer at desktop and mobile widths', async ({
+ page,
+ }) => {
+ test.setTimeout(150000);
+ const label = uniqueLabel('steer-code-layout');
+ const steerText = `Please use this example:\n\n\`\`\`js\n${`const payload = '${'x'.repeat(300)}';\n`.repeat(12)}\`\`\``;
+
+ await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
+ await selectMockEndpoint(page, PROVIDER_C);
+ await selectEphemeralMCP(page);
+ await establishConversation(page, `steer-code-setup-${label}`);
+
+ const run = await sendMessage(page, `E2E_STEER_TOOL_REPLY:${label}`);
+ expect(run.ok()).toBeTruthy();
+ await typeDuringRun(page, steerText);
+ const [steerResponse] = await Promise.all([
+ page.waitForResponse(isSteerRequest, { timeout: 15000 }),
+ messageInput(page).press('Enter'),
+ ]);
+ expect(steerResponse.status()).toBe(202);
+
+ const row = inFlightSteers(page).filter({ hasText: 'const payload' });
+ await expect(row.locator('.markdown pre > div')).toHaveCount(1);
+ await expect(row.getByRole('button', { name: 'Show more' })).toBeInViewport();
+ for (const width of [1200, 390]) {
+ await page.setViewportSize({ width, height: 850 });
+ const bounds = await row.evaluate((element) => {
+ const stack = element.closest('[data-testid="in-flight-steers"]')?.getBoundingClientRect();
+ const bubble = element.querySelector('.rounded-theme-surface')?.getBoundingClientRect();
+ const codeBlock = element.querySelector('.markdown pre > div')?.getBoundingClientRect();
+ const code = element.querySelector('.markdown pre code');
+ const codeScroller = code?.parentElement;
+ if (!stack || !bubble || !codeBlock || !code || !codeScroller) {
+ throw new Error('Pending steer code block is missing');
+ }
+ return {
+ stackLeft: stack.left,
+ stackRight: stack.right,
+ bubbleLeft: bubble.left,
+ bubbleRight: bubble.right,
+ codeLeft: codeBlock.left,
+ codeRight: codeBlock.right,
+ codeStartLeft: code.getBoundingClientRect().left,
+ codeScrollWidth: codeScroller.scrollWidth,
+ codeClientWidth: codeScroller.clientWidth,
+ };
+ });
+ expect(bounds.bubbleLeft).toBeGreaterThanOrEqual(bounds.stackLeft);
+ expect(bounds.bubbleRight).toBeLessThanOrEqual(bounds.stackRight);
+ expect(bounds.codeLeft).toBeGreaterThanOrEqual(bounds.bubbleLeft);
+ expect(bounds.codeRight).toBeLessThanOrEqual(bounds.bubbleRight);
+ expect(bounds.codeStartLeft).toBeGreaterThanOrEqual(bounds.codeLeft);
+ await expect(row.locator('.markdown pre').getByText('js', { exact: true })).toBeInViewport();
+ expect(bounds.codeScrollWidth).toBeGreaterThan(bounds.codeClientWidth);
+ await expect(row.getByRole('button', { name: 'Show more' })).toBeInViewport();
+ }
+ await row.getByRole('button', { name: 'Show more' }).click();
+ await expect(row.getByRole('button', { name: 'Show less' })).toBeVisible();
+ });
+
+ test('keeps the beginning of a short code steer visible without expanding', async ({ page }) => {
+ test.setTimeout(150000);
+ const label = uniqueLabel('steer-code-short');
+ const steerText = `\`\`\`js\nconst payload = '${'x'.repeat(300)}';\n\`\`\``;
+
+ await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
+ await selectMockEndpoint(page, PROVIDER_C);
+ await selectEphemeralMCP(page);
+ await establishConversation(page, `steer-code-setup-${label}`);
+
+ const run = await sendMessage(page, `E2E_STEER_TOOL_REPLY:${label}`);
+ expect(run.ok()).toBeTruthy();
+ await typeDuringRun(page, steerText);
+ const [steerResponse] = await Promise.all([
+ page.waitForResponse(isSteerRequest, { timeout: 15000 }),
+ messageInput(page).press('Enter'),
+ ]);
+ expect(steerResponse.status()).toBe(202);
+
+ const row = inFlightSteers(page).filter({ hasText: 'const payload' });
+ await expect(row.locator('.markdown pre code')).toContainText('const payload');
+ for (const width of [1200, 390]) {
+ await page.setViewportSize({ width, height: 850 });
+ const bounds = await row.evaluate((element) => {
+ const stack = element.closest('[data-testid="in-flight-steers"]')?.getBoundingClientRect();
+ const code = element.querySelector('.markdown pre code')?.getBoundingClientRect();
+ if (!stack || !code) {
+ throw new Error('Pending steer code is missing');
+ }
+ return { stackLeft: stack.left, stackRight: stack.right, codeStartLeft: code.left };
+ });
+ expect(bounds.codeStartLeft).toBeGreaterThanOrEqual(bounds.stackLeft);
+ expect(bounds.codeStartLeft).toBeLessThan(bounds.stackRight);
+ await expect(row.locator('.markdown pre').getByText('js', { exact: true })).toBeInViewport();
+ await expect(row.getByRole('button', { name: 'Show more' })).toHaveCount(0);
+ }
+ });
+
/**
* Two steers submitted in quick succession must BOTH inject at the next
* tool-batch boundary: the drain is an atomic take-all, the hook returns one