Skip to content

Repository-scoped Copilot content exclusions affect unrelated files in multi-repository workspaces #338368

Closed

Description

AI disclosure: This issue was drafted with AI assistance. A human reproduced the behavior and technically investigated it. This is a real problem observed in our company environment.

Anonymization: Repository names, paths, and remotes below are placeholders. The workspace structure and repository relationship reflect the reproduced setup.

Summary

A Copilot content exclusion configured for a nested repository appears to affect unrelated files in the outer repository when both repositories are present in the same VS Code workspace.

Environment

  • Copilot Chat Extension Version: 0.41
  • VS Code Version: 1.139.1
  • OS Version: Ubuntu 24.04.1
  • Feature (e.g. agent/edit/ask mode): agent
  • Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): model independ
  • Logs: see below

The content exclusion is configured only for the nested repository:

[email protected]:vendors/controller-kit.git:
  - "**/*"

Workspace structure

device-suite/                              [outer Git repository]
├── apps/
│   └── data-service/src/DatabaseControlService.hpp
├── services/
│   └── edge-gateway/src/api/firmware/mod.rs
└── vendors/
    └── controller-kit/                   [separate nested Git repository]

Steps to reproduce

  1. Open device-suite as a VS Code workspace.
  2. Keep the nested vendors/controller-kit repository in the workspace.
  3. Configure the **/* content exclusion for the nested repository only.
  4. Ask Copilot to access a file elsewhere in the outer repository, such as one under apps/ or services/.

Actual behavior

Copilot reports files outside the nested repository as excluded:

[debug] File /workspaces/device-suite/apps/data-service/src/DatabaseControlService.hpp is ignored by content exclusion rule **/*
[debug] File /workspaces/device-suite/services/edge-gateway/src/api/firmware/mod.rs is ignored by content exclusion rule **/*

The behavior persists after reloading the VS Code window.

Expected behavior

The **/* rule should apply only to files within vendors/controller-kit. Files in the outer repository should remain available to Copilot unless they have their own applicable exclusion.

Technical investigation

Inspection of the installed extension bundle suggests that exclusion patterns from loaded repositories may be compiled into a shared matcher without preserving which repository supplied each pattern. This would allow the nested repository’s **/* rule to match files elsewhere in the workspace.

There is no .copilotignore file in the workspace, and Git does not report the affected files as ignored.

Suggested fix

Preserve the repository associated with each content exclusion and evaluate its path patterns only against files within that repository.

Activity

  1. sw23 commented on Oct 2, 2026

    @sw23

    My team is hitting this on VS Code 1.138.0 (Linux x64) and GitHub Copilot Chat 0.66.0.
    We have several multi-root workspaces containing a parent repository and a folder with several nested
    repositories. One nested repository receives paths: ["*"] from an enterprise content-exclusion
    policy. After those rules are fetched, Copilot rejects files in the parent repository and unrelated
    nested repositories. I had one of the AI models review the code:

    Inspecting the 0.66.0 extension bundle points to the same root cause described here. applyRules()
    stores rules per repository in _contentExclusionCache, but rebuildCompiledRules() flattens every
    repository's path globs into one _compiledGlobs list. isIgnored(uri) then tests the file against
    every glob in that list. The content-based ifAnyMatch and ifNoneMatch rules remain scoped to the
    file's repository; only the path globs leak across repositories.

    Removing the folder that contains the excluded nested repository from the workspace and reloading
    restores access. files.exclude and search.exclude do not work around the problem because nested
    repository discovery searches for **/.git/HEAD with ExcludeSettingOptions.None.

  2. added
    bug
    on Oct 14, 2026
  3. added this to the 1.143.0 milestone on Oct 14, 2026
  4. added
    unreleased
    insiders-released
    and removed
    unreleased
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugcontent-exclusionsinsiders-releasedverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions