Skip to content

fix: clean up failed WebSocket setup and honor native options - #4121

Merged
markstuart-oai merged 1 commit into
mainfrom
castiron/promotions/pr-295
Oct 20, 2026
Merged

markstuart-oai merged 1 commit into
mainfrom
castiron/promotions/pr-295

Conversation

@markstuart-oai

Copy link
Copy Markdown
Contributor

Summary

Close acquired WebSocket transports when connection setup fails, and use native synchronous option types for synchronous connections and Translation sessions. Preserve explicit caller options across Realtime, Live, Responses, Translation and legacy Beta Realtime.

Unbounded receives disable implicit compression by default. Finite receive limits keep the native compression default, and callers can explicitly configure compression or extensions. Disabling compression can increase network traffic.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

Evaluated main: 0e5794dc48b8f8d51f6047f8a0b1814eb1e65850.

Trusted main policy: 0e5794dc48b8f8d51f6047f8a0b1814eb1e65850.

✅ No new custom-code files detected.

39 mixed files remain; 0 existing customizations changed; 7 generated baselines changed.

Compared 0e5794dc48b8 → 791ea571192b. Generated baselines verified.

File Result Current custom patch
src/openai/resources/beta/responses/responses.py Generated baseline changed +55 / −55
src/openai/resources/live/forks.py Generated baseline changed +15 / −18
src/openai/resources/live/live.py Generated baseline changed +11 / −6
src/openai/resources/live/sideband.py Generated baseline changed +15 / −18
src/openai/resources/realtime/realtime.py Generated baseline changed +9 / −3
src/openai/resources/realtime/translations/translations.py Generated baseline changed +18 / −2
src/openai/resources/responses/responses.py Generated baseline changed +920 / −74
32 existing customizations unchanged
  • api.md
  • src/openai/init.py
  • src/openai/_client.py
  • src/openai/resources/audio/transcriptions.py
  • src/openai/resources/audio/translations.py
  • src/openai/resources/beta/agents/environments/files.py
  • src/openai/resources/beta/agents/sessions/artifacts.py
  • src/openai/resources/beta/agents/sessions/sessions.py
  • src/openai/resources/beta/beta.py
  • src/openai/resources/beta/threads/runs/runs.py
  • src/openai/resources/beta/threads/threads.py
  • src/openai/resources/chat/completions/completions.py
  • src/openai/resources/embeddings.py
  • src/openai/resources/files.py
  • src/openai/resources/realtime/api.md
  • src/openai/resources/uploads/uploads.py
  • src/openai/resources/vector_stores/file_batches.py
  • src/openai/resources/vector_stores/files.py
  • src/openai/resources/videos.py
  • src/openai/resources/webhooks/init.py
  • src/openai/resources/webhooks/webhooks.py
  • src/openai/types/decision_input_image_param.py
  • src/openai/types/decision_input_text_param.py
  • src/openai/types/fine_tuning/fine_tuning_job_integration.py
  • src/openai/types/realtime/conversation_item_input_audio_transcription_delta_event.py
  • src/openai/types/realtime/realtime_error_event.py
  • src/openai/types/responses/tool.py
  • src/openai/types/responses/tool_param.py
  • src/openai/types/webhooks/init.py
  • src/openai/types/webhooks/live_call_incoming_webhook_event.py
  • src/openai/types/webhooks/unwrap_webhook_event.py
  • tests/api_resources/test_videos.py

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 39459981097 --repo openai/openai-python \
  --name castiron-custom-code-39459981097-1 --dir /tmp/castiron-custom-code-39459981097-1
git apply --stat /tmp/castiron-custom-code-39459981097-1/custom-code.patch
cat /tmp/castiron-custom-code-39459981097-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 0e5794dc48b8f8d51f6047f8a0b1814eb1e65850 791ea571192b0c628bef4fdffe32e17ab33eeb7c
python3 scripts/castiron/custom_code_report.py report \
  --base 0e5794dc48b8f8d51f6047f8a0b1814eb1e65850 \
  --head 791ea571192b0c628bef4fdffe32e17ab33eeb7c --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-791ea571192b
cat /tmp/castiron-custom-code-791ea571192b/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@markstuart-oai
markstuart-oai marked this pull request as ready for review October 20, 2026 03:10
@markstuart-oai
markstuart-oai requested a review from a team as a code owner October 20, 2026 03:10
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T16:45:32.908194Z 791ea57 New commits
🔒 Security Review ✅ Completed 2026-10-20T16:47:30.939729Z 791ea57 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openai-sdks

openai-sdks Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

OkTest Summary

✅ 236/236 SDK tests passed in 9.832s for Python SDK PR #4121.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 201ms
tests/chat-completions-create.test.ts ✅ Passed 273ms
tests/chat-completions-stream.test.ts ✅ Passed 287ms
tests/files-content-binary.test.ts ✅ Passed 192ms
tests/files-create-multipart.test.ts ✅ Passed 316ms
tests/files-list-pagination.test.ts ✅ Passed 251ms
tests/initialize-config.test.ts ✅ Passed 188ms
tests/instance-isolation.test.ts ✅ Passed 194ms
tests/models-list.test.ts ✅ Passed 207ms
tests/responses-background-lifecycle.test.ts ✅ Passed 204ms
tests/responses-body-method-errors.test.ts ✅ Passed 333ms
tests/responses-cancel-timeout.test.ts ✅ Passed 267ms
tests/responses-cancel.test.ts ✅ Passed 205ms
tests/responses-compact-retries.test.ts ✅ Passed 343ms
tests/responses-compact.test.ts ✅ Passed 190ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 194ms
tests/responses-create-advanced.test.ts ✅ Passed 234ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.216s
tests/responses-create-errors.test.ts ✅ Passed 201ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 247ms
tests/responses-create-retries.test.ts ✅ Passed 252ms
tests/responses-create-stream-failures.test.ts ✅ Passed 871ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 246ms
tests/responses-create-stream-wire.test.ts ✅ Passed 2.173s
tests/responses-create-stream.test.ts ✅ Passed 236ms
tests/responses-create-terminal-states.test.ts ✅ Passed 294ms
tests/responses-create-timeout.test.ts ✅ Passed 263ms
tests/responses-create.test.ts ✅ Passed 622ms
tests/responses-delete.test.ts ✅ Passed 202ms
tests/responses-input-items-errors.test.ts ✅ Passed 656ms
tests/responses-input-items-list.test.ts ✅ Passed 360ms
tests/responses-input-items-options.test.ts ✅ Passed 380ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 252ms
tests/responses-input-tokens-count.test.ts ✅ Passed 209ms
tests/responses-malformed-inputs.test.ts ✅ Passed 1.166s
tests/responses-not-found-errors.test.ts ✅ Passed 255ms
tests/responses-parse.test.ts ✅ Passed 266ms
tests/responses-retrieve-retries.test.ts ✅ Passed 217ms
tests/responses-retrieve.test.ts ✅ Passed 244ms
tests/responses-stored-method-errors.test.ts ✅ Passed 529ms
tests/retry-behavior.test.ts ✅ Passed 2.956s
tests/sdk-error-shape.test.ts ✅ Passed 292ms

View OkTest run #39459917926

SDK merge (eab7d7ca34ff) · head (791ea571192b) · base (0e5794dc48b8) · OkTest (6c2b4334784c)

Comment thread tests/lib/test_beta_realtime_websocket_options.py Fixed
@markstuart-oai
markstuart-oai force-pushed the castiron/promotions/pr-295 branch from f0bbe5b to fc25578 Compare October 20, 2026 03:15

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved at fc25578. Reviewed the public diff and independently verified promotion parity with approved internal #295 at 65a672c7: all 16 changed source/test/manifest files match exactly, with only public-codegen metadata differing. Supporting WebSocket helpers, client and dependency configuration also match.

No actionable findings. Failed entry closes the acquired transport while preserving the original exception; synchronous options use the native synchronous type. Unlimited receives disable implicit compression, while explicit limits, compression and extensions remain preserved. The increased-network-traffic tradeoff is documented. The compiler source change has merged.

Hosted checks passed or were appropriately skipped, and exact-head OkTest passed 236/236. Static review only; no candidate code or tests were run locally.

@markstuart-oai
markstuart-oai force-pushed the castiron/promotions/pr-295 branch from fc25578 to f28ed29 Compare October 20, 2026 03:44

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-approved after static incremental review. Exact old/new commit tree comparison shows only the generated WebSocket compression test changed; the complete updated file matches approved internal #295 at 336965e2. The 18 added cases verify exact receipt above 2 MiB across nine routes in sync/async modes without implicit compression. No actionable findings. Hosted CI/OkTest are still running; no local candidate code or tests executed.

@markstuart-oai
markstuart-oai force-pushed the castiron/promotions/pr-295 branch from f28ed29 to 0dec5f3 Compare October 20, 2026 04:11

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-approved after independent static review and exact old/new tree comparison. Only two test files changed, both byte-identical to approved internal #295 at 3f51cc8b: the bounded WebSocket peer-readiness barrier and atomic descendant-PID publication. Both preserve the substantive assertions; runtime files are unchanged. No actionable findings. Hosted Python3.10/3.14 and HTTPX2 checks now pass, and OkTest reports 236/236. No candidate code or tests executed locally.

Castiron-Internal-PR: openai/openai-python-internal#295
Castiron-Source-SHA: 5fbf16077384d56a8645730663af13b8d2834ff6
Castiron-Public-Base-SHA: 0e5794d
@markstuart-oai
markstuart-oai force-pushed the castiron/promotions/pr-295 branch from 0dec5f3 to 791ea57 Compare October 20, 2026 16:43

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after coordinator and independent static review of 791ea57 against approved 0dec5f3. The eight changed source/schema/test blobs match current main; generation statistics and manifest reflect that update, including verified hashes for the six inherited compaction type files. Prior WebSocket implementation and tests are byte-identical. No new actionable findings. Hosted CI is still running; no candidate code or tests executed locally.

@markstuart-oai
markstuart-oai added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit b1a1a10 Oct 20, 2026
31 checks passed
@markstuart-oai
markstuart-oai deleted the castiron/promotions/pr-295 branch October 20, 2026 18:08
@openai-sdks openai-sdks Bot mentioned this pull request Oct 20, 2026
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-openai__openai-python that referenced this pull request Oct 20, 2026
Project API-key updates require scopes, an expiration, or both. Record
this existing rule with required-only `anyOf`, and supply valid scopes
bodies in synchronous and asynchronous update tests.

Runtime source, WebSocket documentation, and published WebSocket tests
are unchanged from the public baseline, including the defaults
introduced in openai#4121.

Validation: 340 published WebSocket tests passed; the reporting-helper
suite passed (99 tests, one skipped); scoped lint and formatting passed.
The trusted public-main custom-code budget is 7,352 / 10,000. Two fresh
independent adversarial review rounds were clean. Current hosted
validation is tracked on this PR.

Co-authored-by: jbeckwith-oai <269036200+jbeckwith-oai@users.noreply.github.com>
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.

3 participants