Repository navigation
fix(client): dispatch CR-terminated SSE events immediately - #1495
Open
Elon-Jiang wants to merge 1 commit into
Open
Elon-Jiang wants to merge 1 commit into
Elon-Jiang wants to merge 1 commit into
Conversation
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/client/transports/http_helpers.py | 93.51% | 91.14% | 🔴 -2.37% |
| Total | 93.62% | 93.59% | 🔴 -0.04% |
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
JsonRpcTransport.send_message_streaming()waits for another chunk when a complete SSE event ends in\r\rand the peer keeps the response open._aiter_sse_linesheld the last CR to recognize a split CRLF. Dispatch the CR immediately and skip only its optional following LF, as the SSE rules require. Buffering unfinished line pieces stays linear.The new client regression uses a real HTTPX client, request serialization, SSE parser and protobuf result decoding. Its response fixture yields one JSON-RPC event and then waits indefinitely. On unchanged main, CR times out while LF and CRLF return immediately (1 failed, 7 framing controls passed); all cases return with this change. Split CRLF and multi-line CR controls protect against introducing an extra blank line. Only the remote HTTP response is replaced; no hosted Agent was tested.
Validation on Python 3.12:
./scripts/lint.sh: passed (existing non-fatal ty diagnostics).uv run pytest: 2,626 passed, 215 skipped, 4 xfailed, 1 xpassed, and 4 setup errors in cross-version server startup. The exact baseline in an independent environment has the same four setup errors, with 2,621 passed and identical skip/xfail/xpass counts. No test assertion failures in either run. The full suite is therefore not claimed green. PostgreSQL/MySQL integrations were skipped without their DSNs.uv run pytest --cov=src --cov-report=term-missing: same four setup errors, total coverage 94% (repository threshold 88%).#1489 changes UTF-8 decoding and #1259 concerns BOM handling; neither covers this dispatch delay. This change preserves decoding behavior and does not incorporate those separate fixes.
Fixes #1494
Prepared and validated with an AI coding assistant.