fix(gateway): mark final voice reply as notify-worthy so Telegram delivers it audibly
In Telegram "important" notifications mode (default), TelegramPlatformAdapter sets ``disable_notification=True`` on every send unless metadata carries ``notify=True``. GatewayRunner._send_voice_reply already passes thread metadata through to ``adapter.send_voice``, but never marks the final auto-TTS voice reply as notify-worthy — so users with the default mode get the final voice note delivered silently with no push notification. Mirror the final-text path in gateway/platforms/base.py (the existing text-response final send already adds ``metadata["notify"] = True``). Issue #27970 Bug 2. Bug 1 (MP3 vs. native OGG voice-note) is being addressed by existing PRs #20182 / #20878 — this PR is intentionally scoped to the silent-delivery bug only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10762,13 +10762,24 @@ class GatewayRunner:
|
||||
elif adapter and hasattr(adapter, "send_voice"):
|
||||
reply_anchor = self._reply_anchor_for_event(event)
|
||||
thread_meta = self._thread_metadata_for_source(event.source, reply_anchor)
|
||||
# Mark the auto voice reply as notify-worthy. Mirrors the
|
||||
# final-text path in gateway/platforms/base.py which sets
|
||||
# ``notify=True`` so platform adapters that gate push
|
||||
# notifications (Telegram "important" mode) deliver the
|
||||
# final voice reply as a normal notification instead of a
|
||||
# silent message. Clone first so we don't mutate metadata
|
||||
# shared with concurrent typing-indicator state.
|
||||
if thread_meta is not None:
|
||||
thread_meta = dict(thread_meta)
|
||||
thread_meta["notify"] = True
|
||||
else:
|
||||
thread_meta = {"notify": True}
|
||||
send_kwargs: Dict[str, Any] = {
|
||||
"chat_id": event.source.chat_id,
|
||||
"audio_path": actual_path,
|
||||
"reply_to": reply_anchor,
|
||||
"metadata": thread_meta,
|
||||
}
|
||||
if thread_meta:
|
||||
send_kwargs["metadata"] = thread_meta
|
||||
await adapter.send_voice(**send_kwargs)
|
||||
except Exception as e:
|
||||
logger.warning("Auto voice reply failed: %s", e, exc_info=True)
|
||||
|
||||
Reference in New Issue
Block a user