diff --git a/desktop/src/features/chats/ui/ChatsScreen.tsx b/desktop/src/features/chats/ui/ChatsScreen.tsx index 5fb4be5441..125d2dce85 100644 --- a/desktop/src/features/chats/ui/ChatsScreen.tsx +++ b/desktop/src/features/chats/ui/ChatsScreen.tsx @@ -338,8 +338,8 @@ export function ChatsScreen({ return null; }, [messages]); // The drawer's open state is a single persisted preference — switching - // chats must NOT reset it (the panel used to re-animate open on every - // switch). null = never toggled: auto-open when the chat has a PR. + // chats must NOT reset it or re-derive it (auto-open-on-PR re-animated + // the drawer on every switch). Purely remembered; default closed. const [workPanelPreference, setWorkPanelPreference] = React.useState< boolean | null >(() => { @@ -358,7 +358,7 @@ export function ChatsScreen({ // Best-effort persistence. } }, []); - const isWorkPanelOpen = workPanelPreference ?? agentPullRequestHref !== null; + const isWorkPanelOpen = workPanelPreference ?? false; const startManagedAgentMutation = useStartManagedAgentMutation(); const [isEnsuringDefaultAgent, setIsEnsuringDefaultAgent] = React.useState(false); diff --git a/desktop/tests/e2e/chats-first-message.spec.ts b/desktop/tests/e2e/chats-first-message.spec.ts index 116d84bf2b..d197f3144a 100644 --- a/desktop/tests/e2e/chats-first-message.spec.ts +++ b/desktop/tests/e2e/chats-first-message.spec.ts @@ -184,7 +184,11 @@ test("first message in a new chat is sent and rendered", async ({ page }) => { await expect( page.locator("[data-link-preview='github-pull-request-agent']"), ).toHaveCount(1, { timeout: 10_000 }); + // The drawer is purely a remembered preference (default closed) — open + // it explicitly; the choice persists across chats and restarts. const workPanel = page.getByTestId("chat-work-panel"); + await expect(workPanel).not.toBeVisible(); + await page.getByTestId("toggle-work-panel").click(); await expect(workPanel).toBeVisible(); await expect(workPanel).toContainText("kennylopez-chatmode"); await expect(