From 6cc4258d75c5f4cfded192d2b3708e171b9cd32a Mon Sep 17 00:00:00 2001 From: Liam Hetherington Date: Wed, 11 Feb 2026 09:46:54 +0000 Subject: [PATCH] Show undo/redo controls even when builder output is empty --- chat/public/builder.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/chat/public/builder.js b/chat/public/builder.js index 4e18ddb..92971f2 100644 --- a/chat/public/builder.js +++ b/chat/public/builder.js @@ -1984,7 +1984,12 @@ function renderMessages(session) { } el.chatArea.appendChild(userCard); - if (msg.reply || msg.error || (status === 'running' && msg.partialOutput)) { + const isOpencodeMsg = msg.cli === 'opencode' || msg.phase === 'build'; + const isLatestMessage = latestMessage && latestMessage.id === msg.id; + const shouldShowUndoRedo = isOpencodeMsg && isLatestMessage && (status === 'done' || status === 'error' || status === 'cancelled'); + const shouldRenderAssistantCard = msg.reply || msg.error || (status === 'running' && msg.partialOutput) || shouldShowUndoRedo; + + if (shouldRenderAssistantCard) { console.log('[RenderMessages] Creating assistant card for message:', { id: msg.id, cli: msg.cli, @@ -2015,10 +2020,6 @@ function renderMessages(session) { assistantMeta.appendChild(rawBtn); // Add Undo/Redo buttons - show for latest message when done, errored, or cancelled - const isOpencodeMsg = msg.cli === 'opencode' || msg.phase === 'build'; - const isLatestMessage = latestMessage && latestMessage.id === msg.id; - const shouldShowUndoRedo = isOpencodeMsg && isLatestMessage && (status === 'done' || status === 'error' || status === 'cancelled'); - if (shouldShowUndoRedo) { const undoBtn = document.createElement('button'); undoBtn.className = 'ghost';