[dotnet-code] Consolidate agent host request dispatch internals - #831
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the hosted-agent request dispatch logic in workflow/agentworkflow by consolidating the duplicated “track pending requests, then dispatch newly-tracked ones” loops for tool approval requests and unterminated function calls into a single unexported generic helper, aligning the internal structure more closely with the referenced .NET host options model without changing the public Go API.
Changes:
- Replaced duplicated tracking/dispatch loops with a shared
dispatchTrackedRequestshelper. - Introduced a small internal
requestDispatcher[T]interface to abstract the sharedTrackRequest/DispatchRequestbehavior over both request types.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Parity Review: ✅ ApprovedThis PR consolidates duplicated unexported request-dispatch helpers in Scope: Internal refactor only — out of scope for cross-repo API parity review. No parity issues found. The change keeps Go hosting internals structurally closer to the .NET
|
|
Copilot fix linter failures |
I investigated this lint failure and there are no code lint violations from this PR. The failed |
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.Closes #811