hermes - 💡(How to fix) Fix [Bug]: Telegram voice/audio longer than ~4:50 shows 0:00 (duration not set on send) [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

Code Example

in the attached file if needed

---
RAW_BUFFERClick to expand / collapse

Bug Description

When the agent sends a voice or audio reply on Telegram (auto-TTS / text_to_speech delivery through TelegramAdapter.send_voice), clips longer than roughly 4 min 50 s render as 0:00 in the Telegram player and the progress bar is unusable.

Telegram only auto-derives a clip's duration from container metadata for short recordings. For longer ones it delivers the message with duration 0 unless the sender passes an explicit duration to sendVoice / sendAudio. Hermes doesn't pass one, so long voice/audio replies lose their duration.

Steps to Reproduce

  1. Configure the Telegram gateway with TTS enabled.
  2. Trigger a voice reply whose audio is longer than ~4:50 (e.g. a long text_to_speech answer; I used a ~293 s clip).
  3. Open the resulting voice/audio bubble in any Telegram client.

Expected Behavior

The bubble shows the real length (e.g. 4:53) with a working progress bar.

Actual Behavior

The bubble shows 0:00. The clip still plays but carries no duration metadata.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Telegram

Debug Report

in the attached file if needed

Operating System

hermes_debug_share_sanitized.txt

Linux (also macOS Darwin 25.5)

Python Version

3.14.5

Hermes Version

0.15.1

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

gateway/platforms/telegram.py — send_voice calls self._bot.send_voice / send_audio without a duration kwarg. python-telegram-bot forwards None, so Telegram falls back to container-derived duration, which it omits for long clips → 0:00. Discord's adapter already computes duration locally (plugins/platforms/discord/adapter.py); Telegram never did.

Proposed Fix (optional)

Probe the duration locally before sending and pass it explicitly to sendVoice/sendAudio. Best-effort chain: stdlib wave (WAV) → mutagen (OGG/Opus/MP3/M4A) → ffprobe (guarded by shutil.which). Omit duration when unreadable so behavior is unchanged in that case. I have a focused, Telegram-only fix + hermetic tests ready and will open a PR. This extracts/hardens the Telegram part of the stale, Piper-bundled PR #7815 (relates to #8508).

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Bug]: Telegram voice/audio longer than ~4:50 shows 0:00 (duration not set on send) [2 pull requests]