Skip to content

Conversation

@jck411
Copy link
Owner

@jck411 jck411 commented Jan 20, 2026

Motivation

  • Reduce complexity of the voice UI by collapsing multiple modes into a single session model (IDLE, LISTENING, SPEAKING) and remove the pause flow and its maintenance surface.
  • Remove noisy/expensive logging in the backend state handler to keep the state path lean and avoid redundant computation.

Description

  • Reworked app state to use a sessionActive flag rather than uiMode, and changed deriveAppState to accept sessionActive and return only IDLE, LISTENING, or SPEAKING.
  • Removed pause-related state, APIs and UI: eliminated paused handling across src/App.jsx and src/hooks/useAudioCapture.js, removed pause timeouts and the pause slider from settings, and simplified timeout countdown representation.
  • Simplified useAudioCapture by removing pausedRef, setProcessorPaused, and pause/resume functions so the microphone hook only manages active capture, pending buffers and session-ready flushing.
  • Trimmed unnecessary backend/app state logging in src/App.jsx to reduce overhead and keep the message handler focused on state transitions.

Testing

  • Started the dev server with npm run dev and confirmed Vite reported the app ready on the configured host and port (success).
  • Ran a Playwright script that opened the voice UI and captured a screenshot of the settings panel to validate UI loads after the changes (screenshot created successfully).
  • No automated unit tests were executed for the latest edits.

Codex Task

Copilot AI review requested due to automatic review settings January 20, 2026 00:17
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link

Copilot AI left a 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 uiMode state machine (FRESH/ACTIVE/PAUSED) with a simpler sessionActive boolean flag
  • Removed pause/resume functionality including pauseListening, resumeListening functions, pause timeout scheduling, and pause UI controls
  • Simplified deriveAppState to 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,
Copy link

Copilot AI Jan 20, 2026

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.

Suggested change
pause_timeout_seconds: 30,

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants