Skip to content

fix: keep generated files and project paperwork out of the code index - #133

Draft
PatrickSys wants to merge 7 commits into
masterfrom
feat/250-index-scope
Draft

PatrickSys wants to merge 7 commits into
masterfrom
feat/250-index-scope

Conversation

@PatrickSys

@PatrickSys PatrickSys commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Parked for this release.
The current scanner misses source inside checked-out Git submodules.
Review also found that ignored hidden dependency folders are walked before their files are filtered.
The new submodule test fails, so this change is not ready to merge.
The earlier source-selection and Git-isolation tests pass, but they do not cover this failure.

@PatrickSys PatrickSys changed the title feat: index real source with nested Git ignore rules fix: keep generated files and project paperwork out of the code index Oct 16, 2026
@PatrickSys
PatrickSys changed the base branch from next/2.5.0 to master October 16, 2026 17:14
@PatrickSys
PatrickSys marked this pull request as ready for review October 16, 2026 17:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T18:00:11.087927Z e5e36fd Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR changes which files become searchable across indexed projects.

Restore indexing of source inside initialized submodules before merging.

Findings

  1. P1 Submodule source disappears ▶

Summary

The PR uses Git's tracked and non-ignored file list to select source, adds index-only exclusions, and wires includeExcluded through CLI and MCP indexing.

  • The index follows Git ignores and leaves common repository noise out.
  • Projects can restore chosen excluded source to their index.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Project files] --> B[Normal include patterns]
  B --> C[Built-in and project exclusions]
  C --> D[Git tracked and non-ignored files]
  A --> E[Explicit includeExcluded patterns]
  D --> F[File type, binary, size, and path checks]
  E --> F
  F --> G[Search index]
Loading

Reviews (1) · Last reviewed commit: "fix: isolate Git repository context for ..." · Reviewed by Greptile

Comment thread src/core/indexer.ts
}

return new Promise((resolve, reject) => {
const git = spawn('git', ['ls-files', '-co', '--exclude-standard', '-z'], {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Submodule source disappears

When indexing a repository with initialized submodules, git ls-files -co --exclude-standard lists each submodule directory, not the files inside it. The new membership check then drops those source files even though the existing scan finds them. Previously indexed submodule code disappears from search.

Discover eligible files inside submodules too, while honoring their own ignore rules.

Knowledge Base Used: Codebase indexing

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5e36fd7f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/core/indexer.ts
absolute: true,
ignore: excludePatterns,
ignore: selection.explicit ? [] : excludePatterns,
dot: selection.explicit || gitFiles !== null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prune ignored hidden directories before globbing

In a Git repository containing an ignored hidden dependency tree such as a Python .venv, enabling dot makes every include glob descend through that entire directory before the Git membership check at line 1192 discards its files. A typical virtual environment contains tens of thousands of matching .py files, so default indexing can consume substantial time and memory even though none are eligible; the 10,000-file limit is applied only after this scan. Drive the scan from the Git file set or otherwise prune Git-ignored directories during traversal.

AGENTS.md reference: AGENTS.md:L108-L108

Useful? React with 👍 / 👎.

Comment thread src/core/indexer.ts
}

return new Promise((resolve, reject) => {
const git = spawn('git', ['ls-files', '-co', '--exclude-standard', '-z'], {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve source from checked-out submodules

When the selected root is a superproject with an initialized submodule, this command returns the submodule's gitlink path but not paths such as submodule/src/file.ts; the subsequent glob finds those files and the membership check rejects every one, whereas the previous scanner indexed them. Git documents -c as listing cached index entries and submodule recursion as separate behavior, with recursion unsupported in the combined -o mode used here (git-ls-files documentation), so active submodules need separate discovery if their checked-out source is to remain searchable.

Useful? React with 👍 / 👎.

Comment thread src/cli.ts
Comment on lines +143 to +145
...(projectConfig?.includeExcluded
? { includeExcluded: projectConfig.includeExcluded }
: {})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply CLI excludePatterns before explicit opt-ins

When a project config combines excludePatterns with a narrow includeExcluded override—for example, excluding generated/** while restoring generated/keep.ts—codebase-context reindex forwards only the opt-in. Because the indexer never receives the custom exclusion, the normal scan admits every file under generated/, not just the restored file, unlike MCP indexing and the documented configuration contract. Forward projectConfig.excludePatterns in this CLI configuration as well.

AGENTS.md reference: AGENTS.md:L112-L112

Useful? React with 👍 / 👎.

@PatrickSys
PatrickSys marked this pull request as draft October 16, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant