Conversation
Do one iteration to catch exceptions occurred beforehand to return an error instead of sending headers for SSE. Error handling during the execution is not defined in the spec: a2aproject/A2A#1262.
Summary of ChangesHello, 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 enhances the robustness of REST API streaming endpoints by addressing a critical error handling flaw. Previously, errors occurring early in a streaming request could lead to a broken client connection rather than a structured error response. The changes ensure that such errors are now properly intercepted and returned as standard JSON error messages, significantly improving the client experience and API reliability for streaming operations. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses a key issue in REST streaming error handling by eagerly fetching the first event. This ensures that exceptions occurring before the stream begins are properly caught and returned as JSON errors instead of breaking the SSE connection. The implementation is clean and the addition of the test_client_handles_a2a_errors_streaming integration test provides excellent coverage for this new behavior. I've added one suggestion to further improve the robustness of the error handling for the first event.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/apps/rest/rest_adapter.py | 82.28% | 83.53% | 🟢 +1.25% |
| Total | 91.38% | 91.39% | 🟢 +0.01% |
Generated by coverage-comment.yml
Do one iteration to catch exceptions occurred beforehand to return an error instead of sending headers for SSE. Error handling during the execution is not defined in the spec: a2aproject/A2A#1262.