[dotnet-port-api] Add tool approval bypass opt-out - #1044
Conversation
Port the public opt-out for approval-not-required tool bypassing from microsoft/agent-framework#6970 by adding a matching toolapproval middleware configuration flag and focused tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
A newly added public-facing doc comment describes narrower semantics than the actual implementation, which could mislead API consumers.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a public toolapproval middleware configuration opt-out to stop automatically bypassing/silently auto-approving tool-approval requests for tools that don’t require approval, plus targeted tests and updated .NET/Go parity documentation.
Changes:
- Added
toolapproval.Config.DisableNonApprovalRequiredToolBypassingand wired it into the auto-approval decision path. - Added a focused
toolapprovaltest ensuring queued non-approval-required requests are surfaced when bypassing is disabled. - Updated the .NET/Go SDK feature comparison to reflect the new Go surface area.
File summaries
| File | Description |
|---|---|
| agent/harness/toolapproval/toolapproval.go | Adds the opt-out config flag and changes auto-approval logic to respect it. |
| agent/harness/toolapproval/toolapproval_test.go | Adds coverage validating queued non-approval-required requests are surfaced when the opt-out is enabled. |
| docs/dotnet-go-sdk-feature-comparison.md | Updates parity documentation to mention/configure the new opt-out. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // DisableNonApprovalRequiredToolBypassing disables the default behavior that | ||
| // auto-approves requests for tools that do not actually require approval when | ||
| // they are surfaced alongside approval-required tools. When true, all such | ||
| // requests are surfaced to the caller instead of being transparently | ||
| // re-injected as approved on the next turn. |
|
Copilot resolve merge conflicts and address PR feedback |
…pi-toolapproval-bypass-optout-20260713-063604-230d44dc9dd8e156 # Conflicts: # agent/harness/toolapproval/toolapproval.go # docs/dotnet-go-sdk-feature-comparison.md Co-authored-by: michelle-clayton-work <262183035+michelle-clayton-work@users.noreply.github.com>
Merged
|
|
Scope: public API, user-visible behavior Changed Go contract: New exported field Upstream evidence reviewed:
Result: aligned. The default (bypass enabled) matches upstream's default, and the new opt-out field mirrors the upstream contract shape (an exported boolean disabling the default bypass), adapted idiomatically to Go's options-struct/middleware pattern rather than .NET's chat-client decorator. The cited upstream commit's unrelated changes (no-session no-op/logging behavior for the .NET decorator, and removal of Ran locally:
|
Summary
Port the public opt-out from microsoft/agent-framework#6970 for bypassing approval requests on tools that do not actually require approval.
This adds
toolapproval.Config.DisableNonApprovalRequiredToolBypassing, wires it into the middleware's auto-approval decision path, adds focused coverage for the opt-out behavior, and updates the .NET/Go feature comparison note to reflect the exposed Go surface.Upstream source commit:
76f2c1a0c974cd4168857dc71520597674650bf8(https://github.com/microsoft/agent-framework/commit/76f2c1a0c974cd4168857dc71520597674650bf8).Ported .NET PRs
Breaking Changes
No.
Tests and Examples
go test ./agent/harness/toolapproval ./agent/harness/toolautocall -count=1toolapprovalcoverage verifying that queued non-approval-required tool requests are surfaced when bypassing is disabled.docs/dotnet-go-sdk-feature-comparison.mdNotes
RequirePerServiceCallChatHistoryPersistence) is a broader chat-client pipeline feature and was intentionally not bundled into this narrow nightly port.Closes #480