Repository navigation
[PR] fix: parse and rewrite complete core-loop SSE payloads - #6619
Merged
ranxianglei merged 1 commit intoNov 14, 2026
Merged
Conversation
This was referenced Nov 13, 2026
This was referenced Nov 14, 2026
Owner
|
Superseded by #6677 (merged as Landed into master via the real merge commit The fix for #6614 is now in master. Closing this PR as superseded — thanks for the careful, well-tested fix. |
This was referenced Nov 15, 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 #6614
Problem
Core-loop SSE readers and rewriters disagree about the event boundary. OpenAI and Gemini parse only the first
data:field. Anthropic already reads the complete event, but its index, usage and prose rewrites parse each data line independently. A legal multiline JSON payload therefore loses replies, retains stale start usage, or reuses a client content-block index across continuation rounds.A real loopback upstream exercised through
startServerreproduces all three failures on master: OpenAI emits an empty successful stop, Gemini reports a truncated stream, and Anthropic emits three content-block starts with only two distinct indices during a signed-thinking/status/continuation exchange. All equivalent single-line exchanges pass.Change
Read all data fields as one LF-joined payload. For existing rewrites, replace the complete payload while preserving event/id/retry/comment fields and the terminal blank line. Unedited frames retain their original data lines. OpenAI and Gemini buffered real-tool replay prefix each physical payload line with
data:so accepted multiline calls remain valid SSE. The Gemini JSON-array reader applies the same framing when synthesizing SSE from formatted JSON elements.The change covers the three affected standard compression-loop adapters together. Responses remains a passing control. No compression policy, retry budget, tool argument string, or signed thinking text/signature is changed.
Validation
Base:
e1f31ad9d5b47500362699a9867819b861c7de96(0.1.213), Node v24.22.1.git diff --check: pass.The HTTP tests use a hermetic upstream speaking supported wire formats; they do not claim live-provider coverage. The local Codex prerequisite probe found no reachable upstream at
127.0.0.1:8199, so the real-client four-phase E2E remains a hosted/integration gate. Full regression is the GitHub CI verdict on this head.Related work and scope
All-state searches and file-diff checks distinguished #260 (plugin passthrough / Responses), #6102 (summary readers) and #6603 (CloudCode v1 envelopes). None repairs these standard core-loop readers and rewriters. The source protocol requirement is the SSE event interpretation algorithm.
Topic N, cross-client; suggested
bug,p1,scope/wiring, as recorded in #6614.