Skip to content

Fix A2A fallback artifact text#4548

Merged
asim merged 1 commit into
masterfrom
codex/increment-4547
Jul 10, 2026
Merged

Fix A2A fallback artifact text#4548
asim merged 1 commit into
masterfrom
codex/increment-4547

Conversation

@asim

@asim asim commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary:

  • Decode A2A gateway Agent.Chat replies from provider-compatible text fields when reply is absent.
  • Prevent streaming fallback from completing tasks with empty artifact/history text by returning a failed diagnostic task instead.

Testing:

  • go build ./...
  • go test ./gateway/a2a
  • go test ./... (environment warnings: AtlasCloud configured-provider stream returned 400; loopback gRPC targets are forbidden in this sandbox)
  • golangci-lint run ./...

Closes #4522
Closes #4547

@asim asim added the codex label Jul 10, 2026
Copilot AI review requested due to automatic review settings July 10, 2026 07:56
@asim
asim merged commit 96fc06b into master Jul 10, 2026
10 checks passed

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 PR hardens the A2A gateway’s non-streaming fallback behavior so tasks can’t be marked completed without preserving textual content, and adds decoding for Agent.Chat responses that provide text in provider-style fields (when reply is missing).

Changes:

  • Fail tasks with a diagnostic message when the fallback/non-stream Agent.Chat path returns an empty (or whitespace-only) reply.
  • Decode Agent.Chat responses from multiple provider-compatible text fields (reply, answer, content, text, and message.{content,text}).
  • Add regression tests for the streaming-unsupported fallback path and the new reply decoder.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
gateway/a2a/a2a.go Adds empty-reply failure handling in the dispatcher and introduces decodeAgentChatReply to extract text from multiple response shapes.
gateway/a2a/a2a_test.go Adds regression coverage for fallback completion with empty text and coverage for the decoder’s provider-field fallbacks.

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

Comment thread gateway/a2a/a2a_test.go
Comment on lines +557 to +562
if got := textOf(event.Result.Artifacts[0].Parts); got == "" {
t.Fatalf("fallback artifact text is empty: %+v", event.Result.Artifacts)
}
if got := textOf(event.Result.History[len(event.Result.History)-1].Parts); got == "" {
t.Fatalf("fallback history text is empty: %+v", event.Result.History)
}
Comment thread gateway/a2a/a2a_test.go
Comment on lines +565 to +583
func TestDecodeAgentChatReplyFallsBackToProviderTextFields(t *testing.T) {
for name, body := range map[string]string{
"answer": `{"answer":"answer text"}`,
"content": `{"content":"content text"}`,
"text": `{"text":"text field"}`,
"message_content": `{"message":{"content":"message content"}}`,
"message_text": `{"message":{"text":"message text"}}`,
} {
t.Run(name, func(t *testing.T) {
got, err := decodeAgentChatReply([]byte(body))
if err != nil {
t.Fatalf("decodeAgentChatReply error: %v", err)
}
if strings.TrimSpace(got) == "" {
t.Fatalf("decodeAgentChatReply(%s) returned empty text", body)
}
})
}
}
@asim asim mentioned this pull request Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loop: build increment #173 Preserve A2A fallback artifact text for AtlasCloud

3 participants