Skip to content

Relative file references in copilot-instructions.md are resolved incorrectly. #249848

Open
@nozaq

Description

@nozaq

Type: Bug

In copilot-instructions.md , relative paths in #file: directives are resolved relative to the workspace root, not to the directory of the instruction file, which is where Copilot Chat actually resolves them.

I've created a PoC repo at https://github.com/nozaq/vscode-file-ref-poc

Steps to Reproduce

  1. Open the PoC repo in Dev Container.
  2. Open .github/copilot-instructions.md in the editor tab.

Expected Result

  • #file:./docs/foo.md is not rendered as a valid file reference.
  • #file:../docs/bar.md is rendered as a valid file reference.

Actual Result

  • #file:./docs/foo.md is rendered as a valid file reference.
  • #file:../docs/bar.md is not rendered as a valid file reference.
Image

Additional Context

The expected result above matches the actual Copilot Chat behavior. When you open the Chat panel and send any prompt, you’ll see that bar.md appears in the references, whereas foo.md does not.

Image

VS Code version: Code 1.100.2 (Universal) (848b80a, 2025-05-14T21:47:40.416Z)
OS version: Darwin arm64 24.5.0
Modes:
Remote OS version: Linux arm64 6.10.14-linuxkit

System Info
Item Value
CPUs Apple M2 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 5, 6, 4
Memory (System) 32.00GB (0.08GB free)
Process Argv
Screen Reader no
VM 0%
Item Value
Remote Dev Container: Debian @ desktop-linux
OS Linux arm64 6.10.14-linuxkit
CPUs unknown (10 x 0)
Memory (System) 15.60GB (6.71GB free)
VM 0%
Extensions (4)
Extension Author (truncated) Version
vscode-graphql-syntax Gra 1.3.8
remote-containers ms- 0.413.0
copilot Git 1.323.0
copilot-chat Git 0.27.2

Metadata

Metadata

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