Skip to content

fix(openai): harden realtime reconnect state - #7092

Draft
russellmartin-livekit wants to merge 1 commit into
mainfrom
openai-realtime-reconnect-hardening
Draft

fix(openai): harden realtime reconnect state#7092
russellmartin-livekit wants to merge 1 commit into
mainfrom
openai-realtime-reconnect-hardening

Conversation

@russellmartin-livekit

Copy link
Copy Markdown
Contributor

Summary

  • serialize websocket sends while replaying committed realtime state
  • discard stale connection-bound client events and settle pending response/chat/item futures
  • close replay-failure sockets and reject updates once the session becomes terminal
  • cancel generic xAI say() work tied to the discarded connection

Why

main already replays committed state, but queued client events and acknowledgement futures survive the failed socket. They can otherwise be sent after replay or leave callers waiting indefinitely.

Test plan

  • uv run pytest tests/test_realtime/test_openai_realtime_reconnect.py tests/test_realtime/test_openai_realtime_model.py tests/test_realtime/test_xai_realtime_model.py --unit
  • uv run ruff format --check on changed Python files
  • uv run ruff check on changed Python files

Discard connection-bound events and settle their waiters before replay so stale work cannot leak onto a replacement socket.
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.

1 participant