Skip to content

[codex] feat(webchat): add gateway read aloud - #76027

Closed
steipete wants to merge 1 commit into
mainfrom
codex/webchat-tts-read-aloud
Closed

steipete wants to merge 1 commit into
mainfrom
codex/webchat-tts-read-aloud

Conversation

@steipete

@steipete steipete commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Validation

  • pnpm --dir ui test src/ui/chat/grouped-render.test.ts src/ui/controllers/chat.test.ts
  • pnpm --dir ui test src/ui/views/chat.test.ts src/ui/app-render.assistant-avatar.test.ts
  • pnpm exec oxfmt --check --threads=1 ui/src/ui/chat/grouped-render.ts ui/src/ui/controllers/chat.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/app-render.ts ui/src/ui/views/chat.ts docs/web/webchat.md CHANGELOG.md
  • git diff --check

Notes

  • pnpm tsgo:test:ui currently fails on current main at src/plugins/loader.ts:1381 with Type 'string[] | undefined' is not assignable to type 'string[]', unrelated to this diff.

Refs #45508.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels May 2, 2026
@clawsweeper

clawsweeper Bot commented May 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 9, 2026, 3:31 PM ET / 19:31 UTC (Revision 3).

ClawSweeper review

What this changes

Adds an assistant-message Read aloud button that uses Gateway-configured speech providers and plays generated audio through the assistant-media endpoint.

Merge readiness

⛔ Blocked before merge - 7 items remain

Keep open: current main still lacks the requested WebChat action, and this maintainer-protected PR retains useful work. The earlier credential-exposure and release-owned changelog findings remain applicable.

Priority: P2
Reviewed head: 6ba908b5d5393cd2ffa56676dea33bcb318a0cd1

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused feature has useful unit coverage, but the credential transport defect and missing authority-boundary proof prevent readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: Authority-chain proof required: the new playback path transfers reusable credentials into HTTP URLs, while the supplied tests mock both RPC and Audio. Show authorized playback without reusable credentials in request URLs, and rejection of unauthenticated or revoked credentials before synthesis/media I/O. The maintainer exemption still applies to unrelated proof. Redact secrets and private endpoints; update the PR body for automatic re-review, or ask a maintainer for @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Authority-chain proof required: the new playback path transfers reusable credentials into HTTP URLs, while the supplied tests mock both RPC and Audio. Show authorized playback without reusable credentials in request URLs, and rejection of unauthenticated or revoked credentials before synthesis/media I/O. The maintainer exemption still applies to unrelated proof. Redact secrets and private endpoints; update the PR body for automatic re-review, or ask a maintainer for @clawsweeper re-review.
Evidence reviewed 8 items Introduced credential-bearing playback request: The pinned merge-base-to-head patch adds a URL builder that places the resolved Gateway credential in token= and passes that URL to Audio. The caller resolves a device token, configured shared token, or password. This is a new credential-bearing request, although the original UI already used a similar pattern for other attachments.
Existing authentication contract: The original assistant-media handler accepts query credentials and checks authentication before opening allowed local files. Current main still has legacy query-token handling, alongside scoped media tickets and current-policy checks; this review does not claim query-token playback is categorically rejected or that the PR removes those checks.
A simpler supported audio transport now exists: Current main implements tts.speak, returning audioBase64 and MIME metadata through the authenticated RPC connection using the configured speech synthesis chain. GitHub verifies #100770 merged as 553acdf. Its purpose explicitly includes remote clients playing individual assistant messages without accessing Gateway-local files.
Findings 2 actionable findings [P1] Keep reusable Gateway credentials out of playback URLs
[P3] Remove the release-owned changelog edit
Security Needs attention Reusable credentials exposed through media request URLs: The playback URL carries the same credential resolved for authenticated Control UI access, rather than authority scoped to the generated clip. Request logging can therefore disclose a credential usable beyond audio playback.

How this fits together

Control UI displays assistant messages received from the Gateway. This change sends selected message text to Gateway speech synthesis, then retrieves the generated audio for browser playback.

flowchart LR
  A[Assistant message] --> B[Read aloud button]
  B --> C[Authenticated Gateway request]
  C --> D[Configured speech provider]
  D --> E[Generated audio file]
  E --> F[Assistant media request]
  F --> G[Browser playback]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Authority-chain proof required: the new playback path transfers reusable credentials into HTTP URLs, while the supplied tests mock both RPC and Audio. Show authorized playback without reusable credentials in request URLs, and rejection of unauthenticated or revoked credentials before synthesis/media I/O. The maintainer exemption still applies to unrelated proof. Redact secrets and private endpoints; update the PR body for automatic re-review, or ask a maintainer for @clawsweeper re-review.
  • Keep reusable Gateway credentials out of playback URLs (P1) - Clicking Read aloud serializes the resolved device token, shared token, or password into the audio URL. Reverse proxies commonly record request URLs, exposing reusable Gateway authority to log readers. This retains the earlier media-credential finding. Use current main's tts.speak with local Blob playback, or authenticated metadata retrieval followed by a scoped media ticket; do not pass the reusable credential to Audio.
  • Remove the release-owned changelog edit (P3) - The added entry remains from the earlier review. The authoritative repository policy reserves CHANGELOG.md for release work, so remove this hunk and retain the user-visible behavior and related request in the PR description.
  • Resolve security concern: Reusable credentials exposed through media request URLs - The playback URL carries the same credential resolved for authenticated Control UI access, rather than authority scoped to the generated clip. Request logging can therefore disclose a credential usable beyond audio playback.
  • Resolve merge risk (P1) - Reusable Gateway credentials in playback URLs can enter reverse-proxy access logs and be replayed by someone who can read those logs.
  • Resolve merge risk (P1) - The supplied branch is conflicted against current main; the unavailable pinned test merge leaves the integrated result unverified.
  • Complete next step (P2) - Adapt the action to current main, resolve the branch conflicts, eliminate reusable credentials from playback URLs, remove the changelog hunk, and supply the scoped authorization proof before merge.

Findings

  • [P1] Keep reusable Gateway credentials out of playback URLs — ui/src/ui/controllers/chat.ts:528-533
  • [P3] Remove the release-owned changelog edit — CHANGELOG.md:30
  • [high] Reusable credentials exposed through media request URLs — ui/src/ui/controllers/chat.ts:531
Agent review details

Security

Needs attention: The new audio request transfers reusable Gateway credentials into URLs; no dependency or supply-chain changes were introduced.

PR surface

Source +112, Tests +68, Docs +2. Total +182 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 117 5 +112
Tests 2 69 1 +68
Docs 2 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 188 6 +182

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #45508
Summary: This PR is a candidate for the TTS portion of the broader voice request; it does not resolve the separate STT requirements.

Members:

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

Mantis proof suggestion

A real WebChat interaction with network diagnostics would help verify provider-backed playback, alongside the separate authorization rejection evidence. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis verify the assistant Read aloud action in WebChat, capture configured Gateway TTS playback and redacted request diagnostics, and inspect whether any playback URL contains a reusable Gateway credential.

Merge-risk options

Maintainer options:

  1. Keep audio on the authenticated RPC connection (recommended)
    Adapt the action to tts.speak and local Blob playback, eliminating reusable credentials from media URLs.
  2. Retain file delivery with scoped tickets
    If file delivery is necessary, use the existing authenticated metadata and scoped media-ticket flow with final-access validation.

Technical review

Best possible solution:

Use the existing tts.speak RPC and a browser-local audio Blob in the current chat UI, preserving configured providers without placing Gateway credentials in media URLs.

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

Yes for the credential-exposure finding: the introduced URL builder and its test explicitly put the resolved credential into the audio request URL. This is source-proven; no browser or provider run was executed.

Is this the best way to solve the issue?

No as submitted: Gateway-backed synthesis is appropriate, but current main's existing tts.speak RPC provides the audio directly and avoids the additional credential-bearing file request.

Full review comments:

  • [P1] Keep reusable Gateway credentials out of playback URLs — ui/src/ui/controllers/chat.ts:528-533
    Clicking Read aloud serializes the resolved device token, shared token, or password into the audio URL. Reverse proxies commonly record request URLs, exposing reusable Gateway authority to log readers. This retains the earlier media-credential finding. Use current main's tts.speak with local Blob playback, or authenticated metadata retrieval followed by a scoped media ticket; do not pass the reusable credential to Audio.
    Confidence: 0.99
  • [P3] Remove the release-owned changelog edit — CHANGELOG.md:30
    The added entry remains from the earlier review. The authoritative repository policy reserves CHANGELOG.md for release work, so remove this hunk and retain the user-visible behavior and related request in the PR description.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 10e57bf8ab38.

Labels

Label justifications:

  • P2: This is a bounded accessibility and listening improvement, without evidence of an urgent existing-workflow regression.
  • merge-risk: 🚨 security-boundary: The new playback request exposes reusable Gateway authority in a URL instead of limiting transport to authenticated RPC or scoped media access.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Authority-chain proof required: the new playback path transfers reusable credentials into HTTP URLs, while the supplied tests mock both RPC and Audio. Show authorized playback without reusable credentials in request URLs, and rejection of unauthenticated or revoked credentials before synthesis/media I/O. The maintainer exemption still applies to unrelated proof. Redact secrets and private endpoints; update the PR body for automatic re-review, or ask a maintainer for @clawsweeper re-review.

Evidence

Security concerns:

  • [high] Reusable credentials exposed through media request URLs — ui/src/ui/controllers/chat.ts:531
    The playback URL carries the same credential resolved for authenticated Control UI access, rather than authority scoped to the generated clip. Request logging can therefore disclose a credential usable beyond audio playback.
    Confidence: 0.99

What I checked:

  • Introduced credential-bearing playback request: The pinned merge-base-to-head patch adds a URL builder that places the resolved Gateway credential in token= and passes that URL to Audio. The caller resolves a device token, configured shared token, or password. This is a new credential-bearing request, although the original UI already used a similar pattern for other attachments. (ui/src/ui/controllers/chat.ts:531, 6ba908b5d539)
  • Existing authentication contract: The original assistant-media handler accepts query credentials and checks authentication before opening allowed local files. Current main still has legacy query-token handling, alongside scoped media tickets and current-policy checks; this review does not claim query-token playback is categorically rejected or that the PR removes those checks. (src/gateway/control-ui.ts:559, 10e57bf8ab38)
  • A simpler supported audio transport now exists: Current main implements tts.speak, returning audioBase64 and MIME metadata through the authenticated RPC connection using the configured speech synthesis chain. GitHub verifies feat(gateway): add tts.speak method returning synthesized audio inline #100770 merged as 553acdf. Its purpose explicitly includes remote clients playing individual assistant messages without accessing Gateway-local files. (src/gateway/server-methods/tts.ts:180, 553acdfc1aef)
  • Current-main necessity and release check: Current-main UI search finds no implemented Read aloud or tts.convert action; its message test still asserts that the old Read aloud footer action is absent. The supplied latest release's Gateway source contains tts.speak, so the safer transport is already available. A release-wide UI search encountered an unavailable Git object, so no release-wide UI absence claim is made. (ui/src/pages/chat/components/chat-message.test.ts:803, 10e57bf8ab38)
  • Proof and review continuity: The captured body identifies unit tests and formatting checks; the added controller test mocks both Gateway requests and audio playback. Neither allowed nor forbidden final-effect behavior is demonstrated. The previous completed review examined the identical head and retained the media-credential and changelog findings; the local comparison against that reviewed SHA is empty. (ui/src/ui/controllers/chat.test.ts:801, 6ba908b5d539)
  • Related request and discussion: [Feature]: Self-hosted STT/TTS provider support in webchat (Route webchat TTS through the gateway instead of browser Speech API) #45508 remains open and includes both TTS playback and separate STT requirements. Its discussion positively identifies existing Gateway TTS as the narrow first slice and distinguishes batch transcription from streaming dictation. The comment offering another UI PR does not establish a replacement. Bounded GitHub search found no verified replacement implementing this WebChat action.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Replace credential-bearing audio URLs with tts.speak and browser-local playback, or existing scoped media tickets.
  • Provide redacted final-effect evidence for authorized playback and unauthenticated/revoked-credential rejection before I/O.
  • Remove the release-owned changelog hunk.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-06-30T13:21:26.215Z sha 6ba908b :: needs real behavior proof before merge. :: [P1] Use media tickets instead of token media URLs | [P3] Remove the direct changelog entry
  • reviewed 2026-07-30T21:40:59.287Z sha 6ba908b :: needs real behavior proof before merge. :: [P1] Use media tickets instead of token media URLs | [P3] Remove the direct changelog entry

@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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jun 14, 2026
@xuwei-xy

Copy link
Copy Markdown

This could be resolved by updating ui. I'll prepare a PR if that sounds good.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 30, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. and removed P1 High-priority user-facing bug, regression, or broken workflow. labels Sep 9, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Thanks for the read-aloud work. The current Control UI implements this through configured Gateway speech in #170343, with assistant-message controls and playback/error/stop handling. The former Lit tts.convert/audioPath integration has been replaced, so there is no remaining feature change to carry forward from this PR. Closing as superseded.

@shakkernerd
shakkernerd deleted the codex/webchat-tts-read-aloud branch October 19, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S 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.

3 participants