Skip to content

feat(desktop): open chat links matching site patterns in the integrated browser - #5352

Closed
JudahZF wants to merge 8 commits into
pingdotgg:mainfrom
JudahZF:t3code/browser-site-preferences-1
Closed

JudahZF wants to merge 8 commits into
pingdotgg:mainfrom
JudahZF:t3code/browser-site-preferences-1

Conversation

@JudahZF

@JudahZF JudahZF commented Aug 4, 2026 •

Copy link
Copy Markdown

I wanted links to my postplans (and other sites I always view in-app) to open in the integrated browser panel instead of bouncing out to my system browser every time I click them in chat.

Now there's an "Integrated browser links" setting (Electron only, under General) where you list host patterns like *.github.com or docs.example.com/api. Left-clicking a chat link that matches opens it in the integrated browser; modifier- and middle-clicks still open externally, and everything else behaves as before.

  • Patterns are host + optional path prefix — no schemes or ports. Bare domains normalize to *.domain.com; a leading *. matches the apex and any subdomain, anything else matches exactly.
  • Stored raw in ClientSettings with parsing/validation in the web app, so a bad persisted entry can never break settings decoding.
  • Matching + normalization are unit tested; setting participates in search and settings restore.

🤖 Generated with Claude Code


Note

Low Risk
Scoped to Electron chat link clicks and optional client settings; invalid patterns are ignored at match time and schema stays permissive.

Overview
Adds user-configurable integrated browser link patterns so matching chat URLs open in the in-app browser panel (Electron) instead of the system browser on a normal left-click.

Settings & persistence: New integratedBrowserUrlPatterns on ClientSettings (default [], trimmed non-empty strings only). General settings get an Electron-only Integrated browser links editor to add/remove patterns; search hides that item on web, and restore/reset includes the list.

Pattern engine: New integratedBrowserLinkPatterns helpers parse/normalize host + optional path patterns (*. subdomains, segment-boundary paths, bare domains → *.domain.com), with unit tests.

Chat behavior: ChatMarkdown intercepts external link clicks when preview is available: modifier/middle-clicks unchanged; if the href matches configured patterns, opens integrated preview and falls back to external open on failure. Context-menu preview path shares the same failure reporting helper.

Reviewed by Cursor Bugbot for commit 80af8e4. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Open chat links matching configured site patterns in the integrated browser

  • Adds integratedBrowserUrlPatterns to ClientSettingsSchema as a list of URL patterns (host + optional path prefix) that controls which links open in the integrated browser panel instead of the system browser.
  • Implements pattern parsing, normalization, and matching in integratedBrowserLinkPatterns.ts, supporting *. wildcards, www stripping, segment-boundary path prefixes, and case-insensitive percent-escape handling.
  • Updates the ChatMarkdown anchor renderer to check clicked links against the configured patterns and open matches in the integrated preview, falling back to external open on failure.
  • Adds a settings UI in IntegratedBrowserLinksSetting.tsx (desktop only) to add/remove patterns, with canonicalization and duplicate prevention on add.
  • Behavioral Change: left-clicking a matching link no longer opens the system browser; modifier keys, non-http(s) links, and unmatched links are unaffected.

Macroscope summarized 80af8e4.

Copilot AI lite review requested due to automatic review settings August 4, 2026 18:49
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ac828b2-5150-45d3-b72a-8d35017242db

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026
Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts
Comment thread packages/contracts/src/settings.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an Electron-only setting that lets users route certain chat link clicks into the integrated browser/preview panel based on user-configured host (+ optional path prefix) patterns, instead of always opening the system browser.

Changes:

  • Extends ClientSettings with integratedBrowserUrlPatterns (plus patch support) and adds contract tests for decoding/patch trimming behavior.
  • Adds a General (Electron-only) settings UI for managing integrated-browser link patterns and includes the setting in settings search + “restore defaults”.
  • Implements pattern parsing/normalization/matching utilities with unit tests, and updates ChatMarkdown to intercept plain left-clicks on matching external links to open in preview.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/contracts/src/settings.ts Adds integratedBrowserUrlPatterns to ClientSettingsSchema + patch schema.
packages/contracts/src/settings.test.ts Verifies defaults, trimming behavior, and blank rejection for the new settings field.
apps/web/src/components/settings/settingsSearch.ts Adds a searchable entry for “Integrated browser links”.
apps/web/src/components/settings/SettingsPanels.tsx Wires the new Electron-only setting UI into General settings + restore-defaults/dirty detection.
apps/web/src/components/settings/IntegratedBrowserLinksSetting.tsx New add/remove UI for editing patterns (normalizes on add).
apps/web/src/components/ChatMarkdown.tsx Intercepts left-clicks on matching external links to open in integrated preview, while keeping modifier/middle clicks external.
apps/web/src/browser/integratedBrowserLinkPatterns.ts New parse/normalize/match logic for host(+path prefix) patterns.
apps/web/src/browser/integratedBrowserLinkPatterns.test.ts Unit tests covering parsing, normalization, and matching behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts
Comment thread apps/web/src/components/settings/IntegratedBrowserLinksSetting.tsx
Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 10f6128c281045c2cf186ccb837e35efbcdd759c. Configure here.

Comment thread apps/web/src/components/ChatMarkdown.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new feature allowing users to configure URL patterns that open in the integrated browser rather than the system browser. New user-facing capabilities with new settings and UI components warrant human review.

You can customize Macroscope's approvability policy. Learn more.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d76a2f05f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/components/settings/SettingsPanels.tsx
@JudahZF JudahZF changed the title feat(web): open chat links matching site patterns in the integrated browser feat(desktop): open chat links matching site patterns in the integrated browser Aug 5, 2026
JudahZF and others added 4 commits August 6, 2026 11:25
…rowser

Adds an "Integrated browser links" setting (Electron only) where users list
host(+path-prefix) patterns like *.github.com or docs.example.com/api.
Left-clicking a matching chat link opens it in the integrated browser panel
instead of the system browser; modifier- and middle-clicks still open
externally.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Patterns match against URL.pathname, so a `?` or `#` could never match —
reject them at entry. Dropping the blanket `:` check lets legitimate path
colons through; schemes and ports are still caught by the host character
check. Also correct two stale doc comments flagged in review.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
An empty apex passed the wildcard guard and would match only hosts with a
trailing dot. Require a non-empty apex after `*.`.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Left-clicks on matching links prevent default navigation, so a failed
integrated-browser open previously left the click dead with only a console
error. Mirror the terminal link behavior: fall back to shell.openExternal
(or window.open outside Electron). The context-menu "open in preview" action
keeps its existing behavior since the user asked for preview explicitly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@JudahZF
JudahZF force-pushed the t3code/browser-site-preferences-1 branch from 5d76a2f to 3e0179d Compare August 6, 2026 10:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e0179dff6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/components/settings/settingsSearch.ts
Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts Outdated
… paths

Percent-encode pattern path prefixes via URL so non-ASCII paths match the
encoded URL.pathname they are compared against, and filter the desktop-only
integrated-browser-links entry out of settings search when not in Electron.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts Outdated
Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts
… escape casing

Reject `www.*.example.com` instead of silently widening it to
`*.example.com`, and uppercase percent-escape hex on both the pattern
prefix and the compared pathname so equivalent escapes match.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts
Patterns like `example..com` or `-example.com` passed the character
check but could never match a real hostname, leaving them silently dead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc509e57a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts Outdated
Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts
Comment thread apps/web/src/browser/integratedBrowserLinkPatterns.ts
`*.www.example.com` failed to match `www.example.com` itself because the
link hostname was www-stripped before comparison; now both the raw and
stripped forms are checked.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Closing as part of the open-PR backlog sweep (wave 1).

Reason: Pattern-based in-app browser links superseded by user choice in #9339.
Related: #9339

Reopen if this is still wanted and you’re willing to rebase onto current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants