Skip to content

fix(react-ui): stop voice-typing echo and duplication in composers - #1251

Open
shogun444 wants to merge 11 commits into
thesysdev:mainfrom
shogun444:feat/composer-voice-typing-guard
Open

shogun444 wants to merge 11 commits into
thesysdev:mainfrom
shogun444:feat/composer-voice-typing-guard

Conversation

@shogun444

Copy link
Copy Markdown
Contributor

What

Fixes an issue where using Windows Voice Typing (Win+H) and pressing Enter or Send mid-dictation causes text to duplicate in the draft (e.g., "welcome to Welcome to my house"), reappear after submission, or swallow subsequent speech.

This change introduces a shared composition hook that cleanly commits a single copy on the first Enter, drops trailing microphone noise, allows clean subsequent dictation to append without duplication, and ensures the draft remains cleared after sending.

Closes #1227

Refs #1045, #1068, #1228

Changes

  • Unified composition handling: Consolidated dictation tracking across Composer and DesktopWelcomeComposer into useComposerComposition.
  • Single-copy commit on fast Enter: The first Enter cleanly commits one snapshot to the draft and arms a 1500ms stopped window to swallow trailing speech remnants from the OS mic.
  • Append without duplication: Once the 1500ms window expires, a subsequent Win+H session cleanly appends new text after the committed draft without repeating previous words.
  • Submit-epoch guard: Increments an epoch counter upon submit to swallow late OS compositionend/onChange echoes, keeping the draft clean across rounds.
  • Missing compositionend fallback: Automatically flushes pending commits if the OS fails to emit a terminal composition event.
  • Preserved invariants: Preserved standard CJK IME conversion (keyCode === 229 / isComposing), Shift+Enter newlines, normal Send button click flow, and streaming cancellation.

Test Plan

  • Not applicable (explain why)
  • Verified locally

Environment

  • OS: Windows 11 (25H2)
  • Browsers: Google Chrome 153.0.8010.52, Microsoft Edge 154.0.4258.37

Validation Steps

  1. Mid-dictation commit: Dictated phrases via Win+H and pressed Enter mid-speech $\rightarrow$ exactly one clean copy committed to the draft; trailing mic speech was ignored.
  2. Send flow: Pressed a second Enter (or clicked Send) $\rightarrow$ message submitted cleanly; draft remained completely empty with no post-send echo.
  3. Re-dictation: Dictated phrase $\rightarrow$ pressed Enter $\rightarrow$ pressed Win+H and dictated again $\rightarrow$ new speech appended directly after the committed text with no duplication.
  4. Surfaces tested: Verified identical behavior on both Composer (thread view) and DesktopWelcomeComposer.
  5. Standard typing: Verified that normal typing, Shift+Enter newlines, and CJK IME conversions remain unaffected.

Automated Tests

  • Ran pnpm vitest run src/components/AgentInterface/__tests__/composerKeyboard.test.ts (all 26 tests passed).
  • Ran pnpm run typecheck (no new errors introduced).

Demo

[

Video.Project.56.1.mp4

](url)

Checklist

  • I linked a related issue, if applicable
  • I updated docs/README when needed
  • I considered backwards compatibility

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

@shogun444 is attempting to deploy a commit to the thesys-devs Team on Vercel.

A member of the Team first needs to authorize it.

@shogun444 shogun444 changed the title Feat/composer voice typing guard fix(react-ui): stop voice-typing echo and duplication in composers Sep 28, 2026
@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openui-docs Ready Ready Preview Sep 28, 2026 9:46am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — cfc165fc Deployed Sep 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate text reappearing after Send during Windows Voice Typing

1 participant