Repository navigation
Python: fix(devui): omit connection-specific keep-alive header from SSE streaming responses - #10112
Conversation
…SE streaming responses Remove the Connection: keep-alive header from both DevUI SSE streaming responses in _server.py. RFC 9113 section 8.2.2 forbids connection-specific header fields in HTTP/2 and HTTP/3, and HTTP/1.1 connections remain persistent by default. Gateway and proxy handlers serving DevUI over HTTP/2 will no longer reject or strip malformed connection headers. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
|
Hi Eduard van Valkenburg (@eavanvalkenburg), I've opened this PR to address #10111. DevUI streaming responses were explicitly returning This PR removes the connection-specific header while preserving Regression tests covering both local and OpenAI proxy streaming responses have been added and verified locally. Whenever you have a moment, please feel free to review. Thank you! |
…tion header in streaming responses Add regression tests in test_server.py ensuring both the local executor and OpenAI proxy streaming responses omit the connection-specific Connection header while preserving Cache-Control and X-Response-ID. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
5151692 to
98c26e4
Compare
…d tag test test_registered_child_tag_does_not_hijack_message_payload registered custom TextState with type_id=text into the global _STATE_TYPE_REGISTRY without cleaning it up. When run in the same test process before session deserialization tests that encounter text Content mappings, the lingering registration caused deserialization failures. Clean up the registered state type in a finally block. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
|
Hi Eduard van Valkenburg (@eavanvalkenburg), I've pushed an update addressing the failure previously observed in the
Whenever you have a moment, could you please approve the workflow run for the updated branch? Thank you! |
|
Thanks Eduard van Valkenburg (@eavanvalkenburg) for the approval ! |
Motivation & Context
In
agent_framework_devui._server, streaming Server-Sent Events (SSE) responses explicitly set"Connection": "keep-alive".According to RFC 9113 section 8.2.2 (HTTP/2) and RFC 9114 (HTTP/3), connection-specific header fields such as
Connectionare prohibited. Reverse proxies, gateways, and HTTP/2 clients handling DevUI traffic either strip the header or treat the response as malformed (stream error / 502 Bad Gateway). In HTTP/1.1, persistent connections are the default, and transport-level connection headers are managed by the underlying ASGI server (e.g., Uvicorn).Omitted connection-specific headers resolve this issue while preserving
Cache-Control: no-cacheandX-Response-ID.Description & Review Guide
"Connection": "keep-alive"from theStreamingResponseheaders in both the OpenAI proxy mode streaming handler and the local executor streaming handler inpython/packages/devui/agent_framework_devui/_server.py.python/packages/devui/tests/devui/test_server.pyverifying that both streaming endpoints omit connection-specific headers while maintainingCache-Control: no-cacheandX-Response-ID.Related Issue
Fixes #10111
AI Assistance
AI assistance details:
AI assisted with identifying RFC specifications, generating test scaffolding, and drafting documentation. All code and test changes were manually reviewed and verified locally.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.