Voice mode incorrectly blocked on WSL2 — WSLg provides working audio
Bug Description
Voice mode is hardcoded to reject WSL environments entirely:
if(SA()==="wsl") return {
available: false,
reason: "Voice mode is not supported in WSL (Windows Subsystem for Linux) because audio devices are not available."
}
This check is outdated. WSLg (included in WSL2 since Windows 11) provides full PulseAudio support via RDP audio pipes, and both arecord and rec (sox) successfully capture audio.
Evidence that audio works on WSL2
After installing libasound2-plugins, alsa-utils, sox, and configuring ~/.asoundrc to route ALSA through PulseAudio:
$ pactl list sources short
1 RDPSink.monitor module-rdp-sink.c s16le 2ch 44100Hz SUSPENDED
2 RDPSource module-rdp-source.c s16le 1ch 44100Hz SUSPENDED
$ timeout 3 rec /tmp/test.wav trim 0 1
Input File : 'default' (pulseaudio)
Channels : 2
Sample Rate : 48000
Done.
$ arecord -D default -f S16_LE -r 44100 -c 1 -d 1 /tmp/test2.wav
Recording WAVE '/tmp/test2.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
Both rec and arecord record successfully. Claude Code's own fallback recording code (Fr6 using rec and cr6 using arecord) would work — but the WSL detection gate prevents them from ever being reached.
Environment
- OS: Ubuntu 24.04 on WSL2 (kernel 6.6.87.2-microsoft-standard-WSL2)
- Windows: Windows 11 with WSLg
- Claude Code: v2.1.74
- PulseAudio: Running via WSLg (server v17.0)
Expected Behavior
Voice mode should attempt to use arecord/rec on WSL2 (the existing fallback path) rather than blanket-rejecting all WSL environments. The native audio module will fail (no /proc/asound/cards), but the arecord → rec fallback chain works perfectly with PulseAudio.
Suggested Fix
Either:
- Remove the WSL blanket block and let the existing fallback chain (
native → arecord → rec) handle it naturally - Or check for actual audio availability (e.g.,
pactl infoor attempt a short test recording) instead of checking the platform string
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗