CompositeBackend.ls/als skip intermediate directories for nested routes
Submission checklist
- This is a bug, not a usage question.
- I added a clear and descriptive title.
- I searched existing issues and didn't find this.
- I can reproduce this with the latest released version.
- I included a minimal reproducible example and steps to reproduce.
Area (Required)
- deepagents (SDK)
- dcode
- talon
- acp
- evals
- daytona
- modal
- quickjs
- runloop
- vercel
- langsmith-sandbox
- Other / not sure / general
Related Issues / PRs
#4925 fixed propagation of root listing errors from the default backend. This report concerns directory discovery for nested route prefixes. #6567 contains this same report but was automatically closed because it was created through the CLI without GitHub form metadata; this submission uses the required web form. I found no open Issue or PR covering the behavior.
Reproduction Steps / Example Code (Python)
from deepagents.backends import CompositeBackend, StoreBackend
from langgraph.store.memory import InMemoryStore
store = InMemoryStore()
backend = CompositeBackend(
default=StoreBackend(store=store, namespace=lambda _: ("default",)),
routes={
"/foo/bar/": StoreBackend(store=store, namespace=lambda _: ("mounted",)),
},
)
backend.write("/foo/bar/a.txt", "data")
for path in ("/", "/foo/", "/foo/bar/"):
result = backend.ls(path)
print(path, result.error, [entry["path"] for entry in result.entries or []])Error Message and Stack Trace (if applicable)
No exception is raised. The returned directory entries are incorrect.Description
On deepagents==0.7.19, CompositeBackend.ls() advertises a route mounted at /foo/bar/ directly in the nonrecursive root listing, but /foo/ has no entry for /foo/bar/. A client traversing the filesystem one directory at a time cannot discover the mounted file, although direct access to /foo/bar/a.txt works. als() follows the same listing logic.
Observed output:
/ None ['/foo/bar/']
/foo/ None []
/foo/bar/ None ['/foo/bar/a.txt']In libs/deepagents/deepagents/backends/composite.py, the root branch inserts each full route prefix as an entry. For a nonroot path that is only a virtual parent, ls() delegates to the default backend and never adds the route's immediate child. The expected listings are / → /foo/, /foo/ → /foo/bar/, and /foo/bar/ → /foo/bar/a.txt. This follows the method's nonrecursive listing contract and the documented nested mount shape (for example, /company/knowledge/ in libs/code/EXTENSIONS.md).
I can provide a focused fix and regression tests if a maintainer agrees this behavior should be corrected and assigns the issue.
Environment / System Info
deepagents==0.7.19(latest release checked on 2026-09-27)- Windows 10.0.22631; Python 3.11.7;
langchain==1.4.2 StoreBackendwithInMemoryStore; no model or network service is needed for the reproduction
Source: langchain-ai/deepagents