Repository navigation
fix(client): close HTTP responses when streams end early - #1470
Open
Harshil-1603 wants to merge 3 commits into
Open
Harshil-1603 wants to merge 3 commits into
Harshil-1603 wants to merge 3 commits into
Conversation
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/client/base_client.py | 96.67% | 96.70% | 🟢 +0.04% |
| src/a2a/client/client_factory.py | 89.94% | 91.12% | 🟢 +1.18% |
| src/a2a/client/transports/jsonrpc.py | 95.51% | 96.23% | 🟢 +0.71% |
| src/a2a/client/transports/rest.py | 89.95% | 90.09% | 🟢 +0.14% |
| src/a2a/client/transports/tenant_decorator.py | 98.28% | 98.33% | 🟢 +0.06% |
| src/a2a/compat/v0_3/jsonrpc_transport.py | 73.62% | 75.63% | 🟢 +2.01% |
| src/a2a/compat/v0_3/proto_utils.py | 91.14% | 91.51% | 🟢 +0.37% |
| src/a2a/compat/v0_3/rest_transport.py | 95.78% | 95.88% | 🟢 +0.10% |
| src/a2a/server/cluster/database_event_stream.py | 93.64% | 97.27% | 🟢 +3.64% |
| Total | 93.62% | 93.76% | 🟢 +0.13% |
Generated by coverage-comment.yml
Iwaniukooo11
requested changes
Nov 16, 2026
| async def __aiter__(self) -> AsyncIterator[bytes]: | ||
| yield self.payload | ||
| self.waiting.set() | ||
| await asyncio.Event().wait() |
Member
There was a problem hiding this comment.
Please add a timeout in tests as now it can hang instead of fail
| ) | ||
| ), | ||
| ) | ||
| try: |
Member
There was a problem hiding this comment.
Please split those 5 if scenarios into separate tests. Also, tenant and plugin case can be handled in different test with re-using shared components
| context, | ||
| ): | ||
| yield event | ||
| async with aclosing( |
Member
There was a problem hiding this comment.
Please also apply those changes to compat layer
Close each legacy HTTP forwarding generator, including REST subscription fallback. Split cleanup scenarios into independent bounded tests and share tenant/plugin setup across protocol versions. Assisted-by: OpenAI Codex
Preserve upstream HTTPX2 compatibility alongside the timeout marker, protocol matrix and deterministic stream cleanup. Assisted-by: OpenAI Codex
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
Closing a
BaseClient.send_message()orsubscribe()stream did not close the generators it was forwarding. For v1 REST and JSON-RPC, the underlying HTTP response stayed open after an explicit close, a single-message reply, or an interceptor exception.Use
aclosingat each forwarding boundary inBaseClient, the tenant decorator and the v1 HTTP transports so closure reaches the response's existing context manager immediately. The shared HTTP client remains open.Validation:
./scripts/lint.shpasses (Ruff and ty; three existing unused-ignore warnings).uv run pytest: 2,661 passed, 215 skipped, 4 xfailed, 1 xpassed.git diff --checkpasses.The regression uses the real client factory and HTTP transport stack with
httpx.MockTransportand an open response stream whose closure is tracked. PostgreSQL/MySQL checks requiring unavailable DSNs retain their existing skips.Implemented and tested with Codex assistance.