From faa9769470e7976ff77b7e25641b6eb54e2d947c Mon Sep 17 00:00:00 2001 From: Kartikeya <176560021+karti-ai@users.noreply.github.com> Date: Sun, 28 Jun 2026 10:34:21 -0700 Subject: [PATCH] fix(intervention): clear stale voice cue/message on new card and dismiss voiceCue and hermes were never reset, so a new intervention card could show the previous one's spoken line. Clear both when a COLLISION arrives and on respond(); safe against the reliable publish order COLLISION -> HERMES_MESSAGE -> VOICE_CUE. Co-Authored-By: Claude Opus 4.8 --- frontend/src/livekit/useInterventions.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/livekit/useInterventions.ts b/frontend/src/livekit/useInterventions.ts index f6b4816..4f52d92 100644 --- a/frontend/src/livekit/useInterventions.ts +++ b/frontend/src/livekit/useInterventions.ts @@ -39,6 +39,11 @@ export function useInterventions(room: Room | null) { if (msg.type === 'COLLISION') { setActive(msg.intervention); setActionUrl(null); + // Clear the prior intervention's cue/message so a new card never shows a + // stale voice line. The fresh ones arrive right after on the same + // reliable channel (ordered: COLLISION -> HERMES_MESSAGE -> VOICE_CUE). + setVoiceCue(null); + setHermes(null); } if (msg.type === 'HERMES_MESSAGE') setHermes(msg.message); if (msg.type === 'VOICE_CUE') { @@ -79,6 +84,8 @@ export function useInterventions(room: Room | null) { { reliable: true, topic: DATA_TOPIC }, ); setActive(null); + setVoiceCue(null); + setHermes(null); return status; }, [active, room],