Repository navigation
fix(downloads): fire complete callbacks for remote-browser downloads - #5264
Merged
MagMueller merged 3 commits intoAug 2, 2026
Merged
MagMueller merged 3 commits into
MagMueller merged 3 commits into
Conversation
sergioperezcheco
force-pushed
the
fix/remote-download-complete-callback
branch
3 times, most recently
from
July 26, 2026 06:34
acb21a1 to
a3e1507
Compare
On a remote browser, the downloadProgress(completed) handler only dispatched FileDownloadedEvent on the event bus and never invoked the registered _download_complete_callbacks. The local branch does this inside _track_download(), so DefaultActionWatchdog._execute_click_with_download_detection waited on its on_download_complete asyncio.Event until the 30s timeout even though the download had finished. Call the complete callbacks (with the same complete_info shape _track_download uses) right before dispatching the event in the remote branch. Adds a regression test that drives the registered downloadProgress handler and asserts the callback fires; the test fails on the unpatched code.
Fix code-style CI failure (model_construct call fits on one line).
sergioperezcheco
force-pushed
the
fix/remote-download-complete-callback
branch
from
July 28, 2026 01:12
a3e1507 to
26b9457
Compare
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.
When a file download finishes on a remote browser, DownloadsWatchdog receives the CDP downloadProgress event with state == "completed", but the remote branch of that handler only dispatched FileDownloadedEvent on the event bus. It never invoked the registered _download_complete_callbacks.
The local-browser branch calls those callbacks inside _track_download(), which is exactly what DefaultActionWatchdog._execute_click_with_download_detection waits on: its on_download_complete sets an asyncio.Event the click action is awaiting. So for remote browsers the click that triggered a download blocked until download_complete_timeout (30s by default) even though the file was already on disk, as reported in #5132.
This adds the complete-callback invocation to the remote branch, using the same complete_info shape _track_download already uses (guid, url, path, file_name, file_size, file_type, auto_download), placed right before the FileDownloadedEvent dispatch.
I included a regression test (tests/ci/test_remote_download_complete_callback.py) that registers a fake CDP client via attach_to_target, drives the captured downloadProgress(completed) handler, and asserts the on_complete callback fires with the expected filename. The test fails on the unpatched code and passes with this change.
I could not run the full repo test suite locally because dependency resolution needs network access that is unavailable in this environment, but the new test passes against an isolated venv and ruff is clean on both touched files.
Refs #5132.
Summary by cubic
Fixes remote-browser downloads not firing completion callbacks. Callbacks now run when CDP
downloadProgressreportscompleted, so actions waiting on downloads no longer time out.Bug Fixes
_download_complete_callbacksin the remote path beforeFileDownloadedEventwith the same payload as local; log callback errors at debug level.tests/ci/test_remote_download_complete_callback.py) that drive the CDP handler, assert the callback fires, and confirm the CDP cache is cleared.Refactors
ruffformatting to the new test file.Written for commit 8168483. Summary will update on new commits.