Skip to content

[PR] fix: parse complete SSE events during Responses warmup - #7182

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-18_parse-warmup-sse
Nov 20, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-18_parse-warmup-sse

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Fixes #7180.

Problem

After an upstream WebSocket upgrade is refused, the empty generate: false warmup reads the HTTP/SSE fallback with a separate parser. It recognizes only LF/LF separators and data: lines. Valid CRLF, lone CR, or data: framing therefore ends as incomplete_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 subsequent previous_response_id turn and verify forwarded input and authentication.

Validation

  • On the unchanged reproduction base 548e3960, the nine new cases produce 7 failures and 2 passes; its 12 existing fallback cases and baseline typecheck pass.
  • Rebased onto current master 3f0c1d21; rebuilt this worktree's acp-kernel 0.0.199 and pi-subagents 0.2.4, with both packages resolved to this worktree.
  • 86 targeted tests pass across fallback, WebSocket session/history, budget, buffered SSE fields, and terminal framing suites.
  • npm run typecheck, npm run build, npm run check:test-import-graph, and git diff --check pass.
  • Real-model Codex preflight is blocked by the unreachable local upstream on port 8199. The required four-phase Codex run has not run; it remains a pre-merge validation item. A skipped remote E2E lane does not satisfy that gate.

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.

)

Reuse the shared line-ending and data-field parser after HTTP fallback. Preserve terminal boundaries, buffer limits, and successful warmup checkpoints.
@ranxianglei ranxianglei changed the title fix: parse complete SSE events during Responses warmup [PR] fix: parse complete SSE events during Responses warmup Nov 18, 2026
@ranxianglei
ranxianglei merged commit cb4c894 into ranxianglei:master Nov 20, 2026
48 checks passed
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.

Responses WebSocket warmup rejects valid SSE framing after HTTP fallback

2 participants