Fix CSP for blob URLs + fix pyannote AudioDecoder with torchaudio patch
All checks were successful
Build Sidecars / Bump sidecar version and tag (push) Successful in 4s
Release / Bump version and tag (push) Successful in 3s
Build Sidecars / Build Sidecar (macOS) (push) Successful in 3m25s
Release / Build App (macOS) (push) Successful in 1m26s
Build Sidecars / Build Sidecar (Linux) (push) Successful in 14m31s
Release / Build App (Linux) (push) Successful in 3m50s
Build Sidecars / Build Sidecar (Windows) (push) Successful in 27m7s
Release / Build App (Windows) (push) Successful in 3m26s

CSP: Add blob: to connect-src/img-src/media-src for wavesurfer.js audio
playback. Add http://tauri.localhost to default-src for devtools.

pyannote: sys.modules block didn't work — pyannote still uses AudioDecoder
unconditionally. New approach: monkey-patch Audio.__call__ in diarize.py
to use torchaudio.load() directly, bypassing the broken torchcodec path.
Patch runs once before pipeline loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-22 10:59:52 -07:00
parent 31044b9ad2
commit 2e7a5819bc
3 changed files with 32 additions and 7 deletions

View File

@@ -5,12 +5,6 @@ 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.