From 4d3038a7b6c71e5871cf41a7fcbd901df0d7e1ba Mon Sep 17 00:00:00 2001 From: Nan Gao <88081804+ggnnggez@users.noreply.github.com> Date: Thu, 16 Apr 2026 02:46:47 +0200 Subject: [PATCH] fix(frontend): stop artifact panel from auto-opening on rehydrated write_file (#2278) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a page refresh, the artifact panel's autoOpen/autoSelect state is reset to true. Submitting a new question flips thread.isLoading to true, which message-list passes to every MessageGroup — including historical ones. The previous response's last write_file step then satisfies the auto-open condition and re-pops the stale artifact. Gate the auto-open on the tool call having no result yet, so only a write_file that is still streaming in the current response can trigger it; rehydrated tool calls always carry a result and are now skipped. Co-authored-by: Claude Opus 4.6 --- frontend/src/components/workspace/messages/message-group.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/workspace/messages/message-group.tsx b/frontend/src/components/workspace/messages/message-group.tsx index c80d236de..d850757b6 100644 --- a/frontend/src/components/workspace/messages/message-group.tsx +++ b/frontend/src/components/workspace/messages/message-group.tsx @@ -336,7 +336,7 @@ function ToolCall({ description = t.toolCalls.writeFile; } const path: string | undefined = (args as { path: string })?.path; - if (isLoading && isLast && autoOpen && autoSelect && path) { + if (isLoading && isLast && autoOpen && autoSelect && path && !result) { setTimeout(() => { const url = new URL( `write-file:${path}?message_id=${messageId}&tool_call_id=${id}`,