Repository navigation
fix(install): fetch the skills CLI with npm so npx never takes its lock - #978
Merged
2 commits merged intoOct 15, 2026
Merged
2 commits merged into
2 commits merged into
Conversation
An npx that installs a package holds a lock on its cache folder, and npm before 11.6.3, the npm Node.js 24.13 ships, reports that lock compromised (ECOMPROMISED) whenever the file system answers slowly: overlapping touch timers read a stale mtime (npm/cli#8710). The fresh-cache retry could not help, since the lock, not a cache entry, was the cause, and run 38628936476 failed after it. npm's install takes no such lock, so the npm beside the npx now installs the pinned skills CLI into a folder of the install's own, and npx runs it from that folder with --no, never installing a package itself. The fresh-cache retry goes, and the Install workflow names a failed fetch of the CLI itself.
The skills CLI is fetched by the npm beside the npx, and where there is none the fetch was tried again after a wait, though a missing program never appears on a second try. Such a session, as a test's with only a stand-in npx, now reports the skills' Node.js prerequisite at once, as it does when npx itself is missing, and waits for nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #888
Why
The skill fetch in
install.ps1failed withnpm error code ECOMPROMISED("Lock compromised"), even after its retry with a fresh npm cache.The fresh cache could not help, because the cache was never the cause.
ECOMPROMISEDcomes from one place in npm:libnpmexec/lib/with-lock.js.That is the lock
npxholds on its_npx/<hash>/concurrency.lockfolder while it installs a package into its cache.In npm before 11.6.3 the lock checks itself on a
setInterval.When one
fs.statis slow, which happens on a busy runner or while Defender scans, the next check overlaps it and reads a stale mtime, and npm calls the lock compromised.This is npm/cli#8710, fixed by npm/cli#8733 in npm 11.6.3.
Node.js 24.13.0, which the Install workflow sets up and which many users run, ships npm 11.6.2.
What changes
The fix makes the skill fetch survive the lock failure by never taking the lock.
The workflow still fails a job whose fetch really failed.
npxinstalls the pinned skills CLI withnpm install --prefix <its own temp folder> skills@1.7.1.npm's install takes no such lock.
npx --no skills@1.7.1 add ...runs each skill from that folder.--nomeans npx never installs a package itself, so it never reaches the locked path.npx finds the CLI in the folder it runs in.
I checked this by hand: with the CLI in place, npx ran it and wrote nothing to
_npx, and in an empty folder it refused with "npx canceled due to missing packages".If it fails twice, every skill is named in the install's closing note and npx never runs.
Before, that case would have fallen through to "its log does not say the fetch failed".
Test plan
TestOneLineInstallAddsSkillsWithoutNpxInstallingAPackagefails on the oldinstall.ps1and passes on the fix.In this test, the stand-in npx fails with
ECOMPROMISEDwhenever it would install the CLI itself.TestOneLineInstallNamesEverySkillWhenTheSkillsCliCannotBeFetched(new),TestOneLineInstallTriesASkillAgainAndNamesOneThatStillFails,TestOneLineInstallRefusesALavishDownloadThatDoesNotMatchItsPinandTestTheInstallPinsEveryPackageItFetchesFromNpmpass locally, run by name.go vet ./internal/installscriptis clean.