fix(coding-agent): explain clone failure for unsaved sessions

This commit is contained in:
Armin Ronacher
2026-07-16 19:05:27 +02:00
parent a01baaaea7
commit b97ed20210
2 changed files with 18 additions and 0 deletions
@@ -306,6 +306,11 @@ export class AgentSessionRuntime {
return { cancelled: false, selectedText };
}
if (!existsSync(currentSessionFile)) {
throw new Error(
"This session has not been saved yet. Wait for the first assistant response before cloning or forking it.",
);
}
const sessionManager = SessionManager.open(currentSessionFile, sessionDir);
const forkedSessionPath = sessionManager.createBranchedSession(targetLeafId);
if (!forkedSessionPath) {