Skip to content

fix(recorder): stream SSE responses instead of buffering (v1.14.5)#125

Merged
jpr5 merged 2 commits into
mainfrom
fix/recorder-stream-sse
Apr 22, 2026
Merged

fix(recorder): stream SSE responses instead of buffering (v1.14.5)#125
jpr5 merged 2 commits into
mainfrom
fix/recorder-stream-sse

Conversation

@jpr5

@jpr5 jpr5 commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

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

  • Full aimock suite green (2436 passing)
  • Build green
  • 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

jpr5 added 2 commits April 22, 2026 14:14
`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.
@pkg-pr-new

pkg-pr-new Bot commented Apr 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@125

commit: a6fcffd

@jpr5
jpr5 merged commit f9fb5ca into main Apr 22, 2026
23 checks passed
@jpr5
jpr5 deleted the fix/recorder-stream-sse branch April 22, 2026 21:19
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant