fix: preserve explicitly provided send queues - #3742
Conversation
|
Focused regression tests and repository formatting checks pass on the current head ( |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Changes being requested
WebSocket connection constructors replace an explicitly supplied empty
SendQueuebecauseSendQueue.__bool__is false when empty.Reproduction
SendQueue(max_bytes=0).Expected: the connection retains the supplied queue, including its configured limits and identity.
Actual: the truthiness check constructs a new default
SendQueue, discarding the supplied queue.Root cause and changes
The constructors used
send_queue or SendQueue(). An empty queue is a valid configured dependency, but its falsey value was treated as if no queue had been supplied.is not Nonecheck in the six affected realtime and responses connection constructors.Additional context & links
Validation
uv run --no-project --with-editable . --with pytest python -m pytest -c /dev/null --rootdir=. --noconftest -o addopts='' -q tests/test_websocket_send_queue.py— 6 passed.ruff check src/openai/resources/beta/responses/responses.py src/openai/resources/realtime/realtime.py src/openai/resources/responses/responses.py tests/test_websocket_send_queue.py— passed.ruff format --check src/openai/resources/beta/responses/responses.py src/openai/resources/realtime/realtime.py src/openai/resources/responses/responses.py tests/test_websocket_send_queue.py— passed.This preserves caller-provided queue identity and configuration. Default construction is unchanged when
send_queueisNone; no public API signatures change.