backend/app/code/context/repo_scanner.py:187-205:
def _should_exclude(self, path: str, is_dir: bool = False) -> bool:
name = os.path.basename(path)
for pattern in self.exclude_patterns:
if is_dir and fnmatch.fnmatch(name, pattern):
return True
if fnmatch.fnmatch(name, pattern):
return True
if fnmatch.fnmatch(path, pattern):
return True
# Check if pattern is in path
if pattern in path:
return True
return False
The last branch — if pattern in path — turns every exclude pattern into a substring search. Combined with the defaults at lines 19-68 (which include "build", "dist", "venv", ".eggs", ".tox", "coverage"), a perfectly legitimate file path like:
app/services/agent_builder.py → excluded because "build" is a substring
app/utils/distance.py → excluded because "dist" is a substring
tests/test_envelope.py → excluded because "venv" is a substring
…is silently skipped during scanning. The ScanResult.skipped_files list (repo_scanner.py:139) gets polluted with these false positives, and downstream context retrieval in app.code.context.retriever operates on an incomplete view of the repo.
Severity: Medium — the fnmatch branches above this line already handle the legitimate cases (*.so, node_modules, *.pyc). The substring check is doing nothing useful and a lot of harm.
Suggested fix: delete the pattern in path branch outright. If you want pattern-against-segment matching, do it via path components:
parts = path.replace("\\", "/").split("/")
for pattern in self.exclude_patterns:
if any(fnmatch.fnmatch(part, pattern) for part in parts):
return True
backend/app/code/context/repo_scanner.py:187-205:The last branch —
if pattern in path— turns every exclude pattern into a substring search. Combined with the defaults at lines 19-68 (which include"build","dist","venv",".eggs",".tox","coverage"), a perfectly legitimate file path like:app/services/agent_builder.py→ excluded because"build"is a substringapp/utils/distance.py→ excluded because"dist"is a substringtests/test_envelope.py→ excluded because"venv"is a substring…is silently skipped during scanning. The
ScanResult.skipped_fileslist (repo_scanner.py:139) gets polluted with these false positives, and downstream context retrieval inapp.code.context.retrieveroperates on an incomplete view of the repo.Severity: Medium — the
fnmatchbranches above this line already handle the legitimate cases (*.so,node_modules,*.pyc). The substring check is doing nothing useful and a lot of harm.Suggested fix: delete the
pattern in pathbranch outright. If you want pattern-against-segment matching, do it via path components: