fix(store): Issue #670 realpath:false + maintainer suggestions#677
Closed
jlin53882 wants to merge 3 commits intoCortexReach:masterfrom
Closed
fix(store): Issue #670 realpath:false + maintainer suggestions#677jlin53882 wants to merge 3 commits intoCortexReach:masterfrom
jlin53882 wants to merge 3 commits intoCortexReach:masterfrom
Conversation
…ions - Add realpath:false to avoid ENOENT after stale lock cleanup - Use lockfilePath option to separate target from artifact path - Update stale cleanup to only remove directory artifacts - Keep James conservative retry settings from Issue CortexReach#415
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Apr 20, 2026
rmSync with recursive:true still calls rmdir on FILE paths (ENOTDIR). Use unlinkSync for files, rmSync for directories.
…4 mkdir Pre-creation created a FILE at lockPath. proper-lockfile v4 creates a DIRECTORY at the same path (since lockPath ends with .lock). This causes ENOTDIR when proper-lockfile tries to rmdir a file path. With realpath:false, pre-creation is no longer needed.
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.
Summary
Fix Issue #670: ENOENT from proper-lockfile.realpath() after proactive stale lock cleanup.
Incorporates maintainer feedback from #674 (comment)
Root Cause
The proactive stale lock cleanup (PR #626) deletes a stale .memory-write.lock file. When proper-lockfile subsequently tries to acquire the lock, it calls s.realpath() on the now-deleted file, resulting in ENOENT.
Fix
1. Add
ealpath: false to lockfile.lock()
ypescript const release = await lockfile.lock(this.config.dbPath, { lockfilePath: lockPath, // explicit artifact path realpath: false, // Fix #670: skip realpath() to avoid ENOENT retries: { retries: 10, factor: 2, minTimeout: 1000, // James conservative settings maxTimeout: 30000, }, stale: 10000, onCompromised: (err: unknown) => { isCompromised = true; compromisedErr = err; }, });Key changes:
ealpath: false — avoids ENOENT when stale artifact was already deleted
2. Update stale cleanup for proper-lockfile v4
ypescript if (ageMs > staleThresholdMs && stat.isDirectory()) { rmSync(lockPath, { recursive: true, force: true }); }mSync instead of unlinkSync for proper directory removal
Validation
pm run test:storage-and-schema
pm run test:core-regression
Related