FE-1604: Allow Voice interruption by speaking - #9550
Draft
kostandinang wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
kostandinang
force-pushed
the
kostandin/fe-1604-allow-voice-interruption-by-speaking
branch
from
September 6, 2026 12:54
ae46593 to
435d7dd
Compare
Amp-Thread-ID: https://ampcode.com/threads/T-01a0772c-6fce-752a-9778-480fa5209c5c Co-authored-by: Amp <amp@ampcode.com>
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.
🌟 What is the purpose of this PR?
This PR lets a person interrupt Voice assistant playback by speaking without losing the interrupting utterance. It keeps the existing Your turn handoff as an optional half-duplex fallback and locally rejects likely false interruption transcripts before they become answers.
The change is stacked directly on #9531, which owns the shared Brunch Voice session, completed-transcript authority, canonical playback, and acknowledged manual handoff.
🔗 Related links
🚫 Blocked by
voice-interview-control.test.tsx🔍 What does this change?
speech_started → response.cancel → output_audio_buffer.clear. Interruption never clears the input buffer, and transcript validation does not gate cancellation.Completed-transcript hardening
A false VAD event can cause
gpt-4o-transcribeto repeat its vocabulary prompt or transcribe assistant playback. The Realtime bridge now runs a deterministic classifier only for completed interruption-originated transcripts, before retaining or submitting them:The transcription model and prompt remain unchanged. The prompt is shared between provider configuration and local validation to avoid drift. No extra model call, acoustic processing, debounce, or cancellation delay is introduced.
Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
📜 Does this require a change to the docs?
libs/@hashintel/petrinaut/docs/ai-assistant.mdandapps/petrinaut-website/README.mddocument interruption, retained answers, local rejection, and the manual fallback.🕸️ Does this require a change to the Turbo Graph?
voice-interview-control.test.tsx. These were reproduced before editing at the prior PR head, and the same six tests fail after hardening. This change does not fix or suppress them.🛡 What tests cover this?
The prompt-leak and canonical-echo regression tests were written first and observed failing before implementation. Coverage includes immediate cancellation, short novel answers, unchanged ordinary capture, duplicate completions, delayed/pending admission, active-playback-only snapshots, and lifecycle cleanup.
Current hardening verification:
yarn workspace @apps/petrinaut-website test:unit src/main/app/voice-interview src/server/voice src/voice-diagnostics.test.ts --exclude '**/voice-interview-control.test.tsx'yarn workspace @apps/petrinaut-website test:unit: 350 passed, 6 failed, compared with 317 passed, 6 failed before editing. The failing test names and maximum-update-depth error are unchanged.yarn workspace @apps/petrinaut-website build: passed.yarn workspace @apps/petrinaut-website lint:tsc: passed.yarn workspace @apps/petrinaut-website lint:eslint: passed with zero errors and one existingset-state-in-effectwarning in the unchanged control component.yarn workspace @local/petrinaut-arch-docs lint:arch-docs: passed.yarn lint:formatandgit diff --check: passed.Earlier PR verification recorded 618/618 Petrinaut library unit tests and passing library TypeScript checks. Those library checks were not rerun for this website-only runtime hardening; the library change in this increment is documentation only.
❓ How to test this?