[GH-ISSUE #447] Bug: sandbox ls/glob/grep tools don't follow symlinks #259

Closed
opened 2026-06-05 17:21:19 -04:00 by yindo · 0 comments
Owner

Originally created by @ItayCoCo on GitHub (Apr 10, 2026).
Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/447

Description

The BaseSandbox class in libs/deepagents/src/backends/sandbox.ts uses find without the -L flag in three helper functions:

  • buildLsCommandfind ${quotedPath} -maxdepth 1 ...
  • buildFindCommandfind ${quotedPath} ...
  • buildGrepCommandfind ${searchPathQuoted} -type f -name ...

Without -L, find does not dereference symbolic links. This means that when a path is itself a symlink (or contains symlinked directories), find skips the target entirely and returns no results.

Impact

On Modal (and potentially other sandbox providers), volumes are mounted as symlinks. As a result, all three sandbox tools (ls, glob, grep) return empty results when pointed at symlinked paths, making the agent unable to explore or search the filesystem.

Reproduction Steps

  1. Set up a Modal sandbox with a volume mount (e.g., /vol -> symlinked NFS mount)
  2. Use the ls tool to list files in /vol
  3. Observe: returns empty results
  4. Run find -L /vol -maxdepth 1 manually inside the sandbox — returns the expected files

Expected Behavior

ls, glob, and grep tools should follow symlinks and return results from symlinked directories, matching what a user would see with standard ls or find -L.

Actual Behavior

All three tools return empty results for any path that is a symlink.

Proposed Fix

Add the -L flag to all three find invocations in buildLsCommand, buildFindCommand, and buildGrepCommand. The -L flag causes find to follow symbolic links, which is the expected behavior for filesystem exploration tools.

Originally created by @ItayCoCo on GitHub (Apr 10, 2026). Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/447 ## Description The `BaseSandbox` class in `libs/deepagents/src/backends/sandbox.ts` uses `find` without the `-L` flag in three helper functions: - `buildLsCommand` — `find ${quotedPath} -maxdepth 1 ...` - `buildFindCommand` — `find ${quotedPath} ...` - `buildGrepCommand` — `find ${searchPathQuoted} -type f -name ...` Without `-L`, `find` does not dereference symbolic links. This means that when a path is itself a symlink (or contains symlinked directories), `find` skips the target entirely and returns no results. ## Impact On **Modal** (and potentially other sandbox providers), volumes are mounted as symlinks. As a result, all three sandbox tools (`ls`, `glob`, `grep`) return empty results when pointed at symlinked paths, making the agent unable to explore or search the filesystem. ## Reproduction Steps 1. Set up a Modal sandbox with a volume mount (e.g., `/vol` -> symlinked NFS mount) 2. Use the `ls` tool to list files in `/vol` 3. Observe: returns empty results 4. Run `find -L /vol -maxdepth 1` manually inside the sandbox — returns the expected files ## Expected Behavior `ls`, `glob`, and `grep` tools should follow symlinks and return results from symlinked directories, matching what a user would see with standard `ls` or `find -L`. ## Actual Behavior All three tools return empty results for any path that is a symlink. ## Proposed Fix Add the `-L` flag to all three `find` invocations in `buildLsCommand`, `buildFindCommand`, and `buildGrepCommand`. The `-L` flag causes `find` to follow symbolic links, which is the expected behavior for filesystem exploration tools.
yindo closed this issue 2026-06-05 17:21:19 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#259