fix: fall back to screenshot mode when any CDP call times out during calibration#567
Merged
miguel-heygen merged 1 commit intomainfrom Apr 29, 2026
Conversation
…calibration BeginFrame calibration uses a 30 s protocolTimeout to detect expensive compositions early. On Linux with chrome-headless-shell, compositions with many heavy videos (e.g. 7 videos with sparse keyframes) can cause Chrome to be unresponsive during BeginFrame-mode initialisation — not just during beginFrame calls themselves, but during any CDP call (Runtime.callFunctionOn / Runtime.evaluate). Previously shouldFallbackToScreenshotAfterCalibrationError only matched HeadlessExperimental.beginFrame errors, so a Runtime.callFunctionOn/evaluate timeout during calibration was treated as an opaque failure: the render stayed in BeginFrame mode, spawned 3 workers with a pessimistic cost multiplier of 8, and all 3 workers then also timed out during session initialisation (0 frames captured). Fix: extend the pattern to also match Runtime.callFunctionOn and Runtime.evaluate timeouts. This routes the render into single-worker screenshot mode — the same safe fallback already used for BeginFrame- specific timeouts — and the render completes successfully. Fixes #566
jrusso1020
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shouldFallbackToScreenshotAfterCalibrationErroronly matchedHeadlessExperimental.beginFrameerrors. When a composition with many heavy videos (e.g. 7 videos with sparse keyframes) caused Chrome to be unresponsive in BeginFrame mode during calibration, aRuntime.callFunctionOn timed outorRuntime.evaluate timed outerror was treated as an opaque failure — not a BeginFrame-mode signal. The render kept BeginFrame mode, spawned 3 workers withcaptureCostMultiplier=8, and all 3 workers also timed out initialising their sessions (0 frames captured, render fails).Runtime.callFunctionOn timed outandRuntime.evaluate timed outto the screenshot-fallback pattern. Any CDP call timing out during the short-timeout calibration probe now routes the render into single-worker screenshot mode — the safe fallback already used for explicit BeginFrame timeouts.Test plan
falls back to screenshot mode after Runtime.callFunctionOn timeout during calibration— asserts bothRuntime.callFunctionOn timed outandRuntime.evaluate timed outreturntruecapture calibration safeguardsunit tests still passFixes #566