Skip to content

fix(server): auto-title sessions in the user's language - #652

Open
jasmine889966 wants to merge 1 commit into
andrewyng:mainfrom
jasmine889966:upstream/autotitle-i18n
Open

fix(server): auto-title sessions in the user's language#652
jasmine889966 wants to merge 1 commit into
andrewyng:mainfrom
jasmine889966:upstream/autotitle-i18n

Conversation

@jasmine889966

Copy link
Copy Markdown

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 a 4-5 word title, 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:

  • The title must be written in the same language as the user's opening message.
  • The 4-5 word count becomes an English-scale hint, with "the natural equivalent brevity for other languages" elsewhere.
  • The small-talk sentinel 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):

  1. test_title_call_pins_the_opener_language — regression-guards the same-language instruction in the title call's system prompt.
  2. 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.
  3. 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.py needed no change.

tests/test_ui_refresh_e2e.py fails identically on clean main in 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.

@jasmine889966
jasmine889966 force-pushed the upstream/autotitle-i18n branch from 536fa6a to af24217 Compare September 8, 2026 01:05
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
jasmine889966 force-pushed the upstream/autotitle-i18n branch from af24217 to 752c3a6 Compare September 8, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant