diff --git a/packages/opencode/src/session/processor.ts b/packages/opencode/src/session/processor.ts index 38dac41b05..a0eaf2b50e 100644 --- a/packages/opencode/src/session/processor.ts +++ b/packages/opencode/src/session/processor.ts @@ -48,8 +48,8 @@ export namespace SessionProcessor { needsCompaction = false const shouldBreak = (await Config.get()).experimental?.continue_loop_on_deny !== true while (true) { + let currentText: MessageV2.TextPart | undefined try { - let currentText: MessageV2.TextPart | undefined let reasoningMap: Record = {} const stream = await LLM.stream(streamInput) @@ -385,6 +385,15 @@ export namespace SessionProcessor { SessionStatus.set(input.sessionID, { type: "idle" }) } } + if (currentText) { + currentText.text = currentText.text.trimEnd() + currentText.time = { + start: currentText.time?.start ?? Date.now(), + end: Date.now(), + } + await Session.updatePart(currentText) + currentText = undefined + } if (snapshot) { const patch = await Snapshot.patch(snapshot) if (patch.files.length) {