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
Copy link
Copy Markdown

@mormubis mormubis commented May 24, 2026

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.

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

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

1 participant