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 }}
Repository navigation
[BUG] SSE Event Stream Closes Immediately After Connection (Effect HTTP API Backend) #27391
Bug Report: SSE Event Stream Closes Immediately After Connection (Effect HTTP API Backend)
Summary
In OpenCode v1.14.43+, the SSE /event endpoint closes the stream immediately (~1ms) after sending the server.connected event. This prevents all subsequent server-pushed events from reaching clients.
Severity
Critical — The SSE event stream is the only mechanism for clients to receive real-time updates. This bug causes:
No AI streaming responses (message.part.delta)
No message completion notifications (message.completed)
No permission request handling (permission.asked)
No question request handling (question.asked)
Affected Versions
Affected: v1.14.43 ~ v1.14.48 (latest as of report)
Not affected: v1.14.42 and earlier (using Hono backend)
Root Cause
The eventResponse() function in packages/opencode/src/server/routes/instance/httpapi/event.ts creates an SSE stream bound to the Effect HTTP request scope. When the handler returns, the request scope is disposed, cancelling the bus.subscribeAll() PubSub subscription and terminating the stream prematurely.
Steps to Reproduce
Start OpenCode server: opencode serve --cors '*'
Connect to SSE endpoint: curl -N http://127.0.0.1:4096/event
Expected: Stream stays open
Actual: Stream closes immediately after server.connected (< 1ms)
Suggested Fix
Lift the PubSub subscription outside the request scope so its lifetime is not affected by request disposal. Consider using Effect.unsafeScoped or binding the subscription to an application-level Scope.
The description appears to be AI-generated (structured wall of text with sections like "## Severity", "## Root Cause", "## Suggested Fix", "## Labels"). AI-generated issue descriptions are not acceptable — please rewrite this in your own words with only the details you actually observed.
Required fields Operating System and Terminal are left blank (_No response_). Please provide your system information.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
Activity
github-actions commentedon May 13, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
_No response_). Please provide your system information.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon May 14, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.