fix(a2a): prevent a2a SDK SPI loading issues caused by delayed thread…#601
fix(a2a): prevent a2a SDK SPI loading issues caused by delayed thread…#601AlbumenJ merged 1 commit intoagentscope-ai:mainfrom
Conversation
… switching Change-Id: Iadf6ca7f9e3e3b4fb41a3a9a91e7526170252b77
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 inJdkHttpTransport.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.
agentscope-core/src/main/java/io/agentscope/core/model/transport/JdkHttpTransport.java
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
AgentScope-Java Version
1.0.8
Description
Same as #464
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)