-
Notifications
You must be signed in to change notification settings - Fork 940
Description
Incorrect Windows Path Handling Prevents Filesystem Operations
Description
On Windows systems, filesystem operations like listing directory contents (ls) fail due to incorrect path handling. When an agent attempts to access an absolute Windows path (e.g., C:\Users\...), the system incorrectly reports the directory as empty.
This is caused by two primary issues:
- Path Validation Error: The middleware incorrectly prepends a leading slash to absolute Windows paths (e.g.,
C:\...becomes/C:/...). - Inconsistent Separators: The filesystem backend returns paths with a mix of forward slashes and backslashes, breaking cross-platform compatibility and causing test failures.
Steps to Reproduce
- Set up the environment on a Windows machine.
- Run the
deepagentsapplication. - Instruct the agent to list the contents of the current working directory (e.g., using the
ls(.)tool).
Expected Behavior
The agent should correctly list the files and directories in the specified Windows path.
Actual Behavior
The agent incorrectly reports that the directory is empty. This happens because the malformed path (e.g., /C:/...) fails to resolve correctly in the filesystem backend.
Root Cause
The _validate_path() function does not properly detect absolute Windows paths and incorrectly modifies them. This leads to path resolution failure in FilesystemBackend._resolve_path(), which returns an empty list.