From 6904cfbc589af6eb2d36fa27fe1669fb812935d3 Mon Sep 17 00:00:00 2001
From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
Date: Fri, 27 Nov 2026 22:26:32 -0500
Subject: [PATCH 1/6] feat(frontend): give the composer its own strip and let
voice mode skip reading replies
---
.../components/message/FloatingTTSButton.tsx | 8 +--
.../message/PromptInput.command.test.tsx | 4 +-
.../message/PromptInput.composer.test.tsx | 37 +++++++++-
.../message/PromptInput.config.test.tsx | 2 +-
.../src/components/message/PromptInput.tsx | 26 ++++---
.../components/message/SessionConfigMenu.tsx | 2 +-
.../message/VoiceConversationBar.test.tsx | 31 +++++++++
.../message/VoiceConversationBar.tsx | 28 ++++++--
.../src/hooks/useVoiceConversation.test.tsx | 68 +++++++++++++++++++
frontend/src/hooks/useVoiceConversation.ts | 66 ++++++++++++++----
frontend/src/pages/SessionDetail.tsx | 31 +++++----
.../SessionDetail.scroll-floating.test.tsx | 68 +++++++++++++++++--
frontend/src/stores/voiceConversationStore.ts | 20 ++++++
frontend/src/test/promptInput.tsx | 2 +
frontend/src/test/test-utils.tsx | 3 +
15 files changed, 341 insertions(+), 55 deletions(-)
create mode 100644 frontend/src/stores/voiceConversationStore.ts
diff --git a/frontend/src/components/message/FloatingTTSButton.tsx b/frontend/src/components/message/FloatingTTSButton.tsx
index 2f67df556..cda4ba53c 100644
--- a/frontend/src/components/message/FloatingTTSButton.tsx
+++ b/frontend/src/components/message/FloatingTTSButton.tsx
@@ -91,17 +91,17 @@ export function FloatingTTSButton({ messageId, content, isScrolledUp, onSpeakVis
: 'TTS controls'
const pillAriaLabel = `${pillTitle}. ${autoPlay ? 'Auto-play enabled.' : 'Auto-play disabled.'} hold to toggle auto-play`
const buttonToneClasses = showStop
- ? 'justify-center px-3 py-1.5 rounded-lg bg-destructive border border-destructive/60 shadow-destructive/30 ring-destructive/20 hover:ring-destructive/40 text-destructive-foreground'
+ ? 'bg-destructive border border-destructive/60 shadow-destructive/30 ring-destructive/20 hover:ring-destructive/40 text-destructive-foreground'
: autoPlay
- ? 'justify-center px-3 py-1.5 rounded-lg bg-primary border border-primary/60 shadow-primary/30 ring-primary/20 hover:ring-primary/40 text-primary-foreground'
- : 'justify-center px-3 py-1.5 rounded-lg bg-gradient-to-br from-warning to-highlight border border-warning/60 shadow-warning/30 ring-warning/20 hover:ring-warning/40 text-warning-foreground'
+ ? 'bg-primary border border-primary/60 shadow-primary/30 ring-primary/20 hover:ring-primary/40 text-primary-foreground'
+ : 'bg-gradient-to-br from-warning to-highlight border border-warning/60 shadow-warning/30 ring-warning/20 hover:ring-warning/40 text-warning-foreground'
return (
@@ -1240,7 +1242,7 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read)
: ''
return (
-
+
{sessionActivityAnnouncement}
@@ -1308,7 +1310,7 @@ return (
? "Enter bash command..."
: "Send a message..."
}
- className={`flex-1 min-w-0 bg-muted/50 pl-2 md:pl-3 pr-3 py-2 text-[16px] text-foreground placeholder-muted-foreground focus:outline-none focus:bg-muted/70 resize-none min-h-[40px] max-h-[120px] disabled:opacity-50 disabled:cursor-not-allowed md:text-sm rounded-lg [field-sizing:content] ${
+ className={`flex-1 min-w-0 bg-muted/50 pl-2 md:pl-3 pr-3 py-2.5 md:py-2 text-[16px] text-foreground placeholder-muted-foreground focus:outline-none focus:bg-muted/70 resize-none min-h-11 md:min-h-[40px] max-h-[120px] disabled:opacity-50 disabled:cursor-not-allowed md:text-sm rounded-lg [field-sizing:content] ${
isBashMode
? 'border-warning/50 bg-warning/5 focus:bg-warning/10'
: isDragging ? 'border-info/50 border-dashed bg-info/5' : ''
@@ -1347,6 +1349,14 @@ return (
onChange={handleFileInputChange}
/>
{showVoiceMic && !hasPromptContent && !showStopButton && renderVoiceMic()}
+ {trailingAction !== undefined && (
+
+ {trailingAction}
+
+ )}
{imageAttachments.length > 0 && (
diff --git a/frontend/src/components/message/SessionConfigMenu.tsx b/frontend/src/components/message/SessionConfigMenu.tsx
index 6a5805fd5..a97a1b354 100644
--- a/frontend/src/components/message/SessionConfigMenu.tsx
+++ b/frontend/src/components/message/SessionConfigMenu.tsx
@@ -585,7 +585,7 @@ export const SessionConfigMenu = memo(function SessionConfigMenu({
className={cn(
getIconToggleButtonClassName(isAnySessionToggleActive),
'relative flex shrink-0 items-center justify-center overflow-hidden p-0',
- isMobile ? 'size-11' : 'size-9',
+ isMobile ? 'size-11' : 'size-10',
gutterCardClassName,
)}
>
diff --git a/frontend/src/components/message/VoiceConversationBar.test.tsx b/frontend/src/components/message/VoiceConversationBar.test.tsx
index 952da0dfe..884dfab66 100644
--- a/frontend/src/components/message/VoiceConversationBar.test.tsx
+++ b/frontend/src/components/message/VoiceConversationBar.test.tsx
@@ -17,6 +17,8 @@ const buildController = (
canStopAgent: false,
hasHeldReading: false,
isEndpointing: false,
+ readRepliesAloud: true,
+ canReadRepliesAloud: true,
notice: null,
start: vi.fn(),
exit: vi.fn(),
@@ -25,6 +27,7 @@ const buildController = (
pause: vi.fn(),
resume: vi.fn(),
stopAgent: vi.fn(),
+ toggleReadRepliesAloud: vi.fn(),
...overrides,
})
@@ -111,6 +114,34 @@ describe('VoiceConversationBar', () => {
expect(controller.stopAgent).toHaveBeenCalledTimes(1)
})
+ it('toggles reading replies aloud from the bar', async () => {
+ const user = userEvent.setup()
+ const controller = buildController({ readRepliesAloud: true })
+ renderBar(controller)
+
+ const toggle = screen.getByRole('button', { name: 'Read replies aloud' })
+ expect(toggle).toHaveAttribute('aria-pressed', 'true')
+
+ await user.click(toggle)
+
+ expect(controller.toggleReadRepliesAloud).toHaveBeenCalledTimes(1)
+ })
+
+ it('presents the read-aloud toggle as unpressed when reading is off', () => {
+ renderBar(buildController({ readRepliesAloud: false }))
+
+ expect(screen.getByRole('button', { name: 'Read replies aloud' })).toHaveAttribute(
+ 'aria-pressed',
+ 'false',
+ )
+ })
+
+ it('hides the read-aloud toggle when text-to-speech is not configured', () => {
+ renderBar(buildController({ canReadRepliesAloud: false }))
+
+ expect(screen.queryByRole('button', { name: 'Read replies aloud' })).toBeNull()
+ })
+
it('shows the approval control instead of pause while the session waits for approval', async () => {
const user = userEvent.setup()
const onViewApproval = vi.fn()
diff --git a/frontend/src/components/message/VoiceConversationBar.tsx b/frontend/src/components/message/VoiceConversationBar.tsx
index 69e929896..36964e30f 100644
--- a/frontend/src/components/message/VoiceConversationBar.tsx
+++ b/frontend/src/components/message/VoiceConversationBar.tsx
@@ -1,4 +1,4 @@
-import { Pause, Pencil, Play, X } from 'lucide-react'
+import { Pause, Pencil, Play, Volume2, VolumeX, X } from 'lucide-react'
import type { ReactNode } from 'react'
import { VoiceConversationOrb } from '@/components/message/VoiceConversationOrb'
import { Button } from '@/components/ui/button'
@@ -7,9 +7,16 @@ import { SquareFill } from '@/components/ui/square-fill'
import type { VoiceConversationController } from '@/hooks/useVoiceConversation'
import { cn } from '@/lib/utils'
+const BAR_ICON_BUTTON_SIZE_CLASS = 'flex size-11 shrink-0 items-center justify-center p-0'
+
const BAR_ICON_BUTTON_CLASS = cn(
getIconToggleButtonClassName(false),
- 'flex size-11 shrink-0 items-center justify-center p-0',
+ BAR_ICON_BUTTON_SIZE_CLASS,
+)
+
+const BAR_ICON_BUTTON_ACTIVE_CLASS = cn(
+ getIconToggleButtonClassName(true),
+ BAR_ICON_BUTTON_SIZE_CLASS,
)
const RESERVED_LINE_CLASS = 'h-4 w-full truncate text-center leading-4'
@@ -17,18 +24,20 @@ const RESERVED_LINE_CLASS = 'h-4 w-full truncate text-center leading-4'
interface BarIconButtonProps {
label: string
onClick: () => void
+ pressed?: boolean
children: ReactNode
}
-function BarIconButton({ label, onClick, children }: BarIconButtonProps) {
+function BarIconButton({ label, onClick, pressed, children }: BarIconButtonProps) {
return (
event.preventDefault()}
onClick={onClick}
- className={BAR_ICON_BUTTON_CLASS}
+ className={pressed ? BAR_ICON_BUTTON_ACTIVE_CLASS : BAR_ICON_BUTTON_CLASS}
>
{children}
@@ -55,6 +64,8 @@ export function VoiceConversationBar({
canEditInTextBox,
canStopAgent,
hasHeldReading,
+ readRepliesAloud,
+ canReadRepliesAloud,
notice,
} = controller
@@ -90,6 +101,15 @@ export function VoiceConversationBar({
)}
+ {canReadRepliesAloud ? (
+
+ {readRepliesAloud ? : }
+
+ ) : null}
{canStopAgent ? (
diff --git a/frontend/src/hooks/useVoiceConversation.test.tsx b/frontend/src/hooks/useVoiceConversation.test.tsx
index 9162bba45..da1f2454f 100644
--- a/frontend/src/hooks/useVoiceConversation.test.tsx
+++ b/frontend/src/hooks/useVoiceConversation.test.tsx
@@ -6,6 +6,7 @@ import type { SessionMessageAssistant } from '@opencode-manager/shared/opencode'
import type { SpeakMessageOptions, TTSContextValue } from '@/contexts/tts-context'
import type { SttEndOfSpeechReason } from '@/lib/webSpeechRecognizer'
import type { StartRecordingOptions } from '@/hooks/useSTT'
+import { useVoiceConversationStore } from '@/stores/voiceConversationStore'
import { useVoiceConversation } from './useVoiceConversation'
import type { UseVoiceConversationInput, VoiceConversationCollaborators } from './useVoiceConversation'
@@ -183,6 +184,7 @@ describe('useVoiceConversation', () => {
isPaused: false,
error: null,
})
+ useVoiceConversationStore.setState({ readRepliesAloud: true })
sttListeners.clear()
harness.putSessionInstruction.mockResolvedValue(undefined)
harness.removeSessionInstruction.mockResolvedValue(undefined)
@@ -581,6 +583,72 @@ describe('useVoiceConversation', () => {
expect(result.current.label).toBe('Reading the reply failed')
})
+ it('marks replies as heard without speaking when read-back is turned off', async () => {
+ useVoiceConversationStore.setState({ readRepliesAloud: false })
+ const { result, rerender } = renderHook(
+ (props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators),
+ { initialProps: createProps() },
+ )
+
+ act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ await endOfSpeech('pause', 'hello there')
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+
+ rerender(createProps({ messages: [assistantMessage('msg_1', 'Done')] }))
+
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ expect(harness.speakMessage).not.toHaveBeenCalled()
+ expect(result.current.readRepliesAloud).toBe(false)
+ expect(harness.startRecording).toHaveBeenCalledTimes(2)
+ })
+
+ it('stops reading and listens again when read-back is turned off mid-reply', async () => {
+ const { result, rerender } = renderHook(
+ (props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators),
+ { initialProps: createProps() },
+ )
+
+ act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ await endOfSpeech('pause', 'hello there')
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+
+ rerender(createProps({ messages: [assistantMessage('msg_1', 'Done')] }))
+ await waitFor(() => expect(result.current.phase).toBe('speaking'))
+
+ act(() => result.current.toggleReadRepliesAloud())
+
+ expect(harness.ttsStop).toHaveBeenCalledTimes(1)
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ expect(result.current.readRepliesAloud).toBe(false)
+ expect(harness.startRecording).toHaveBeenCalledTimes(2)
+ })
+
+ it('keeps waiting for a busy agent when read-back is turned off mid-reply', async () => {
+ const { result, rerender } = renderHook(
+ (props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators),
+ { initialProps: createProps() },
+ )
+
+ act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ await endOfSpeech('pause', 'hello there')
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+
+ rerender(createProps({ status: 'busy', messages: [assistantMessage('msg_1', 'Working on it')] }))
+ await waitFor(() => expect(result.current.phase).toBe('speaking'))
+
+ act(() => result.current.toggleReadRepliesAloud())
+
+ expect(harness.ttsStop).toHaveBeenCalledTimes(1)
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+
+ rerender(createProps({ status: 'idle', messages: [assistantMessage('msg_1', 'Working on it'), assistantMessage('msg_2', 'Done')] }))
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ expect(harness.speakMessage).toHaveBeenCalledTimes(1)
+ })
+
it('marks a reply with nothing to read as heard and listens again', async () => {
const { result, rerender } = renderHook(
(props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators),
diff --git a/frontend/src/hooks/useVoiceConversation.ts b/frontend/src/hooks/useVoiceConversation.ts
index c63edb670..baf1b6b63 100644
--- a/frontend/src/hooks/useVoiceConversation.ts
+++ b/frontend/src/hooks/useVoiceConversation.ts
@@ -31,6 +31,7 @@ import { useSTT } from '@/hooks/useSTT'
import { useTTS } from '@/hooks/useTTS'
import { sanitizeForTTS } from '@/lib/utils'
import type { SttEndOfSpeechReason } from '@/lib/webSpeechRecognizer'
+import { useVoiceConversationStore } from '@/stores/voiceConversationStore'
export interface UseVoiceConversationInput {
sessionID: string
@@ -56,6 +57,8 @@ export interface VoiceConversationController {
canStopAgent: boolean
hasHeldReading: boolean
isEndpointing: boolean
+ readRepliesAloud: boolean
+ canReadRepliesAloud: boolean
notice: string | null
start: () => void
exit: () => void
@@ -64,6 +67,7 @@ export interface VoiceConversationController {
pause: () => void
resume: () => void
stopAgent: () => void
+ toggleReadRepliesAloud: () => void
}
interface VoiceConversationLatest {
@@ -74,6 +78,7 @@ interface VoiceConversationLatest {
sendTurn: (text: string, options: { busy: boolean }) => Promise
interrupt: () => Promise
onEditInTextBox: (text: string) => void
+ readRepliesAloud: boolean
tts: ReturnType
}
@@ -217,6 +222,8 @@ export function useVoiceConversation(
const listInstructionKeys = collaborators.listSessionInstructionKeys ?? DEFAULT_COLLABORATORS.listSessionInstructionKeys
const tts = ttsHook()
const stt = sttHook()
+ const readRepliesAloud = useVoiceConversationStore((state) => state.readRepliesAloud)
+ const setReadRepliesAloud = useVoiceConversationStore((state) => state.setReadRepliesAloud)
const [state, dispatch] = useReducer(
reduceVoiceConversation,
@@ -258,6 +265,7 @@ export function useVoiceConversation(
sendTurn,
interrupt,
onEditInTextBox,
+ readRepliesAloud,
tts,
})
@@ -289,6 +297,7 @@ export function useVoiceConversation(
sendTurn,
interrupt,
onEditInTextBox,
+ readRepliesAloud,
tts,
}
sttRef.current = stt
@@ -553,9 +562,10 @@ export function useVoiceConversation(
}
const spokenIds = spokenIdsRef.current
const unspoken = listUnspokenMessages(messages, state.baselineId, spokenIds)
- const readable = latestRef.current.tts.isEnabled
- ? unspoken.find((message) => sanitizeForTTS(message.text).trim() !== '')
- : undefined
+ const readable =
+ latestRef.current.tts.isEnabled && latestRef.current.readRepliesAloud
+ ? unspoken.find((message) => sanitizeForTTS(message.text).trim() !== '')
+ : undefined
if (readable) {
clearWorkingTimers()
dispatch({ type: 'speak-start' })
@@ -606,6 +616,7 @@ export function useVoiceConversation(
hasPendingApproval,
clearWorkingTimers,
speakMessage,
+ readRepliesAloud,
])
useEffect(() => {
@@ -777,6 +788,38 @@ export function useVoiceConversation(
})
}, [setHeldPlayback])
+ const skipReading = useCallback(() => {
+ const latest = latestRef.current
+ for (const message of listUnspokenMessages(
+ latest.messages,
+ baselineIdRef.current,
+ spokenIdsRef.current,
+ )) {
+ spokenIdsRef.current.add(message.id)
+ }
+ speakTokenRef.current += 1
+ speakingIdRef.current = null
+ latest.tts.stop()
+ dispatch({ type: 'skip' })
+ }, [])
+
+ const toggleReadRepliesAloud = useCallback(() => {
+ const next = !latestRef.current.readRepliesAloud
+ latestRef.current = { ...latestRef.current, readRepliesAloud: next }
+ setReadRepliesAloud(next)
+ if (next) return
+ if (phaseRef.current === 'speaking') {
+ speakTokenRef.current += 1
+ speakingIdRef.current = null
+ latestRef.current.tts.stop()
+ dispatch({ type: 'speech-ended' })
+ return
+ }
+ if (!playbackHeldRef.current) return
+ setHeldPlayback(false)
+ latestRef.current.tts.stop()
+ }, [setReadRepliesAloud, setHeldPlayback])
+
const tapOrb = useCallback(() => {
const phase = phaseRef.current
const latest = latestRef.current
@@ -793,17 +836,7 @@ export function useVoiceConversation(
return
case 'speaking':
if (latest.status === 'idle') {
- for (const message of listUnspokenMessages(
- latest.messages,
- baselineIdRef.current,
- spokenIdsRef.current,
- )) {
- spokenIdsRef.current.add(message.id)
- }
- speakTokenRef.current += 1
- speakingIdRef.current = null
- latest.tts.stop()
- dispatch({ type: 'skip' })
+ skipReading()
return
}
speakTokenRef.current += 1
@@ -820,7 +853,7 @@ export function useVoiceConversation(
default:
return
}
- }, [resumeConversation])
+ }, [resumeConversation, skipReading])
const stopAgent = useCallback(() => {
void latestRef.current.interrupt()
@@ -926,6 +959,8 @@ export function useVoiceConversation(
canStopAgent,
hasHeldReading,
isEndpointing: stt.isEndpointing,
+ readRepliesAloud,
+ canReadRepliesAloud: tts.isEnabled,
notice,
start,
exit,
@@ -934,5 +969,6 @@ export function useVoiceConversation(
pause,
resume: resumeConversation,
stopAgent,
+ toggleReadRepliesAloud,
}
}
diff --git a/frontend/src/pages/SessionDetail.tsx b/frontend/src/pages/SessionDetail.tsx
index 02469f1e0..f46563910 100644
--- a/frontend/src/pages/SessionDetail.tsx
+++ b/frontend/src/pages/SessionDetail.tsx
@@ -726,6 +726,19 @@ export function SessionDetail() {
promptInputRef.current?.setPromptValue(restoredPrompt)
}, []);
+ const composerTrailingAction = ttsEnabled && !isMobile && !isVoiceConversationActive
+ ? !isFormSheetOpen && !hasPromptContent && !isSessionActive && latestPlayableAssistant
+ ? (
+
+ )
+ : null
+ : undefined;
+
@@ -895,7 +908,7 @@ export function SessionDetail() {
data-testid="prompt-overlay"
className={cn(
"@container/composer absolute left-0 right-0 flex justify-center",
- isFormOpen && "top-0 flex-col items-center justify-end pointer-events-none md:pt-3",
+ isFormOpen ? "top-0 flex-col items-center justify-end pointer-events-none md:pt-3" : "border-t border-border/50 bg-background",
)}
style={{ bottom: inputBottomOffset }}
>
@@ -911,14 +924,6 @@ export function SessionDetail() {
>
{!isFormSheetOpen && (
- {ttsEnabled && !isVoiceConversationActive && !hasPromptContent && !isSessionActive && latestPlayableAssistant && (
-
- )}
{hasPromptContent && !isSessionActive && !hasComposerSuggestions && (
e.preventDefault()}
@@ -939,13 +944,12 @@ export function SessionDetail() {
{showScrollButton && !isFormSheetOpen && (
e.preventDefault()}
onClick={scrollToBottom}
- className="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 z-50 size-11 rounded-full bg-card text-foreground border border-border shadow-md flex items-center justify-center transition-all duration-200 active:scale-95 hover:bg-accent"
+ className="absolute bottom-full left-1/2 -translate-x-1/2 z-50 h-8 flex items-center gap-1.5 rounded-t-lg border border-b-0 border-border/50 bg-background px-3 text-xs font-medium text-foreground transition-colors hover:bg-accent"
>
-
+
+ Back to latest
)}
{minimizedForm && (
@@ -991,6 +995,7 @@ export function SessionDetail() {
onScrollToBottom={scrollToBottom}
commandActions={commandActions}
onPromptChange={setHasPromptContent}
+ trailingAction={composerTrailingAction}
/>
diff --git a/frontend/src/pages/__tests__/SessionDetail.scroll-floating.test.tsx b/frontend/src/pages/__tests__/SessionDetail.scroll-floating.test.tsx
index 4c9a853c3..d68bd19e8 100644
--- a/frontend/src/pages/__tests__/SessionDetail.scroll-floating.test.tsx
+++ b/frontend/src/pages/__tests__/SessionDetail.scroll-floating.test.tsx
@@ -5,11 +5,14 @@ import {
installElementScrollMetrics,
installMatchMedia,
installResizeObserver,
+ installSpeechSynthesis,
installWindowSize,
} from '@/test/browserFakes'
-import { makeUserMessage } from '@/test/fixtures/api'
+import { makeSettingsResponse, makeUserMessage, makeUserPreferences } from '@/test/fixtures/api'
import { promptTextarea } from '@/test/promptInput'
import { renderSessionPage } from '@/test/sessionPage'
+import { DEFAULT_TTS_CONFIG } from '@opencode-manager/shared/schemas'
+import type { SessionMessageAssistant } from '@opencode-manager/shared/opencode'
import type { ElementScrollMetricsFake, ResizeObserverFake } from '@/test/browserFakes'
import type { FetchRouteResult } from '@/test/fetchFake'
@@ -79,7 +82,7 @@ describe('SessionDetail scroll and composer affordances', () => {
scrollUpInTranscript()
- expect(screen.getByRole('button', { name: 'Jump to latest' })).toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'Back to latest' })).toBeInTheDocument()
})
it('keeps jump to latest visible while the composer has content', async () => {
@@ -90,7 +93,7 @@ describe('SessionDetail scroll and composer affordances', () => {
scrollUpInTranscript()
expect(await screen.findByRole('button', { name: 'Clear' })).toBeInTheDocument()
- expect(screen.getByRole('button', { name: 'Jump to latest' })).toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'Back to latest' })).toBeInTheDocument()
})
it('hides jump to latest while the transcript is at the bottom', async () => {
@@ -98,7 +101,7 @@ describe('SessionDetail scroll and composer affordances', () => {
await waitForComposer()
scrollMetrics.setScrollTop(transcriptContainer(), TRANSCRIPT_SCROLL_HEIGHT)
- expect(screen.queryByRole('button', { name: 'Jump to latest' })).not.toBeInTheDocument()
+ expect(screen.queryByRole('button', { name: 'Back to latest' })).not.toBeInTheDocument()
})
it('scrolls the transcript back to the bottom when jump to latest is clicked', async () => {
@@ -106,10 +109,10 @@ describe('SessionDetail scroll and composer affordances', () => {
await waitForComposer()
scrollUpInTranscript()
- fireEvent.click(screen.getByRole('button', { name: 'Jump to latest' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Back to latest' }))
await waitFor(() => {
- expect(screen.queryByRole('button', { name: 'Jump to latest' })).not.toBeInTheDocument()
+ expect(screen.queryByRole('button', { name: 'Back to latest' })).not.toBeInTheDocument()
})
expect(transcriptScrollTop()).toBe(TRANSCRIPT_SCROLL_HEIGHT)
})
@@ -128,6 +131,59 @@ describe('SessionDetail scroll and composer affordances', () => {
})
})
+ it('places the speaker button inside the composer input row', async () => {
+ installSpeechSynthesis()
+ const assistantReply: SessionMessageAssistant = {
+ id: 'msg_reply',
+ type: 'assistant',
+ agent: 'build',
+ model: { providerID: 'anthropic', id: 'claude-sonnet-4-5' },
+ content: [{ type: 'text', text: 'A reply' }],
+ time: { created: 1, completed: 2 },
+ }
+ const preferences = makeUserPreferences({ tts: { ...DEFAULT_TTS_CONFIG, enabled: true, provider: 'builtin' } })
+
+ renderSessionPage({
+ messages: [assistantReply],
+ extraRoutes: [
+ { method: 'GET', path: '/api/settings', respond: () => ({ json: makeSettingsResponse({ preferences }) }) },
+ ],
+ })
+ await waitForComposer()
+
+ const speaker = await screen.findByRole('button', { name: /play latest reply/i })
+ const slot = screen.getByTestId('composer-trailing-slot')
+
+ expect(slot).toContainElement(speaker)
+ expect(screen.getByTestId('composer-input-row')).toContainElement(slot)
+ })
+
+ it('leaves the speaker button out of the composer on mobile', async () => {
+ installWindowSize(480)
+ installSpeechSynthesis()
+ const assistantReply: SessionMessageAssistant = {
+ id: 'msg_reply',
+ type: 'assistant',
+ agent: 'build',
+ model: { providerID: 'anthropic', id: 'claude-sonnet-4-5' },
+ content: [{ type: 'text', text: 'A reply' }],
+ time: { created: 1, completed: 2 },
+ }
+ const preferences = makeUserPreferences({ tts: { ...DEFAULT_TTS_CONFIG, enabled: true, provider: 'builtin' } })
+
+ renderSessionPage({
+ messages: [assistantReply],
+ extraRoutes: [
+ { method: 'GET', path: '/api/settings', respond: () => ({ json: makeSettingsResponse({ preferences }) }) },
+ ],
+ })
+ await waitForComposer()
+ await screen.findByText('A reply')
+
+ expect(screen.queryByTestId('composer-trailing-slot')).not.toBeInTheDocument()
+ expect(screen.queryByRole('button', { name: /play latest reply/i })).not.toBeInTheDocument()
+ })
+
it.each(VIEWPORTS)('interrupts the active session from the composer stop button on $name', async ({ width }) => {
installWindowSize(width)
const { fetchFake } = renderSessionPage({ activeSessions: ['session-1'] })
diff --git a/frontend/src/stores/voiceConversationStore.ts b/frontend/src/stores/voiceConversationStore.ts
new file mode 100644
index 000000000..15808b2dd
--- /dev/null
+++ b/frontend/src/stores/voiceConversationStore.ts
@@ -0,0 +1,20 @@
+import { create } from 'zustand'
+import { persist } from 'zustand/middleware'
+
+interface VoiceConversationStore {
+ readRepliesAloud: boolean
+ setReadRepliesAloud: (readRepliesAloud: boolean) => void
+}
+
+export const useVoiceConversationStore = create()(
+ persist(
+ (set) => ({
+ readRepliesAloud: true,
+ setReadRepliesAloud: (readRepliesAloud: boolean) => set({ readRepliesAloud }),
+ }),
+ {
+ name: 'opencode-voice-conversation',
+ partialize: (state) => ({ readRepliesAloud: state.readRepliesAloud }),
+ },
+ ),
+)
diff --git a/frontend/src/test/promptInput.tsx b/frontend/src/test/promptInput.tsx
index 3862ab983..23071286f 100644
--- a/frontend/src/test/promptInput.tsx
+++ b/frontend/src/test/promptInput.tsx
@@ -52,6 +52,7 @@ export interface PromptInputFixture {
onPromptChange?: (hasContent: boolean) => void
onSuggestionsOpenChange?: (open: boolean) => void
onVoiceConversationActiveChange?: (active: boolean) => void
+ trailingAction?: ReactNode
}
export function makeAgent(overrides: Partial & { id: string }): AgentInfo {
@@ -153,6 +154,7 @@ export async function renderPromptInput(fixture: PromptInputFixture = {}) {
onSuggestionsOpenChange={active.onSuggestionsOpenChange}
onVoiceConversationActiveChange={active.onVoiceConversationActiveChange}
voiceConversation={active.voiceConversation}
+ trailingAction={active.trailingAction}
ref={active.promptRef}
/>
diff --git a/frontend/src/test/test-utils.tsx b/frontend/src/test/test-utils.tsx
index ac753dc79..335a78e8e 100644
--- a/frontend/src/test/test-utils.tsx
+++ b/frontend/src/test/test-utils.tsx
@@ -22,6 +22,8 @@ export function createVoiceConversationControllerMock(
canStopAgent: false,
hasHeldReading: false,
isEndpointing: false,
+ readRepliesAloud: true,
+ canReadRepliesAloud: true,
notice: null,
start: vi.fn(),
exit: vi.fn(),
@@ -30,6 +32,7 @@ export function createVoiceConversationControllerMock(
pause: vi.fn(),
resume: vi.fn(),
stopAgent: vi.fn(),
+ toggleReadRepliesAloud: vi.fn(),
...overrides,
}
}
From 99b8d854d4e5db0dd580ad860058ebc1c9e267a4 Mon Sep 17 00:00:00 2001
From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
Date: Fri, 27 Nov 2026 22:49:47 -0500
Subject: [PATCH 2/6] Keep voice mode listening after empty sends and
transcription errors, and let failed sends be resent
---
.../message/VoiceConversationBar.test.tsx | 23 +-
.../src/hooks/useVoiceConversation.test.tsx | 234 ++++++++++++++++--
frontend/src/hooks/useVoiceConversation.ts | 166 +++++++++++--
frontend/src/lib/voiceConversation.test.ts | 99 +++++++-
shared/src/opencode/voiceConversation.ts | 40 ++-
5 files changed, 522 insertions(+), 40 deletions(-)
diff --git a/frontend/src/components/message/VoiceConversationBar.test.tsx b/frontend/src/components/message/VoiceConversationBar.test.tsx
index 884dfab66..80e226ab9 100644
--- a/frontend/src/components/message/VoiceConversationBar.test.tsx
+++ b/frontend/src/components/message/VoiceConversationBar.test.tsx
@@ -223,18 +223,39 @@ describe('VoiceConversationBar', () => {
renderBar(
buildController({
phase: 'paused',
- label: 'Microphone access denied. Please allow microphone permissions.',
+ label: 'Microphone problem',
+ notice: 'Microphone access denied. Please allow microphone permissions.',
hint: 'Allow microphone access, then tap to retry',
orbLabel: 'Resume voice conversation',
}),
)
+ expect(screen.getByText('Microphone problem')).toBeInTheDocument()
expect(
screen.getByText('Microphone access denied. Please allow microphone permissions.'),
).toBeInTheDocument()
expect(screen.getByText('Allow microphone access, then tap to retry')).toBeInTheDocument()
})
+ it('offers the edit control while paused with a failed message', async () => {
+ const user = userEvent.setup()
+ const controller = buildController({
+ phase: 'paused',
+ label: "Couldn't send your message",
+ hint: 'Tap to resend',
+ notice: "Couldn't send: network down",
+ canEditInTextBox: true,
+ orbLabel: 'Resend message',
+ })
+ renderBar(controller)
+
+ expect(screen.queryByRole('button', { name: 'Exit voice conversation' })).toBeNull()
+ expect(screen.getByRole('button', { name: 'Resend message' })).toBeInTheDocument()
+ await user.click(screen.getByRole('button', { name: 'Edit in text box' }))
+
+ expect(controller.editInTextBox).toHaveBeenCalledTimes(1)
+ })
+
it('shows the notice when there is one and keeps the reserved hint line empty', () => {
renderBar(
buildController({
diff --git a/frontend/src/hooks/useVoiceConversation.test.tsx b/frontend/src/hooks/useVoiceConversation.test.tsx
index da1f2454f..1ad41c870 100644
--- a/frontend/src/hooks/useVoiceConversation.test.tsx
+++ b/frontend/src/hooks/useVoiceConversation.test.tsx
@@ -458,20 +458,25 @@ describe('useVoiceConversation', () => {
expect(result.current.orbLabel).toBe('Resume voice conversation')
})
- it('pauses with an error when capture cannot start', async () => {
- harness.startRecording.mockResolvedValue(false)
+ it('keeps listening and restarts capture when a tap captures nothing', async () => {
const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
initialProps: createProps(),
})
act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ expect(harness.startRecording).toHaveBeenCalledTimes(1)
- await waitFor(() => expect(result.current.phase).toBe('paused'))
- expect(result.current.label).toBe('Speech recognition failed')
- expect(result.current.hint).toBe('Allow microphone access, then tap to retry')
+ act(() => result.current.tapOrb())
+
+ await waitFor(() => expect(harness.startRecording).toHaveBeenCalledTimes(2))
+ expect(result.current.phase).toBe('listening')
+ expect(result.current.label).toBe('Listening')
+ expect(result.current.notice).toBe("Didn't hear anything, still listening")
+ expect(harness.sendTurn).not.toHaveBeenCalled()
})
- it('shows the specific microphone failure and how to fix it', async () => {
+ it('clears the empty-tap notice once speech arrives', async () => {
const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
initialProps: createProps(),
})
@@ -479,19 +484,66 @@ describe('useVoiceConversation', () => {
act(() => result.current.start())
await waitFor(() => expect(result.current.phase).toBe('listening'))
- updateStt({
- isError: true,
- error: 'Microphone access denied. Please allow microphone permissions.',
+ act(() => result.current.tapOrb())
+ await waitFor(() =>
+ expect(result.current.notice).toBe("Didn't hear anything, still listening"),
+ )
+
+ updateStt({ interimTranscript: 'hello' })
+
+ await waitFor(() => expect(result.current.notice).toBeNull())
+ })
+
+ it('keeps working with a notice when a queue tap captures nothing', async () => {
+ const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
+ initialProps: createProps({ status: 'busy' }),
+ })
+
+ act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+
+ act(() => result.current.tapOrb())
+ await waitFor(() => expect(result.current.phase).toBe('recording'))
+
+ act(() => result.current.tapOrb())
+
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+ expect(result.current.notice).toBe("Didn't hear anything")
+ expect(harness.sendTurn).not.toHaveBeenCalled()
+ })
+
+ it('pauses with a microphone label and the reason when capture cannot start', async () => {
+ harness.startRecording.mockResolvedValue(false)
+ const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
+ initialProps: createProps(),
})
+ act(() => result.current.start())
+
await waitFor(() => expect(result.current.phase).toBe('paused'))
- expect(result.current.label).toBe(
+ expect(result.current.label).toBe('Microphone problem')
+ expect(result.current.notice).toBe('Speech recognition failed')
+ expect(result.current.hint).toBe('Allow microphone access, then tap to retry')
+ })
+
+ it('shows the specific microphone failure in the notice and how to fix it', async () => {
+ harness.startRecording.mockResolvedValue(false)
+ updateStt({ error: 'Microphone access denied. Please allow microphone permissions.' })
+ const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
+ initialProps: createProps(),
+ })
+
+ act(() => result.current.start())
+
+ await waitFor(() => expect(result.current.phase).toBe('paused'))
+ expect(result.current.label).toBe('Microphone problem')
+ expect(result.current.notice).toBe(
'Microphone access denied. Please allow microphone permissions.',
)
expect(result.current.hint).toBe('Allow microphone access, then tap to retry')
})
- it('keeps a plain retry for a failure that retrying can clear', async () => {
+ it('keeps the failed text and resends it from the orb', async () => {
harness.sendTurn.mockRejectedValueOnce(new Error('network down'))
const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
initialProps: createProps(),
@@ -502,8 +554,54 @@ describe('useVoiceConversation', () => {
await endOfSpeech('pause', 'hello there')
await waitFor(() => expect(result.current.phase).toBe('paused'))
- expect(result.current.label).toBe('network down')
- expect(result.current.hint).toBe('Tap to retry')
+ expect(result.current.label).toBe("Couldn't send your message")
+ expect(result.current.notice).toBe("Couldn't send: network down")
+ expect(result.current.hint).toBe('Tap to resend')
+ expect(result.current.orbLabel).toBe('Resend message')
+ expect(result.current.canEditInTextBox).toBe(true)
+
+ act(() => result.current.tapOrb())
+
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+ expect(harness.sendTurn).toHaveBeenCalledTimes(2)
+ expect(harness.sendTurn).toHaveBeenLastCalledWith('hello there', { busy: false })
+ expect(result.current.notice).toBeNull()
+ expect(result.current.canEditInTextBox).toBe(false)
+ })
+
+ it('resends the failed text from the resume control', async () => {
+ harness.sendTurn.mockRejectedValueOnce(new Error('network down'))
+ const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
+ initialProps: createProps(),
+ })
+
+ act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ await endOfSpeech('pause', 'hello there')
+ await waitFor(() => expect(result.current.phase).toBe('paused'))
+
+ act(() => result.current.resume())
+
+ await waitFor(() => expect(harness.sendTurn).toHaveBeenCalledTimes(2))
+ expect(harness.sendTurn).toHaveBeenLastCalledWith('hello there', { busy: false })
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+ })
+
+ it('moves the failed text into the composer instead of resuming', async () => {
+ harness.sendTurn.mockRejectedValueOnce(new Error('network down'))
+ const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
+ initialProps: createProps(),
+ })
+
+ act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ await endOfSpeech('pause', 'hello there')
+ await waitFor(() => expect(result.current.phase).toBe('paused'))
+
+ act(() => result.current.editInTextBox())
+
+ expect(harness.onEditInTextBox).toHaveBeenCalledWith('hello there')
+ expect(result.current.phase).toBe('off')
})
it('reports that the microphone is starting until capture begins', async () => {
@@ -525,18 +623,116 @@ describe('useVoiceConversation', () => {
expect(result.current.hint).toBe('Tap to send')
})
- it('pauses when speech recognition reports an error while listening', async () => {
+ it('keeps listening and restarts capture when a transcription fails', async () => {
const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
initialProps: createProps(),
})
act(() => result.current.start())
await waitFor(() => expect(result.current.phase).toBe('listening'))
+ expect(harness.startRecording).toHaveBeenCalledTimes(1)
- updateStt({ isError: true, error: 'Microphone access denied' })
+ updateStt({ isRecording: true })
+ updateStt({ isError: true, error: 'STT API returned invalid response' })
+
+ await waitFor(() => expect(harness.startRecording).toHaveBeenCalledTimes(2))
+ expect(harness.abortRecording).toHaveBeenCalledTimes(1)
+ expect(result.current.phase).toBe('listening')
+ expect(result.current.label).toBe('Listening')
+ expect(result.current.notice).toBe(
+ "Couldn't transcribe that: STT API returned invalid response. Still listening",
+ )
+ expect(harness.sendTurn).not.toHaveBeenCalled()
+ })
+
+ it('pauses after three transcription failures in a row', async () => {
+ const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
+ initialProps: createProps(),
+ })
+
+ act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+
+ updateStt({ isError: true, error: 'STT API returned invalid response' })
+ await waitFor(() => expect(harness.startRecording).toHaveBeenCalledTimes(2))
+ updateStt({ isError: false, error: null })
+
+ updateStt({ isError: true, error: 'STT API returned invalid response' })
+ await waitFor(() => expect(harness.startRecording).toHaveBeenCalledTimes(3))
+ updateStt({ isError: false, error: null })
+
+ updateStt({ isError: true, error: 'STT API returned invalid response' })
await waitFor(() => expect(result.current.phase).toBe('paused'))
- expect(result.current.label).toBe('Microphone access denied')
+ expect(result.current.label).toBe("Transcription isn't working")
+ expect(result.current.hint).toBe('Tap to try again')
+ expect(result.current.notice).toBe('STT API returned invalid response')
+ expect(harness.startRecording).toHaveBeenCalledTimes(3)
+ })
+
+ it('resets the transcription failure streak after a sent message', async () => {
+ const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
+ initialProps: createProps({ status: 'busy' }),
+ })
+
+ act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+
+ act(() => result.current.tapOrb())
+ await waitFor(() => expect(result.current.phase).toBe('recording'))
+ updateStt({ isError: true, error: 'first failure' })
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+ updateStt({ isError: false, error: null })
+
+ act(() => result.current.tapOrb())
+ await waitFor(() => expect(result.current.phase).toBe('recording'))
+ updateStt({ isError: true, error: 'second failure' })
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+ updateStt({ isError: false, error: null })
+
+ act(() => result.current.tapOrb())
+ await waitFor(() => expect(result.current.phase).toBe('recording'))
+ await endOfSpeech('pause', 'hello there')
+ await waitFor(() =>
+ expect(harness.sendTurn).toHaveBeenCalledWith('hello there', { busy: true }),
+ )
+
+ for (const error of ['third failure', 'fourth failure']) {
+ act(() => result.current.tapOrb())
+ await waitFor(() => expect(result.current.phase).toBe('recording'))
+ updateStt({ isError: true, error })
+ await waitFor(() => expect(result.current.phase).toBe('working'))
+ updateStt({ isError: false, error: null })
+ }
+
+ expect(result.current.phase).toBe('working')
+ expect(harness.sendTurn).toHaveBeenCalledTimes(1)
+ })
+
+ it('restarts capture once when a transcription fails while a turn is finishing', async () => {
+ const { result } = renderHook((props: UseVoiceConversationInput) => useVoiceConversation(props, collaborators), {
+ initialProps: createProps(),
+ })
+
+ act(() => result.current.start())
+ await waitFor(() => expect(result.current.phase).toBe('listening'))
+ expect(harness.startRecording).toHaveBeenCalledTimes(1)
+
+ updateStt({ isRecording: true })
+ act(() => result.current.tapOrb())
+ updateStt({ isError: true, error: 'STT API returned invalid response' })
+
+ expect(harness.startRecording).toHaveBeenCalledTimes(1)
+
+ updateStt({ isRecording: false, isProcessing: false, isError: true })
+
+ await waitFor(() => expect(harness.startRecording).toHaveBeenCalledTimes(2))
+ expect(result.current.phase).toBe('listening')
+ expect(result.current.notice).toBe(
+ "Couldn't transcribe that: STT API returned invalid response. Still listening",
+ )
+ expect(harness.sendTurn).not.toHaveBeenCalled()
+ expect(harness.startRecording).toHaveBeenCalledTimes(2)
})
it('pauses instead of finishing the turn when reading the reply fails', async () => {
@@ -556,7 +752,8 @@ describe('useVoiceConversation', () => {
act(() => speechEndHandler(0)('error', 'Audio playback was blocked by the browser'))
expect(result.current.phase).toBe('paused')
- expect(result.current.label).toBe(
+ expect(result.current.label).toBe("Couldn't read the reply")
+ expect(result.current.notice).toBe(
'Reading the reply failed: Audio playback was blocked by the browser',
)
expect(result.current.hint).toBe('Tap to retry')
@@ -580,7 +777,8 @@ describe('useVoiceConversation', () => {
act(() => speechEndHandler(0)('error'))
expect(result.current.phase).toBe('paused')
- expect(result.current.label).toBe('Reading the reply failed')
+ expect(result.current.label).toBe("Couldn't read the reply")
+ expect(result.current.notice).toBe('Reading the reply failed')
})
it('marks replies as heard without speaking when read-back is turned off', async () => {
diff --git a/frontend/src/hooks/useVoiceConversation.ts b/frontend/src/hooks/useVoiceConversation.ts
index baf1b6b63..6b0ed364a 100644
--- a/frontend/src/hooks/useVoiceConversation.ts
+++ b/frontend/src/hooks/useVoiceConversation.ts
@@ -17,6 +17,7 @@ import {
import type {
SessionInboxInfo,
SessionMessageInfo,
+ VoiceFailureSource,
VoicePauseReason,
VoicePhase,
VoiceSessionStatus,
@@ -108,6 +109,12 @@ const REPLY_READ_FAILED_MESSAGE = 'Reading the reply failed'
const STT_FAILED_MESSAGE = 'Speech recognition failed'
+const EMPTY_TURN_NOTICE = "Didn't hear anything, still listening"
+
+const EMPTY_QUEUE_NOTICE = "Didn't hear anything"
+
+const TRANSCRIPTION_FAILURE_LIMIT = 3
+
const LISTENING_MAX_TURN_MS = 120_000
const STT_STOP_TIMEOUT_MS = 10_000
@@ -130,6 +137,12 @@ function clearTimeoutRef(ref: TimeoutRef): void {
ref.current = null
}
+function failureNotice(source: VoiceFailureSource | null, error: string | null): string | null {
+ const message = error?.trim()
+ if (!message) return null
+ return source === 'send' ? `Couldn't send: ${message}` : message
+}
+
function latestMessageBaseline(messages: readonly SessionMessageInfo[]): string | null {
return messages[messages.length - 1]?.id ?? null
}
@@ -177,9 +190,13 @@ function orbLabelFor(
phase: VoicePhase,
canStopAgent: boolean,
hasHeldReading: boolean,
+ canResend: boolean,
): string {
if (phase === 'speaking') return canStopAgent ? 'Add a message' : ORB_LABELS.speaking
- if (phase === 'paused') return hasHeldReading ? 'Continue reading' : ORB_LABELS.paused
+ if (phase === 'paused') {
+ if (canResend) return 'Resend message'
+ return hasHeldReading ? 'Continue reading' : ORB_LABELS.paused
+ }
return ORB_LABELS[phase]
}
@@ -253,6 +270,10 @@ export function useVoiceConversation(
const playbackHeldRef = useRef(false)
const endTurnRef = useRef<((finalText?: string) => Promise) | null>(null)
const endRecordingRef = useRef<((finalText?: string) => Promise) | null>(null)
+ const failedTurnTextRef = useRef(null)
+ const transcriptionFailureCountRef = useRef(0)
+ const transcriptionFailedRef = useRef(false)
+ const captureStartingRef = useRef(false)
const captureSettleRef = useRef void>>([])
const exitInFlightRef = useRef(false)
const speakTokenRef = useRef(0)
@@ -365,16 +386,45 @@ export function useVoiceConversation(
if (!current || !current.isEnabled || !current.isSupported) return
const generation = turnGenerationRef.current
const phase = phaseRef.current
- const started = await current.startRecording({
- endpointing: { pauseMs, noSpeechTimeoutMs: VOICE_NO_SPEECH_TIMEOUT_MS },
- onEndOfSpeech: handleEndOfSpeech,
- })
+ captureStartingRef.current = true
+ let started = false
+ try {
+ started = await current.startRecording({
+ endpointing: { pauseMs, noSpeechTimeoutMs: VOICE_NO_SPEECH_TIMEOUT_MS },
+ onEndOfSpeech: handleEndOfSpeech,
+ })
+ } finally {
+ captureStartingRef.current = false
+ }
if (started) return
if (turnGenerationRef.current !== generation) return
if (phaseRef.current !== phase) return
failCapture(sttRef.current?.error ?? STT_FAILED_MESSAGE)
}, [pauseMs, handleEndOfSpeech, failCapture])
+ const handleTranscriptionFailure = useCallback(() => {
+ const phase = phaseRef.current
+ if (phase !== 'listening' && phase !== 'recording') return
+ transcriptionFailureCountRef.current += 1
+ const message = sttRef.current?.error?.trim() || STT_FAILED_MESSAGE
+ const current = sttRef.current
+ if (current && (current.isRecording || current.isProcessing)) current.abortRecording()
+ if (transcriptionFailureCountRef.current >= TRANSCRIPTION_FAILURE_LIMIT) {
+ dispatch({ type: 'error', message, source: 'transcription' })
+ return
+ }
+ setNotice(`Couldn't transcribe that: ${message}. Still listening`)
+ if (endTurnInFlightRef.current) {
+ transcriptionFailedRef.current = true
+ return
+ }
+ if (phase === 'recording') {
+ dispatch({ type: 'record-ended' })
+ return
+ }
+ void startCapture()
+ }, [startCapture])
+
const endTurn = useCallback(
async (finalText?: string) => {
if (exitInFlightRef.current) return
@@ -386,8 +436,19 @@ export function useVoiceConversation(
finalText === undefined ? await stopCapture() : capturedWords(finalText)
if (turnGenerationRef.current !== generation) return
if (phaseRef.current !== 'listening') return
+ if (!text) {
+ if (transcriptionFailedRef.current) {
+ transcriptionFailedRef.current = false
+ } else {
+ setNotice(EMPTY_TURN_NOTICE)
+ }
+ await startCapture()
+ return
+ }
dispatch({ type: 'transcript', text })
- if (!text) return
+ failedTurnTextRef.current = null
+ transcriptionFailureCountRef.current = 0
+ setNotice(null)
const latest = latestRef.current
const baselineId = latestMessageBaseline(latest.messages)
fireImpactHaptic()
@@ -395,6 +456,7 @@ export function useVoiceConversation(
await latest.sendTurn(text, { busy: latest.status !== 'idle' })
} catch (error) {
if (turnGenerationRef.current !== generation) return
+ failedTurnTextRef.current = text
dispatch({ type: 'send-failed', message: errorMessage(error) })
return
}
@@ -406,7 +468,7 @@ export function useVoiceConversation(
}
}
},
- [stopCapture],
+ [stopCapture, startCapture],
)
const endRecording = useCallback(
@@ -421,13 +483,24 @@ export function useVoiceConversation(
if (turnGenerationRef.current !== generation) return
if (phaseRef.current !== 'recording') return
dispatch({ type: 'record-ended' })
- if (!text) return
+ if (!text) {
+ if (transcriptionFailedRef.current) {
+ transcriptionFailedRef.current = false
+ } else {
+ setNotice(EMPTY_QUEUE_NOTICE)
+ }
+ return
+ }
+ failedTurnTextRef.current = null
+ transcriptionFailureCountRef.current = 0
+ setNotice(null)
const latest = latestRef.current
fireImpactHaptic()
try {
await latest.sendTurn(text, { busy: latest.status !== 'idle' })
} catch (error) {
if (turnGenerationRef.current !== generation) return
+ failedTurnTextRef.current = text
dispatch({ type: 'send-failed', message: errorMessage(error) })
}
} finally {
@@ -517,6 +590,11 @@ export function useVoiceConversation(
const interimText = capturedWords(stt.interimTranscript)
const turnTextValue = capturedWords(stt.transcript)
+ useEffect(() => {
+ if (!interimText && !turnTextValue) return
+ setNotice(null)
+ }, [interimText, turnTextValue])
+
useEffect(() => {
const isCapturing = state.phase === 'listening' || state.phase === 'recording'
if (!isCapturing || !stt.isRecording || stt.isEndpointing) {
@@ -649,6 +727,9 @@ export function useVoiceConversation(
invalidateTurn()
instructionEpochRef.current += 1
pendingTurnBaselineRef.current = null
+ failedTurnTextRef.current = null
+ transcriptionFailureCountRef.current = 0
+ transcriptionFailedRef.current = false
spokenIdsRef.current.clear()
speakingIdRef.current = null
activeSessionIDRef.current = latest.sessionID
@@ -706,6 +787,9 @@ export function useVoiceConversation(
const current = sttRef.current
invalidateTurn()
pendingTurnBaselineRef.current = null
+ failedTurnTextRef.current = null
+ transcriptionFailureCountRef.current = 0
+ transcriptionFailedRef.current = false
spokenIdsRef.current.clear()
speakingIdRef.current = null
if (current && (current.isRecording || current.isProcessing)) current.abortRecording()
@@ -750,6 +834,11 @@ export function useVoiceConversation(
const editInTextBox = useCallback(() => {
const phase = phaseRef.current
if (phase === 'off' || exitInFlightRef.current) return
+ const failedText = failedTurnTextRef.current
+ if (phase === 'paused' && failedText) {
+ performExit(failedText)
+ return
+ }
const capturedText = readCapturedText()
if ((phase !== 'listening' && phase !== 'recording') || !capturedText) {
performExit('')
@@ -763,8 +852,45 @@ export function useVoiceConversation(
})()
}, [invalidateTurn, performExit, readCapturedText, stopCapture])
+ const resendFailedTurn = useCallback(async (text: string) => {
+ if (phaseRef.current !== 'paused' || failedTurnTextRef.current !== text) return
+ if (endTurnInFlightRef.current) return
+ const generation = turnGenerationRef.current
+ endTurnInFlightRef.current = true
+ const latest = latestRef.current
+ const busy = latest.status !== 'idle'
+ const baselineId = latestMessageBaseline(latest.messages)
+ pendingTurnBaselineRef.current = null
+ setNotice(null)
+ fireImpactHaptic()
+ dispatch({ type: 'resend', busy, baselineId })
+ try {
+ await latest.sendTurn(text, { busy })
+ } catch (error) {
+ if (turnGenerationRef.current !== generation) return
+ failedTurnTextRef.current = text
+ dispatch({ type: 'send-failed', message: errorMessage(error) })
+ return
+ } finally {
+ if (turnGenerationRef.current === generation) {
+ endTurnInFlightRef.current = false
+ }
+ }
+ if (turnGenerationRef.current !== generation) return
+ failedTurnTextRef.current = null
+ dispatch({ type: 'turn-sent', baselineId })
+ }, [])
+
const resumeConversation = useCallback(() => {
if (phaseRef.current !== 'paused') return
+ transcriptionFailureCountRef.current = 0
+ transcriptionFailedRef.current = false
+ const failedText = failedTurnTextRef.current
+ if (failedText) {
+ void resendFailedTurn(failedText)
+ return
+ }
+ setNotice(null)
const latest = latestRef.current
if (playbackHeldRef.current) {
setHeldPlayback(false)
@@ -786,7 +912,7 @@ export function useVoiceConversation(
busy: latest.status !== 'idle' || pendingTurnBaseline !== null || hasUnspoken,
baselineId: resumeBaseline ?? currentTurnBaseline(latest.messages),
})
- }, [setHeldPlayback])
+ }, [setHeldPlayback, resendFailedTurn])
const skipReading = useCallback(() => {
const latest = latestRef.current
@@ -864,6 +990,8 @@ export function useVoiceConversation(
return () => {
invalidateTurn()
pendingTurnBaselineRef.current = null
+ transcriptionFailureCountRef.current = 0
+ transcriptionFailedRef.current = false
spokenIds.clear()
speakingIdRef.current = null
playbackHeldRef.current = false
@@ -926,10 +1054,13 @@ export function useVoiceConversation(
const wasError = previousSttErrorRef.current
previousSttErrorRef.current = stt.isError
if (!stt.isError || wasError) return
- failCapture(stt.error ?? STT_FAILED_MESSAGE)
- }, [stt.isError, stt.error, failCapture])
+ if (captureStartingRef.current) return
+ handleTranscriptionFailure()
+ }, [stt.isError, stt.error, handleTranscriptionFailure])
const hasHeldReading = state.phase === 'paused' && playbackHeld
+ const hasFailedTurnText =
+ state.phase === 'paused' && state.failureSource === 'send' && failedTurnTextRef.current !== null
const isCapturing = state.phase === 'listening' || state.phase === 'recording'
const textInput = {
phase: state.phase,
@@ -941,19 +1072,26 @@ export function useVoiceConversation(
error: state.error,
failureSource: state.failureSource,
isStartingCapture: isCapturing && stt.isStarting,
+ canResend: hasFailedTurnText,
}
const label = voiceConversationLabel(textInput)
const hint = voiceConversationHint(textInput)
const liveTranscript = isCapturing ? interimText || turnTextValue : ''
- const canEditInTextBox = isCapturing && (interimText !== '' || turnTextValue !== '')
+ const canEditInTextBox =
+ hasFailedTurnText || (isCapturing && (interimText !== '' || turnTextValue !== ''))
const canStopAgent = isActive && status !== 'idle'
+ const errorNotice =
+ state.phase === 'paused' && state.pauseReason === 'error'
+ ? failureNotice(state.failureSource, state.error)
+ : null
+ const shownNotice = errorNotice ?? notice
return {
isActive,
phase: state.phase,
label,
hint,
- orbLabel: orbLabelFor(state.phase, canStopAgent, hasHeldReading),
+ orbLabel: orbLabelFor(state.phase, canStopAgent, hasHeldReading, hasFailedTurnText),
liveTranscript,
canEditInTextBox,
canStopAgent,
@@ -961,7 +1099,7 @@ export function useVoiceConversation(
isEndpointing: stt.isEndpointing,
readRepliesAloud,
canReadRepliesAloud: tts.isEnabled,
- notice,
+ notice: shownNotice,
start,
exit,
editInTextBox,
diff --git a/frontend/src/lib/voiceConversation.test.ts b/frontend/src/lib/voiceConversation.test.ts
index 385e149ba..8f3830046 100644
--- a/frontend/src/lib/voiceConversation.test.ts
+++ b/frontend/src/lib/voiceConversation.test.ts
@@ -87,6 +87,7 @@ function labelInput(
error: null,
failureSource: null,
isStartingCapture: false,
+ canResend: false,
...overrides,
}
}
@@ -205,6 +206,47 @@ describe('reduceVoiceConversation', () => {
})
})
+ describe('resend', () => {
+ it('returns to sending with a cleared failure when the session is idle', () => {
+ const state = conversation({
+ phase: 'paused',
+ pauseReason: 'error',
+ error: 'network down',
+ failureSource: 'send',
+ baselineId: 'b2',
+ })
+ expect(
+ reduceVoiceConversation(state, { type: 'resend', busy: false, baselineId: 'b3' }),
+ ).toEqual({
+ ...state,
+ phase: 'sending',
+ pauseReason: null,
+ error: null,
+ failureSource: null,
+ })
+ })
+
+ it('returns to working with the new baseline when the session is busy', () => {
+ const state = conversation({
+ phase: 'paused',
+ pauseReason: 'error',
+ error: 'network down',
+ failureSource: 'send',
+ })
+ expect(
+ reduceVoiceConversation(state, { type: 'resend', busy: true, baselineId: 'b3' }),
+ ).toEqual({
+ ...state,
+ phase: 'working',
+ sawBusy: true,
+ baselineId: 'b3',
+ pauseReason: null,
+ error: null,
+ failureSource: null,
+ })
+ })
+ })
+
describe('status', () => {
it('records the first busy report after a turn is sent', () => {
const state = conversation({ phase: 'working', baselineId: 'b2' })
@@ -463,6 +505,16 @@ describe('reduceVoiceConversation', () => {
],
['resume-speech while listening', conversation({ phase: 'listening' }), { type: 'resume-speech' }],
['resume-speech while speaking', conversation({ phase: 'speaking' }), { type: 'resume-speech' }],
+ [
+ 'resend while listening',
+ conversation({ phase: 'listening' }),
+ { type: 'resend', busy: false, baselineId: null },
+ ],
+ [
+ 'resend while working',
+ conversation({ phase: 'working' }),
+ { type: 'resend', busy: true, baselineId: null },
+ ],
])('ignores %s and returns the same state object', (_description, state, event) => {
expect(reduceVoiceConversation(state, event)).toBe(state)
})
@@ -716,7 +768,42 @@ describe('voiceConversationLabel', () => {
error: 'Microphone access denied. Please allow microphone permissions.',
failureSource: 'capture',
},
- 'Microphone access denied. Please allow microphone permissions.',
+ 'Microphone problem',
+ ],
+ [
+ 'paused after a capture failure without a reason',
+ { phase: 'paused', pauseReason: 'error', failureSource: 'capture' },
+ 'Microphone problem',
+ ],
+ [
+ 'paused after a send failure with a reason',
+ {
+ phase: 'paused',
+ pauseReason: 'error',
+ error: 'network down',
+ failureSource: 'send',
+ },
+ "Couldn't send your message",
+ ],
+ [
+ 'paused after a playback failure with a reason',
+ {
+ phase: 'paused',
+ pauseReason: 'error',
+ error: 'Audio playback was blocked by the browser',
+ failureSource: 'playback',
+ },
+ "Couldn't read the reply",
+ ],
+ [
+ 'paused after a transcription failure',
+ {
+ phase: 'paused',
+ pauseReason: 'error',
+ error: 'STT API returned invalid response',
+ failureSource: 'transcription',
+ },
+ "Transcription isn't working",
],
[
'paused after a failure with a blank reason',
@@ -783,11 +870,21 @@ describe('voiceConversationHint', () => {
{ phase: 'paused', pauseReason: 'error', failureSource: 'send' },
'Tap to retry',
],
+ [
+ 'paused after a send failure with the text kept',
+ { phase: 'paused', pauseReason: 'error', failureSource: 'send', canResend: true },
+ 'Tap to resend',
+ ],
[
'paused after a playback failure',
{ phase: 'paused', pauseReason: 'error', failureSource: 'playback' },
'Tap to retry',
],
+ [
+ 'paused after a transcription failure',
+ { phase: 'paused', pauseReason: 'error', failureSource: 'transcription' },
+ 'Tap to try again',
+ ],
['paused by the user', { phase: 'paused', pauseReason: 'user' }, 'Tap to talk'],
[
'paused by the user while a reply is held',
diff --git a/shared/src/opencode/voiceConversation.ts b/shared/src/opencode/voiceConversation.ts
index 697b2d765..f5a1722cf 100644
--- a/shared/src/opencode/voiceConversation.ts
+++ b/shared/src/opencode/voiceConversation.ts
@@ -18,7 +18,7 @@ export type VoicePhase =
export type VoicePauseReason = 'user' | 'background' | 'no-speech' | 'error'
-export type VoiceFailureSource = 'capture' | 'send' | 'playback'
+export type VoiceFailureSource = 'capture' | 'send' | 'playback' | 'transcription'
export type VoiceSessionStatus = SessionStatus['type']
@@ -46,6 +46,7 @@ export type VoiceConversationEvent =
| { type: 'turn-sent'; baselineId: string | null }
| { type: 'turn-started'; baselineId: string | null }
| { type: 'send-failed'; message: string }
+ | { type: 'resend'; busy: boolean; baselineId: string | null }
| { type: 'status'; busy: boolean }
| { type: 'speak-start' }
| { type: 'speech-ended' }
@@ -83,6 +84,7 @@ export interface VoiceConversationLabelInput {
error?: string | null
failureSource?: VoiceFailureSource | null
isStartingCapture?: boolean
+ canResend?: boolean
}
export function reduceVoiceConversation(
@@ -129,6 +131,25 @@ export function reduceVoiceConversation(
error: event.message,
failureSource: 'send',
}
+ case 'resend':
+ if (state.phase !== 'paused') return state
+ return event.busy
+ ? {
+ ...state,
+ phase: 'working',
+ sawBusy: true,
+ baselineId: event.baselineId,
+ pauseReason: null,
+ error: null,
+ failureSource: null,
+ }
+ : {
+ ...state,
+ phase: 'sending',
+ pauseReason: null,
+ error: null,
+ failureSource: null,
+ }
case 'status':
if (state.phase !== 'working') return state
if (!event.busy || state.sawBusy) return state
@@ -267,7 +288,7 @@ export function isVoiceTurnComplete(input: VoiceTurnCompletionInput): boolean {
}
export function voiceConversationLabel(input: VoiceConversationLabelInput): string {
- const { phase, pauseReason, pendingApproval, error, isStartingCapture } = input
+ const { phase, pauseReason, pendingApproval, error, failureSource, isStartingCapture } = input
switch (phase) {
case 'listening':
@@ -282,7 +303,13 @@ export function voiceConversationLabel(input: VoiceConversationLabelInput): stri
return isStartingCapture ? 'Starting…' : 'Adding to queue'
case 'paused':
if (pauseReason === 'no-speech') return "Didn't catch that"
- if (pauseReason === 'error') return error?.trim() || 'Something went wrong'
+ if (pauseReason === 'error') {
+ if (failureSource === 'send') return "Couldn't send your message"
+ if (failureSource === 'capture') return 'Microphone problem'
+ if (failureSource === 'playback') return "Couldn't read the reply"
+ if (failureSource === 'transcription') return "Transcription isn't working"
+ return error?.trim() || 'Something went wrong'
+ }
return 'Paused'
case 'off':
return ''
@@ -318,9 +345,10 @@ export function voiceConversationHint(input: VoiceConversationLabelInput): strin
case 'paused':
if (pauseReason === 'no-speech') return 'Tap to talk'
if (pauseReason === 'error') {
- return failureSource === 'capture'
- ? 'Allow microphone access, then tap to retry'
- : 'Tap to retry'
+ if (failureSource === 'capture') return 'Allow microphone access, then tap to retry'
+ if (failureSource === 'send') return input.canResend ? 'Tap to resend' : 'Tap to retry'
+ if (failureSource === 'transcription') return 'Tap to try again'
+ return 'Tap to retry'
}
return isPlaybackPaused ? 'Tap to continue' : 'Tap to talk'
case 'off':
From eca6a29b87082e311f4b7d74baaa50d1647e87d1 Mon Sep 17 00:00:00 2001
From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
Date: Fri, 27 Nov 2026 23:06:11 -0500
Subject: [PATCH 3/6] Move the read-aloud toggle beside Pause so Stop fits in
the voice bar
---
.../message/VoiceConversationBar.tsx | 20 +++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/frontend/src/components/message/VoiceConversationBar.tsx b/frontend/src/components/message/VoiceConversationBar.tsx
index 36964e30f..b6f24aa12 100644
--- a/frontend/src/components/message/VoiceConversationBar.tsx
+++ b/frontend/src/components/message/VoiceConversationBar.tsx
@@ -101,15 +101,6 @@ export function VoiceConversationBar({
)}
- {canReadRepliesAloud ? (
-
- {readRepliesAloud ? : }
-
- ) : null}
{canStopAgent ? (
@@ -119,7 +110,16 @@ export function VoiceConversationBar({
-
+
+ {canReadRepliesAloud ? (
+
+ {readRepliesAloud ? : }
+
+ ) : null}
{hasPendingApproval ? (
Date: Fri, 27 Nov 2026 23:08:18 -0500
Subject: [PATCH 4/6] Clear the transcription failure flag when a turn still
sends text
---
frontend/src/hooks/useVoiceConversation.ts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/frontend/src/hooks/useVoiceConversation.ts b/frontend/src/hooks/useVoiceConversation.ts
index 6b0ed364a..bcf611018 100644
--- a/frontend/src/hooks/useVoiceConversation.ts
+++ b/frontend/src/hooks/useVoiceConversation.ts
@@ -448,6 +448,7 @@ export function useVoiceConversation(
dispatch({ type: 'transcript', text })
failedTurnTextRef.current = null
transcriptionFailureCountRef.current = 0
+ transcriptionFailedRef.current = false
setNotice(null)
const latest = latestRef.current
const baselineId = latestMessageBaseline(latest.messages)
@@ -493,6 +494,7 @@ export function useVoiceConversation(
}
failedTurnTextRef.current = null
transcriptionFailureCountRef.current = 0
+ transcriptionFailedRef.current = false
setNotice(null)
const latest = latestRef.current
fireImpactHaptic()
From efcb9dee289114fd02e6d784e2358d710ccbf8c3 Mon Sep 17 00:00:00 2001
From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
Date: Fri, 27 Nov 2026 23:10:14 -0500
Subject: [PATCH 5/6] Pause cleanly at the transcription failure limit, forget
resent text once delivered, and keep the composer opaque while a form is open
---
frontend/src/hooks/useVoiceConversation.ts | 3 ++-
frontend/src/pages/SessionDetail.tsx | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/frontend/src/hooks/useVoiceConversation.ts b/frontend/src/hooks/useVoiceConversation.ts
index bcf611018..6c035e32c 100644
--- a/frontend/src/hooks/useVoiceConversation.ts
+++ b/frontend/src/hooks/useVoiceConversation.ts
@@ -410,6 +410,7 @@ export function useVoiceConversation(
const current = sttRef.current
if (current && (current.isRecording || current.isProcessing)) current.abortRecording()
if (transcriptionFailureCountRef.current >= TRANSCRIPTION_FAILURE_LIMIT) {
+ phaseRef.current = 'paused'
dispatch({ type: 'error', message, source: 'transcription' })
return
}
@@ -878,8 +879,8 @@ export function useVoiceConversation(
endTurnInFlightRef.current = false
}
}
- if (turnGenerationRef.current !== generation) return
failedTurnTextRef.current = null
+ if (turnGenerationRef.current !== generation) return
dispatch({ type: 'turn-sent', baselineId })
}, [])
diff --git a/frontend/src/pages/SessionDetail.tsx b/frontend/src/pages/SessionDetail.tsx
index f46563910..7f0995a46 100644
--- a/frontend/src/pages/SessionDetail.tsx
+++ b/frontend/src/pages/SessionDetail.tsx
@@ -969,7 +969,7 @@ export function SessionDetail() {
onAskSideQuestion={() => handleAskSideQuestion('')}
/>
)}
-
+
From eab3022d63ee073955ce8c33ba8ce8e8c585c974 Mon Sep 17 00:00:00 2001
From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
Date: Fri, 27 Nov 2026 23:11:25 -0500
Subject: [PATCH 6/6] Invalidate held playback callbacks when read-back is
turned off
---
frontend/src/hooks/useVoiceConversation.ts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/frontend/src/hooks/useVoiceConversation.ts b/frontend/src/hooks/useVoiceConversation.ts
index 6c035e32c..d86103151 100644
--- a/frontend/src/hooks/useVoiceConversation.ts
+++ b/frontend/src/hooks/useVoiceConversation.ts
@@ -946,6 +946,8 @@ export function useVoiceConversation(
}
if (!playbackHeldRef.current) return
setHeldPlayback(false)
+ speakTokenRef.current += 1
+ speakingIdRef.current = null
latestRef.current.tts.stop()
}, [setReadRepliesAloud, setHeldPlayback])