Skip to content

fix(a2a): prevent a2a SDK SPI loading issues caused by delayed thread…#601

Merged
AlbumenJ merged 1 commit intoagentscope-ai:mainfrom
LearningGp:a2a-fix
Jan 19, 2026
Merged

fix(a2a): prevent a2a SDK SPI loading issues caused by delayed thread…#601
AlbumenJ merged 1 commit intoagentscope-ai:mainfrom
LearningGp:a2a-fix

Conversation

@LearningGp
Copy link
Contributor

AgentScope-Java Version

1.0.8

Description

Same as #464

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

… switching

Change-Id: Iadf6ca7f9e3e3b4fb41a3a9a91e7526170252b77
@LearningGp LearningGp requested review from a team and Copilot January 19, 2026 12:48
@gemini-code-assist
Copy link

Summary of Changes

Hello @LearningGp, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue affecting A2A SDK SPI loading by refining the thread management for HTTP stream processing. By ensuring that stream operations are executed on a dedicated bounded elastic scheduler, the change mitigates problems caused by delayed threads, thereby enhancing the stability and reliability of the SDK's initialization and operation.

Highlights

  • Thread Scheduling for Stream Processing: Introduced publishOn(Schedulers.boundedElastic()) to explicitly manage the thread on which streaming HTTP responses are processed. This change aims to prevent issues related to delayed threads that could impact A2A SDK SPI loading.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request attempts to fix a threading issue by introducing publishOn to a reactive stream. While the intent is correct, the placement of the operator doesn't fully resolve the potential for blocking an HttpClient thread. My review includes a suggestion to adjust the operator order to correctly offload the blocking I/O operation, preventing potential thread starvation in the HTTP client's thread pool.

Copy link
Contributor

Copilot AI left a comment

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 fixes SPI (Service Provider Interface) loading issues in the a2a SDK by ensuring reactive streams emit events on threads with the correct context classloader. The issue was caused by delayed thread switching in the reactive pipeline, which prevented ServiceLoader from properly loading transport implementations.

Changes:

  • Added .publishOn(Schedulers.boundedElastic()) to the reactive stream chain in JdkHttpTransport.stream() to ensure downstream subscribers receive events on a thread with the correct context classloader

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

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AlbumenJ AlbumenJ merged commit 29ac346 into agentscope-ai:main Jan 19, 2026
10 of 11 checks passed
Alexxigang pushed a commit to Alexxigang/agentscope-java that referenced this pull request Jan 25, 2026
agentscope-ai#601)

## AgentScope-Java Version

1.0.8

## Description

Same as agentscope-ai#464

## Checklist

Please check the following items before code is ready to be reviewed.

- [x]  Code has been formatted with `mvn spotless:apply`
- [x]  All tests are passing (`mvn test`)
- [x]  Javadoc comments are complete and follow project conventions
- [x] Related documentation has been updated (e.g. links, examples,
etc.)
- [x]  Code is ready for review
@LearningGp LearningGp deleted the a2a-fix branch January 28, 2026 05:51
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