fix(voice): add WSL2 PowerShell audio fallback for TTS playback - #68604
Closed
ygd58 wants to merge 1 commit into
Closed
fix(voice): add WSL2 PowerShell audio fallback for TTS playback#68604ygd58 wants to merge 1 commit into
ygd58 wants to merge 1 commit into
Conversation
Ports NousResearch#63768 forward onto current main per teknium1's review. On WSL2 without a PulseAudio bridge, ffplay and aplay have no audio device and TTS playback silently fails (issue NousResearch#17608). When powershell.exe and ffmpeg are available, convert the audio to a uniquely-named WAV in the Windows %TEMP% directory and play it via Media.SoundPlayer. Per review, this fixes two gaps in the original port: 1. Exit-status masking: the cleanup subshell was '( ffmpeg && powershell ); rm -f wav' -- the shell's exit status is the LAST command's (rm -f, which is always 0), so a real ffmpeg/PowerShell failure could never be detected by the rc-checking fallback logic added to the player loop. Now captures the real status before cleanup and re-exits with it: '( ffmpeg && powershell ); rc=0; rm -f wav; exit '. 2. The no-Pulse WSL gate in detect_audio_environment() still hard-blocked voice mode entirely (input AND output) even when the PowerShell fallback made TTS output viable. Added _wsl_powershell_tts_available() and use it to downgrade the WSL-without-Pulse case from a hard 'warnings' block to a non-blocking 'notices' entry when the fallback is available -- the same PulseAudio-bridge recording guidance is still surfaced (mic capture genuinely still needs it), it just no longer blocks /voice on for TTS-only usage. cli.py's existing env_check['available'] gate needed no changes since it already respects this flag. Also fixed the flaky uniqueness test (the original asserted len(filenames) >= 2, which passed trivially on zero captured filenames) and added a real fallback-triggering regression test for the exit-status fix. 10 new/fixed tests pass in TestWSL2PowerShellFallback and the new TestWSLAudioEnvironmentGate; 80/80 in the full tests/tools/test_voice_mode.py file.
Closed
1 task
This was referenced Jul 28, 2026
Contributor
|
Merged into main via consolidated salvage PR #73520 (merge Your contribution is credited to you in git history. Thank you! Closing this PR as merged-via-salvage. |
|
这是来自QQ邮箱的假期自动回复邮件。
您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Ports #63768 forward onto current main per @teknium1's review.
Problem
On WSL2 without a PulseAudio bridge, ffplay and aplay have no audio device and TTS playback silently fails (issue #17608).
Fix
When powershell.exe and ffmpeg are available, convert audio to a uniquely-named WAV in Windows %TEMP% and play via Media.SoundPlayer.
Per review, fixes two gaps:
( ffmpeg && powershell ); rm -f wav-- the shell exits withrm -f's status (always 0), so a real failure could never be detected. Now:( ffmpeg && powershell ); rc=$?; rm -f wav; exit $rc._wsl_powershell_tts_available()to downgrade that case from a hard block to a non-blocking notice (recording still needs PulseAudio and that guidance stays visible) -- no cli.py changes needed since it already respectsavailable.Verification
Fixed the flaky uniqueness test (previously passed trivially on zero captured filenames) and added a real fallback-triggering regression test for the exit-status fix, plus WSL-gate coverage. 10 new/fixed tests; 80/80 in the full
tests/tools/test_voice_mode.pyfile.