Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/resources/extensions/gsd/interrupted-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ export async function assessInterruptedSession(
? existsSync(pausedSession.worktreePath)
: false;
const assessmentBasePath = worktreeExists ? pausedSession!.worktreePath! : basePath;
const rawLock = readCrashLock(basePath);
const lock = rawLock && rawLock.pid !== process.pid ? rawLock : null;
const lock = readCrashLock(basePath);

if (!lock && !pausedSession) {
return {
Expand All @@ -146,7 +145,7 @@ export async function assessInterruptedSession(
};
}

if (lock && isLockProcessAlive(lock)) {
if (lock && lock.pid !== process.pid && isLockProcessAlive(lock)) {
return {
classification: "running",
lock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ test("direct /gsd auto source only resumes paused-session metadata for recoverab
assert.ok(source.includes('|| !!freshStartAssessment.lock'));
});

test("interrupted-session source preserves raw lock and excludes same-pid from running classification", async () => {
const source = await import(`node:fs/promises`).then((fs) =>
fs.readFile(new URL("../interrupted-session.ts", import.meta.url), "utf-8")
);
assert.ok(source.includes('const lock = readCrashLock(basePath);'));
assert.ok(source.includes('if (lock && lock.pid !== process.pid && isLockProcessAlive(lock)) {'));
});

test("auto module imports successfully after interrupted-session changes", async () => {
const mod = await import(`../auto.ts?ts=${Date.now()}-${Math.random()}`);
assert.equal(typeof mod.startAuto, "function");
Expand Down
Loading