t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Mobile renders single tildes (~) in numeric ranges as strikethrough

Open andirtew opened this issue 1 week ago • 2 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/mobile

Steps to reproduce

  1. Open a thread in T3 Code Mobile (observed on Android).
  2. Have an agent reply with a paragraph containing two or more ordinary single tildes (~) — very common in CJK/Chinese numeric ranges or home-relative paths, for example:
    • 每分钟稳定 370~418 次请求(约 6.5~7 QPS)
    • 平均每 3~6 分钟重启一次;同时单个进程内存涨到 1.3~1.5 GB,CPU 拉到 170%~190%。
  3. Inspect the rendered reply in the mobile timeline.

Expected behavior

Single ~ characters in prose (e.g. 370~418, 6.5~7, 3~6, 1.3~1.5, ~/a ... ~/b) should render literally without strikethrough, while explicit double-tilde ~~strikethrough~~ continues to render as strikethrough.

Actual behavior

Pairs of single ~ within the same paragraph are parsed as GFM strikethrough delimiters: both ~ characters are stripped and everything between them is crossed out, corrupting the numbers:

  • 370~418 次请求(约 6.5~7 QPS) renders as 370 + ~~418 次请求(约 6.5~~ + 7 QPS) (visually 370418 and 6.57).
  • 每 3~6 分钟……涨到 1.3~1.5 GB renders as 每 3 + ~~6 分钟……涨到 1.3~~ + 1.5 GB (visually 36 and 1.31.5), while an odd trailing third 170%~190% stays literal.

Root cause in apps/mobile

This is the mobile counterpart of #29254 (and #16105 for user prompts). Open PR #29270 only targets apps/web / packages/shared and does not touch apps/mobile:

  1. apps/mobile/src/lib/markdownDocument.ts (lines 14 and 491) configures unified().use(remarkParse).use(remarkGfm) without { singleTilde: false }.
  2. Mobile renders chat Markdown through apps/mobile/src/native/EnrichedMarkdownText.tsx (react-native-enriched-markdown), whose native Markdown parser also treats single ~...~ as strikethrough unless single tildes are escaped during markdownForNativeRendering (outside code spans/fences) or disabled in the native parser config.

Related

  • #29254 (same single-tilde strikethrough bug on desktop/web; PR #29270 does not cover apps/mobile)
  • #16105 (single-tilde strikethrough in user prompts, fixed for web via [remarkGfm, { singleTilde: false }] in packages/shared/src/markdownPipeline.ts)

Impact

Minor bug or occasional failure

Version or commit

T3 Code Mobile (Android) / main

Environment

Android, T3 Code Mobile (react-native-enriched-markdown 1.2.0-t3.18)

Logs or stack traces

Raw assistant Markdown stored in thread:
1. **每分钟稳定 370~418 次请求(约 6.5~7 QPS)**
2. 平均每 3~6 分钟重启一次;同时单个进程内存涨到 1.3~1.5 GB,CPU 拉到 170%~190%。

Rendered on T3 Mobile (Android):
- "418 次请求(约 6.5" is struck through with both `~` removed ("370418", "6.57")
- "6 分钟……涨到 1.3" is struck through with both `~` removed ("36", "1.31.5")

Screenshots, recordings, or supporting files

No response

Workaround

Instruct agents to use - / – (en dash) instead of ~ for numeric ranges, or wrap ranges in inline code backticks.

andirtew avatar Nov 24 '26 02:11 andirtew

This is the same problem as #29254, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

juliusmarminge avatar Nov 24 '26 02:11 juliusmarminge

This is distinct from #29254 on the implementation side and will not be resolved by #29254's current PR:

  1. Separate Markdown rendering stack on mobile: #29254 targets the desktop/web client (which has since moved off remark to Words in #27866), whereas mobile renders through a completely separate pipeline: apps/mobile/src/lib/markdownDocument.ts (lines 14 & 491, using remarkGfm without { singleTilde: false }) and apps/mobile/src/native/EnrichedMarkdownText.tsx (react-native-enriched-markdown, whose native parser also treats single ~...~ as strikethrough).
  2. Existing web PRs do not touch apps/mobile:
    • Open PR #29270 (for #29254) modifies zero files under apps/mobile.
    • Merged PR #35859 (for #16105, fixing single tildes in sent user prompts) also modified zero files under apps/mobile, so mobile still lacks that already-approved fix as well.

Because fixing #29254 / #29270 will still leave apps/mobile affected, please reopen this to track the apps/mobile pipeline separately (or explicitly include apps/mobile in the fix).

andirtew avatar Nov 24 '26 08:11 andirtew