Repository navigation
Fix autocall implementation parity with MEAI - #1357
Quim Muntal (qmuntal) wants to merge 2 commits into
Conversation
Exclude server-handled calls before creating approval state and preserve serial call order when resuming hidden safe calls alongside approvals. Include explicit do-not-retry guidance in rejection results. Add graceful termination through function invocation middleware, preserving tool outcomes and isolating nested and concurrent calls. Cover approved calls, restored sessions, and provider-managed execution with regression tests, and document the new control. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
API consistency review
Changed Go contract
Upstream evidence reviewed
AssessmentThe PR ports MEAI 10.11.0 behavior.
|
There was a problem hiding this comment.
🟡 Changes recommended
Termination set on a copied invocation after next returns can be lost, allowing remaining serial tools and another provider request to execute.
1 open issue
What changed in this PR
This PR improves automatic tool invocation parity with MEAI 10.11.0 in the agent harness, focusing on approval handling and graceful termination.
Changes:
- Excludes server-completed calls from local execution and approvals, while preserving serial order for hidden safe calls and approved calls.
- Adds per-invocation termination through function middleware and rejects unsupported provider-managed termination.
- Clarifies rejection results and expands documentation and regression coverage.
| File | Description |
|---|---|
internal/toolmiddleware/wrapper.go |
Carries invocation identity and termination control through context. |
docs/agent-harness.md |
Documents buffering, approval ordering, and termination behavior. |
agent/middleware.go |
Adds and propagates middleware termination requests. |
agent/middleware_test.go |
Tests provider-managed termination rejection and error preservation. |
agent/harness/toolautocall/autocall.go |
Updates approval ordering, server-completed call filtering, and termination handling. |
agent/harness/toolautocall/autocall_test.go |
Covers termination across execution modes, nested calls, and repeated runs. |
agent/harness/toolautocall/autocall_log_test.go |
Verifies termination logging. |
agent/harness/toolautocall/autocall_approval_test.go |
Covers approval resumption, restored sessions, ordering, and conversation retention. |
Review effort: Balanced
| defer func() { | ||
| if nextInvocation != invocation && nextInvocation.Terminate { | ||
| invocation.Terminate = true | ||
| } |
|
Copilot fix codereview comments |
Co-authored-by: qmuntal <3747816+qmuntal@users.noreply.github.com>

Summary
Fix automatic tool invocation parity with MEAI 10.11.0:
Includes documentation and regression coverage for streaming, approval resumption, restored sessions, errors, and repeated runs.
Validation