Skip to content

Windows: instruction file loaded twice due to \ vs / path-separator mismatch in dedup #4702

Description

@koll051

Describe the bug

On Windows, COPILOT_CUSTOM_INSTRUCTIONS_DIRS is set with backslash-separated paths (Windows default). /env shows the same instruction file listed twice under "Custom Instructions" -- once with backslashes, once with forward slashes:

- <repo-a>\.github\instructions\personal.instructions.md
- <repo-b>/.github/copilot-instructions.md
- <repo-a>/.github/instructions/personal.instructions.md

Entries 1 and 3 point to the exact same file on disk, just discovered via two different code paths that normalize separators differently (one appears to preserve the raw env-var value with \, the other appears to come from a separate discovery mechanism -- e.g. git-root walk -- that normalizes to /). Deduplication apparently compares raw path strings rather than normalized/resolved paths, so the same file''s content is loaded and injected into context twice.

Affected version

GitHub Copilot CLI 1.0.82

Steps to reproduce

  1. On Windows, set COPILOT_CUSTOM_INSTRUCTIONS_DIRS to an absolute backslash path pointing at a directory containing an *.instructions.md file, inside a git repo.
  2. Start a session in that repo (or a subdirectory).
  3. Run /env.
  4. Observe the same file listed twice under "Custom Instructions", once with \, once with /.

Expected behavior

Path deduplication should normalize separators (and ideally resolve to a canonical/absolute path) before comparing, so the same file is only loaded and injected once.

Additional context

Windows 11. Confirmed via /env output; env var itself only contains one (backslash) entry for the affected directory, so the duplicate entry is generated internally by the CLI''s discovery logic, not by the env var configuration.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:context-memoryContext window, memory, compaction, checkpoints, and instruction loadingarea:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminal

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions