fix(server): auto-title sessions in the user's language - #652
Open
jasmine889966 wants to merge 1 commit into
Open
fix(server): auto-title sessions in the user's language#652jasmine889966 wants to merge 1 commit into
jasmine889966 wants to merge 1 commit into
Conversation
jasmine889966
force-pushed
the
upstream/autotitle-i18n
branch
from
September 8, 2026 01:05
536fa6a to
af24217
Compare
The titling instruction asked for a '4-5 word title' in English without pinning an output language, so non-English sessions (zh/ja/ko/…) got English titles. Tell the model to write the title in the same language as the user's opening message, and treat the word count as an English-scale hint only — the natural equivalent brevity elsewhere (CJK titles are a few characters, not 4-5 words). The small-talk sentinel stays the fixed English token it always was (normalization already tolerates casing/punctuation riffs). Tests: the title call's system prompt pins the same-language rule; a CJK opener keeps a CJK title end to end (sanitizer whitespace/quote handling and the 80-char cap are script-agnostic); the sentinel still fires for a non-English small-talk opener and earns its single retry.
jasmine889966
force-pushed
the
upstream/autotitle-i18n
branch
from
September 8, 2026 01:12
af24217 to
752c3a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Session auto-titles come out in English even when the conversation is entirely in another language. The titling prompt (
_AUTOTITLE_PROMPT) is written in English, asks for a4-5 wordtitle, and never pins an output language — so the model defaults to English for zh/ja/ko/… sessions. The word count itself is also English-scale: a natural Chinese title is a few characters, not 4-5 words.Change
One prompt rewording, no behavior plumbing touched:
small-talksentinel stays the fixed English token it always was (the existing normalization already tolerates casing/punctuation riffs), so sentinel detection and the single-retry flow are unchanged.Tests
Three additions to
tests/test_autotitle.py(suite: 11 passed):test_title_call_pins_the_opener_language— regression-guards the same-language instruction in the title call's system prompt.test_non_english_opener_keeps_non_english_title— end to end: a CJK title survives the sanitizer (whitespace/quote handling) and the 80-char cap, stored verbatim.test_non_english_small_talk_still_hits_the_sentinel— a non-English small-talk opener still hits the sentinel and earns its single retry.The prompt keeps the "You title chat sessions" opening, so the title-call recognizer in
tests/test_server.pyneeded no change.tests/test_ui_refresh_e2e.pyfails identically on cleanmainin this environment (needs built GUI assets) — unaffected by this change.Context
Follows the i18n line of #127 (GUI localization) and #468 (output-language control): user-visible generated text should speak the user's language.