Skip to content

feat(web): open files in containing folder - #5366

Open
t3-code[bot] wants to merge 7 commits into
mainfrom
feat/open-files-in-folder
Open

feat(web): open files in containing folder#5366
t3-code[bot] wants to merge 7 commits into
mainfrom
feat/open-files-in-folder

Conversation

@t3-code

@t3-code t3-code Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

problem

file link context menus can open files in editors or copy their paths, but cannot reveal them in the host file manager.

fix

  • add an "Open in folder" action to markdown file chip context menus
  • route the action through the thread's environment so remote hosts open their own file manager
  • reveal files with Finder and Windows Explorer, and open the containing directory on Linux
  • add launcher and websocket routing coverage

testing

  • GOMAXPROCS=2 pnpm --filter @t3tools/contracts typecheck
  • GOMAXPROCS=2 pnpm --filter @t3tools/client-runtime typecheck
  • GOMAXPROCS=2 pnpm --filter t3 typecheck
  • GOMAXPROCS=1 pnpm --filter @t3tools/web typecheck
  • GOMAXPROCS=2 pnpm --filter t3 exec vp test run src/process/externalLauncher.test.ts
  • GOMAXPROCS=2 pnpm --filter t3 exec vp test run src/server.test.ts -t "routes websocket rpc shell.revealInFileManager"

model: gpt-5.4
harness: t3bot


Note

Medium Risk
Spawns host file-manager processes from server-side paths and adds session/env heuristics (SSH, headless Linux, WSL); mistakes could expose the action where it cannot work or launch unexpected commands, but scope matches existing shell operate RPCs and unsupported cases are rejected.

Overview
Adds Open in folder for markdown file links in chat, routed through a new shell.revealInFileManager RPC on the thread’s environment (same operate scope as open-in-editor).

The server exposes fileManagerReveal and implements ExternalLauncher.revealInFileManager with platform-specific behavior: Finder -R / Explorer /select, when the path exists, otherwise the parent folder; Linux uses xdg-open on the directory. File-manager availability is gated on a graphical session (DISPLAY/Wayland, not SSH, not Windows Services, WSL without WSLg uses explorer.exe with UNC paths).

The web UI shows the context-menu action only when connected, the capability is advertised, and file-manager is in availableEditors. Link parsing now handles paths with spaces and angle-bracket destinations; reveal uses resolved filePath rather than editor targetPath.

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

Note

Add 'Open in folder' file manager reveal action to chat file links

  • Adds a new shell.revealInFileManager WebSocket RPC that spawns the OS file manager to select a file or open its containing folder, with platform-specific handling for macOS (-R), Windows (/select,), Linux (xdg-open), and WSL (explorer.exe with UNC paths).
  • Adds an 'Open in folder' context menu item to file link chips in ChatMarkdown.tsx, shown only when the server advertises the fileManagerReveal capability and a compatible editor is available.
  • Introduces fileLinkContextMenu.ts with helpers to resolve the correct environment and gate visibility of the reveal action.
  • Extends markdown link parsing in markdown-links.ts to support spaces and angle-bracketed destinations.
  • Risk: The reveal action is silently suppressed in headless, SSH, and Windows Service sessions; the server actively checks for a graphical session before advertising the capability.
📊 Macroscope summarized 8709943. 11 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026
Comment thread apps/web/src/components/ChatMarkdown.tsx
Comment thread apps/server/src/process/externalLauncher.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found. New feature adding "reveal in file manager" functionality with new RPC endpoint, platform detection logic, capability flag, and UI integration. New user-facing features require human review. Additionally, an unresolved High-severity finding about regex edge cases warrants attention.

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

@t3-code
t3-code Bot force-pushed the feat/open-files-in-folder branch from c5ce623 to 71d99ee Compare August 5, 2026 01:40
@t3-code

t3-code Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

updated the review fixes: open in folder is first and only appears when the file’s connected environment advertises both the reveal rpc and an available file manager. added focused menu-order and visibility tests.

open in folder first

@t3-code
t3-code Bot force-pushed the feat/open-files-in-folder branch from 47284e0 to 316bb7d Compare August 5, 2026 05:26

@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.

Reviewed by Cursor Bugbot for commit 316bb7d. Configure here.

Comment thread apps/server/src/process/externalLauncher.ts
@t3-code
t3-code Bot force-pushed the feat/open-files-in-folder branch from 1ff7da7 to 0647b60 Compare August 6, 2026 14:52
@t3-code
t3-code Bot force-pushed the feat/open-files-in-folder branch from 0647b60 to 8709943 Compare August 8, 2026 02:38
const RELATIVE_FILE_NAME_PATTERN = /^[A-Za-z0-9._ -]+\.[A-Za-z0-9_-]+(?::\d+){0,2}$/;
const POSITION_SUFFIX_PATTERN = /:\d+(?::\d+)?$/;
const POSITION_ONLY_PATTERN = /^\d+(?::\d+)?$/;
const MARKDOWN_LINK_HREF_PATTERN = /\[[^\]]*]\(\s*(<[^>\n]+>|[^)\s]+)(?:\s+["'][^"']*["'])?\s*\)/g;

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.

🟠 High src/markdown-links.ts:12

MARKDOWN_LINK_HREF_PATTERN fails to extract valid markdown link destinations that contain a literal ), such as [file](src/foo(bar).ts). The regex stops at the first ), so extractMarkdownLinkHrefs omits the href and the link renders as an ordinary link instead of a file chip. Consider handling balanced parentheses in the destination (e.g., counting nested ( ) or matching the closing ) at depth zero).

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/markdown-links.ts around line 12:

`MARKDOWN_LINK_HREF_PATTERN` fails to extract valid markdown link destinations that contain a literal `)`, such as `[file](src/foo(bar).ts)`. The regex stops at the first `)`, so `extractMarkdownLinkHrefs` omits the href and the link renders as an ordinary link instead of a file chip. Consider handling balanced parentheses in the destination (e.g., counting nested `(` `)` or matching the closing `)` at depth zero).

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 11.4 KiB 11.3 KiB −12 B (−0.1%) 15.1 KiB
Codex Thread snapshot wire 5.5 KiB 5.5 KiB +4 B (+0.1%) 7.3 KiB
Codex Live turn WebSocket wire 5.9 KiB 5.9 KiB −16 B (−0.3%) 7.8 KiB
Codex Live turn WebSocket decoded 49.7 KiB 49.7 KiB 0 B (0.0%) 66.4 KiB
Codex Live turn messages 16 16 0 (0.0%) 21
Claude Total thread wire 11.3 KiB 11.3 KiB +12 B (+0.1%) 15.1 KiB
Claude Thread snapshot wire 5.5 KiB 5.5 KiB +6 B (+0.1%) 7.3 KiB
Claude Live turn WebSocket wire 5.9 KiB 5.9 KiB +6 B (+0.1%) 7.8 KiB
Claude Live turn WebSocket decoded 50.6 KiB 50.6 KiB 0 B (0.0%) 66.4 KiB
Claude Live turn messages 16 16 0 (0.0%) 21

Baseline: 4eaf5ef · PR result: 8709943 · 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: 94.6 KiB
  • Claude decoded thread snapshot: 95.4 KiB

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

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:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants