Repository navigation
fix(compat): return HTTP errors from v0.3 REST streams that fail early - #1403
Open
jaeminbird wants to merge 1 commit into
Open
jaeminbird wants to merge 1 commit into
jaeminbird wants to merge 1 commit into
Conversation
The v0.3 REST adapter started the SSE response before running the
handler, so a malformed message:stream body or an unknown task on
tasks/{id}:subscribe produced an empty 200 text/event-stream. Fetch the
first event before starting the stream, as the v1.0 REST dispatcher
does, so these errors get the same JSON error response as message:send.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/compat/v0_3/rest_adapter.py | 77.14% | 78.05% | 🟢 +0.91% |
| Total | 93.37% | 93.36% | 🔴 -0.01% |
Generated by coverage-comment.yml
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The v0.3 REST adapter starts the SSE response before the handler runs, so any error raised before the first event becomes an empty 200
text/event-stream: a malformedmessage:streambody (even{bad), ortasks/{id}:subscribefor an unknown task.message:sendanswers 400 for the same body, and the v1.0 routes answer 400/404._handle_streaming_requestnow fetches the first event before creating the response, asRestDispatcher._handle_streamingalready does, so@rest_stream_error_handlermaps these errors to the usual JSON error. Mid-stream behaviour is unchanged. Follow-up to #1401, which noted this as a separate problem.New tests (malformed
message:stream→ 400, unknown-task subscribe → 404, events still streamed in order) fail on main and pass with the fix.scripts/lint.shanduv run pyteston Linux pass.Follow the
CONTRIBUTINGGuide.Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
Ensure the tests and linter pass
Appropriate docs were updated (not needed)