Repository navigation
Description
Issue Description
When the agent attempts to access a file path that doesn't exist (or is invalid) within the workspace, it incorrectly identifies the file as "external" and prompts for confirmation with "is outside of the current workspace." If the user clicks the link in the error dialog, it shows "Unable to open 'common' - The editor could not be opened because the file was not found."
Example
🛠️ read_file (call_GzhPpQEUmEzfVBDyKLpYjgoG) {
"filePath": "/.loop/001-implement-full-spec/context.md"
}
🛠️ read_file (call_mhBGKo7q8Z98OTAPIjOUbp38) {
"filePath": "/.loop/001-implement-full-spec/plan.md"
}
🛠️ list_dir (call_fARd2sMlBt5CUjWTCPOAE2t6) {
"path": "/.loop/001-implement-full-spec/learnings"
}
Root Cause
In vscode-copilot-chat/src/extension/tools/node/toolUtils.ts, isFileExternalAndNeedsConfirmation() checks:
if (workspaceService.getWorkspaceFolder(normalizedUri)) {
return false; // Not external
}
// ... other checks ...
return true; // Treat as externalWhen a file path is invalid or non-existent within the workspace, getWorkspaceFolder() returns undefined, causing the file to be incorrectly flagged as external rather than as an invalid workspace path.
Key Breadcrumbs
- File resolution:
resolveToolInputPath()→promptPathRepresentationService.resolveFilePath() - External check:
isFileExternalAndNeedsConfirmation()at line 181 - Workspace lookup:
workspaceService.getWorkspaceFolder()implementation usesextUriBiasedIgnorePathCase.isEqualOrParent(resource, folder) - Error message: Uses
dirname(uri)as the "folder" in confirmation dialog at readFileTool.tsx:181
Related Issues
Similar path resolution issues in remote/WSL scenarios:
- Copilot Agent file tools fail with WSL path mismatch #289166 (WSL path mismatch)
- Copilot attempts writing files in windows format on linux remote host via ssh #284417 (Windows paths on Linux SSH)
- Agents are limited over SSH #280816 (SSH workspace path rejection)
- Incorrect warning "The model wants to edit files outside of your workspace" (if using symlinks?) #289094 (Symlink false positives)
Expected Behavior
Non-existent or invalid paths within the workspace should be identified as invalid/not found, not as external files requiring confirmation.
Reproduction
Occurs when agent provides a path that:
- Resolves to a valid URI format
- Is logically within the workspace directory structure
- But doesn't exist on disk or has some path normalization issue
Activity
vs-code-engineering commentedon Feb 3, 2026
Hi Harald Kirschner (@digitarald). As a member of the team, you can help us triage this issue by referring to https://github.com/microsoft/vscode-copilot/wiki/Copilot-Inbox-Tracker and assigning an owner directly.
connor4312 commentedon Feb 3, 2026
The model here is just asking for
/.loop/...in your filesystem root, which I assume doesn't exist. We don't do any existence checks to show the prompt. I assume it's trying to use an incorrect absolute path for something that's actually in the workspace. Not sure how these should get handled, maybe we intentionally shouldn't prompt for files that don't exist. What do you think SteVen Batten (@sbatten)?read_fileandlist_dirtrigger "Allow reading external files?" prompt, then fail on GitHub Copilot #293204 as a duplicate of this issuegarretwilson commentedon Feb 6, 2026
I'm puzzled by what existence checks would have to do with the algorithm, unless there is another bug. Whether a path is within a particular workspace is a product of a known algorithm of normalizing and resolving paths and then seeing if they have the same prefix. Whether they exist shouldn't come into play in this algorithm. In fact both the workspace and the requested path could both not exist, yet the algorithm should still work.
For example see my
isSubPath()utility in https://github.com/globalmentor/globalmentor-base/blob/main/core/src/main/java/com/globalmentor/io/Paths.java (which I wrote before LLMs).I spent a long time in #293204 providing a comprehensive matrix of the different scenarios. I recommend creating a test suite based upon those scenarios, run the algorithm, and fix the failing tests. Nothing about that sounds complicated or novel, other than the fact that apparently it hasn't been done yet.
sbatten commentedon Feb 10, 2026
Connor Peet (@connor4312) aha, I believe this issue of the model reading files with incorrect paths is not new and before the model would get self corrected because we'd error behind the scenes. now we are showing a confirmation which is correct but annoying. maybe we should return an error just like when the file doesn't exist in the workspace.
sbatten commentedon Feb 10, 2026
Garret Wilson (@garretwilson) in this issue, the read_file tools are being called with absolute paths which are indeed outside of the workspace so the algorithm is functioning correctly (at least for this particular case)
garretwilson commentedon Feb 11, 2026
SteVen Batten (@sbatten) can you clarify the intended meaning of that sentence?
Did you really mean "… that are indeed outside the workspace"?
I saw "… which are indeed outside the workspace", and at first I interpreted this to mean that you assume any absolute path is outside the workspace. (I was dumbfounded!) But now I think you meant "… that are indeed outside the worksapce", in other words, you don't consider every absolute path outside the workspace, but in this particular case the paths were indeed outside the workspace. I hope that's what you meant.
But if this ticket is about absolute file requests outside the workspace, then why was my ticket #293204 closed which meticulously spells out a bug for absolute paths that are indeed inside the workspace? (In fact my ticket description plainly says: "The file is inside the workspace.") In addition my ticket shows two tools behaving differently for the same input path. If this current ticket is about files outside the workspace, my ticket #293204 is not a duplicate and should be reopened.