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

Co-authored-by: noamzbr <noamzbr@users.noreply.github.com>
This commit is contained in:
Noam Bressler 2025-12-22 05:13:11 +02:00 committed by GitHub
parent 4f73d58031
commit d4b7f75ce3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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") {