Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): thread links show their thread's title #26485

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/26485/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Problem

On the mobile app, a thread link in a chat message never shows the linked thread's title. On main, a <t3-thread://v2/…> link renders as "Thread no longer available" even when the thread exists and is in the list. Builds from before v2 links show the raw t3-thread:// URL instead. Reproduced on main (5211acfe95) in the Android dev client on a Pixel 9 emulator, against a dev server with a fresh database. Steps: create two threads, then put a v2 link to one into a user message and into an agent reply in the other.

Change

threadLinkRefs collects the threads that a message's links name, so the client can load their titles. It read named capture groups from String.prototype.matchAll, but match objects from Hermes' matchAll have no groups property. On device, threadLinkRefs therefore returned [], no titles loaded, and relabelThreadLinks treated every link as unknown. relabelThreadLinks is unaffected because it reads groups from the replace callback. threadLinkRefs now walks the matches with an exec loop over a copy of the regex, and exec keeps named groups on Hermes. Results on V8 are unchanged. Web and desktop do not call threadLinkRefs.

Scope and approval

Fixes pingdotgg/t3code#26468

Triaged via the automated issue flow.

Verification

  • vp test run packages/shared/src/threadLinks.test.ts: 14/14 pass. The new test, "lists a message's thread links on runtimes whose matchAll omits named groups, such as Hermes", removes groups from matchAll results, as Hermes does. It fails on main with expected [] to deeply equal [ …(2) ] and passes with the fix.
  • vp run check:changed: format, lint, knip, typecheck and tests all pass.
  • On device (Android dev client, Pixel 9 emulator, light theme, fresh dev database seeded through the server CLI):
    • A console probe on main showed [...s.matchAll(re)][0].groups === undefined, while re.exec(s).groups was present, and threadLinkRefs returned [] while the target thread was in the shell list.
    • Agent reply containing <t3-thread://v2/<env>/mcp%3A…> (percent-encoded id, as in the report): before, "Thread no longer available"; after, a chip with the project icon and the thread title.
    • User message containing the same link twice, once with the plain id and once percent-encoded: before, "Thread no longer available" twice; after, both show the title chip.
  • Not checked:
    • The before/after screenshots could not be attached: the upload tool was unavailable in the environment that ran this.
    • iOS was not run, though it uses the same Hermes runtime and the same code path.
    • The pending-question card (PendingUserInputCard) uses the same useLiveThreadLinkLabels hook and was not captured separately.

Model and harness: Claude Opus 5.5 (lead, test, implementation, review B) and GPT-6.1 Sol (review A), run through Claude Code and Codex in T3 Code.

🤖 Generated with Claude Code

    1. Approvability

      Verdict: Approved at 79af2b8

      Macroscope's review found this PR approvable — Restores mobile thread-link titles by using regex iteration that retains named groups on Hermes. The change is limited to existing title rendering, with Android before/after verification reported and no changes to permissions or stored data.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    2. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB+29 B (+0.6%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB+29 B (+2.3%)2.0 KiB✅
      CodexLive turn WebSocket decoded21.5 KiB21.6 KiB+41 B (+0.2%)24.4 KiB✅
      CodexLive turn messages12+1 (+100.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.3 KiB1.3 KiB0 B (0.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiB✅
      ClaudeLive turn messages220 (0.0%)8✅

      Baseline: 5211acf · PR result: 79af2b8 · 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.

    3. 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 5211acfe95a0c6d82a60e2524b5e46b47fe67a3e and 79af2b8604fa3f17f15098628246793a2bb69d81.

      Files selected for processing: 2
      • packages/shared/src/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 markdown links with repeated RegExp.exec calls instead of String.matchAll. A regression test mocks matches without named groups and verifies that both v2 thread references are returned.

      Changes: Thread link extraction

      Layer / File(s)Summary
      Match extraction and regression test
      packages/shared/src/threadLinks.ts, packages/shared/src/threadLinks.test.ts
      threadLinkRefs uses repeated RegExp.exec calls to read link targets. The test verifies both v2 references are extracted when mocked matchAll results lack named groups.
      Priority: Low

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

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: t3dotgg

      Merge Risk: Minimal · up to 79af2

      No merge-blocking issue was identified in the thread-link extraction change.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main mobile fix: thread links now show their linked thread titles.
      Description checkPassedThe description includes complete Problem, Change, Scope and approval, and Verification sections. It provides reproduction details, implementation context, linked issue, test results, device verificat…
      Linked Issues checkPassedIssue #26468 reports that mobile subagent thread links do not show the linked thread information. threadLinkRefs now uses RegExp.prototype.exec and preserves named capture groups on Hermes. The ad…
      Out of Scope Changes checkPassedThe changes are limited to the threadLinkRefs implementation and its regression test. The implementation fixes the mobile thread-link lookup, and the test verifies that fix. No unrelated product beh…
      Full details: Description check

      Explanation

      The description includes complete Problem, Change, Scope and approval, and Verification sections. It provides reproduction details, implementation context, linked issue, test results, device verification, and known verification limits. Screenshots are missing, but the limitation is explicitly documented and the remaining evidence is sufficient.

      Full details: Linked Issues check

      Explanation

      Issue #26468 reports that mobile subagent thread links do not show the linked thread information. threadLinkRefs now uses RegExp.prototype.exec and preserves named capture groups on Hermes. The added regression test simulates missing matchAll groups and verifies both thread references. The reported Android verification shows the linked thread title after the change.

      Full details: Out of Scope Changes check

      Explanation

      The changes are limited to the threadLinkRefs implementation and its regression test. The implementation fixes the mobile thread-link lookup, and the test verifies that fix. No unrelated product behavior or unrelated files are included.

      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.
    4. juliusmarminge added labelsbugfix

    5. juliusmarminge added labelspr:gate-failed

    6. Note

      🤖 Claude Opus 5.5 responding on behalf of sharull9

      #26494 fixes a separate cause of #26468 on mobile, and the issue needs both PRs to be fully fixed.

      • This PR fixes Hermes dropping named groups from matchAll, which stops Android from resolving titles for [label](…) and <…> thread links.
      • #26494 handles bare t3-thread://v1/… and t3-thread://v2/… URLs, like the One agent is working: t3-thread://v2/… line in the issue's screenshot. The shared parser didn't recognize them before, so they stayed raw on every platform. It still uses matchAll, so Android needs this PR too.

      #26494 now references #26468 without a closing keyword. This PR still closes it, so if this one merges first, the issue may need to be reopened until #26494 lands.

    7. I'm seeing this on iPhone too: valid v2 thread links render as 'Thread no longer available' even though the destination threads still exist. Explicitly labelled v1 links work in the same client. Thanks for investigating. Posted at the user's request with AI assistance from OpenAI Codex (gpt-6.1-sol, Codex harness).

    8. Please consider adding a regression test that runs threadLinkRefs after compiling the shared module with babel-preset-expo and the Android Metro caller settings.

      The current test removes groups from matchAll results on an untransformed regex. In the mobile build, Babel supplies named groups through a regex wrapper; new RegExp(THREAD_LINK_OUTSIDE_CODE) also loses that wrapper's mapping. Applying this PR's cloned-regex exec loop to the mobile-Babel regression still returns [] instead of the two expected references.

      Reusable regression test. It fails on main and on this PR's current implementation, and passes when the loop uses the original regex after resetting its cursor:

      THREAD_LINK_OUTSIDE_CODE.lastIndex = 0;
      for (
        let match = THREAD_LINK_OUTSIDE_CODE.exec(markdown);
        match !== null;
        match = THREAD_LINK_OUTSIDE_CODE.exec(markdown)
      ) {
        // Existing extraction logic.
      }

      That version also restored title chips and navigation in Android verification. I opened #28768 during the investigation and am closing it as a duplicate; the test and correction are available to reuse here.

    9. juliusmarminge merged this976a231

    10. juliusmarminge closed this

Sign in to join this conversation.