Skip to content

Windows: VS Code agent host loads ~/.copilot/instructions twice (drive-letter case mismatch in dedup) #5022

Description

@emersonfranks

Describe the bug

In a Copilot agent session hosted by VS Code on Windows, every personal instructions file under ~/.copilot/instructions is injected into the session's system message twice. A description-only file (no applyTo) has its whole body inlined twice; a file with applyTo gets two index rows.

The host starts the runtime with COPILOT_HOME=c:\Users\<user>\.copilot, with a lowercase drive letter, while native discovery sees the same directory as C:\Users\<user>\.copilot\instructions. The two locations differ only in drive-letter case, and deduplication appears to treat them as different files.

This looks like the drive-letter-case sibling of #4702, which was the \ vs / separator variant. It still reproduces on a runtime built after that fix.

Affected version

  • VS Code 1.140.0 (agent host)
  • @github/copilot-sdk-win32-x64 1.0.15-preview.4, copilot-runtime.exe 1.0.89-7
  • Windows 11

The standalone CLI (@github/copilot 1.0.40) run against the same directory loads each file once.

Steps to reproduce

  1. Create %USERPROFILE%\.copilot\instructions\probe.instructions.md with front matter name: "Probe" and description: "probe", no applyTo, and a one-line body.
  2. Start a new Copilot agent session from VS Code.
  3. Open ~/.copilot/session-state/<session-id>/events.jsonl, take the first system.message event, and count occurrences of name: "Probe" in its content.
  4. In a shell tool of that session, print COPILOT_HOME.

Observed: the count is 2, and COPILOT_HOME is c:\Users\<user>\.copilot.

Expected behavior

Instruction directories and files are deduplicated by canonical path — case-insensitively on Windows, after normalizing separators — so each file is loaded once.

Additional context

With four description-only personal instruction files, the duplicate costs about 25K characters of system message in every session. Two workarounds were tried and neither helps: a subdirectory of ~/.copilot/instructions is duplicated the same way, and COPILOT_CUSTOM_INSTRUCTIONS_DIRS loads the files as external repository instructions rather than personal ones.

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