From c9fadf20e171e9e5cd688babeec25da2bfc3de08 Mon Sep 17 00:00:00 2001 From: majdyz Date: Mon, 13 Apr 2026 12:48:03 +0000 Subject: [PATCH] fix(copilot): record current session mode before switching away Old sessions (created before the mode fix) didn't have a recorded mode, so switching away and back would lose the mode. Now we record the current mode for the departing session before switching. --- .../frontend/src/app/(platform)/copilot/useCopilotPage.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts index 5fe2ea19f3..b8548346d5 100644 --- a/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts +++ b/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts @@ -355,6 +355,12 @@ export function useCopilotPage() { } function handleSelectSession(id: string) { + // Record current session's mode before switching away so it's + // preserved when the user switches back — covers sessions created + // before the per-session mode fix was deployed. + if (sessionId) { + recordSessionMode(sessionId); + } setSessionId(id); restoreSessionMode(id); if (isMobile) setDrawerOpen(false);