The .NET Microsoft.Agents.AI.GitHub.Copilot provider doesn't honor the Agent Framework approval boundary for custom function tools wrapped in ApprovalRequiredAIFunction. Because the GitHub Copilot SDK owns the tool-calling loop, the standard AF approval round-trip never runs, so the tool can execute without approval.
Direction
Rather than reimplementing enforcement, lean on the Copilot SDK's native OnPreToolUse hook (verified: it gates custom tools, runs before the permission layer, and "ask" routes to OnPermissionRequest):
- The provider installs a default
OnPreToolUse hook only if the user hasn't supplied their own. It returns "ask" for tools wrapped in ApprovalRequiredAIFunction (routed to OnPermissionRequest to approve/deny) and defers (null) for everything else, so other tools surface through OnPermissionRequest as they do today.
- If the user supplies their own
OnPreToolUse, theirs takes precedence and they own approval handling. This is documented, and the provider logs a warning when an approval-required tool would go unenforced.
A follow-up will align the Python provider to the same model.
The .NET
Microsoft.Agents.AI.GitHub.Copilotprovider doesn't honor the Agent Framework approval boundary for custom function tools wrapped inApprovalRequiredAIFunction. Because the GitHub Copilot SDK owns the tool-calling loop, the standard AF approval round-trip never runs, so the tool can execute without approval.Direction
Rather than reimplementing enforcement, lean on the Copilot SDK's native
OnPreToolUsehook (verified: it gates custom tools, runs before the permission layer, and"ask"routes toOnPermissionRequest):OnPreToolUsehook only if the user hasn't supplied their own. It returns"ask"for tools wrapped inApprovalRequiredAIFunction(routed toOnPermissionRequestto approve/deny) and defers (null) for everything else, so other tools surface throughOnPermissionRequestas they do today.OnPreToolUse, theirs takes precedence and they own approval handling. This is documented, and the provider logs a warning when an approval-required tool would go unenforced.A follow-up will align the Python provider to the same model.