fix(ContextSearch): resolve ripgrep when no real rg binary exists#1486
Open
anikinsasha wants to merge 1 commit into
Open
fix(ContextSearch): resolve ripgrep when no real rg binary exists#1486anikinsasha wants to merge 1 commit into
anikinsasha wants to merge 1 commit into
Conversation
Claude Code's shell integration provides rg as a shell function wrapping its embedded ripgrep. Bun.spawn cannot see shell functions, so on machines without a standalone ripgrep install, every rg-backed source (ISA bodies, conversation logs) fails with 'Executable not found in $PATH: rg' and ContextSearch exits 1. Resolve the binary at spawn time: prefer a real rg on PATH (Bun.which), fall back to the Claude Code executable run with argv0=rg — the same mechanism the shell function uses. No behavior change on machines that have ripgrep installed.
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.
Problem
ContextSearch's
ripgrep()helper spawnsrgviaBun.spawn. Claude Code's shell integration providesrgas a shell function wrapping the CLI's embedded ripgrep (ARGV0=rg "$CLAUDE_CODE_EXECPATH"), whichBun.spawncannot see. On machines without a standalone ripgrep install this makes every rg-backed source (ISA bodies, conversation logs) die with:— so the tool exits 1 on every query, silently losing two of its five sources' coverage. Easy to miss because machines with
brew install ripgrepnever hit it.Fix
Resolve the binary at spawn time:
rgon PATH (Bun.which) — used as before; zero behavior change for machines that have ripgrep.CLAUDE_CODE_EXECPATHor~/.local/bin/claude) withargv0: "rg"— the same mechanism the shell function uses to expose the embedded ripgrep."rg"literal, preserving the original error if neither exists.Testing
On a machine with no ripgrep binary (only the shell function): before the patch, every query exits 1 with the error above; after the patch, all five sources return results (verified against live
MEMORY/WORKISAs and conversation JSONLs, ~1s wall time). On a machine with real ripgrep,Bun.which("rg")short-circuits and behavior is byte-identical.