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 System Messages Stable During Collapse (#16780)

lia-by-librechat[bot]cd4ae0f37f1c
diff --git a/client/src/components/Chat/Messages/Content/Wakeup.tsx b/client/src/components/Chat/Messages/Content/Wakeup.tsx
index a918d656d8..7b90ff0e29 100644
--- a/client/src/components/Chat/Messages/Content/Wakeup.tsx
+++ b/client/src/components/Chat/Messages/Content/Wakeup.tsx
@@ -164,7 +164,7 @@ const Wakeup = memo(function Wakeup({
);
return (
- <div className={cn('max-w-full', isExpanded && 'w-[36rem]')}>
+ <div className={cn('max-w-full', shouldRenderBody && 'w-[36rem]')}>
<Button
variant="ghost"
type="button"
diff --git a/client/src/components/Chat/Messages/Content/__tests__/Wakeup.test.tsx b/client/src/components/Chat/Messages/Content/__tests__/Wakeup.test.tsx
index a694b0cdc4..acca733107 100644
--- a/client/src/components/Chat/Messages/Content/__tests__/Wakeup.test.tsx
+++ b/client/src/components/Chat/Messages/Content/__tests__/Wakeup.test.tsx
@@ -95,6 +95,65 @@ const subagentDisplay = {
};
describe('Wakeup', () => {
+ it.each([
+ ['subagent', subagentDisplay, 'com_ui_wakeup_subagent_completed'],
+ [
+ 'background tool',
+ {
+ kind: 'background_tool' as const,
+ tasks: [
+ {
+ taskId: 'bg-wide',
+ status: 'completed' as const,
+ result: 'wide output '.repeat(200),
+ toolName: 'bash_tool',
+ },
+ ],
+ },
+ 'com_ui_wakeup_task_finished',
+ ],
+ ])('holds the %s width until its closing body unmounts', (_kind, display, label) => {
+ render(
+ <ChatSurfaceHarness>
+ <RecoilRoot>
+ <Wakeup display={display} conversationId="conversation-1" />
+ </RecoilRoot>
+ </ChatSurfaceHarness>,
+ );
+
+ const header = screen.getByRole('button', { name: label });
+ const panel = screen.getByTestId('wakeup-panel');
+ const card = header.parentElement;
+ expect(card).not.toHaveClass('w-[36rem]');
+ expect(panel).toBeEmptyDOMElement();
+
+ fireEvent.click(header);
+ expect(card).toHaveClass('w-[36rem]');
+ expect(panel).not.toBeEmptyDOMElement();
+
+ fireEvent.click(header);
+ expect(header).toHaveAttribute('aria-expanded', 'false');
+ expect(panel).toHaveAttribute('aria-hidden', 'true');
+ expect(panel.firstElementChild).toHaveAttribute('inert');
+ expect(card).toHaveClass('w-[36rem]');
+ expect(panel).not.toBeEmptyDOMElement();
+
+ fireEvent.transitionEnd(panel.firstElementChild!);
+ expect(card).toHaveClass('w-[36rem]');
+ expect(panel).not.toBeEmptyDOMElement();
+
+ fireEvent.click(header);
+ fireEvent.transitionEnd(panel);
+ expect(header).toHaveAttribute('aria-expanded', 'true');
+ expect(card).toHaveClass('w-[36rem]');
+ expect(panel).not.toBeEmptyDOMElement();
+
+ fireEvent.click(header);
+ fireEvent.transitionEnd(panel);
+ expect(card).not.toHaveClass('w-[36rem]');
+ expect(panel).toBeEmptyDOMElement();
+ });
+
it('renders a collapsible subagent completion card with the result and panel affordance', () => {
render(
<ChatSurfaceHarness>