71281fb266
An empty `data:` frame (or a frame carrying only `event:` / `id:`) is a legal SSE no-op, but the OpenAI SDK still hands it to `json.loads`, which raises `JSONDecodeError` with an empty document. The streaming helper translated that into `ProviderStreamError(provider_stream_non_json_data)`, nothing recognised it as recoverable, and the main loop retried streaming -- identically -- until the retry budget ran out: "API call failed after 3 retries: Provider stream returned non-JSON SSE data". A degraded gateway answers EVERY streaming request that way, so the retries only repeated the failure while the same request sent non-streaming succeeded seconds later. An empty document means no payload, which is a different fact from a malformed payload: give it its own code, and when it appears before any delta switch the session to non-streaming (the existing `_disable_streaming` mechanism, already used for "stream not supported", Bedrock IAM denials and adapter-returned final responses) so the retry goes out on a channel the degraded gateway can answer. Non-empty payloads keep today's fatal semantics; failures after deltas keep the existing stream-drop handling. Tests: the turn-level recovery test drives the real SDK decoder over a real httpx response and is red on base (three identical streaming attempts, turn lost); the boundary test pins the malformed-payload path so a future "ignore bad frames" change cannot swallow genuine provider errors.