diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 5602e8031e..b897337176 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -3501,7 +3501,29 @@ export class Task extends EventEmitter implements TaskLike { // Only show error and count toward mistake limit after 2 consecutive failures if (this.consecutiveNoToolUseCount >= 2) { - await this.say("error", "MODEL_NO_TOOLS_USED") + // Create diagnostic information for the details popup + const diagnosticInfo = [ + "Diagnostic Information:", + "", + `Tool Protocol: ${this._taskToolProtocol ?? "unknown"}`, + `Consecutive No-Tool-Use Count: ${this.consecutiveNoToolUseCount}`, + `Assistant Message Length: ${assistantMessage.length} characters`, + "", + "Assistant Message Content Blocks:", + this.assistantMessageContent.length > 0 + ? this.assistantMessageContent + .map( + (block, i) => + ` ${i + 1}. Type: ${block.type}${block.type === "text" ? `, Length: ${(block as any).content?.length ?? 0} chars` : ""}`, + ) + .join("\n") + : " (none)", + "", + "Raw Assistant Message:", + assistantMessage || "(empty)", + ].join("\n") + + await this.say("error", `MODEL_NO_TOOLS_USED\n${diagnosticInfo}`) // Only count toward mistake limit after second consecutive failure this.consecutiveMistakeCount++ } diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index e36ef2811b..ac63df6b6b 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1310,27 +1310,47 @@ export const ChatRowContent = ({ ) case "error": // Check if this is a model response error based on marker strings from backend - const isNoToolsUsedError = message.text === "MODEL_NO_TOOLS_USED" - const isNoAssistantMessagesError = message.text === "MODEL_NO_ASSISTANT_MESSAGES" + // The format is "MARKER\nDiagnostic Info" where diagnostic info is optional + const messageText = message.text || "" + const isNoToolsUsedError = messageText.startsWith("MODEL_NO_TOOLS_USED") + const isNoAssistantMessagesError = messageText.startsWith("MODEL_NO_ASSISTANT_MESSAGES") if (isNoToolsUsedError) { + // Extract diagnostic info if present (after the marker and newline) + const parts = messageText.split("\n") + const diagnosticInfo = parts.length > 1 ? parts.slice(1).join("\n") : undefined + + // Combine i18n detailed explanation with diagnostic info + const fullDetails = diagnosticInfo + ? `${t("chat:modelResponseErrors.noToolsUsedDetails")}\n\n${diagnosticInfo}` + : t("chat:modelResponseErrors.noToolsUsedDetails") + return ( ) } if (isNoAssistantMessagesError) { + // Extract diagnostic info if present (after the marker and newline) + const parts = messageText.split("\n") + const diagnosticInfo = parts.length > 1 ? parts.slice(1).join("\n") : undefined + + // Combine i18n detailed explanation with diagnostic info + const fullDetails = diagnosticInfo + ? `${t("chat:modelResponseErrors.noAssistantMessagesDetails")}\n\n${diagnosticInfo}` + : t("chat:modelResponseErrors.noAssistantMessagesDetails") + return ( ) }