Repository navigation
fix(browser): stop cancelled downloads from capturing later files - #124382
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready proof for exact head
Production LOC is +43/-15, net +28; tests are +342/-0. No schema, dependency, public API, path/security policy, changelog, or test-only production seam changed. Known proof gaps: none. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 11:37 PM ET / August 16, 2026, 03:37 UTC. ClawSweeper reviewWhat this changesThis PR propagates request cancellation through browser download operations so an aborted request releases its download capture before a later request starts. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for active maintainer review. Current main still leaves cancelled download captures armed; the branch binds cancellation to the capture owner and covers the race without a concrete patch defect found. Priority: P1 Review scores
Verification
How this fits togetherThe browser plugin sends agent download actions through an HTTP route to a Playwright-backed managed browser session. The route owns request cancellation, while the download capture owns its listener, timer, output file, and completion result. flowchart LR
A[Agent browser action] --> B[Browser tool client]
B --> C[Download HTTP route]
C --> D[Route cancellation lease]
D --> E[Playwright click or wait]
E --> F[Download capture owner]
F --> G[Managed download file]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +28, Tests +342. Total +370 across 9 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single route-lease-to-capture cancellation flow, then merge after exact-head CI completes without adding downstream listener guards or parallel cancellation paths. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main leaves the explicit capture armed after outer-request cancellation, and the added Chromium scenario exercises cancellation followed by a successor download. Is this the best way to solve the issue? Yes. Passing the existing request lease into the capture owner removes stale state at its producer rather than filtering a later download downstream. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a0498f7a9c8a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
ClawSweeper pre-merge notes resolved on reviewed head
No ClawSweeper finding or rank-up code change remains. The current review is fresh and covers this exact head, so no re-review request is needed. |
|
Merged via squash.
|
…enclaw#124382) * fix(browser): cancel abandoned download waits * fix(browser): cancel in-flight download clicks
Related: #124064
What Problem This Solves
Fixes an issue where cancelling a browser download request could leave its download listener and click running, allowing that abandoned request to capture or write a later download intended for a successor request.
Why This Change Was Made
The request's
AbortSignalnow follows the existing ownership chain from the browser tool HTTP call through the route lease into both the explicit capture owner and Playwright's click operation. Cancellation rejects with the caller's reason, releases the listener/timer/depth owner immediately, observes the capture rejection while the click is still pending, and prevents the cancelled operation from consuming a successor download.Playwright 1.62.1 source and types were checked directly: locator clicks accept
AbortSignal; its client sends protocol cancellation, preserves the caller cause on the resulting abort error, and removes the signal listener when the command settles. The separately landed #124064 closed-tab retirement path remains unchanged and composes with this request-owned cancellation path.Production LOC: +43/-15 (net +28) | Tests: +342/-0 (net +342)
The production growth carries one existing request signal across the tool/client/route boundary and adds cleanup at the capture owner. It adds no parallel resolver, compatibility path, test-only production seam, schema, dependency, public API, path-policy, or security-policy surface.
User Impact
Cancelled
waitfordownloadand click-to-download requests now stop promptly and cannot steal or overwrite later downloads. Successor requests, repeated same-name downloads, and downloads after a managed-profile restart continue to succeed with unique managed paths and no temporary-file residue.Evidence
Candidate head:
c1b92eb44e964863cc0262956459607eeec993a5Rebased local-main baseline:
4b8ca98a940a76ebb2263b1448d539f7b7377dd0; later local-main drift touched no browser files.tbx_01m0490v6q9dy4kcv3r9f059wh(run 31923780499).git diff --check: passed.No changelog edit: release generation owns
CHANGELOG.md.