fix(desktop): re-arm voice chat after replies - #74780
Conversation
Duplicate of #73880: both move the voice-playback sequence baseline past the hook's internal playback reset/start so a normal reply re-arms the microphone rather than looking like an explicit Stop. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused renderer regression fix. The current-main premise is valid: openLiveSpeech() records its baseline before startSpeechStream() at apps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts:487, while startSpeechStream() later calls stopVoicePlayback() after asynchronous URL resolution at apps/desktop/src/lib/voice-playback.ts:324-332.
Problems
- The new post-
await startSpeechStream()baseline atapps/desktop/src/app/chat/composer/hooks/use-voice-conversation.ts:509absorbs an explicit Stop made while stream discovery is pending. The helper's normal reset and that user Stop are both included in the recorded baseline, so the later sequence comparison cannot suppress re-arm. - The new test covers normal streaming completion only. The fallback path changed too, and explicit-Stop behavior remains untested.
Suggested changes
- Preserve the entry sequence and allow only the one expected setup increment after
startSpeechStream()resolves; stop and settle without re-arming if an additional increment occurred. - Cover Stop during setup, Stop during active playback, normal fallback re-arm, and Stop before fallback begins.
Automated hermes-sweeper review.
| @@ -505,6 +509,11 @@ export function useVoiceConversation({ | |||
| return | |||
There was a problem hiding this comment.
startSpeechStream() awaits URL discovery before it performs its one expected stopVoicePlayback() increment. A user Stop during that await is absorbed by this post-await baseline, so later settling cannot distinguish it from normal setup and re-arms the mic. Preserve the entry sequence and treat more than the expected one increment as an external Stop.
Summary
Closes #73649.
Test Plan
npm test -- --run src/app/chat/composer/hooks/use-voice-conversation.test.tsxnpm run typechecknpm run lint -- --quiet src/app/chat/composer/hooks/use-voice-conversation.ts src/app/chat/composer/hooks/use-voice-conversation.test.tsx