From d074e0eb4b7ebea1a6c4473cf2d732b184bbcf37 Mon Sep 17 00:00:00 2001 From: cmanu Date: Mon, 10 Aug 2026 08:11:27 -0700 Subject: [PATCH] fix(pr-view): Update mergeMessages to main --- .../kilo-vscode/webview-ui/src/context/session-merge.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/kilo-vscode/webview-ui/src/context/session-merge.ts b/packages/kilo-vscode/webview-ui/src/context/session-merge.ts index ac9264cf238..2a59bf0d0ad 100644 --- a/packages/kilo-vscode/webview-ui/src/context/session-merge.ts +++ b/packages/kilo-vscode/webview-ui/src/context/session-merge.ts @@ -1,7 +1,9 @@ import type { Message, MessageLoadMode, Part } from "../types/messages" import { sameParts } from "./session-parts" +import { withoutResolvedSessionErrors } from "./session-errors" export function mergeMessages(current: Message[], incoming: Message[], mode: Exclude) { + const kept = withoutResolvedSessionErrors(current, incoming) if (mode === "reconcile") { // Tail reconcile: incoming is the authoritative newest-N snapshot. // Local state may already hold some of those IDs and may also hold @@ -10,12 +12,12 @@ export function mergeMessages(current: Message[], incoming: Message[], mode: Exc // server messages land in the right position and optimistic tail // entries stay at the end. const byId = new Map() - for (const msg of current) byId.set(msg.id, msg) + for (const msg of kept) byId.set(msg.id, msg) for (const msg of incoming) byId.set(msg.id, msg) return [...byId.values()].sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()) } const seen = new Set() - const source = mode === "prepend" ? [...incoming, ...current] : incoming + const source = mode === "prepend" ? [...incoming, ...kept] : incoming return source.filter((msg) => { if (seen.has(msg.id)) return false seen.add(msg.id)