fix(webui): pin explicitly-set session titles — stop auto-retitle churn (#2165)#2171
Conversation
Sessions created with an explicit title (POST /api/sessions {"title": ...})
or renamed in the UI were being renamed by the background auto-titler on
essentially every assistant reply — the topic-shift pass replaced any title
with low word-overlap against the new message, with no notion of "the user
chose this name". One session cycled through 3+ names in a single run.
Sessions now persist a title_is_custom flag: set when a title is passed at
creation or via a PUT rename, never set by the auto-titler's own updates.
_should_retitle returns False for pinned sessions; placeholder titles
("New Task" / "New Chat" / empty) still auto-title as before, and
non-pinned auto-generated titles keep the topic-shift pass.
The webui's client-side first-message auto-title sends title_is_custom:
false so it doesn't pin, while the manual rename sends true. An additive
migration adds the column and backfills existing non-placeholder titles
as pinned — wrongly renaming a user's title is worse than never renaming.
Fixes #2165
|
Verdict: Approve ✅ This fixes the annoying churn where naming a session (UI rename or API) didn't stick — the background auto-titler kept renaming it on nearly every reply (#2165). The fix adds a persisted 🔍 Technical detailsCorrectness — verified, no issues found:
Minor (non-blocking):
Strengths:
|
Why this matters
Naming a session — via the UI rename or
POST /api/sessions {"title": ...}— didn't stick: the background auto-titler silently renamed it on essentially every assistant reply, with one session cycling through 3+ names in a single run (#2165). Explicit titles are now pinned via a persistedtitle_is_customflag and are never touched by the auto-titler, while fresh "New Task"/"New Chat" sessions still get auto-titled on the first substantive message exactly as before. An additive migration backfills existing non-placeholder titles as pinned, so already-renamed sessions stop churning too.Test plan
python -m pytest tests/unit/chat/— 798 passed (includes new pin/placeholder/migration cases intest_chat_helpers.py,test_database.py,test_server.py)vitest run— 182 passed (newChatView.autotitle.test.tsx: rename pins, client auto-title doesn't) +tsc --noEmitcleanpython util/lint.py --all— clean