You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Port the harness-side approval-response binding behavior from .NET PR microsoft/agent-framework#7111 into Go's agent/harness/toolapproval middleware.
This change records surfaced approval requests in session state, rebinds inbound approval responses to the recorded request tool call by default, drops unbound or duplicate responses, and exposes toolapproval.Config.DisableApprovalResponseBinding as the public opt-out. It also adds focused regression coverage for snapshot binding, history-carried requests, duplicate responses, unbound responses, and the opt-out path, and updates the parity note in docs/dotnet-go-sdk-feature-comparison.md.
Yes. Previously, Go forwarded inbound ToolApprovalResponseContent unchanged, including responses whose tool call no longer matched the surfaced request or that were not tied to any surfaced request at all. Now, approval responses are rebound to the surfaced request's tool call by default and unbound/duplicate responses are ignored. This is acceptable in the beta Go SDK because it closes a user-facing approval-flow integrity gap while still providing an explicit compatibility opt-out via toolapproval.Config.DisableApprovalResponseBinding.
Tests and Examples
Ran go test ./agent/harness/toolapproval ./agent/harness/toolautocall
Added focused agent/harness/toolapproval regression tests for surfaced-request snapshot binding, history request binding, unbound response dropping, duplicate response consumption, and DisableApprovalResponseBinding
No examples updated; the user-facing scenario remains the existing tool-approval middleware flow
Notes
This PR ports the harness-side behavior only. The broader .NET chat-client decorator added in #7111 does not have a direct Go equivalent because Go exposes the approval flow through explicit middleware rather than the .NET chat-client pipeline.
Recent upstream approval-related items already tracked by the nightly workflows, such as microsoft/agent-framework#6970 and microsoft/agent-framework#7107, were intentionally skipped to avoid duplication.
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch dotnet-port-api-approval-response-binding-ec06dcb2a240cae7.
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (500 of 670 lines)
From ca8f4c4d75221f7aa380eb2a48e07547f60bd3a7 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 22 Jul 2026 06:24:24 +0000
Subject: [PATCH] [dotnet-port-api] Bind tool approval responses to surfaced
requests
Port .NET approval-response binding from microsoft/agent-framework#7111 into the Go tool approval middleware.
Add surfaced-request tracking and default response rebinding in agent/harness/toolapproval, expose a DisableApprovalResponseBinding opt-out in toolapproval.Config, add focused regression coverage, and update the feature comparison note.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
agent/harness/toolapproval/toolapproval.go | 210 +++++++++---
.../harness/toolapproval/toolapproval_test.go | 307 +++++++++++++++++-
docs/dotnet-go-sdk-feature-comparison.md | 2 +-
3 files changed, 468 insertions(+), 51 deletions(-)
diff --git a/agent/harness/toolapproval/toolapproval.go b/agent/harness/toolapproval/toolapproval.go
index b277204b3..4640a0ec5 100644
--- a/agent/harness/toolapproval/toolapproval.go+++ b/agent/harness/toolapproval/toolapproval.go@@ -18,6 +18,7 @@ import (
"encoding/json"
"fmt"
"iter"
+ "maps"
"slices"
"strings"
@@ -51,21 +52,22 @@ func (r Rule) matches(toolName string, arguments map[string]string) bool {
// state is persisted in the session across turns.
type state struct {
- Rules []Rule `json:"rules,omitempty"`- CollectedApprovalResponses []*message.ToolApprovalResponseContent `json:"collectedResponses,omitempty"`- QueuedApprovalRequests []*message.ToolApprovalRequestContent `json:"queuedRequests,omitempty"`+ Rules []Rule `json:"rules,omitempty"`+ CollectedApprovalResponses []*message.ToolApprovalResponseContent `json:"collectedResponses,omitempty"`+ QueuedApprovalRequests []*message.Tool
... (truncated)
Summary
Port the harness-side approval-response binding behavior from .NET PR
microsoft/agent-framework#7111into Go'sagent/harness/toolapprovalmiddleware.This change records surfaced approval requests in session state, rebinds inbound approval responses to the recorded request tool call by default, drops unbound or duplicate responses, and exposes
toolapproval.Config.DisableApprovalResponseBindingas the public opt-out. It also adds focused regression coverage for snapshot binding, history-carried requests, duplicate responses, unbound responses, and the opt-out path, and updates the parity note indocs/dotnet-go-sdk-feature-comparison.md.Primary upstream commit:
09473fa7edc4142d89d4269fc3f8d4ae35c3bcf3Upstream link: microsoft/agent-framework@09473fa
Ported .NET PRs
Breaking Changes
Yes. Previously, Go forwarded inbound
ToolApprovalResponseContentunchanged, including responses whose tool call no longer matched the surfaced request or that were not tied to any surfaced request at all. Now, approval responses are rebound to the surfaced request's tool call by default and unbound/duplicate responses are ignored. This is acceptable in the beta Go SDK because it closes a user-facing approval-flow integrity gap while still providing an explicit compatibility opt-out viatoolapproval.Config.DisableApprovalResponseBinding.Tests and Examples
go test ./agent/harness/toolapproval ./agent/harness/toolautocallagent/harness/toolapprovalregression tests for surfaced-request snapshot binding, history request binding, unbound response dropping, duplicate response consumption, andDisableApprovalResponseBindingNotes
microsoft/agent-framework#6970andmicrosoft/agent-framework#7107, were intentionally skipped to avoid duplication.Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
dotnet-port-api-approval-response-binding-ec06dcb2a240cae7.Click here to create the pull request
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (500 of 670 lines)