Skip to content

fix(dictation): stop double insert/paste in accumulate mode - #575

Merged
silverstein merged 2 commits into
mainfrom
fix/dictation-double-insert-accumulate
Jul 27, 2026
Merged

fix(dictation): stop double insert/paste in accumulate mode#575
silverstein merged 2 commits into
mainfrom
fix/dictation-double-insert-accumulate

Conversation

@silverstein

Copy link
Copy Markdown
Owner

The bug

fn dictation pastes the transcription into the focused field twice. Reproduced from a live dictation log: two dictation_insert events per utterance, ~1s apart — one per-utterance (no file) and one combined (with the note file).

Root cause in crates/core/src/dictation.rs: with dictation.accumulate = true (the compiled default), handle_utterance both accumulates the utterance and calls on_result for it, while flush_accumulated_results then delivers the combined result too. For a single-shot destination that is two deliveries per session; for destination = "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 default fn-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 the stdout special-case already in flush_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

silverstein and others added 2 commits July 27, 2026 17:37
…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>
@silverstein
silverstein merged commit 649fda0 into main Jul 27, 2026
21 checks passed
@silverstein
silverstein deleted the fix/dictation-double-insert-accumulate branch July 27, 2026 18:01
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.

1 participant