Skip to content

fix(local): populate IsDir, Size and ModifiedAt in LsInfo results - #958

Open
GerardGao wants to merge 1 commit into
cloudwego:mainfrom
GerardGao:fix/ls-entry-details
Open

fix(local): populate IsDir, Size and ModifiedAt in LsInfo results#958
GerardGao wants to merge 1 commit into
cloudwego:mainfrom
GerardGao:fix/ls-entry-details

Conversation

@GerardGao

Copy link
Copy Markdown

What is the purpose of the change

Fixes cloudwego/eino#1100.

Local.LsInfo filled only FileInfo.Path, so models using the ls tool could not tell files from directories and kept descending into files, and had no size information to avoid reading large/binary files. The in-memory backend already returns IsDir/Size/ModifiedAt; the local backend now fills the same fields.

Brief changelog

  • adk/backend/local: use os.DirEntry.Info() to fill IsDir, Size and ModifiedAt (RFC3339Nano, same format as the in-memory backend) per entry.
  • local_test.go: extend TestLsInfo with field assertions and a symlink subtest; symlink entries report the link itself (lstat semantics, consistent with os.ReadDir), skipped on Windows.

Notes for reviewers:

  • The new entry.Info() error path returns an error, matching the existing behavior of Read when file.Stat() fails.
  • The agentkit backend already returns is_dir; adding size/mtime there could be a follow-up.

Verifying this change

  • The new assertions fail on the previous code (Size 0 vs expected 5, IsDir false for a directory) and pass after the change.
  • go test ./... in adk/backend/local: all 25 tests PASS.
  • go vet ./... and gofmt -l: clean.

@GerardGao
GerardGao force-pushed the fix/ls-entry-details branch from f11e762 to a13c16e Compare August 24, 2026 12:11
@CLAassistant

CLAassistant commented Aug 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Local.LsInfo filled only FileInfo.Path, so models using the ls tool
could not tell files from directories and had no size information to
avoid reading large or binary files. Fill the same fields the
in-memory backend already returns.

Fixes cloudwego/eino#1100
@GerardGao
GerardGao force-pushed the fix/ls-entry-details branch from a13c16e to 84734a3 Compare August 25, 2026 13:34
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.

Ls Tool lack detail infomations of return entries

2 participants