Description
Description:
The opencode server's event stream (GET /event) terminates the connection immediately after sending the initial server.connected event. No subsequent bus events (e.g., message.part.delta, message.part.updated) are received by the client, despite the server logs showing that these events are being published internally.
Environment:
- OS: Linux Ubuntu 24.04
- OpenCode version: 1.14.46 (Broken) / 1.14.41 (Working)
- Install method: curl -fsSL https://opencode.ai/install | bash
Steps to reproduce:
- Run opencode serve.
- Connect to the event stream using curl -sN http://localhost:4096/event.
- In another terminal, send a prompt to a session via the HTTP API (e.g., using POST /session/:id/message). (or simply opencode attach http://localhost:4096 and send something)
- Observe that the curl connection closes immediately after the server.connected event, and no message events are streamed.
Verification:
- Server Logs: opencode.log confirms that events are being published to the internal bus (e.g., service=bus type=message.part.delta publishing).
- Direct API Test: curl -vN http://localhost:4096/event returns HTTP 200 OK and the first event, but then the connection is closed by the server.
- Version Regression: The issue is present in v1.14.46 but is completely resolved when rolling back to v1.14.41.
Likely cause:
The regression appears to have been introduced between v1.14.41 and v1.14.46. A strong suspect is the introduction of HTTP API response compression in v1.14.42, which may be incorrectly buffering or terminating the long-lived SSE stream.
OpenCode version
1.14.46
Operating System
Ubuntu 24.04
Terminal
WezTerm
Description
Description:
The opencode server's event stream (GET /event) terminates the connection immediately after sending the initial server.connected event. No subsequent bus events (e.g., message.part.delta, message.part.updated) are received by the client, despite the server logs showing that these events are being published internally.
Environment:
Steps to reproduce:
Verification:
Likely cause:
The regression appears to have been introduced between v1.14.41 and v1.14.46. A strong suspect is the introduction of HTTP API response compression in v1.14.42, which may be incorrectly buffering or terminating the long-lived SSE stream.
OpenCode version
1.14.46
Operating System
Ubuntu 24.04
Terminal
WezTerm