Skip to content

Fix redundant Voice Live response cancellation on speech start - #380

Open
Yulin Li (yulin-li) wants to merge 1 commit into
Azure-Samples:masterfrom
yulin-li:fix/voicelive-service-interruption
Open

Fix redundant Voice Live response cancellation on speech start#380
Yulin Li (yulin-li) wants to merge 1 commit into
Azure-Samples:masterfrom
yulin-li:fix/voicelive-service-interruption

Conversation

@yulin-li

Copy link
Copy Markdown
Contributor

Purpose

Voice Live already interrupts the active response when it detects user speech. The Python, JavaScript, Java, and .NET Agent V2 quickstarts redundantly cancel that response again when handling input_audio_buffer.speech_started.

Remove the four automatic cancellation calls, their response-state flags, and cancellation-specific error suppression. Keep immediate local playback clearing, proactive greetings, audio processing, session configuration, and authentication unchanged. There are no manual response-cancellation calls or explicitly disabled automatic-interruption cases in these samples.

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone --branch fix/voicelive-service-interruption https://github.com/yulin-li/cognitive-services-quickstart-code.git
cd cognitive-services-quickstart-code
  • Test the code
python3 -m py_compile python/Speech/voice-live-with-agent-v2.py
node --check javascript/speech/voice-live-with-agent-v2.js
dotnet build dotnet/Speech/VoiceLiveWithAgent.csproj
mvn -q -f java/Speech/pom-agent.xml dependency:build-classpath -Dmdep.outputFile=/tmp/voicelive-classpath.txt
mkdir -p /tmp/voicelive-classes
javac -encoding UTF-8 --release 11 -cp "$(cat /tmp/voicelive-classpath.txt)" -d /tmp/voicelive-classes java/Speech/VoiceLiveWithAgentV2.java

Python syntax parsing, JavaScript syntax checking, the .NET build, and direct Java compilation passed. Isolated before/after Python and JavaScript event checks reproduced the redundant cancels on the base revision and confirmed none are sent after this change, while playback clearing, subsequent audio, proactive greetings, and error reporting remain functional.

What to Check

Verify that the following are valid

  • Speaking over a response still clears local playback immediately, without sending a second service cancellation.
  • Later response audio still plays, and service errors are surfaced instead of special-casing cancellation errors.
  • The change covers all four Voice Live runtime clients in this repository; agent-creation helpers and code-in-documentation were also audited for copies and interruption overrides.

Other Information

No live microphone/service session was run. No SDK APIs, dependencies, authentication, unrelated services, or agent-creation configuration were changed.

Let the service interrupt active responses and keep local playback clearing in the Python, JavaScript, Java, and .NET agent quickstarts. Remove cancellation-only state and error suppression.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@yulin-li
Yulin Li (yulin-li) marked this pull request as ready for review September 6, 2026 17:20
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.

1 participant