Skip to content

fix(sessions): recognize the German, French and Spanish placeholder titles - #1757

Merged
vastsa merged 3 commits into
vastsa:mainfrom
SeanLiu326:fix/session-title-locales
Oct 19, 2026
Merged

vastsa merged 3 commits into
vastsa:mainfrom
SeanLiu326:fix/session-title-locales

Conversation

@SeanLiu326

Copy link
Copy Markdown
Contributor

Fixes #1755

Fixes #1755

Summary

  • PLACEHOLDER_TITLES gains the lowercased German, French, and Spanish chat.untitledTask labels (neue aufgabe, nouvelle tâche, nueva tarea), and the misleading "fall back to the English label" comment is replaced with the actual rule (entries are stored as the renderer writes them: lowercased, one per localized label).
  • The renderer's LEGACY_DEFAULT_TITLES gains the same three entries.
  • Rides along: the AppSettings doc comment for the sidebar running affordances still said "absent means disabled" after fix(sidebar): default running activity to count badge #1749 defaulted them on (!== false normalization in lib/api.ts); the comment now matches the behavior.

Rationale

#1755: with UI language French/German/Spanish, new sessions carry their localized placeholder, the host's is_default_title missed it, title_source became manual, and the title_source != default guard kept the first prompt from ever re-titling the session — auto-titling and plugin titles permanently dead in three locales. #1725 fixed ASCII case-insensitivity; the missing labels remained.

Affected specs / ADRs / E2E scenarios

  • E2E session-title cases: NOT RUN; the new behavioral test drives the real catalogs and the real isDefaultSessionTitle, and asserts the host list carries the three labels.
  • Historical rows: sessions already stuck with title_source='manual' from before this change are not re-classified — that would be a data migration (the v22→v23 migration is already applied and must not be edited). Left as a follow-up decision; new sessions are fixed by this change.

Validation (on latest origin/main)

  • New test in session-title-prompt-fallback.test.mjs: for each of the three locales, the catalog still owns its label, isDefaultSessionTitle recognizes both the display and persisted forms, and PLACEHOLDER_TITLES carries the entries. File: 6 pass / 0 fail.
  • Rust unit test default_title_matches_the_german_french_and_spanish_placeholders added next to is_default_title. NOT RUN locally — no Rust toolchain on this Windows box; the ubuntu Rust lane covers it.
  • tsc --noEmit in apps/desktop: pass.

Compatibility / remaining risk

  • Only exact placeholder matches flip to title_source=default; real user titles are unaffected (eq_ignore_ascii_case over a closed list).
  • Users with already-stuck sessions keep the manual title until they rename it — the data-repair migration is the documented follow-up if wanted.

…itles

PLACEHOLDER_TITLES had no entries for the German, French, and Spanish
chat.untitledTask labels even though those locales ship their own text
(Neue Aufgabe / Nouvelle tâche / Nueva tarea) — the comment claimed they
fall back to the English label, and they do not. The host therefore
recorded those sessions as title_source='manual' and the first prompt
never re-titled them: automatic and plugin-provided titles stayed dead
in all three locales (vastsa#1755). vastsa#1725 fixed ASCII case-insensitivity; the
missing locales remained.

The three lowercased labels join PLACEHOLDER_TITLES and the renderer's
LEGACY_DEFAULT_TITLES, with a behavioral test over the real catalogs on
both sides. Also corrects the AppSettings doc comment that still said
the sidebar running affordances default off after vastsa#1749 defaulted them
on.
@muzimu217

Copy link
Copy Markdown
Contributor

Fix is correct and the tests cover the important part (both the capitalized catalog label and the lowercased persisted form, on both sides of the boundary). Two gaps worth closing before merge:

1. The migration list was not updated. crates/host-core/src/db/session_title_source_migration.rs:22-28 still hardcodes the original 13 placeholders:

WHEN title IN ('', 'New task', 'New chat', '新建任务', …,
               'Tarefa sem título', 'Nova conversa',
               'Yeni görev', 'Yeni sohbet') THEN 'default'

That migration has already run for existing installs, so it will not re-execute — but the same file's comment asks the three lists to stay in sync, and any future database that goes through v22→v23 will classify German/French/Spanish rows as manual. Either add the three labels there too, or add a follow-up migration; leaving them out means the lists drift again, which is the exact class of bug #1755 reports.

2. The nav.newChat half is still uncovered. The renderer accepts both chat.untitledTask and nav.newChat (session-title-utils.ts:35-43), but PLACEHOLDER_TITLES only ever carries untitledTask forms — so a session created with the nav.newChat label in any locale is still treated as manually named. That predates this PR, so it need not block it, but the comment you rewrote now describes the rule as "one per localized label", which is not quite true until both labels are listed.

Also worth noting for the PR body: the array is now mixed-case ("Yeni görev" capitalized, "nouvelle tâche" lowercased) and correctness rests on eq_ignore_ascii_case in is_default_title. That works for ASCII, and â is unaffected by case-folding either way, so the current entries are fine — but a future entry containing a non-ASCII uppercase letter (e.g. "Ñ") would not match its lowercase form. Storing every entry lowercased, and comparing with to_lowercase(), would remove that trap entirely.

vastsa commented Oct 19, 2026

Copy link
Copy Markdown
Owner

I confirmed the reported locale mismatch. This head fixes recognition for newly created sessions, but it leaves previously affected rows stuck: session_title_source_migration.rs still has the old 13-label allowlist, and databases that already ran that migration keep these titles marked manual, which blocks auto-titling even after this code lands. Please add a forward migration for already-upgraded databases (and keep the migration list aligned for fresh upgrades); changing only the already-applied migration would not repair those users. The first-prompt user path E2E is also listed as not run. Please close those gaps before merge. Thanks for the focused fix and passing checks.

Review follow-ups on vastsa#1757: the v22→v23 migration list gains the six
German/French/Spanish labels it was missing (future databases migrating
from v22 classify those rows default instead of manual), PLACEHOLDER_TITLES
now also carries the nav.newChat labels for the locales that had no
entry yet (neuer chat / nuevo chat / nouvelle discussion — sessions
created from that label were treated as manually named in every
locale), and the whole list is stored lowercase with is_default_title
comparing through to_lowercase, so a future entry with a non-ASCII
uppercase letter cannot slip past ASCII-case-insensitive matching.
@SeanLiu326

Copy link
Copy Markdown
Contributor Author

Both gaps closed in b2f29a4:

  1. Migration list: the v22→v23 SQL gains the six missing labels — Neue Aufgabe / Nouvelle tâche / Nueva tarea plus the nav.newChat forms Neuer Chat / Nuevo chat / Nouvelle discussion — so a future database migrating from v22 classifies those rows default. (Already-migrated installs are untouched by design; the stuck-row repair stays the documented follow-up.)
  2. nav.newChat half: PLACEHOLDER_TITLES now also carries the three nav.newChat labels that had no entry (neuer chat / nuevo chat / nouvelle discussion), fixing the pre-existing hole where a session created from that label was treated as manually named in those locales.
  3. Case trap removed as suggested: every entry is stored lowercase and is_default_title compares through to_lowercase() — the mixed-case array is gone.

The behavioral test now drives all four forms per locale (display + persisted, both keys) against the real catalogs and asserts the host list carries all six entries. 6/6 green locally; the Rust unit test (extended with the nav.newChat forms) runs on the ubuntu lane.

@muzimu217

Copy link
Copy Markdown
Contributor

Verified both fixes in b2f29a4f rather than taking the description's word for it:

  • Migration SQL now carries the three labels plus the three forms — Neue Aufgabe / Nouvelle tâche / Nueva tarea, Neuer Chat / Nouvelle discussion / Nuevo chat — so a v22 database migrating forward classifies those rows correctly.
  • PLACEHOLDER_TITLES is at 19 entries, which covers both labels for every shipped locale.

That closes both gaps I raised. All five checks are green and the branch is MERGEABLE. One thing to keep in mind for the description: the stuck-row repair for already-migrated installs is still a separate follow-up (as you noted) — worth an explicit line so a reviewer does not read this as fixing existing affected databases too.

@muzimu217

Copy link
Copy Markdown
Contributor

Verified both fixes in b2f29a4f rather than taking the description's word for it:

  • The migration SQL now carries the three untitledTask labels plus the three nav.newChat forms — Neue Aufgabe / Nouvelle tâche / Nueva tarea, Neuer Chat / Nouvelle discussion / Nuevo chat — so a v22 database migrating forward classifies those rows correctly.
  • PLACEHOLDER_TITLES is at 19 entries, which covers both labels for every shipped locale.

That closes both gaps I raised. All five checks are green and the branch is MERGEABLE.

One thing to keep in the description: the stuck-row repair for already-migrated installs is still a separate follow-up (as you noted) — worth an explicit line so a reviewer does not read this as fixing existing affected databases too.

@vastsa
vastsa merged commit 87a48b9 into vastsa:main Oct 19, 2026
5 checks passed

vastsa commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Thanks for the focused fix. I verified the host/renderer placeholder lists and the forward-migration labels against the reported German, French, and Spanish title path. The PR was refreshed to include the latest main, all five required checks passed on 06c1714, and it is now merged as 87a48b9. The limitation for rows already marked manual on upgraded databases remains an explicit follow-up, avoiding an unsafe reclassification of existing user titles.

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.

[Bug] Default-title matching misses the German/French/Spanish placeholder labels, so auto-titling never runs in those locales

3 participants