Skip to content

fix(ui): dictation duplicates words on Stop and retains canceled speech - #130395

Merged
steipete merged 1 commit into
mainfrom
codex/qa-dictation-lifecycle-20260826
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-dictation-lifecycle-20260826

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 it at the caret displayed ship please it, but Stop produced ship please it please. The repaired Stop keeps exactly ship 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:

Before: ship please it please

After — Stop commits exactly once:

After: ship please it

  • 150 focused tests across seven dictation, composer, pointer/IME, new-session and audio-owner files passed.
  • All seven real Chromium browser-dictation scenarios passed, including actual Stop pointerdown/click and Collapse-sidebar blur followed by Escape.
  • Additional Chromium recording passed Escape, immediate restart while old close remained deferred, stale old partial/final events, and Stop; exactly two dictation sessions were created/closed and no chat/session dispatch was sent.
  • Full changed-file policy, formatting, type, lint, i18n and Knip gates passed. Production UI build and startup performance passed (341390 bytes gzip, below the 341845-byte budget).
  • Fresh final structured Codex autoreview and independent source review found no actionable findings.

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.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 20:42
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 4:50 PM ET / 20:50 UTC.

ClawSweeper review

What this changes

The branch makes composer dictation retain one session-owned transcript and insert it into the originally captured draft, avoiding duplicated or canceled speech.

Regression provenance

Possible regression — probable (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. The focused owner-boundary repair appears correct; required exact-head checks were still in progress in the supplied PR state.

Priority: P2
Reviewed head: 5ef056b6cba153fff8deb2d3a8259738acae224f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused owner-boundary repair with strong regression coverage; browser transport evidence remains mock-backed.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This repository-member PR is exempt from the external-contributor proof gate; its mock-backed browser flows and linked screenshots remain supporting evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This repository-member PR is exempt from the external-contributor proof gate; its mock-backed browser flows and linked screenshots remain supporting evidence.
Evidence reviewed 7 items Canonical transcript ownership: The session now exposes its accumulated final and partial transcript, removing the controller-level mirror that could diverge from session state.
Captured-draft commit path: Stop inserts the session transcript into the saved original value and selection rather than the read-only preview value currently in the textarea.
Preview follows the same insertion basis: The rendered preview derives from the captured draft value and the full session transcript, so repeated transcript updates do not compose on prior preview text.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - Provided check state still had exact-head UI and build jobs in progress; merge only after required checks complete successfully.
Agent review details

Security

None.

PR surface

Source -5, Tests +175. Total +170 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 5 56 61 -5
Tests 3 197 22 +175
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 253 83 +170

Review metrics

Metric Value Why it matters
Production versus test delta production +56/-61; tests +197/-22 The owner-boundary repair is net-negative in production while adding focused regression coverage for the affected UI flows.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the single session-owned transcript and immutable draft-snapshot flow after exact-head UI validation completes.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

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

Labels

Label changes:

  • add P2: This repairs a normal composer workflow defect that can duplicate or retain dictated text without a security or availability impact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This repository-member PR is exempt from the external-contributor proof gate; its mock-backed browser flows and linked screenshots remain supporting evidence.

Label justifications:

  • P2: This repairs a normal composer workflow defect that can duplicate or retain dictated text without a security or availability impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This repository-member PR is exempt from the external-contributor proof gate; its mock-backed browser flows and linked screenshots remain supporting evidence.

Evidence

What I checked:

Likely related people:

Rank-up moves

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

  • Let the exact-head UI and build checks finish successfully before merge.

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Verified dictation repair at 5ef056b6cba153fff8deb2d3a8259738acae224f: preview and Stop share one original draft/caret snapshot and one complete session transcript; textarea blur cannot publish uncommitted speech; direct and held entry share cancellation lifetime; retired session events cannot replace a new preview while remote close drains.

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.

@steipete
steipete merged commit 2df6461 into main Aug 26, 2026
169 checks passed
@steipete
steipete deleted the codex/qa-dictation-lifecycle-20260826 branch August 26, 2026 21:02
@steipete

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: web-ui App: web-ui maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant