fix(recorder): stream SSE responses instead of buffering (v1.14.5)#125
Merged
Conversation
`proxyAndRecord` collected every upstream chunk into an array and replayed the entire body via a single `res.end()` at the bottom of the function. For `text/event-stream` responses this collapses all frames into one client-visible write, defeating progressive rendering in downstream consumers. When upstream declares `content-type: text/event-stream`, tee each incoming chunk to the client while still accumulating into the recording buffer. Non-SSE responses continue to use the existing buffered relay path unchanged. Latent since v1.6.0 (`900399b`); surfaced in production once showcase traffic began exercising `--proxy-only` more heavily under tightened v1.14.0+ fixture handling.
commit: |
jpr5
added a commit
that referenced
this pull request
Jul 15, 2026
) ## Summary - `proxyAndRecord` buffered upstream SSE bodies and replayed in a single `res.end()`, collapsing chunks into one client-visible write. - Showcase's `--proxy-only` mode hit this path in production, breaking progressive streaming downstream. - Surgical split: when upstream `content-type` is `text/event-stream`, relay chunks to the client as they arrive while still tee-ing into the recording buffer. Non-SSE behavior unchanged. ## Context Latent since v1.6.0 (`900399b`). Exposed in production after v1.14.0+ fixture handling tightened and more showcase traffic began hitting the proxy path. Live curl against deployed `showcase-aimock-production` confirmed: 11 SSE frames in 35µs after a 515ms TTFB — classic buffer-and-replay signature. ## Test plan - [x] Full aimock suite green (2436 passing) - [x] Build green - [x] New `recorder SSE progressive streaming` test — red on pre-fix recorder (single data event, `arrivalTimes.length === 1`), green after fix (multi-frame span >=100ms) - [ ] Post-release: showcase `:latest` auto-picks up; Jordan verifies via Playwright probe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
proxyAndRecordbuffered upstream SSE bodies and replayed in a singleres.end(), collapsing chunks into one client-visible write.--proxy-onlymode hit this path in production, breaking progressive streaming downstream.content-typeistext/event-stream, relay chunks to the client as they arrive while still tee-ing into the recording buffer. Non-SSE behavior unchanged.Context
Latent since v1.6.0 (
900399b). Exposed in production after v1.14.0+ fixture handling tightened and more showcase traffic began hitting the proxy path.Live curl against deployed
showcase-aimock-productionconfirmed: 11 SSE frames in 35µs after a 515ms TTFB — classic buffer-and-replay signature.Test plan
recorder SSE progressive streamingtest — red on pre-fix recorder (single data event,arrivalTimes.length === 1), green after fix (multi-frame span >=100ms):latestauto-picks up; Jordan verifies via Playwright probe