openclaw - 💡(How to fix) Fix [Bug]: messages.tts provider 配置无法生效 — schema 要求写 providers.<id> 但运行时读 tts[id](2026.4.5) [1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#62093Fetched 2026-04-08 03:09:05
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Timeline (top)
closed ×1commented ×1

Code Example

{
  "messages": {
    "tts": {
      "provider": "openai",
      "providers": {
        "openai": { "baseUrl": "...", "apiKey": "...", "model": "tts-1", "voice": "alloy" }
      }
    }
  }
}

---

const providerId = msgTts?.provider || "openai";
const providerBlock = msgTts?.[providerId];  // 读 tts.openai,不是 tts.providers.openai
RAW_BUFFERClick to expand / collapse

Bug 描述

2026.4.2 升级到 2026.4.5 后,TTS 功能完全无法工作。根因是 schema 迁移路径和运行时读取路径不一致。

复现步骤

  1. 配置 messages.tts.provider = "openai",将 provider 详情写入 messages.tts.providers.openai
  2. 触发 TTS(发送带 [[tts:provider=openai]] 标签的消息)
  3. 期望收到语音消息

实际结果:只收到文字,没有语音。

根因分析

Schema 要求(doctor/migration 迁移后的格式):

{
  "messages": {
    "tts": {
      "provider": "openai",
      "providers": {
        "openai": { "baseUrl": "...", "apiKey": "...", "model": "tts-1", "voice": "alloy" }
      }
    }
  }
}

运行时读取代码dist/outbound-Bc-9andi.js):

const providerId = msgTts?.provider || "openai";
const providerBlock = msgTts?.[providerId];  // 读 tts.openai,不是 tts.providers.openai

问题链:

  • 4.2 的 migration 函数把 tts.edge / tts.microsoft 移动到 tts.providers.microsoft
  • 4.5 的 schema 校验拒绝旧格式 tts.<id>,报 config reload skipped (invalid config): messages.tts.<provider> keys are legacy
  • 但运行时代码始终读 msgTts[providerId](即 tts.openai),从未读 tts.providers.openai

结果:无论按哪种格式写配置,TTS provider block 永远是 undefinedresolveTTSFromBlock 拿不到 baseUrl/apiKey,直接返回 null,语音静默失败。

附加问题

  1. [[tts]] 标签无效tagged 模式下系统提示(dist/extensions/speech-core/runtime-api.js L189)告诉 Agent 使用 [[tts]],但 parseTtsDirectives 的正则 /\[\[tts:([^\]]+)\]\]/gi 要求冒号后必须有内容,裸 [[tts]] 永远不匹配。
  2. migration 循环:每次 gateway 启动,migration 函数都会把 tts.edge 迁移到 tts.providers.microsoft,但不更新 provider 字段值,导致 provider: "edge" 指向一个已被移走的 key。

环境

  • OpenClaw: 2026.4.5 (3e72c03)
  • macOS 25.1.0, Apple Silicon (Mac mini)
  • Node: 22.19.0

extent analysis

TL;DR

Update the configuration to use the new schema format, with the provider details under messages.tts.providers.openai, to fix the TTS functionality.

Guidance

  • Verify that the messages.tts.provider is set to "openai" and the provider details are written under messages.tts.providers.openai in the configuration.
  • Check the runtime code to ensure it is reading the correct path for the provider block, which should be msgTts.providers[providerId] instead of msgTts[providerId].
  • Update the migration function to correctly update the provider field value when migrating the tts.edge or tts.microsoft to tts.providers.microsoft.
  • Test the TTS functionality with the updated configuration and runtime code to ensure it is working as expected.

Example

{
  "messages": {
    "tts": {
      "provider": "openai",
      "providers": {
        "openai": { "baseUrl": "...", "apiKey": "...", "model": "tts-1", "voice": "alloy" }
      }
    }
  }
}

Notes

The issue seems to be caused by the inconsistency between the schema migration path and the runtime reading path. Updating the configuration to use the new schema format and ensuring the runtime code reads the correct path should fix the issue. However, there may be additional issues with the migration function and the handling of bare [[tts]] tags that need to be addressed.

Recommendation

Apply workaround by updating the configuration to use the new schema format and ensuring the runtime code reads the correct path, as this should fix the immediate issue with the TTS functionality.

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

openclaw - 💡(How to fix) Fix [Bug]: messages.tts provider 配置无法生效 — schema 要求写 providers.<id> 但运行时读 tts[id](2026.4.5) [1 comments, 2 participants]