Skip to content

Progressively relay NDJSON/Bedrock streams, add SSE anti-buffering headers#175

Merged
jpr5 merged 2 commits into
mainfrom
blitz/streaming-relay/integration
May 11, 2026
Merged

Progressively relay NDJSON/Bedrock streams, add SSE anti-buffering headers#175
jpr5 merged 2 commits into
mainfrom
blitz/streaming-relay/integration

Conversation

@jpr5
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 commented May 11, 2026

Summary

  • Extend progressive streaming relay to cover application/x-ndjson (Ollama) and application/vnd.amazon.eventstream (Bedrock) — previously these were fully buffered before relay, triggering downstream HTTP idle timeouts on slow calls
  • Add standard anti-buffering headers (Cache-Control: no-cache, no-transform, Connection: keep-alive, X-Accel-Buffering: no) to all progressive stream relay paths, preventing reverse proxies from buffering SSE/NDJSON/Bedrock responses
  • Widen onHookBypassed reason type to distinguish SSE, NDJSON, and binary stream bypasses

Addresses #172

Test plan

  • 2872 tests pass (79 files, 37 skipped)
  • TypeScript typecheck clean
  • Prettier + ESLint clean
  • 7-agent CR Round 1: 0 bucket (a) findings
  • 5 new tests: NDJSON progressive timing, NDJSON content-type preservation, Bedrock progressive timing, Bedrock content-type preservation, SSE anti-buffering headers

jpr5 added 2 commits May 11, 2026 10:08
anti-buffering headers

Extend the SSE progressive streaming relay to also cover
application/x-ndjson (Ollama) and application/vnd.amazon.eventstream
(Bedrock). Previously these were fully buffered before relay, which
could trip downstream HTTP idle timeouts on slow calls.

Add standard anti-buffering headers (Cache-Control: no-cache,
Connection: keep-alive, X-Accel-Buffering: no) to all progressive
stream relay paths, preventing reverse proxies from buffering the
response.

Widen onHookBypassed reason type to distinguish SSE, NDJSON, and
binary stream bypasses.
Add 5 tests: NDJSON progressive timing, NDJSON content-type
preservation, Bedrock binary stream progressive timing, Bedrock
content-type preservation, SSE anti-buffering headers verification.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 11, 2026

Open in StackBlitz

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

commit: 4d64d20

@jpr5 jpr5 self-assigned this May 11, 2026
@jpr5 jpr5 merged commit 693b1bb into main May 11, 2026
23 checks passed
@jpr5 jpr5 deleted the blitz/streaming-relay/integration branch May 11, 2026 17:56
jpr5 added a commit that referenced this pull request May 11, 2026
## Summary

Follow-up quality sweep addressing 30 issues surfaced by 7-agent CR on
PR #175, complementing the broader sweep in #176.

**Recorder proxy relay** — forward HTTP method instead of hardcoding
POST, clear response timeout after completion, fix client-disconnect
handler to check `writableFinished` before destroying upstream, wrap
hook callbacks in try/catch, override audio content-type on error relay,
atomic fixture writes, toolCall sanitization, tighter video detection

**Server error handling** — deferred splice for one-shot error fixtures,
SyntaxError guard on Azure injection catch, fixture-level chaos
evaluation for non-completions endpoints, fal body double-consumption
fix, fal PUT body support

**Test hygiene** — tmpDir leak fix, global fetch replaced with node:http
helpers, try/finally fixture cleanup, deduplicated helpers, explicit
mock properties, resource guard on setup helper

## Test plan

- [x] 2872 tests pass (79 files, 37 skipped)
- [x] TypeScript typecheck clean
- [x] Prettier + ESLint clean
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