Skip to content

fix(mobile): draft task titles no longer end in a broken character - #41787

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
tiliakoos:fix/mobile-draft-title-emoji
Nov 24, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
tiliakoos:fix/mobile-draft-title-emoji

Conversation

@tiliakoos

Copy link
Copy Markdown
Contributor

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 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.

Verification

  • projectThreadStartTurn.test.ts gets fix(mobile): pending task titles no longer end in a broken character #30347's case: a prompt of 68 a followed by 😀. With the test on base be0619a294 it fails (Received: "aaa…a�...", 1 failed | 4 passed). On head, 5 of 5 pass.
  • 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.

Claude Fable 5.2 via T3 Code

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>
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • 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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between cd128e7 and cd3faa6.

Files selected for processing: 3

  • apps/mobile/src/lib/projectThreadStartTurn.test.ts
  • apps/mobile/src/lib/projectThreadStartTurn.ts
  • scripts/scenarios/new-task-draft-title-keeps-whole-characters.e2e.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 24, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

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.

Before After
85aaef42d4 98ecb33051
Before: confirmation contains a replacement character before the dots After: confirmation ends with three dots and no replacement character
Before recording After recording
Before accessibility label After accessibility label

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.

Scripts: interaction driver, stable screenshot helper, synthetic project seed.

Not shown:

  • Android was not exercised; this proof covers the reported flow in the real iOS app.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 24, 2026
@juliusmarminge
juliusmarminge merged commit 3ddfa73 into pingdotgg:main Nov 24, 2026
55 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 24, 2026
@tiliakoos
tiliakoos deleted the fix/mobile-draft-title-emoji branch November 24, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants