Repository navigation
fix(plugin): exclude nested Git metadata from scan inventories - #1099
Merged
mldangelo-oai merged 2 commits intoSep 30, 2026
Merged
mldangelo-oai merged 2 commits into
mldangelo-oai merged 2 commits into
Conversation
The shared file inventory is built with `rg --files --hidden --glob '!.git/**'`. A ripgrep glob that contains a slash is anchored at the search root, so `!.git/**` only prunes the repository's own top-level `.git` directory. Two common layouts slip through: - a vendored or nested checkout keeps its own `.git` directory, and `--hidden` makes ripgrep descend into it, so `vendor/lib/.git/HEAD`, `vendor/lib/.git/config`, and loose object files land in the inventory; - a linked `git worktree` stores its gitdir pointer in a `.git` *file*, which `.git/**` never matches, so `./.git` is listed as a source file. The inventory is the authorized list that scan coverage is reconciled against, so Git internals become paths the scan is expected to review or defer, even though ranking already drops any path with a `.git` component and can never score them. Use `!**/.git` instead. The leading `**/` makes the pattern match a `.git` entry at any depth, ripgrep stops descending once the directory is excluded, and a plain `.git` file is excluded as well. Apply the same glob to the scoped ripgrep call in `generate_rank_input.py` and to the two mirrored oracle commands in the tests so they keep matching the command the scripts actually run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mldangelo-oai
approved these changes
Sep 30, 2026
mldangelo-oai
left a comment
Collaborator
There was a problem hiding this comment.
Thank you for tracking this down. Keeping Git internals out of the inventory makes both the review list and coverage counts more useful. The directory-scope fix and worktree tests cover the tricky cases, and the 142 targeted Python tests, MCP checks, and platform CI are all green. Looks good to merge.
Merged
3 tasks done
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
Repository and directory scan inventories now exclude nested Git metadata and linked-worktree
.gitfiles while retaining the surrounding source files. Metadata no longer inflates the inventory or its coverage count.Changes
.gitentries at any depth in both shared inventory generation and scoped rank-input enumeration..git; ripgrep otherwise bypasses the directory-name exclusion for an explicit search root..gitignore,.github, and ordinary files ending in.gitremain included.Testing
node --test plugins/codex-security/mcp-app/tests/test_artifact_inventory.mjs: passed.pnpm --config.verify-deps-before-run=false --dir sdk/typescript run build:ci: passed using the installed dependencies.git diff --check: passed.Risk and rollout
The change is limited to directory enumeration. Git metadata is removed from nested-repository inventories and coverage counts; source files, ignore behavior, and explicit-file scope behavior are preserved. No public CLI, configuration, or artifact-format changes are required.
Public disclosure review