Visitar URL original
fix: symlink/junction directories invisible in directory picker and @file · Issue #28526 · anomalyco/opencode · GitHub
Skip to content

fix: symlink/junction directories invisible in directory picker and @file #28526

Closed as not planned

Description

@danielxxomg

Description

Symlinked directories (Linux ln -s) and Windows junction points (e.g., OneDrive Desktop) are invisible in the directory picker, @file picker, and file listing. Navigating to ~/OneDrive/Desktop/ shows empty contents.

Root Cause

packages/core/src/filesystem.ts:74 — readDirectoryEntries classifies symlinks and junction points as "symlink" because Node's isDirectory() returns false for reparse points. Downstream filters in src/file/index.ts skip type !== "directory", silently losing all symlink entries.

Steps to Reproduce

  1. On Windows with OneDrive: navigate to ~/OneDrive/Desktop/ in the directory picker → empty
  2. On Linux: ln -s /mnt/data/Projects ~/Projects, navigate → empty
  3. @file picker also doesn't show symlinked directories

Proposed Fix

In readDirectoryEntries, when isSymbolicLink() is true, stat() the target. If the target is a directory, return "directory" instead of "symlink". This fixes ALL consumers (picker, @file, File.list, ripgrep indexer) without changing any downstream filters.

Related Issues

Platform

Windows 11, Linux, macOS (all symlink types)

Terminal

Windows Terminal

Activity

  1. added a commit that references this issue on May 20, 2026
    7b29ce7
  2. github-actions commented on May 20, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct or adds new context, please clarify how it differs from the above.

  3. sghng commented on Jun 4, 2026

    @sghng

    Second this. Really looking forward to the fixes getting merged. I can also share my use case: I symlink a dir inside my Obsidian vault into the project repo, i.e. ./notes -> ~/obsidian/projects/my-new-app/, that way the agent works in the codebase natively, while also updating notes in Obsidian vault. This also serves as a memory layer.

  4. added a commit that references this issue on Jun 4, 2026
    eccb75a
  5. danielxxomg commented on Jun 4, 2026

    @danielxxomg
    Author

    @sghng Thanks for sharing the use case. That helps clarify the expected behavior.

    This PR fixes the classification issue in readDirectoryEntries, so symlinks to directories should now show up correctly in the directory picker when browsing from the home directory.

    That said, symlinks pointing outside the project root, like an external Obsidian vault, are still intentionally blocked by the security check in entry(). That part is meant to prevent symlink escape issues.

    Supporting external symlinks safely would probably need a separate discussion, maybe with explicit user consent or a trusted-path mechanism.

  6. danielxxomg commented on Jun 4, 2026

    @danielxxomg
    Author

    @sghng Your Obsidian vault use case got me thinking — the classification fix in #28532 makes symlinks visible in the picker, but external symlinks are still blocked by the security check in entry().

    I opened #30788 to discuss allowing those external symlinks with explicit user consent, using the existing external_directory permission flow instead of adding a separate trust system.

    So the idea would be to route escaped symlink targets through the same Allow once / Allow always / Reject flow that already exists for external paths.

    Would love your input there if you have thoughts on the approach.

  7. added a commit that references this issue on Jun 5, 2026
    8559f60
  8. jianbinJava commented on Jun 6, 2026

    @jianbinJava

    问题仍然没有修复, v1.16.2 版本仍然存在.(Windows 11 环境)

  9. danielxxomg commented on Jun 6, 2026

    @danielxxomg
    Author

    The fix for this is in PR #28532 — it's been ready for a while but hasn't been merged yet. It resolves the root cause in readDirectoryEntries by stat()-ing the symlink target to detect if it's a directory.

    There's also a companion PR (#29102) that adds follow: true to the file scan, which handles the @file mentions case.

    Both are waiting on maintainer review. Hopefully they land soon — this has been affecting a lot of Windows/OneDrive users.

  10. adamrybak commented on Jul 7, 2026

    @adamrybak

    any update on this?

  11. BadLemon5267 commented on Jul 17, 2026

    @BadLemon5267

    Same as with WSL server projects, there's a symlink (created by ln -s) in ~, but it's invisible.

  12. github-actions commented on Sep 17, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions