Skip to content

feat: Auto-approve reads of Copilot customization files#331

Merged
jdneo merged 4 commits into
mainfrom
tori/approve
Jul 2, 2026
Merged

feat: Auto-approve reads of Copilot customization files#331
jdneo merged 4 commits into
mainfrom
tori/approve

Conversation

@xinyi-gong

@xinyi-gong xinyi-gong commented Jul 1, 2026

Copy link
Copy Markdown
Member

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:

  • Workspace instruction files under .github/instructions/* are matched by the default deny rule, so their reads prompt.
  • User-global files (~/.copilot, ~/.claude, ~/.agents) are outside the workspace, so they always prompt.
  • Skill folders (SKILL.md plus 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/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. Editing is never auto-approved — only reads.

Changes

  • CustomizationFileService (core): keeps an immutable snapshot of customization-file paths per type, refreshed on the matching copilot/custom*/didChange notification. Exposed via IChatServiceManager.
  • Protocol: 4 @JsonRequest list methods on CopilotLanguageServer + connection wrappers, returning CustomizationFileInfo (carries the file uri).
  • FileOperationConfirmationHandler: auto-approves a FILE_READ of a recognized customization file, before the outside-workspace check.
  • FileUtils.isPathWithin: path-containment helper for skill-folder matching.

Testing

  • FileUtilsTestsisPathWithin (self / strict / nested / sibling / null).
  • FileOperationConfirmationHandlerTestsisCustomizationRead (exact match, skill folder + helpers, negatives).
  • Test plan file-operation-auto-approve.md — TC-010 (workspace + edit-still-prompts) and TC-011 (user-global).

./mvnw verify green across all modules.

fix #318

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + CustomizationFileService and wires it into ChatServiceManager.
  • 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 jdneo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jdneo jdneo merged commit 73e72b7 into main Jul 2, 2026
4 checks passed
@jdneo jdneo deleted the tori/approve branch July 2, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Copilot asks read permission for a global skill file

3 participants