diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 4fa921f443..206f9b4640 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1204,6 +1204,37 @@ export const ChatRowContent = ({ return case "user_edit_todos": return {}} /> + case "browser_action_result": + // This should not normally be rendered here as browser_action_result messages + // should be grouped into browser sessions and rendered by BrowserSessionRow. + // If we see this, it means the message grouping logic has a bug. + return ( + <> + {title && ( +
+ {icon} + {title} +
+ )} +
+
+ ⚠️ Browser action result not properly grouped - this is a bug in the message + grouping logic +
+ +
+ + ) default: return ( <> diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 9b8c96dea1..3b3dc6f55d 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -1265,6 +1265,18 @@ const ChatViewComponent: React.ForwardRefRenderFunction { + // Special handling for browser_action_result - ensure it's always in a browser session + if (message.say === "browser_action_result" && !isInBrowserSession) { + isInBrowserSession = true + currentGroup = [] + } + + // Special handling for browser_action - ensure it's always in a browser session + if (message.say === "browser_action" && !isInBrowserSession) { + isInBrowserSession = true + currentGroup = [] + } + if (message.ask === "browser_action_launch") { // Complete existing browser session if any. endBrowserSession() @@ -1294,12 +1306,14 @@ const ChatViewComponent: React.ForwardRefRenderFunction m.say === "browser_action") + if (lastBrowserAction) { + const browserAction = JSON.parse(lastBrowserAction.text || "{}") as ClineSayBrowserAction + if (browserAction.action === "close") { + endBrowserSession() + } } } } else {