Skip to content

Handle keepalive events in Responses streams#1965

Open
koriyoshi2041 wants to merge 1 commit into
openai:mainfrom
koriyoshi2041:fix-response-stream-keepalive
Open

Handle keepalive events in Responses streams#1965
koriyoshi2041 wants to merge 1 commit into
openai:mainfrom
koriyoshi2041:fix-response-stream-keepalive

Conversation

@koriyoshi2041

Copy link
Copy Markdown

Problem
Responses streaming can receive keepalive SSE events on long-running requests. They do not carry Response state, but the accumulator currently falls through to the exhaustive error path and ends the stream. Fixes #1964.

Fix
Treat keepalive as a no-op accumulator event, alongside other stream events that do not map onto the Response snapshot. Unknown event types still go through the existing error path.

Test

  • pnpm test tests/lib/ResponseAccumulator.test.ts
  • pnpm exec prettier --check src/lib/responses/ResponseAccumulator.ts tests/lib/ResponseAccumulator.test.ts
  • pnpm build
  • git diff --check

Risk
Low. This only ignores the explicit keepalive event; it does not change handling for normal response deltas or undocumented unknown event types.

@koriyoshi2041 koriyoshi2041 requested a review from a team as a code owner July 3, 2026 02:37
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.

v6.45.0 can't handle stream keepalive events

1 participant