Repository navigation
Abort failed runtime downloads after cleanup - #26269
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughWhen an error occurs during archive download, writing, or checksum verification, Priority: ➖ Normal Merge Risk: 🔵 Low · up to A failed download can still delay request retirement and staging cleanup if stream cancellation waits on the request, though the delay is bounded by the stall timeout. Merging carries limited risk; aborting before awaiting cancellation would make cleanup prompt. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
⚔️ Resolve merge conflicts 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4d0d06d7-78d5-418e-a917-e625dfdde105
📒 Files selected for processing (2)
src/main/ssh/pinned-runtime-materializer-node.test.tssrc/main/ssh/runtime-archive-download.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| ) | ||
| } | ||
| } catch (error) { | ||
| stall.abort() |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Abort the request before awaiting stream cancellation.
On an HTTP error, oversized response, or staging-open failure, this code awaits stream cancellation before it reaches stall.abort(). If cancellation waits for the request signal, the request and staging cleanup remain pending until the 120-second stall timer aborts the signal. Web Streams permits asynchronous cancellation. (nodejs.org) Abort the owned controller when the failure is known, before awaiting cancellation. Preserve the original error when cancellation rejects.
aaf01ba to
14f174e
Compare
…-download-failure-abort # Conflicts: # tests/e2e/relay-region-correction.unit.test.ts
ELI5
A failed runtime download can leave its network request running after setup has returned an error and removed its temporary files. Failed downloads now abort their own request immediately, releasing the native connection.
What Changed
Each failed archive download attempt selects its existing error before aborting its internal controller, then throws that same error. Selecting first preserves the stall error and retry classification added on main. Existing body cancellation, file close and staging cleanup still run. Successful downloads keep their existing signal and cache behavior; retry counts and 1/3/9-second delays are unchanged.
Why
Canceling the response body alone does not reliably retire Electron's native request. Aborting the controller that already owns this download closes that ownership gap without changing deadlines, redirects, proxy settings, size limits or checksum verification.
The actual public archive materializer and desktop HTTP client were exercised through Electron 43.7.5 against an owned native HTTPS server on macOS. The final replay uses the actual updated retry implementation. One HTTP 503 submission makes four attempts with the real default retry delays. All four original native requests remained open 5.5 seconds after the materializer returned, including after GC; the fix leaves none. Separate oversized-declaration and real staging-open-collision cohorts each left three original requests versus zero after the fix. Each stalled response sent only 1 KiB. Temporary directories were removed in both versions, and all 16 paired result/error/file/cache/extraction controls matched, including HTTP 404 refusal and recovery from 503 to a verified archive.
This affects cold or missing verified runtimes during SSH/WSL setup; warm caches skip downloads. Existing callers have a three-minute external deadline, so the original requests can eventually retire. This measures prompt cleanup after failure, not a permanent leak or a cause for the intermittent Codex typing pause.
Linked Issue
Performance audit; no existing issue linked.
Visual Proof
N/A
This changes native request ownership after a failed download. Renderer and setup error behavior are unchanged. The public native before/after resource check is described above.
Testing
The original broader SSH run recorded one unrelated macOS shell-fixture assertion alongside 4,063 passing tests. It was not rerun during this update. Native resource proof was macOS; live Windows/Linux request cleanup was not repeated locally. The optional standalone E2E typecheck has the same existing diagnostics as pinned main, with no new semantic error.
Review
Independent review of the production proposal and native provenance found no blocker. The small production change reuses the existing request owner and preserves the current-main error selection before aborting. No remote wire, execution-host authority, polling or cache policy changes; failed downloads never cancel their caller's controller.
Agent skill upstream boundary
Checklist