Skip to content

fix(wake): stabilize exclusive and duplex audio handoffs - #75659

Closed
seppegadeyne wants to merge 3 commits into
NousResearch:mainfrom
seppegadeyne:fix/wake-recorder-release
Closed

fix(wake): stabilize exclusive and duplex audio handoffs#75659
seppegadeyne wants to merge 3 commits into
NousResearch:mainfrom
seppegadeyne:fix/wake-recorder-release

Conversation

@seppegadeyne

@seppegadeyne seppegadeyne commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Stabilizes the wake-to-voice audio handoff on exclusive input devices and opt-in full-duplex HFP transports.

Changes

  • Release the CLI AudioRecorder after every wake-suspended capture, before transcription or follow-up capture reacquires the device.
  • Add optional wake_word.duplex_output_device support: keep a silent 16 kHz output stream open while wake capture uses a bounded callback queue.
  • Close both wake streams before dispatching the wake callback, preventing the command recorder and first cue from racing stream teardown.
  • Add voice.output_device for explicit cue routing and a 250 ms silent preroll for the first cue after an HFP wake.
  • Preserve ordinary non-wake recorder reuse and the existing input-only wake path.

Deployment-specific selectors, launchers, STT-provider changes, and local wake engines are intentionally excluded.

Verification

  • Six focused regressions: 6 passed.
  • Full affected slice on the PR branch: 96 passed.
  • Same patch applied cleanly to current upstream main: 116 passed; ruff and git diff --check clean.
  • Raspberry Pi 5 + Jabra Speak2 55 over Bluetooth HFP/mSBC: first wake phrase detected on the first attempt, first cue audible, command/TTS/follow-up completed, wake resumed after the 60-second cap, and no BlueALSA overruns or device-busy errors were observed.

Related context

Complementary to #74152 and #74996.

Type of Change

  • Bug fix
  • Tests
  • New feature
  • Security fix

Checklist

  • Scope is limited to the audio lifecycle fix and its regressions.
  • Current main compatibility was verified.
  • Real-device end-to-end validation completed on Raspberry Pi OS 13/aarch64.
  • No deployment credentials or device-specific values are included.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard tool/tts Text-to-speech and transcription labels Jul 31, 2026
@seppegadeyne
seppegadeyne force-pushed the fix/wake-recorder-release branch from 53bafa2 to 825cc7d Compare July 31, 2026 21:25
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused lifecycle fix. Current main confirms the premise: cli.py:12027 calls AudioRecorder.stop(), and tools/voice_mode.py:1112-1127 documents that this preserves the stream. The wake path sets _wake_suspended at cli.py:12617-12626, while its watchdog later calls resume_listening() at cli.py:12682-12701.

The proposed finally release is correctly scoped to wake-suspended, non-continuous captures, preserves ordinary recorder reuse, and runs even when stop() fails. The added tests cover release-before-transcription, finalization failure, and regular-mode persistence. The PR is one commit ahead of current main with no divergence, so it should cherry-pick cleanly.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 31, 2026
@seppegadeyne
seppegadeyne force-pushed the fix/wake-recorder-release branch from 825cc7d to 63e557b Compare July 31, 2026 22:03
@seppegadeyne seppegadeyne changed the title fix(voice): release recorder before wake listener resumes fix(wake): stabilize exclusive and duplex audio handoffs Aug 1, 2026
@seppegadeyne

Copy link
Copy Markdown
Contributor Author

Closing this draft — we won't have time to continue this line of work for the foreseeable future. Keeping the branch around in case we pick it back up later.

@seppegadeyne

Copy link
Copy Markdown
Contributor Author

Closed — no time to continue this work for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/tts Text-to-speech and transcription type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants