Skip to content

fix: honor configured speech in Control UI - #170343

Merged
steipete merged 43 commits into
mainfrom
feat/self-hosted-voice-webchat
Oct 13, 2026
Merged

steipete merged 43 commits into
mainfrom
feat/self-hosted-voice-webchat

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Control UI Read aloud, microphone dictation, and configured stt-tts Talk ignored the Gateway's speech providers and local chat model.

Closes #45508. Closes #113049.

User Impact

Operators can use configured OpenAI-compatible speech services for Read aloud and dictation, with the current chat agent answering split Talk turns. Unconfigured browser behavior and explicit realtime-provider selections remain supported. Escape and Stop discard buffered input and cancel pending transcription. Starting another voice action supersedes existing playback or capture, including pending dictation.

Why This Change Was Made

The UI reuses Gateway TTS, the existing Talk relay/media transcription owner, and normal chat submission. File transcription carries the admitted session's agent and credential context. Split Talk preserves the displayed branch and requires input/output readiness. Long answers use bounded speech requests.

Three optional additions are maintainer-approved: discard on talk.session.close, MediaUnderstandingProvider.isAudioConfigured(context), and sessionKey on talk.catalog. Existing clients/providers retain their behavior when these additions are absent. Catalog session targets use existing session authorization; selected-agent STT/realtime readiness matches execution. Speech readiness remains on shared synthesis configuration because the existing speech RPCs have no session target. Settings keeps the unscoped catalog call. No new operator configuration, dependency, or transcript store.

Thanks @mcfex and @mike-nott for reporting these workflows.

Evidence

Head 2c87586fb6b20efe5c7faa54bd88ca658c3665b2, including main fad1c5fa15b5d9d31a050646bdbd27beefa4a5a6. The merge preserves main's realtime preparation reuse and operator-read gate.

  • 189 focused Gateway/media/provider/browser-catalog cases passed in 354.57 seconds. The selected-agent credential matrix and cancellation regressions fail on their original defective owners; hidden/missing keys match sessions.resolve rejection. Composer/dictation: 43 passed in 13.48 seconds.
  • Full CI-like Bun UI: 1,784 files, 20,861 tests passed, 6 skipped; three-worker shard wall times 222.88 / 239.01 / 228.89 seconds. No hangs or new normalized Solid warnings. All three actual CI UI shards and all nine UI E2E shards passed on this head.
  • Full pnpm build passed on this head in 1,328.52 seconds, including all declarations. Protocol/native generation, SDK export checks, scoped production/test types and lint, complete core type-boundary check, and all seven baseline ratchets passed.
  • Fresh Chromium → built Control UI → isolated Gateway → loopback speech stub → native Ollama qwen3:8b: passed in 23.23 seconds. The current-key catalog, microphone transcription, local model reply and both decoded Gateway speech clips were verified. Split Stop and dictation Escape passed live cancellation in 9.30 seconds, with no late transcript, chat or TTS.
  • Independent Codex branch review: clean through P2. ClawSweeper re-review requested; no current-head report arrived within the required 15-minute observation window. Its older report is not counted as a current-head pass.

CI run 38447134368 has inherited wrapper-inventory failures in test/scripts/eager-import-closure.test.ts and test/scripts/pr-wrapper-source-closure.test.ts. Clean final-head and exact-base (fad1c5fa15b5d9d31a050646bdbd27beefa4a5a6) replays both produce the same three failures and 17 passes, in 25.04 and 28.61 seconds. The inventory misses five display/media helper files; the relevant inventory, tests and sources are unchanged from the base. An Android emulator-image unpacking failure was retried once; the native Access check then passed. The separate Security Review workflow could not complete: both the original attempt and one infrastructure retry exhausted their recovery budget on GitHub jobs API timeouts. That gate remains incomplete; it is not counted as a security approval.

The earlier Bun hang was PR-caused: the Custodian fixture omitted its runtime-config owner and another fixture initialized lifecycle state at module scope. Both are repaired, and the complete suite finishes. The first follow-up CI also caught two test issues—core-only type-graph placement and an unprepared catalog session fixture—which are repaired and verified against its exact main base.

Limits: Chromium on macOS with synthetic microphone and speech service; no speech-quality or Safari claim. Maintainer-authorized proof-only holds: live requester-revocation and latest-stable upgrade proof are not supplied; HTTP/CLI authority regressions pass.

Before: assistant reply lacks Read aloud

After: Gateway-backed Read aloud

Before: split configuration still requires a realtime provider

After: microphone transcription and the local model reply in normal chat

Production: +2,032 / −785 lines. Tests: +2,837 / −90. Docs: +68 / −2. Two obsolete baseline entries removed. Growth implements file-STT adaptation and browser capture/playback lifecycles while preserving existing speech, credential, session and chat ownership. No prompt/tool-text change; token delta 0.

@steipete steipete added the ci:no-fail-fast Keep all selected CI matrix jobs running after failures on the next PR run. label Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR connects Control UI Read aloud, dictation, and split Talk to configured Gateway speech providers and the current chat agent.

Example: An operator configures local Whisper transcription, Gateway TTS, and Ollama qwen3:8b with talk.realtime.mode set to stt-tts.

  • Before: Browser Talk requires a realtime provider and bypasses the configured local speech loop.
  • After: The microphone recording is transcribed through the Gateway, submitted to the local chat agent, and answered through Gateway speech playback.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful, owner-approved integration with credible browser evidence, but account binding, branch admission, readiness, bounded synthesis, and playback coordination still need repair.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Control UI speech ignores configured Gateway providers and the selected local chat model.
Reason: The reports establish practical self-hosted workflows, and maintainer authorship supplies direction for the integration and additive contracts.

Merge readiness

⛔ Blocked before merge - 7 items remain

Keep this PR open: it addresses a real, maintainer-approved speech gap, but five source-confirmed defects block merging; the previous discard and credential-readiness findings are fixed.

Priority: P2
Reviewed head: 86986b9bd7805641f8bc1d50b57d0016ba51a063

Before merge

  • Add real behavior proof - Authority-chain proof required: inspected before/after images and the reported Chromium run through the built UI, isolated Gateway, loopback speech service, and Ollama support configured STT/chat/TTS routing and playback; the reported Escape/Stop run supports cancellation, but requester revocation is covered only by mocked HTTP/CLI effects, with no supplied final-effect trace showing a revoked requester denied before provider I/O. Supply redacted allowed-versus-revoked dispatch evidence, removing IPs, API keys, phone numbers, and non-public endpoints. 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.
  • Carry the selected agent into file transcription (P1) - For a conversation owned by a non-default agent, this call supplies neither agentId nor agentDir/workspaceDir. The media runtime therefore reaches resolveApiKeyForProviderCore with no agent scope, which falls back to the default agent directory. Agent-local credentials can appear unavailable, or microphone audio can be uploaded using the default agent's provider account. Carry the admitted conversation's agent scope through readiness and execution. This corroborates the existing inline review; it was equally visible at the previous reviewed head and should have been caught then.
  • Preserve the displayed branch when submitting split Talk (P2) - Ordinary foreground sends pass expectedLeafEntryId from the displayed transcript, but this callback omits it. If another client changes the active branch before the voice turn is admitted, the Gateway can accept the spoken message onto an unseen branch instead of rejecting it for reconciliation. Reuse the foreground send's displayed-leaf admission contract. This corroborates the existing inline review; the unchanged callback was already visible at the previous reviewed head.
  • Require speech output readiness before enabling split Talk (P2) - With stt-tts selected, working transcription and an unconfigured speech provider still produce realtimeStatus='ready'. The browser records the utterance and executes chat.send, then fails only when speech synthesis is requested after the answer. Include authoritative readiness for the selected Talk output or TTS fallback before admitting capture. This corroborates the existing inline review; the same gate was already present at the previous reviewed head.
  • Handle speech text beyond the synthesis limit (P2) - Both Read aloud and split Talk pass the entire assistant answer through this single request. A 5000-character answer exceeds the default tts.maxTextLength of 4096: tts.speak rejects it, and talk.speak reaches the same synthesis bound. Read aloud fails, while split Talk ends the call after the agent has completed. Handle long text through bounded speech requests while preserving cancellation and playback order. This corroborates the existing inline review; this request was unchanged at the previous reviewed head.
  • Coordinate playback across Read aloud and Talk (P2) - Every mounted assistant message constructs an independent playback owner, and split Talk constructs another. Starting Read aloud on message B leaves message A playing; starting Talk also leaves that audio running while microphone capture begins, so generated speech can be transcribed as user input. Share playback ownership within the active conversation so a new speech operation supersedes the previous clip. This corroborates the existing inline review; the constructor was unchanged at the previous reviewed head.
  • Resolve security concern: Recorded audio can use another agent's provider account - The missing scope affects provider account selection at the upload boundary; the existing requester guard checks caller authority but does not establish which agent's credential store should supply the account.

Findings

  • [P1] Carry the selected agent into file transcription — src/gateway/talk/file-transcription.ts:141-143
  • [P2] Preserve the displayed branch when submitting split Talk — ui/src/pages/chat/chat-state-page.ts:382-385
  • [P2] Require speech output readiness before enabling split Talk — ui/src/pages/chat/composer-microphone-picker.ts:138-144
  • [medium] Recorded audio can use another agent's provider account — src/gateway/talk/file-transcription.ts:142

Tests

  • Missing end-to-end proof: Supplied proof lacks final-provider-I/O denial for a revoked requester and a latest-stable upgrade run preserving existing speech selections.
Agent review details

How this fits together

The Control UI captures microphone audio and requests playback; Gateway Talk adapts recordings to the media transcription owner, ordinary chat runs produce answers, and existing speech providers return audio.

flowchart LR
  A[Control UI microphone] --> B[Gateway Talk relay]
  B --> C[Media transcription owner]
  C --> D[Ordinary chat submission]
  D --> E[Selected agent]
  E --> F[Gateway speech provider]
  F --> G[Browser audio playback]
Loading

Technical review

Best possible solution:

Complete the existing speech-owner integration with agent-scoped transcription, branch-safe chat submission, authoritative output readiness, bounded synthesis, and coordinated playback.

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

Current-main source and the linked reports establish that browser Talk ignores configured split speech; source tracing also establishes the listed introduced failures without executing target code.

Is this the best way to solve the issue?

Reusing Gateway speech, media transcription, and ordinary chat is the right direction, but the integration must preserve those owners' agent scope, branch admission, readiness, text limits, and playback lifecycle.

Full review comments:

  • [P1] Carry the selected agent into file transcription — src/gateway/talk/file-transcription.ts:141-143
    For a conversation owned by a non-default agent, this call supplies neither agentId nor agentDir/workspaceDir. The media runtime therefore reaches resolveApiKeyForProviderCore with no agent scope, which falls back to the default agent directory. Agent-local credentials can appear unavailable, or microphone audio can be uploaded using the default agent's provider account. Carry the admitted conversation's agent scope through readiness and execution. This corroborates the existing inline review; it was equally visible at the previous reviewed head and should have been caught then.
    Confidence: 0.98
    Late finding: first raised on code an earlier review cycle already covered.
  • [P2] Preserve the displayed branch when submitting split Talk — ui/src/pages/chat/chat-state-page.ts:382-385
    Ordinary foreground sends pass expectedLeafEntryId from the displayed transcript, but this callback omits it. If another client changes the active branch before the voice turn is admitted, the Gateway can accept the spoken message onto an unseen branch instead of rejecting it for reconciliation. Reuse the foreground send's displayed-leaf admission contract. This corroborates the existing inline review; the unchanged callback was already visible at the previous reviewed head.
    Confidence: 0.98
    Late finding: first raised on code an earlier review cycle already covered.
  • [P2] Require speech output readiness before enabling split Talk — ui/src/pages/chat/composer-microphone-picker.ts:138-144
    With stt-tts selected, working transcription and an unconfigured speech provider still produce realtimeStatus='ready'. The browser records the utterance and executes chat.send, then fails only when speech synthesis is requested after the answer. Include authoritative readiness for the selected Talk output or TTS fallback before admitting capture. This corroborates the existing inline review; the same gate was already present at the previous reviewed head.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.
  • [P2] Handle speech text beyond the synthesis limit — ui/src/lib/speech-playback.ts:39-42
    Both Read aloud and split Talk pass the entire assistant answer through this single request. A 5000-character answer exceeds the default tts.maxTextLength of 4096: tts.speak rejects it, and talk.speak reaches the same synthesis bound. Read aloud fails, while split Talk ends the call after the agent has completed. Handle long text through bounded speech requests while preserving cancellation and playback order. This corroborates the existing inline review; this request was unchanged at the previous reviewed head.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.
  • [P2] Coordinate playback across Read aloud and Talk — ui/src/pages/chat/components/chat-read-aloud.tsx:19
    Every mounted assistant message constructs an independent playback owner, and split Talk constructs another. Starting Read aloud on message B leaves message A playing; starting Talk also leaves that audio running while microphone capture begins, so generated speech can be transcribed as user input. Share playback ownership within the active conversation so a new speech operation supersedes the previous clip. This corroborates the existing inline review; the constructor was unchanged at the previous reviewed head.
    Confidence: 0.97
    Late finding: first raised on code an earlier review cycle already covered.

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

Provenance checked

  • Dictation capture and final transcript ownership keeps the original intent (aae5b0f: Hold-to-record inserts editable text without sending; subsequent fixes preserve canceled drafts and late final transcripts.)
  • Configured transcription selection keeps the original intent (a118b32: Configured streaming providers must remain discoverable and executable even under a partial active provider registry.)
  • Provider authentication execution keeps the original intent (9bbba7b: The OpenAI provider owns credential preparation after file loading while preserving the existing transcription API and automatic-selection rejection contract.)
  • Transcription close behavior changes intended behavior with a stated reason (6363875: Normal close preserves final speech; this PR retains finalization and adds explicitly approved discard intent for cancellation.)

Testing

Proof path: shipped entry point.

Security

Needs attention: Selected-agent credential binding must be repaired before microphone audio can safely follow this new transcription path.

Evidence

Security concerns:

  • [medium] Recorded audio can use another agent's provider account — src/gateway/talk/file-transcription.ts:142
    The missing scope affects provider account selection at the upload boundary; the existing requester guard checks caller authority but does not establish which agent's credential store should supply the account.
    Confidence: 0.98

What I checked:

PR surface

Source +973, Tests +1827, Docs +62, Other -1. Total +2861 across 64 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 38 1702 729 +973
Tests 21 1887 60 +1827
Docs 4 63 1 +62
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 64 3652 791 +2861

Review metrics

Metric Value Why it matters
Production versus test changes Production +1702/-729; tests and fixtures +1887/-60 Growth implements file-STT adaptation and browser speech flows while extracting existing capture and credential owners; size alone is not a blocker.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Configured browser speech is a useful improvement with a bounded affected surface; existing chat remains usable.
  • merge-risk: 🚨 compatibility: The optional provider-readiness hook and close-discard field expand public SDK and protocol behavior; their direction is already approved.
  • merge-risk: 🚨 auth-provider: File transcription omits the selected agent scope and can resolve credentials from the default agent.
  • merge-risk: 🚨 security-boundary: Recorded audio can use a different agent's provider account, and retained requester authority requires final-effect revocation evidence.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-12T22:43:06.090Z sha afac473 :: needs real behavior proof before merge. :: [P1] Preserve the configured transcription voiceModel before selecting file STT | [P1] Carry requester authority through media attempts to the final effect | [P2] Derive file-transcription readiness from executable provider state
  • reviewed 2026-10-12T23:08:48.179Z sha 91b2bf1 :: needs real behavior proof before merge. :: [P1] Preserve the configured transcription voiceModel before selecting file STT | [P1] Carry requester authority through media attempts to the final effect | [P2] Derive file-transcription readiness from executable provider state
  • reviewed 2026-10-13T01:09:44.627Z sha 673f79d :: needs real behavior proof before merge. :: [P2] Discard canceled file captures instead of finalizing them | [P2] Check executable credentials for context-aware transcription providers | [P2] Permit the effect-owned playback state writes | [P2] Update shared chat fixtures for the runtime-config consumer
  • reviewed 2026-10-13T01:39:52.433Z sha db16774 :: needs real behavior proof before merge. :: [P2] Discard canceled file captures instead of finalizing them | [P2] Check executable credentials for context-aware transcription providers

Reviewed October 13, 2026, 4:49 AM ET / 08:49 UTC (Revision 5).

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 12, 2026
@steipete
steipete marked this pull request as ready for review October 13, 2026 00:57
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The reviewed provider-selection, readiness, and capture-authority findings are fixed. Regression tests fail against the previous owners and pass after the repairs; the complete branch has a clean independent Codex review. The PR body records the final local-model/browser proof and its speech-stub limitation.

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 ci:no-fail-fast Keep all selected CI matrix jobs running after failures on the next PR run. docs Improvements or additions to documentation extensions: openai gateway Gateway runtime merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

1 participant