Skip to content

fix(realtime): strip Omit/NotGiven in ConnectionManager.send pre-connect - #3627

Open
Xsidz wants to merge 1 commit into
openai:mainfrom
Xsidz:fix/realtime-manager-send-omit
Open

fix(realtime): strip Omit/NotGiven in ConnectionManager.send pre-connect#3627
Xsidz wants to merge 1 commit into
openai:mainfrom
Xsidz:fix/realtime-manager-send-omit

Conversation

@Xsidz

@Xsidz Xsidz commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Fixes #3402.

AsyncRealtimeConnectionManager.send() and RealtimeConnectionManager.send() called json.dumps(event) directly on dict payloads without first running maybe_transform(). The post-connect connection.send() paths already wrap with maybe_transform / async_maybe_transform to strip Omit / NotGiven sentinels before serialization — the pre-connect manager paths were missing this step, causing:

TypeError: Object of type Omit is not JSON serializable

The fix adds maybe_transform(event, RealtimeClientEventParam) to both manager send() paths, matching the existing post-connect behavior. Both managers have synchronous send() signatures (queuing for later dispatch), so maybe_transform (not the async variant) is correct here.

Test plan

  • tests/test_models.py and tests/test_transform.py: 114 passed, 0 failures.
  • Ruff lint: all checks passed.
  • maybe_transform was already imported in the file — no import changes needed.

Fixes openai#3402: the pre-connect manager send() paths called json.dumps()
directly on dict events without running maybe_transform(), so passing
omit or not_given values raised TypeError. Mirror the post-connect
connection.send() behavior by wrapping with maybe_transform().
@Xsidz
Xsidz requested a review from a team as a code owner August 16, 2026 17:07
Copilot AI lite review requested due to automatic review settings August 16, 2026 17:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Pre-connect Realtime manager.send crashes on Omit in dict events

2 participants