Part 4 of 12 · 2 min read
Barge-in: stopping fast and keeping the history honest
Stopping the audio is only half of handling an interruption. What the agent remembers saying has to match what the caller actually heard.
Think of a lecturer who keeps talking over a raised hand versus one who stops mid-sentence — and then, afterward, remembers accurately which half of the sentence the student actually caught.
In plain words: handling an interruption means stopping playback quickly, and separately, correcting the conversation history so the agent doesn't believe it said something the caller never heard.
A worked example. With a 35-word reply interrupted at a random point, talk-over time after detection scales with the detection delay. It runs 149 ms at 100 ms detection, 198 ms at 150 ms, 345 ms at 300 ms, and 632 ms at 600 ms. Separately, if the history keeps the full reply regardless of the interruption, it records about 17 of those 35 words as said that the caller never actually heard. Truncating the history at the interruption point cuts that to 0. Requiring a minimum speech duration before stopping also matters: with no minimum, ordinary noise (a cough, a door) triggers 30 false barge-ins in 10 minutes. A 200 ms minimum cuts that to 6, a 250 ms minimum to 2, at a cost of roughly 100 ms more talk-over before a real interruption is caught.
The key lines. From code/mini-voice/bargein.py:
# from code/mini-voice/bargein.py
def history_entry(text, result, truncate=True):
"""What the agent's memory records as its own last turn."""
if not truncate or len(result["heard_words"]) == len(text.split()):
return text
return (result["heard_text"] + " " + MARK).strip()
Read it as: the history is rewritten to what was actually heard, not left as the full planned reply. Stopping the speaker and fixing the transcript are two separate steps. Skipping the second one leaves the agent confidently wrong about its own last turn.
Barge-in
Barge-in is the caller speaking while the agent is still speaking, which should stop the agent's audio and, as above, correct what the history says the agent delivered.
Example: the 17-words-claimed-but-unheard number above is exactly the gap barge-in handling has to close — not just stopping the sound, but fixing the record of what was said.