Summary
Clicking "New Conversation" (or pressing Cmd+K) always creates a new empty session, even when the current session has zero messages. Clicking it rapidly 5 times adds 5 empty sessions to the list. The 60-second cleanup window means they accumulate visibly, and users who frequently use Cmd+K end up with a cluttered session list.
Steps to reproduce
- Open the WebUI — a new empty session is created (normal)
- Without sending any message, click "New Conversation" in the sidebar header
- Another empty session appears in the list
- Click it 5 more times → 5 empty "Untitled" sessions pile up
- They eventually disappear after ~60 seconds, but during that window (and before) the list is cluttered
Root cause — confirmed in code
static/boot.js:385 — the btnNewChat onclick handler:
$('btnNewChat').onclick = async () => {
await newSession();
await renderSessionList();
closeMobileSidebar();
$('msg').focus();
};
static/boot.js:517–519 — Cmd+K shortcut:
if((e.metaKey||e.ctrlKey) && e.key==='k'){
if(!S.busy){ await newSession(); await renderSessionList(); ... }
}
Neither handler checks whether the current session already has zero messages. newSession() unconditionally calls POST /api/session/new, creating and persisting a fresh session every time.
api/models.py:563–567 — the 60-second cleanup filter:
result = [s for s in result if not (
s.get('title', 'Untitled') == 'Untitled'
and s.get('message_count', 0) == 0
and (_now - s.get('updated_at', _now)) > 60
)]
Empty sessions are hidden from the sidebar after 60 seconds, but during the window they're fully visible. And the session files still exist on disk even after they're hidden — the filter is UI-only.
Expected behavior
If the current session is empty (0 messages sent), clicking "New Conversation" or pressing Cmd+K should focus the composer of the existing empty session rather than creating another one.
Proposed fix
Add a guard in both btnNewChat and the Cmd+K handler:
$('btnNewChat').onclick = async () => {
// If current session is already empty, just focus the composer
if (S.session && (S.session.message_count || 0) === 0) {
$('msg').focus();
return;
}
await newSession();
await renderSessionList();
closeMobileSidebar();
$('msg').focus();
};
Same guard for the Cmd+K path. Optionally also clean up orphaned zero-message sessions on server restart or add a "cleanup" call after session creation so old orphan files don't accumulate on disk.
Impact
Low-medium — annoying UX noise, not data-destructive. Users who use Cmd+K habitually as a "go to chat" shortcut hit this constantly.
Summary
Clicking "New Conversation" (or pressing Cmd+K) always creates a new empty session, even when the current session has zero messages. Clicking it rapidly 5 times adds 5 empty sessions to the list. The 60-second cleanup window means they accumulate visibly, and users who frequently use Cmd+K end up with a cluttered session list.
Steps to reproduce
Root cause — confirmed in code
static/boot.js:385— thebtnNewChatonclick handler:static/boot.js:517–519— Cmd+K shortcut:Neither handler checks whether the current session already has zero messages.
newSession()unconditionally callsPOST /api/session/new, creating and persisting a fresh session every time.api/models.py:563–567— the 60-second cleanup filter:Empty sessions are hidden from the sidebar after 60 seconds, but during the window they're fully visible. And the session files still exist on disk even after they're hidden — the filter is UI-only.
Expected behavior
If the current session is empty (0 messages sent), clicking "New Conversation" or pressing Cmd+K should focus the composer of the existing empty session rather than creating another one.
Proposed fix
Add a guard in both
btnNewChatand the Cmd+K handler:Same guard for the Cmd+K path. Optionally also clean up orphaned zero-message sessions on server restart or add a "cleanup" call after session creation so old orphan files don't accumulate on disk.
Impact
Low-medium — annoying UX noise, not data-destructive. Users who use Cmd+K habitually as a "go to chat" shortcut hit this constantly.