Description
When using GitHub Copilot Chat inside VSCode/JetBrains (on both Windows and Mac) and asking it to cover file abc.py with unit tests
works as expected — the file is clearly read, and good quality unit tests are generated.
However, when using a custom GitHub Copilot extension (e.g., "ext-name") and issuing a similar prompt like @ext-name cover file abc.py with unit tests
, Copilot fails to recognize the open file context and instead generates unrelated or generic responses, even if the file is referenced in the chat.
Console logging shows that the file is correctly passed in the request payload (under copilot_references), including its content and language. This confirms the file is technically available, but the Copilot agent does not seem to process it appropriately when using the custom extension.
To Reproduce:
- Open a Python file (abc.py) in VSCode on Windows or Mac.
- Open GitHub Copilot Chat.
- Prompt:
cover file abc.py with unit tests
→ Copilot correctly understands and generates appropriate output. - Now, using the custom Copilot extension (ext-name), prompt:
ext-name cover file abc.py with unit tests
- See the output — the file context is ignored, and the response is generic or incorrect.
Expected behavior
When using a custom Copilot extension, if the file is opened and/or referenced, the agent should correctly pick up the file content and generate accurate and relevant responses, just like the default Copilot Chat experience.
If I console.log copilot_references payload, we can see, that file content is present:
{
"copilot_thread_id": "...",
"messages": [
{
"role": "user",
"content": "cover abc.py file with unit tests",
"copilot_references": [
{
"type": "client.file",
"data": {
"content": "import datetime\n\nclass TaskManager: ...",
"language": "python"
},
"id": "file:///path/to/abc.py"
}
]
}
],
"agent": "ext-name"
}
This issue may point to a gap in how custom Copilot extensions handle file references or prompt interpretation. Despite the file content being available in the payload, the custom agent is not utilizing it effectively.
Let me know if you'd like a reproduction repo or logs for further debugging.