Skip to content

fix: include Windows directory junctions in project browser - #2798

Open
badcuban wants to merge 2 commits into
pingdotgg:mainfrom
badcuban:codex/windows-directory-junction-browse
Open

fix: include Windows directory junctions in project browser#2798
badcuban wants to merge 2 commits into
pingdotgg:mainfrom
badcuban:codex/windows-directory-junction-browse

Conversation

@badcuban

@badcuban badcuban commented May 25, 2026

Copy link
Copy Markdown

Summary

  • include directory symlinks/junctions in workspace folder browsing when they resolve to directories
  • skip legacy Windows profile junction names that otherwise add noisy dead-end entries in the home directory
  • add a focused regression test for browsing a symlinked directory

Why

On Windows, OneDrive-backed known folders like Desktop, Documents, and Pictures can appear as reparse points. Node reports those entries as symbolic links from fs.readdir(..., { withFileTypes: true }), so the project browser filtered them out when it only accepted dirent.isDirectory().

This keeps the existing browser behavior, but follows symlink/junction entries with fs.stat and includes them when they resolve to directories.

Testing

  • bun fmt
  • bun lint (passes with existing warnings)
  • bun typecheck
  • bun run test -- WorkspaceEntries
  • manual browse check: ~/OneDrive/ returns Attachments, Desktop, Documents, Music, Pictures, and Public

Note

Low Risk
Scoped to workspace browse listing logic with graceful stat failures; no auth or data-path changes, only richer directory detection on disk.

Overview
Project folder browsing now treats symlink and junction entries as directories when they resolve to a folder, instead of dropping anything that readdir reports only as a symbolic link.

browse() in WorkspaceEntries uses a new isDirectoryEntry helper: real directories pass through unchanged; symlinks are followed with fs.stat and included when the target is a directory (broken or file symlinks are skipped). On win32, a fixed set of legacy user-profile junction names is excluded so home-directory listings stay usable.

Directory checks run async with concurrency 16 per listing. A regression test asserts symlinked directories appear when browsing a temp folder.

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

Note

Include Windows directory junctions in project browser

  • Adds isDirectoryEntry helper in WorkspaceEntries.ts that resolves symlinks via stat() and returns true if the target is a directory, false on error.
  • Updates browse() to replace the dirent.isDirectory() filter with async isDirectoryEntry checks (concurrency: 16), so directory symlinks and junctions appear alongside real directories.
  • Excludes a hardcoded set of legacy Windows user-profile junction names (WINDOWS_LEGACY_PROFILE_JUNCTION_NAMES) on win32 to avoid surfacing noise entries.
  • Behavioral Change: browse() now returns symlinked directories that were previously omitted; broken symlinks and non-directory symlinks are silently skipped.

Macroscope summarized ae46c95.

@coderabbitai

coderabbitai Bot commented May 25, 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

Run ID: c1c9b8d0-f510-42f9-bb46-76c1d84fc9a4

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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:M 30-99 changed lines (additions + deletions). labels May 25, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes May 25, 2026
@macroscopeapp

macroscopeapp Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Straightforward bug fix that makes directory symlinks and Windows junctions visible in the project browser. Changes are self-contained with proper error handling, a safeguard for problematic system junctions, and include a test.

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

@juliusmarminge
juliusmarminge force-pushed the codex/windows-directory-junction-browse branch from cde0dbd to 8faa7ab Compare June 16, 2026 18:35
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 16, 2026 18:35

Dismissing prior approval to re-evaluate 8faa7ab

@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 3 potential issues.

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 ae46c95. Configure here.

}
if (platform === "win32" && WINDOWS_LEGACY_PROFILE_JUNCTION_NAMES.has(dirent.name)) {
return false;
}

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.

Legacy junction filter too broad

Low Severity

On Windows, the isDirectoryEntry function's check for WINDOWS_LEGACY_PROFILE_JUNCTION_NAMES applies too broadly. It filters out valid directory symlinks whose names match, even when they are outside the user profile, preventing these legitimate project folders from appearing in browse results.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ae46c95. Configure here.

"SendTo",
"Start Menu",
"Templates",
]);

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.

Incomplete Windows junction denylist

Medium Severity

WINDOWS_LEGACY_PROFILE_JUNCTION_NAMES omits the standard profile junctions My Music, My Pictures, and My Videos, while including the same-class entry My Documents. After symlink/junction browsing is enabled, those missing names can pass stat and show up under the user profile as noisy dead-end folders that fail when opened.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ae46c95. Configure here.

yield* writeTextFile(cwd, "target/index.ts", "export {};\n");
yield* Effect.promise(() =>
fsPromises.symlink(target, link, platform === "win32" ? "junction" : "dir"),
);

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.

Symlink regression test cannot run

Medium Severity

The new browse symlink regression test calls fsPromises.symlink, but this file only imports the fs promises module as NodeFSP. Setup throws before browse runs, so the only coverage for directory symlink/junction inclusion never executes.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ae46c95. Configure here.

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

Labels

size:M 30-99 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.

2 participants