Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): restore thread links in the Hermes build #28768

ClosedPixPMusic(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/28768/headopened View on GitHub

Problem

Valid thread links render as plain text or “Thread no longer available” on mobile even when the destination is in the thread list. Reported on Android 2.2.0 (739), with the same links working on desktop.

Change

Read matches with exec on the original regex. Hermes's matchAll clones the regex and loses the named-group mapping added by the mobile Babel transform, so the client found no target IDs. Reset the scan cursor for each message.

The regression test compiles the actual shared module with the mobile Babel preset and models Hermes's cloning behavior. It fails on main and with the cloned-regex loop proposed in #26485, and passes with this fix.

Scope and approval

Alex reported this existing navigation regression and requested testing. This is a small, focused correction of an obvious bug in thread-link extraction. The shared mobile hook serves assistant messages, user messages, and pending questions.

Fixes #26468. Related: #26485 and #27977.

In #26468, the expected screenshot shows a titled thread chip; the Android screenshot instead shows raw t3-thread://v2/.../thread:delegated-task:... URLs with percent-encoded IDs. Delegated-thread links use the same useLiveThreadLinkLabels → threadLinkRefs extraction path as ordinary thread links. The existing shared tests cover a thread:delegated-task:mcp%3A1 destination. The Android fixture here verifies title-chip rendering and navigation through that path; the issue reporter’s project was not separately replayed.

Verification

  • vp test run apps/mobile/src/lib/threadLinks.test.ts packages/shared/src/threadLinks.test.ts: 14 tests pass, covering the mobile transform, v1/v2 destinations, encoded IDs, and links outside code.
  • vp run check:changed --concurrency 2: passes formatting, lint, both knip checks, 33 affected package typechecks, and 15 focused tests.
  • Native Android 15, Pixel 10 Pro emulator, 1080×2400, dark theme: matched captures use isolated Demo Studio fixtures and the same dev client. Before restores the parser from 1d626d02d95f; after uses this change. Test data and evidence are excluded from the commit.
  • Native tap verification: the title chip opens the correct destination thread; returning preserves the working link.
  • iOS was not exercised. It uses the same Hermes extraction path; web/desktop behavior is covered by the existing shared tests.
BeforeAfter
Android before: valid thread link renders as ordinary textAndroid after: the same link shows its destination thread title

Open the linked thread on Android

Model: GPT-6.1 Sol (xhigh reasoning) | Harness: Codex in T3 Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Approvability

      Verdict: Approved at afdc6e1

      Macroscope's review found this PR approvable — This restores thread-link title resolution in Hermes by preserving regex capture groups during reference extraction. Existing link parsing and environment scoping remain unchanged, with no persistence or access-control changes.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between 3fd2b855c5c6b9169cdfe3733b34011c1c5ed4b7 and afdc6e1951d7af470a8dd9d6699233fcb0f705f8.

      Files selected for processing: 2
      • apps/mobile/src/lib/threadLinks.test.ts
      • packages/shared/src/threadLinks.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.

      Walkthrough

      threadLinkRefs now scans thread links with exec after resetting the regex index. A mobile test checks extraction under Expo’s Android Metro Babel settings, including Markdown and angle-bracket links and exclusion of a code-formatted link.

      Changes: Thread-link extraction

      Layer / File(s)Summary
      Regex scan and mobile validation
      packages/shared/src/threadLinks.ts, apps/mobile/src/lib/threadLinks.test.ts
      threadLinkRefs resets the regex’s lastIndex and uses exec to scan matches. The mobile test checks extracted references in Markdown and angle-bracket forms, and excludes a code-formatted link.

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

      Change: Bug fix · Severity of issue fixed: Low

      Possibly related PRs

      Suggested labels: bugfix, size:S

      Suggested reviewers: juliusmarminge, macroscopeapp

      Merge Risk: Minimal · up to afdc6

      Thread-link extraction uses the Hermes-compatible scan, with no identified merge-blocking risk.

      Pre-merge checks: Passed 3 · Inconclusive 1
      Failed Failed checks: 1 inconclusive
      Check nameStatusExplanationResolution
      Linked Issues checkInconclusiveIssue #26468 reports that subagent thread IDs display incorrectly in the mobile application (Android 16, version 2.0.0). The issue text does not mention thread links, markdown, or extraction. Its expe…Provide one of the following so the requirement can be decided: (1) the expected and actual behavior of #26468 described in text, showing that the affected subagent thread ID is rendered as a thread link; or (2) confirmation from the issue …
      Passed Passed checks: 3 passed
      Check nameStatusExplanation
      Title checkPassedThe title is concise, uses the conventional commit format, and clearly identifies the mobile Hermes build regression being fixed.
      Out of Scope Changes checkPassedComparing merge base 1d626d02d95f to head afdc6e1951d7 shows a focused change in packages/shared/src/threadLinks.ts. In threadLinkRefs, the loop changes from matchAll to a cursor-reset exec loop…
      Description checkPassedThe description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the reproduction context, implementation, linked issues, approval rationale, focused …
      Full details: Out of Scope Changes check

      Explanation

      Comparing merge base 1d626d02d95f to head afdc6e1951d7 shows a focused change in packages/shared/src/threadLinks.ts. In threadLinkRefs, the loop changes from matchAll to a cursor-reset exec loop. The added comment explains the reason for the change. The loop body is unchanged. The PR also adds apps/mobile/src/lib/threadLinks.test.ts, which tests the same extraction path under the mobile Babel transform. Both changes support the stated objective of restoring thread link extraction on Hermes. No unrelated files or unrelated behavior changes were identified in the summary. The shared function also runs on web and desktop, but the change keeps the same extraction output for those paths, as the PR states.

      Full details: Description check

      Explanation

      The description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the reproduction context, implementation, linked issues, approval rationale, focused test results, Android evidence, tap verification, untested iOS coverage, and the model and harness used.

      Full details: Linked Issues check

      Explanation

      Issue #26468 reports that subagent thread IDs display incorrectly in the mobile application (Android 16, version 2.0.0). The issue text does not mention thread links, markdown, or extraction. Its expected and actual behavior appear only in images that were not available for review. The PR changes threadLinkRefs in packages/shared/src/threadLinks.ts so that mobile Hermes reads matches with exec on the original regex. This restores target ID extraction for valid thread links. The PR description and the new test in apps/mobile/src/lib/threadLinks.test.ts cover thread links generally (v1/v2 destinations, encoded IDs). No evidence was found that subagent thread IDs use this link path, and no test covers a subagent thread. The PR description reports Android 15 verification of a title chip opening a destination thread. It does not show the subagent display case from #26468. The link between the reported symptom and the changed code is therefore not established.

      Resolution

      Provide one of the following so the requirement can be decided: (1) the expected and actual behavior of #26468 described in text, showing that the affected subagent thread ID is rendered as a thread link; or (2) confirmation from the issue author or the PR author that the subagent display issue is caused by the same Hermes matchAll extraction failure; or (3) a verification result for a subagent thread link on mobile after this change.

      Finishing Touches
      Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
    4. Closing as a duplicate of #26485. The mobile-Babel regression test and remaining regex-cloning issue are documented at https://github.com/pingdotgg/t3code/pull/26485#issuecomment-6561217712, with the verified correction available to reuse.

Sign in to join this conversation.