Skip to content

feat(gateway): add tts.speak method returning synthesized audio inline - #100770

Merged
steipete merged 8 commits into
mainfrom
claude/listen-gateway-tts-speak
Jul 6, 2026
Merged

steipete merged 8 commits into
mainfrom
claude/listen-gateway-tts-speak

Conversation

@steipete

@steipete steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Mobile clients need a way to hear an individual assistant message rendered with the operator's configured TTS provider (tracking issue: #100708, "Listen" on iOS/Android). The existing surfaces don't cover this:

  • talk.speak is intentionally pinned to the Talk-mode provider with fallback disabled and fails with talk_unconfigured when only messages.tts is configured.
  • tts.convert renders with the configured chain but returns a gateway-local audioPath that remote clients cannot read.

Why This Change Was Made

Adds one additive request/response method, tts.speak (operator.write, same scope as its tts.*/talk.speak siblings): text in, whole-clip base64 audio out. It reuses the existing synthesizeSpeech engine with the general provider chain and fallback — no second TTS path, and no new gateway events (the protocol-event-coverage guard is unaffected by request methods). Input is bounded by the existing messages.tts.maxTextLength (default 4096), pre-checked in the handler so oversized text returns INVALID_REQUEST instead of a synthesis failure.

The inferMimeType helper that talk.speak used moved to src/gateway/server-methods/speech-mime.ts so both handlers share one output-format → MIME mapping.

Whole-clip delivery deliberately matches what the TTS pipeline ships today (talk.speak proves it end-to-end on both mobile apps); a streamed variant would be a separate protocol addition.

User Impact

No behavior change for existing methods. New gateway capability: authorized clients (operator.write scope) can render arbitrary text to audio with the configured TTS provider chain. Consumed by the stacked iOS/Android "Listen" PRs.

Evidence

  • pnpm test src/gateway/server-methods/tts.test.ts src/gateway/server-methods/talk.test.ts packages/gateway-protocol/src/channels.schema.test.ts packages/gateway-protocol/src/index.test.ts — green on Blacksmith Testbox (94 passed at first run; the tts file re-ran green with 10/10 after an expected-message fix).
  • pnpm check:changed on Testbox: all lanes green except lint core, whose four findings are in files untouched by this PR (src/channels/plugins/bundled.shape-guard.test.ts, src/cli/gateway-cli/run-loop.ts, src/infra/gateway-boot-lifecycle.ts) and are already fixed on latest origin/main; branch was rebased onto that main afterwards.
  • pnpm protocol:gen && pnpm protocol:gen:swift — generated GatewayModels.swift committed (TtsSpeakParams/TtsSpeakResult), regen after rebase produced no drift.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: adc091bc56

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/methods/core-descriptors.ts Resolved
@clawsweeper

clawsweeper Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 6198748217a31f0e17d1c8cfb287504af6cc7808, but the PR head is now 8babb162ba4500242d6e7619cbb7f9b4225a4802. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (2 earlier review cycles)
  • reviewed 2026-07-06T09:52:17.902Z sha adc091b :: needs real behavior proof before merge. :: [P2] Append tts.speak to the discovery table
  • reviewed 2026-07-06T15:10:53.103Z sha 0941b12 :: needs real behavior proof before merge. :: [P2] Append tts.speak instead of shifting discovery order | [P3] Document tts.speak in the protocol reference

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 6, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 6, 2026
@steipete steipete self-assigned this Jul 6, 2026
@steipete
steipete force-pushed the claude/listen-gateway-tts-speak branch from 0941b12 to 841620b Compare July 6, 2026 16:11
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: tts-local-cli plugin: azure-speech Azure Speech plugin labels Jul 6, 2026
@steipete
steipete force-pushed the claude/listen-gateway-tts-speak branch 2 times, most recently from b56575b to 0284cf8 Compare July 6, 2026 16:31
@openclaw-barnacle openclaw-barnacle Bot added the channel: discord Channel integration: discord label Jul 6, 2026
@steipete
steipete force-pushed the claude/listen-gateway-tts-speak branch from 0284cf8 to 56bd0b3 Compare July 6, 2026 16:31
@openclaw-barnacle openclaw-barnacle Bot removed the channel: discord Channel integration: discord label Jul 6, 2026
@steipete
steipete force-pushed the claude/listen-gateway-tts-speak branch from 56bd0b3 to afa0248 Compare July 6, 2026 16:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56bd0b3027

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CHANGELOG.md Resolved
@steipete
steipete force-pushed the claude/listen-gateway-tts-speak branch from afa0248 to 6198748 Compare July 6, 2026 16:53
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jul 6, 2026
@steipete
steipete force-pushed the claude/listen-gateway-tts-speak branch from 6198748 to 8babb16 Compare July 6, 2026 17:07
@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 6, 2026
@steipete
steipete force-pushed the claude/listen-gateway-tts-speak branch from 8babb16 to 906f51b Compare July 6, 2026 17:21
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready review complete on 906f51bd5dbb311e865cd34c293ae96452b24917.

What changed after review:

  • Kept tts.speak additive and moved its descriptor to the append-only tail so existing advertised method indices remain stable; restored the legacy index-window test and added a presence assertion.
  • Added Gateway protocol/TTS docs and the maintainer-owned Unreleased changelog entry.
  • Repaired two current-main CI races encountered during exact-head validation: fast-mode startup synchronization in run.fast-mode-auto.test.ts, and the sparse-checkout post-exit fixture timing in crabbox-wrapper.test.ts.

Proof on Blacksmith Testbox tbx_01kww3z7642f1jt64ybjds8kdn:

  • pnpm test src/gateway/server-methods/tts.test.ts src/gateway/server-methods/talk.test.ts src/gateway/server-methods-list.test.ts packages/gateway-protocol/src/channels.schema.test.ts packages/gateway-protocol/src/index.test.ts — 116 passed.
  • pnpm check:test-types — passed.
  • OPENCLAW_VITEST_MAX_WORKERS=2 OPENCLAW_VITEST_SHARD_NAME=agentic-agents-embedded pnpm exec node scripts/test-projects.mjs test/vitest/vitest.agents-embedded-agent.config.ts — 85 files, 1,639 passed, twice after the relevant rebases.
  • pnpm test test/scripts/crabbox-wrapper.test.ts — 187 passed.
  • Tooling/config project suite — 295 files, 4,724 passed.
  • Source-blind live Gateway call with TTS otherwise unconfigured: Microsoft fallback returned distinct MP3 clips; decoded audio detected as audio/mpeg; blank and over-limit text both returned INVALID_REQUEST; no local audioPath leaked.
  • Fresh autoreviews: full TTS branch clean (0.84), fast-mode repair clean (0.89), Crabbox fixture repair clean (0.88). git diff --check clean.

Hosted CI run 28809285239 was fully green on exact patch head 8babb162ba4500242d6e7619cbb7f9b4225a4802. The final head is a patch-identical rebase onto newer main; OPENCLAW_TESTBOX=1 OPENCLAW_ALLOW_ROOT_CHANGELOG_PR=1 scripts/pr prepare-run 100770 validated the fingerprint and reused that exact hosted proof.

Remaining proof gap is client-only: physical-device playback/fallback recordings belong to stacked iOS #100771 and Android #100772, not this Gateway PR.

@steipete
steipete merged commit 553acdf into main Jul 6, 2026
97 checks passed
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the claude/listen-gateway-tts-speak branch July 6, 2026 17:25
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
openclaw#100770)

* feat(gateway): add tts.speak method returning synthesized audio inline

* test(gateway): type tts.speak synthesis mock for failure shapes

* fix(gateway): restore lowercase normalizer import used by talk catalog

* test(gateway): shift advertised-method window for tts.speak

* fix(gateway): ready tts speak for landing

* docs(changelog): record tts speak gateway API

* test(agents): stabilize fast auto startup synchronization

* test(crabbox): stabilize sparse checkout exit guard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation extensions: tts-local-cli gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. plugin: azure-speech Azure Speech plugin size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant