Repository navigation
fix(libnpmexec): fix lock compromise logic - #8733
Merged
Merged
Conversation
Contributor
Author
I suspect this may not be due to any underlying bugs in |
owlstronaut
approved these changes
Nov 18, 2025
owlstronaut
left a comment
There was a problem hiding this comment.
Makes sense. Thanks for the contribution!
Merged
Bewinxed
added a commit
to Bewinxed/cawco
that referenced
this pull request
Oct 19, 2026
…ith node: no session waits on npx's lock npx 11.19.1 takes <cache>/_npx/<hash>/concurrency.lock on every start (libnpmexec index.js `withLock(lockPath, ...)`), waits on it forever, and removes it only from signal-exit, which a SIGKILL never runs; the next npx waits until the lock is `staleThreshold = 60_000` ms old, the MCP SDK's own initialize timeout. Boundaries end sandboxes with SIGKILL and every workspace shares one npm cache, so one killed session held every other session's browser tool for a minute. npm 12.2.0 keeps it (npm/cli#8733 accepts the wait). The fleet sync now installs each npx row's package at its exact version (`latest` and ranges read from the registry at the sync) with npm into <data>/cawco/fleet-mcp/<name>@<version>, through a staging dir renamed whole, and every harness launches its bin with node. A failed install makes the row failed with npm's own sentence; an npx line that is not one registry package is refused in words. npm is npm's, never a Bun alias (the 1e63e6e rule, moved from npx to npm). The install dir is read-only to every workspace (fleetSyncedPaths). An install no row names retires once the sessions live when it was superseded have ended and no process holds its held file open: node preloads it (--require) and it opens itself, since a server may rename its process (chrome-devtools-mcp sets process.title) and XNU omits a code-restricted process's environment from ps -E. Looked at again each 60 s while in use, and at every session's end. browser-shield and browser-cutover pin no npm cache; browser-gate PUTs the fleet row and launches the entry the sync wrote. New spec fleet-mcp-install. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fix a race condition in
withLockwhere a slowfs.statcall could result in an ECOMPROMISED false positive. Due to the usage ofsetInterval, one callback could mutatemtimejust before an overlapping callback'sfs.statpromise has resolved, causing a mismatch. By switching tosetTimeout, we ensure that we don't have overlapping callbacks and incorrect values.Additionally bump the stale threshold higher, to reduce the likelihood of another caller taking over a seemingly-stale-but-actually-active lock. Under Windows in particular,
fs.stathas been observed to sometimes take over 20 seconds, so we should err on the side of a higher threshold before we judge a lock as stale. The minor potential downside is that we might wait longer before taking over a stale lock, but lock takeover is already a very exceptional case (i.e. it would typically only happen if another process was SIGKILLed while holding the same lock)Testing Notes
npx --yes jest --versionReferences
Fixes #8710