Skip to content

fix(links): open local html file links in the browser link routing picks - #32706

Merged
AmoabaKelvin merged 3 commits into
mainfrom
html-file-link-system-browser
Oct 23, 2026
Merged

AmoabaKelvin merged 3 commits into
mainfrom
html-file-link-system-browser

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​56
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​93 $\color{#cf222e}{\Huge{\mathbf{−}}}$​40 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​53

What you saw

With Link Routing set to System Browser, Cmd/Ctrl-clicking a local .html path in the terminal or in an agent chat still opened it in Orca's browser. Only http(s) links honored the setting.

Root cause

openDetectedFilePath (terminal-file-open-routing.ts) opened every local HTML file in an Orca browser tab and never asked the link-routing owner. Terminal and chat file links both go through it, so both were affected.

Fix

Local HTML files now take their destination from httpLinkActionDestinationsFor, the same owner http links use:

Link Routing Cmd/Ctrl-click Shift+Cmd/Ctrl-click
System Browser OS browser Orca browser
Orca Browser Orca browser (unchanged) OS browser (unchanged)
  • Shift takes the other destination through a new shared helper, httpLinkDirectClickDestination. The terminal and chat http paths already did this inline, and now call the helper too.
  • The click popover for a local HTML file now shows "System Browser" and "Orca Browser" in setting order, with the same shortcuts as http links. The old rows were "Open file" and "Open with default app".
  • The hover hint names what Shift does ("⇧⌘+click to open in Orca" or "for system browser").
  • The OS route is the existing shell.openFilePath call that Shift+Cmd already used, so main isn't touched. Main's shell:openUrl rejects file: URLs.

Remote workspaces keep today's behaviour. SSH and paired-runtime HTML still opens through the doc preview, because the OS can't open a remote path. This includes a file that turns out to be on this computer: its hint and popover are built before the path resolves and promise Orca.

Known limit. The OS route opens the app associated with .html, which is the default browser on most machines. If .html is associated with an editor, that editor opens. Main's Shift+Cmd path already had this limit, and its hint called it "default browser". Opening the real default browser would need a per-platform opener in main, so that's left for a follow-up.

Noticed, not fixed. With Link Routing on System Browser and "Shift inverts" off, the terminal's http hint says "⇧⌘+click for system browser", but Shift+Cmd on an http link opens Orca, because the terminal always takes the alternate destination. That's a separate fix.

Testing

  • openDetectedFilePath: under System Browser, Cmd-click calls the OS and Shift-click opens an Orca tab. Fails on main.
  • openDetectedFilePath: a client-local HTML file in a server workspace stays in Orca under the default setting.
  • Popover: rows for a local HTML file under both settings.
  • Hint strings.
  • Existing HTML tests now set openLinksInApp: true so they keep testing the Orca path.
  • Focused terminal, chat and http-link suites pass. check:code-quality:changed and check:react-doctor:changed are clean.
  • Live in a hidden dev build, for terminal and agent chat links, under both settings. The OS open was stubbed in main so the recording didn't launch a browser on the desktop. The caption shows the shell.openPath call it received.

Visual Proof

Terminal, BEFORE (System Browser: ⌘-click opens Orca's browser):

(screenshot removed: contained real product data)

Terminal, AFTER (⌘-click goes to the OS browser, ⇧⌘-click to Orca; the popover and hint name both):

(screenshot removed: contained real product data)

Agent chat, BEFORE:

(screenshot removed: contained real product data)

Agent chat, AFTER:

(screenshot removed: contained real product data)

Linked Issue

Fixes #32547

Linear: STA-11878

@AmoabaKelvin
AmoabaKelvin marked this pull request as ready for review October 23, 2026 17:38
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5a0bd129-ec36-494b-90c8-926f9593a504
📥 Commits

Reviewing files that changed from the base of the PR and between 88b47bc and f902698.

📒 Files selected for processing: 13
  • src/renderer/src/components/native-chat/native-chat-web-link-actions.ts
  • src/renderer/src/components/terminal-pane/local-html-file-destinations.ts
  • src/renderer/src/components/terminal-pane/terminal-file-link-actions.test.ts
  • src/renderer/src/components/terminal-pane/terminal-file-link-actions.ts
  • src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts
  • src/renderer/src/components/terminal-pane/terminal-link-click-fallback.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-file-open-routing.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers.ts
  • src/renderer/src/components/terminal-pane/terminal-link-open-beside-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-open-hints.ts
  • src/renderer/src/components/terminal-pane/terminal-link-osc-url-routing.test.ts
  • src/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.ts
  • src/renderer/src/lib/http-link-destinations.ts

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

📝 Walkthrough

Direct-click handlers now use a shared helper to select HTTP-link destinations. Local HTML file actions and routing use destinations derived from app settings, and the hover hint reflects the configured primary and alternate destinations. Tests cover browser action order, file routing, direct-click setup, and hint text.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to f9026

Local HTML links follow the selected routing preference, and the checked remote and client-local hints do not misstate the advertised click behavior. The change is ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 13 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: local HTML file links now follow the configured browser-link routing. It is concise and related to the changeset.
Description check Passed The description provides a clear problem statement, root cause, implementation details, scope limitations, linked issue, visual proof, and testing information. It omits some template headings and chec…
Linked Issues check Passed Issue #32547 requires that local HTML file links honor the System Browser setting (openLinksInApp false), and that a reliable system-browser action exists. At head, openDetectedFilePath (terminal-fi…
Out of Scope Changes check Passed All changed files relate to the issue or support its implementation. Routing changes are in terminal-file-open-routing.ts, local-html-file-destinations.ts, terminal-file-link-actions.ts, terminal-link…
Full details: Description check

Explanation

The description provides a clear problem statement, root cause, implementation details, scope limitations, linked issue, visual proof, and testing information. It omits some template headings and checklist confirmations, but the required change and validation details are sufficiently documented.

Full details: Linked Issues check

Explanation

Issue #32547 requires that local HTML file links honor the System Browser setting (openLinksInApp false), and that a reliable system-browser action exists. At head, openDetectedFilePath (terminal-file-open-routing.ts) selects a page destination for local HTML using httpLinkDirectClickDestination(localHtmlFileDestinations(), openWithSystemDefault) unless browserDestination is supplied. localHtmlFileDestinations() calls httpLinkActionDestinationsFor with the current settings. Under System Browser, a plain click resolves to system, which calls window.api.shell.openFilePath. Shift-click resolves to the Orca alternate, which opens an Orca browser tab. The popover (terminal-file-link-actions.ts) builds rows through buildHttpLinkActions, so the System Browser row is the reliable action the issue asks for. Tests cover both settings and the popover rows. Remaining limit: shell.openFilePath opens the app associated with .html, which is not guaranteed to be a browser. The PR discloses this limit and defers a per-platform opener. This does not break the issue's stated expectation for the common default-browser setup. Remote and paired-runtime HTML stays in the doc preview, which the issue does not require to change.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the issue or support its implementation. Routing changes are in terminal-file-open-routing.ts, local-html-file-destinations.ts, terminal-file-link-actions.ts, terminal-link-handlers.ts and terminal-link-open-hints.ts. The hover hint and popover changes are required so the displayed destinations match the new routing. The new httpLinkDirectClickDestination helper in http-link-destinations.ts is used by the terminal http path (terminal-url-link-hit-testing.ts) and the native chat path (native-chat-web-link-actions.ts). This refactor is a shared-logic consolidation that the PR justifies, and it leaves http-link Shift behavior unchanged. Moving isHtmlFilePath into local-html-file-destinations.ts is a supporting refactor. Test edits set openLinksInApp explicitly so existing HTML tests keep covering the Orca path. The PR's noted but unfixed terminal hint mismatch for http links is documented only and has no code change in this PR. No unrelated behavior change was found.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@AmoabaKelvin
AmoabaKelvin merged commit 2d06b6d into main Oct 23, 2026
70 checks passed
@AmoabaKelvin
AmoabaKelvin deleted the html-file-link-system-browser branch October 23, 2026 21:18
nwparker added a commit that referenced this pull request Oct 23, 2026
… their own modules

terminal-file-open-routing.ts went over the 300-line limit after #32706, failing
every PR's lint. Move two self-contained pieces out, unchanged: the open-request
turn (shared with click hit-testing) and opening a local HTML file in Orca's
browser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local HTML artifact links ignore “System Browser” setting

1 participant