You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]:Redis 模式下 glob 和 ls 操作被本地索引误导,无法正确发现 Redis 中实际存储的记忆文件。 #3197
Category: bug | Status: Confirmed (partial) — the glob()/ls() index fast-path flaw is real on current main; the specific Redis memory-search causal chain in the report does not match today's path normalization.
Verified against main @ dc15ff42c by reading the code (agentscope-harness/src/main/java/io/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java, .../workspace/WorkspaceIndex.java):
Confirmed
glob() (RemoteFilesystem.java:442-462) enters the index fast path whenever index.hasPrefix(normalizedPath) is true and then return GlobResult.success(results)unconditionally — including when results is empty after pattern filtering. The authoritative fallback (searchAllItems(), :465-491) is unreachable on that path, exactly as the report describes.
ls() (:153-175) has the same unconditional return LsResult.success(infos) inside the fast path.
grep() is the correct contrast (:343-380): it returns index hits only when !matches.isEmpty() and otherwise falls through to the full remote scan. The comment there even names this reason — on a multi-node deployment this node's index may not know about files written by another node. glob()/ls() never got that guard.
RemoteFilesystem itself does not maintain the index on its write path — uploadFiles() (:495), write() (:261) and edit() (:280) never touch it, while delete() does (index.remove, :587+). WorkspaceManager.writeUtf8WorkspaceRelative compensates with a best-effort index.upsert(...) (WorkspaceManager.java:725-727), but only for its own relative-path writes and only with the size of the uploaded content — no local file backs the entry, and present_local=1 is set anyway. So a locally-built index can drift from the authoritative store.
Not established as described
5. Key shapes do not line up on the default mounting: normalizePath() (:711-720) forces a leading slash (memory → /memory), while WorkspaceIndex stores workspace-relative keys under agents/ and memory/ (WorkspaceIndex.java:64-65,316-330, matched with path LIKE '<prefix>%'). So glob()'s hasPrefix("/memory") does not hit relative keys and the call falls through to the authoritative remote scan. The glob() fast path is effectively unreachable for the standard WorkspaceManager.listMemoryFilePaths() → glob("*.md", "memory") chain (WorkspaceManager.java:939-972), which also unions the filesystem result with a direct local-disk listing.
6. ls() is the reachable variant, because it does not call normalizePath() — it only appends a trailing slash (:153-158). A caller passing a relative dir (e.g. fs.ls(rc, "memory")) does match index keys, and the returned listing is then derived purely from the local index (with entries marked present_local=1 even when written by WorkspaceManager.writeUtf8WorkspaceRelative best-effort upsert), so files that exist only in Redis and were never indexed on this node are omitted. Whether the result is empty (the reported symptom) additionally requires a concurrent index change between hasPrefix() and listByPrefix(), since both use the same predicate.
Impact:ls() on a RemoteFilesystem with an injected index reports a local-index-derived listing and never consults the store, so in a multi-node / Redis deployment a node that did not write a memory file will not list it. glob() carries the same unconditional-return shape (its pattern filter can empty a non-empty candidate set), currently masked by the key-shape mismatch above — which is exactly the kind of thing that breaks when a route is mounted differently or the normalization is touched. Both are silent wrong-result paths rather than data corruption, and the default Redis memory search is not shown to be broken, which is why this is not rated higher. Severity: low-medium. Correctness gap in a shared fast path, trivial fix, no data loss.
Suggested direction (mirror grep()): guard both returns — in glob() return only when !results.isEmpty(), in ls() only when !infos.isEmpty(), otherwise continue into the existing searchAllItems() scan. The two methods do not share a fast-path helper today, so both need the guard.
Needs info:@insStyle please share (a) your RemoteFilesystemSpec / route mounting, (b) the exact pattern + path arguments that return empty, and (c) whether you are on a multi-node deployment where another node wrote the files. With that we can pin the branch you hit. A regression test would also be welcome: index prefix matches + filtered result empty + store contains matching items → glob()/ls() must return the store items (cf. RemoteFilesystemGrepTest.java:44-80, which already covers this shape for grep()).
Community: reply /approve to have an automated fix proposal (spec) posted for this issue, /revise <note> to steer the analysis, or /reject to stop here.
Hi, I wasn’t able to reproduce this bug based on your description. Could you provide reproduction code so we can identify the root cause? Until more complete information is provided, I don’t think we should proceed with the PR related to this bug.
Status: 72 h feedback window expired — no automated PR will be generated, the proposal window here is closed
The evaluation CTA above (5726627511, posted 2026-09-18T07:22:18Z) reached its 72-hour
feedback limit at 2026-09-21T07:22:18Z without an own-line /approve, /revise, or /reject reply, so per our workflow we skip PR generation and no competing PR will be
filed from this proposal window. No action is needed from anyone.
What the thread actually contains: one reply, from gmjneko on 2026-09-19T14:54:16Z, saying
the reproduction did not work and asking the reporter for reproduction code. That reply is
a request for information, not a directive: it has no line starting with a slash command,
so nothing was actionable here.
The fix path stays community-owned. PR #3201 by philo-x
(fix(harness): fall through to remote store in glob and ls when index yields no matches)
is the carrier for this issue. As of this check it is still OPEN and unmerged at head f87db37b23 (mergeable_state=clean, last updated 2026-09-18T14:04:31Z), so the fix ships
through it rather than through a bot-generated duplicate.
Closing this proposal window is not a judgement on the issue. The confirmed part of the
report — glob() at RemoteFilesystem.java:442-462 and ls() at :153-175 returning
index-derived results unconditionally, while grep() at :343-380 has the fall-through
guard — is still a real gap, and #3197 remains open for the community to continue.
If a maintainer would still prefer an independent, bot-generated PR for this fix despite #3201, reply on this issue and we will re-evaluate.
I re-checked the complete path against current main, including WorkspaceManager, CompositeFilesystem, RemoteFilesystemSpec, WorkspaceIndex, and RemoteFilesystem.
The original Redis memory-search causal chain does not appear to hold for the standard RemoteFilesystemSpec configuration: the memory/ route is remapped by CompositeFilesystem to backend path /, while WorkspaceIndex stores workspace-relative keys such as memory/foo.md. As a result, the remote glob() call does not hit the index fast path described in the issue and falls through to the store scan.
There is still an independent RemoteFilesystem.glob() / ls() correctness gap where an empty result from an entered index fast path is returned as authoritative, unlike grep(), but I have closed #3201 because that is not a demonstrated reproduction of the Redis memory-search failure reported here.
Status update: #3875 (merged) makes index prefixes match literally instead of as LIKE patterns — related but a different root cause. The Redis fast path returning no rows and never falling back (this issue and #3201) remains open.
Activity
oss-maintainer commentedon Sep 18, 2026
Issue Evaluation
Category:
bug| Status: Confirmed (partial) — theglob()/ls()index fast-path flaw is real on currentmain; the specific Redis memory-search causal chain in the report does not match today's path normalization.Verified against
main@dc15ff42cby reading the code (agentscope-harness/src/main/java/io/agentscope/harness/agent/filesystem/remote/RemoteFilesystem.java,.../workspace/WorkspaceIndex.java):Confirmed
glob()(RemoteFilesystem.java:442-462) enters the index fast path wheneverindex.hasPrefix(normalizedPath)is true and thenreturn GlobResult.success(results)unconditionally — including whenresultsis empty after pattern filtering. The authoritative fallback (searchAllItems(),:465-491) is unreachable on that path, exactly as the report describes.ls()(:153-175) has the same unconditionalreturn LsResult.success(infos)inside the fast path.grep()is the correct contrast (:343-380): it returns index hits only when!matches.isEmpty()and otherwise falls through to the full remote scan. The comment there even names this reason — on a multi-node deployment this node's index may not know about files written by another node.glob()/ls()never got that guard.RemoteFilesystemitself does not maintain the index on its write path —uploadFiles()(:495),write()(:261) andedit()(:280) never touch it, whiledelete()does (index.remove,:587+).WorkspaceManager.writeUtf8WorkspaceRelativecompensates with a best-effortindex.upsert(...)(WorkspaceManager.java:725-727), but only for its own relative-path writes and only with the size of the uploaded content — no local file backs the entry, andpresent_local=1is set anyway. So a locally-built index can drift from the authoritative store.Not established as described
5. Key shapes do not line up on the default mounting:
normalizePath()(:711-720) forces a leading slash (memory→/memory), whileWorkspaceIndexstores workspace-relative keys underagents/andmemory/(WorkspaceIndex.java:64-65,316-330, matched withpath LIKE '<prefix>%'). Soglob()'shasPrefix("/memory")does not hit relative keys and the call falls through to the authoritative remote scan. Theglob()fast path is effectively unreachable for the standardWorkspaceManager.listMemoryFilePaths()→glob("*.md", "memory")chain (WorkspaceManager.java:939-972), which also unions the filesystem result with a direct local-disk listing.6.
ls()is the reachable variant, because it does not callnormalizePath()— it only appends a trailing slash (:153-158). A caller passing a relative dir (e.g.fs.ls(rc, "memory")) does match index keys, and the returned listing is then derived purely from the local index (with entries markedpresent_local=1even when written byWorkspaceManager.writeUtf8WorkspaceRelativebest-effort upsert), so files that exist only in Redis and were never indexed on this node are omitted. Whether the result is empty (the reported symptom) additionally requires a concurrent index change betweenhasPrefix()andlistByPrefix(), since both use the same predicate.Impact:
ls()on aRemoteFilesystemwith an injected index reports a local-index-derived listing and never consults the store, so in a multi-node / Redis deployment a node that did not write a memory file will not list it.glob()carries the same unconditional-return shape (its pattern filter can empty a non-empty candidate set), currently masked by the key-shape mismatch above — which is exactly the kind of thing that breaks when a route is mounted differently or the normalization is touched. Both are silent wrong-result paths rather than data corruption, and the default Redis memory search is not shown to be broken, which is why this is not rated higher.Severity: low-medium. Correctness gap in a shared fast path, trivial fix, no data loss.
Suggested direction (mirror
grep()): guard both returns — inglob()return only when!results.isEmpty(), inls()only when!infos.isEmpty(), otherwise continue into the existingsearchAllItems()scan. The two methods do not share a fast-path helper today, so both need the guard.Needs info: @insStyle please share (a) your
RemoteFilesystemSpec/ route mounting, (b) the exactpattern+patharguments that return empty, and (c) whether you are on a multi-node deployment where another node wrote the files. With that we can pin the branch you hit. A regression test would also be welcome: index prefix matches + filtered result empty + store contains matching items →glob()/ls()must return the store items (cf.RemoteFilesystemGrepTest.java:44-80, which already covers this shape forgrep()).Community: reply
/approveto have an automated fix proposal (spec) posted for this issue,/revise <note>to steer the analysis, or/rejectto stop here.Automated evaluation by github-manager-bot
fix(harness): fall through to remote store in glob and ls when index …
gmjneko commentedon Sep 19, 2026
Hi, I wasn’t able to reproduce this bug based on your description. Could you provide reproduction code so we can identify the root cause? Until more complete information is provided, I don’t think we should proceed with the PR related to this bug.
oss-maintainer commentedon Sep 21, 2026
Status: 72 h feedback window expired — no automated PR will be generated, the proposal window here is closed
The evaluation CTA above (
5726627511, posted 2026-09-18T07:22:18Z) reached its 72-hourfeedback limit at 2026-09-21T07:22:18Z without an own-line
/approve,/revise, or/rejectreply, so per our workflow we skip PR generation and no competing PR will befiled from this proposal window. No action is needed from anyone.
What the thread actually contains: one reply, from gmjneko on 2026-09-19T14:54:16Z, saying
the reproduction did not work and asking the reporter for reproduction code. That reply is
a request for information, not a directive: it has no line starting with a slash command,
so nothing was actionable here.
The fix path stays community-owned. PR #3201 by philo-x
(fix(harness): fall through to remote store in glob and ls when index yields no matches)
is the carrier for this issue. As of this check it is still
OPENand unmerged at headf87db37b23(mergeable_state=clean, last updated 2026-09-18T14:04:31Z), so the fix shipsthrough it rather than through a bot-generated duplicate.
Closing this proposal window is not a judgement on the issue. The confirmed part of the
report —
glob()atRemoteFilesystem.java:442-462andls()at:153-175returningindex-derived results unconditionally, while
grep()at:343-380has the fall-throughguard — is still a real gap, and #3197 remains open for the community to continue.
If a maintainer would still prefer an independent, bot-generated PR for this fix despite
#3201, reply on this issue and we will re-evaluate.
Automated by github-manager-bot
philo-x commentedon Sep 24, 2026
I re-checked the complete path against current
main, includingWorkspaceManager,CompositeFilesystem,RemoteFilesystemSpec,WorkspaceIndex, andRemoteFilesystem.The original Redis memory-search causal chain does not appear to hold for the standard
RemoteFilesystemSpecconfiguration: thememory/route is remapped byCompositeFilesystemto backend path/, whileWorkspaceIndexstores workspace-relative keys such asmemory/foo.md. As a result, the remoteglob()call does not hit the index fast path described in the issue and falls through to the store scan.There is still an independent
RemoteFilesystem.glob()/ls()correctness gap where an empty result from an entered index fast path is returned as authoritative, unlikegrep(), but I have closed #3201 because that is not a demonstrated reproduction of the Redis memory-search failure reported here.juruoO-o commentedon Nov 12, 2026
Status update: #3875 (merged) makes index prefixes match literally instead of as LIKE patterns — related but a different root cause. The Redis fast path returning no rows and never falling back (this issue and #3201) remains open.
fix(filesystem): fall back to full scan when index path yields no res…
fix(filesystem): make ls/glob/grep store-authoritative