fix(voice): mute audio input while detached (#2221) - #2231
Conversation
setAudioEnabled(false) called onAttached/onDetached, but AudioInput treated detach as a no-op, so held warm-transfer callers kept feeding STT and could invoke consult tools. Gate the input stream on attach state to match Python. Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: a10ba56 The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b466f65cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| onDetached(): void { | ||
| this._attached = false; |
There was a problem hiding this comment.
Decouple the mute gate from overridable hooks
When an application supplies an AudioInput subclass that already overrides onDetached()—a public hook that was a no-op before this change—AgentInput.setAudioEnabled(false) dispatches only to that override unless it happens to call super. The private _attached flag therefore remains true and frames continue into STT, so the mute fix still fails for existing custom inputs. Update the gate through a non-overridable internal transition while invoking the lifecycle hook separately, rather than requiring every existing subclass to add a new super call.
Useful? React with 👍 / 👎.
AgentInput now flips AudioInput attach state through setAttached before invoking onAttached/onDetached, so subclasses that override those hooks without calling super still mute. Also align SessionHost forwarded-event coverage with agent_false_interruption. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Superseded by #2222 (merged) + follow-up harden/CI fix on this branch. Closing as duplicate. |
Summary
AudioInput.onDetached()was a no-op, sosession.input.setAudioEnabled(false)(used by warm-transfer hold) did not stop frames from reaching STT/LLM/tools_attached) and sync attach/detach when swappingAgentInput.audioTest plan
agents/src/voice/io.test.ts— frames drop while detached and resume after re-attachsid_25948c27e48a): hold mute → held speech produces no final STT / no tools → unmute →get_weatherworksconnect_to_caller/ aliases from caller-room speech