Add tree-sitter C/C++ reachability review#199
Open
asotic04 wants to merge 37 commits into
Open
Conversation
stevep-arm
reviewed
May 12, 2026
Comment on lines
+522
to
+527
| parser.add_argument( | ||
| "--reachability-extraction-model", | ||
| type=str, | ||
| default=None, | ||
| help="Deprecated; graph extraction now uses deterministic tree-sitter.", | ||
| ) |
Contributor
There was a problem hiding this comment.
Sounds like this option can be removed as I think it was added and deprecated only in this branch.
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
This PR adds tree-sitter based C/C++ reachability review support to Metis.
The new pipeline builds a C/C++ function/call graph with tree-sitter, then traces source-rooted paths, and uses that graph to drive focused LLM review.
Initially, the idea was to build the graph using LLM, and then continue with the process of scanning paths that included a source. This worked well, but the creation of the graph was expensive in tokens, and it was not as deterministic as the tree-sitter method. Also, when I had the LLM creating graphs, I was also prompting it to take notes on the file, including any potentially vulnerable patterns found there. Later LLM calls, which had sole task of finding security issues, took these notes as ground truth and that resulted in overreporting of issues that the graph creation worker flagged in passing.
Changes
review_code,review_file, andreachability.C/C++ reachability flow
For C/C++ files, Metis now uses tree-sitter to extract functions, callsites, globals, source-like entry points, and sink-like operations. It resolves calls where possible, traces paths through the resulting graph, and runs focused confirmation and supplementary semantic passes over graph-selected code context.
For
review_code, C/C++ reachability runs first. If the repository also contains non-C/C++ files, those continue through the existing plugin review path.For
review_file, C/C++ files use scoped reachability context around the reviewed file, including inbound, outbound, shared, lifecycle, and callback-related context.