From 25d7473df5aa01f4578067033552c1f92a0c0b90 Mon Sep 17 00:00:00 2001 From: spoukyii <61633921+spoukyii@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:53:48 -0800 Subject: [PATCH 1/2] test(mobile): a pending task title cut beside an emoji The title mobile shows for a queued or draft new task cuts a long prompt at 69 UTF-16 code units. When an emoji straddles that cut, the row keeps half of it and shows a replacement character before the "...", and this test fails here. --- apps/mobile/src/lib/projectThreadStartTurn.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/mobile/src/lib/projectThreadStartTurn.test.ts b/apps/mobile/src/lib/projectThreadStartTurn.test.ts index e2a41cf9d886f..6abb3409d3680 100644 --- a/apps/mobile/src/lib/projectThreadStartTurn.test.ts +++ b/apps/mobile/src/lib/projectThreadStartTurn.test.ts @@ -5,6 +5,7 @@ import { serializeComposerMessageForServer } from "./composerContext"; import { buildProjectThreadStartTurnInput, + deriveThreadTitleFromPrompt, type ProjectThreadStartTurnSpec, } from "./projectThreadStartTurn"; @@ -69,4 +70,10 @@ describe("project thread title", () => { expect(relaunched.message.text).toBe(wire.text); expect(relaunched.message.attachments).toEqual(uploadedAttachments); }); + + it("shortens a long prompt without splitting an emoji", () => { + expect(deriveThreadTitleFromPrompt(`${"a".repeat(68)}😀 and the rest of the prompt`)).toBe( + `${"a".repeat(68)}...`, + ); + }); }); From a588d1bc81c97f597ac23d32853dffcabef02825 Mon Sep 17 00:00:00 2001 From: spoukyii <61633921+spoukyii@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:54:10 -0800 Subject: [PATCH 2/2] fix(mobile): pending task titles no longer end in a broken character Mobile titles a queued or draft new task in the task list with its own copy of the title cut, deriveThreadTitleFromPrompt, which slices a long prompt at 69 UTF-16 code units. An emoji straddling that cut left a lone high surrogate before the "...", so the row showed a replacement character until the server's thread replaced it. The cut now steps back one unit when it would split a surrogate pair, the same check #29563 and #29163 added to the CLI and create_threads titles. The 72-character limit and every other title are unchanged. Bug: a pending or draft task's title on mobile ends in a broken character when an emoji sits at the cut --- apps/mobile/src/lib/projectThreadStartTurn.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/mobile/src/lib/projectThreadStartTurn.ts b/apps/mobile/src/lib/projectThreadStartTurn.ts index 1e677d232b81f..00dbadc3aff17 100644 --- a/apps/mobile/src/lib/projectThreadStartTurn.ts +++ b/apps/mobile/src/lib/projectThreadStartTurn.ts @@ -87,5 +87,12 @@ export function buildProjectThreadStartTurnInput(spec: ProjectThreadStartTurnSpe export function deriveThreadTitleFromPrompt(value: string): string { const title = threadTitleTextFromPrompt(value) || "New thread"; - return title.length <= 72 ? title : `${title.slice(0, 69).trimEnd()}...`; + if (title.length <= 72) return title; + let end = 69; + const previous = title.charCodeAt(end - 1); + const next = title.charCodeAt(end); + if (previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) { + end -= 1; + } + return `${title.slice(0, end).trimEnd()}...`; }