[dotnet-port-fixes] Preserve tool approval message ordering - #1012
[dotnet-port-fixes] Preserve tool approval message ordering#1012Quim Muntal (qmuntal) wants to merge 1 commit into
Conversation
Port the approval anchor handling from dotnet/extensions#7617 so reconstructed function calls and results remain adjacent ahead of trailing caller content in both service-managed and client-managed histories.`n`nUpstream: dotnet/extensions#7617
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The ordering fix is well-scoped, preserves existing processing semantics, and is covered by new/updated unit tests for both service-managed and client-managed history cases.
Review tier: Lite
Findings: None
What changed in this PR
This PR ports and applies fixes to the tool-autocall approval workflow so that reconstructed function calls/results are anchored at the original approval location (ahead of trailing caller content), and so that provider/service-managed conversation history is treated differently from client-managed history when deciding what to resend downstream.
Changes:
- Compute an “approval anchor” insertion index and use
slices.Insertto place generated tool result messages before trailing user/caller content. - Distinguish service-managed vs client-managed history (via
WithServiceID/Session.ServiceID) so only client-managed history re-inserts reconstructed assistant function-call messages into downstream history. - Add/adjust tests to cover trailing-message ordering and residual-content cases for both history modes.
| File | Description |
|---|---|
| agent/harness/toolautocall/autocall.go | Computes an approval-anchor insertion point; inserts reconstructed approval artifacts at that anchor; skips resending reconstructed call history when the service manages conversation state. |
| agent/harness/toolautocall/autocall_approval_test.go | Updates helper to run under provider-managed conversation mode by default and adds targeted ordering/regression tests for trailing/residual content scenarios. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Scope: internal-only (unexported helpers in Changed Go contract: None. Upstream evidence reviewed: Result: aligned. The Go port faithfully mirrors the .NET fix: it computes the same "approval anchor" ( Warning Firewall blocked 2 domainsThe following domains were blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "github.com"
- "proxy.golang.org"See Network Configuration for more information.
|
Summary
Upstream
Ports Fix FICC tool_calls/tool ordering with approvals and service-managed chat history (#7617) by westey-m.
Testing
go test ./agent/harness/toolautocall