-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(cli): close stale-lock cleanup race in acquireOnboardLock (#1281) #1656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ericksoa
merged 5 commits into
NVIDIA:main
from
ColinM-sys:fix/1281-onboard-lock-stale-cleanup-race
Apr 16, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fb9ea42
fix(cli): close stale-lock cleanup race in acquireOnboardLock
ColinM-sys 19219a3
fix(cli): hold lock fd for ownership verification on release
ColinM-sys 88a995a
Merge branch 'main' into fix/1281-onboard-lock-stale-cleanup-race
prekshivyas 6629df6
fix(test): swap lock before stat #2 so unlinkIfInodeMatches is exercised
prekshivyas 08a1df2
Merge branch 'main' into fix/1281-onboard-lock-stale-cleanup-race
prekshivyas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Check the file exists and read the relevant section head -n 5 src/lib/onboard-session.tsRepository: NVIDIA/NemoClaw
Length of output: 269
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 932
🏁 Script executed:
# Check for SPDX header compliance head -n 5 src/lib/onboard-session.tsRepository: NVIDIA/NemoClaw
Length of output: 269
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 6028
🌐 Web query:
Node.js fs.writeFileSync file descriptor parameter usage💡 Result:
In
fs.writeFileSync(file, data[, options]), the first argument is not a special “fd parameter”—it’s thefileparameter, and it can be either:string | Buffer | URL), orinteger) you previously opened withfs.openSync()(or received elsewhere). (nodejs.org)Using a file descriptor (fd)
Key behaviors when
fileis an fd:fs.write()(Node even recommends usingfs.write()for the fd case). (nodejs.org)Citations:
🌐 Web query:
Node.js fs.writeSync short write behavior regular files💡 Result:
fs.writeSync()can legally perform a short write (return a value< length) even whenfdrefers to a regular file.fs.writeSync(...)returns “the number of bytes written” (it does not promise to write the full requested length). If it returnsn, only the firstnbytes were written and you must write the remainder yourself if you need “write all”. [1]write(2)may write fewer thancountbytes for reasons such as insufficient space, process file-size limits (RLIMIT_FSIZE), or being interrupted by a signal after writing some bytes. [2]Practical guidance: if you need a “guaranteed full write”, loop until all bytes are written (or an exception is thrown), even for regular files.
Sources: [1] Node.js
fs.writeSyncdocs, [2] Linuxwrite(2)semantics.Ensure
fs.writeSync()writes the full payload in a single call, or loop until all bytes are written.fs.writeSync(fd, payload)can return fewer bytes than requested, leaving the JSON truncated. For the lock mechanism to function correctly, the entire payload must be written atomically. The suggestedfs.writeFileSync()has identical short-write behavior on file descriptors and does not solve this.Either ensure the payload fits in a single
fs.writeSync()call (it does at ~150–300 bytes, but this is not guaranteed across all platforms and configurations), or loop until all bytes are written:Alternatively, use a platform-safe wrapper if the codebase has one.
🤖 Prompt for AI Agents