From f377a663cc333509dae03cbf3cd689158ce145a3 Mon Sep 17 00:00:00 2001 From: Tyler Longwell Date: Sun, 30 Nov 2025 11:10:50 -0500 Subject: [PATCH] cleaner session changing --- crates/goose-tui/src/components/chat.rs | 4 +++- crates/goose-tui/src/state/reducer.rs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/goose-tui/src/components/chat.rs b/crates/goose-tui/src/components/chat.rs index 9482a2c5d5..53edb070d8 100644 --- a/crates/goose-tui/src/components/chat.rs +++ b/crates/goose-tui/src/components/chat.rs @@ -506,12 +506,14 @@ impl Component for ChatComponent { self.last_width = area.width; } - // If state cleared (new session), clear cache + // If state cleared (new session), clear cache and reset scroll if state.messages.len() < self.sealed_count { self.cached_items.clear(); self.cached_mapping.clear(); self.sealed_count = 0; self.last_tool_context.clear(); + self.list_state = ListState::default(); + self.stick_to_bottom = true; } // Determine how many messages are "sealed" diff --git a/crates/goose-tui/src/state/reducer.rs b/crates/goose-tui/src/state/reducer.rs index 7ee74f7669..052e089f46 100644 --- a/crates/goose-tui/src/state/reducer.rs +++ b/crates/goose-tui/src/state/reducer.rs @@ -106,6 +106,8 @@ fn handle_chat(state: &mut AppState, action: &Action) -> bool { Action::CreateNewSession | Action::ResumeSession(_) | Action::ForkFromMessage(_) => { state.is_working = true; state.active_popup = ActivePopup::None; + state.messages.clear(); + state.todos.clear(); true } Action::Error(e) => {