Skip to content

.copilotignore pattern **/copilot-instructions.md not working in multi-folder workspaces - All repository attachments sent despite ignore rules #288860

@hugodeco

Description

@hugodeco

.copilotignore pattern **/copilot-instructions.md not working in multi-folder workspaces - All repository attachments sent despite ignore rules

Descrição do Problema:
In multi-folder workspaces with 64+ subfolders (each containing a separate Git repository), the .copilotignore file with pattern **/copilot-instructions.md is not preventing VS Code Copilot Chat from automatically sending repository information attachments for all subfolders. This results in excessive token consumption, as each repository's metadata (name, owner, current branch, default branch) is attached to every chat session, even though the ignore pattern should exclude files matching that path.

The issue is specifically that despite having .copilotignore in the root workspace with the pattern **/copilot-instructions.md, VS Code still sends repository information for all 64+ repositories in the workspace, consuming unnecessary tokens. The attachments are not the actual copilot-instructions.md files themselves, but rather the repository metadata that gets attached automatically.

This behavior makes it impossible to work efficiently in large multi-project workspaces, as users are forced to either:

  1. Rename files in subfolders (which breaks functionality when opening subfolders as independent projects)
  2. Remove the workspace and work with single folders only
  3. Accept excessive token waste

Passos para Reproduzir:

  1. Create a VS Code workspace with multiple folders (e.g., 64+ subfolders, each being a separate Git repository).
  2. In the root workspace folder, create a .copilotignore file with the content: **/copilot-instructions.md
  3. Ensure each subfolder contains a file named copilot-instructions.md (following the pattern).
  4. Open VS Code Copilot Chat in the workspace.
  5. Start a new chat session or continue an existing one.
  6. Observe that VS Code automatically attaches repository information for ALL 64+ repositories in the workspace, despite the ignore pattern.
  7. Check the token usage - it will be inflated due to the attachments.

Comportamento Esperado:
The .copilotignore pattern **/copilot-instructions.md should prevent VS Code from sending any attachments related to files matching that pattern, including repository metadata for folders containing such files. Only the root workspace's repository information should be attached if applicable, and no subfolder repository metadata should be sent.

Comportamento Atual:
VS Code ignores the .copilotignore pattern and sends repository information attachments for all 64+ repositories in the multi-folder workspace, leading to excessive token consumption and poor performance.

Ambiente:

  • VS Code Version: 1.108.1
  • VS Code Copilot Chat Extension Version: 0.36.1
  • OS: Windows 11 [or your OS version]
  • Workspace Type: Multi-folder workspace with 64+ Git repositories
  • .copilotignore Content: **/copilot-instructions.md
  • Number of Affected Repositories: 64+ (each with copilot-instructions.md)

Logs ou Evidências Adicionais:

  • Screenshot of the chat showing all repository attachments being sent
  • Screenshot of the .copilotignore file in the root workspace
  • Token usage before/after the issue (showing inflation)
  • Example of repository metadata being attached: "Repository name: sufficit-endpoints, Owner: sufficit, Current branch: master, Default branch: master"

Possíveis Soluções ou Workarounds:

  • Respect the .copilotignore pattern for repository attachments
  • Allow users to disable automatic repository attachments in workspace settings
  • Provide a way to exclude specific folders from repository attachment scanning

Gravidade:
High - Makes multi-project development inefficient and expensive due to token waste.

Labels Sugeridas:
bug, copilotignore, workspace, attachments, token-usage

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions