ExportXMLWordPrintableJSON

    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Review PR #460 from langchain dev: "fix(deepagents-vfs): strip leading slash in grep/ls/glob so agent paths match".

      Reported problem

      When MongoFilesystemBackend is used as a Deep Agent backend, grep/ls/glob return empty even when the files exist, so the agent reports the corpus is empty. Deep Agents' file tools pass absolute paths (e.g. /mongodb_vfs/journal), but SearchRouter builds a ^<path> regex against source_path, where stored keys are relative (no leading slash) — so the regex never matches.

      Proposed change

      All in SearchRouter (search.py):

      • ls(): path.rstrip("/") -> path.strip("/")
      • _glob(): path.rstrip("/") -> path.strip("/")
      • grep(): path.lstrip("/") before the value is used as a ^<path> regex prefix

      The author notes this matches existing behavior elsewhere: glob() already does pattern.lstrip("/") and the S3 backend's _key() does .lstrip("/").

      Tests

      Adds TestSearchRouterLeadingSlash (unit, mongomock — no Atlas) asserting ls/glob/grep return the same non-empty results for /docs as for docs. Reported 19 passed.

      Task

      Review correctness and test coverage, confirm path normalization is the right fix, and decide on changelog entry and merge.

            Assignee:
            Unassigned
            Reporter:
            Casey Clements
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: