[dotnet-port-fixes] Bound tool approval auto-approval loop - #835
[dotnet-port-fixes] Bound tool approval auto-approval loop#835Michelle Clayton (michelle-clayton-work) wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Ports the upstream safety fix to the Go tool-approval middleware by bounding the internal auto-approval re-entry loop to prevent runaway “auto-approved tool request” chains, while preserving the public Go API and surfacing a final unsplit inner turn once the cap is reached.
Changes:
- Introduced an internal max-iteration cap (40) for the auto-approval re-entry loop and, upon reaching it, forwards one final unsplit inner-agent turn to surface pending approval requests.
- Added a regression test ensuring auto-approved approval-requests stop at the iteration cap and the final approval request is surfaced.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| agent/harness/toolapproval/toolapproval.go | Adds an internal 40-iteration cap to the auto-approval re-entry loop and forwards one final unsplit inner turn when the cap is hit. |
| agent/harness/toolapproval/toolapproval_test.go | Adds a regression test verifying the capped behavior (40 auto-approved turns + 1 surfaced turn). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
Cross-Repo Parity ReviewPR #835 ports the .NET safety cap on the tool-approval auto-approval re-entry loop (upstream commit
|
Summary
Bound the tool-approval middleware's internal auto-approval re-entry loop to 40 passes and forward one final unsplit inner turn once the cap is hit. This aligns Go with the upstream .NET safety fix for runaway auto-approved tool requests without changing the public Go API.
Upstream commit:
74a144085a5fd05921b473001528f3ae0725b76a(microsoft/agent-framework@74a1440)
Ported .NET PRs
Breaking Changes
No.
Tests and Examples
go test ./agent/harness/toolapprovalTestToolApproval_AutoApprovedRequestsStopAtIterationCapNotes
[dotnet-port-fixes].Closes #812