Skip to content

feat(android): add Listen action speaking assistant messages via gateway TTS - #100772

Merged
steipete merged 2 commits into
mainfrom
claude/listen-android-chat-speech
Jul 6, 2026
Merged

steipete merged 2 commits into
mainfrom
claude/listen-android-chat-speech

Conversation

@steipete

@steipete steipete commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Android users cannot hear an assistant reply from the chat transcript (tracking issue: #100708). Gateway support landed in #100770; the iOS client landed in #100771.

Why This Change Was Made

  • Shared Listen action: the existing long-press message menu now offers Listen or Stop for persisted assistant messages with visible text. Both the full Chat tab and compact chat sheet use the same action host; user, tool-only, image-only, blank, and streaming rows do not expose a dead action.
  • One playback owner: MessageSpeechController calls gateway tts.speak, passes the full format/MIME/extension metadata through the existing TalkAudioPlayer, and falls back to Android TextToSpeech when synthesis or clip playback is unavailable. A generation token prevents superseded completions from clearing newer playback state.
  • Transcript-exact speech: Listen reuses chatMessagePlainText, the same visible-text projection already used by Copy, Share, and Reply.
  • Lifecycle cleanup: playback stops on session switch, New Chat, app backgrounding, and disposal of either chat surface. Failed Android TTS initialization is discarded so the next Listen attempt retries instead of caching a dead engine.
  • Inline state: assistant bubbles show tappable Preparing audio… and Speaking… status pills that stop playback.

User Impact

Long-press an assistant reply and choose Listen. OpenClaw uses the configured gateway TTS provider when available and the device voice otherwise, with no new player dependency.

Evidence

  • Blacksmith Testbox tbx_01kwwbfhfzkzhzj2xt84x4vsy3: full :app:testPlayDebugUnitTest, :app:ktlintCheck, and :app:assemblePlayDebug — green on the final rebased tree.
  • Focused MessageSpeechControllerTest plus ChatMessageActionsTest: 10/10, including RPC request/metadata preservation, gateway and playback fallbacks, stop/supersede, blank input, and transcript text projection.
  • Native i18n inventory: entries=2764 changed=false.
  • Fresh Codex autoreview: clean on the final rebased branch.
  • Exact-head CI: run 28816900466 passed for 90ea96348683e427bbcf49c7aa28c4b94771bde1.
  • Device gap: the exact proof variant is installed on a connected Pixel 10a, but the locked device still blocks audible gateway/fallback playback capture.

@openclaw-barnacle openclaw-barnacle Bot added app: android App: android size: L maintainer Maintainer-authored PR docs Improvements or additions to documentation labels Jul 6, 2026

@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: 847c2eec3a

ℹ️ 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".

@clawsweeper

clawsweeper Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 6, 2026, 2:22 PM ET / 18:22 UTC.

Summary
This PR adds Android chat Listen/Stop listening UI, controller, tests, and docs for speaking assistant messages through tts.speak, while the branch also carries the now-merged gateway protocol method it depends on.

PR surface: Source +109, Tests +106, Docs +1, Other +683. Total +899 across 19 files.

Reproducibility: yes. for the review blockers from source: start Listen playback and then start a New chat, or simulate a failed Android TextToSpeech initialization before a later fallback attempt. I did not run device audio playback, and the PR body says that proof is still pending.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #100708
Summary: This PR is the Android implementation candidate for the mobile Listen feature tracked by the canonical issue; the gateway dependency is merged and the iOS sibling remains a parallel platform implementation.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦪 silver shellfish
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix New chat speech cleanup and failed local TTS retry.
  • [P2] Add a redacted device recording or runtime transcript proving gateway clip playback and the TextToSpeech fallback.
  • Rebase or refresh the dirty branch against current main after the gateway API dependency has landed.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body includes unit/build evidence but explicitly says real Android audio playback still needs device proof for both gateway clip playback and local TextToSpeech fallback; contributors should redact private endpoints, keys, phone numbers, and other private details before posting proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging this head can leave speech playback associated with a transcript that has been replaced by New chat.
  • [P2] The local fallback can stay disabled until app restart after a transient TextToSpeech init failure.
  • [P2] Real Android device playback proof is still missing for gateway audio and local fallback paths.
  • [P1] The live PR is currently dirty and needs rebase or conflict handling before merge.

Maintainer options:

  1. Fix Android speech blockers before merge (recommended)
    Stop active message speech on New chat and reset failed local TTS initialization so playback state cannot outlive its transcript or stay disabled after a transient engine failure.
  2. Refresh and prove manually
    A maintainer can ask the author to rebase this dirty branch and add device proof before any code repair is attempted.
  3. Accept with explicit follow-up risk
    Maintainers could choose to merge the feature with known lifecycle and fallback gaps, but users may hear wrong-session audio or lose fallback speech until app restart.

Next step before merge

  • [P1] This proof-gated, dirty feature PR needs contributor/maintainer follow-up for real Android playback proof, rebase/conflict handling, and the two code blockers before automation should take over.

Maintainer decision needed

  • Question: Should Android Listen ship with the gateway-first tts.speak plus local TextToSpeech fallback design once the source blockers and proof gap are resolved?
  • Rationale: This PR implements a new mobile UX and provider-fallback behavior for a maintainer-labeled feature, so final product acceptance should be a maintainer choice even though the gateway method dependency has landed.
  • Likely owner: steipete — steipete opened the feature stack and has recent history on both the Android runtime path and the merged gateway TTS dependency.
  • Options:
    • Proceed after blockers and proof (recommended): Keep the gateway-first Android Listen direction, then require the lifecycle/TTS retry fixes, a clean rebase, and real device playback proof before merge.
    • Narrow the Android surface: Ask the branch to reduce or alter the Android UX/fallback behavior before merge if maintainers do not want this Listen affordance in the native chat transcript yet.
    • Pause mobile Listen: Leave this PR open but paused until maintainers settle the broader mobile transcript playback rollout across Android and iOS.

Security
Cleared: No concrete security or supply-chain concern found; the branch adds Android UI/runtime speech code, docs, generated protocol types, and gateway method use without new dependencies, permissions, CI, or secret handling.

Review findings

  • [P2] Stop speech when starting a new chat — apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt:2694-2695
  • [P2] Clear failed local TTS initialization — apps/android/app/src/main/java/ai/openclaw/app/chat/MessageSpeechController.kt:252-260
Review details

Best possible solution:

Fix the Android lifecycle and local TTS retry defects, rebase the dirty branch onto current main so it consumes the already-merged gateway API cleanly, and then provide real Android playback proof before merge.

Do we have a high-confidence way to reproduce the issue?

Yes for the review blockers from source: start Listen playback and then start a New chat, or simulate a failed Android TextToSpeech initialization before a later fallback attempt. I did not run device audio playback, and the PR body says that proof is still pending.

Is this the best way to solve the issue?

No: the feature shape is plausible, but this head is not the best merge candidate until lifecycle cleanup covers New chat, local TTS init failures can retry, the dirty branch is rebased, and playback is proven on device.

Full review comments:

  • [P2] Stop speech when starting a new chat — apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt:2694-2695
    switchChatSession() stops active message speech, but startNewChat() still replaces the transcript through chat.startNewChat() without stopping playback. If a user starts a New chat while an old assistant reply is speaking, audio can continue after the row and inline Stop affordance disappear, so stop speech on this session-replacement path too.
    Confidence: 0.94
  • [P2] Clear failed local TTS initialization — apps/android/app/src/main/java/ai/openclaw/app/chat/MessageSpeechController.kt:252-260
    This code is unchanged from the earlier reviewed head, so this is a late finding. When TextToSpeech reports an init failure once, the completed ready=false deferred stays cached and every later fallback Listen attempt returns null until process restart; clear ready/engine and shut down the failed instance so a later attempt can retry.
    Confidence: 0.9
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6bc661ce14c8.

Label changes

Label changes:

  • add merge-risk: 🚨 availability: A transient Android TextToSpeech init failure can leave local fallback speech unavailable until app restart.

Label justifications:

  • P2: The PR adds a useful Android accessibility/UX feature with concrete blockers but limited blast radius.
  • merge-risk: 🚨 session-state: The patch introduces chat-scoped speech state and currently misses the New chat replacement path, allowing old-session playback after the transcript changes.
  • merge-risk: 🚨 availability: A transient Android TextToSpeech init failure can leave local fallback speech unavailable until app restart.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body includes unit/build evidence but explicitly says real Android audio playback still needs device proof for both gateway clip playback and local TextToSpeech fallback; contributors should redact private endpoints, keys, phone numbers, and other private details before posting proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +109, Tests +106, Docs +1, Other +683. Total +899 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 9 142 33 +109
Tests 2 108 2 +106
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 7 727 44 +683
Total 19 978 79 +899

Acceptance criteria:

  • [P1] node scripts/run-android-gradle.mjs :app:testPlayDebugUnitTest --tests 'ai.openclaw.app.chat.MessageSpeechControllerTest'.
  • [P1] Focused Android coverage for New chat/session replacement speech cleanup if added.
  • [P2] Real Android playback proof for gateway clip playback and local TextToSpeech fallback before merge.

What I checked:

Likely related people:

  • steipete: Current-main history shows Peter Steinberger recently changed Android NodeRuntime.kt and merged the gateway tts.speak dependency consumed by this PR. (role: recent Android runtime and gateway TTS contributor; confidence: high; commits: 5b5a540e3451, 553acdfc1aef; files: apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt, src/gateway/server-methods/tts.ts)
  • Sahibzada: Current-main history and blame show Sahibzada recently rewrote broad session/runtime-adjacent Android files including ChatScreen, NodeRuntime, and TalkModeManager. (role: recent session/runtime contributor; confidence: medium; commits: 5e22787ba1f2; files: apps/android/app/src/main/java/ai/openclaw/app/ui/chat/ChatScreen.kt, apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt, apps/android/app/src/main/java/ai/openclaw/app/voice/TalkModeManager.kt)
  • Colin Johnson: Current-main history shows Colin Johnson recently changed Android chat refresh behavior in ChatScreen.kt, close to this PR's chat UI wiring. (role: recent Android chat contributor; confidence: medium; commits: 9c2bbd07506e; files: apps/android/app/src/main/java/ai/openclaw/app/ui/chat/ChatScreen.kt)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (2 earlier review cycles)
  • reviewed 2026-07-06T09:49:23.126Z sha ccdaec6 :: needs real behavior proof before merge. :: [P2] Stop speech when starting a new chat
  • reviewed 2026-07-06T15:16:07.569Z sha a8b66de :: needs real behavior proof before merge. :: [P2] Stop speech when starting a new chat | [P2] Clear failed local TTS initialization

@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 6, 2026
@steipete
steipete force-pushed the claude/listen-android-chat-speech branch from ccdaec6 to b0d0ca7 Compare July 6, 2026 14: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: b0d0ca7c82

ℹ️ 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".

@steipete
steipete force-pushed the claude/listen-android-chat-speech branch from b0d0ca7 to a8b66de Compare July 6, 2026 15:00
@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. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 8 times, most recently from 8babb16 to 906f51b Compare July 6, 2026 17:21
Base automatically changed from claude/listen-gateway-tts-speak to main July 6, 2026 17:25
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: XL and removed size: L labels Jul 6, 2026
@steipete steipete self-assigned this Jul 6, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jul 6, 2026
@steipete
steipete force-pushed the claude/listen-android-chat-speech branch from a8b66de to 90ea963 Compare July 6, 2026 19:15
@openclaw-barnacle openclaw-barnacle Bot added size: L and removed app: web-ui App: web-ui gateway Gateway runtime size: XL labels Jul 6, 2026
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready at 90ea96348683e427bbcf49c7aa28c4b94771bde1.

What changed:

Proof:

Known proof gap: the exact proof variant is installed on a connected Pixel 10a, but the device remained locked, so audible gateway-clip and on-device fallback capture could not be completed. No automated or CI failures remain.

@steipete
steipete merged commit 2638113 into main Jul 6, 2026
98 of 102 checks passed
@steipete
steipete deleted the claude/listen-android-chat-speech branch July 6, 2026 19:30
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant