Preemptive generation is discarded when the final transcript only adds Arabic, CJK or Devanagari punctuation
Bug Description
#6667 made preemptive generation survive a final transcript that differs from the preflight transcript only in casing, whitespace or punctuation. That works for English, but not for languages whose punctuation isn't ASCII.
_transcripts_equivalent (voice/agent_activity.py) compares the two transcripts word by word after split_words(..., ignore_punctuation=True). The punctuation it strips comes from tokenize.tokenizer.PUNCTUATIONS, which is ASCII-only. So Arabic ، ؛ ؟, Urdu ۔, Devanagari । and fullwidth CJK ,。 stay attached to the words, the transcripts compare as different, and the preemptive reply is cancelled and generated again from scratch.
from livekit.agents.voice.agent_activity import _transcripts_equivalent
_transcripts_equivalent("hello how are you", "Hello, how are you?") # True
_transcripts_equivalent("مرحبا كيف حالك", "مرحبا، كيف حالك؟") # False
_transcripts_equivalent("你好 我很好", "你好,我很好。") # False
_transcripts_equivalent("आप कैसे हैं", "आप कैसे हैं।") # FalseThis happens whenever the STT sends an unpunctuated preflight and a punctuated final (the same situation #5766 reported for Soniox). Preflight transcripts come from AssemblyAI, Cartesia, Deepgram, Soniox and LiveKit Inference STT. When it happens, the user waits one extra LLM round-trip, and the log shows preemptive generation invalidated ... because the transcript ... changed.
Expected Behavior
Punctuation-only differences should keep the preemptive generation in every language, as they already do in English.
Reproduction Steps
Run the snippet above on main (57b3227).
Operating System
macOS 26.5 (the behaviour is platform-independent)
Models Used
Any STT that emits PREFLIGHT_TRANSCRIPT, with any LLM.
Package Versions
livekit-agents 1.8.3 (main @ 57b3227)
Proposed Solution
In tokenize/_basic_word.py, when ignore_punctuation=True, also drop characters whose Unicode category is punctuation (P*), on top of the existing ASCII list. That keeps the current behaviour for ASCII symbols like $ or + (category S), and doesn't touch Arabic diacritics (category Mn). As a side effect, a standalone ؟ or 。 no longer counts as a word for min_interruption_words or the user-turn word limit.
I have a fix with tests ready and will open a PR.
Source: livekit/agents