Skip to content

Revert "fix(a2a): use text/event-stream SSE format for message/stream endpoint"#20446

Merged
ishaan-jaff merged 1 commit intomainfrom
revert-20365-litellm_fix_a2a_streaming_content_type
Feb 5, 2026
Merged

Revert "fix(a2a): use text/event-stream SSE format for message/stream endpoint"#20446
ishaan-jaff merged 1 commit intomainfrom
revert-20365-litellm_fix_a2a_streaming_content_type

Conversation

@ishaan-jaff
Copy link
Member

Reverts #20365

@vercel
Copy link

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Building Building Preview, Comment Feb 5, 2026 0:08am

Request Review

@ishaan-jaff ishaan-jaff merged commit 6a73e5b into main Feb 5, 2026
8 of 11 checks passed
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 5, 2026

Greptile Overview

Greptile Summary

This PR reverts the SSE (Server-Sent Events) format changes for A2A streaming endpoints, reverting from text/event-stream back to application/x-ndjson.

Changes:

  • Reverts streaming Content-Type from text/event-stream to application/x-ndjson in a2a_endpoints.py:76,114
  • Removes SSE framing (data: prefix and \n\n suffix), restores NDJSON format (JSON + \n) in a2a_endpoints.py:65,74,99-103,106-112
  • Removes enhanced error handling that avoided exposing internal exception details in a2a_endpoints.py:105
  • Removes 261-line manual SSE validation test (test_a2a_sse_manual.py)
  • Removes 126 lines of automated SSE format validation tests (test_a2a_endpoints.py)

Context:
PR #20365 (now being reverted) changed the A2A streaming format to comply with SSE standards based on issue #20278. The original PR claimed the A2A protocol spec requires text/event-stream, but this revert suggests there may be compatibility issues or the spec interpretation was incorrect.

Confidence Score: 3/5

  • Safe to merge with caution - reverts to working implementation but removes error handling improvements
  • The revert cleanly undoes recent changes and restores the previous working implementation. However, the PR lacks explanation for why the revert is needed, which raises concerns about whether the root issue was identified. The revert also removes an improvement to error handling that prevented exposing internal exception details to clients.
  • Pay attention to litellm/proxy/agent_endpoints/a2a_endpoints.py - error handling was degraded

Important Files Changed

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
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

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}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
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)}"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant