Skip to content

Asking copilot to run dotnet build /t:Target results in a prompt for access to directory outside the allowed location #1015

@vitek-karas

Description

@vitek-karas

Describe the bug

When copilot wants to run dotnet build /t:TestTarget command, the Copilot CLI will prompt the user like this:

 ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ Allow directory access                                                                                             │
 │                                                                                                                    │
 │ Copilot is attempting to read the following path outside your allowed directory list.                              │
 │                                                                                                                    │
 │ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
 │ │ /t:TestTarget                                                                                                  │ │
 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
 │                                                                                                                    │
 │ Do you want to add these directories to the allowed list?                                                          │
 │                                                                                                                    │
 │ ❯ 1. Yes                                                                                                           │
 │   2. No (Esc)                                                                                                      │
 │                                                                                                                    │
 │ Confirm with number keys or ↑↓ keys and Enter, Cancel with Esc                                                     │
 ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

This is on Windows where such path is non-sense, but even on Linux such path is basically impossible. It also means that the user can't tell the copilot CLI to allow this execution for future executions, requiring prompt every time.

Affected version

0.0.384 Commit: 0b21260

Steps to reproduce the behavior

I prepared a gist https://gist.github.com/vitek-karas/54ffafdc2f0221a22d250974092b84b6 with a simple repro - just move copilot-instructions.md to the .github directory and then prompt copilot "Test the target".

Expected behavior

This is not a path and CLI should treat it as a normal "dotnet build" invocation.

Additional context

Windows, x64, Windows Terminal, powershell
I can provide logs directly (since they contain PII I won't share them in public) - I'm an FTE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions