Skip to content

Commit d4b7f75

Browse files
authored
fix: Perform snapshot in cases finish-step is not reached (anomalyco#5912)
Co-authored-by: noamzbr <noamzbr@users.noreply.github.com>
1 parent 4f73d58 commit d4b7f75

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

packages/opencode/src/session/processor.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,20 @@ export namespace SessionProcessor {
365365
error: input.assistantMessage.error,
366366
})
367367
}
368+
if (snapshot) {
369+
const patch = await Snapshot.patch(snapshot)
370+
if (patch.files.length) {
371+
await Session.updatePart({
372+
id: Identifier.ascending("part"),
373+
messageID: input.assistantMessage.id,
374+
sessionID: input.sessionID,
375+
type: "patch",
376+
hash: patch.hash,
377+
files: patch.files,
378+
})
379+
}
380+
snapshot = undefined
381+
}
368382
const p = await MessageV2.parts(input.assistantMessage.id)
369383
for (const part of p) {
370384
if (part.type === "tool" && part.state.status !== "completed" && part.state.status !== "error") {

0 commit comments

Comments
 (0)