Skip to content

fix(examples): detect incomplete WebSocket responses - #4187

Merged
markstuart-oai merged 5 commits into
mainfrom
markstuart/websocket-audit-examples-20261026
Oct 28, 2026
Merged

markstuart-oai merged 5 commits into
mainfrom
markstuart/websocket-audit-examples-20261026

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Realtime README, multi-agent Responses sample and Live transcript sample report errors and early closure. The Azure Realtime CLI also rejects unsuccessful terminal responses. It closes its credential, client and connection on normal and error paths.

Only coordinator terminal events end the multi-agent sample; delegated agents may fail or finish while the coordinator continues. The Live reader captures through a bounded listen window, requests session closure, and returns only after session.closed confirms close_requested. It receives final transcript data through that confirmation. Unexpected closure, errors and EOF before or during finalization fail instead of returning partial text. The listen window does not guarantee a complete model answer.

Verification

  • Current Live verification: 223 focused tests pass in both checkouts, including 21 real WebSocket startup/audio/finalization cases for all five close reasons, protocol errors and EOF. The original 15 closure cases fail against the preceding implementation. Scoped Ruff checks and Python 3.10 compilation pass. Hosted Python 3.10, Python 3.14 and HTTPX2 suites passed, along with lint, build, policy, lock and security checks.
  • Earlier checks on the unchanged multi-agent sample: 20 child/coordinator terminal-event combinations passed; Ruff lint/format and the CI type-narrowing check passed.
  • 18 local WebSocket success and failure cases passed for the README, multi-agent and Live samples.
  • Six Azure cases passed against this SDK: completion, protocol error, early close, failed, cancelled and incomplete responses.
  • Azure tests use the real Identity provider with local token and TLS WebSocket fixtures. No Azure cloud service was contacted.
  • Pinned Ruff format/lint, Python 3.10 execution and unchanged custom-code budget guards passed. Generated code and generation metadata are unchanged.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

Evaluated main: a3f430241c4a2e3e25bf79cc7d0148e51795a292.

Trusted main policy: a3f430241c4a2e3e25bf79cc7d0148e51795a292.

✅ No new custom-code files detected.

0 mixed files remain; 0 existing customizations changed.

Compared a3f430241c4a → 24c4e56455b8. Generated baselines verified.

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 40444826529 --repo openai/openai-python \
  --name castiron-custom-code-40444826529-1 --dir /tmp/castiron-custom-code-40444826529-1
git apply --stat /tmp/castiron-custom-code-40444826529-1/custom-code.patch
cat /tmp/castiron-custom-code-40444826529-1/custom-code.patch

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

git fetch --no-tags origin a3f430241c4a2e3e25bf79cc7d0148e51795a292 24c4e56455b8337d99af943dbd1edc7ffd9ca810
python3 scripts/castiron/custom_code_report.py report \
  --base a3f430241c4a2e3e25bf79cc7d0148e51795a292 \
  --head 24c4e56455b8337d99af943dbd1edc7ffd9ca810 --target-branch main --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-24c4e56455b8
cat /tmp/castiron-custom-code-24c4e56455b8/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 27, 2026 17:50
@markstuart-oai
markstuart-oai requested a review from a team as a code owner October 27, 2026 17:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-28T05:30:42.411374Z 4474ba0 Manual request
🔒 Security Review ✅ Completed 2026-10-28T05:31:25.319652Z 4474ba0 Manual request
ℹ️ 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.

@markstuart-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 4474ba0fa8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 4474ba0fa8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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.

Reviewed terminal success/error/EOF handling, requested Live closure and final transcript delivery, receiver cancellation, Azure resource cleanup, and coordinator-only multi-agent termination. No actionable findings.

Static review of commit 4474ba0. Hosted checks show no failures (applicable checks passed; other jobs skipped). No local tests or candidate code were run.

@markstuart-oai
markstuart-oai added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 8559299 Oct 28, 2026
27 checks passed
@markstuart-oai
markstuart-oai deleted the markstuart/websocket-audit-examples-20261026 branch October 28, 2026 05:59
@openai-sdks openai-sdks Bot mentioned this pull request Oct 27, 2026
gh-actions-shared Bot pushed a commit to xf-qubit/openai-python that referenced this pull request Oct 28, 2026
Automated Release PR
---


##
[3.41.0](openai/openai-python@v3.40.0...v3.41.0)
(2026-10-28)


### Features

* **api:** accept typed references in Realtime response inputs
([openai#4189](openai#4189))
([8ecb487](openai@8ecb487))
* **api:** add response tool usage models
([openai#4201](openai#4201))
([55fc500](openai@55fc500))
* **api:** filter agent sessions by metadata
([openai#4200](openai#4200))
([77fd116](openai@77fd116))
* **websocket:** recover queued binary frames after reconnect
([openai#4191](openai#4191))
([f079868](openai@f079868))


### Bug Fixes

* **examples:** detect incomplete WebSocket responses
([openai#4187](openai#4187))
([8559299](openai@8559299))
* **examples:** handle interruptions and disconnects in push-to-talk
([openai#4192](openai#4192))
([35fc9f3](openai@35fc9f3))
* keep consumer fixtures clean under strict Pyright
([openai#4204](openai#4204))
([5012565](openai@5012565))


### Chores

* **api:** document upcoming model shutdowns
([openai#4199](openai#4199))
([5b43cce](openai@5b43cce))
* **api:** update image-model documentation
([openai#4198](openai#4198))
([fa67521](openai@fa67521))
* enforce generated-file ownership
([openai#4193](openai#4193))
([1b37b9a](openai@1b37b9a))
* migrate development type checking to ty
([openai#4202](openai#4202))
([45b9531](openai@45b9531))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: openai-sdks[bot] <284451331+openai-sdks[bot]@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