Repository navigation
fix(browser): fix the downloads live test flake at its three causes - #959
Merged
Merged
Conversation
…<a download> Chrome reloads the page 1.46 to 1.70 seconds after an <a download> begins (Chromium 155), and the reload aborts a navigation started before it. The 1.5-second hold sat inside that spread: the next navigate failed with net::ERR_ABORTED 2 times in 40. The hold is now 2.5 seconds. The live test also stopped polling at the first read naming a download, which can still be in progress (seen on Windows). The contract is that a read names a running download and the next one says when it ends, so the test now polls until the download is no longer in progress.
Downloads are allowed for the whole browser, so the optimization guide's model downloads, which run with no page and announce no download event, landed in the user's Downloads as files named by a GUID and were never renamed. The Windows and macOS CI runners left 4 KB to 33 MB of them next to the six files the live test expects. Chrome now starts with those features off.
omartelo
force-pushed
the
fix/browser-downloads-flake
branch
from
October 28, 2026 01:01
5a7cd26 to
ffde639
Compare
omartelo
marked this pull request as ready for review
October 28, 2026 01:01
omartelo
added a commit
that referenced
this pull request
Oct 28, 2026
Browser.setDownloadBehavior is browser-wide, so files Chrome downloads on its own, with no page and no download event, landed in the user's Downloads under a GUID and were never renamed (macOS and Windows runners, after #959 switched the optimization guide's model downloads off). Chrome now writes into a staging folder inside the session's ephemeral profile. Only a download a page announced moves to Downloads, under its reserved name; anything else stays in staging and is deleted with the profile. Across filesystems or volumes the move falls back to a copy under a hidden .part name, renamed once whole, reusing profilestore's copy helper and cross-device seam, now exported.
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.
Fixes the flaky
TestChromeDownloadsLandInDownloadsAndThePageStays, which failed on main (run 40584150744, macOS) and on #955. Three failures, three causes.Linux:
page load error net::ERR_ABORTEDinattachmentChrome reloads the page 1.46 to 1.70 seconds after an
<a download>begins (24 samples, Chromium 155), and that reload aborts a navigation started before it. The answer was held 1.5 seconds after the download began, inside that spread, so the nextbrowser_navigatesometimes lost the race. Product fix:downloadQuietis now 2.5 seconds. The same race hit an agent's real next step, not only the test.macOS and Windows: GUID-named files left in Downloads
Traced on the Windows runner: the extra files (4 KB to 33 MB) never had a
Browser.downloadWillBeginordownloadProgressevent.Browser.setDownloadBehaviorapplies to the whole browser, so Chrome's own background downloads (the optimization guide's models, which go through the profile's download manager with no page) were saved into the Downloads folder under their GUID and never renamed. In production that is the user's real~/Downloads. Product fix: Chrome starts withOptimizationGuideModelDownloadingandOptimizationTargetPredictiondisabled, on top of chromedp's owndisable-featureslist.docs/ceilings.mdnames the remaining trap: a background download a later Chrome adds would land the same way.Windows:
blank.csv ... State:inProgressTest change, because the test asserted something the contract never promised. For a
target=_blankdownload the click answers before the new tab hands over its URL, so the test polls page reads. A read names a download still running and the next read says when it ends (docs/browser-tab.md), but the loop stopped at the first read that named one. It now keeps polling until that download is no longer in progress. The assertions are unchanged: exactly one download, at the expected path, completed, with the expected contents.Test plan
go test -count=20 -run TestChromeDownloadsLandfailed 1/20, and theattr+attachmentpair failed 2/40 withERR_ABORTED.attr+attachment, and 0/20 for the downloads live tests on the final commit.gofmt -l .,go vet ./...andgo test ./...are clean.