Repository navigation
fix(cli): a browser install goes on when Windows holds a file for a moment - #7194
Conversation
There was a problem hiding this comment.
Approve at b7bb8699. No blockers.
- Fails without the fix: The body names
manager.test.ts › retryWhileLocked. Without the helper those 6 tests can't import it and fail. The windows-latest run with a 3 s hold covers the wiring that the unit tests don't. - Move retry is safe:
moveStagedInstallIntoCacheonly getsretryWhileLockedwith the default no-oponRetry, so staging isn't cleared between move attempts. A failed rename leavesstaged.pathin place, so the next attempt has something to move. If the first rename (target → aside) is what's locked, for example because a running old Chrome holds the cache dir, it now fails after about 3.75 s of waits instead of at once. Same outcome as before, just later. - Install retry: Lock errors go to the outer loop, while stall and corrupt-archive errors are still handled inside it. Each lock retry clears staging and downloads again. That's acceptable for a short scanner hold, but see the nit below.
- macOS and Linux:
isLockedFileErrorreturns false off win32, so nothing changes there.
Nits (none block):
- Fallow audit is red because of this PR:
packages/cli/src/browser/manager.ts:758,isLockedFileErroris exported but never imported. Droppingexportshould clear it. It isn't a required check, but it will stay red on main. - On Windows, a genuine
EPERM/EACCES(for example, a cache dir the user can't write) is now tried 5 times, with a fresh download each time if it fails after the archive lands. That's worth a comment, or a separate attempt limit for the install step. - The
clearStagingcall inonRetrycan itself throwEBUSYafter its 3rmSyncretries. That ends the loop with the rm error rather than the install error. It's rare and still a clear message.
CI at this head when I reviewed: regression, Player perf and PR captures had passed, and Lint, Format and Test reachability in CI had passed. The CLI tests, Typecheck, Build and Windows render verification were still running.
Edit accuracy: accurate 267 (base branch 267), smooth 119 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (2)
|
There was a problem hiding this comment.
Approve at bb1777e0. This re-reviews my approval at b7bb8699.
- What changed:
b7bb8699..bb1777e0is one commit (fix(cli): keep the lock check private) that sits directly on the approved head. It changespackages/cli/src/browser/manager.tsonly:isLockedFileErroris no longer exported, which clears the Fallowunused-exportfinding.- Its doc comment now says a real permission error is retried too, then thrown. That covers nit 2 from my earlier review.
- Tests: No test imported
isLockedFileError, and the tests still reach it throughretryWhileLocked. The 6 tests named on the "fails without the fix:" line are unchanged. - CI: Every Actions workflow at this head has passed: CI, regression, preview-regression, Windows render verification, CodeQL, Player perf and PR captures.
There was a problem hiding this comment.
Approve at bd67aa70. This re-reviews my approval at bb1777e0.
bb1777e0..bd67aa70 is one commit (chore(cli): wrap the lock-check comment) that sits directly on the approved head. Its only change is to split the isLockedFileError doc comment across two lines in packages/cli/src/browser/manager.ts. No code changed, and the tests and the "fails without the fix:" line are unchanged.
CI at this head when I reviewed: regression, Player perf, PR captures and Comments had passed. CI, CodeQL, Windows render verification and preview-regression were still running.
…eview Adopts heygen-com#7199 (delivery-PCM duration normalization), heygen-com#7194 (browser install retries while Windows holds a file), the Studio marquee and timeline range-selection series, waapi initial-state, lint media and CLI check/contrast fixes, and skills docs. Not adopted with ledger reasons: heygen-com#7203, heygen-com#7207, heygen-com#7202, heygen-com#7197; limitDeliveryPeaks and the neverStyledStarts cache are left out because the fork lacks their prerequisites. Watermark advances to aa34cff / PR heygen-com#7190. Co-authored-by: WaterrrForever <miao.yang@heygen.com> Co-authored-by: Miguel Ángel <miguel.sierra@heygen.com> Co-authored-by: kevin <5299031+kevin9327@users.noreply.github.com> Co-authored-by: Jason <jason.easyai@gmail.com> Co-authored-by: cooleryu <53998515+cooleryu@users.noreply.github.com> Co-authored-by: Vincent Yip <realsharkguy@gmail.com> Co-authored-by: Vance Ingalls <vance@heygen.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
On Windows,
hyperframes browser ensure(and any render that installs the browser first) now waits a moment and tries again when a file in the install is held by another program, instead of failing at once withEBUSY,EPERMorEACCES.Why
Virus scanners and indexers open freshly unzipped files for a few seconds. The install unzips into a staging folder, then renames it into the cache. If a scanner holds a file at either step, the unzip, the cleanup of the staging folder or the rename throws, and the install gives up with "Failed to install chrome-headless-shell". Nothing retried a lock error, so people on Windows saw a browser install fail that works a few seconds later.
How
packages/cli/src/browser/manager.ts:isLockedFileError(Windows only;EBUSY,EPERM,EACCESby code or message) andretryWhileLocked, up to 5 tries with waits of 250, 500, 1000 and 2000 ms, clearing the half-written staging folder between tries.maxRetries: 3).Size
Small: one helper and two call sites in the one file that does the install.
What I measured
EBUSY,EPERMandEACCESon Windows and then succeeds, gives up after the last try, does not retry other errors, does not retry off Windows)chrome-headless-shell.exeopen for 3 s as soon as it is unzipped. Released 0.9.13:browser ensureexits 1 withEBUSY: resource busy or locked, unlink '...\.chrome-staging-...\chrome-headless-shell.exe'. This branch: the same hold,browser ensureexits 0, "Ready to render."What I did NOT exercise