fix(browser): set DISPLAY fallback for non-headless Chrome on Linux/WSL2#64547
fix(browser): set DISPLAY fallback for non-headless Chrome on Linux/WSL2#64547Yanhu007 wants to merge 2 commits into
Conversation
The reply media path normalizer blocked absolute paths from the managed OpenClaw temp directory (/tmp/openclaw/), causing TTS-generated audio files to be silently dropped. This resulted in no reply being delivered and a 60s typing indicator timeout. The media loading allowlist (buildMediaLocalRoots) already includes the preferredTmpDir, but the reply security check (isAllowedAbsoluteReplyMediaPath) did not. Add the same check so the two allowlists are consistent. Wraps resolvePreferredOpenClawTmpDir() in try/catch to gracefully degrade in exotic environments where tmp dir resolution fails. Fixes openclaw#64529
On WSL2, the DISPLAY environment variable is often not set by default. When launching Chrome in non-headless mode, this causes the X11/Ozone platform to fail with 'Missing X server or $DISPLAY'. Fall back to DISPLAY=:0 (the standard X11 default) when the env var is unset, the platform is Linux, and headless mode is disabled. This matches the default for most X11/Xwayland/WSLg setups. Fixes openclaw#64464
Greptile SummaryThis PR fixes non-headless Chrome failing to start on Linux/WSL2 by injecting a Confidence Score: 5/5Safe to merge — both changes are narrow, well-guarded, and address real runtime failures with no regressions in other environments. The DISPLAY fallback is correctly scoped (Linux + non-headless + DISPLAY unset), evaluated at spawn time, and the spread order ensures existing values win. The reply-media-paths addition is wrapped in a try-catch so exotic environments fall through safely. No P0/P1 issues found. No files require special attention. Reviews (1): Last reviewed commit: "fix(browser): set DISPLAY fallback for n..." | Re-trigger Greptile |
|
Closing to rotate in newer fix. Will resubmit if needed. |
Summary
Fixes #64464 — Non-headless Chrome on WSL2 fails with
Missing X server or $DISPLAYbecause the environment variable is unset.Root Cause
WSL2 (especially with WSLg) often doesn't export
DISPLAYto all shell contexts. The Chrome spawn inlaunchOpenClawChrome()passesprocess.env, which lacksDISPLAY. Chrome's X11/Ozone platform then fails:Fix
When all three conditions are met, fall back to
DISPLAY=:0:process.env.DISPLAYis unset:0is the standard default for X11/Xwayland/WSLg displays. If the user hasDISPLAYset, their value takes precedence (...process.envspread comes first).No-op for other environments