Skip to content

[dotnet-code] Consolidate A2A response update creation#390

Merged
gdams merged 2 commits into
mainfrom
dotnet-code-a2a-response-update-helper-6794454b255b38d9
Jun 30, 2026
Merged

[dotnet-code] Consolidate A2A response update creation#390
gdams merged 2 commits into
mainfrom
dotnet-code-a2a-response-update-helper-6794454b255b38d9

Conversation

@michelle-clayton-work

Copy link
Copy Markdown
Contributor

This pull request refactors the construction of ResponseUpdate objects in the agent/provider/a2aagent/a2a.go file to reduce code duplication and improve maintainability. The main change is the introduction of a helper function, newResponseUpdate, which centralizes the logic for creating ResponseUpdate instances.

Refactoring for code reuse and maintainability:

  • Introduced the newResponseUpdate helper function to encapsulate the construction of agent.ResponseUpdate objects, reducing repeated code blocks throughout the file.
  • Updated all relevant locations in the sendMsg and yieldTask functions to use newResponseUpdate instead of manually constructing ResponseUpdate structs. [1] [2] [3] [4]

Minor behavioral change:

  • Ensured that the ContinuationToken is set explicitly after creating a ResponseUpdate in yieldTask, preserving previous behavior while using the new helper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 29, 2026 21:42
@michelle-clayton-work
michelle-clayton-work requested a review from a team as a code owner June 29, 2026 21:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 common agent.ResponseUpdate field population.
  • Updated sendMsg event handling branches to use newResponseUpdate instead of repeated struct literals.
  • Updated yieldTask to use newResponseUpdate while still explicitly applying ContinuationToken to preserve prior behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown
Contributor

Cross-Repo Parity Review — No Issues Found

This PR only modifies the unexported newResponseUpdate helper in agent/provider/a2aagent/a2a.go. No exported types, method signatures, option structs, or observable runtime behavior are changed. The refactoring consolidates identical agent.ResponseUpdate struct literals across four call sites while preserving all field values (including the explicit ContinuationToken assignment in yieldTask).

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.

Generated by Go API Consistency Review Agent for #390 · 45.7 AIC · ⌖ 12.6 AIC · ⊞ 28.7K ·

@michelle-clayton-work
michelle-clayton-work requested review from qmuntal and removed request for qmuntal June 29, 2026 21:57
@gdams
gdams added this pull request to the merge queue Jun 30, 2026
@gdams gdams linked an issue Jun 30, 2026 that may be closed by this pull request
Merged via the queue into main with commit 9f60290 Jun 30, 2026
18 checks passed
@gdams
gdams deleted the dotnet-code-a2a-response-update-helper-6794454b255b38d9 branch June 30, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dotnet-code] Consolidate A2A response update creation

3 participants