agentscope-ai / agentscope-ai/agentscope-java

[Bug]:glob_files tool description advertises **/*.java pattern but BaseSandboxFilesystem implementation doesn't support it

未關閉
#1,674 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area/core/tool bug
主要語言
Java
星號
5.6k
分支
1.3k
平均合併
4 天 12 小時
30 天內合併 PR
77

描述

The glob_files tool in FilesystemTool.java declares its pattern parameter with the example **/*.java:

@ToolParam(name = "pattern", description = "Glob pattern (e.g., **/*.java)")

However, BaseSandboxFilesystem.glob() translates this directly into find -name:

String cmd = "find " + escapedPath + " -type f -name " + escapedPattern + " 2>/dev/null | sort";

find -name does not support ** — it only matches the filename portion, so **/*.md always returns empty results.

Impact

- LLM follows the tool description, uses **/*.md as instructed
- Tool silently returns empty, model retries with list_files、raw find shell commands
- Causes 3-4 rounds of wasted tool calls and unnecessary context bloat

Steps to Reproduce

1. Create a sandbox-backed agent with files in subdirectories (e.g., knowledge/foo.md)
2. Call glob_files with pattern **/*.md
3. Observe empty results

Suggested Fix

Option A: Strip **/ prefix before passing to find -name:
String findPattern = pattern.startsWith("**/") ? pattern.substring(3) : pattern;

Option B: Update tool description to only advertise find -name compatible patterns (e.g., *.java).

Location

- FilesystemTool.java line 125

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。