You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 13, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 13, 2026. It is now read-only.
SSE connections hang in Coder environments due to proxy buffering #69
Server-Sent Events (SSE) connections to the /events endpoint hang indefinitely when AgentAPI is deployed in Coder workspaces. The connection opens successfully but no events are received due to proxy buffering.
Expected behavior
SSE connections should remain open and stream events in real-time for the chat interface.
Actual behavior:
EventSource shows readyState: 1 (OPEN) successfully
Connection appears established but hangs indefinitely
No SSE events are received (message_update, status_change)
Chat interface becomes non-functional - messages appear stuck
After ~60 seconds, connection may timeout and show error
Coder's reverse proxy might be buffering HTTP responses by default, preventing real-time streaming of SSE data. The proxy waits to collect a "complete" response before forwarding, but SSE connections are meant to stay open indefinitely.
I created a PR #70, and tested this, making this change actually made it work
I think this issue coder/registry#433 might be related, the problem is as events sse call is not resolved the ui does not allow me to type
@DivyMohan14 While investigating coder/registry#433 I found that killing the agentapi process did not resolve the issue, which suggests to me that the issue is more on the Coder side?
Hey @johnstcn thanks for looking into this, regarding your comment for coder/registry#433, I found that killing the agentapi process did not resolve the issue -> wouldn't killing the agentapi process also kill the ui, I am not sure if I am missing something.
I suspect this issue stems from the varied networking setups across different customer deployments - some may be running nginx, Cloudflare proxy, or other reverse proxies that buffer responses by default. To handle this variability and avoid requiring customers to configure their proxies correctly, I think implementing the fix directly in the application layer would be more robust. What are your thoughts on this?
@DivyMohan14 Yes it would, but keeping the chat UI running wasn't my focus. The issue in coder/coder seems to be related to an internal Coder process that keeps a workspace running as long as network activity is detected. My theory was that agentapi was perhaps keeping something open. I do suspect this issue is related, though.
I'm unable to reproduce this issue with Coder directly (no reverse proxy in-betweeen).
However, I can absolutely see how this could happen when you introduce other reverse proxies into the mix, and was able to reproduce this with a local Docker setup running nethack-console through AgentAPI.
Server-Sent Events (SSE) connectionsto the/eventsendpoint hang indefinitely when AgentAPI is deployed in Coder workspaces. The connection opens successfully but no events are received due to proxy buffering.Expected behavior
SSE connections should remain open and stream events in real-time for the chat interface.
I am using https://registry.coder.com/modules/coder/claude-code without tasks
Actual behavior:
EventSource shows readyState: 1 (OPEN) successfully
Connection appears established but hangs indefinitely
No SSE events are received (message_update, status_change)
Chat interface becomes non-functional - messages appear stuck
After ~60 seconds, connection may timeout and show error