fix(linux): retry Lightning export with WebGL fallback when WebGPU render fails - #908
Conversation
…nder fails Lightning MP4 export on Linux crashes with 'Cannot read properties of undefined (reading _resourceType)' inside pixi.js WebGPURenderer (BindGroupSystem) during frame render. The WebCodecs software encoder path works; the crash is isolated to the WebGPU render stage (confirmed via minimal repro on Electron 43.1.0 / Chromium / AMD RADV). Keep WebGPU as the default render backend on Linux. When a WebGPU render-stage failure occurs during export, retry once from scratch with the WebGL renderer and report renderFallbackUsed in export metrics. RECORDLY_LINUX_RENDER_BACKEND=webgl|webgpu overrides the backend for validation; forced values disable the fallback. Also keeps smoke-export diagnostics visible in packaged builds (terser drop_console) via keepLog/keepError wrappers, and adds scripts/verify-smoke-build.mjs to guard against stale packaging. macOS/Windows are unchanged: policy returns undefined outside Linux and the fallback is gated to the linux runtime platform.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (16)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe PR adds Linux render-backend selection and WebGPU-to-WebGL export fallback. It preserves smoke-export diagnostics in production builds and adds a packaged-build marker verification script with Vitest coverage. ChangesLinux export and smoke verification
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk remains in the reviewed Linux fallback, diagnostics, and smoke-build verification changes. Sequence Diagram(s)sequenceDiagram
participant ModernVideoExporter
participant electronAPI
participant ModernFrameRenderer
ModernVideoExporter->>electronAPI: Read Linux backend environment
electronAPI-->>ModernVideoExporter: Return backend value or null
ModernVideoExporter->>ModernFrameRenderer: Initialize with resolved backend
ModernFrameRenderer-->>ModernVideoExporter: Report render failure
ModernVideoExporter->>ModernFrameRenderer: Retry once with WebGL
ModernFrameRenderer-->>ModernVideoExporter: Return export result and fallback metrics
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
Lightning (Beta) MP4 export fails on Linux with:
Reproduced on the official v1.4.0-beta.1 AppImage (Arch Linux, Hyprland/Wayland, Electron 43.1.0, AMD RADV). The string
_resourceTypeonly exists in pixi.js's WebGPU renderer (gpu/BindGroupSystem): the crash happens inside the WebGPU render stage, before any frame is encoded (frameCount: 0). The WebCodecs software encoder path works — confirmed with a minimal repro (clean Electron + pixi WebGPURenderer + per-frame texture swap) where canvas/WebGL pipelines encode successfully.Solution
renderFallbackUsedis reported in export metrics/report.RECORDLY_LINUX_RENDER_BACKEND=webgl|webgpuenv override for debugging/validation; a forced value disables the automatic fallback.drop_console) viakeepLog/keepErrorwrappers, andscripts/verify-smoke-build.mjsguards against stale packaging.Testing
renderBackend: webgl+renderFallbackUsed: true; forced env→no retry; max 1 retry). Full suite: 1103 tests passing, biome and tsc clean.success: true, 327 frames, valid playable MP4 (1080p30). Forcing webgl exports directly with no WebGPU attempt.undefinedoutside Linux, the fallback is gated to the linux runtime platform, and the new IPC (get-linux-render-backend-env) is additive and returnsnullelsewhere.Notes
BindGroupSystem._resourceTypeon first render) is an upstream issue; this PR makes the app resilient to it while it gets fixed upstream.Summary by CodeRabbit
New Features
Bug Fixes
Tests