Skip to content

feat(a2a): migrate server runner to streamEvents#2222

Open
guslegend0510 wants to merge 2 commits into
agentscope-ai:mainfrom
guslegend0510:fix/2207-a2a-stream-events
Open

feat(a2a): migrate server runner to streamEvents#2222
guslegend0510 wants to merge 2 commits into
agentscope-ai:mainfrom
guslegend0510:fix/2207-a2a-stream-events

Conversation

@guslegend0510

Copy link
Copy Markdown
Contributor

Summary

  • migrate the A2A server AgentRunner contract from deprecated stream() / Event to streamEvents() / AgentEvent
  • update BaseReActAgentRunner to call ReActAgent.streamEvents()
  • adapt AgentScopeAgentExecutor to convert typed agent events into A2A streaming artifacts and final messages
  • update A2A server tests for typed events, including lifecycle-event filtering

Fixes #2207

Test

  • mvn -pl agentscope-extensions/agentscope-extensions-protocol/agentscope-extensions-a2a/agentscope-extensions-a2a-server -am test
  • mvn -pl agentscope-extensions/agentscope-spring-boot-starters/agentscope-a2a-spring-boot-starter -am -DskipTests test
  • mvn -pl agentscope-extensions/agentscope-spring-boot-starters/agentscope-a2a-spring-boot-starter -am -Dtest=AgentscopeA2aAutoConfigurationTest,A2aJsonRpcControllerTest -DfailIfNoTests=false test

@AgentScopeJavaBot AgentScopeJavaBot 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.

🤖 AI Review

This PR migrates the A2A server's AgentRunner contract and AgentScopeAgentExecutor from the deprecated coarse-grained Event / EventType API to the fine-grained typed AgentEvent / AgentEventType hierarchy. The migration is well-aligned with the project's deprecation direction and fixes #2207. However, a critical logic gap in finalMessage population was faithfully carried over from the old code: when requireInnerMessages=false, the finalMessage is never populated because AgentResultEvent handling is gated behind both isLifecycleEvent() (which returns false for AGENT_RESULT) and the requireInnerMessages flag in handleInnerMessage(). This leads to completeTaskWithMessage() being called with a null finalMessage on stream completion, likely causing an NPE.

(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)

@AgentScopeJavaBot AgentScopeJavaBot 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.

🤖 AI Review

This PR migrates the A2A server's AgentRunner contract and AgentScopeAgentExecutor from the deprecated coarse-grained Event / EventType API to the fine-grained typed AgentEvent / AgentEventType hierarchy. The migration is well-aligned with the project's deprecation direction and fixes #2207. However, a critical logic gap in finalMessage population was faithfully carried over from the old code: when requireInnerMessages=false, the finalMessage is never populated because AgentResultEvent handling is gated behind both isLifecycleEvent() (which returns false for AGENT_RESULT) and the requireInnerMessages flag in handleInnerMessage(). This leads to completeTaskWithMessage() being called with a null finalMessage on stream completion, likely causing an NPE.

(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)

@AgentScopeJavaBot AgentScopeJavaBot added enhancement New feature or request area/ext/integration External protocols & middleware integrations labels Jul 16, 2026
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.79070% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...e/a2a/server/executor/AgentScopeAgentExecutor.java 61.90% 14 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ext/integration External protocols & middleware integrations enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Upgrade A2A module event mechanism

2 participants