fix(util): bound npm installs with a configurable timeout - #41936
fix(util): bound npm installs with a configurable timeout#41936Robin1987China wants to merge 1 commit into
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Friendly heads-up on the pr-standards bot comment: this PR's description does link an issue — #41934 exists, is open, and describes exactly this fix (unguarded |
Issue for this PR
Closes #41934
Type of change
What does this PR do?
Npm.reify(Arborist) currently runs with no timeout and no retry. With a cold cache and a slow or wedged registry, the install can hang indefinitely, blocking whatever path awaits the plugin/package load (PluginSupervisor.loadwaits onnpm.add, and startup config dependency installs wait onNpm.install). This is the same unguarded-install mechanism as V1 issues #31463 (open) and #33905 (closed as a mis-triage, left untracked).This PR bounds every
reifywithEffect.timeout, defaulting to npm's own fetch-timeout default (300s) and configurable viaOPENCODE_NPM_INSTALL_TIMEOUT. Timeouts surface asInstallFailedErrorwith the package and install directory, and a diagnostic log is emitted on any install failure.How did you verify your code works?
packages/util/test/npm.test.ts:InstallFailedErrorafter the configured timeoutfile:dependency install still succeeds (no regression on the normal path)bun test(packages/util) — 9 passtsgo --noEmit(packages/util) — cleanChecklist