Skip to content

fix(plugins): discover symlinked plugin directories#72695

Closed
ming1523 wants to merge 1 commit intoopenclaw:mainfrom
ming1523:fix/symlinked-plugin-directory-discovery
Closed

fix(plugins): discover symlinked plugin directories#72695
ming1523 wants to merge 1 commit intoopenclaw:mainfrom
ming1523:fix/symlinked-plugin-directory-discovery

Conversation

@ming1523
Copy link
Copy Markdown

Summary

  • follow explicitly linked plugin entries in scanned plugin roots when the symlink target is a file or directory
  • keep broken/non-file/non-directory symlinks ignored
  • add a regression test for discovering a symlinked plugin directory

Test

  • node scripts/test-projects.mjs src/plugins/discovery.test.ts

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This PR fixes plugin discovery to follow symbolic links in scanned plugin root directories, resolving to file or directory type via fs.statSync (symlink-following) and ignoring broken/non-file/non-directory symlinks. A regression test covering the symlinked directory case is included. The implementation integrates cleanly with the existing addCandidate path, which already resolves rootDir via safeRealpathSync.

Confidence Score: 5/5

Safe to merge — the symlink resolution logic is correct and well-tested, edge cases (broken symlinks, non-file/dir targets) are handled, and existing cycle-detection via visitedDirectories + safeRealpathSync prevents infinite loops.

No bugs found. resolveScannedEntryType correctly uses safeStatSync (which calls fs.statSync, a symlink-following stat) to determine the real type, the explicit continue after addCandidate in the file branch is correct, and addCandidate's existing safeRealpathSync call on rootDir means the test's rootDir assertion against the resolved real path is valid.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(plugins): discover symlinked plugin ..." | Re-trigger Greptile

@steipete
Copy link
Copy Markdown
Contributor

Thanks for the focused fix. I landed an equivalent maintainer patch on main in 28f264034b after adapting it around the recent realpath-cache changes in the same file.

The landed patch keeps the same core approach: resolve symlinked scanned entries to file/directory targets before the scanner branch, then reuse the existing discovery and safety gates. I also added coverage for global roots, workspace roots, and broken symlinks.

Proof:

  • pnpm test src/plugins/discovery.test.ts
  • pnpm check:changed
  • Blacksmith Testbox tbx_01kq7h9qdrr82q6kh32pry1xc0: same focused test plus pnpm check:changed

Closing this PR as superseded by the landed maintainer patch.

@steipete steipete closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants