A valid event stream prefixed with the UTF-8 bytes EF BB BF does not recognize its first field. If that field is event: message_start, the accumulator can miss the start event; if it is data:, JSON parsing can fail because the first payload was ignored.
Reproduce by prefixing the existing basic_response.txt fixture and serving it through a mocked messages endpoint. Both synchronous/asynchronous and stable/beta streaming helpers fail. The same fixture without the prefix works.
The SSE interpretation algorithm removes one leading BOM, while later U+FEFF characters remain content. Reference: https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation.
Forty-eight real-client regression cases cover first-field order, transport chunking, sync/async and stable/beta helpers. The 24 prefixed cases fail on unchanged main and the 24 unprefixed controls pass. The fixture also includes U+FEFF in response text and a later field name. No live API calls are involved.
A valid event stream prefixed with the UTF-8 bytes EF BB BF does not recognize its first field. If that field is event: message_start, the accumulator can miss the start event; if it is data:, JSON parsing can fail because the first payload was ignored.
Reproduce by prefixing the existing basic_response.txt fixture and serving it through a mocked messages endpoint. Both synchronous/asynchronous and stable/beta streaming helpers fail. The same fixture without the prefix works.
The SSE interpretation algorithm removes one leading BOM, while later U+FEFF characters remain content. Reference: https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation.
Forty-eight real-client regression cases cover first-field order, transport chunking, sync/async and stable/beta helpers. The 24 prefixed cases fail on unchanged main and the 24 unprefixed controls pass. The fixture also includes U+FEFF in response text and a later field name. No live API calls are involved.