fix: Perform snapshot in cases finish-step is not reached (#5912)

Co-authored-by: noamzbr <noamzbr@users.noreply.github.com>
thinking-toggle-wip
Noam Bressler 2025-12-22 05:13:11 +02:00 committed by Aiden Cline
parent 6fe028dd21
commit a8f5e69ede
1 changed files with 14 additions and 0 deletions

View File

@ -365,6 +365,20 @@ export namespace SessionProcessor {
error: input.assistantMessage.error,
})
}
if (snapshot) {
const patch = await Snapshot.patch(snapshot)
if (patch.files.length) {
await Session.updatePart({
id: Identifier.ascending("part"),
messageID: input.assistantMessage.id,
sessionID: input.sessionID,
type: "patch",
hash: patch.hash,
files: patch.files,
})
}
snapshot = undefined
}
const p = await MessageV2.parts(input.assistantMessage.id)
for (const part of p) {
if (part.type === "tool" && part.state.status !== "completed" && part.state.status !== "error") {