fix: add actionable recovery guidance to crash info messages (#1295)
This commit is contained in:
parent
5351e776d9
commit
5660100c66
1 changed files with 15 additions and 2 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue