Repository navigation
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
24679ef to
8794989
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #36311
Supersedes #50375 (that one targets
dev; the same missing bridge is present onv2).Type of change
What does this PR do?
On Bun 1.3.14,
node:httpdoes not emitServerResponse"close" when an SSE client disconnects (oven-sh/bun#14697).@effect/platform-nodewaits for that event to interrupt the request fiber, so when a TUI drops its/api/eventSSE connection the server-side event stream is never released. It keeps writing heartbeats into a dead socket, pinning one CPU core at 100% and making the server unresponsive.packages/server/src/process.tsis thev2equivalent of thedevcall site the issue describes. This adds the bridge the issue suggests: on Bun only, destroy the response from the request "aborted" event so Bun emits the missing "close" and Effect can interrupt the stream and release its subscription.The bridge is a small named function (
bridgeSseDisconnect) next tobindso its two guards — Bun only, and only for a response that has not already ended — are directly testable.How did you verify your code works?
bun test test/process.test.tsfrompackages/server— 4 pass. Two new cases drive a fake"request"emission and then"aborted": an unfinished response is destroyed, an already-ended response is left alone. The existing live server tests still pass.bun typecheckinpackages/server— passed.bun run lint— 0 warnings / 0 errors.The original report notes there is no short deterministic trigger for the permanent spin, so this is covered at the event-bridge level rather than by reproducing the spin end to end.
Note:
bun run checkstill cannot complete in my Windows checkout becausepackages/app/src/custom-elements.d.tsis a git symlink (mode 120000) materialized as a text file (core.symlinks=false), which fails@opencode/app#typecheckwith TS1128. That is unrelated to this change and passes on a normal checkout.Screenshots / recordings
Not applicable; no UI change.
Checklist