-
Notifications
You must be signed in to change notification settings - Fork 0
Simplify voice state flow and trim backend state logging #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: separated2
Are you sure you want to change the base?
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR simplifies the voice state management by removing the pause flow and collapsing multiple UI modes into a single session-based model with three states: IDLE, LISTENING, and SPEAKING. It also removes verbose backend state logging.
Changes:
- Replaced
uiModestate machine (FRESH/ACTIVE/PAUSED) with a simplersessionActiveboolean flag - Removed pause/resume functionality including
pauseListening,resumeListeningfunctions, pause timeout scheduling, and pause UI controls - Simplified
deriveAppStateto return only IDLE, LISTENING, or SPEAKING based on session state - Removed auto-start logic that automatically initiated sessions on first WebSocket connection
- Cleaned up backend state logging and removed pause-related refs from audio capture hook
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend-voice/src/hooks/useAudioCapture.js | Removed pause-related refs (pausedRef), functions (pauseListening, resumeListening, setProcessorPaused), and pause state checks from audio processing flow |
| frontend-voice/src/App.jsx | Refactored state management from uiMode to sessionActive, removed pause timeout logic and UI controls, simplified state derivation and tap handling, removed auto-start behavior, cleaned up timeout countdown to use simple number instead of object with mode |
Comments suppressed due to low confidence (1)
frontend-voice/src/App.jsx:926
- The handleTap function no longer handles the LISTENING state. When a user taps while in LISTENING state (which is the most common active state), nothing happens. The previous implementation allowed pausing; now there's no action defined for this state. Consider adding functionality to stop/interrupt the session or clarify intended behavior with a comment.
const handleTap = () => {
primeAudioContext();
if (showHistory || showSettings) return;
const currentAppState = deriveAppState(
sessionActiveRef.current,
backendStateRef.current,
responseActiveRef.current,
);
if (currentAppState === 'SPEAKING') {
console.log('🎤 TAP: INTERRUPT');
interruptResponse();
return;
}
if (currentAppState === 'IDLE') {
console.log('🎤 TAP: FIRST START');
clearInactivityTimeouts();
cancelFade();
clearTranscriptForListening();
setBackendState('IDLE');
setSessionActive(true);
setTextVisible(true);
initMic().then(ok => {
if (ok) {
startNewConversation();
}
});
}
// Other states are handled above.
| eot_timeout_ms: 1000, // 1 second - natural conversation pace | ||
| eot_threshold: 0.7, // balanced confidence threshold | ||
| pause_timeout_seconds: 30, // 30 seconds when paused | ||
| pause_timeout_seconds: 30, |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pause_timeout_seconds field remains in the default settings but the pause timeout functionality has been completely removed. This field should be removed from defaultSettings to fully eliminate the pause flow and avoid confusion.
| pause_timeout_seconds: 30, |
Motivation
IDLE,LISTENING,SPEAKING) and remove the pause flow and its maintenance surface.Description
sessionActiveflag rather thanuiMode, and changedderiveAppStateto acceptsessionActiveand return onlyIDLE,LISTENING, orSPEAKING.pausedhandling acrosssrc/App.jsxandsrc/hooks/useAudioCapture.js, removed pause timeouts and the pause slider from settings, and simplified timeout countdown representation.useAudioCaptureby removingpausedRef,setProcessorPaused, andpause/resumefunctions so the microphone hook only manages active capture, pending buffers and session-ready flushing.src/App.jsxto reduce overhead and keep the message handler focused on state transitions.Testing
npm run devand confirmed Vite reported the app ready on the configured host and port (success).Codex Task