← Back to PRs

#8282: Fix: Enable browser downloads via CDP Browser.setDownloadBehavior

by vishaltandale00 open 2026-02-03 21:06 View on GitHub →
stale
Fixes #8268 The OpenClaw browser profile couldn't download files because the required CDP command Browser.setDownloadBehavior was never called during browser launch. Changes: - Added resolveDownloadPath() to determine the user's Downloads folder (supports macOS, Windows, and Linux with XDG_DOWNLOAD_DIR) - Added CDP call to Browser.setDownloadBehavior after Chrome is ready - Downloads are now enabled with behavior: "allow" and eventsEnabled: true - Added error handling with log warnings if CDP call fails The fix automatically configures downloads to the user's default Downloads folder on browser launch, eliminating the need for manual CDP commands. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR enables file downloads for the OpenClaw-managed Chrome profile by issuing the CDP `Browser.setDownloadBehavior` command after launch. It adds a helper to pick a default downloads directory and wires in a one-time CDP WebSocket call once the browser’s CDP endpoint is reachable. Overall this fits cleanly into the existing CDP readiness/launch flow in `src/browser/chrome.ts`, reusing the repo’s CDP helpers (`withCdpSocket`) rather than introducing new protocol plumbing. <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge; main risk is edge-case failures in download directory resolution/creation that can keep downloads broken on some systems. - Change is localized to browser launch and uses existing CDP socket helper; however the Linux XDG download path value may need expansion and the target directory isn’t ensured to exist before calling CDP, both of which can cause the feature to silently fail in real environments. - src/browser/chrome.ts <!-- greptile_other_comments_section --> <sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs