Add more tools (based on searchfox-py) to the LLM review agent, and make it patch stack aware to a certain extent#6051
Open
padenot wants to merge 2 commits into
Open
Conversation
expand_context now shows the file as it appears after the full patch stack is applied. A new patch_apply module provides reusable primitives: - strip_diff_prefix, find_patched_file, apply_patched_file: diff utilities - fetch_with_revision_fallback: try a specific revision, fall back to tip - get_file_after_stack(patch, path, fetch): applies patch.patch_stack in order on top of whatever base the caller provides via fetch() expand_context calls get_file_after_stack with patch.get_old_file as the fetch function. The Patch base class gains patch_stack (default: [patch_set]) and get_base_revision(); phabricator.py overrides both. Non-linear stacks fall back to the current patch only. expand_context also gains optional start_line / end_line — omitting either returns from the beginning or to the end of the file.
02c806e to
33dbdae
Compare
Expose the searchfox Python API (searchfox-cli) as LangChain tools wired into the code review agent. expand_context switches its fetch function from patch.get_old_file to searchfox at the patch's base revision, using fetch_with_revision_fallback and get_file_after_stack from patch_apply. - expand_context: searchfox at base revision + full patch stack applied - search_text: free-text / regex search with file-type and path filters - get_blame: per-line commit history - get_field_layout: C++ class/struct memory layout - find_definition: look up a function, method, class, or struct - search_identifier: exact identifier search with file-type filters - calls_from / calls_to / calls_between: call graph traversal with depth - check_can_gc: SpiderMonkey GC hazard analysis for C++ functions All tools support langs (list) and tests filters where applicable. No additional tests for the tool wrappers: the tools are thin call-and-format wrappers over searchfox-py, which is tested independently in its own repo. Closes mozilla#5284
33dbdae to
798947f
Compare
Collaborator
Author
|
padenot/searchfox-cli@v0.10.12...v0.13.0 are the changes in |
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.
The two patches can be reviewed independently but are close in location so I'm putting one branch for both.