fix: recover from malformed instance lock files

Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-03-18 15:19:45 +00:00
committed by Haze
parent 5a4c63f7f3
commit 6d79a4f881
2 changed files with 19 additions and 1 deletions

View File

@@ -76,7 +76,9 @@ export function acquireProcessInstanceFileLock(
}
ownerPid = readLockOwnerPid(lockPath);
if (ownerPid && !isPidAlive(ownerPid) && existsSync(lockPath)) {
const shouldTreatAsStale =
ownerPid === undefined || !isPidAlive(ownerPid);
if (shouldTreatAsStale && existsSync(lockPath)) {
try {
rmSync(lockPath, { force: true });
continue;