From 9c8bc64138cbef081b82836cc3fc677faafdfab0 Mon Sep 17 00:00:00 2001
From: Adam <2363879+adamdotdevin@users.noreply.github.com>
Date: Mon, 29 Dec 2025 02:57:28 -0600
Subject: fix(desktop): sync last agent and model when changing session

---
 packages/app/src/pages/session.tsx | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'packages/app/src/pages/session.tsx')

diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsx
index 019cc305c..ec55acf1e 100644
--- a/packages/app/src/pages/session.tsx
+++ b/packages/app/src/pages/session.tsx
@@ -91,6 +91,18 @@ export default function Page() {
   })
   const lastUserMessage = createMemo(() => visibleUserMessages()?.at(-1))
 
+  createEffect(
+    on(
+      () => lastUserMessage()?.id,
+      () => {
+        const msg = lastUserMessage()
+        if (!msg) return
+        if (msg.agent) local.agent.set(msg.agent)
+        if (msg.model) local.model.set(msg.model)
+      },
+    ),
+  )
+
   const [store, setStore] = createStore({
     clickTimer: undefined as number | undefined,
     activeDraggable: undefined as string | undefined,
-- 
cgit v1.2.3

