fix(sandbox): GNU grep fallback when ripgrep is unavailable#3571
Open
guitavano wants to merge 1 commit into
Open
fix(sandbox): GNU grep fallback when ripgrep is unavailable#3571guitavano wants to merge 1 commit into
guitavano wants to merge 1 commit into
Conversation
When ripgrep is unavailable (e.g. user-desktop dev on macOS), fall back to GNU grep with brace glob expansion and friendlier regex errors. Normalize paths to repo-relative and count real matches when context lines are included. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
Release OptionsSuggested: Patch ( React with an emoji to override the release type:
Current version:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
greptool whenrgis not on PATH (common inuser-desktopdev), while keeping ripgrep as the preferred backend in Docker/K8s sandboxes.matchCountwhencontextis set, and friendly 400 errors for invalid regex.{ts,tsx}) and line-start patterns for the GNU grep path.Test plan
bun test packages/sandbox/daemon/routes/grep-search.test.tsbun test packages/sandbox/daemon/routes/fs.test.tsMade with Cursor
Summary by cubic
Adds a GNU grep fallback for the sandbox search tool when
rgisn’t available, while keeping ripgrep preferred. Normalizes output across backends with repo-relative paths and accurate match counts.Bug Fixes
rgis missing; supports brace globs and line-start patterns.matchCountexcludes context lines.Refactors
packages/sandbox/daemon/routes/grep-search.ts;fs.tsre-exportsmakeGrepHandler.Written for commit 956f438. Summary will update on new commits.