feat - support auto approve (#255)#26
Conversation
* feat - LSP data layer + confirmationService skeleton (Auto-approve Part 1 ) (microsoft#132) * feat: Terminal auto-approve with confirmation dialog enhancement (Auto-approve Part 2) (microsoft#171) * revert splitDropdownButton padding change (microsoft#184) * feat: File operation auto-approve with glob pattern rules (Auto-approve Part 3) (microsoft#216) * add file operation approve logic * resolve comments * change default rules color * resolve comments * update test cases * feat: MCP tool auto-approve and global auto-approve (Auto-approve Part 4) (microsoft#218) * add mcp approve support and global approve support * resolve comments * fix test cases * resolve comments and add token/policy check * fix compile error * Fix auto-approve preference page layout instability * fix copilot comments
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end “Tool Auto Approve” support in GitHub Copilot for Eclipse Agent Mode, including preference UI, confirmation dialog UX, auto-approval evaluation/caching, and syncing settings down to the Copilot Language Server (CLS).
Changes:
- Introduces a new Tool Auto Approve preference page with sections for Terminal, File Operations, MCP, and Global (YOLO) auto-approve.
- Implements a centralized confirmation pipeline (
ConfirmationService+ per-tool handlers) and integrates it into the tool-confirmation flow and chat session context. - Extends CLS protocol/settings plumbing to support tool metadata/annotations, default file safety rules retrieval, and auto-approve settings sync; adds tests and SWTBot test plans.
Reviewed changes
Copilot reviewed 62 out of 62 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/PreferencesUtils.java | Registers the new Auto Approve preference page ID. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/swt/SplitDropdownButton.java | Renames/relocates dropdown button implementation and adds separator color customization. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/TerminalAutoApproveSection.java | Adds UI section for terminal rule management and unmatched toggle. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/messages.properties | Adds i18n strings for auto-approve pages/sections. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/Messages.java | Exposes new preference strings via NLS fields. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/McpAutoApproveSection.java | Adds MCP auto-approve UI (trust annotations + server/tool tree). |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/LanguageServerSettingManager.java | Syncs auto-approve settings/rules from preferences into CLS settings. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/GlobalAutoApproveSection.java | Adds Global/YOLO auto-approve UI with confirmation warning dialog. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/FileOperationAutoApproveSection.java | Adds file-operation rule UI including CLS-fetched defaults merging. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/CopilotPreferencesPage.java | Links to the new Tool Auto Approve preference page. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/CopilotPreferenceInitializer.java | Initializes default auto-approve preference values. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/AutoApprovePreferencePage.java | New preference page composing all auto-approve sections. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/AddTerminalRuleDialog.java | Dialog for creating terminal allow/deny rules. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/AddFileOperationRuleDialog.java | Dialog for creating file operation allow/deny rules. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/dialogs/mcp/McpServerItem.java | Migrates MCP install dropdown to SplitDropdownButton. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/McpConfigService.java | Binds MCP observable data into the MCP auto-approve preference section. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/AgentToolService.java | Integrates ConfirmationService into tool confirmation handling and caches decisions. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/messages.properties | Adds confirmation dialog action/title/message strings. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/Messages.java | Exposes new chat confirmation strings via NLS fields. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/InvokeToolConfirmationDialog.java | Reworks confirmation dialog rendering to be driven by ConfirmationContent and split-dropdown actions. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/TerminalConfirmationHandler.java | Implements terminal auto-approve evaluation + session/global persistence. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/McpConfirmationHandler.java | Implements MCP tool/server auto-approve evaluation + trust-annotations support. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/FileOperationConfirmationHandler.java | Implements file operation auto-approve evaluation (rules, workspace/global, session caching, attached-file allow). |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/FallbackConfirmationHandler.java | Adds simple allow-once/skip handler for unsupported tool types. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationService.java | Central dispatcher for confirmation classification, evaluation, and persistence routing. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationHandler.java | Defines handler contract + shared helpers (toolType extraction, session eviction, path normalization). |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/AttachedFileRegistry.java | Tracks user-attached files for immediate file-operation auto-approval (pending + per-conversation). |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ChatView.java | Stages/flushes attached-file paths into the registry across conversation lifecycle. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/BaseTurnWidget.java | Updates tool-confirmation UI invocation to accept ConfirmationContent. |
| com.microsoft.copilot.eclipse.ui/plugin.xml | Registers the new preference page extension. |
| com.microsoft.copilot.eclipse.ui/plugin.properties | Adds preference page display name; minor formatting tweak. |
| com.microsoft.copilot.eclipse.ui/META-INF/MANIFEST.MF | Exports confirmation package for UI tests (x-friends). |
| com.microsoft.copilot.eclipse.ui/css/light.css | Fixes selector path for command panel styling under new widget hierarchy. |
| com.microsoft.copilot.eclipse.ui/css/dark.css | Fixes selector path for command panel styling under new widget hierarchy. |
| com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/preferences/LanguageServerSettingManagerTests.java | Updates expected agent tool settings shape (auto-approve maps). |
| com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/McpConfirmationHandlerTests.java | Adds unit tests for MCP confirmation auto-approve behavior and persistence. |
| com.microsoft.copilot.eclipse.swtbot.test/test-plans/mcp-auto-approve/mcp-auto-approve.md | Adds manual/SWTBot-oriented test plan coverage for MCP auto-approve. |
| com.microsoft.copilot.eclipse.swtbot.test/test-plans/global-auto-approve/global-auto-approve.md | Adds test plan coverage for global/YOLO auto-approve. |
| com.microsoft.copilot.eclipse.swtbot.test/test-plans/file-operation-auto-approve/file-operation-auto-approve.md | Adds test plan coverage for file-operation auto-approve and attached-file behavior. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolMetadata.java | New protocol model for CLS tool metadata (terminal + sensitive file data). |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolAnnotations.java | New protocol model for MCP tool annotations (readOnly/openWorld/etc.). |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/policy/DidChangePolicyParams.java | Adds policy flag for enabling/disabling auto-approval by org policy. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/InvokeClientToolConfirmationParams.java | Adds tool annotations + metadata to confirmation request params. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/GetDefaultFileSafetyRulesResult.java | Adds protocol result type for CLS default file safety rules request. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/FileSafetyRuleInfo.java | Adds protocol model for individual file safety rules. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/DidChangeFeatureFlagsParams.java | Adds feature-flag helper for auto-approval availability via token flag. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotAgentSettings.java | Extends agent settings with unmatched toggles + per-tool auto-approve maps. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageServerConnection.java | Adds CLS request wrapper for getDefaultFileSafetyRules. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageServer.java | Adds JSON-RPC contract for getDefaultFileSafetyRules. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageClient.java | Wires feature flag + policy updates into FeatureFlags for auto-approval gating. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/FeatureFlags.java | Adds combined token+policy gating for auto-approval availability. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/Constants.java | Adds preference keys for all auto-approve settings. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/TerminalAutoApproveRule.java | Adds model type for terminal rules stored in preferences. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/FileOperationAutoApproveRule.java | Adds model type for file-operation rules (pattern/desc/allow + default marker). |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationResult.java | Adds result model for auto-approve evaluation (auto/dismiss/needs confirmation). |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationHandler.java | Adds core-side interface for confirmation evaluation (introduced by this PR). |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationContent.java | Adds UI-agnostic confirmation content model (title/message/actions). |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationActionScope.java | Defines decision persistence scope (once/session/global). |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationAction.java | Defines action model used to drive UI and persistence semantics. |
Comments suppressed due to low confidence (1)
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/swt/SplitDropdownButton.java:110
SplitDropdownButton(Composite parent, int style)ignores the providedstyleand always creates the underlying SWTButtonwithSWT.PUSH. This makes the constructor parameter misleading and prevents callers from applying styles they pass (e.g.,SWT.FLAT). Use thestyleargument when constructing theButton(and/or document/remove the parameter if it must always beSWT.PUSH).
| /** Saves file-operation rules and unmatched-file-operation preference to the store. */ | ||
| public void saveToPreferences(IPreferenceStore store) { | ||
| // Save all rules (defaults + user) to preferences. | ||
| // On next load, defaults are re-identified by pattern matching. | ||
| store.setValue(Constants.AUTO_APPROVE_FILE_OP_RULES, | ||
| new Gson().toJson(allRules)); | ||
| store.setValue(Constants.AUTO_APPROVE_UNMATCHED_FILE_OP, |
| * <p>When the auto-approval feature is disabled by token or organization policy, all | ||
| * auto-approve rules (YOLO, session, global) are bypassed and the user is always prompted | ||
| * with a simple Allow-Once / Skip dialog. | ||
| * |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9289af0250
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| rules.add(new FileOperationAutoApproveRule(globalFp, | ||
| Messages.confirmation_autoApprovedDescription, true)); |
There was a problem hiding this comment.
Make global file allow override earlier deny rules
When a user picks Always allow for a file, this path appends an allow rule to the end of the list. evaluateAutoApprovalEnabled stops at the first matching rule, so an existing broad deny rule (for example default **/.github/instructions/*) continues to win and the file keeps prompting forever. This makes the global allow action ineffective for files already covered by an earlier deny pattern.
Useful? React with 👍 / 👎.
| // Unmatched workspace file: auto-approve | ||
| return ConfirmationResult.AUTO_APPROVED; |
There was a problem hiding this comment.
Stop auto-approving when auto-approval is policy-disabled
In the evaluateAutoApprovalDisabled branch, unmatched workspace files are still auto-approved, so tool calls can execute without any prompt even when token/org policy disables auto-approval. Because this code path is explicitly for the disabled state, returning AUTO_APPROVED here bypasses the expected safety gate and undermines the policy setting.
Useful? React with 👍 / 👎.
feat - LSP data layer + confirmationService skeleton (Auto-approve Part 1 ) (feat - LSP data layer + confirmationService skeleton (Auto-approve Part 1 ) microsoft/copilot-for-eclipse#132)
feat: Terminal auto-approve with confirmation dialog enhancement (Auto-approve Part 2) (feat: Terminal auto-approve with confirmation dialog enhancement (Auto-approve Part 2) microsoft/copilot-for-eclipse#171)
revert splitDropdownButton padding change (fix - revert splitDropdownButton padding change microsoft/copilot-for-eclipse#184)
feat: File operation auto-approve with glob pattern rules (Auto-approve Part 3) (feat: File operation auto-approve with glob pattern rules (Auto-approve Part 3) microsoft/copilot-for-eclipse#216)
add file operation approve logic
resolve comments
change default rules color
resolve comments
update test cases
feat: MCP tool auto-approve and global auto-approve (Auto-approve Part 4) (feat: MCP tool auto-approve and global auto-approve (Auto-approve Part 4) microsoft/copilot-for-eclipse#218)
add mcp approve support and global approve support
resolve comments
fix test cases
resolve comments and add token/policy check
fix compile error
Fix auto-approve preference page layout instability
fix copilot comments