[PR #975] [MERGED] fix(sdk): grep should perform literal search instead of regex #1027

Closed
opened 2026-02-16 09:17:57 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/975
Author: @eyurtsev
Created: 1/31/2026
Status: Merged
Merged: 2/3/2026
Merged by: @eyurtsev

Base: masterHead: fix-grep-literal-search


📝 Commits (10+)

  • b5b3894 fix: make grep search literal instead of regex
  • 2738964 chore: run make format
  • a744fc7 fix: apply literal search to all backends and improve tool description
  • 1c5622f fix: update middleware tests for literal grep search
  • 0e44ffe Optimize grep literal search and add comprehensive tests
  • b326421 Merge master into fix-grep-literal-search
  • 2bb3f0e Refactor literal search tests to use pytest.mark.parametrize
  • 93dce40 Fix linting issues in test_filesystem_backend.py
  • c1cc276 Remove unnecessary subprocess mocking in filesystem grep tests
  • 8ec3660 x

📊 Changes

15 files changed (+212 additions, -75 deletions)

View changed files

📝 libs/deepagents/deepagents/backends/composite.py (+2 -2)
📝 libs/deepagents/deepagents/backends/filesystem.py (+13 -21)
📝 libs/deepagents/deepagents/backends/utils.py (+6 -9)
📝 libs/deepagents/deepagents/middleware/filesystem.py (+3 -1)
📝 libs/deepagents/tests/unit_tests/backends/test_composite_backend.py (+9 -10)
📝 libs/deepagents/tests/unit_tests/backends/test_composite_backend_async.py (+9 -10)
📝 libs/deepagents/tests/unit_tests/backends/test_filesystem_backend.py (+37 -3)
📝 libs/deepagents/tests/unit_tests/backends/test_filesystem_backend_async.py (+3 -3)
📝 libs/deepagents/tests/unit_tests/backends/test_sandbox_backend.py (+35 -0)
📝 libs/deepagents/tests/unit_tests/backends/test_state_backend.py (+40 -3)
📝 libs/deepagents/tests/unit_tests/backends/test_state_backend_async.py (+3 -3)
📝 libs/deepagents/tests/unit_tests/backends/test_store_backend.py (+37 -0)
📝 libs/deepagents/tests/unit_tests/backends/test_store_backend_async.py (+3 -4)
📝 libs/deepagents/tests/unit_tests/test_middleware.py (+6 -2)
📝 libs/deepagents/tests/unit_tests/test_middleware_async.py (+6 -4)

📄 Description

The grep tool was documented to perform literal text search, but the implementation in some backends treated patterns as regex. This caused errors when searching for common code patterns like def __init__(self): or str | int, which would fail with "unterminated subpattern" errors. The bug affected FilesystemBackend, StateBackend, and StoreBackend (SandboxBackend was already correct).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagents/pull/975 **Author:** [@eyurtsev](https://github.com/eyurtsev) **Created:** 1/31/2026 **Status:** ✅ Merged **Merged:** 2/3/2026 **Merged by:** [@eyurtsev](https://github.com/eyurtsev) **Base:** `master` ← **Head:** `fix-grep-literal-search` --- ### 📝 Commits (10+) - [`b5b3894`](https://github.com/langchain-ai/deepagents/commit/b5b3894ae7556e7f5179318925d7000e7dc54bad) fix: make grep search literal instead of regex - [`2738964`](https://github.com/langchain-ai/deepagents/commit/273896476bf9a91ee21a84ed4171a5124602d467) chore: run make format - [`a744fc7`](https://github.com/langchain-ai/deepagents/commit/a744fc7fbcbb05c8cf54f8be2f423983ef0e875b) fix: apply literal search to all backends and improve tool description - [`1c5622f`](https://github.com/langchain-ai/deepagents/commit/1c5622fefe22732cd1dd0188973a535b40db2791) fix: update middleware tests for literal grep search - [`0e44ffe`](https://github.com/langchain-ai/deepagents/commit/0e44ffe612e140949a784f095c365624b7cf8083) Optimize grep literal search and add comprehensive tests - [`b326421`](https://github.com/langchain-ai/deepagents/commit/b32642185e585b4a4313338f21117c86155be9bd) Merge master into fix-grep-literal-search - [`2bb3f0e`](https://github.com/langchain-ai/deepagents/commit/2bb3f0ea5288ada9041e1d6d43afde65ee3e2c4e) Refactor literal search tests to use pytest.mark.parametrize - [`93dce40`](https://github.com/langchain-ai/deepagents/commit/93dce4099b26af8436894589e5466d5948a7502d) Fix linting issues in test_filesystem_backend.py - [`c1cc276`](https://github.com/langchain-ai/deepagents/commit/c1cc276dfbf267dfba50aefa44329f929440deab) Remove unnecessary subprocess mocking in filesystem grep tests - [`8ec3660`](https://github.com/langchain-ai/deepagents/commit/8ec3660a1e3e6d35925848768176b15c72f7c0df) x ### 📊 Changes **15 files changed** (+212 additions, -75 deletions) <details> <summary>View changed files</summary> 📝 `libs/deepagents/deepagents/backends/composite.py` (+2 -2) 📝 `libs/deepagents/deepagents/backends/filesystem.py` (+13 -21) 📝 `libs/deepagents/deepagents/backends/utils.py` (+6 -9) 📝 `libs/deepagents/deepagents/middleware/filesystem.py` (+3 -1) 📝 `libs/deepagents/tests/unit_tests/backends/test_composite_backend.py` (+9 -10) 📝 `libs/deepagents/tests/unit_tests/backends/test_composite_backend_async.py` (+9 -10) 📝 `libs/deepagents/tests/unit_tests/backends/test_filesystem_backend.py` (+37 -3) 📝 `libs/deepagents/tests/unit_tests/backends/test_filesystem_backend_async.py` (+3 -3) 📝 `libs/deepagents/tests/unit_tests/backends/test_sandbox_backend.py` (+35 -0) 📝 `libs/deepagents/tests/unit_tests/backends/test_state_backend.py` (+40 -3) 📝 `libs/deepagents/tests/unit_tests/backends/test_state_backend_async.py` (+3 -3) 📝 `libs/deepagents/tests/unit_tests/backends/test_store_backend.py` (+37 -0) 📝 `libs/deepagents/tests/unit_tests/backends/test_store_backend_async.py` (+3 -4) 📝 `libs/deepagents/tests/unit_tests/test_middleware.py` (+6 -2) 📝 `libs/deepagents/tests/unit_tests/test_middleware_async.py` (+6 -4) </details> ### 📄 Description The grep tool was documented to perform literal text search, but the implementation in some backends treated patterns as regex. This caused errors when searching for common code patterns like `def __init__(self):` or `str | int`, which would fail with "unterminated subpattern" errors. The bug affected FilesystemBackend, StateBackend, and StoreBackend (SandboxBackend was already correct). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 09:17:57 -05:00
yindo closed this issue 2026-02-16 09:17:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagents#1027