Expose VAD threshold and barge-in controls in the packaged audio client #722
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 263 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.334
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #722"
general
weight: 0.35
jackboyla
The server already honors turn_detection.threshold and interrupt_response, but the packaged microphone client had no way to set them. It always sent interrupt_response=true, and it cleared its playback on every input_audio_buffer.speech_started. So even with interruption off on the server, the reply still got cut off on the client side.
I added vad_threshold and interrupt_response to RealtimeAudioClientConfig, and build_session_update now sends them in turn_detection. vad_threshold defaults to None, so it is left out of the session update unless you set it. interrupt_response defaults to true, so nothing changes for existing users. talk gets --vad-threshold and --interrupt-response / --no-interrupt-response, local gets --local_audio_vad_threshold and --local_audio_interrupt_response, and YAML runtime.client picks up both fields. Values outside 0 to 1, inf and nan are rejected. If no threshold is set, the server's --thresh still applies.
handle_server_event now only clears playback on speech_started when interruption is on. A cancelled response.done and output_audio_buffer.cleared still clear it.
The reproduction from the issue is now a test in test_audio_client.py. It sends the client's session update to RealtimeService with threshold 0.8 and interruption off, dispatches a speech start during an active response, and feeds the resulting events through the client session loop with fake audio streams. The queued audio still plays and mic chunks are still sent. I also added tests for threshold validation, the cancel and clear events, the talk and local flags, and the YAML fields. The Realtime README now shows the session payload, explains how it differs from --block-mic-during-playback, and says other clients need to skip the playback clear on speech start too.
Locally ruff check, ruff format --check and the audio client tests pass, and so do the new cases in test_config.py and test_configured_runtime.py. I can't install the full model stack on my machine, so the rest of those files and the CLI parser tests (they import s2s_pipeline) will only run in CI.
Closes #712