Repository navigation
fix(browser): honor accept_downloads=False for CDP and fetch downloads - #6195
Open
ninglinLiu wants to merge 5 commits into
Open
ninglinLiu wants to merge 5 commits into
ninglinLiu wants to merge 5 commits into
Conversation
Browser.setDownloadBehavior always used behavior=allow, so accept_downloads=False had no effect for local CDP sessions. Deny downloads when the flag is false, gate network auto-fetch the same way, and add regression tests. Fixes browser-use#6065
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
…load test Keep an explicit AsyncMock for setDownloadBehavior so pyright sees assert_awaited/await_args, collapse the ruff-format one-liner, and set accept_downloads=True on the remote-download SimpleNamespace profile so attach_to_target still reaches the progress-handler path.
Returning None is also the fetch-failure path. Require that get_or_create_cdp_session was not awaited so the regression covers the early return. Co-authored-by: NingLin Liu <[email protected]>
Narrow await_args None checks and isinstance(AsyncMock) so code-style/type-checker pass on the strengthened CDP-skip assert.
This was referenced Oct 26, 2026
This branch has not been deployed
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
BrowserProfile.accept_downloadswas documented and plumbed through session/beta APIs, butDownloadsWatchdog.attach_to_targetalways called CDPBrowser.setDownloadBehaviorwithbehavior: 'allow'. Settingaccept_downloads=Falsetherefore still accepted downloads for local CDP sessions.Changes
denywhenaccept_downloadsis false (keepallowas the default).accept_downloads=Falseas disabling network auto-fetch (_is_auto_download_enabledanddownload_file_from_url).Test plan
uv run pytest tests/ci/test_accept_downloads_false.py -q -o addopts='' --noconftest(4 passed)Fixes #6065
Summary by cubic
Fixes
BrowserProfile.accept_downloads=Falsehaving no effect: CDPBrowser.setDownloadBehavioralways passedbehavior: 'allow', so local sessions still accepted downloads despite the flag. It now passes'deny'when the flag is false and disables network auto-fetch anddownload_file_from_urlthe same way.Written for commit 8f68af8. Summary will update on new commits.