fix(shortcuts): release recording source lock before transcription#252
Merged
fix(shortcuts): release recording source lock before transcription#252
Conversation
Drop the recording_state().source mutex guard before calling stop_recording/cancel_recording in force_stop/force_cancel functions. Previously, the mutex was held for the entire duration of the synchronous transcription pipeline (Whisper API call). For long recordings (up to 5min), this blocked all shortcut handlers that acquire the same lock, making the overlay appear frozen and preventing cancellation via keyboard. https://claude.ai/code/session_01MRBCo8Pr7YvhiEVuxkCbaC
When the 5-minute recording limit is hit, the user likely forgot or didn't notice the recording. Cancelling is the safer UX: no surprise transcription pasted into a random window, and instant response. https://claude.ai/code/session_01MRBCo8Pr7YvhiEVuxkCbaC
|
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.



Summary
force_stop_recordingetforce_cancel_recordingqui causait le freeze/crash de l'overlay quand la limite de 5 minutes d'enregistrement était atteinterecording_state().sourceétait tenu pendant toute la pipeline de transcription Whisper synchrone, bloquant tous les raccourcis clavier et empêchant l'annulationRoot Cause
Quand la limite d'enregistrement est atteinte (
recording-limit-reachedevent),force_stop_recording:recording_state().sourcestop_recording(app)— transcription Whisper synchrone (potentiellement très lent pour 5min d'audio)Pendant l'étape 2, tous les raccourcis (Cancel, Toggle, PushToTalk) qui tentent d'acquérir le même lock étaient bloqués → app non-responsive.
Fix
stop_recording/cancel_recordingen scopant le lockforce_cancel_recordingau lieu deforce_stop_recordingquand la limite est atteinte — pas de transcription surprise dans une fenêtre aléatoireTest plan