Skip to content

fix(local): follow directory symlinks in GlobInfo - #930

Open
March-77 wants to merge 1 commit into
cloudwego:mainfrom
March-77:agent/follow-local-symlink-dirs
Open

fix(local): follow directory symlinks in GlobInfo#930
March-77 wants to merge 1 commit into
cloudwego:mainfrom
March-77:agent/follow-local-symlink-dirs

Conversation

@March-77

Copy link
Copy Markdown

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • User-facing module documentation is updated in this PR; no separate docs-repository change is needed.

(Optional) Translate the PR title into Chinese.

fix(local): 让 GlobInfo 跟随目录软链接

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:

Local.GlobInfo currently uses filepath.WalkDir, which treats a directory symlink as a leaf. As a result, skill discovery such as */SKILL.md returns nothing when the skills root or an individual skill directory is symlinked.

This change:

  • follows directory symlinks while keeping returned paths under their logical symlink aliases;
  • detects cycles against the current ancestor chain with os.SameFile, so self/ancestor links terminate without suppressing independent aliases to the same target;
  • preserves existing matching behavior for file and broken symlinks;
  • keeps context cancellation and unreadable-directory handling aligned with the previous walker;
  • documents the behavior in the English and Chinese module READMEs.

Tests cover a symlink root, multiple directory aliases, a directory cycle, and file/broken symlinks. The earlier #863 attempt was closed unmerged without review; this implementation is deliberately narrower (no GrepRaw change) and avoids its global visited set, which could drop valid alias paths.

Validation:

  • go test -race . -run '^TestGlobInfo$' -count=1
  • go test ./... -run '^TestGlobInfo$' -count=1
  • go vet ./...
  • incremental golangci-lint (0 issues)
  • Linux/amd64 test-binary cross-compilation

The local Windows account lacks symlink-creation privilege, so real symlink subtests are skipped there; the repository's Linux CI executes them. A full Windows module run was also attempted and reached existing Unix-specific failures in TestLsInfo and TestGrepRaw.

zh(optional):

GlobInfo 增加目录软链接跟随能力,保留软链接逻辑路径,并以当前递归祖先链检测循环;同时保持文件软链接和坏链接原有的匹配语义。

(Optional) Which issue(s) this PR fixes:

Fixes #746

(optional) The PR that updates user documentation:

The module-level English and Chinese READMEs are updated in this PR.

@March-77
March-77 marked this pull request as ready for review July 23, 2026 03:36
@March-77

Copy link
Copy Markdown
Author

Revalidated on 2026-08-23 against current main (6752ff8):

  • GitHub reports MERGEABLE. BLOCKED is solely the repository rule requiring one approving review; all five checks, including CLA, pass.
  • A test merge of current main is clean (the branch is 12 main commits behind), and no merged main change covers github.com/cloudwego/eino-ext/adk/backend/local.Local 不支持软链接目录 #746. There is an overlapping but still-open fix(local): follow symlink dirs in glob when requested #867; its key product difference is opt-in FollowSymlinkDirsInGlob, whereas this PR follows directory symlinks for GlobInfo by default.
  • Validation after the test merge: go test -race . -run "^TestGlobInfo$" -count=10, go test ./..., and go vet ./....
  • I also ran an uncommitted regression with a symlink to an external directory that links back to the requested root, 20x under race. Traversal terminated and returned only logical relative paths. The ancestor os.SameFile chain also permits independent aliases instead of globally suppressing them.

No code update appears necessary. A maintainer decision on default-vs-opt-in behavior relative to #867, plus an approving review, would unblock this.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

github.com/cloudwego/eino-ext/adk/backend/local.Local 不支持软链接目录

1 participant