From 9ddf36f510dea272cddee95ec3ae9299add81379 Mon Sep 17 00:00:00 2001 From: Frank Song Date: Thu, 28 May 2026 12:13:30 +0800 Subject: [PATCH] fix: reset _messagesTruncated flag on new session creation newSession() did not reset _messagesTruncated or _oldestIdx, unlike loadSession() which resets both at line 590. When a user switched from a long session (messages > _INITIAL_MSG_LIMIT) to a new session, the stale _messagesTruncated=true caused renderMessages() to show the 'Scroll up or click to load older messages' indicator on a fresh conversation with only 1 message. Add the same reset that loadSession() already performs so newSession() starts with clean pagination state. --- static/sessions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/sessions.js b/static/sessions.js index fb51405e..39015f82 100644 --- a/static/sessions.js +++ b/static/sessions.js @@ -455,6 +455,8 @@ async function newSession(flash, options={}){ _newSessionInFlight=(async()=>{ updateQueueBadge(); S.toolCalls=[]; + _messagesTruncated=false; + _oldestIdx=0; clearLiveToolCards(); // One-shot profile-switch workspace: applied to the first new session after a profile // switch, then cleared. Use a dedicated flag so S._profileDefaultWorkspace (the