Skip to content

fix(server-common): keep task streams open after messages - #1060

Open
dangzitou wants to merge 1 commit into
a2aproject:mainfrom
dangzitou:agent/fix-message-before-input-required
Open

fix(server-common): keep task streams open after messages#1060
dangzitou wants to merge 1 commit into
a2aproject:mainfrom
dangzitou:agent/fix-message-before-input-required

Conversation

@dangzitou

Copy link
Copy Markdown

Description

Keep a task stream open when an agent emits a Message after the task lifecycle has started. A stateless Message remains a complete response and still closes its stream.

The new regression test covers WORKING Task -> Message -> INPUT_REQUIRED -> COMPLETED, including a custom message without task/context IDs as accepted by AgentEmitter.sendMessage(Message).

  • Follow the CONTRIBUTING Guide.
  • Use a Conventional Commits PR title.
  • Ensure the affected tests pass.
  • Appropriate documentation was updated.

Reproduction

On current main, the focused Java 17 regression was run three times. Every run failed after delivering only the working task and message:

expected: <4> but was: <2>

The following INPUT_REQUIRED and COMPLETED updates were lost because every Message was treated as stream-terminal.

Verification

Run with OpenJDK 17:

mvn -pl server-common -Dtest=EventConsumerTest test
mvn -pl server-common test

Results:

  • EventConsumerTest: 19 tests passed
  • server-common: 475 tests passed
  • existing stateless-message stream termination coverage remains green

This fixes #1037

@dangzitou
dangzitou marked this pull request as ready for review August 12, 2026 19:54

@kabir kabir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe this PR to be wrong for the same reasons as mentioned in #1040 (review)

Essentially the agents should either:

  • Emit a Message. No Task is created, and is for single reply interactions
  • Create a Task for long running tasks

The two are mutually exclusive

@dangzitou
dangzitou force-pushed the agent/fix-message-before-input-required branch from 1fcb46e to 85283a9 Compare August 13, 2026 15:08
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.

agentEmitter.requiresInput(a2aMessage) does not trigger a TaskStatusUpdateEvent

2 participants