Repository navigation
fix(browser): stop cancelled downloads from publishing files - #128651
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 7:48 AM ET / 11:48 UTC. ClawSweeper reviewWhat this changesThe PR makes browser-download capture cancel Chromium transfers during validation or staging while preserving the true result once atomic publication has begun. Regression provenancePossible regression — probable (reviewed change; reproduction). No predecessor PR is attributed. Merge readinessNo blocking patch defect found. This maintainer-owned PR has credible real-browser proof and a coherent shared-owner repair, but its intentional cancellation-semantic change and exact-head CI remain maintainer merge gates. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe browser plugin receives Playwright download events, validates and stages files beneath a managed output root, then returns a saved-artifact result to browser tools. A request cancellation can arrive while that capture flow is validating or writing. flowchart LR
A[Browser tool request] --> B[Playwright download event]
B --> C[Download capture owner]
C --> D[Validate URL and output]
D --> E[Stage file safely]
E --> F[Atomically publish artifact]
C --> G[Cancellation signal]
G --> H[Cancel native download]
Decision needed
Why: The PR is maintainer-owned and protected, and it intentionally changes the user-visible result of cancellation after a download event. Before merge
Agent review detailsSecurityNone. PR surfaceSource +15, Tests +265, Other 0. Total +280 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep cancellation and publication ownership in the shared capture flow, with exact-head CI confirming the real Chromium and atomic-write regressions before merge. Do we have a high-confidence way to reproduce the issue? Yes: the shared capture flow previously had no native cancellation path or abort checks around asynchronous validation and staged saving; the PR also supplies real Chromium/CDP proof. Is this the best way to solve the issue? Yes: the shared capture owner serves both explicit callers, while the existing atomic writer remains the sole publication authority; no duplicate caller-side policy was introduced. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0d840c0fce11. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
Merged via squash.
|
…w#128651) * fix(browser): cancel in-flight downloads before atomic publication * fix(browser): type download capture event and deferred fixtures * fix(browser): ratchet down obsolete download capture assertions
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where users cancelling a browser download would still receive a
completed file, or see the operation remain pending, when cancellation happened
after Chromium started the download but before the file was safely published.
Why This Change Was Made
The download owner now keeps cancellation alive through URL validation and the
Playwright transfer, cancels the native Chromium download, and checks the
request before and after writing staged bytes. Once the safe atomic writer has
entered its irreversible publication phase, cancellation no longer misreports a
successful download as aborted: the owner waits for the authoritative result.
The existing duplicate waiter-depth flag was removed; the registered download
listener now owns that lifecycle directly. Output-root validation, SSRF policy,
passive navigation capture, and public APIs remain unchanged.
User Impact
Cancelled in-flight downloads stop promptly without leaving a partial or final
file. Downloads that have already crossed the atomic publication boundary
finish successfully and return the real saved artifact instead of reporting a
false cancellation.
Evidence
main: cancellationduring asynchronous pre-save validation and during an in-progress staged file
transfer both failed to invoke native Chromium cancellation.
actual Chromium, and a Chrome DevTools Protocol connection; the added
Chromium regression failed on unchanged
mainand passes after the fix.actual safe writer at
fs.rename: the original candidate incorrectlyreported cancellation before publishing a final artifact. The regression
now stays pending until publication completes and reports the real success.
suites: 5 suites, 71 tests passing, including both actual Chromium/CDP
scenarios.
including output-root containment, hardlink/symlink guards, URL policy,
passive capture, and successor waiters.
delta: 26 additions, 15 deletions; net +11 lines.