Skip to content

fix(examples): stop microphone capture between recordings - #4143

Merged
marcuswood-oai merged 2 commits into
mainfrom
marcuswood/fix-push-to-talk-recording
Oct 21, 2026
Merged

marcuswood-oai merged 2 commits into
mainfrom
marcuswood/fix-push-to-talk-recording

Conversation

@marcuswood-oai

@marcuswood-oai marcuswood-oai commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Keep the microphone lifecycle aligned with the K recording toggle in the Realtime push-to-talk example. Open a stream only when recording is enabled and the connection is ready, abort and close it when recording stops, and create a fresh stream on resume so queued samples do not carry into the next recording.

Validation:

  • Local checks with fake audio and network objects covered recording transitions, connection readiness, manual turn commits, cleanup, and stopping during an upload.
  • Repository Ruff checks and changed-file formatting checks pass.
  • No live microphone or API session was exercised.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

Evaluated main: c99df7b87d214094eb819267575e06ecc8c7c71c.

Trusted main policy: c99df7b87d214094eb819267575e06ecc8c7c71c.

✅ No new custom-code files detected.

42 mixed files remain; 0 existing customizations changed.

Compared c99df7b87d21 → e21bab2ceacf. Generated baselines verified.

42 existing customizations unchanged
  • api.md
  • scripts/castiron/custom_code_budget.py
  • scripts/castiron/test_custom_code_budget.py
  • scripts/castiron/test_custom_code_github.py
  • 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/responses/responses.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/live/forks.py
  • src/openai/resources/live/live.py
  • src/openai/resources/live/sideband.py
  • src/openai/resources/realtime/api.md
  • src/openai/resources/realtime/realtime.py
  • src/openai/resources/realtime/translations/translations.py
  • src/openai/resources/responses/responses.py
  • 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

2 more in the full report.

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

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

git fetch --no-tags origin c99df7b87d214094eb819267575e06ecc8c7c71c e21bab2ceacff4df012d359e27933059e642bb4a
python3 scripts/castiron/custom_code_report.py report \
  --base c99df7b87d214094eb819267575e06ecc8c7c71c \
  --head e21bab2ceacff4df012d359e27933059e642bb4a --target-branch main --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-e21bab2ceacf
cat /tmp/castiron-custom-code-e21bab2ceacf/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

@marcuswood-oai
marcuswood-oai marked this pull request as ready for review October 21, 2026 19:52
@marcuswood-oai
marcuswood-oai requested a review from a team as a code owner October 21, 2026 19:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T19:54:23.452339Z e21bab2 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-21T19:54:53.804182Z e21bab2 Draft marked ready
ℹ️ 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.

@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 e21bab2 with an independent static review. No blocking issues found. Microphone capture starts only after recording is enabled and the connection is available; the flag is rechecked after waiting. Stop aborts/closes the stream, resume creates a fresh stream, and finally handles worker cancellation or start failure. Stream access has no await boundary between eligibility checks and reading, so the key handler cannot close the stream midway through a read on this event loop. Existing in-flight upload behavior is unchanged.

Hosted checks are complete; OkTest and validation checks pass, with conditional jobs skipped. No candidate code, tests, microphone capture, or live API session was executed locally.

@marcuswood-oai
marcuswood-oai added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit 26e5d92 Oct 21, 2026
36 checks passed
@marcuswood-oai
marcuswood-oai deleted the marcuswood/fix-push-to-talk-recording branch October 21, 2026 20:02
@openai-sdks openai-sdks Bot mentioned this pull request Oct 21, 2026
gh-actions-shared Bot pushed a commit to xf-qubit/openai-python that referenced this pull request Oct 22, 2026
Automated Release PR
---


##
[3.36.1](openai/openai-python@v3.36.0...v3.36.1)
(2026-10-22)


### Bug Fixes

* **api:** honor per-call WebSocket query settings
([openai#4138](openai#4138))
([d40a5e1](openai@d40a5e1))
* **examples:** stop microphone capture between recordings
([openai#4143](openai#4143))
([26e5d92](openai@26e5d92))
* validate browser calls before reading driver state
([openai#4142](openai#4142))
([2bfe460](openai@2bfe460))


### Chores

* **api:** clarify service-account API key deletion
([openai#4151](openai#4151))
([6ed945e](openai@6ed945e))


### Refactors

* prepare handwritten chunked upload runtime
([openai#4146](openai#4146))
([2d58e82](openai@2d58e82))
* prepare handwritten vector-store polling runtime
([openai#4148](openai#4148))
([7cd7028](openai@7cd7028))

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