Bug
When the user interrupts the agent immediately after the first audio frame is queued but before any text has been synchronized, the full unplayed LLM response is incorrectly inserted into the chat context. This causes the agent to "remember" things it never said.
Example: Agent generates a follow-up question, user interrupts before any audio plays, user asks the agent to repeat its question — agent repeats the question it never actually said.
Root Cause
In agent_activity.ts, forwardedText is initialized to the full generated response (textOut?.text). On interruption:
- If first audio frame was not played →
forwardedText = '' ✅
- If first audio frame was queued but
synchronizedTranscript is empty (interrupted before any text synced) → forwardedText stays as the full unplayed text ❌
Affected locations:
Fix
Add else { forwardedText = ''; } in both locations:
// before
if (playbackEv.synchronizedTranscript) {
forwardedText = playbackEv.synchronizedTranscript;
}
// after
if (playbackEv.synchronizedTranscript) {
forwardedText = playbackEv.synchronizedTranscript;
} else {
forwardedText = '';
}
Bug
When the user interrupts the agent immediately after the first audio frame is queued but before any text has been synchronized, the full unplayed LLM response is incorrectly inserted into the chat context. This causes the agent to "remember" things it never said.
Example: Agent generates a follow-up question, user interrupts before any audio plays, user asks the agent to repeat its question — agent repeats the question it never actually said.
Root Cause
In
agent_activity.ts,forwardedTextis initialized to the full generated response (textOut?.text). On interruption:forwardedText = ''✅synchronizedTranscriptis empty (interrupted before any text synced) →forwardedTextstays as the full unplayed text ❌Affected locations:
Fix
Add
else { forwardedText = ''; }in both locations: