Fix CSP blocking IPC/assets + fix pyannote AudioDecoder crash
All checks were successful
Build Sidecars / Bump sidecar version and tag (push) Successful in 9s
Release / Bump version and tag (push) Successful in 5s
Build Sidecars / Build Sidecar (macOS) (push) Successful in 3m37s
Release / Build App (macOS) (push) Successful in 1m16s
Build Sidecars / Build Sidecar (Linux) (push) Successful in 14m3s
Release / Build App (Linux) (push) Successful in 4m45s
Build Sidecars / Build Sidecar (Windows) (push) Successful in 24m32s
Release / Build App (Windows) (push) Successful in 3m12s

CSP: Add connect-src for ipc.localhost and asset.localhost so Tauri IPC
commands and local file loading (waveform, audio playback) work.

pyannote: Block torchcodec in sys.modules at startup so pyannote.audio
falls back to torchaudio for audio decoding. pyannote has a bug where
it uses AudioDecoder unconditionally even when torchcodec import fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-22 09:54:19 -07:00
parent 4160202ad7
commit db770c341d
2 changed files with 8 additions and 1 deletions

View File

@@ -5,6 +5,13 @@ from __future__ import annotations
import signal
import sys
# Block torchcodec before anything imports it. pyannote.audio has a bug where
# it conditionally imports AudioDecoder from torchcodec but uses it
# unconditionally. Making torchcodec fully unimportable forces the torchaudio
# fallback path.
sys.modules["torchcodec"] = None # type: ignore[assignment]
sys.modules["torchcodec.decoders"] = None # type: ignore[assignment]
# CRITICAL: Capture real stdout for IPC *before* importing any ML libraries
# that might print to stdout and corrupt the JSON-line protocol.
from voice_to_notes.ipc.protocol import init_ipc