fix(mobile): Windows image paths and non-ASCII file links open like desktop#25802
Problem
On mobile, an agent's Markdown with a host path did not always work like desktop:
showed "Image unavailable". Markdown read\.and\_as escapes, so the app asked forC:\work.t3\shot.png. Web already keeps these paths. Mobile lost that when it moved to the native Markdown renderer.[exam](pastexam/線性代數/考試.pdf)was a plain web link, not a file chip. The shared link parser only accepted ASCII names. This also affected web.
Fix
- Mobile rewrites Windows image and link destinations before parsing, so the JS parser and the native md4c parser both get the path as written, the same as web. A cheap regex check skips the extra parse for messages without a Windows destination.
- The shared relative-path patterns accept any script (
\p{L}\p{M}\p{N}). Mobile drops its ASCII-only folder fallback and uses the shared parser only.
Server file access is unchanged.
Fixes #23722 Fixes #16096
Refs #17668. With the iOS app on main, host-path images outside the project render (screenshot below), matching the maintainer's result on the issue. This PR does not change that path.
Supersedes #23750. Its idea of rewriting parsed destinations before the native parse is reused in a smaller form, credited to @amv146 with a co-author line.
Proof
Focused tests fail on main and pass here: markdownHtml.test.ts (real md4c WASM parser plus the JS parser) and markdownLinks.test.ts. vp run check:changed passes.
iPhone 17 Pro simulator, iOS dev client, isolated dev server on a Linux host:
- Windows image: on main, "Copy full path" gave
C:\work.t3_build\shot.png. Now it givesC:\work\.t3\_build\shot.png. - Non-ASCII link, left to right: main (plain link), this branch (file chip), and the file opened from the chip.
Windows image path in the long-press menu
These closed issues still work on device: ~/.bashrc link (#18327), Example.md:314 in a subfolder (#17830), and a shots/ folder link (#21257).
Follow-ups, not in this PR:
- Mobile inline code chips (
ENRICHED_INLINE_FILE_LINK_REGEX) still accept only ASCII bare relative paths. - Windows paths in plain prose on mobile lose separators (open #21454).
- File names with CJK punctuation (
・,()).
Council review
Rounds: 3
| Delegate | Round 1 | Round 2 | Round 3 |
|---|---|---|---|
| Claude Opus 5.5 | 7/10 | 9/10 | 9/10 |
| Codex GPT-6.1 Sol | 9/10 | 8/10 | 9.5/10 |
Created with Claude Opus 5.5 in Claude Code, running in T3 Code.
🤖 Generated with Claude Code
Checks
Added 3 commits
Approvability
Verdict: Approved at 23121d9
Macroscope's review found this PR approvable — This is a localized Markdown compatibility fix for Windows destinations and non-ASCII file links, with focused regression tests and no changes to product defaults or static-analysis configuration. Its runtime effects are confined to existing link and image parsing paths.
You can add or adjust custom eligibility rules. Learn more.
Thread transfer impact
✅ Thread transfer remains within every enforced ceiling.
| Provider | Metric | Main baseline | This PR | Impact | PR ceiling | |
|---|---|---|---|---|---|---|
| Codex | Total thread wire | 5.0 KiB | 5.0 KiB | 0 B (0.0%) | 6.8 KiB | ✅ |
| Codex | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ✅ |
| Codex | Live turn WebSocket wire | 1.3 KiB | 1.3 KiB | 0 B (0.0%) | 2.0 KiB | ✅ |
| Codex | Live turn WebSocket decoded | 21.6 KiB | 21.6 KiB | 0 B (0.0%) | 24.4 KiB | ✅ |
| Codex | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ✅ |
| Claude | Total thread wire | 5.0 KiB | 5.0 KiB | 0 B (0.0%) | 6.8 KiB | ✅ |
| Claude | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ✅ |
| Claude | Live turn WebSocket wire | 1.3 KiB | 1.3 KiB | 0 B (0.0%) | 2.0 KiB | ✅ |
| Claude | Live turn WebSocket decoded | 21.9 KiB | 21.9 KiB | 0 B (0.0%) | 24.4 KiB | ✅ |
| Claude | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ✅ |
Baseline: 96fc7b9 · PR result: 23121d9 · Source CI: success
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
No actionable comments were generated in the recent review.
External image Recent review info
-
External image Run configuration
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: t3/mobile-chat-host-paths
- File: .coderabbit.config.ts
- Commit: 23121d9
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
d2221c0b-80ba-43a6-be87-6f40a1d16479
External image Commits
Reviewing files that changed from the base of the PR and between 96fc7b955196637605cbf3b415152ce4dd0e2294 and 23121d95c41e8ddcbdf789b6d34faa4edababa06.
External image Files selected for processing: 7
apps/mobile/src/lib/markdownDocument.tsapps/mobile/src/lib/markdownHtml.test.tsapps/mobile/src/lib/markdownInlineFileLinks.test.tsapps/mobile/src/lib/markdownLinks.tsapps/mobile/src/native/EnrichedMarkdownText.tsxpackages/shared/src/markdownLinks.test.tspackages/shared/src/markdownLinks.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Walkthrough
Mobile Markdown preprocessing now normalizes Windows path destinations. Shared relative file-link matching now accepts Unicode characters in paths and filenames.
Changes: Markdown path handling
Layer / File(s) Summary Windows destination normalization
apps/mobile/src/lib/markdownDocument.ts,apps/mobile/src/native/EnrichedMarkdownText.tsx,apps/mobile/src/lib/markdownHtml.test.ts,apps/mobile/src/lib/markdownInlineFileLinks.test.tsNative parsing and rendering use preprocessing that converts HTML and normalizes Windows destinations. Regression tests cover Markdown and HTML image and link paths. Relative file-link recognition
packages/shared/src/markdownLinks.ts,packages/shared/src/markdownLinks.test.ts,apps/mobile/src/lib/markdownLinks.tsRelative path patterns accept Unicode letters, marks, and numbers. Mobile file presentation no longer falls back to a directory-like path match when parsing rejects the target. Priority: External image Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Low
Possibly related PRs
- pingdotgg/t3code#23750: Both PRs normalize mobile Markdown destinations containing Windows backslashes.
- pingdotgg/t3code#16990: Both PRs use parse-based file-link detection and native Markdown preprocessing.
- pingdotgg/t3code#24418: Both PRs update shared relative file-path patterns to accept Unicode characters.
Suggested reviewers:
juliusmarminge,macodev00,flamboh
Merge Risk: External image Minimal · up to 23121
The reviewed changes preserve the checked Windows destinations and relative directory links while recognizing the reported non-ASCII paths. No issue identified here needs to block merging.
Pre-merge checks: Passed 4
Check name Status Explanation Title check Passed The title clearly and concisely describes the two main fixes: Windows image paths and non-ASCII file links on mobile. Description check Passed The description covers the problem, fix, scope, linked issues, focused verification, device testing, screenshots, and agent details. The “Fix” and “Proof” headings differ from the template’s “Change” … Linked Issues check Passed The PR meets the coding requirements for both active linked issues. For #23722,markdownForNativeParsingdetects Windows destinations, preserves backslashes before native parsing, and is used by bot…Out of Scope Changes check Passed The changes stay within the linked issue scope. The modified mobile parser, link presentation logic, shared path patterns, and regression tests directly support #23722and#16096. The inline-file-link…Full details: Description check
Explanation
The description covers the problem, fix, scope, linked issues, focused verification, device testing, screenshots, and agent details. The “Fix” and “Proof” headings differ from the template’s “Change” and “Verification” headings, but the required information is present.
Full details: Linked Issues check
Explanation
The PR meets the coding requirements for both active linked issues. For
#23722,markdownForNativeParsingdetects Windows destinations, preserves backslashes before native parsing, and is used by both mobile parsing paths. The regression test covers Windows image and link destinations, including backslashes, parentheses, ampersands, HTML, and blockquotes. Forward-slash destinations remain supported by the existing path handling. For#16096, the shared relative-path patterns now accept Unicode letters, marks, and numbers. The shared tests cover Chinese path components, accented names, and decoded spaces. Mobile now relies onparseMarkdownFileLinkand removes its ASCII-only fallback.
Full details: Out of Scope Changes check
Explanation
The changes stay within the linked issue scope. The modified mobile parser, link presentation logic, shared path patterns, and regression tests directly support
#23722and#16096. The inline-file-link test update keeps its assertion on the shared test parser after the native parser normalization change. No unrelated product behavior or server file access changes are shown in the whole-PR diff.
Finishing Touches
📝 Generate docstrings
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.