Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): choose whether links open in the default browser or in T3 Code #9339

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/9339/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

The in-app browser has become a general-purpose browser (profiles, cookie import), but every link a user clicks still went to the OS browser. The only way to get one into the in-app browser was the right-click menu on chat links, and terminal links forced a two-item menu on every click.

This adds a Browser setting, Open links in: Your default browser (the default, so nothing changes until it is switched) or T3 Code. With T3 Code selected, links clicked beside a thread open as a tab in the in-app browser. Cmd/Ctrl-click on a chat link still opens the default browser as the way out, mirroring how change-request links already treat the modifier; the right-click menu keeps offering both explicitly.

What follows the setting:

  • Markdown links in the chat (and PR descriptions, which reuse the same renderer)
  • Hyperlinks in the terminal — these no longer show a menu on every click; the setting decides
  • CI check Details in the PR panel
  • A PR link that has no checked-out project to open in the panel
  • The repository a publish just created

What stays on the system browser, because the control names its destination: Open on GitHub, the external-link icons in the PR header, the in-app browser's own "open in system browser" escape hatch, release notes. Non-web schemes (mailto:, vscode://) always go to the shell. The hosted web app and mobile have no in-app browser, so the setting does not render there and links behave as before.

Implementation: one pure resolver (browser/browserLinkTarget.ts) turns preference + click into a target, and a useOpenLink(threadRef) hook wraps it for the non-markdown buttons so every entry point makes the same decision.

Setting

Open links in setting

Chat link opened in the in-app browser

Terminal link opened in the in-app browser

Verified in the desktop app: chat link plain-click → in-app tab; Cmd-click → default browser; terminal link → in-app tab, no menu; a foreign PR link → in-app tab; setting back to default → unchanged pre-feature behaviour.

Claude Fable 5 via Claude Code.


Note

Medium Risk Wide user-facing link routing change across chat, terminal, and PR surfaces, though default system preserves prior behavior until users opt in; in-app open paths add failure/fallback complexity beside threads.

Overview Adds a client setting Open links in (browserLinkTarget: system by default, or app on desktop) under Integrations → Browser, with search, dirty-state labels, and restore-defaults support.

Central behavior: resolveLinkTarget and useOpenLink(threadRef) decide whether http(s) links beside a thread open in the in-app preview or via shell.openExternal, with in-app failure falling back to the system browser. Cmd/Ctrl on chat links still forces the system browser; non-web schemes always go to the shell; clients without an in-app browser ignore app.

Where it applies: chat markdown (including PR bodies via ChatMarkdown), terminal hyperlinks (the per-click preview/browser context menu is removed—the setting drives the path), CI check details, publish-repo links, and PR URLs that cannot open in-panel. PR UI passes threadRef through markdown editors and panels so previews and inline links follow the preference. Explicit “open on host” controls in the timeline still use the shell.

Contracts: BrowserLinkTarget and browserLinkTarget added to client settings schema and patches.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 69ee98fe783331d693abe386d2fb6db845a50814. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

  • Adds a BrowserLinkTarget client setting (system | in-app, default system) and an "Open links in" control in Integrations settings, with search and dirty-tracking support
  • Introduces resolveLinkTarget in browserLinkTarget.ts and a shared useOpenLink hook that route link clicks based on the hydrated preference, falling back to the system browser for Cmd/Ctrl clicks, unsupported runtimes, and non-HTTP(S) URLs
  • Wires the active thread reference through chat markdown, terminal links, pull-request detail/timeline, and Git action controls so in-app preview opening has the context it needs
  • Removes the old terminal-link context menu; terminal links now open directly via the setting-aware path with system-browser fallback on failure
  • Risk: openTerminalLinkInPreview removes TerminalLinkContextMenuShowError and the per-click preview/browser choice; any out-of-tree callers of that error class or the context-menu flow will break. Non-desktop clients ignore the in-app choice and always use the system browser.
Macroscope summarized 69ee98f.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.4 KiB13.3 KiB−175 B (−1.3%)15.1 KiB✅
      CodexThread snapshot wire6.9 KiB6.9 KiB0 B (0.0%)7.3 KiB✅
      CodexLive turn WebSocket wire6.6 KiB6.4 KiB−175 B (−2.6%)7.8 KiB✅
      CodexLive turn WebSocket decoded57.0 KiB55.5 KiB−1.5 KiB (−2.6%)66.4 KiB✅
      CodexLive turn messages109−1 (−10.0%)21✅
      ClaudeTotal thread wire13.3 KiB13.5 KiB+159 B (+1.2%)15.1 KiB✅
      ClaudeThread snapshot wire6.9 KiB6.9 KiB−3 B (−0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.4 KiB6.6 KiB+162 B (+2.5%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded56.4 KiB57.8 KiB+1.4 KiB (+2.5%)66.4 KiB✅
      ClaudeLive turn messages10100 (0.0%)21✅

      Baseline: 1aa44a0 · PR result: 69ee98f · 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: 109.4 KiB
      • Claude decoded thread snapshot: 110.1 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    3. Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

      Fix All in Cursor Bugbot Autofix is [ON](https://www.cursor.com/dashboard/bugbot), but a cloud agent failed to start. Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c73d67cb4bff37be4b401994322372e61f3975e9. Configure [here](https://www.cursor.com/dashboard/bugbot).
      apps/web/src/browser/useOpenLink.ts line 46OutdatedResolvedby juliusmarminge
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR adds a cross-surface link-routing feature and changes terminal links from a per-click choice menu to direct system-browser opening by default. Because the default product behavior changes and the implementation spans chat, terminal, pull-request, and Git-action paths, human review is warranted.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. juliusmarminge merged this18062da

    6. juliusmarminge closed this

Sign in to join this conversation.