Agent Host: Require confirmation for managed permission asks#327383
Draft
joshspicer wants to merge 2 commits into
Draft
Agent Host: Require confirmation for managed permission asks#327383joshspicer wants to merge 2 commits into
joshspicer wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 18f1bbc1-6001-43e2-b293-724505087f6a
Contributor
There was a problem hiding this comment.
Pull request overview
Adds managed permission markers so Agent Host can require human confirmation.
Changes:
- Projects
managedApprovalRequiredinto permission requests. - Guards local auto-approval paths.
- Adds focused confirmation coverage.
Show a summary per file
| File | Description |
|---|---|
copilotAgentSession.ts |
Guards permission auto-approval paths. |
copilotToolDisplay.ts |
Extends the permission request projection. |
copilotAgentSession.test.ts |
Tests managed approval recommendations. |
Review details
Comments suppressed due to low confidence (1)
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts:2245
- This guards only the client-tool result that was buffered before the permission request. If completion arrives after the managed request has entered
_pendingPermissions,handleClientToolCallCompletestill unconditionally callsrespondToPermissionRequest(toolCallId, true)at line 1269, resolving the managed ask without human input. Preserve whether a pending request is managed and suppress that late-completion auto-approval as well.
if (!managedApprovalRequired && request.kind === 'custom-tool'
&& typeof request.toolName === 'string'
&& this._clientToolNames.has(this._clientToolName(request.toolName))
&& this._pendingClientToolCalls.hasBufferedResult(toolCallId)
) {
this._logService.info(`[Copilot:${this.sessionId}] Auto-approving client tool ${request.toolName} because its result arrived before the permission request`);
return { kind: 'approve-once' };
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Medium
Comment on lines
+2144
to
+2145
| const managedApprovalRequired = request.managedApprovalRequired === true; | ||
| const autoApproval = !managedApprovalRequired && this._lastAppliedPermissionMode === 'auto' |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 18f1bbc1-6001-43e2-b293-724505087f6a
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.
Why
Enterprise-managed permission
askrules require an explicit human response through the client's standard approval UI. Agent Host must not apply its normal auto-approval shortcuts when the Copilot runtime marks a request withmanagedApprovalRequired.Depends on https://github.com/github/copilot-agent-runtime/pull/13312, whose initial managed-selector scope is Shell, Read, Edit, and URL. Tool and MCP selectors are deferred.
Public SDK type: github/copilot-sdk#2080
What
managedApprovalRequiredthrough the SDK request projection and host-onlypending_confirmationsignalCopilotAgentSessionAgentSideEffectsChatToolCallReadyconfirmation options so the connected client renders its approval UIThe client does not evaluate managed rules. The runtime decides the verdict and enforces one-time semantics; VS Code only presents its existing confirmation UI and returns the user's decision.
Validation
npm run typecheck-clientcopilotAgentSessionandagentSideEffectsmanaged-approval tests