Skip to content

fix: reject empty recordings on retry, restore push-to-talk under compositor shortcuts#1065

Open
xAlcahest wants to merge 2 commits into
OpenWhispr:mainfrom
xAlcahest:fix/corrupted-audio-error
Open

fix: reject empty recordings on retry, restore push-to-talk under compositor shortcuts#1065
xAlcahest wants to merge 2 commits into
OpenWhispr:mainfrom
xAlcahest:fix/corrupted-audio-error

Conversation

@xAlcahest

Copy link
Copy Markdown
Collaborator

Summary

The double-trigger behind #864 left a lasting scar: header-only recordings (~110 bytes) saved to history by older builds fail every Retry/Recover with the same confusing "Audio file might be corrupted or unsupported", because the retry-transcription handler in ipcHandlers.js ships the stored buffer to a backend with no validation. The handler now rejects buffers smaller than MIN_AUDIO_BYTES (reusing isEmptyRecording from recordingGuard.js) and returns a clear "Recording contains no audio" instead.

The reconcileNativeKeyListeners gate from #1001 also turned out to kill push-to-talk on KDE/GNOME/Hyprland: it blanks the native key listener whenever the compositor owns the hotkeys, but in push mode the compositor callback intentionally early-returns to defer to that same listener, so holding the hotkey did nothing at all. getNativeListenerKeys now takes a compositorOwnsHotkeys flag and keeps just the dictation key watched in push mode; tap slots stay compositor-delivered, so the original double-trigger cannot come back. Verified on KDE Plasma Wayland (Fedora 44): tap unchanged, hold works again.

Fixes #864 #847

Changes

  • src/helpers/ipcHandlers.js: reject stored audio buffers smaller than MIN_AUDIO_BYTES in the retry-transcription handler instead of sending them to a backend
  • src/helpers/hotkeyManager.js: getNativeListenerKeys takes a compositorOwnsHotkeys flag and keeps only the push-to-talk dictation key when a compositor delivers hotkeys
  • src/helpers/windowManager.js: reconcileNativeKeyListeners passes isUsingNativeShortcut() instead of blanking all keys
  • test/helpers/recordingGuard.test.js: add a require() interop test for the main-process guard
  • test/helpers/nativeListenerKeys.test.js: add compositor carve-out cases

Supersedes #872.

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.

Audio file might be corrupted or unsupported

1 participant