Repository navigation
[PR] fix: parse complete SSE events during Responses warmup - #7182
Merged
ranxianglei merged 1 commit intoNov 20, 2026
Merged
Conversation
This was referenced Nov 18, 2026
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.
Fixes #7180.
Problem
After an upstream WebSocket upgrade is refused, the empty
generate: falsewarmup reads the HTTP/SSE fallback with a separate parser. It recognizes only LF/LF separators anddata:lines. Valid CRLF, lone CR, ordata:framing therefore ends asincomplete_response; multiline data fields are forwarded as separate, invalid JSON messages. A successful warmup cannot establish its continuation checkpoint.Change
Reuse the existing SSE line-ending and event-data helpers in this warmup reader. Decode each complete event into one WebSocket payload, handle a CR split across chunks, and flush the UTF-8 decoder at EOF. Keep the buffer limit before parsing, require a terminating blank line, and commit history only for
response.completed.Nine regressions use the real local WebSocket client,
startServer, and an HTTP supplier that rejects the upgrade with 426. They cover LF/CRLF/CR, optional space, multiline JSON, byte-fragmented CRLF/UTF-8, failed/incomplete terminals, and an unterminated event. Successful cases also exercise a subsequentprevious_response_idturn and verify forwarded input and authentication.Validation
548e3960, the nine new cases produce 7 failures and 2 passes; its 12 existing fallback cases and baseline typecheck pass.3f0c1d21; rebuilt this worktree'sacp-kernel0.0.199 and pi-subagents 0.2.4, with both packages resolved to this worktree.npm run typecheck,npm run build,npm run check:test-import-graph, andgit diff --checkpass.The fallback in #3447 retained this parser; #6853 changes the loop adapters. The current warmup reader and all three historical warmup variants retain the defect. No equivalent change was found across 266 fork heads or 315 upstream file-history commits.