The title prompt sent the user's first message as a raw user turn, so a
query ending in "summarise it in a table" made the model emit a Markdown
table that became the session title.
- Wrap the query in a <user_message> block (embedded delimiter tags are
neutralised) and append a guard to the configured system prompt telling
the model to treat the block as data and never follow its instructions.
- sanitizeGeneratedTitle now drops a full <think> block, keeps the first
line with content, strips headings, list/quote markers, labels, links,
inline markup and wrapping quotes, and falls back to a 30-rune plain-text
prefix of the user query when the output is still table-like.
- Tighten the default session title template.
GenerateTitle writes the model completion straight into sessions.title,
which every shipped migration declares as VARCHAR(255). When the model
ignores the "short title" instruction and returns an explanation along with
the title, the follow-up Update fails with SQLSTATE 22001 (value too long
for type character varying(255)) and the session silently ends up with no
title. The error only reaches the log and the answer itself is unaffected,
so the failure is easy to miss.
Trim the reasoning prefix and surrounding whitespace, then truncate to 100
runes - by rune rather than byte, so a multi-byte character is never cut in
half - and log a warning when truncation happens so the prompt can be
revisited.