Skip to content

v1.2.2

Choose a tag to compare

@github-actions github-actions released this 28 Aug 16:54
· 10 commits to main since this release

Release v1.2.2 - WhisperX Process Isolation, CUDA/OpenVINO Conflict Fix, and a Real-Backend E2E Test Layer

This release isolates WhisperX into its own subprocess to resolve a hard dependency-version conflict, fixes a real CUDA/OpenVINO mixed-context crash/hang on Intel iGPU hardware, closes the one remaining gap in dashboard JS test coverage, and adds a second, real-backend Playwright test layer that runs the dashboard, analytics, /docs, and the Bazarr/OpenAI-compatible API against the actual FastAPI app instead of a mock. That real-backend layer surfaced two genuine, previously-undetected bugs, both fixed here.


Highlights

WhisperX Process Isolation (Architecture Change)

  • whisperx is no longer imported in the main service process. WhisperX 3.8.6 hard-pins a torch/torchaudio/torchvision/huggingface-hub stack incompatible with the rest of the application's dependency versions, and that stack cannot be safely reloaded inside one live interpreter.
  • New modules/inference/engines/whisperx_worker.py (child-process entrypoint, spawned via multiprocessing.get_context("spawn") against an isolated install at WHISPERX_LIB_PATH; app __main__ and package inits are spawn-safe so the child does not import the main torch stack before isolation) and whisperx_worker_client.py (parent-side, lock-serialized client that lazily owns the worker; RPC deadline disabled by default via WHISPERX_WORKER_CALL_TIMEOUT_SEC=0) replace direct in-process whisperx.* calls in whisperx_engine.py and diarization.py.
  • ALIGN_POOL/DIARIZE_POOL still track per-hardware-unit handles in the main process; the underlying models now live in the worker. Idle cleanup and unload_models() shut down and respawn the worker to actually reclaim VRAM/RAM, rather than dropping in-process references. A WhisperXWorkerError falls back to unlabeled segments instead of failing the whole transcription.
  • whisperx has been removed from pyproject.toml entirely; it's installed only inside the Dockerfile's isolated /app/libs/whisperx stage.

Bug Fixes

  • CUDA + OpenVINO mixed-context crash/hang on Intel iGPU. Eager per-unit preprocessing-manager construction could poison the CUDA-capable onnxruntime module by initializing an OpenVINO execution provider in the same process. modules/core/config.py now forces PREPROCESS_DEVICE to CUDA whenever DEVICE == "CUDA" and preprocessing would otherwise resolve to GPU/NPU/Intel/OpenVINO; modules/inference/pipeline/preprocessing/__init__.py and provider.py add matching guards (_ensure_openvino_onnxruntime skipped outright on CUDA, on-disk OpenVINO cache dropped for GPU/NPU providers, plus a last-resort _block_openvino_alongside_cuda redirect) so no code path can still trigger the conflict.
  • torch/torchvision import race on startup. UVR's per-request onnxruntime module reload could interleave with torchvision's first import from a request-handling thread, intermittently producing operator torchvision::nms does not exist errors. whisper_pro_asr.py now imports torch/torchvision once, single-threaded, during app startup (_warm_up_torch_stack()) before any request thread can race it.
  • response_format=text / response_format=verbose_json silently downgraded to SRT. The OpenAI-compatible /v1/audio/transcriptions and /v1/audio/translations endpoints only recognized {json, vtt, txt, tsv, srt} for output/response_format; a spec-following client requesting the documented text or verbose_json values got SRT-formatted output instead. modules/api/routes/asr.py now aliases text → txt and verbose_json → json.
  • prompt silently dropped on the OpenAI-compatible endpoints. The official OpenAI SDKs (and any spec-following client) send prompt; the route only ever read initial_prompt, so a caller's prompt was accepted with a 200 and then ignored. prompt is now accepted as an alias, with initial_prompt still taking precedence when both are sent.

Test Coverage — Dashboard JS, Bazarr/OpenAI Contract Research, and a Real-Backend E2E Layer

  • Closed the last dashboard JS coverage gap: modules/monitoring/templates/dashboard/features/audit.js (caller-info panel rendering, JSON normalization, media-path stripping) and features/runtime.js (the updateStats() polling loop: top stats, telemetry buffering, hardware-pool rendering and kind inference) previously had zero unit or e2e coverage. Added tests/js/dashboard_audit.test.js (23 tests) and tests/js/dashboard_runtime.test.js (29 tests).
  • Bazarr wire-format audit against Bazarr's actual source. Read morpheus65535/bazarr's real provider (subliminal_patch/providers/whisperai.py) directly rather than assuming from this repo's own prior test naming. Finding: real Bazarr never sends local_path — it always uploads pre-encoded raw s16le/16kHz/mono PCM as a multipart audio_file, with encode=false, task, language, output=srt, and an optional video_file (caller metadata only). This repo's local_path tests cover a real, intentional optimization this codebase separately supports, but were previously the de facto stand-in for "how Bazarr talks to us" — now re-labeled, and a new TestRealBazarrWireFormat class in tests/integration/test_bazarr_wire_format.py covers the actual multipart/raw-PCM contract.
  • OpenAI /v1/audio/* contract audit against OpenAI's documented API reference. Cross-checked every documented request field (file, model, language, prompt, response_format and all 5 spec values, temperature, timestamp_granularities[], stream) against the route implementation; the two real bugs above were found this way, along with the path-based task-inference logic (/v1/audio/translations forcing task=translate regardless of an explicit task param). ~30 new integration tests added covering the full parameter matrix, alias equivalence across /asr//v1/audio/transcriptions//v1/audio/translations, file vs audio_file field-name precedence, and a local_path access-control/path-traversal test.
  • New real-backend Playwright layer (tests/e2e/real/, npm run test:e2e:real): boots the actual FastAPI app (tests/e2e/real_backend/serve_real_app.py) with only ASR inference and language-detection voting patched to deterministic fakes — routing, history_manager, telemetry_manager, settings persistence, and the auth/admin-key middleware all run for real. 18 tests cover the full task lifecycle (a real /v1/audio/transcriptions submission through active-tasks → history → analytics), the Bazarr multipart wire format, settings persistence, auth (missing/wrong/correct admin key), the /docs Swagger UI (previously only string-asserted at the backend level, never loaded in a browser), and responsive/dark-theme rendering at the dashboard's real CSS breakpoints (768px/600px/480px), none of which any prior e2e spec exercised.
  • This real-backend layer is what surfaced the two response-format/prompt bugs above — bugs invisible to the existing fixture-mock e2e suite, which mocks the backend round trip rather than validating it.
  • Dashboard settings tab rehydrates from the backend on open. Opening Settings calls loadRetentionSettings() which GETs /system/settings and applies TELEMETRY_RETENTION_HOURS / LOG_RETENTION_DAYS to the sliders (and labels). Real-backend e2e asserts the values survive a full-page reload.

Design Gaps Flagged for Follow-Up (Not Implemented This Release)

  • npm run quality:frontend runs the fixture-mock Playwright project but not the new real-backend one; real-backend E2E must run through the Docker test image pipeline (Dockerfile.test target test, or scripts/ci/build-and-test.sh / scripts/ci/build-and-test.ps1, which invoke tests/run_suite.sh with optional SKIP_REAL_E2E=1). Do not run host-side npm run test:e2e:real as a quality gate.

Documentation Accuracy

  • docs/API.md: documented the prompt→initial_prompt and response_format→output aliases (including the text/verbose_json value mappings) and the OpenAI SDK compatibility fields (model, temperature, timestamp_granularities[], stream) that are accepted-but-ignored.
  • docs/ARCHITECTURE.md: added the WhisperX process-isolation explanation to the diarization pipeline section and the two new worker files to the source-tree listing.
  • README.md: documented the new npm run test:e2e:real real-backend Playwright layer alongside the existing fixture-mock npm run test:e2e.
  • .agent/skills/quality/frontend_quality_gates_skill.md: added the real-backend Playwright gate and noted it isn't yet folded into the quality:frontend aggregate script.
  • Audited docs/SETUP.md and docs/DOCKERHUB_DESCRIPTION.md against every production-code change in this release. Found and fixed two real gaps during a follow-up review pass: docker-compose.yml's commented Windows/WSL2 Intel block was missing the pid: host/privileged: true/cap_add/sysfs mounts that docs/SETUP.md's telemetry note already claimed it documented (added them, matching the equivalent docker run flags already shown in SETUP.md); and the HOST_INTEL_RENDER_GID derivation comment (docker-compose.yml, docs/SETUP.md, docs/DOCKERHUB_DESCRIPTION.md) piped stat -c '%g' /dev/dri/renderD* — which can print multiple lines on multi-GPU hosts — into a scalar group_add entry; all three now derive a single GID (| head -n 1, matching the pattern the AMD section already used correctly).
  • docs/SETUP.md's Docker Hub quickstart command unconditionally required /dev/dri//dev/accel and stat-ed /dev/dri/renderD128 directly, which fails outright on NVIDIA/AMD/CPU-only hosts despite the Prerequisites section listing those as supported. Split into a CPU-only default command (works everywhere) and a separate Intel-hardware variant.

Dependency Changes

  • Main: fastapi 0.139.2→0.141.1, uvicorn 0.51.0→0.52.4.
  • ML group: torch 2.8.0→2.13.0, torchaudio 2.8.0→2.11.0, torchvision 0.23.0→0.28.0, transformers 4.48.3→5.15.1 (major), huggingface-hub 0.36.2→1.28.0 (major), tokenizers 0.21.4→0.22.2; NVIDIA CUDA runtime libs migrated cu12→cu13. librosa held at 0.11.0 and openvino held at 2026.2.1 deliberately (upgrading either regresses a dependency or the Intel iGPU GPU plugin, per in-repo comments); new explicit audioread pin since librosa no longer pulls it in transitively.
  • whisperx removed from pyproject.toml/poetry.lock — now installed only inside the Dockerfile's isolated worker stage, not the main dependency set.

Verification

Docker-parity full CI gate (scripts/ci/build-and-test.sh) — required (not optional) for this release given the ML dependency version bumps, and was run to completion in a follow-up pass:

  • Backend: pytest (with coverage) — 1342 passed, 0 failed. Coverage gate (tests/check_coverage.py, threshold 90%) — 96.21% total, every individual file at or above the 90% per-file floor.
  • Coverage badge regenerated (assets/coverage.svg).
  • Lint/format: Black, isort, Ruff (check + format), Flake8, Pylint — all clean, Pylint 10.00/10 (verified by exit code, not just the displayed score, after this pass also found and fixed several genuine bugs the gate itself doesn't check for — see below).
  • Complexity: Radon cyclomatic complexity, rank-A enforced repo-wide — zero violations.
  • Security/audit: Bandit, pip-audit, gitleaks, npm audit (low threshold), check-inline-ignores.py (zero-suppression policy) — zero findings.
  • Markdown/config/shell lint: markdownlint, yamllint (strict), shfmt, ShellCheck, Hadolint, PSScriptAnalyzer, actionlint, HTMLHint/html-validate — all clean.
  • Frontend: Vitest, fixture-mock Playwright, and the real-backend Playwright project all green inside the container.

Bugs found and fixed getting the Docker-parity gate green (none were caught by the native runs above, underscoring why the container gate is required, not optional, for a release touching this many dependency/runtime boundaries): a pre-existing 126-char docker-compose.yml comment line failing yamllint's strict mode before any test could run; Black-formatting drift in two test files; a Python-patch-version-specific inspect.getsource() fragility in a concurrency test helper (3.13.15 in the CI container vs. 3.13.13 used natively) — fixed by reading source directly from the file instead of via the loader; a mock.patch() silently clobbered by importlib.reload() in a settings-fallback test — fixed by mocking the lower-level primitives instead of the reloaded module's own redefined name; stale host __pycache__ directories leaking into the Docker build context despite .dockerignore; and 6 real cyclomatic-complexity violations (genuine refactors: extracted helper functions, not just complexity-suppression).