[dotnet-code] Consolidate A2A response update creation#390
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request refactors the A2A provider (agent/provider/a2aagent/a2a.go) to centralize creation of agent.ResponseUpdate instances behind a small unexported helper, reducing duplication while preserving existing runtime behavior.
Changes:
- Introduced
newResponseUpdate(...)to encapsulate commonagent.ResponseUpdatefield population. - Updated
sendMsgevent handling branches to usenewResponseUpdateinstead of repeated struct literals. - Updated
yieldTaskto usenewResponseUpdatewhile still explicitly applyingContinuationTokento preserve prior behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Cross-Repo Parity Review — No Issues Found This PR only modifies the unexported Because no public Go API surface or user-visible behavior is affected, this change is out of scope for cross-repo parity review. No alignment issues with the upstream .NET or Python implementations were identified.
|
This pull request refactors the construction of
ResponseUpdateobjects in theagent/provider/a2aagent/a2a.gofile to reduce code duplication and improve maintainability. The main change is the introduction of a helper function,newResponseUpdate, which centralizes the logic for creatingResponseUpdateinstances.Refactoring for code reuse and maintainability:
newResponseUpdatehelper function to encapsulate the construction ofagent.ResponseUpdateobjects, reducing repeated code blocks throughout the file.sendMsgandyieldTaskfunctions to usenewResponseUpdateinstead of manually constructingResponseUpdatestructs. [1] [2] [3] [4]Minor behavioral change:
ContinuationTokenis set explicitly after creating aResponseUpdateinyieldTask, preserving previous behavior while using the new helper.