fix(voice_mode): restore audio-env detection across clean/WSL/Termux scenarios (partial close hermes-agent#9) #12
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/voice-mode-detect-audio-env-container-stub"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
4 tests in
tests/tools/test_voice_mode.py::TestDetectAudioEnvironmentwere failing on CI withassert False is True:test_clean_environment_is_availabletest_wsl_with_pulse_allows_voicetest_wsl_device_query_fails_with_pulse_continuestest_termux_api_microphone_allows_voice_without_sounddeviceRoot cause (regressing commit)
Commit
5e1197a4(fix(gateway): harden Docker/container gateway pathway) replaced an inlineos.path.exists('/.dockerenv')check indetect_audio_environment()with the more thoroughis_container()helper fromhermes_constants. The new helper also looks at/run/.containerenvand/proc/1/cgroupfordocker/podman//lxc/markers, and caches the result at module level (_container_detected).CI runners themselves run inside Docker. So
is_container()returnsTrueon CI, and the function silently appended"Running inside Docker container -- no audio devices"to the warnings list of every scenario — including the four test fixtures that legitimately set up a non-container environment (clean Linux, WSL+pulse, WSL with broken device query, Termux API).The other 5 tests in the same class survived only by coincidence — they all expected blocking warnings (SSH, missing PulseAudio, missing PortAudio), so the extra container warning just stacked harmlessly on top.
Per
feedback_no_such_thing_as_flakes: the failure was a real environmental coupling bug, not a flake.Fix
from hermes_constants import is_containerto module-level intools/voice_mode.pyso tests can reach it astools.voice_mode.is_container— matches the existing monkeypatch convention used elsewhere (shutil,_import_audio,_termux_api_app_installed, etc).TestDetectAudioEnvironmentthat defaultsis_containertoFalse, so tests don't inherit the host runner's container state.test_docker_container_blocks_voiceto pin the original container-blocks-voice intent that was previously implicit.Net:
+25 / -2lines acrosstools/voice_mode.pyandtests/tools/test_voice_mode.py.Test plan
pytest tests/tools/test_voice_mode.py::TestDetectAudioEnvironment -v— all 10 tests pass (9 existing + 1 new)pytest tests/tools/test_voice_mode.py— all 61 tests pass (no sibling regression)is_container=True(CI-in-Docker) state — autouse fixture neutralizes it;available=Trueas the tests expectOut of scope
The ~17-43 unrelated failures in
tests/tools/test_voice_cli_integration.py(pre-existing, identical with this branch's changes stashed) are being handled by parallel agents per the dispatch brief — partial close only.Partial close hermes-agent#9.
LGTM. Root-caused via git blame to commit
5e1197a4. Hoistis_containerto module-level so monkeypatch works (matching existing shutil/_import_audio/_termux_api_app_installed convention). Autouse fixture defaults is_container=False; new test pins the docker-blocks-voice intent. 10/10 TestDetectAudioEnvironment + 61/61 file pass.