Revert "fix(a2a): use text/event-stream SSE format for message/stream endpoint"#20446
Conversation
… endpoin…" This reverts commit 0209b21.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile OverviewGreptile SummaryThis PR reverts the SSE (Server-Sent Events) format changes for A2A streaming endpoints, reverting from Changes:
Context: Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/agent_endpoints/a2a_endpoints.py | Reverts SSE format back to NDJSON format for A2A streaming responses - changes text/event-stream to application/x-ndjson and removes SSE framing |
| tests/a2a_manual/test_a2a_sse_manual.py | Removes manual SSE validation test file that was validating the SSE format implementation |
| tests/test_litellm/proxy/agent_endpoints/test_a2a_endpoints.py | Removes automated tests that validated SSE format (Content-Type and body framing) for A2A streaming |
Sequence Diagram
sequenceDiagram
participant Client as A2A Client
participant Proxy as LiteLLM Proxy
participant Agent as Backend Agent
Client->>Proxy: POST /a2a/{agent_id} (message/stream)
Note over Client,Proxy: JSON-RPC 2.0 request
Proxy->>Proxy: Validate request & auth
Proxy->>Proxy: Check agent permissions
alt A2A SDK Available
Proxy->>Agent: Forward streaming request
Agent-->>Proxy: Stream chunks
loop For each chunk
Proxy->>Proxy: Convert to NDJSON format
Note over Proxy: After revert: {json}\n<br/>Before revert: data: {json}\n\n
Proxy-->>Client: Yield NDJSON chunk
end
Note over Client,Proxy: Content-Type: application/x-ndjson<br/>(reverted from text/event-stream)
else A2A SDK Not Available
Proxy->>Proxy: Generate error stream
Proxy-->>Client: Error in NDJSON format
end
| verbose_proxy_logger.exception("Error streaming A2A response") | ||
| # Return a generic error message to the client without exposing internal details | ||
| yield "data: " + json.dumps( | ||
| verbose_proxy_logger.exception(f"Error streaming A2A response: {e}") |
There was a problem hiding this comment.
The revert removes security-improved error handling. The original code (line 105) used .exception() without the exception message parameter, which is better for security as it logs full details server-side but doesn't expose them to clients. The reverted version exposes {str(e)} to clients.
Consider keeping the improved error handling:
| verbose_proxy_logger.exception(f"Error streaming A2A response: {e}") | |
| verbose_proxy_logger.exception("Error streaming A2A response") |
Prompt To Fix With AI
This is a comment left during a code review.
Path: litellm/proxy/agent_endpoints/a2a_endpoints.py
Line: 105:105
Comment:
The revert removes security-improved error handling. The original code (line 105) used `.exception()` without the exception message parameter, which is better for security as it logs full details server-side but doesn't expose them to clients. The reverted version exposes `{str(e)}` to clients.
Consider keeping the improved error handling:
```suggestion
verbose_proxy_logger.exception("Error streaming A2A response")
```
How can I resolve this? If you propose a fix, please make it concise.| "code": -32603, | ||
| "message": "Streaming error", | ||
| }, | ||
| "error": {"code": -32603, "message": f"Streaming error: {str(e)}"}, |
There was a problem hiding this comment.
The error response now exposes internal exception details via f"Streaming error: {str(e)}". The original version (before the reverted PR) showed exception details, but PR #20365 improved this to return a generic "Streaming error" message. This revert reintroduces the information exposure issue that Copilot Autofix previously flagged (alert #4045).
Prompt To Fix With AI
This is a comment left during a code review.
Path: litellm/proxy/agent_endpoints/a2a_endpoints.py
Line: 110:110
Comment:
The error response now exposes internal exception details via `f"Streaming error: {str(e)}"`. The original version (before the reverted PR) showed exception details, but PR #20365 improved this to return a generic "Streaming error" message. This revert reintroduces the information exposure issue that Copilot Autofix previously flagged (alert #4045).
How can I resolve this? If you propose a fix, please make it concise.
Reverts #20365