From 671fb0aa25646d81361ed21f1e72d365d2f4134f Mon Sep 17 00:00:00 2001 From: amosblomqvist Date: Wed, 2 Sep 2026 03:02:23 +0300 Subject: [PATCH] fix: backfill empty message ids in legacy transcripts + defensive key fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The persistTurn id hygiene (2d7b004) only covers NEW writes — records persisted before it still carry messages with empty SDK ids, and two of those in one transcript re-trigger the duplicate-React-key error. - data/chats: backfilled all empty ids (6 messages across 5 records, msg__ scheme matching withMessageIds). - chat.tsx: key={m.id || `m-${mi}`} on both message branches — even an unmigrated legacy record can never collide keys again. NOTE for master at merge: the master tree's data/ needs the same one-time backfill (any chat saved before the withMessageIds commit). --- components/chat.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/chat.tsx b/components/chat.tsx index 22d209d..2f1557e 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -292,10 +292,11 @@ export function Chat({ // Sub-agent delivery (wake-pipeline steer): NO message bubble — the // artifact card sits in the transcript column directly, full width // and centered like the teacher's artifacts (contracts.ts "THE ASYNC - // PROTOCOL" §4). - + // PROTOCOL" §4). Key fallback: legacy transcripts (pre id-hygiene) + // can still hold empty ids — the index keeps keys unique for them. + ) : ( - + {m.role === "user" ? ( // User text renders plain: the model's LaTeX pipeline is not