Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(sessions): recognize the German, French and Spanish placeholder titles
liuzixiang0a8163dec002
diff --git a/apps/desktop/src/lib/session-title-utils.ts b/apps/desktop/src/lib/session-title-utils.tsindex ce856512f..e6275efc6 100644--- a/apps/desktop/src/lib/session-title-utils.ts+++ b/apps/desktop/src/lib/session-title-utils.ts@@ -18,6 +18,9 @@ const LEGACY_DEFAULT_TITLES = new Set(["nova conversa","yeni görev","yeni sohbet",+ "neue aufgabe",+ "nouvelle tâche",+ "nueva tarea",]);/** Sidebar/topbar title budget for the local first-prompt fallback. */const PROMPT_FALLBACK_TITLE_LENGTH = 48;diff --git a/apps/desktop/test/session-title-prompt-fallback.test.mjs b/apps/desktop/test/session-title-prompt-fallback.test.mjsindex 9ccf46094..22194a428 100644--- a/apps/desktop/test/session-title-prompt-fallback.test.mjs+++ b/apps/desktop/test/session-title-prompt-fallback.test.mjs@@ -96,3 +96,38 @@ test("automatic AI titles stay plugin-owned", () => {assert.doesNotMatch(store, /triggerAutoTitleSummarization/);assert.doesNotMatch(main, /IPC\.invoke\.sessionSummarizeTitle/);});++test("the German, French and Spanish placeholders are recognized as default titles (#1755)", async (t) => {+ // The renderer lowercases chat.untitledTask before persisting; the host+ // list and this legacy set must recognize those forms or auto-titling+ // never runs in those locales.+ const locales = [+ ["de", "Neue Aufgabe", "neue aufgabe"],+ ["fr", "Nouvelle tâche", "nouvelle tâche"],+ ["es", "Nueva tarea", "nueva tarea"],+ ];+ for (const [locale, label, lowercased] of locales) {+ assert.equal(+ catalogs[locale].chat.untitledTask,+ label,+ `${locale} catalog must still own its placeholder label`,+ );+ assert.equal(+ isDefaultSessionTitle(label),+ true,+ `${locale}: the placeholder is recognized as default`,+ );+ assert.equal(+ isDefaultSessionTitle(lowercased),+ true,+ `${locale}: the persisted lowercased form is recognized too`,+ );+ }++ // Host side stays in sync: the three labels are in PLACEHOLDER_TITLES.+ assert.match(+ host,+ /"neue aufgabe",\s*\n\s*"nouvelle tâche",\s*\n\s*"nueva tarea",/,+ "PLACEHOLDER_TITLES must carry the German, French and Spanish labels",+ );+});diff --git a/crates/host-core/src/sessions.rs b/crates/host-core/src/sessions.rsindex df89a3dcc..1ad90e967 100644--- a/crates/host-core/src/sessions.rs+++ b/crates/host-core/src/sessions.rs@@ -342,11 +342,13 @@ pub struct SearchHit {/// The renderer creates a session with its localized `chat.untitledTask` label/// and also recognizes `nav.newChat`, so host-core has to recognize the same/// values: it owns title eligibility and cannot read the renderer catalog when-/// it decides whether a title may still be replaced. German, Spanish, and-/// French fall back to the English label. Keep this in sync with the migration-/// list in `db/session_title_source_migration.rs` and `LEGACY_DEFAULT_TITLES`-/// in the renderer.-const PLACEHOLDER_TITLES: [&str; 13] = [+/// it decides whether a title may still be replaced. Entries are stored in+/// the form the renderer writes: lowercased, because every localized+/// `chat.untitledTask` has its own label — the German, Spanish, and French+/// ones do not fall back to the English text (#1755). Keep this in sync with+/// the migration list in `db/session_title_source_migration.rs` and+/// `LEGACY_DEFAULT_TITLES` in the renderer.+const PLACEHOLDER_TITLES: [&str; 16] = ["","New task","New chat",@@ -360,6 +362,9 @@ const PLACEHOLDER_TITLES: [&str; 13] = ["Nova conversa","Yeni görev","Yeni sohbet",+ "neue aufgabe",+ "nouvelle tâche",+ "nueva tarea",];fn is_default_title(title: &str) -> bool {@@ -4269,6 +4274,15 @@ pub fn get_token_usage_history(#[cfg(test)]mod tests {use super::*;++ #[test]+ fn default_title_matches_the_german_french_and_spanish_placeholders() {+ // The renderer lowercases `chat.untitledTask` before persisting (#1755).+ assert!(is_default_title("neue aufgabe"));+ assert!(is_default_title("Nouvelle tâche"));+ assert!(is_default_title("nueva tarea"));+ assert!(!is_default_title("real session name"));+ }use crate::workspace::simple_canonicalize;fn test_db() -> Database {diff --git a/packages/shared/src/types/settings.ts b/packages/shared/src/types/settings.tsindex 2bf997b9e..26d6d96cb 100644--- a/packages/shared/src/types/settings.ts+++ b/packages/shared/src/types/settings.ts@@ -172,13 +172,14 @@ export type AppSettings = {preventScreenSleep?: boolean;/*** Sidebar project "running" affordances. The master switch gates both- * sub-switches; absent means disabled, so a fresh install shows a clean- * sidebar until the user opts in.+ * sub-switches; absent means enabled — the renderer normalizes+ * `!== false` to on, so a fresh install shows the running badge and rail+ * until the user turns them off (#1749).*/sidebarRunningIndicators?: boolean;- /** Count badge beside a project name. Only honored while the master is on. */+ /** Count badge beside a project name. On unless explicitly disabled. */sidebarRunningBadge?: boolean;- /** Activity rail down the project group. Only honored while the master is on. */+ /** Activity rail down the project group. On unless explicitly disabled. */sidebarRunningRail?: boolean;/*** Last-reply date shown at the right edge of session rows. Absent means