diff --git a/src/tui/app.js b/src/tui/app.js index 24be7c69..76503875 100644 --- a/src/tui/app.js +++ b/src/tui/app.js @@ -589,7 +589,11 @@ export default function App({ /** * Start a new session: generate new UUID, clear conversation, reset state. */ - const handleNewSession = () => { + const handleNewSession = async () => { + // Persist the current session before wiping state + if (onSaveSession) { + await onSaveSession(); + } const newSession = createSession({ provider: sessionState.getProvider() }); sessionState.createNewSession(newSession.sessionId); setIsCompacting(false);