Repository navigation
fix(ui): name a chat when its first message is taken, and title cloud chats - #5580
Conversation
… chats A chat left mid-answer stayed "New Task" for good, because only the open window named it. The server now names the chat after its first question as soon as it takes the message, unpinned, so the auto-titler can still replace it. Cloud chats never got a written title: the title request allowed 24 tokens, and fireworks.deepseek-v4p1-flash reasons by default, so it spent all of them reasoning and returned no content. Cloud title requests now get room to reason. The titler also runs on the model the turn actually ran on (relayed turns included), never sends a local chat to a cloud model, and logs failures as warnings instead of at debug.
|
Verdict: Approve with suggestions A chat now gets its name from the server as soon as the server accepts the first message, so a chat you leave mid-answer no longer stays "New Task". Cloud chats get a real written title, because the title request now leaves room for the model's reasoning. The server-side design is sound: renames you make still win, a local chat is never sent to a cloud model just to name it, and the new tests check the real request shape. Two things worth fixing before merge:
Real-world evidenceN/A: no evidence bundle was produced for this run. The verdict rests on static review alone. The Agent UI sidebar behaviour and the Fireworks title call were not exercised here. 🔍 Technical details🟡 Missing real-world evidence for an Agent-UI-visible change 🟢 Retitle retries every turn after a failed title ( 🟢 Client only recognises 🟢 Rename guard is check-then-write ( Strengths
|
|
Checked live in the Agent UI with Fireworks DeepSeek V4 Flash: a chat left 2 s after sending is titled from its question within 3 s, and the model's title replaces it once the answer finishes. 🔍 Technical detailsSent "Chat C: explain how tides work in about 600 words." then clicked New chat after ~2 s.
|
A failed title request left the question-name in place, which kept the chat eligible, so every later turn more than 30 s apart made another title call, billed on a cloud model. Each session now gets one title request per server run. The title is written with a conditional UPDATE, so a rename that lands mid-request always wins, and the view refreshes the name for every placeholder title the server recognises, not only "New Task".
|
A failed title no longer retries on every later turn: each chat gets one title request, so a cloud chat is billed for it once. Also took the two smaller suggestions. Live Agent UI evidence (a chat left 2 s after sending, then titled by Fireworks) is in this comment. 🔍 Technical details
|
A chat you leave while it is still answering no longer stays "New Task" forever. It is named after its first question as soon as the server takes the message, whether or not its window is still open. Cloud chats (Fireworks via Lemonade) now get a real written title too. Before this change, every cloud chat was titled with its truncated first question, because the title request ran out of tokens while the model was still reasoning.
Test plan
python -m pytest tests/unit/chat/ui/test_chat_title_on_send.py tests/unit/chat/ui/test_chat_helpers.pypython -m pytest tests/unit/chat -n 4cd src/gaia/apps/webui && npx tsc --noEmit -p . && npx vitest runfireworks.deepseek-v4p1-flash: send "write a 1200-word essay on the history of tea" in a new chat, click New chat within a few seconds and ask something else. The first chat shows its question as its name at once, then a short written title once its answer finishes.🔍 Technical details
Root causes
updateSessioninChatView.tsx'sonDone. It runs only if that chat's view is still mounted when the stream ends. The server titler should have covered this, but it never produced anything for a cloud model (see F42)._generate_session_title(src/gaia/ui/_chat_helpers.py, the oldmax_tokens = 96 if … else 24) sent cloud modelsmax_completion_tokens=24, andno_thinking_kwargsis empty for cloud ids. Fireworks'deepseek-v4p1-flashreasons by default. Measured against the real API, it returnedcontent: null,finish_reason: "length"andreasoning_tokens: 24, so the titler fell back to the first question every time.reasoning_effort: "none"is not a portable fix:glm-5p3-flashandgpt-oss-120breject it with a 400. Cloud title requests now get 512 tokens. All three models then return a title in 6 to 182 tokens.Also fixed on the way
session_model, which is the stored or custom model beforeresolve_session_model. It now uses the model the turn actually ran on, on both the streamed (relayed included) and plain paths. As a result, a local turn is never titled by a cloud model. A local guard model whose stand-in default is a cloud model is also no longer titled in the cloud._should_retitlenow also accepts the provisional question title, so the LLM title can replace it. A rename made while a title is being generated wins.except. It is now a warning forsqlite3.Error. Exceptions escaping a_spawn_backgroundtask are now logged instead of vanishing.getSessiononce, so the sidebar shows the server's name immediately. The 5 s session poll brings in the LLM title.sessionCleanup.tsis unchanged: a chat that never sent anything is still "New Task" with zero messages.[name](url)→name).Pre-existing, unrelated:
tests/unit/chatshows one teardown error intest_sse_confirmation.py. A thread left over fromtest_sidecar_relay_profiles.pysetup tries to spawn a daemon. It reproduces onorigin/mainwithout this change.