You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): draft task titles no longer end in a broken character - #41787
On mobile, an unsent new-task draft is titled from its prompt by deriveThreadTitleFromPrompt: a title over 72 UTF-16 units is cut at 69 plus .... When an emoji sits on the cut, half of it stays behind and the title ends in �.... To reproduce: tap New chat, pick a project, type 68 letters followed by an emoji and more text, and go back without sending. The draft's row in the Unsent list then carries the broken title: it is the row's accessibility name, and the row's Discard prompt shows “aaa…a�...” will be removed. The row's own text clips before the cut for this prompt, so it looks the same either way. Queued new tasks and the pending-creation shell get their title from the same function.
Change
When the cut would split a surrogate pair, it steps back one unit, using the shared splitsSurrogatePair from @t3tools/shared/assistantCitations that the server's cuts already use. The 72-unit limit, the 69-unit cut and the ... suffix are unchanged, and so is the title the server stores.
Scope
A small fix for an obvious bug, so no issue. This re-lands spoukyii's #30347, which Macroscope approved and spoukyii closed on 2026-11-06 because they could not run the mobile app on a device, so the fix had only its unit test. This PR adds the device proof, keeps #30347's test case, and swaps its hand-written code-point check for the shared helper.
New iOS scenario scripts/scenarios/new-task-draft-title-keeps-whole-characters.e2e.ts. It enters that prompt in a new-task draft through the app, goes back without sending, opens the draft row's Discard prompt for the capture, cancels it, then checks the row's accessible name.
One paired run, vp run scenarios:prove scripts/scenarios/new-task-draft-title-keeps-whole-characters.e2e.ts --base upstream/main, exited 0. Base be0619a294 fails on the assertion: observed: name "aaa…a�...". Head cd3faa63a2 passes. Both captures are from that run.
vp run check:changed upstream/main: format, lint, knip, typecheck (2 packages), tests and the React Compiler check pass.
Base be0619a294
Head cd3faa63a2
Result
❌ failed: expect.toHaveAccessibleName, observed name aaa…a�...
✅ passed
Discard prompt
The scenario ran on a local iPhone 17 Pro simulator (iOS 26.5) instead of the Simlock pool, with the device and session overridden in scripts/e2e.config.ts for the run only (not committed). Not checked: Android, spoken VoiceOver output, and the queued-task row and pending-creation shell on a device; those two call the same function and are covered by the unit test only. The cut works per code point, so it can still split a grapheme cluster such as a flag or a ZWJ sequence, but it never leaves a lone surrogate.
A new-task draft or queued task is titled from its prompt, cut at 69 UTF-16
units. An emoji on the cut left half a surrogate pair before the "...".
Re-lands pingdotgg#30347.
Co-authored-by: spoukyii <61633921+spoukyii@users.noreply.github.com>
Reviewing files that changed from the base of the PR and between cd3faa6 and 98ecb33.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Long prompt-derived titles now avoid truncating between the code units of a surrogate pair. Unit and iOS end-to-end tests cover a prompt with an emoji at the truncation boundary.
Changes: Draft title truncation
Layer / File(s)
Summary
Safe truncation and validation apps/mobile/src/lib/projectThreadStartTurn.ts, apps/mobile/src/lib/projectThreadStartTurn.test.ts, scripts/scenarios/new-task-draft-title-keeps-whole-characters.e2e.ts
For titles longer than 72 characters, truncation moves to index 68 when the boundary at index 69 splits a surrogate pair; otherwise, it uses index 69. The unit test checks the resulting title, and the iOS scenario checks the draft row’s accessible name.
pingdotgg/t3code#30347: Addresses the same surrogate-pair truncation boundary in mobile prompt-derived titles.
Suggested labels:bugfix
Suggested reviewers:juliusmarminge, macroscopeapp
Merge Risk: Minimal · previous review cd3fa
Draft task titles no longer end in a broken character when a long prompt is truncated at an emoji. The change is small and covered by unit and iOS end-to-end tests, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: prompt-derived draft task titles on mobile no longer end in a broken character. It follows conventional commit form (fix(mobile)) and is specific. It matches the chang…
Description check
The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each is filled in with specific detail. The problem, reproduction steps, and expected beh…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: prompt-derived draft task titles on mobile no longer end in a broken character. It follows conventional commit form (fix(mobile)) and is specific. It matches the changeset, which adjusts deriveThreadTitleFromPrompt to avoid splitting a surrogate pair when truncating.
Full details: Description check
Explanation
The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each is filled in with specific detail. The problem, reproduction steps, and expected behavior are stated. The change explains the fix and why it uses the shared splitsSurrogatePair helper. The scope explains why no issue is linked and names the prior PR it re-lands. Verification gives the focused unit test, the paired iOS scenario run with base and head results, the check:changed run, and the unchecked areas. Before/after screenshots are linked for the UI-facing scenario. The template's agent attribution line is present as well. Minor gap: the scope asks for a link to the issue that shows the bug, and the author gives a reason instead, which the template allows for small obvious fixes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Real iOS app on the same iPhone 18 Pro simulator, iOS 27.2, portrait, light theme, with fresh synthetic state per commit.
Steps: New chat → demo → enter 68 a characters + 😀 and the rest of the prompt → Back without sending → long-press the Unsent draft → Discard → inspect confirmation → Cancel. Recordings begin after selecting demo.
Base shows �...; head shows exactly 68 a characters followed by .... Both composers showed the intact emoji. Stills were stable across two pixel-identical screenshots at least 500 ms apart.
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
size:M30-99 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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
On mobile, an unsent new-task draft is titled from its prompt by
deriveThreadTitleFromPrompt: a title over 72 UTF-16 units is cut at 69 plus.... When an emoji sits on the cut, half of it stays behind and the title ends in�.... To reproduce: tap New chat, pick a project, type 68 letters followed by an emoji and more text, and go back without sending. The draft's row in the Unsent list then carries the broken title: it is the row's accessibility name, and the row's Discard prompt shows“aaa…a�...” will be removed.The row's own text clips before the cut for this prompt, so it looks the same either way. Queued new tasks and the pending-creation shell get their title from the same function.Change
When the cut would split a surrogate pair, it steps back one unit, using the shared
splitsSurrogatePairfrom@t3tools/shared/assistantCitationsthat the server's cuts already use. The 72-unit limit, the 69-unit cut and the...suffix are unchanged, and so is the title the server stores.Scope
A small fix for an obvious bug, so no issue. This re-lands spoukyii's #30347, which Macroscope approved and spoukyii closed on 2026-11-06 because they could not run the mobile app on a device, so the fix had only its unit test. This PR adds the device proof, keeps #30347's test case, and swaps its hand-written code-point check for the shared helper.
Verification
projectThreadStartTurn.test.tsgets fix(mobile): pending task titles no longer end in a broken character #30347's case: a prompt of 68afollowed by 😀. With the test on basebe0619a294it fails (Received: "aaa…a�...", 1 failed | 4 passed). On head, 5 of 5 pass.scripts/scenarios/new-task-draft-title-keeps-whole-characters.e2e.ts. It enters that prompt in a new-task draft through the app, goes back without sending, opens the draft row's Discard prompt for the capture, cancels it, then checks the row's accessible name.vp run scenarios:prove scripts/scenarios/new-task-draft-title-keeps-whole-characters.e2e.ts --base upstream/main, exited 0. Basebe0619a294fails on the assertion:observed: name "aaa…a�...". Headcd3faa63a2passes. Both captures are from that run.vp run check:changed upstream/main: format, lint, knip, typecheck (2 packages), tests and the React Compiler check pass.be0619a294cd3faa63a2expect.toHaveAccessibleName, observed nameaaa…a�...The scenario ran on a local iPhone 17 Pro simulator (iOS 26.5) instead of the Simlock pool, with the device and session overridden in
scripts/e2e.config.tsfor the run only (not committed). Not checked: Android, spoken VoiceOver output, and the queued-task row and pending-creation shell on a device; those two call the same function and are covered by the unit test only. The cut works per code point, so it can still split a grapheme cluster such as a flag or a ZWJ sequence, but it never leaves a lone surrogate.Claude Fable 5.2 via T3 Code