Skip to content

fix: route osc 8 file links to plugin handlers - #2942

Merged
ogulcancelik merged 1 commit into
masterfrom
akbash/2941-file-link-handler
Aug 25, 2026
Merged

fix: route osc 8 file links to plugin handlers#2942
ogulcancelik merged 1 commit into
masterfrom
akbash/2941-file-link-handler

Conversation

@akbash-bot

Copy link
Copy Markdown
Collaborator

Issue

Ctrl-clicking an OSC 8 file:// link does nothing even when an enabled plugin link handler matches it, while the same handler works for web links.

Problem

Herdr applied its browser-opening web allowlist before checking plugin handlers, so explicit terminal links using other schemes were discarded before a plugin could match them.

How did we fix it?

Explicit OSC 8 targets now reach installed plugin handlers unchanged. The browser fallback remains a separate HTTP(S)-only boundary, so unmatched file links are neither consumed nor sent to the system URL opener; visible plain-text file paths also remain non-clickable.

Verification

Before the change, a production click-path test using the reported OSC 8 file:///tmp/herdr-file-repro.txt target failed because the Ctrl-click was unhandled. The same test now starts the matching plugin action, and its unmatched case confirms the system opener is not called. Related URL-click, hyperlink resolution, plugin-context, Unix/Windows lint, maintenance, and 3,470 other Rust tests pass; one unrelated live-handoff test remains environment-failing because its replacement server does not start.

refs #2941

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: accd1d07-6b75-46c5-b338-eb6451119ffb

📥 Commits

Reviewing files that changed from the base of the PR and between 7ac49a6 and 1ece701.

📒 Files selected for processing (3)
  • docs/next/CHANGELOG.md
  • src/app/actions.rs
  • src/app/input/terminal.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change routes visible OSC 8 file:// hyperlinks to matching plugin handlers. Unmatched links remain blocked from the system URL opener. Terminal input checks use runtime helpers, and a Unix-only test verifies both link paths.

Changes

OSC 8 file link dispatch

Layer / File(s) Summary
Extract and dispatch hyperlink clicks
src/app/actions.rs, src/app/input/mod.rs
Clicked hyperlink URIs are no longer limited to HTTP(S). Plugin handlers receive URLs first. Unhandled URLs require safe_web_url validation before system opening.
Delegate terminal input state checks
src/app/input/terminal.rs, src/app/actions.rs
Terminal input handling uses TerminalRuntime helpers for host scrollback, keyboard reporting, and mouse reporting. Manifest update matching accepts additional fields.
Validate plugin and opener behavior
src/app/input/terminal.rs, docs/next/CHANGELOG.md
A Unix-only test covers matching and unmatched OSC 8 file:// links. The changelog records the updated routing behavior.

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

Merge Risk: ⚪ Minimal · up to 1ece7

Explicit OSC 8 file targets can now reach matching plugin handlers while unmatched file links remain unconsumed; related tests pass, and no actionable merge-blocking risk remains beyond normal checks.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant url_at_pane_cell
  participant PluginHandler
  participant SystemURLOpener
  User->>url_at_pane_cell: Ctrl-click visible hyperlink
  url_at_pane_cell-->>User: Return hyperlink URI
  User->>PluginHandler: Try plugin handler
  PluginHandler-->>User: Return handled or unhandled
  User->>SystemURLOpener: Open only unhandled safe web URL
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the OSC 8 file-link issue, the plugin-handler routing fix, fallback behavior, and verification results.
Title check ✅ Passed The title clearly and concisely identifies the main change: routing OSC 8 file links to plugin handlers.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch akbash/2941-file-link-handler

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.

@snqb

snqb commented Aug 20, 2026

Copy link
Copy Markdown

will this allow clicking to file:// links without turning off mouse support?

@ogulcancelik

Copy link
Copy Markdown
Collaborator

@akbash-bot the implementation review is clean. please rebase onto current master, resolve the changelog conflict, and rerun checks and both review bots.

@ogulcancelik
ogulcancelik force-pushed the akbash/2941-file-link-handler branch from 7ac49a6 to 1ece701 Compare August 25, 2026 16:45
@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown

Greptile Summary

This PR allows explicit OSC 8 targets to reach enabled plugin link handlers before applying the browser-opening allowlist.

  • Returns raw OSC 8 hyperlink targets from pane-cell URL resolution.
  • Preserves HTTP(S)-only system-opener fallback for links not handled by plugins.
  • Adds coverage for matched and unmatched file:// hyperlinks and documents the fix.

Confidence Score: 5/5

The PR appears safe to merge with the intended plugin-first routing and HTTP(S)-only system-opener boundary intact.

The only production consumer of the newly unfiltered OSC 8 target invokes plugin handlers first and independently reapplies the web allowlist before reaching the system opener; unmatched non-web links remain unhandled as documented.

Important Files Changed

Filename Overview
src/app/actions.rs Returns explicit OSC 8 URIs unchanged while retaining the existing web-only filter for plain-text URL detection.
src/app/input/mod.rs Routes resolved links through plugin handlers first and gates system-opener fallback to HTTP(S).
src/app/input/terminal.rs Adds an end-to-end input-path test proving matched file links invoke plugins and unmatched file links avoid the system opener.
docs/next/CHANGELOG.md Accurately documents the new OSC 8 plugin-handler behavior and browser fallback boundary.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Modified click on pane cell] --> B{OSC 8 or detected URL?}
    B -->|No| C[Continue normal mouse handling]
    B -->|Yes| D{Plugin handler matches?}
    D -->|Yes| E[Start plugin action]
    D -->|No| F{HTTP or HTTPS?}
    F -->|Yes| G[Open with system URL opener]
    F -->|No| C
Loading

Reviews (1): Last reviewed commit: "fix: route osc 8 file links to plugin ha..." | Re-trigger Greptile

@ogulcancelik

Copy link
Copy Markdown
Collaborator

will this allow clicking to file:// links without turning off mouse support?

yes. ctrl-click is handled by herdr before pane mouse reporting, so the app can keep mouse support enabled. this only applies to explicit OSC 8 file:// links with a matching enabled plugin handler; plain file paths still do nothing.

@ogulcancelik
ogulcancelik merged commit 9ff467b into master Aug 25, 2026
7 checks passed
@kangal-bot kangal-bot removed the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 25, 2026
joonhwan pushed a commit to joonhwan/herdr that referenced this pull request Aug 25, 2026
refs herdrdev#2941

Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
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.

4 participants