[Bug] Autopilot ignores allowUserBargeIn during the greeting and the idle message
Summary
With allowUserBargeIn: false, the autopilot still lets the caller interrupt the first message and the idle prompt, because the greeting and announcingIdleTimeout states accept SPEECH_START without the barge-in guard.
Steps to Reproduce
- Configure an assistant with
conversationSettings.allowUserBargeIn: falseand a longfirstMessage. - Call in and talk (or make background noise) while the greeting is playing.
- Observe: playback is cut (
interruptPlaybackrunsvoice.stopSpeech()), same as with barge-in enabled. - Same with
idleOptions.messagewhile it is being announced.
Expected Behavior
When barge-in is disabled, the assistant finishes the greeting and the idle prompt uninterrupted, consistent with processingUserRequest and waitingForSpeechTimeout, which guard SPEECH_START with context.allowUserBargeIn.
Actual Behavior
mods/autopilot/src/machine/machine.ts: both states transition to listeningToUser on SPEECH_START unconditionally. This predates #890 (the old machine sat in idle, which was also unguarded), but that PR made the two "assistant is speaking" states explicit, so it is the right place to honor the setting.
Note for the fix: a bare guard is not enough. idle only listens for SPEECH_START, so if the caller answers "yes, I'm here" during the idle prompt and the event is dropped, the machine sits silent until the next timeout. The announcement's onDone (and possibly the greeting's) should route to listeningToUser, or idle should also accept SPEECH_RESULT, so speech that started during playback is still processed.
Found by code review of #890.
Priority
P2
Source: fonoster/fonoster