Skip to content

Agent Host: Require confirmation for managed permission asks#327383

Draft
joshspicer wants to merge 2 commits into
microsoft:mainfrom
joshspicer:joshspicer/managed-permission-asks
Draft

Agent Host: Require confirmation for managed permission asks#327383
joshspicer wants to merge 2 commits into
microsoft:mainfrom
joshspicer:joshspicer/managed-permission-asks

Conversation

@joshspicer

@joshspicer joshspicer commented Jul 24, 2026

Copy link
Copy Markdown
Member

Why

Enterprise-managed permission ask rules 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 with managedApprovalRequired.

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

  • forwards managedApprovalRequired through the SDK request projection and host-only pending_confirmation signal
  • bypasses Approve When Safe recommendations and request-local shortcuts inside CopilotAgentSession
  • bypasses Agent Host session/global auto-approval in AgentSideEffects
  • dispatches the normal ChatToolCallReady confirmation options so the connected client renders its approval UI
  • prevents managed approvals from seeding duplicate read/write auto-approval state
  • adds focused coverage at both the SDK callback and Agent Host side-effects layers

The 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-client
  • targeted ESLint on changed files
  • focused copilotAgentSession and agentSideEffects managed-approval tests
  • local linked runtime + SDK + Code OSS manual validation for Shell, Read, and URL managed asks

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 18f1bbc1-6001-43e2-b293-724505087f6a
Copilot AI review requested due to automatic review settings July 24, 2026 20:30

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

Adds managed permission markers so Agent Host can require human confirmation.

Changes:

  • Projects managedApprovalRequired into 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, handleClientToolCallComplete still unconditionally calls respondToPermissionRequest(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
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.

2 participants