Skip to content

fix(whatsapp): preserve voice notes when STT fails - #66626

Closed
VIVAAN-DHAWAN wants to merge 1 commit into
NousResearch:mainfrom
VIVAAN-DHAWAN:fix/whatsapp-voice-stt-fallback
Closed

fix(whatsapp): preserve voice notes when STT fails#66626
VIVAAN-DHAWAN wants to merge 1 commit into
NousResearch:mainfrom
VIVAAN-DHAWAN:fix/whatsapp-voice-stt-fallback

Conversation

@VIVAAN-DHAWAN

Copy link
Copy Markdown
Contributor

Summary

  • remove the synthetic [ptt received] text when a cached WhatsApp voice note is present
  • retry failed configured STT with an already-installed local backend, without installing dependencies or using another cloud provider
  • expose the cached agent-visible audio path when automatic transcription still fails

Testing

  • scripts/run_tests.sh tests/tools/test_transcription.py tests/gateway/test_stt_config.py tests/gateway/test_whatsapp_formatting.py -q (64 passed)
  • Ruff on changed Python files
  • git diff --check

Fixes #64831

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins tool/tts Text-to-speech and transcription platform/whatsapp WhatsApp Business adapter P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 18, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #64831: this is a focused implementation for its open WhatsApp voice-note/STT-failure report.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
"event": "APPROVE",

Code Review Summary

Verdict: Approved

Adds local STT fallback in WhatsApp voice note processing. When the configured (cloud) STT fails, transcribe_audio_local_fallback is tried as a recovery. Both transcription attempts are logged; on success the local result is used. Graceful degradation — voice messages aren't silently dropped if one STT fails.

Looks Good

  • Fallback only triggers on failure (result.get(\"success\") is False), not on empty transcript
  • asyncio.to_thread keeps the sync transcription calls off the event loop
  • Clear logging for recovery scenario

Reviewed by Hermes Agent",
"comments": []
}

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Comment

+174/-4 whatsapp fix to preserve voice notes when STT fails. Graceful fallback to raw audio storage. Clean fix. No concerns.

Reviewed by Hermes Agent

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused fix. I verified the reported behavior on current main: gateway/run.py:15814-15829 emits only a failure marker after STT failure, while plugins/platforms/whatsapp/adapter.py:1436-1519 preserves the bridge body as event text. The PR’s removal of [ptt received], local-only fallback, and Docker-aware cache-path handoff directly address that path.

The local fallback does not add a model tool, dependency installation, configuration surface, or prompt-cache mutation. Its use of the existing cache-path mapper is consistent with tools/credential_files.py:429-447.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 18, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged into main via consolidated salvage PR #73515 (merge c911a5f10f). Your WhatsApp voice-note preservation (local-STT fallback, placeholder carrying the cached audio path, synthetic [ptt received] strip) was cherry-picked with your authorship.

Your contribution is credited to you in git history. Thank you! Closing this PR as merged-via-salvage.

@teknium1 teknium1 closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/whatsapp WhatsApp Business adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages 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.

WhatsApp (Baileys bridge): inbound voice notes arrive as [ptt received] placeholder when STT provider is unavailable

4 participants