[PR #1350] fix(sdk): fix glob matching with ** in _python_search fallback #1327

Open
opened 2026-02-16 09:18:45 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/1350
Author: @dotuananh0712
Created: 2/15/2026
Status: 🔄 Open

Base: mainHead: main


📝 Commits (1)

  • 57ffba2 fix(sdk): fix glob matching with ** in _python_search fallback

📊 Changes

1 file changed (+4 additions, -2 deletions)

View changed files

📝 libs/deepagents/deepagents/backends/filesystem.py (+4 -2)

📄 Description

Summary

Fixed issue #1348 where glob patterns containing ** silently return zero results when ripgrep is unavailable.

Problem

The _python_search fallback method had two bugs:

  1. Used fp.name (filename only) instead of relative path for glob matching
  2. Missing GLOBSTAR flag, so ** wasn't treated as recursive wildcard

Fix

# Before (broken):
if include_glob and not wcglob.globmatch(fp.name, include_glob, flags=wcglob.BRACE):
    continue

# After (fixed):
if include_glob:
    rel_path = str(fp.relative_to(root))
    if not wcglob.globmatch(
        rel_path, include_glob, flags=wcglob.BRACE | wcglob.GLOBSTAR
    ):
        continue

Now matches against relative path and adds GLOBSTAR flag for proper ** matching.

Testing

  • Reproduced the bug with test case from issue
  • Verified fix works with glob patterns like **/*.py

AI assistance used for code review and implementation


🔄 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/1350 **Author:** [@dotuananh0712](https://github.com/dotuananh0712) **Created:** 2/15/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`57ffba2`](https://github.com/langchain-ai/deepagents/commit/57ffba2ccd53fe8a913a1dbf683f0d6742b9deb5) fix(sdk): fix glob matching with ** in _python_search fallback ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `libs/deepagents/deepagents/backends/filesystem.py` (+4 -2) </details> ### 📄 Description ## Summary Fixed issue #1348 where glob patterns containing `**` silently return zero results when ripgrep is unavailable. ## Problem The `_python_search` fallback method had two bugs: 1. Used `fp.name` (filename only) instead of relative path for glob matching 2. Missing `GLOBSTAR` flag, so `**` wasn't treated as recursive wildcard ## Fix ```python # Before (broken): if include_glob and not wcglob.globmatch(fp.name, include_glob, flags=wcglob.BRACE): continue # After (fixed): if include_glob: rel_path = str(fp.relative_to(root)) if not wcglob.globmatch( rel_path, include_glob, flags=wcglob.BRACE | wcglob.GLOBSTAR ): continue ``` Now matches against relative path and adds GLOBSTAR flag for proper `**` matching. ## Testing - Reproduced the bug with test case from issue - Verified fix works with glob patterns like `**/*.py` AI assistance used for code review and implementation --- <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:18:45 -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#1327