feat: Auto-approve reads of Copilot customization files#331
Merged
Conversation
Reading a Copilot customization file (skill, instruction, prompt, or agent) is normal agent operation, but these reads previously triggered a confirmation dialog — including workspace instructions caught by the default deny rule and user-global files outside the workspace. Recognize these reads precisely from the language server, which is the source of truth for where the files live (including user-configured and global locations). New copilot/customSkill|customPrompt|customInstruction| customAgent/list requests report each file's on-disk URI; a read is auto-approved when it exactly matches a reported file or sits inside a reported skill folder (covering SKILL.md and its helper files). Editing is never auto-approved — only reads. - Add CustomizationFileService, refreshed per type on the matching custom*/didChange notification, exposing an immutable path snapshot. - Hook FileOperationConfirmationHandler to auto-approve FILE_READ of a recognized customization file before the outside-workspace check. - Add FileUtils.isPathWithin for skill-folder containment. Tests: FileUtilsTests (isPathWithin), FileOperationConfirmationHandlerTests (isCustomizationRead), and TC-010/TC-011 in the auto-approve test plan.
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds language-server–backed tracking of Copilot customization file locations (skills/prompts/instructions/agents) and uses it to auto-approve read-only file operations for those files.
Changes:
- Introduces
ICustomizationFileService+CustomizationFileServiceand wires it intoChatServiceManager. - Extends the LSP protocol/client/connection to list customization items and refresh snapshots on
copilot/custom*/didChange. - Updates file-operation confirmation logic to auto-approve reads of recognized customization files, with new unit tests and SWTBot test-plan coverage.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ChatServiceManager.java | Instantiates and exposes CustomizationFileService from the UI chat service manager. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/FileOperationConfirmationHandler.java | Auto-approves file-read operations when the path matches language-server-reported customization files/folders. |
| com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/FileOperationConfirmationHandlerTests.java | Adds unit tests for customization read detection logic. |
| com.microsoft.copilot.eclipse.swtbot.test/test-plans/file-operation-auto-approve/file-operation-auto-approve.md | Documents manual test cases for customization file read auto-approval behavior. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/utils/FileUtils.java | Adds isPathWithin helper for path containment checks. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/WorkspaceFoldersParams.java | Adds params record used by new “custom* list” LSP requests. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CustomizationFileInfo.java | Adds protocol record representing customization file metadata returned from the language server. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageServerConnection.java | Adds connection helpers to call new “custom* list” language-server methods. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageServer.java | Adds new JSON-RPC requests for listing custom skills/prompts/instructions/agents. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageClient.java | Refreshes customization snapshots when the server sends “custom* didChange” notifications. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/service/ICustomizationFileService.java | Defines the customization file service API used by UI confirmation logic. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/service/IChatServiceManager.java | Exposes getCustomizationFileService() on the chat service manager interface. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/service/CustomizationFileService.java | Implements snapshotting/refresh of customization files using language-server list requests. |
| com.microsoft.copilot.eclipse.core.test/src/com/microsoft/copilot/eclipse/core/utils/FileUtilsTests.java | Adds tests for FileUtils.isPathWithin. |
jdneo
reviewed
Jul 1, 2026
jdneo
reviewed
Jul 2, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Auto-approve reads of Copilot customization files
Problem
Reading a Copilot customization file (skill, instruction, prompt, or agent) is normal agent operation, but these reads always prompted for confirmation when "Auto approve file operations not covered by rules" was unchecked:
.github/instructions/*are matched by the default deny rule, so their reads prompt.~/.copilot,~/.claude,~/.agents) are outside the workspace, so they always prompt.SKILL.mdplus the helper files it references) had no special handling.Solution
Recognize these reads precisely from the language server, which is the source of truth for where the files live (including user-configured and global locations) — instead of guessing conventional paths.
New
copilot/customSkill|customPrompt|customInstruction|customAgent/listrequests report each file's on-disk URI. A read is auto-approved when it exactly matches a reported file or sits inside a reported skill folder. Editing is never auto-approved — only reads.Changes
CustomizationFileService(core): keeps an immutable snapshot of customization-file paths per type, refreshed on the matchingcopilot/custom*/didChangenotification. Exposed viaIChatServiceManager.@JsonRequestlist methods onCopilotLanguageServer+ connection wrappers, returningCustomizationFileInfo(carries the fileuri).FileOperationConfirmationHandler: auto-approves aFILE_READof a recognized customization file, before the outside-workspace check.FileUtils.isPathWithin: path-containment helper for skill-folder matching.Testing
FileUtilsTests—isPathWithin(self / strict / nested / sibling / null).FileOperationConfirmationHandlerTests—isCustomizationRead(exact match, skill folder + helpers, negatives).file-operation-auto-approve.md— TC-010 (workspace + edit-still-prompts) and TC-011 (user-global)../mvnw verifygreen across all modules.fix #318