Repository navigation
fix(ui): dictation duplicates words on Stop and retains canceled speech - #130395
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 4:50 PM ET / 20:50 UTC. ClawSweeper reviewWhat this changesThe branch makes composer dictation retain one session-owned transcript and insert it into the originally captured draft, avoiding duplicated or canceled speech. Regression provenancePossible regression — probable (reviewed change; reproduction). No predecessor PR is attributed. Merge readinessKeep open. The focused owner-boundary repair appears correct; required exact-head checks were still in progress in the supplied PR state. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI composer streams dictation through the Gateway transcription relay and renders a read-only preview in the draft field. Stop inserts recognized speech into the saved selection, while cancel restores the original draft. flowchart LR
User[Composer microphone gesture] --> Session[Dictation session]
Session --> Relay[Gateway transcription relay]
Relay --> Transcript[Session transcript]
Transcript --> Preview[Read-only draft preview]
Preview --> Decision{Stop or cancel}
Decision -->|Stop| Insert[Insert into captured draft]
Decision -->|Cancel| Discard[Discard speech]
Insert --> Draft[Editable composer draft]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -5, Tests +175. Total +170 across 8 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the single session-owned transcript and immutable draft-snapshot flow after exact-head UI validation completes. Do we have a high-confidence way to reproduce the issue? Yes. The prior owner path previews a partial in the read-only draft then inserts the transcript against that previewed value on Stop; focused browser scenarios cover caret and selected-range cases. Is this the best way to solve the issue? Yes. Session-owned transcript accumulation plus an immutable original-draft snapshot eliminates the conflicting state owners and prevents late session events from replacing current state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 70c87cc98d7a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Verified dictation repair at Authentic failing owner and Chromium scenarios now pass: 150 focused owner/sibling tests and all seven browser-dictation flows, plus a separate cancel/restart/deferred-close/stale-event recording. Production UI build/startup performance and the full changed-file gates passed. Fresh final Codex autoreview and independent source review found no actionable issues. Production net -5 lines; existing audio-drain, repeated-final, disconnect, pointer/IME and ordinary blur behavior remain covered. Exact-head CI and Workflow Sanity passed. Before/after screenshots in the PR body were inspected at original resolution and independently OCR-checked. Browser evidence uses deterministic mocked Gateway traffic and fake media hardware, not actual microphone/provider execution. Proceeding through native prepare/merge gates. The latest ClawSweeper review reports no actionable findings. Its sole before-merge item and rank-up move—finish exact-head UI/build checks successfully—is satisfied by the linked completed CI run; no source revision or review bypass was needed. |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where users dictating into Control UI could see words duplicated when pressing Stop, recognized words disappear from the preview, or canceled speech remain after moving focus. Direct dictation on the new-session page also missed Escape, window-blur and hidden-page cancellation; a closing session could overwrite a newer preview.
Why This Change Was Made
The dictation session now owns the complete transcript used by both preview and commit. Chat captures the draft and caret only when admitting a new gesture, so Stop cannot capture the preview as a new draft; the textarea blur producer no longer publishes a read-only preview. Phase transitions own cancellation listeners for both entry paths, and stopping retires session events immediately while queued audio and remote close still drain in the background.
This removes the partial-only mirror and duplicate closed/late-event-cleanup state. It changes no provider, protocol, persisted setting, dependency, or storage contract. Production LOC: +56/-61 (net -5). Tests: +197/-22 (net +175).
Provenance: direct start and immediate UI release arrived in #127823 (code/PR author @vyctorbrzezowski, merged by @steipete on August 26). Its preview made the older DOM-valued commit and partial-only display behavior visible; those lines originated in #111114 (code/PR author and merger @steipete, July 19). This repair follows the shared draft/session owners rather than adding per-surface transcript workarounds.
User Impact
Dictated words stay visible and are inserted exactly once at the original caret or selection. Escape discards speech without changing the draft, including after moving focus. Starting another dictation while the old remote close is pending cannot let old speech replace the new preview. Stop remains immediate and never sends a chat message by itself.
Evidence
Authentic before/after Chromium reproduction: dictating “please” into
ship itat the caret displayedship please it, but Stop producedship please it please. The repaired Stop keeps exactlyship please it. Selection replacement, recognized-final plus interim speech, and focus-away followed by Escape also failed before their owner repairs and pass afterward.Before — Stop duplicates the preview:
After — Stop commits exactly once:
Browser proof uses deterministic mocked Gateway traffic and fake media hardware, not an actual microphone or authenticated transcription provider. The repaired browser state ownership is exercised through the real rendered UI; provider behavior is unchanged. Exact-head hosted CI remains the landing gate.