feat(realtime): add private translation WebSocket transport - #3871
jbeckwith-oai wants to merge 3 commits into
Conversation
Castiron custom code✅ No new custom-code files detected. 46 mixed files remain; 0 existing customizations changed. Compared 46 existing customizations unchanged
6 more in the full report. A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 35056205891 --repo openai/openai-python \
--name castiron-custom-code-35056205891-1 --dir /tmp/castiron-custom-code-35056205891-1
git apply --stat /tmp/castiron-custom-code-35056205891-1/custom-code.patch
cat /tmp/castiron-custom-code-35056205891-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 98e1d24f4902ab58830adf0e2b6a729a5d5429b1 189f5431ee40d58cab79f5d98fe03d0a22fbad2a
python3 scripts/castiron/custom_code_report.py report \
--base 98e1d24f4902ab58830adf0e2b6a729a5d5429b1 \
--head 189f5431ee40d58cab79f5d98fe03d0a22fbad2a --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-189f5431ee40
cat /tmp/castiron-custom-code-189f5431ee40/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
markstuart-oai
left a comment
There was a problem hiding this comment.
Reviewed 9255036de3ba48c18892fb34ba89bdde9174cfaa against 98e1d24f4902ab58830adf0e2b6a729a5d5429b1. Leaving feedback without approval for a cancellation hang in failure cleanup. A real loopback peer that stops reading leaves both a directly cancelled send and an AnyIO-cancelled startup flush pending beyond the default close timeout. The shielded close cannot reach its timeout while it is blocked draining the same socket.
Authentication and ordinary transport behavior otherwise check out: the independent auth review passed six boundary probes; 51 focused transport/queue tests pass; real sync/async wire probes confirm FIFO startup frames, one raw error delivery, an uncompressed frame over 1 MiB, normal remote close, and unsent reporting after close. Source stays private and the generated adapter remains out of scope.
Exact-head CI run 35055191611 passes Python 3.10/3.14, HTTPX2, lint and build; Python 3.10's Pydantic lanes report 13,182 and 13,168 passed. Security and custom-code checks also pass. Local probes used the existing Python 3.10 environment with websockets 15.0.1 and AnyIO 4.12.1, not a fresh locked installation. No live API calls or generated-adapter integration tests were run.
Changes being requested
Adds private synchronous and asynchronous WebSocket transport support for a future generated Realtime Translation resource. Connections refresh callable API keys through the existing client hooks, reuse the protected async connector and sync redirect rejection, and report failed or unsent frames without reconnecting or replaying them.
Startup queues are fully flushed, including messages added during a flush. Failure cleanup preserves cancellation, shields async cleanup from AnyIO cancellation, and allows up to 10 seconds for graceful close before aborting a transport that cannot close. API error events are delivered through a single raw receive path. Incoming messages have no new fixed size limit; callers can still specify a limit.
This is SDK infrastructure only: there is no new public client resource, generated adapter, event model, or exported public API. Both new files are handwritten; generated ownership and custom-code budget metadata are unchanged.
Validation
Additional context & links
Generated resource integration and adapter-level tests are intentionally deferred. No reconnect system, WebRTC, or changes to existing Realtime resources are included.