Skip to content

[Bug]: Completed A2A status updates lose their response message when artifacts are empty #3783

Closed

Description

@pengmoubuaixuexi

Describe the bug

A2aAgent drops a completed task's final status.message when the SDK delivers it as a TaskUpdateEvent / TaskStatusUpdateEvent and the accumulated task has no artifacts. call() returns an empty assistant message even though the final event contains the answer.

The TaskEvent path already falls back to the status message when artifacts are empty (including after #3775), but TaskUpdateEventHandler always converts artifacts for a completed status update.

To Reproduce

Using an offline Client.sendMessage test double in A2aAgentTest, deliver this SDK event to its event consumer:

TaskStatus status = new TaskStatus(
        TaskState.TASK_STATE_COMPLETED,
        A2A.toAgentMessage("status-only answer"), null);
Task task = Task.builder()
        .id("taskId")
        .contextId("contextId")
        .status(status)
        .artifacts(List.of())
        .build();
TaskStatusUpdateEvent update = new TaskStatusUpdateEvent(
        "taskId", status, "contextId", Map.of());
consumer.accept(new TaskUpdateEvent(task, update), agentCard);

Call the public agent.call(input).block() and assert its text is status-only answer.

The regression fails on current main (16cb024ae62a10db2aedc2371f4d729194ffda82):

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
expected: <status-only answer> but was: <>

No real model, remote service, credentials, event reordering, or transport cancellation is needed.

Expected behavior

For a completed task, prefer nonempty artifacts; when artifacts are absent, preserve the final status message. The result should agree whether completion arrives as a complete TaskEvent or a TaskStatusUpdateEvent.

Error messages

There is no runtime exception: the response text is silently empty.

Environment

  • AgentScope Java: 2.1.0-SNAPSHOT, main commit 16cb024ae62a10db2aedc2371f4d729194ffda82
  • A2A Java SDK: 1.4.0.Final
  • Java: Temurin 17.0.15
  • OS: Windows / PowerShell

Additional context

The completed branch in TaskUpdateEventHandler.TaskStatusUpdateEventHandler.handle only calls MessageConvertUtil.convertFromArtifact(context.getTask().artifacts(), ...); it never reads event.status().message().

I am implementing the focused fix and regression coverage and will submit a linked PR in this session. Please assign this issue to pengmoubuaixuexi if an assignment is needed. Investigation and patch preparation use Codex assistance; the failure above is from an executed offline regression test.

Activity

  1. added a commit that references this issue on Oct 27, 2026
    00e4a66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions