Skip to content

TTS: MEDIA: directive not processed as audio attachment when model differs from default (auto: inbound) #9722

Description

@ChanDava

Bug Description

When messages.tts.auto is set to "inbound", the model's tts tool call generates audio successfully, but the MEDIA: directive in the reply is not processed as an audio attachment. This creates a conflict where:

  1. Auto-TTS is skipped because it detects the MEDIA: directive in the reply
  2. The MEDIA: directive itself is not processed into an audio attachment

Result: No audio is sent to the user. The MEDIA: path appears as plain text.

Environment

  • OpenClaw version: 2026.2.3-1
  • Channel: Telegram (streamMode: "partial")
  • TTS config: auto: "inbound", provider: "edge"
  • Default model: minimax-cn/MiniMax-M2.1 (OpenAI Completions API)
  • Test model: anthropic/claude-opus-4-5 (Anthropic Messages API) — switched via /model
  • OS: macOS (Apple Silicon)

Steps to Reproduce

  1. Configure messages.tts.auto: "inbound" with Edge TTS provider
  2. Set default model to a non-Anthropic provider (e.g., MiniMax via OpenAI Completions API)
  3. Switch active model to anthropic/claude-opus-4-5 via /model opus
  4. Send a voice message from Telegram
  5. Model calls tts tool → gets MEDIA:/path/to/voice.mp3
  6. Model includes MEDIA: line in reply

Expected: Audio sent as voice note attachment
Actual: MEDIA: path appears as plain text, no audio played

Systematic Test Results

All tests performed under anthropic/claude-opus-4-5 (switched from default MiniMax):

# Method Result
1 Pure MEDIA: line (no other text) ❌ No audio
2 Short text + MEDIA: line at end ❌ No audio
3 Long text + markdown + MEDIA: line ❌ No audio
4 [[tts:text]] tag ❌ No audio
5 message tool with asVoice: true + filePath ✅ Audio plays

Root Cause Analysis

The TTS docs state:

"When enabled, OpenClaw: skips TTS if the reply already contains media or a MEDIA: directive."

This creates a deadlock when the model uses the tts tool:

User sends voice → auto: "inbound" triggers
  → Model calls tts tool → reply contains MEDIA: line
  → Auto-TTS detects MEDIA: → skips auto conversion
  → MEDIA: directive itself is NOT processed as attachment
  → No audio delivered

The design conflict: the system prompt instructs the model to call the tts tool when the user sends voice, but doing so blocks auto-TTS while the MEDIA: directive fails to deliver audio on its own.

Additional Observations

  • In previous sessions, MiniMax (OpenAI Completions API) occasionally succeeded with MEDIA: lines
  • Gemini Flash (Google API) also succeeded in one instance
  • Anthropic API (Opus) failed consistently across all MEDIA: delivery methods
  • The message tool with filePath + asVoice: true works 100% as a workaround

Suggested Fix

Consider one or more of:

  1. Process MEDIA: directives reliably regardless of model API type
  2. Auto-send audio when the tts tool is called successfully, instead of relying on the model to place the MEDIA: line correctly
  3. Clarify the intended flow — if auto: "inbound" handles TTS at the system level, the system prompt should not instruct the model to also call the tts tool (as this blocks auto-TTS)

Workaround

Use the message tool to send the TTS-generated audio directly:

1. Call tts tool → get MEDIA: path
2. Use message tool: action=send, filePath=<path>, asVoice=true

This bypasses both the MEDIA: directive and auto-TTS mechanisms entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions