Skip to content

[dotnet-port-fixes] Align A2A streaming artifact updates with .NET #892

Description

@github-actions

Summary

Aligned hosted A2A streaming task artifact updates with the upstream .NET fix from commit d29e7be7fd7277f15e37ddda5b6bf154c9ef428b (microsoft/agent-framework#7722). The Go A2A provider now buffers streaming chunks so contiguous updates stay on the same artifact, closes the final chunk correctly, flushes the buffered artifact before failed/background handoff states, and assigns a fresh artifact ID when a message ID reappears later in the stream.

Ported .NET PRs

Breaking Changes

No. The change preserves the existing Go API and only corrects hosted A2A streaming task artifact behavior to match the upstream contract.

Tests and Examples

  • Added hosted A2A streaming regression coverage for append/last-chunk behavior, repeated message IDs, and failure flushing in provider/a2aprovider/hosting_test.go
  • Ran go test ./provider/a2aprovider

Notes

Scoped to the task-lifecycle artifact streaming parity fix from the upstream change set. No exported Go symbols changed, and the feature-comparison document did not require an update for this behavior-only alignment.

Generated by .NET to Go Fixes and Test Porting Agent · gpt54 · 223.4 AIC · ⌖ 14.7 AIC · ⊞ 24.4K ·


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 copilot/dotnet-port-fixes-a2a-streaming-artifacts-391a86679901d552.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (431 of 431 lines)
From 05062ffd2a562de22396926c34c7f905f7d2aaa2 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Mon, 24 Aug 2026 02:56:41 +0000
Subject: [PATCH] [dotnet-port-fixes] Align A2A streaming artifact updates with
 .NET

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 provider/a2aprovider/artifact_stream.go | 109 +++++++++++++++++++++++
 provider/a2aprovider/executor.go        |  60 +++++++++++--
 provider/a2aprovider/hosting_convert.go |  56 +++++++++---
 provider/a2aprovider/hosting_test.go    | 110 ++++++++++++++++++++++++
 4 files changed, 317 insertions(+), 18 deletions(-)
 create mode 100644 provider/a2aprovider/artifact_stream.go

diff --git a/provider/a2aprovider/artifact_stream.go b/provider/a2aprovider/artifact_stream.go
new file mode 100644
index 000000000..6d002a3e8
--- /dev/null
+++ b/provider/a2aprovider/artifact_stream.go
@@ -0,0 +1,109 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+package a2aprovider
+
+import (
+	"github.com/a2aproject/a2a-go/v2/a2a"
+	"github.com/microsoft/agent-framework-go/agent"
+)
+
+type artifactStreamWriter struct {
+	infoProvider      a2a.TaskInfoProvider
+	usedArtifactIDs   map[a2a.ArtifactID]struct{}
+	currentMessageID  string
+	currentArtifactID a2a.ArtifactID
+	bufferedUpdate    *agent.ResponseUpdate
+	shouldAppend      bool
+}
+
+func newArtifactStreamWriter(infoProvider a2a.TaskInfoProvider) *artifactStreamWriter {
+	return &artifactStreamWriter{
+		infoProvider:    infoProvider,
+		usedArtifactIDs: make(map[a2a.ArtifactID]struct{}),
+	}
+}
+
+func (w *artifactStreamWriter) Write(update *agent.ResponseUpdate) ([]*a2a.TaskArtifactUpdateEvent, error) {
+	if update == nil {
+		return nil, nil
+	}
+
+	events := make([]*a2a.TaskArtifactUpdateEvent, 0, 2)
+	if w.currentArtifactID == "" {
+		w.startArtifact(update.MessageID)
+	} else if w.isNewMessage(update.MessageID) {
+		evt, err := w.flushBuffered(true)
+		if err != nil {
+			return nil, 
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions