fix(dictation): stop double insert/paste in accumulate mode - #575
Merged
Conversation
…acent) With dictation.accumulate = true, handle_utterance pushed each utterance to the accumulator AND called on_result for it, while flush_accumulated_results then delivered the combined result too. For a single-shot destination that meant two deliveries per session — and for destination = "insert" the dictation was pasted into the focused field twice (confirmed in the field: two dictation_insert log events per utterance, one per-utterance with no file, one combined with the note file). The bug was masked until Accessibility was granted, because the paste keystroke silently failed without it. Fix: in accumulate mode, only stream the per-utterance result for stdout; single-shot destinations (insert/clipboard/file/command) receive exactly one combined result from the flush. This mirrors the stdout special-case already in flush_accumulated_results. Adds a regression test asserting insert delivers zero per-utterance and stdout still streams. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…on test Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
fndictation pastes the transcription into the focused field twice. Reproduced from a live dictation log: twodictation_insertevents per utterance, ~1s apart — one per-utterance (no file) and one combined (with the note file).Root cause in
crates/core/src/dictation.rs: withdictation.accumulate = true(the compiled default),handle_utteranceboth accumulates the utterance and callson_resultfor it, whileflush_accumulated_resultsthen delivers the combined result too. For a single-shot destination that is two deliveries per session; fordestination = "insert"(also the default) it pastes twice.It was masked until Accessibility was granted, because the paste keystroke silently no-ops without it — so fixing a TCC grant "revealed" this latent double-paste.
Scope
accumulate: true+destination: "insert"are both defaults, so this affects every defaultfn-dictation user whose Accessibility works. Recommend a 0.23.1 patch.Fix
In accumulate mode, only stream the per-utterance result for
stdout; single-shot destinations (insert/clipboard/file/command) receive exactly one combined result from the flush. Mirrors thestdoutspecial-case already inflush_accumulated_results. Adds a regression test: insert delivers zero per-utterance, stdout still streams.Verified: dictation suite 29/29, clippy
-D warnings, fmt clean.🤖 Generated with Claude Code