Skip to content

fix: keep current status messages out of task history - #1122

Open
1fanwang wants to merge 2 commits into
a2aproject:mainfrom
1fanwang:fix-client-status-history
Open

fix: keep current status messages out of task history#1122
1fanwang wants to merge 2 commits into
a2aproject:mainfrom
1fanwang:fix-client-status-history

Conversation

@1fanwang

@1fanwang 1fanwang commented Sep 2, 2026

Copy link
Copy Markdown

Description

A streaming client currently puts the active status message in both Task.status.message and Task.history. A client that receives the update reconstructs different state from a later subscriber reading the server snapshot.

The client now moves only the previous status message into history. This matches the Java server and the Python and Go SDKs. The v0.3 compatibility client uses the same rule.

End-to-end repro

I used the existing stream lifecycle example with this temporary instrumentation:

-emitter.startWork();
+emitter.startWork(emitter.newAgentMessage(java.util.List.of(new TextPart("working")), null));

-System.out.printf("[%s] StatusUpdate — %s%n", subscriber, tue.getTask().status().state());
+System.out.printf("[%s] StatusUpdate — %s statusMessage=%s history=%s%n", subscriber, tue.getTask().status().state(), tue.getTask().status().message().messageId(), tue.getTask().history().stream().map(Message::messageId).toList());

-System.out.printf("[%s] TaskEvent — state: %s, id: %s%n", subscriber, te.getTask().status().state(), te.getTask().id());
+System.out.printf("[%s] TaskEvent — state: %s, id: %s statusMessage=%s history=%s%n", subscriber, te.getTask().status().state(), te.getTask().id(), te.getTask().status().message().messageId(), te.getTask().history().stream().map(Message::messageId).toList());
cd examples/stream-lifecycle/server && mvn -q quarkus:dev
cd examples/stream-lifecycle/client && mvn -q compile exec:java

Before:

StatusUpdate ... statusMessage=2b86bb5b-921a-4775-b413-6e90b667b8db history=[2b86bb5b-921a-4775-b413-6e90b667b8db]
TaskEvent ... statusMessage=2b86bb5b-921a-4775-b413-6e90b667b8db history=[]

After:

StatusUpdate ... statusMessage=30b9d47f-5358-4c0c-9805-f790becec694 history=[]
TaskEvent ... statusMessage=30b9d47f-5358-4c0c-9805-f790becec694 history=[]
  • Followed the CONTRIBUTING Guide.
  • Used a Conventional Commits title.
  • mvn -pl client/base,compat-0.3/client/base -am test
[ERROR] Tests run: 14, Failures: 2, Errors: 0, Skipped: 0
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
  • No README update is needed because the public API is unchanged.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
Signed-off-by: 1fanwang <1fannnw@gmail.com>

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.

🟢 Approval recommended

The focused implementation matches server behavior and includes regression coverage for both supported client models.

Pull request overview

Updates client task reconstruction so only superseded status messages enter task history, aligning current and v0.3 clients with server behavior.

Changes:

  • Archives the previous status message when processing an update.
  • Keeps the current message exclusively in Task.status.
  • Updates tests for both protocol versions.
File summaries
File Description
client/base/.../ClientTaskManager.java Corrects current task-history reconstruction.
client/base/.../ClientTaskManagerTest.java Updates status-message lifecycle assertions.
compat-0.3/client/base/.../ClientTaskManager_v0_3.java Applies equivalent v0.3 behavior.
compat-0.3/client/base/.../ClientTaskManager_v0_3_Test.java Adds v0.3 regression coverage.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants