Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…yields no matches (agentscope-ai#3197) In multi-node deployments (e.g. Redis backing store), a node's local WorkspaceIndex may not yet contain files written by sibling nodes. RemoteFilesystem.grep() already implements the proper fallback paradigm: it only returns early when the index yields matches, otherwise falling through to searchAllItems() on the authoritative store. However, RemoteFilesystem.glob() and ls() returned early as long as index.hasPrefix() was true, even when pattern-filtered results or entry lists were empty, masking files present in the remote store. This fix: 1. Aligns glob() and ls() fast-path to only return early when results/infos are non-empty, falling through to searchAllItems() otherwise. 2. Updates Javadoc in withIndex to document unified fallback semantics and note that non-empty index results are returned directly without store merge. 3. Adds comprehensive unit regression tests in RemoteFilesystemGlobLsTest covering branch fallbacks when index returns non-matching or empty candidates. 4. Adds integration regression test in RemoteFilesystemSpecTest covering real SQLite WorkspaceIndex and composite filesystem routing.
1e82dd1 to
f87db37
Compare
oss-maintainer
left a comment
There was a problem hiding this comment.
LGTM. The fallback fix is narrowly scoped and correct: glob/ls now fall through to the authoritative remote store when the WorkspaceIndex fast path yields zero candidates or zero matches, while non-empty fast-path results keep their existing (no-merge) semantics — aligning both tools with the already-correct grep/exists behavior. Regression coverage is strong: branch-level unit tests plus a parameterized integration test with real SQLite WorkspaceIndex instances across two workspace nodes. Spotless clean, CI green on ubuntu/windows, CLA signed. Welcome, and thanks for the thorough tests!
Automated review by github-manager-bot
AgentScope-Java Version
2.0.4-SNAPSHOT
Description
Fixes #3197.
Background
RemoteFilesystem.glob()andls()return directly from theWorkspaceIndexfast path whenever the index has a matching prefix, evenwhen that fast path yields no matching results.
Because
WorkspaceIndexis best-effort and may be stale or incomplete, anempty index result is not authoritative. In that case, files present in the
remote store can be missed.
RemoteFilesystem.grep()already handles this case by falling through tothe authoritative store scan when the index produces no matches.
Changes
glob()andls()with the existinggrep()fallback semantics:path yields no matches or entries.
withIndexJavadoc to document the fallback semantics.WorkspaceIndexinstancesand
RemoteFilesystemSpecrouting.The
RemoteFilesystemSpecTestcoverage is intentionally a compatibilitytest rather than a reproducer for the empty-result fast path: real workspace
indexes use workspace-relative paths while the composite memory route uses
different path normalization.
Validation
mvn spotless:checkglob()/ls()index fallback.Checklist
mvn spotless:applymvn test)