Fix: tech detector excludes vendored/build files only when nested, not at path root (#150) - #1019
Open
sojsun17 wants to merge 7 commits into
Open
Fix: tech detector excludes vendored/build files only when nested, not at path root (#150)#1019sojsun17 wants to merge 7 commits into
sojsun17 wants to merge 7 commits into
Conversation
sojsun17
marked this pull request as ready for review
August 10, 2026 00:01
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
Fixes
_should_skip_file()inagent/tools/tech_detector.pyso vendored andbuild-output directories are correctly excluded from language detection
regardless of whether they appear at the root of a file path or nested
deeper. The previous implementation matched skip-directories as raw
substrings requiring a leading slash (e.g.
"/build/" in filepath), whichmissed root-level paths like
"build/bundle.js"or"node_modules/x.js"that have no parent directory — causing repos that are mostly one language
to be misclassified as another based on bundled/vendored files.
Issue
Closes #150
Changes
_should_skip_file()with path-segmentmatching: split each path on
/and check whether any individualsegment exactly matches a skip-directory name (
node_modules,vendor,dist,build,.git,__pycache__,.venv,venv).for nested ones, and avoids false positives on filenames that merely
contain a skip-dir word as a substring (e.g.
src/rebuild/utils.py,vendor_utils.py).node_modules/buildexclusion,filename-substring false-positive check, and an all-vendored-files case
that should resolve to
"Unknown".execute()butnever checked the result (
test_vendor_files_excluded,test_dockerfile_detection,test_github_actions_detection,test_makefile_detection,test_framework_detection).Testing
make test-unit)make test-integration)make lint)make typecheck)Verified the fix directly against the reproduction script from the issue
(
reproduce_issue_150.py) — now returnsprimary_language = Pythonasexpected, instead of
JavaScript.Pre-existing failures: confirmed via branch comparison — main has 53 failing / 375 passing unit tests before this branch; this branch has 51 failing / 381 passing. All remaining 51 failures are in files unrelated to this issue (test_review_service.py, test_pii_scrubber.py, test_bias_detector.py, etc.) and exist identically on main. This PR fixes 2 test failures and adds 6 newly-passing assertions, all within tests/unit/test_tech_detector.py.
Screenshots / Demo
N/A — backend tool logic change, no UI impact.
Notes for Reviewers
While fixing this, I found two separate, pre-existing bugs in
tech_detector.pythat are out of scope for #150 but worth flagging:primary_languageselection is alphabetical (sorted(languages)[0]),not frequency-based — e.g. a repo with 2 Python files and 1 Dockerfile
reports
"Infrastructure"as primary since it sorts before"Python".(
filepath.endswith(ext)without lowercasingfilepathfirst), despitean existing test named
test_case_insensitive_extension_matching.I left both untouched here to keep this PR scoped to #150, but I'm happy
to file a follow-up issue for either/both if that's useful.