Skip to content

fix(downloads): respect BrowserProfile.accept_downloads - #6067

Open
marcardenas wants to merge 2 commits into
browser-use:mainfrom
marcardenas:fix/6065-respect-accept-downloads
Open

marcardenas wants to merge 2 commits into
browser-use:mainfrom
marcardenas:fix/6065-respect-accept-downloads

Conversation

@marcardenas

@marcardenas marcardenas commented Oct 14, 2026 •

Copy link
Copy Markdown

Fixes #6065

Problem

BrowserProfile.accept_downloads is never read. The downloads watchdog always calls Browser.setDownloadBehavior with behavior: 'allow', and PDF/network auto-download runs regardless, so accept_downloads=False still saves files.

Change

In DownloadsWatchdog:

  • when accept_downloads=False, attach_to_target sets Browser.setDownloadBehavior to deny (once per browser session) instead of allow, and skips the download listeners;
  • _is_auto_download_enabled() now requires both accept_downloads and auto_download_pdfs, so PDF viewer auto-download and network-response downloads can't bypass the setting.

Default behavior (accept_downloads=True) is unchanged.

Tests

  • New tests/ci/browser/test_accept_downloads.py: launches a real headless Chromium against a local pytest-httpserver and checks the downloads directory:
    • attachment (Content-Disposition: attachment) is saved with accept_downloads=True;
    • attachment is not saved with accept_downloads=False (fails on main, passes with this change);
    • PDF is not auto-downloaded with accept_downloads=False (fails on main, passes with this change).
  • tests/ci/test_remote_download_complete_callback.py: the SimpleNamespace profile stub now carries accept_downloads=True (the real default), since the watchdog reads it.
  • Ran tests/ci/test_downloads_watchdog.py, test_agent_download_paths.py, test_remote_download_complete_callback.py, browser/test_session_start.py, and the new file: 22 passed. ruff check, ruff format --check and pyright clean on the touched files.

Note on #5991

I found #5991 after implementing this; it addresses the same root cause with unit-level tests. This PR differs mainly in the end-to-end Chromium regression test. Happy to close this in favor of #5991, or to move the integration test over there, whichever the maintainers prefer.

AI assistance: prepared with Claude Code; I reviewed the diff and ran the tests above.

🤖 Generated with Claude Code


Summary by cubic

Fixes #6065. BrowserProfile.accept_downloads was never read, so files were always saved even when downloads were disabled. Now, with accept_downloads=False, the browser refuses downloads and PDF auto-download no longer bypasses the setting. Default behavior (accept_downloads=True) is unchanged.

Bug Fixes

  • The downloads watchdog sends Browser.setDownloadBehavior with deny per browser session, before any downloads_path check, so a profile without a path can't fall back to the browser default.
  • PDF auto-download now requires both accept_downloads and auto_download_pdfs.
  • New end-to-end tests confirm attachments are saved and PDFs auto-download with accept_downloads=True, and that neither is saved when downloads are disabled.

Written for commit 2dc81de. Summary will update on new commits.

View guided diff

…6065)

The downloads watchdog always set Browser.setDownloadBehavior to 'allow'
and auto-downloaded PDFs, so accept_downloads=False had no effect.
When downloads are disabled, set the behavior to 'deny' and skip PDF
auto-download and network download monitoring.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@CLAassistant

CLAassistant commented Oct 14, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply to a comment to ask cubic a question or push back. It learns from your replies.
Click Fix with cubic on a comment, or reply @cubic-dev-ai fix this, and cubic writes the fix.

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Browser parameter accept_downloads is nonfunctional when running Browser-use locally

2 participants