← Back to Pull requests

Expose VAD threshold and barge-in controls in the packaged audio client #722

Closed
unknown closed this pull request without merging on Oct 30, 2026 15:24 UTC
View on GitHub
unknown unknown commented on Oct 15, 2026 09:38 UTC
Author

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

Diff: 263 lines (+197 / -66) across 3 files Reviewer: jackboyla Review duration: 21945m
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
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.3% (MEDIUM) · Higher = larger blast radius
39.3%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.5% · Safe to merge
15.5%