Skip to content

fix(mobile): open web links from read-only chats - #40963

Closed
StiensWout wants to merge 8 commits into
pingdotgg:mainfrom
StiensWout:t3/1291-web-links-in-read-only-linked-chats-do-n
Closed

StiensWout wants to merge 8 commits into
pingdotgg:mainfrom
StiensWout:t3/1291-web-links-in-read-only-linked-chats-do-n

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

Read-only linked chats on mobile rendered web links in assistant replies and tool-sent messages without handling taps. Both message types now open HTTP(S) links through the system URL opener, and the iOS link menu offers Open link only for supported destinations.

Fixes #40962

Reproduction on main

Commit 7ddc81d639 (main). The link is styled as a link, but tapping it leaves the read-only chat on screen. The cause is at apps/mobile/src/features/threads/LinkedThreadSheet.tsx:176. Followed the steps under Evidence in the app on Pixel_9_API_37 (Android 17.0): The assistant’s Example link appeared blue in the chat marked Read-only. Tapping it left the same chat on screen.

Evidence

Environment: Pixel_9_API_37, Android 17.0, Android Emulator on Linux x64

Steps:

  1. Link two test environments, A and B, from A with full access.
  2. Pair T3 Code on an Android phone emulator with A only.
  3. In a chat on B, ask the agent to reply with a Markdown link labeled Example that points to https://example.com/.
  4. Copy the link to the target chat from a separate T3 Code client connected to B.
  5. Paste and send that link in a chat on A in the Android app.
  6. Tap the sent thread link and check that the target chat is marked Read-only.
  7. Tap Example in the assistant's reply.

Proven: the bug shows on main at 7ddc81d639 and no longer shows on head c490b83f9d.

Before After
Commit 7ddc81d639 c490b83f9d
Result Shows: The assistant’s Example link appeared blue in the chat marked Read-only. Tapping it left the same chat on screen. Does not show: The linked chat was marked Read-only and showed the assistant’s blue Example link. Tapping Example opened Chrome at example.com and displayed the Example Domain page.
Read-only chat after tapping Example Before: Read-only chat after tapping Example After: Read-only chat after tapping Example
Opening the linked chat and tapping Example Before: Opening the linked chat and tapping Example After: Opening the linked chat and tapping Example

Tests

  • 7cc4712e2c adds the failing test, alone, before the fix.
  • pnpm exec vp test run apps/mobile/src/features/threads/LinkedThreadSheet.test.tsx passed on head.
  • pnpm exec vp run check:changed passed on head.

Not in this change

  • User messages use a separate plain-text row without Markdown tap actions.
  • Connected mobile chats have their own routing for files, previews, issues, and pull requests.
  • Web and desktop linked chats use the web timeline’s own link handling.
  • Linked-environment identity, missing or stale messages, and stream retries belong to the existing thread loader.
  • The system URL opener handles failures, and each tap is independent of previous taps.

Who did the work

  • Written by GPT 6.2 Sol, in Codex
  • Review findings fixed by GPT 6.2 Sol, in Codex
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex, each on its own
  • Also reviewed by cubic, run locally by a program, with no score
  • Reproduced on the device, on main and on the head, by GPT 6.2 Sol, in Codex
  • Checks run by a program on base and head, not by an agent
  • Left open after review: should, apps/mobile/src/features/threads/LinkedThreadSheet.test.tsx:16: The test mocks about twenty modules (including a react override for useSyncExternalStore, react-native, navigation, the linkedThread state and SelectableMarkdownText) and renders to static markup. What it really checks is that onLinkPress is passed to the markdown renderer, which is the callback wiring the testing rules say to leave out. It will also break whenever LinkedThreadSheet gains an import. Its URL cases (protocol-relative, relative path, thread link, empty href) repeat what apps/mobile/src/lib/markdownLinks.test.ts already covers for resolveMarkdownLinkPresentation. A smaller version would mock only react-native Linking and the markdown renderer, keep one web link and one non-web link, and leave the scheme matrix to the resolver's tests.; should, apps/mobile/src/features/threads/LinkedThreadSheet.test.tsx:63: The replacement SelectableMarkdownText parses fixtures with its own regex and calls onLinkPress directly. The test can pass even when the actual markdown component fails to forward a native tap, and its exact list of parsed labels only exercises the test parser. Keep SelectableMarkdownText and EnrichedMarkdownText in the path and simulate the press at the native widget boundary, leaving destination parsing to the renderer that owns it.

Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5

StiensWout and others added 5 commits November 22, 2026 18:41
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 22, 2026
@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Mobile linked-thread messages now open external Markdown links through the system browser. Markdown link menus can hide “Open link” for URLs rejected by an optional predicate, while retaining copy and platform-supported share actions.

Changes: Mobile Markdown Link Handling

Layer / File(s) Summary
Conditional Markdown link menus
apps/mobile/src/native/SelectableMarkdownText.types.ts, apps/mobile/src/native/EnrichedMarkdownText.tsx, apps/mobile/src/native/EnrichedMarkdownText.test.tsx, apps/mobile/vite.config.ts
An optional predicate controls whether the default menu includes “Open link.” The default menu always includes “Copy link” and includes “Share link” on iOS and Android. Tests check menu contents and selection behavior.
Linked-thread link routing
apps/mobile/src/features/threads/LinkedThreadSheet.tsx, apps/mobile/src/features/threads/LinkedThreadSheet.test.tsx
Assistant and sent-message Markdown links use shared URL resolution and external-URL opening. The test checks that only external links open, and that a protocol-relative URL is normalized to HTTPS.

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

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • pingdotgg/t3code#39406: Adds the mobile read-only linked-thread view that this change updates with Markdown link handling.

Suggested reviewers: maria-rcks, juliusmarminge, jakeleventhal

Merge Risk: Minimal · previous review c490b

Web links in read-only linked mobile chats now open through the system browser, and the iOS "Open link" menu action is limited to supported destinations. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Out of Scope Changes check Inconclusive The LinkedThreadSheet.tsx changes (URL helpers, onLinkPress and canOpenLinkFromMenu wiring, and the new test) connect directly to the issue. The EnrichedMarkdownText.tsx diff could not be read, so its… Provide a readable diff or file content for apps/mobile/src/native/EnrichedMarkdownText.tsx at the merge base and at head, and confirm whether the Android “Share link” menu entry is required for this fix or should be removed or split into a…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: web links in read-only linked chats on mobile now open. It follows the conventional commit form with a clear scope. The title matches the linked issue #40962 and the c…
Description check Passed The description covers the problem, the change, the scope link to issue #40962, and detailed verification with before and after evidence. It lists the tests run and states the exclusions. It also name…
Linked Issues check Passed Issue #40962 requires that tapping an ordinary web link in an assistant reply in a read-only linked chat opens the destination page. The head diff of apps/mobile/src/features/threads/LinkedThreadSheet…
Full details: Title check

Explanation

The title names the main change: web links in read-only linked chats on mobile now open. It follows the conventional commit form with a clear scope. The title matches the linked issue #40962 and the changed files in LinkedThreadSheet and EnrichedMarkdownText.

Full details: Description check

Explanation

The description covers the problem, the change, the scope link to issue #40962, and detailed verification with before and after evidence. It lists the tests run and states the exclusions. It also names the models that did the work, as the template asks. The template's Problem section is present, and the Change section is covered by the opening paragraph and the reproduction notes. The Scope section links the issue, and the Verification section gives observed results with media. Two review concerns are left open in the description. They concern test quality and do not block the template check.

Full details: Linked Issues check

Explanation

Issue #40962 requires that tapping an ordinary web link in an assistant reply in a read-only linked chat opens the destination page. The head diff of apps/mobile/src/features/threads/LinkedThreadSheet.tsx passes onLinkPress={openWebLink} to both SelectableMarkdownText call sites: the sent-message branch and the assistant-message branch. openWebLink resolves the href with resolveMarkdownLinkPresentation and calls tryOpenExternalUrl(link.href, "markdown-link") only when the kind is "external". SelectableMarkdownTextProps declares onLinkPress at head, so the callback is part of the existing API. The PR reports a device reproduction on Pixel_9_API_37: the bug shows on main at 7ddc81d and does not show on head at c490b83, where Example opened example.com. The EnrichedMarkdownText.tsx diff could not be read, so the native tap path is confirmed by the PR's device evidence and not by source inspection of that file. The objective of #40962 is met on the reported evidence. No coding requirement from the issue is unmet.

Full details: Out of Scope Changes check

Explanation

The LinkedThreadSheet.tsx changes (URL helpers, onLinkPress and canOpenLinkFromMenu wiring, and the new test) connect directly to the issue. The EnrichedMarkdownText.tsx diff could not be read, so its changes were not verified from source. The raw summary states that the shared default link menu in EnrichedMarkdownText.tsx now omits “Open link” for unsupported URLs. It also states that Android's default link menu now includes “Share link”, which was previously absent. This shared component serves other markdown surfaces, such as the thread screen. The PR description does not mention the Android “Share link” addition. Whether this change is needed for the linked-chat fix cannot be decided from the available evidence.

Resolution

Provide a readable diff or file content for apps/mobile/src/native/EnrichedMarkdownText.tsx at the merge base and at head, and confirm whether the Android “Share link” menu entry is required for this fix or should be removed or split into a separate change. Also confirm the scope of the SelectableMarkdownText.types.ts and vite.config.ts changes, which the summary indicates are small and supporting.

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 6972026 and c490b83.

Files selected for processing: 6

  • apps/mobile/src/features/threads/LinkedThreadSheet.test.tsx
  • apps/mobile/src/features/threads/LinkedThreadSheet.tsx
  • apps/mobile/src/native/EnrichedMarkdownText.test.tsx
  • apps/mobile/src/native/EnrichedMarkdownText.tsx
  • apps/mobile/src/native/SelectableMarkdownText.types.ts
  • apps/mobile/vite.config.ts

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

juliusmarminge and others added 3 commits November 22, 2026 18:13
Link classification is already covered by markdownLinks.test.ts; the
removed tests only mirrored callback wiring through heavy mocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

the proof was not accepted:

  • The diff changes iOS behaviour that no capture covers. In EnrichedMarkdownText.tsx, iOS builds its link context menu once any onLinkPress handler is set. LinkedThreadSheet now passes onLinkPress, so read-only linked chats on iOS gain a long-press Open/Copy/Share link menu they did not have before. No capture shows it.
  • The canOpenLinkFromMenu change, which hides 'Open link' on iOS for destinations that are not web links, is stated in the PR but not shown in any capture.
  • Tapping a link on iOS was not tested. The proof is Android-only, and the capture step lists iOS as unverified.
  • The tool-sent message branch (entry.type === 'sent-message') now also gets onLinkPress and canOpenLinkFromMenu, but only an assistant-reply link was captured.

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:in-progress A takeover lead is working on this PR labels Nov 22, 2026
@StiensWout StiensWout closed this Nov 22, 2026
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). takeover:blocked Takeover blocked; reason in the PR body 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.

[Bug]: Web links in read-only linked chats do nothing on mobile

2 participants