Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Twilio sends media continuously, including silence. The Python adapter queues every batch, so the shared response drain never sees the arrival gap that ends a spoken turn. This ports the inbound speech gate already used by the JavaScript adapter in #990.
Closes #991.
What changed
speech_gate=TwilioSpeechGateOptions(...)andspeech_gate=False. Gate decoded inbound audio before queue delivery; terminal chunks always reach the consumer.0x7Fencodes silence. Document the Python controls and update the JS counterpart pointer.Test plan
From
python/:test_media_loop_gates_quiet_batches_and_preserves_terminalfails on unchanged media handling (15 batches admitted instead of 8).uv run --frozen --no-sync pytest tests/voice/test_twilio*.py tests/voice/test_voice_spans_twilio.py -m 'not integration' -q: 165 passed, 3 live tests deselected.uv run --frozen --no-sync pytest tests/ -v --tb=short -m 'not integration': 1,588 passed, 10 skipped, 62 deselected. Two intentional reruns exercisetest_arun_survives_pytest_reruns.uv run --frozen --no-sync pyright .: zero errors or warnings.How I can prove I was successful
The runnable local transport demonstration is
test_real_route_ends_turn_while_quiet_media_continues. It starts the real uvicorn route, sends µ-law speech followed by continuing silence over a real WebSocket, and asserts thatadapter.call()returns while the stream is still connected and sending. Run it withuv run --frozen --no-sync pytest tests/voice/test_twilio_speech_gate.py -k real_route -qfrompython/.No playable artifact: this is a library transport regression using synthetic PCM, not a recorded telephone conversation. Live PSTN/provider testing has not been performed.
Implementation and local validation by OpenAI Codex.