Avoid bun memory leak bug from TransformStream#4255
Avoid bun memory leak bug from TransformStream#4255TheodoreSpeaks wants to merge 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@BugBot review |
PR SummaryMedium Risk Overview Adds Reviewed by Cursor Bugbot for commit 43a727d. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 43a727d. Configure here.
| } catch {} | ||
| } | ||
|
|
||
| const fullContent = chunks.join('') |
There was a problem hiding this comment.
Partial content persisted when stream consumer errors internally
Medium Severity
Content accumulation is now coupled to the client's consumption of the stream via the pull callback in clientSource. Previously, stream.tee() gave the executor an independent copy that was always fully consumed regardless of client-side failures. Now, if an onStream consumer encounters an internal error (e.g., SSE sendEvent throws) but catches it without re-throwing, onStream returns normally, drainError is not set, and the code proceeds to process and persist the partially accumulated content — setting incomplete text on executionOutput.content and invoking onFullContent with a truncated string. This can cause incomplete assistant responses to be persisted to memory via appendToMemory.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 43a727d. Configure here.


Summary
Bun has a bug in TransformStream: oven-sh/bun#28035 causing high memory consumption due to no backpressure signal. We use this in
Type of Change
Testing
Checklist
Screenshots/Videos