AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

SandboxIntegrationTests.Test_glob_with_directories Contradicts Documented Glob() Files-Only Contract

The standard sandbox integration test in langchain-tests expects glob() to return directories (with is_dir=True), but the deepagents BackendProtocol.glob() documentation and all implementations (FilesystemBackend and BaseSandbox) explicitly return only regular files. This causes the test to fail for every sandbox backend implementation.

highConfidence 95%LangchainAffected Vdeepagents<=0.7.9Affected Vlangchain-Tests<=1.1.9

Origin Analysis

The test test_glob_with_directories in langchain_tests/integration_tests/sandboxes.py was written against an intended or future contract where glob() includes directories, but the actual deepagents protocol and implementations adopted a files-only contract. The implementation ignores dirnames from os.walk() and filters only files, making directories structurally invisible to glob(). The documentation clearly states 'Only regular files are returned; directories are never matched.', so the test assertion is incorrect.
1. Create a temporary directory with two subdirectories (dir1, dir2) and one file (file.txt). 2. Instantiate FilesystemBackend with virtual_mode=True or any SandboxBackendProtocol implementation. 3. Call glob('*', path=base_dir). 4. Observe that result.matches contains only the file, not the directories. 5. Run the standard SandboxIntegrationTests.test_glob_with_directories, which expects len(result.matches) == 3 (2 dirs + 1 file), leading to AssertionError.

Fixing Code Block

Edge Case Audit

Changing only the test does not alter the runtime behavior, so there is no direct production risk. However, if some downstream users or alternative backends have already adapted their glob() to include directories based on the old test, updating the standard test could cause their custom implementations to fail the new assertion. Before merging, confirm with the deepagents maintainers that the files-only contract is intentional and that no backends rely on the directory-inclusive behavior. Rollback is straightforward: revert to the previous test version. If the decision is to include directories, this fix is insufficient and the implementation must be modified.

Ecosystem Topology