Repository navigation
test(browser): give the stalled download cancel test a hang guard that fits a busy runner - #484
Merged
itsskofficial merged 1 commit intoOct 21, 2026
Conversation
…t fits a busy runner
ShryukGrandhi
requested review from
Kabeer2004 and
itsskofficial
as code owners
October 20, 2026 08:37
5 tasks done
itsskofficial
approved these changes
Oct 21, 2026
itsskofficial
left a comment
Contributor
There was a problem hiding this comment.
Thanks @ShryukGrandhi! The comment explaining that the 0.01 s limits are what's under test is a nice touch, and a cancel that never ends still fails the test. I ran it 50 times quiet, 140 times next to the full suite and 64 times at 16 at once, all green. Approving and merging.
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.
What and why
test_stalled_download_cancel_is_bounded_and_partial_file_is_removedfailed once on Windows CI withTimeoutError. The test setsDOWNLOAD_MAX_DURATION_SandDOWNLOAD_CANCEL_TIMEOUT_Sto 0.01 s, which are the limits it actually checks, but wrapped the whole save, cancel attempt and partial-file removal in a 0.5 sasyncio.wait_for. On a loaded runner with-n autothe event loop can stall for longer than that, so the outer guard fired before_save_downloadraised the expectedBrowserError.The outer guard is only there to stop the test hanging if the cancel bound breaks, so it is now 10 s. The inner 0.01 s limits and the asserted error message are unchanged, so a cancel that is not bounded still fails the test (it would hit the guard and raise
TimeoutErrorinstead ofBrowserError). The@pytest.mark.flaky(reruns=2)marker is removed, as docs/DEVELOPING.md asks for in the same PR as the fix.Fixes #421
How I tested it
save_asblocks the event loop for 0.6 s (standing in for a busy runner): with the 0.5 s guard it fails with the sameTimeoutErroras CI, and with the 10 s guard it passes and still gets the expectedBrowserError("Browser cancellation failed: timed out after 0.01 seconds").pytest -q tests/browser/test_profiles.py: 73 passedpytest -q -n auto tests/browser: 137 passedruff check sentient tests packaging: cleanReal test
Test-only change, no engine or model involved. Checked on macOS (arm64); I have no Windows runner, so the proof there is CI not needing a rerun for this test.
Checklist
pytest/npm run typecheckpass locally for what I touchedruff check sentient testsis cleandocs/API.mdupdated if the desktop ↔ engine contract changed (not changed)changes/if users will notice this change (test-only, users won't notice)Summary by CodeRabbit