microsoft / microsoft/agent-framework

.NET: [Feature]: Support resumable GitHubCopilotAgent permission requests across turns

Open
#7,735 0 comments 0 reactions 1 assignee View on GitHub

@javiercn is already working on this.

Since Aug 19, 2026.

.NET
Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
2d 45m
Merged PRs (30d)
358

Description

Description

GitHubCopilotAgent exposes unhandled Copilot SDK session events through AIContent.RawRepresentation, including PermissionRequestedEvent. This is sufficient for applications and protocol adapters to define their own mapping.

The remaining provider-level gap is the permission lifecycle. The Copilot SDK callback model waits inside one active session, while an Agent Framework interaction may need to expose the permission request, end the current agent turn, receive a response in a later turn, and then continue the pending Copilot work.

GitHubCopilotAgent currently disposes its CopilotSession when its streaming enumeration ends. A delegating agent can map the raw permission event to ToolApprovalRequestContent or another request representation, but it cannot safely end the turn unless the provider preserves the pending permission and supports resumption.

The Copilot SDK already exposes the required primitives:

  • PermissionRequestedEvent.Data.RequestId;
  • session.Rpc.Permissions.PendingRequestsAsync();
  • session.Rpc.Permissions.HandlePendingPermissionRequestAsync(...);
  • ResumeSessionConfig.ContinuePendingWork.

Expected behavior:

  1. When a permission is requested, GitHubCopilotAgent preserves the Copilot session ID, pending permission request ID, and relevant metadata in the AgentSession.
  2. The current Agent Framework turn can end without losing or denying the pending request.
  3. On a later turn, the agent accepts a response correlated by request ID.
  4. The provider resumes the Copilot session with ContinuePendingWork = true.
  5. The provider calls HandlePendingPermissionRequestAsync(...) with the approved or denied decision.
  6. Tool execution and assistant output continue normally after the decision.
  7. Stale, duplicate, expired, or mismatched responses are rejected, and a permission request can be completed only once.
  8. The raw PermissionRequestedEvent remains available so applications can map it through a delegate or DelegatingAIAgent without introducing transport-specific behavior into the provider.

For tool permissions, applications can map the raw event to existing MEAI approval content:

PermissionRequestedEvent? permission = update.Contents
    .Select(content => content.RawRepresentation)
    .OfType<PermissionRequestedEvent>()
    .FirstOrDefault();

if (permission is not null)
{
    var toolCall = new FunctionCallContent(
        permission.Data.RequestId,
        GetToolName(permission.Data.PermissionRequest),
        GetArguments(permission.Data.PermissionRequest))
    {
        RawRepresentation = permission,
    };

    yield return new AgentResponseUpdate(
        ChatRole.Assistant,
        [new ToolApprovalRequestContent(permission.Data.RequestId, toolCall)
        {
            RawRepresentation = permission,
        }]);

    yield break;
}

The provider owns preserving and resuming the pending Copilot permission; the mapping layer owns how the request is represented to a caller or transport.

Code Sample

See the proposed flow above.

Language/SDK

.NET

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.