Skip to content

fix(gateway): guard empty/inaudible voice transcripts in enrichment - #41603

Closed
deacon-botdoctor wants to merge 1 commit into
NousResearch:mainfrom
Bot-Doctor-LLC:botdoctor/empty-transcript-guard-upstream
Closed

fix(gateway): guard empty/inaudible voice transcripts in enrichment#41603
deacon-botdoctor wants to merge 1 commit into
NousResearch:mainfrom
Bot-Doctor-LLC:botdoctor/empty-transcript-guard-upstream

Conversation

@deacon-botdoctor

Copy link
Copy Markdown
Contributor

Summary

  • speech-to-text can return success=True with an empty/whitespace transcript on silence, cut-off, or inaudible audio
  • previously this emitted Here's what they said: "", sending empty content to the model (which can hallucinate a reply and loop)
  • extract a small pure helper that emits a clear sentinel note for the empty case instead of empty quotes

Validation

  • python3 -m py_compile gateway/run.py tests/gateway/test_voice_transcription_note.py
  • .venv/bin/python -m pytest tests/gateway/test_voice_transcription_note.py (4 passed)
  • git diff --check

Scope check

  • rebuilt from fresh NousResearch/hermes-agent main
  • scanned staged diff for obvious secrets/private identifiers and downstream overlay markers

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery tool/tts Text-to-speech and transcription labels Jun 8, 2026
@liuhao1024

Copy link
Copy Markdown
Contributor

✅ Verified — empty voice transcript guard is correct

Reviewed the diff for gateway/run.py and tests/gateway/test_voice_transcription_note.py.

  • Empty/whitespace handling: _voice_transcription_note() correctly checks transcript.strip() — empty string, whitespace-only, and missing key all return the sentinel note asking the user to resend. Real transcripts get quoted as before.
  • Agent-loop prevention: The sentinel note explicitly says "Do not guess at the content; ask the user to resend or type it out." — clear instruction that prevents the agent from replying to silence.
  • Test coverage: 4 test cases cover non-empty, empty, whitespace-only, and missing transcript key. Edge cases are well covered.

The fix is correct and the extraction into a helper function is clean. No issues found.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for identifying the blank-transcript path. The premise remains valid on current main: gateway/run.py:15247-15255 still turns a successful empty transcript into "".

Problems

  • The submitted helper restores the old voice-message wrapper and adds a Do not guess directive. Current main deliberately replaced that format with a plain quoted transcript at gateway/run.py:15250-15255; commit 5582b51a680b16b399a82e9c04b3317c0fd06255 removed STT-mode prompt chatter because it persisted into later turns.
  • Current code appends every successful transcript before formatting it (gateway/run.py:15247-15249), while queued paths echo those values at gateway/run.py:15327-15339. A blank guard must avoid that append too, or users can still receive an empty 🎙️ "" echo.

Suggested changes

  • Apply the blank check in the current success branch, preserving the existing neutral [voice message could not be transcribed] contract for blank results and excluding them from successful_transcripts.
  • Add an async regression test through _enrich_message_with_transcription() that verifies blank and whitespace-only successful results produce no quoted empty prompt and no echo candidates.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
@teknium1 teknium1 closed this in f76b2b4 Jul 28, 2026
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…d empty transcripts

Two hand-written fixes in the voice input path:

- _handle_voice_channel_input now resolves the bound text channel's
  channel_prompt via the adapter's _resolve_channel_prompt so voice input
  gets the same per-channel context as typed messages (fixes NousResearch#50149).
- _enrich_message_with_transcription now guards success=True results whose
  transcript is empty/whitespace-only (silence, cut-off, inaudible audio):
  instead of emitting empty quotes the agent gets a clear sentinel note.
  Reimplemented against the current plain-quoted note wording; original
  concept and tests by @deacon-botdoctor in PR NousResearch#41603 (fixes NousResearch#41603).
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 P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform 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.

4 participants