Skip to content

Fix gaia talk: mic sensitivity, LEMONADE_BASE_URL, stuck listening (#347)#348

Merged
itomek merged 4 commits intomainfrom
347-gaia-talk-stuck-listening-ignores-lemonade_base_url-no-mic-sensitivity-control
Feb 24, 2026
Merged

Fix gaia talk: mic sensitivity, LEMONADE_BASE_URL, stuck listening (#347)#348
itomek merged 4 commits intomainfrom
347-gaia-talk-stuck-listening-ignores-lemonade_base_url-no-mic-sensitivity-control

Conversation

@itomek
Copy link
Collaborator

@itomek itomek commented Feb 23, 2026

Summary

Closes #347

This PR fixes three issues with gaia talk:

  1. Mic sensitivity control — adds --mic-threshold CLI argument that threads through TalkConfig.mic_thresholdAudioClient.mic_thresholdWhisperAsr.silence_threshold, replacing the previously hardcoded value
  2. LEMONADE_BASE_URL env var ignoredChatConfig.base_url now defaults to None instead of "http://localhost:8000/api/v1", so the env var is respected by the LLM factory
  3. Stuck listening UX — mic level check at startup warns if no audio detected, "no speech detected" warning after 10s of silence, device name printed on start

Test plan

  • pytest tests/unit/test_talk_config.py — mic_threshold default, custom, AudioClient propagation (5 tests)
  • pytest tests/unit/test_chat_config_base_url.py — base_url=None default, custom, forwarded to create_client (4 tests)
  • pytest tests/unit/test_audio_client_mic_check.py — _check_mic_levels warns/passes/handles-exception/skips-without-asr, 10s no-speech warning (5 tests)
  • pytest tests/test_sdk.py::TestTalkSDK — mic_threshold attribute exists (1 assertion added)
  • pytest tests/unit/test_asr.py::TestMicThreshold — mic_threshold propagates end-to-end (skips without pyaudio)
  • pytest tests/unit/ -v — full unit suite (431 passed, 14 skipped)
  • python util/lint.py --all — all critical checks pass
  • gaia talk --help--mic-threshold flag visible

🤖 Generated with Claude Code

itomek and others added 2 commits February 23, 2026 16:30
- tests/unit/test_talk_config.py: TalkConfig.mic_threshold default and custom values, AudioClient propagation
- tests/unit/test_chat_config_base_url.py: ChatConfig.base_url defaults to None, forwarded to create_client
- tests/unit/test_audio_client_mic_check.py: _check_mic_levels warns on silence, handles exceptions, 10s no-speech warning
- tests/test_sdk.py: assert mic_threshold attribute exists on TalkConfig
- tests/unit/test_asr.py: TestMicThreshold verifies mic_threshold propagates to AudioClient

Co-Authored-By: Tomasz Iniewicz <[email protected]>
@github-actions github-actions bot added documentation Documentation changes talk Talk agent changes chat Chat SDK changes audio Audio (ASR/TTS) changes cli CLI changes tests Test changes labels Feb 23, 2026
Replace PyAudio with sounddevice for microphone recording across all
audio modules, tests, and CI. Add PortAudio prerequisite documentation
to the talk guide and troubleshooting page.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions github-actions bot added dependencies Dependency updates devops DevOps/infrastructure changes labels Feb 23, 2026
@itomek itomek self-assigned this Feb 23, 2026
@itomek itomek marked this pull request as ready for review February 23, 2026 23:04
@kovtcharov-amd
Copy link
Collaborator

@claude please review this PR. Are there any breaking changes?

@github-actions
Copy link

github-actions bot commented Feb 23, 2026

Claude finished @kovtcharov-amd's task —— View job


PR Review: Fix gaia talk - mic sensitivity, LEMONADE_BASE_URL, stuck listening (#347)

  • Read PR diff and changed files
  • Analyze for breaking changes
  • Review code quality and patterns
  • Provide review summary

Breaking Changes Analysis

🟡 Potentially Breaking Change: Dependency Migration from PyAudio to sounddevice

This PR replaces pyaudio with sounddevice as the audio recording backend. This is a potentially breaking change for users with existing installations:

Change Impact
setup.py: pyaudiosounddevice Users must reinstall talk extras
System dependency: portaudio19-devlibportaudio2 Linux users need only runtime lib, not dev headers
API key changes in AudioRecorder maxInputChannelsmax_input_channels, defaultSampleRatedefault_samplerate

Migration required:

# Linux users
sudo apt-get install libportaudio2

# Reinstall GAIA talk extras
uv pip install -e ".[talk]"

🟢 Non-Breaking: SDK API Additions

Change Location Impact
TalkConfig.mic_threshold (default: 0.003) src/gaia/talk/sdk.py:36 Additive - existing code unaffected
AudioClient.mic_threshold parameter src/gaia/audio/audio_client.py:21 Additive - optional with default
--mic-threshold CLI flag src/gaia/cli.py:940-944 Additive

🟢 Non-Breaking: ChatConfig.base_url Default Change

The change from base_url="http://localhost:8000/api/v1" to base_url=None (src/gaia/chat/sdk.py:38-40) is behavioral but compatible:

  • When base_url=None, the LLM factory respects LEMONADE_BASE_URL env var
  • Users relying on the hardcoded default now need to either:
    • Set LEMONADE_BASE_URL env var, OR
    • Explicitly pass base_url="http://localhost:8000/api/v1"

This is the correct fix since the previous behavior ignored the environment variable.


Code Quality Review

Strengths:

  • ✅ Comprehensive test coverage added (4 new test files, 431 tests passing)
  • ✅ Good UX improvements: mic level check at startup, 10s no-speech warning
  • ✅ Documentation updated in docs/guides/talk.mdx, docs/reference/cli.mdx, docs/reference/troubleshooting.mdx
  • ✅ Follows existing code patterns and conventions

Minor Observations:

  1. src/gaia/audio/audio_client.py:337-372 - _check_mic_levels() is well-implemented with proper exception handling and resource cleanup.

  2. src/gaia/audio/audio_recorder.py:26-33 - Good pattern for optional dependency handling:

    if sd is None:
        raise ImportError(
            "sounddevice is required for audio recording.\n"
            'Install with: uv pip install -e ".[talk]"'
        )
  3. src/gaia/cli.py:2901-2903 - Device info key names updated to match sounddevice API (maxInputChannelsmax_input_channels).


Summary

This PR is ready to merge with one consideration:

Type Description Action
🟡 Breaking PyAudio → sounddevice migration Mention in release notes
🟢 Enhancement Mic threshold control via --mic-threshold Documented
🟢 Bug Fix LEMONADE_BASE_URL now respected Fixed correctly
🟢 UX Startup mic check + 10s no-speech warning Good improvement

Recommendation: Add a note to the release/changelog about the PyAudio → sounddevice migration requiring users to reinstall talk extras.

- Replace unused `overflowed` with `_` in audio_recorder.py,
  whisper_asr.py, and audio_client.py (Pylint W0612)
- Remove unused `import queue` and `from importlib import reload`
  from test_audio_recorder_sd.py (Flake8 F401)
- Add direct sounddevice/whisper imports to test_asr.py skip guard
  so tests SKIP instead of FAIL when audio deps are absent
- Replace print() with self.log.info() for microphone device line
  in audio_client.py (Black formatting applied)

Co-Authored-By: Tomasz Śliwowski <[email protected]>
@itomek itomek added this pull request to the merge queue Feb 24, 2026
Merged via the queue into main with commit 1198af5 Feb 24, 2026
51 checks passed
@itomek itomek deleted the 347-gaia-talk-stuck-listening-ignores-lemonade_base_url-no-mic-sensitivity-control branch February 24, 2026 12:18
This was referenced Feb 24, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 24, 2026
## Summary

- Add release notes for v0.15.4.1 (`docs/releases/v0.15.4.1.mdx`)
- Bump `__version__` from `0.15.4` → `0.15.4.1` in `src/gaia/version.py`
- Add `releases/v0.15.4.1` to nav and update navbar label in
`docs/docs.json`

Closes #336, #339, #344, #345, #342, #348, #346

> **Note:** Do not tag `v0.15.4.1` until after this PR merges.

---------

Co-authored-by: Tomasz Iniewicz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audio Audio (ASR/TTS) changes chat Chat SDK changes cli CLI changes dependencies Dependency updates devops DevOps/infrastructure changes documentation Documentation changes talk Talk agent changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gaia talk: stuck listening, ignores LEMONADE_BASE_URL, no mic sensitivity control

2 participants