Resolve model-emitted /<repo>/ paths onto work_dir; locate rg via PATH; Read lists directories#1
Open
dannyg-sys wants to merge 1 commit into
Open
Conversation
…a PATH, Read lists directories
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
Three robustness fixes to the file tools so paths and executables the model emits resolve correctly against the working directory, plus a small
.gitignoreentry.Changes
1. Resolve model-emitted
/<repo>/…paths ontowork_dirNew shared helper
resolve_path(path, cwd)intool.py, now used by Read, Grep, and Glob.The model was trained on SWE-bench instances where repos are mounted at
/<repo-name>/, so it frequently emits absolute-looking paths such as/myrepo/src/x.pythat don't exist on the local filesystem.resolve_pathremaps them ontocwd:cwd;/<repo-name>[/rest]→cwd[/rest](when the first segment matchescwd's basename or the remapped path exists);/src/…style →cwd/src/…when that exists;Grep still enforces its existing "within working directory" guard after resolution, so the sandbox boundary is unchanged.
2. Locate
ripgrepviaPATH(grep.py)_rg_pathwas hard-coded to/usr/bin/rg. It now usesshutil.which("rg")and falls back to/usr/bin/rg, so Grep works on macOS/Homebrew and other layouts wherergisn't in/usr/bin.3.
Readon a directory lists its contents (read.py)Passing a directory path to Read previously errored. It now returns a sorted listing (directories suffixed with
/) instead of failing, making directory paths self-correcting for the model.4.
.gitignoreIgnore the
.fastcontext/working directory.5 files changed, 44 insertions(+), 6 deletions(-).