Repository navigation
Fix #599: live mode STT restored — ORT path, async deadlock, diagnostic logging - #601
Conversation
…diagnostic logging Three fixes to restore live mode speech-to-text: 1. Set ORT_DYLIB_PATH in start-workers.sh (ONNX Runtime wasn't found) 2. Use spawn_blocking for VAD init (ORT deadlocked in async context) 3. Added diagnostic logging throughout listen_and_transcribe pipeline 4. Orphan watchdog timeout 60s → 600s (PR #600, already merged)
There was a problem hiding this comment.
Pull request overview
Restores live-mode STT/subtitles by ensuring ONNX Runtime can be located at runtime and by avoiding an ORT deadlock when initializing Silero VAD inside async tasks.
Changes:
- Export
ORT_DYLIB_PATHinstart-workers.shfor Homebrew-installed ONNX Runtime. - Initialize
ProductionVADviatokio::task::spawn_blockingto avoid ORT deadlock in async context. - Add additional diagnostic logging around STT/VAD startup and initialization.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/workers/start-workers.sh |
Sets ORT_DYLIB_PATH to help the Rust workers dynamically load ONNX Runtime for Silero VAD. |
src/workers/continuum-core/src/live/transport/livekit_agent.rs |
Adds STT lifecycle logs and moves VAD initialization to spawn_blocking to avoid async deadlock. |
src/workers/continuum-core/src/live/audio/vad/production.rs |
Adds initialization progress logs for the two-stage VAD pipeline. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # The ort crate with load-dynamic feature needs to find libonnxruntime.dylib | ||
| if [ -f "/opt/homebrew/lib/libonnxruntime.dylib" ]; then | ||
| export ORT_DYLIB_PATH="/opt/homebrew/lib/libonnxruntime.dylib" | ||
| elif [ -f "/usr/local/lib/libonnxruntime.so" ]; then | ||
| export ORT_DYLIB_PATH="/usr/local/lib/libonnxruntime.so" |
There was a problem hiding this comment.
start-workers.sh sets ORT_DYLIB_PATH based only on Homebrew/mac paths and will overwrite any user-provided ORT_DYLIB_PATH. This misses the repo’s standard user-space install location (~/.continuum/lib/libonnxruntime.so) used by install.sh/parallel-start.sh and can break VAD when start-workers.sh is run directly. Consider: only setting ORT_DYLIB_PATH if it’s unset, and checking $HOME/.continuum/lib first (then Homebrew paths).
| # The ort crate with load-dynamic feature needs to find libonnxruntime.dylib | |
| if [ -f "/opt/homebrew/lib/libonnxruntime.dylib" ]; then | |
| export ORT_DYLIB_PATH="/opt/homebrew/lib/libonnxruntime.dylib" | |
| elif [ -f "/usr/local/lib/libonnxruntime.so" ]; then | |
| export ORT_DYLIB_PATH="/usr/local/lib/libonnxruntime.so" | |
| # The ort crate with load-dynamic feature needs to find the ONNX Runtime shared library. | |
| # Respect any user-provided ORT_DYLIB_PATH; otherwise, try common install locations. | |
| if [ -z "${ORT_DYLIB_PATH:-}" ]; then | |
| # Prefer the repo's standard user-space install location | |
| if [ -f "$HOME/.continuum/lib/libonnxruntime.so" ]; then | |
| export ORT_DYLIB_PATH="$HOME/.continuum/lib/libonnxruntime.so" | |
| elif [ -f "/opt/homebrew/lib/libonnxruntime.dylib" ]; then | |
| export ORT_DYLIB_PATH="/opt/homebrew/lib/libonnxruntime.dylib" | |
| elif [ -f "/usr/local/lib/libonnxruntime.so" ]; then | |
| export ORT_DYLIB_PATH="/usr/local/lib/libonnxruntime.so" | |
| fi |
| # Set ORT_DYLIB_PATH for ONNX Runtime (needed by Silero VAD in live mode) | ||
| # The ort crate with load-dynamic feature needs to find libonnxruntime.dylib | ||
| if [ -f "/opt/homebrew/lib/libonnxruntime.dylib" ]; then | ||
| export ORT_DYLIB_PATH="/opt/homebrew/lib/libonnxruntime.dylib" |
There was a problem hiding this comment.
On macOS Intel/Homebrew the library is typically /usr/local/lib/libonnxruntime.dylib, but this script only checks /usr/local/lib/libonnxruntime.so. Add a .dylib check (and keep .so for Linux) so ORT_DYLIB_PATH is set correctly on Intel Macs.
| export ORT_DYLIB_PATH="/opt/homebrew/lib/libonnxruntime.dylib" | |
| export ORT_DYLIB_PATH="/opt/homebrew/lib/libonnxruntime.dylib" | |
| elif [ -f "/usr/local/lib/libonnxruntime.dylib" ]; then | |
| export ORT_DYLIB_PATH="/usr/local/lib/libonnxruntime.dylib" |
| return; | ||
| } | ||
| Err(e) => { | ||
| clog_error!("🎤 STT: VAD init task panicked for '{}': {}", speaker_name, e); |
There was a problem hiding this comment.
tokio::task::JoinError isn’t always a panic (it can also indicate task cancellation). The log message says "panicked" unconditionally, which can mislead debugging. Consider branching on e.is_panic()/e.is_cancelled() (or wording like "VAD init task failed/join error") and logging the appropriate reason.
| clog_error!("🎤 STT: VAD init task panicked for '{}': {}", speaker_name, e); | |
| if e.is_panic() { | |
| clog_error!("🎤 STT: VAD init task panicked for '{}': {}", speaker_name, e); | |
| } else if e.is_cancelled() { | |
| clog_error!("🎤 STT: VAD init task was cancelled for '{}' (join error): {}", speaker_name, e); | |
| } else { | |
| clog_error!("🎤 STT: VAD init task failed for '{}' (join error): {}", speaker_name, e); | |
| } |
| tbuf, | ||
| ) | ||
| .await; | ||
| clog_warn!("🎤 STT: listen_and_transcribe exited for '{}'", sname); |
There was a problem hiding this comment.
listen_and_transcribe() ending is likely a normal lifecycle event (participant disconnect / track ended), but it’s logged at warn level. Consider using info/debug (or include an error condition) to avoid warning spam during normal calls.
| clog_warn!("🎤 STT: listen_and_transcribe exited for '{}'", sname); | |
| clog_info!("🎤 STT: listen_and_transcribe exited for '{}'", sname); |
Problem
Live mode subtitles completely broken. No speech-to-text from human mic.
Root Causes (3 layers)
ort::Session::builder()uses internal std::sync::Mutex that deadlocks when called from tokio async task. Fixed withspawn_blocking.Evidence
Before:
VAD init task panicked with message "Mutex poisoned"After: Subtitles appear when speaking in live mode.
Test