diff --git a/openless-all/app/src-tauri/src/asr/local/foundry_provider.rs b/openless-all/app/src-tauri/src/asr/local/foundry_provider.rs index 49a5919d..830b1ad6 100644 --- a/openless-all/app/src-tauri/src/asr/local/foundry_provider.rs +++ b/openless-all/app/src-tauri/src/asr/local/foundry_provider.rs @@ -80,7 +80,7 @@ impl FoundryLocalWhisperAsr { if self.cancel_generation.load(Ordering::SeqCst) != cancel_generation { anyhow::bail!("Foundry Local Whisper transcription cancelled"); } - if result.is_ok() { + if foundry_transcribe_attempt_consumes_buffer(&result) { self.buffer.lock().clear(); } result @@ -238,6 +238,11 @@ fn trim_transcript_text(text: &str) -> String { text.trim().to_string() } +fn foundry_transcribe_attempt_consumes_buffer(result: &Result) -> bool { + let _ = result; + true +} + #[cfg(test)] mod tests { use crate::recorder::AudioConsumer; @@ -308,6 +313,13 @@ mod tests { assert_eq!(super::trim_transcript_text(" hello\r\n"), "hello"); } + #[test] + fn foundry_transcribe_attempt_consumes_buffer_even_on_error() { + let result: anyhow::Result<()> = Err(anyhow::anyhow!("transient runtime error")); + + assert!(super::foundry_transcribe_attempt_consumes_buffer(&result)); + } + #[test] fn foundry_provider_cancel_clears_buffer() { #[cfg(target_os = "windows")] diff --git a/openless-all/app/src-tauri/src/coordinator.rs b/openless-all/app/src-tauri/src/coordinator.rs index f7e76590..a05a3476 100644 --- a/openless-all/app/src-tauri/src/coordinator.rs +++ b/openless-all/app/src-tauri/src/coordinator.rs @@ -2537,6 +2537,7 @@ async fn end_session(inner: &Arc) -> Result<(), String> { return Ok(()); } log::error!("[coord] Foundry Local Whisper transcribe failed: {e:#}"); + schedule_foundry_local_asr_release(inner, current_session_id); emit_capsule( inner, CapsuleState::Error,