Skip to content

Scope content exclusion path rules to their repository - #339415

Merged
Logan Ramos (lramos15) merged 2 commits into
microsoft:mainfrom
sw23:sw23/content-exclusion-repo-scoping
Oct 14, 2026
Merged

Logan Ramos (lramos15) merged 2 commits into
microsoft:mainfrom
sw23:sw23/content-exclusion-repo-scoping

Conversation

@sw23

@sw23 Spencer Williams (sw23) commented Oct 2, 2026 •

Copy link
Copy Markdown

Path globs from every cached repository were flattened into a single list, so a nested repo with paths: ["*"] caused Copilot to exclude every file in a multi-repo workspace.

  • Store compiled globs per repository fetch URL and only test a file against globs from its own repositories plus org-wide (non-git) rules.
  • asMinimatchPatterns now returns only org-wide patterns; repo-scoped rules are enforced per result.
  • SearchServiceImpl.findFiles searches with the requested limit first and only re-searches unbounded when a full page lost results to filtering.

Fixes #338368

I performed a before/after test and confirm this fix works

Path globs from every cached repository were flattened into a single
list, so a nested repo with `paths: ["*"]` caused Copilot to exclude
every file in a multi-repo workspace.

- Store compiled globs per repository fetch URL and only test a file
  against globs from its own repositories plus org-wide (non-git) rules.
- `asMinimatchPatterns` now returns only org-wide patterns; repo-scoped
  rules are enforced per result.
- `SearchServiceImpl.findFiles` searches with the requested limit first
  and only re-searches unbounded when a full page lost results to
  filtering.
Copilot AI balanced review requested due to automatic review settings October 2, 2026 23:00

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Case-distinct repositories can bypass exclusions, and search retries retain provider caps while causing excessive filtering work.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)
What changed in this PR

Scopes Copilot content exclusions to their repositories, addressing unrelated files being excluded in multi-repository workspaces.

Changes:

  • Compiles repository-specific rules separately from organization-wide rules.
  • Retries file searches when exclusions consume the requested result limit.
  • Adds regression tests for repository isolation and search limits.
File Description
extensions/​copilot/​src/​platform/​search/​vscode-node/​test/​searchServiceImpl.spec.ts Tests filtered limits and repository isolation.
extensions/​copilot/​src/​platform/​search/​vscode-node/​searchServiceImpl.ts Retries searches to replenish filtered results.
extensions/​copilot/​src/​platform/​ignore/​node/​test/​remoteContentExclusion.spec.ts Tests repository-scoped and organization-wide rules.
extensions/​copilot/​src/​platform/​ignore/​node/​remoteContentExclusion.ts Selects exclusion patterns by repository.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…citly

- Only ignore case when comparing repository roots where the file system
  does, so case-distinct repos on Linux keep their own exclusion rules.
- Widen findFiles retries with explicit limits, since search providers cap
  an unset limit at 20,000, and stop once the caller's quota is met.
@sw23

Copy link
Copy Markdown
Author

Logan Ramos (@lramos15) I reviewed the Copilot PR feedback, applied the fixes, and re-tested the fix locally. Let me know if you have any questions

@lramos15
Logan Ramos (lramos15) merged commit 7340d55 into microsoft:main Oct 14, 2026
35 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 14, 2026
@sw23
Spencer Williams (sw23) deleted the sw23/content-exclusion-repo-scoping branch October 20, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants