Skip to content

Voice: mute command only active during active recording — must work at all times (during TTS, agent processing, co-pilot chat) #153

Description

@serge-ivo

Problem

The mute (and other) voice control words are only checked inside the transcription paths — real-time interim, hands-free finalize, and tap-to-talk final (packages/sdk/src/voice/use-voice.ts handleResult). All three only run when the main STT is actively recording a user turn.

So the mute word does NOT fire when:

  1. The co-pilot / agent is speaking (TTS playing) — the mic is stopped, nothing is transcribed.
  2. The agent is working / processing between utterances — the mic is paused (pausedForThinking).
  3. The mic is muted — obviously nothing is being recorded.

In practice: exactly the moments a user wants to say "mute" (to shut the agent up while it talks or thinks) are the moments the mute word is unreachable. The command is gated on the recording state machine.

Root cause

Control-word detection is coupled to the main recording pipeline. When that pipeline is stopped/paused (TTS, thinking, muted), there is no listener at all, so control words are never checked.

Fix

A continuous, always-on background control-word listener, separate from the main recording pipeline:

  1. A lightweight browser-dictation listener dedicated to control words (mute / stop), active whenever voice is engaged — regardless of app state (TTS playing, agent processing, mic paused/muted).
  2. Separate from the main STT so it never interferes with normal recording (it yields to the main recorder while the main path is actively capturing a turn, which already checks control words).
  3. Checks spoken words against the mute list at any time.
  4. On a mute word: immediately mute the mic AND cancel any TTS playing.
  5. Wired through useVoice, so it works in both the agent Assistant chat and the Coder Co-pilot (both consume the same hook).

Acceptance Criteria

  • Saying the mute word while the agent is speaking stops the mic and cancels TTS.
  • Saying the mute word while the agent is processing (between utterances) mutes.
  • Works in co-pilot chat and agent chat (via useVoice).
  • The background listener does not double-fire or fight the main recorder during active capture.
  • Pure decision logic (when to run the listener; control-word match) is unit-tested.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvoiceVoice / STT / TTS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions