fix: add DOM renderer fallback for Windows compatibility#722
Open
djdarcy wants to merge 2 commits intocharmbracelet:mainfrom
Open
fix: add DOM renderer fallback for Windows compatibility#722djdarcy wants to merge 2 commits intocharmbracelet:mainfrom
djdarcy wants to merge 2 commits intocharmbracelet:mainfrom
Conversation
The canvas renderer fails in headless Chrome on Windows when WebGL is unavailable (RDP sessions, headless environments, CI). This causes CanvasToImage() calls to return empty frames. Changes: - Switch default renderer from canvas to DOM (tty.go) - Add SwiftShader/ANGLE browser flags for WebGL fallback (vhs.go) - Probe for canvas.xterm-text-layer with timeout; fall back to .xterm-screen element screenshot when canvas is absent (vhs.go) - Use temporary timeout page for probe to avoid context deadline errors on stored elements (vhs.go) - Add diagnostic logging throughout startup, setup, and recording pipeline (evaluator.go, vhs.go) The debug-instrumented version is preserved in this commit for reference. A follow-up commit strips the diagnostic logging. Related: charmbracelet#631 Depends on: tsl0922/ttyd#1501 (ConPTY fix for Windows 11)
Remove verbose debug output from evaluator, browser launch, setup, and recording pipeline. Functional changes preserved: DOM renderer fallback, SwiftShader browser flags, timeout-based canvas probe. The debug-instrumented version is preserved in the previous commit for reference.
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.
CONTRIBUTING.md.I have created a discussion that was approved by a maintainer (for new features).(not applicable)Fixes #721. Related: #631, tsl0922/ttyd#1501, tsl0922/ttyd#1502.
VHS on Windows produces blank frames because the canvas renderer fails in headless Chrome when WebGL is unavailable. This is compounded by a ConPTY bug in ttyd's MinGW build on Windows 11 25H2 (tracked separately in tsl0922/ttyd#1501).
Changes
tty.go:
canvastodomvhs.go:
use-gl=angle,use-angle=swiftshader,enable-webgl) as WebGL fallbackcanvas.xterm-text-layerwith a 5-second timeout, fall back to.xterm-screenelement screenshotttyd dependency
The bundled
ttyd.win32.exe(MinGW cross-compiled) fails on Windows 11 25H2 withCreateProcessWerror 123. An MSVC-built ttyd resolves this. See:Notes
Happy to adjust the approach. The DOM renderer fallback could be made configurable via environment variable if preferred, and the SwiftShader flags could be opt-in rather than default.
Tested on Windows 11 Pro 25H2 (build 26200.8037) with MSVC-built ttyd, Chrome 134.