Skip to content

[bug]: symlinks to directories outside the worktree are not browsable in the file tree (1.2.0 regression) #3076

Description

@iAsimov

Bug Description

A symlink whose target resolves outside the workspace root is classified as outside-root and is neither expandable nor openable in the file tree. It renders as a leaf node with a link icon, and opening it shows "Could not load file". The same links behaved as directories in 1.1.40.

Steps to Reproduce

  1. Create a task/worktree in any project.
  2. From the worktree root: ln -s ~/some/dir/outside shared (target outside the worktree).
  3. Open the task editor's file tree and click shared.

Actual vs Expected Behavior

Actual: the entry cannot be expanded or opened; opening it yields "Could not load file".

Expected: a symlink to a directory behaves as a directory.

emdash Version

1.2.2. Introduced in 1.2.0; 1.1.40 is unaffected.

Operating System

macOS 26.6.2 (Apple silicon)

Additional Context

  • packages/core/src/runtimes/files/node/tree/directory-reader.ts, in classifySymlink, returns before the isDirectory() / isFile() classification:
    const canonical = await realpath(absolutePath);
    if (!containsPath(rootPath, canonical)) return { target, kind: 'outside-root' };
  • With symlinkTargetKind === 'outside-root', isExpandableFileEntry and isOpenableFileEntry (packages/core/src/runtimes/files/api/tree/state.ts) both return false.
  • The same containment applies in RootPathPolicy.resolveFollowed and resolveExistingEntry (packages/core/src/runtimes/files/node/fs/path-policy.ts), and in enumerate.ts, where it also overrides includeSymlinkFiles.
  • directory-reader.ts is absent in v1.1.40 and present in v1.2.0.

Metadata

Metadata

Assignees

No one assigned

    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