Skip to content

fix(opencode): follow symlinks in file scan and directory listing#29102

Open
mormubis wants to merge 1 commit into
anomalyco:devfrom
mormubis:fix/file-follow-symlinks
Open

fix(opencode): follow symlinks in file scan and directory listing#29102
mormubis wants to merge 1 commit into
anomalyco:devfrom
mormubis:fix/file-follow-symlinks

Conversation

@mormubis

@mormubis mormubis commented May 24, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #29080

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

@file mentions cannot find files inside symlinked directories because File.scan() calls rg.files() without --follow — ripgrep skips symlinked directories by default.

this adds follow: true to the rg.files() call so ripgrep traverses symlinks when building the file search cache.

the other half of the issue (readDirectoryEntries classifying symlinked dirs as "symlink" instead of "directory") is addressed by #28532 which fixes the root cause in readDirectoryEntries itself.

How did you verify your code works?

  • bun typecheck passes
  • bun test test/file/index.test.ts — 52 tests pass

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on the search results, I found a related PR that addresses a similar concern:

Related PR:

The other PRs found (#27639 and #24973) are related to symlink handling but focus on different aspects (circular symlinks and ripgrep-specific handling respectively).

No exact duplicates were found (the current PR #29102 should not be marked as a duplicate of itself), but you may want to review #28532 to ensure your changes complement rather than conflict with that work.

@mormubis mormubis force-pushed the fix/file-follow-symlinks branch from 5e3809b to 4379e15 Compare May 24, 2026 14:01
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@sghng

sghng commented Jun 4, 2026

Copy link
Copy Markdown

Any updates on this PR? This feature is very needed! @mormubis seems like there are some merge conflicts that need to be resolved?

@mormubis mormubis force-pushed the fix/file-follow-symlinks branch from 4379e15 to 060e94b Compare June 4, 2026 14:17
rg.files() in scan() was not passing --follow, so files inside symlinked
directories were invisible to @file autocomplete.

the remaining readDirectoryEntries consumer fixes (symlinked dirs in
list() and the global home scan path) are covered by anomalyco#28532 which fixes
the root cause in readDirectoryEntries itself.

closes anomalyco#29080
@mormubis mormubis force-pushed the fix/file-follow-symlinks branch from 060e94b to cc536db Compare June 4, 2026 14:32
@mormubis

mormubis commented Jun 4, 2026

Copy link
Copy Markdown
Author

Any updates on this PR? This feature is very needed! @mormubis seems like there are some merge conflicts that need to be resolved?

@sghng resolved the conflicts... but not much else I can do ¯_(ツ)_/¯ I hope some contributor sees the PR and approve the CI.

@danielxxomg

Copy link
Copy Markdown

Hey @mormubis! Author of #28532 here.

Thanks for working on the complementary fix. Your follow: true change for ripgrep and my NFS.stat-based classification should cover the symlink behavior from both sides.

Hopefully both fixes can land together or close to each other.

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.

[Bug] @file mentions cannot find files inside symlinked directories

3 participants