-
Notifications
You must be signed in to change notification settings - Fork 652
Description
Describe the bug
When attaching a file in interactive mode with @path\to\file notation, the contents of the file do not get attached, copilot just gets the file name and line count. This is a bug because the VS Code extension sends the entire file, and if I explicitly attach a file, the correct behavior is to include that attachment's content, not just the name and line numbers.
When attaching a file in the CLI in prompt mode with -p (--prompt), nothing gets attached, not even the file path and line numbers like interactive mode does.
Affected version
0.0.367
Steps to reproduce the behavior
Try to attach a file in the copilot CLI using @path\to\file syntax and ask copilot a question about that file. Specify that it cannot call any additional tools to read the file, only answer questions based on what was attached. It will say it only received a path to the file and line numbers
In prompt mode (--prompt), to attach a file in the prompt using the same syntax. Tell copilot not to read any additional info, and see if it even knows the number of lines of the file without calling a tool (it wont know anything about the file other than the name)
Here's an example output in interactive mode:
> Can you tell me the contents of @search_by_query_api.py without calling any file read tools. I want to see what context you get sent by
default.
● I can see that search_by_query_api.py has been tagged in this conversation, and I can tell you that it's 95 lines long and located at
C:\dev\Misc\azure-test-view\search_by_query_api.py.
However, I don't receive the actual file contents by default - I only get metadata about tagged files (path and line count). To see the
actual code, I would need to use the view tool to read it, but you've asked me not to do that.
The only content I automatically receive is what's shown in the environment context (directory listings, git info, etc.) but not the
contents of individual files unless explicitly viewed.
and here's an example output in prompt mode:
C:\dev\Misc\azure-test-view [main ↑1]> copilot --prompt "Can you tell me the contents of @search_by_query_api.py without calling any file read tools. I want to see what context you get sent by default. Do you know the line count by default?"
Based on the environment context I receive, I can see that `search_by_query_api.py` exists in the current working directory (C:\dev\Misc\azure-test-view), but I do **not** receive its contents or line count by default.
The environment context only provides:
- Current working directory path
- Git repository root
- Operating system
- A directory listing showing the file exists
I don't have access to file contents, line counts, or any internal details about the files unless I use tools like `view` to read them. The directory snapshot is just a list of file/folder names at the top level, nothing more.
So to answer your question directly: **No, I don't know the contents or line count by default** - I only know the file exists in your directory.
Expected behavior
Just like the copilot VS Code extension, I expect any file attachments to actually be attached, not just metadata. I also expect file attachments to work regardless of interactive mode or prompt mode.
Additional context
Running on windows 11 in powershell.