This repository was archived by the owner on May 20, 2026. It is now read-only.
Repository navigation
Skip external file confirmation for non-existent files - #3795
Merged
Connor Peet (connor4312) merged 4 commits intoFeb 17, 2026
Merged
Conversation
- Add file existence check in isFileExternalAndNeedsConfirmation() - Non-existent files now return false (not external) to prevent confirmation dialog - Actual tool invocation will fail with proper "file not found" error - Update tests to reflect new behavior Co-authored-by: connor4312 <[email protected]>
- Add comprehensive comment explaining error handling tradeoff - Add test suite with MockFileSystemService to verify existing external files still need confirmation - Tests confirm the fix works correctly for both existing and non-existing files Co-authored-by: connor4312 <[email protected]>
Copilot
AI
changed the title
[WIP] Fix agent tools identifying non-existent files as external
Skip external file confirmation for non-existent files
Feb 17, 2026
Connor Peet (connor4312)
marked this pull request as ready for review
February 17, 2026 17:09
Connor Peet (connor4312)
enabled auto-merge
February 17, 2026 17:10
Connor Peet (connor4312)
approved these changes
Feb 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where agent tools incorrectly prompted for "external file confirmation" when attempting to access non-existent files within the workspace. The root cause was that getWorkspaceFolder() returns undefined for non-existent files, causing them to be misclassified as external files.
Changes:
- Modified
isFileExternalAndNeedsConfirmation()to check file existence before classifying files as external - Updated existing tests to reflect the new behavior for non-existent files
- Added comprehensive test coverage for both existing and non-existent files using MockFileSystemService
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/extension/tools/node/toolUtils.ts | Added file existence check using fileSystemService.stat() with .then(() => true).catch(() => false) pattern before returning true for external files |
| src/extension/tools/node/test/toolUtils.spec.ts | Updated test expectations for non-existent files and added new test suite with MockFileSystemService to verify both existing and non-existent file scenarios |
Garret Wilson (garretwilson)
suggested changes
Feb 17, 2026
roblourens
previously requested changes
Feb 17, 2026
Alexandru Dima (alexdima)
approved these changes
Feb 17, 2026
Connor Peet (connor4312)
deleted the
copilot/fix-agent-tools-external-files
branch
February 17, 2026 21:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent tools prompted "external file" confirmation for non-existent paths (e.g.,
/.loop/001-implement-full-spec/context.md) becausegetWorkspaceFolder()returnsundefinedfor files that don't exist, causing them to be misclassified as external.Changes
isFileExternalAndNeedsConfirmation(): Check file existence before returning truestat()fails, return false (not external)Testing
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.