From 5660100c66e2cbad3ea2f24d19a994a0bf1eb9d2 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Wed, 18 Mar 2026 20:56:55 -0400 Subject: [PATCH] fix: add actionable recovery guidance to crash info messages (#1295) --- src/resources/extensions/gsd/crash-recovery.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/resources/extensions/gsd/crash-recovery.ts b/src/resources/extensions/gsd/crash-recovery.ts index e1ff26c9c..8db786026 100644 --- a/src/resources/extensions/gsd/crash-recovery.ts +++ b/src/resources/extensions/gsd/crash-recovery.ts @@ -98,11 +98,24 @@ export function isLockProcessAlive(lock: LockData): boolean { /** Format crash info for display or injection into a prompt. */ export function formatCrashInfo(lock: LockData): string { - return [ + const lines = [ `Previous auto-mode session was interrupted.`, ` Was executing: ${lock.unitType} (${lock.unitId})`, ` Started at: ${lock.unitStartedAt}`, ` Units completed before crash: ${lock.completedUnits}`, ` PID: ${lock.pid}`, - ].join("\n"); + ]; + + // Add recovery guidance based on what was happening when it crashed + if (lock.unitType === "starting" && lock.unitId === "bootstrap" && lock.completedUnits === 0) { + lines.push(`No work was lost. Run /gsd auto to restart.`); + } else if (lock.unitType.includes("research") || lock.unitType.includes("plan")) { + lines.push(`The ${lock.unitType} unit may be incomplete. Run /gsd auto to re-run it.`); + } else if (lock.unitType.includes("execute")) { + lines.push(`Task execution was interrupted. Run /gsd auto to resume — completed work is preserved.`); + } else if (lock.unitType.includes("complete")) { + lines.push(`Slice/milestone completion was interrupted. Run /gsd auto to finish.`); + } + + return lines.join("\n"); }