fix: preserve explicit interrupted-session resume mode

Pass paused step-mode metadata through guided resume actions and tighten source
coverage around stale paused-session handling so the interrupted-session flow
matches the selected resume mode.
This commit is contained in:
Derek Pearson 2026-03-21 13:41:22 -04:00
parent 33564894cf
commit 2b4e78d9ab
3 changed files with 18 additions and 3 deletions

View file

@ -894,7 +894,10 @@ export async function showSmartEntry(
],
});
if (resume === "resume") {
await startAuto(ctx, pi, basePath, false, { interrupted });
await startAuto(ctx, pi, basePath, false, {
interrupted,
step: interrupted.pausedSession?.stepMode ?? false,
});
return;
}
}

View file

@ -128,6 +128,17 @@ test("direct /gsd auto stale paused-session metadata is treated as stale when no
}
});
test("direct /gsd auto source only resumes paused-session metadata for recoverable state with real recovery signals", async () => {
const source = await import(`node:fs/promises`).then((fs) =>
fs.readFile(new URL("../auto.ts", import.meta.url), "utf-8")
);
assert.ok(source.includes('freshStartAssessment.classification === "recoverable"'));
assert.ok(source.includes('freshStartAssessment.hasResumableDiskState'));
assert.ok(source.includes('|| !!freshStartAssessment.recoveryPrompt'));
assert.ok(source.includes('|| !!freshStartAssessment.lock'));
assert.ok(!source.includes('freshStartAssessment.classification === "recoverable"\n || freshStartAssessment.hasResumableDiskState'));
});
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");

View file

@ -137,12 +137,13 @@ test("guided-flow stale paused-session scenario is suppressed when no resumable
}
});
test("guided-flow source uses step-aware resume label and shared assessment", () => {
test("guided-flow source uses step-aware resume label and passes step mode into startAuto", () => {
const source = readFileSync(join(import.meta.dirname, "..", "guided-flow.ts"), "utf-8");
assert.ok(source.includes('const interrupted = await assessInterruptedSession(basePath);'));
assert.ok(source.includes('if (interrupted.classification === "running")'));
assert.ok(source.includes('if (interrupted.classification === "stale")'));
assert.ok(source.includes('resumeLabel = interrupted.pausedSession?.stepMode'));
assert.ok(source.includes('"Resume with /gsd next"'));
assert.ok(source.includes('await startAuto(ctx, pi, basePath, false, { interrupted });'));
assert.ok(source.includes('step: interrupted.pausedSession?.stepMode ?? false'));
assert.ok(!source.includes('await startAuto(ctx, pi, basePath, false, { interrupted });'));
});