Skip to content

GrepTool runs ripgrep in the process CWD, ignoring the passed working directory #19

Description

@Scratchydisk

GrepTool.call computes the working directory from its kwargs and uses it for the containment check (grep.py:72,87), but the search helper run_rg ignores it and hardcodes the process CWD:

# grep.py:161-162  (inside run_rg)
cwd = Path.cwd().as_posix()
output = subprocess.run(command, cwd=cwd, capture_output=True, text=True)

So if the process CWD differs from the work_dir passed to the tool, the containment check validates against one directory while ripgrep actually searches another. run_rg accepts **kwargs but never reads cwd from them.

Suggested fix: have run_rg use the cwd passed by GrepTool.call (kwargs.get("cwd")) instead of recomputing Path.cwd().

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions