Fix race condition when toggling transcription via SIGUSR2#560
Merged
cjpais merged 2 commits intocjpais:mainfrom Jan 10, 2026
Merged
Fix race condition when toggling transcription via SIGUSR2#560cjpais merged 2 commits intocjpais:mainfrom
cjpais merged 2 commits intocjpais:mainfrom
Conversation
The toggle state was being set to false immediately when stop was called, but the actual transcription runs asynchronously. If another signal arrived before transcription completed, a new recording could start while the old transcription was still running, causing the old text to paste unexpectedly. Now the toggle state stays true until the async transcription task completes.
Owner
|
thanks merging |
h0lybyte
added a commit
to KBVE/Handy
that referenced
this pull request
Jan 12, 2026
…, and UI improvements Merged upstream features: - feat: add Czech translation (cjpais#568) - fix: keybinding changes failing silently due to incorrect key ordering (cjpais#524) - fix: improve apple intelligence ui and add reusable alert component (cjpais#517) - Fix race condition when toggling transcription via SIGUSR2 (cjpais#560) - feat(linux): add ydotool support for text input (cjpais#557) - feat: add Moonshine Base speech recognition model (cjpais#556) - Prevent highlight and selection cursor hover on UI text items (cjpais#541) - feat(ui): add reusable Tooltip component and integrate with settings (cjpais#538) - PR guidelines for AI - dont allow package-lock with a bun project for now Conflicts resolved: - src-tauri/src/shortcut.rs: Kept KBVE filler detection commands, adopted upstream's improved doc comment - src/bindings.ts: Merged KBVE types (Discord, Memory, Filler) with upstream's Moonshine engine type
4 tasks
aidynamicsolutions
pushed a commit
to aidynamicsolutions/codictate
that referenced
this pull request
Feb 21, 2026
Brings in latest main changes since PR cjpais#473 including: - cjpais#524: keybinding ordering fix - cjpais#517: Apple Intelligence UI improvements with Alert component - cjpais#560: SIGUSR2 race condition fix - cjpais#557: ydotool support for Linux - cjpais#556: Moonshine Base model support - cjpais#541: UI text selection prevention - cjpais#538: Tooltip component - cjpais#540: Portuguese language support - cjpais#536: Ukrainian language support Conflict resolutions: - PostProcessingSettings.tsx: Combined MLX provider support with new Alert UI - actions.rs: Fixed async block syntax issue - Lock files: Regenerated
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.
Before Submitting This PR
Please confirm you have done the following:
Human Written Description
I noticed this happening during my usage and wanted to fix it, it seemed clear enough that pasting was happening before transcription was completed.
Related Issues/Discussions
May help fix #462 - The race condition described there (rapid toggling causing hangs) shares the same root cause: toggle state is updated immediately while async work is still running, allowing new operations to start before previous ones complete.
Community Feedback
Related to community-reported issue #462
Testing
Code review of the async flow. The fix ensures toggle state stays
trueuntil the async transcription task completes, preventing new operations from starting while previous ones are still running.Summary
When using SIGUSR2 to toggle transcription, if signals are sent in quick succession, the previous transcription could paste at unexpected times.
The issue: Toggle state was set to
falseimmediately on stop, but transcription runs asynchronously. A new recording could start while the old transcription was still running.The fix: Keep toggle state
trueuntil the async transcription task completes (~10 lines changed).