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
Consolidates the duplicated hosted-agent request tracking and dispatch loops used for tool approval requests and unterminated function calls into one unexported helper. This keeps the Go hosting internals structurally closer to the .NET host option model where request interception is handled through common host behavior, while preserving the existing public Go config shape and dispatch semantics.
.NET Reference
dotnet/src/Microsoft.Agents.AI.Workflows/AIAgentHostOptions.cs - host options describing intercepted user-input requests, intercepted unterminated function calls, forwarded messages, and agent response/update emission.
Public API and Behavior
No public Go API changed. No intentional behavior change was made.
dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/CheckpointManagerImpl.cs / Go checkpoint manager: inspected, but no smaller safe structural improvement was preferable to the hosting cleanup.
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-code/agent-host-request-dispatch-f2801c8f8cc41e6e.
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 (82 of 82 lines)
From 7eeac5113d758c7bce7fe56eaa0b5ae034da2b84 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 7 Aug 2026 00:33:39 +0000
Subject: [PATCH] Consolidate agent host request dispatch internals
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
workflow/agentworkflow/hosting.go | 46 +++++++++++++------------------
1 file changed, 19 insertions(+), 27 deletions(-)
diff --git a/workflow/agentworkflow/hosting.go b/workflow/agentworkflow/hosting.go
index f206b1818..43f7944de 100644
--- a/workflow/agentworkflow/hosting.go+++ b/workflow/agentworkflow/hosting.go@@ -581,44 +581,36 @@ func (h *hostExecutor) dispatchRequests(wctx *workflow.Context, msgs []*message.
}
}
- var approvalDispatches []*message.ToolApprovalRequestContent- var callDispatches []*message.FunctionCallContent- for _, id := range approvalOrder {- approval, ok := approvalRequests[id]- if !ok {- continue- }- delete(approvalRequests, id)- added, err := h.approvalHandler.TrackRequest(wctx, approval)- if err != nil {- return err- }- if added {- approvalDispatches = append(approvalDispatches, approval)- }+ if err := dispatchTrackedRequests(wctx, approvalOrder, approvalRequests, h.approvalHandler); err != nil {+ return err
}
- for _, id := range callOrder {- call, ok := functionCalls[id]+ return dispatchTrackedRequests(wctx, callOrder, functionCalls, h.callHandler)+}++type requestDispatcher[T any] interface {+ TrackRequest(*workflow.Context, T) (bool, error)+ DispatchRequest(*workflow.Context, T) error+}++func dispatchTrackedRequests[T any](wctx *workflow.Context, order []string, requests map[string]T, dispatcher requestDispatcher[T]) error {+ dispatches := make([]T, 0, len(order))+ for _, id := range order {+ request, ok := requests[id]
if !ok {
continue
}
- delete(functionCalls, id)- added, err := h.callHandler.TrackRequest(wctx, call)+ delete(requests, id)
... (truncated)
Summary
Consolidates the duplicated hosted-agent request tracking and dispatch loops used for tool approval requests and unterminated function calls into one unexported helper. This keeps the Go hosting internals structurally closer to the .NET host option model where request interception is handled through common host behavior, while preserving the existing public Go config shape and dispatch semantics.
.NET Reference
dotnet/src/Microsoft.Agents.AI.Workflows/AIAgentHostOptions.cs- host options describing intercepted user-input requests, intercepted unterminated function calls, forwarded messages, and agent response/update emission.Public API and Behavior
No public Go API changed. No intentional behavior change was made.
Tests
go test ./workflow/agentworkflowNotes
Rejected sampled candidates:
dotnet/src/Microsoft.Agents.AI.Workflows/SwitchBuilder.cs/ Go workflow edge dispatch: already covered by open PR [dotnet-code] Consolidate workflow edge connection construction #799.dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FilteringAgentSkillsSourceTests.cs/ Go skills lookup: already covered by open PR [dotnet-code] Consolidate skill member lookup internals #800.dotnet/tests/Microsoft.Agents.AI.UnitTests/Compaction/ChatReducerCompactionStrategyTests.cs/ Go compaction internals: overlapped active compaction cleanup PRs [dotnet-code] Consolidate compaction included group helpers #794, [dotnet-code] Consolidate compaction group inclusion checks #795, and [dotnet-code] Consolidate compaction non-negative normalization #796.dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/CheckpointManagerImpl.cs/ Go checkpoint manager: inspected, but no smaller safe structural improvement was preferable to the hosting cleanup.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-code/agent-host-request-dispatch-f2801c8f8cc41e6e.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 (82 of 82 lines)