fix(live): preserve caller queues and prevent uncertain WebSocket replay (#3980)
If a Live connection opened with an empty manager queue, iterator recovery lost the caller's queued messages and byte budget. A typed command could also be sent again after the first socket actually received it but its send raised. Keep the passed queue even when empty and drop only the attempted message on a failed send/flush, leaving unattempted messages ordered. This matches the merged Realtime handling. Primary, fork and sideband fixes are separate commits for review. No startup, auth, default reconnect, imports or public method signatures change. Direct send errors still raise; queued flush failures still log the existing warning. The Live helper notes describe the recovery and recording-error policy. Validation: - Baseline: 337 Live/redirect tests pass under both Pydantic 1 and 2. - Reproduced all 18 queue/replay failures using actual loopback wire delivery, then 42 role tests pass, including per-role error/unknown-event/close ordering and helper disposal. - Final 399 Live, protected dial, Realtime and send-queue tests pass in each Pydantic lane; Ruff and full SDK Mypy (1,865 source files) pass. - Trusted main budget/isolation pass: 7,826/10,000 with unchanged generated snapshot. Independent review found only the queued-error doc clarification, which is included.
M
Mark Stuart committed
80e96860b5ccbfcf4a1c9dd9947fc31cd021037a
Parent: 78074d7
Committed by GitHub <noreply@github.com>
on 9/28/2026, 2:31:23 PM