Skip to content

fix(shortcuts): release recording source lock before transcription#252

Merged
Kieirra merged 4 commits intomainfrom
claude/fix-whisper-overlay-crash-LwOHI
Mar 26, 2026
Merged

fix(shortcuts): release recording source lock before transcription#252
Kieirra merged 4 commits intomainfrom
claude/fix-whisper-overlay-crash-LwOHI

Conversation

@Kieirra
Copy link
Copy Markdown
Owner

@Kieirra Kieirra commented Mar 25, 2026

Summary

  • Fix mutex contention in force_stop_recording et force_cancel_recording qui causait le freeze/crash de l'overlay quand la limite de 5 minutes d'enregistrement était atteinte
  • Le mutex recording_state().source était tenu pendant toute la pipeline de transcription Whisper synchrone, bloquant tous les raccourcis clavier et empêchant l'annulation
  • Changement UX : quand la limite est atteinte, on annule maintenant l'enregistrement au lieu de transcrire — l'utilisateur a probablement oublié l'enregistrement

Root Cause

Quand la limite d'enregistrement est atteinte (recording-limit-reached event), force_stop_recording :

  1. Verrouillait recording_state().source
  2. Appelait stop_recording(app) — transcription Whisper synchrone (potentiellement très lent pour 5min d'audio)
  3. Ne libérait le lock qu'au return de la fonction

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

  1. Libérer le mutex avant d'appeler stop_recording/cancel_recording en scopant le lock
  2. Utiliser force_cancel_recording au lieu de force_stop_recording quand la limite est atteinte — pas de transcription surprise dans une fenêtre aléatoire

Test plan

  • Lancer un enregistrement et le laisser atteindre la limite de 5 min — l'overlay doit se fermer instantanément sans transcription
  • Pendant la phase après la limite, vérifier que les raccourcis clavier restent réactifs
  • L'enregistrement normal start/stop fonctionne toujours correctement

claude and others added 4 commits March 25, 2026 16:10
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
@sonarqubecloud
Copy link
Copy Markdown

@Kieirra Kieirra merged commit ff8b3b8 into main Mar 26, 2026
9 checks passed
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.

2 participants