Registry Mirror
Skip to content

Conversation

@saphid

@saphid saphid commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Problem

First-message thread titles truncated at the cutoff can retain a lone Unicode Grapheme_Cluster_Break=Prepend character such as an Arabic number sign (U+0600) while dropping the following digit (U+0661) or trailing space, splitting a single grapheme cluster before "...".

Deterministic repro on origin/main (dff224df1db98bcfdee3ef823afcd05899ac7eb1):

  • Web / Desktop path: submitting a first message calls deriveThreadTitleSeed (packages/client-runtime/src/operations/threadTitle.ts) -> truncate (packages/shared/src/String.ts), sends titleSeed via startThreadTurn (apps/web/src/components/chat/useComposerSend.ts:1652), persists it onto thread metadata in Orchestrator.ts:7953 (thread.metadata-updated), and renders it via ChatView.tsx:3773 into ChatHeader.tsx:363-373 (the header heading, tooltip label, and button aria-label, all receiving the full seed before asynchronous title generation can replace it).
  • Mobile pending/draft task path: deriveThreadTitleFromPrompt (apps/mobile/src/lib/projectThreadStartTurn.ts:97-102) truncates pending and unsent draft titles at 69 UTF-16 code units (when length > 72), feeding pending-new-tasks-model.ts:136,:153 and thread-list-v2-items.tsx:723,:861.
  • Command:
    node --input-type=module -e 'import { deriveThreadTitleSeed } from "./packages/client-runtime/src/operations/threadTitle.ts"; console.log(JSON.stringify(deriveThreadTitleSeed({ text: "a".repeat(49) + "\u0600\u0661 notes", attachments: [] })));'
  • Observed on origin/main: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\u0600..." (ends in U+0600 U+002E U+002E U+002E; U+0661 is dropped). The mobile pending-title path similarly returned "a".repeat(68) + "\u0600..." for "a".repeat(68) + "\u0600\u0661 notes".
  • Expected: back up before U+0600 ("a".repeat(49) + "..." for deriveThreadTitleSeed, "a".repeat(68) + "..." for deriveThreadTitleFromPrompt) when the cluster does not fit or when cutoff whitespace is trimmed, and keep the full \u0600\u0661 cluster when it fits within the existing budget.

Change

In packages/shared/src/String.ts, added trimCutPrefix to trim trailing cutoff whitespace and back up across any trailing Unicode Grapheme_Cluster_Break=Prepend code points whenever the first excluded code point (including whitespace removed by trimEnd()) is not a UAX #29 Control/CR/LF break, using explicit Unicode ranges so it stays portable across Hermes (mobile), Web, Desktop, and Node. Both truncate (packages/shared/src/String.ts) and mobile's deriveThreadTitleFromPrompt (apps/mobile/src/lib/projectThreadStartTurn.ts) now call trimCutPrefix without changing their existing budgets, no-space-before-ellipsis rule, or "..." ellipsis. Added split, full-fit, cutoff-whitespace, multi-prepend, and newline-boundary regressions in packages/shared/src/String.test.ts and split, full-fit, and cutoff-whitespace regressions in apps/mobile/src/lib/projectThreadStartTurn.test.ts.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • Base failure (dff224df1db98bcfdee3ef823afcd05899ac7eb1): vp test run packages/shared/src/String.test.ts -t "moves the cut back so prepend signs stay with their following character" failed (Expected: "a".repeat(49) + "...", Received: "a".repeat(49) + "\u0600..."), and deriveThreadTitleSeed returned tail code points U+0600 U+002E U+002E U+002E.
  • Head pass (49d03e4df0e4242931be6ac1e401b9e9a347c8ae): vp test run packages/shared/src/String.test.ts apps/mobile/src/lib/projectThreadStartTurn.test.ts passed (17/17 across both files), covering split, full-fit, cutoff-whitespace, multi-prepend, and newline boundaries on truncate and split, full-fit, and cutoff-whitespace on mobile deriveThreadTitleFromPrompt.
  • vp run check:changed: exit 0 on 49d03e4df0e4242931be6ac1e401b9e9a347c8ae (format pass, lint pass with 0 warnings/errors, knip pass, typecheck 37/37 packages pass, test 3 files / 19 tests pass, react compiler pass).
  • Before/after transcript (including mobile test pass and check:changed exit summary for 49d03e4df0e4242931be6ac1e401b9e9a347c8ae): https://gist.github.com/saphid/f29507a94403c6c6f01dff4fe8b8468f
  • Not shown: real-client before/after screenshots, a scenarios:prove run (submitting the exact prompt in a fresh Replay thread and asserting the header accessible name before title generation replaces the seed), live Electron desktop window, and iOS/Android mobile device rendering.

Authored by Gemini 4 Neon (Antigravity); reviewed by GPT-6.2 Sol (Codex).

Not shown

  • apps/web/src/components/chat/ChatHeader.tsx:363 — Real-client before/after screenshots and a live Electron check were not run; capture the seed before asynchronous title generation replaces it.
  • apps/web/src/components/chat/useComposerSend.ts:1652 — No scenarios:prove run; submit the exact prompt in a fresh Replay thread and assert the full header accessible name before title generation replaces the seed.
  • apps/mobile/src/features/threads/thread-list-v2-items.tsx:861 — iOS and Android device rendering was not checked; verify the draft or pending row’s accessible label on-device.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Shared truncation now adjusts cut prefixes around Unicode Prepend characters. Mobile thread-title truncation uses the shared helper. Tests cover prepend sequences near truncation boundaries.

Changes: Unicode-safe truncation

Layer / File(s) Summary
Shared truncation behavior
packages/shared/src/String.ts, packages/shared/src/String.test.ts
The shared string module adds trimCutPrefix and applies it during truncation. Tests cover cuts around prepend characters, digits, and newlines.
Mobile thread-title truncation
apps/mobile/src/lib/projectThreadStartTurn.ts, apps/mobile/src/lib/projectThreadStartTurn.test.ts
Thread-title truncation uses trimCutPrefix without changing the 72-character cutoff or appended ellipsis. A test covers Arabic number signs at the cutoff.

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

Change: Bug fix

Suggested reviewers: only21mil

Merge Risk: Minimal · up to 7dae3

This keeps Arabic number signs together with their digits when thread titles are cut off. The change is small, reversible and covered by tests, so it carries minimal merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: trimming the thread title cutoff so Arabic number signs (Prepend characters) stay with their following digit. It follows the conventional commit style and the diff add…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives a clear bug, a deterministic repro, and expected behavior. The Change section …
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: trimming the thread title cutoff so Arabic number signs (Prepend characters) stay with their following digit. It follows the conventional commit style and the diff adds trimCutPrefix in shared String.ts and applies it to truncate and the mobile title derivation. The title is specific and matches the changeset.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives a clear bug, a deterministic repro, and expected behavior. The Change section explains the trimCutPrefix fix and why explicit Unicode ranges are used. The Scope section says why no issue is linked. The Verification section lists the base failure, the head pass, the check:changed result, and a transcript link, and it states what was not checked. The template asks for a model and harness line at the end, and the description includes one (Gemini 4 Neon / GPT-6.2 Sol). The description has a few gaps, but it is mostly complete. The Scope section says no issue is needed, 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 78e3808 and 7dae3f3.

Files selected for processing: 3

  • apps/mobile/src/lib/projectThreadStartTurn.test.ts
  • packages/shared/src/String.test.ts
  • packages/shared/src/String.ts

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

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Dec 2, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 7dae3f3

Macroscope's review found this PR approvable — This adjusts text truncation so Arabic number signs and other Unicode prepend characters are not stranded at the cutoff. Its effects are limited to formatted titles and diagnostic text, with existing limits and defaults unchanged.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 2, 2026
@github-actions github-actions Bot added the vouch:trusted Author is trusted by repo permissions or the VOUCHED list. label Dec 2, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review December 2, 2026 19:08

Dismissing prior approval to re-evaluate 7dae3f3

@github-actions github-actions Bot added the size:S 10-29 changed lines (additions + deletions). label Dec 2, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Environment: real web app, Chromium, 1280×800, light theme, isolated fresh databases, Replay (dev) Showcase.

On each fresh database, create a demo project, open its new-thread composer with Replay (dev) Showcase selected, enter exactly 49 'a' + U+0600 + U+0661 + ' notes', press Enter, and capture the seeded breadcrumb heading before generated-title replacement.

Scenario: A seeded title omits an Arabic number cluster that cannot fit

Proven: the scenario fails on base 8ec6425010 and passes on head 7dae3f3602.

Base 8ec6425010 Head 7dae3f3602
Result ❌ failed
ASSERTION_FAILED: expected "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa؀..." to be "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..."
✅ passed
arabic number title cutoff Base 8ec6425010: arabic number title cutoff Head 7dae3f3602: arabic number title cutoff
failure Base 8ec6425010: failure

| Recording | Before recording | After recording |

Scenario script

Not shown:

  • Mobile pending/draft titles were not exercised; this proof covers the reported web seeded-title path.
  • The 48-character fitting control and whitespace-trimming variants were not exercised in this scenario.
  • Other accessible names and the browser tab title were not separately inspected.

@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 Dec 2, 2026
@juliusmarminge
juliusmarminge merged commit 128759b into pingdotgg:main Dec 2, 2026
60 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants