From 09c6f620830f63734d66e94d2cb1c2e8bca83cd3 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Sun, 30 Nov 2025 14:42:06 -0500 Subject: [PATCH] Fix auto-retry: execute fixed code directly without posting to chat - Remove chat message posting that prevented automatic re-execution - Fixed code now executes directly using same blockElement - Simplify re-execution flow with direct recursive call - Results display in same execution results container --- templates/chat.html | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/templates/chat.html b/templates/chat.html index 6f02f81..d68239f 100644 --- a/templates/chat.html +++ b/templates/chat.html @@ -1604,20 +1604,10 @@ async function executeCodeBlock(code, blockElement, playButton) { // Update status autoFixDiv.textContent = `Code fixed! Re-executing (attempt ${currentAttempts + 1}/3)...`; - // Post the fixed code as a new message in the chat - socket.emit("chat_message", { - "username": username, - "message": `**Auto-fixed code (attempt ${currentAttempts + 1}/3):**\n\n\`\`\`${language}\n${fixData.fixed_code}\n\`\`\``, - "model": "None", - "room_name": room_name - }); - - // Wait a moment for the message to be posted - await sleep(500); - - // Re-execute with the fixed code - // Create a small delay to prevent stack overflow + // Small delay before re-execution to prevent stack overflow await sleep(200); + + // Re-execute with the fixed code (no need to post to chat, execution will show results) await executeCodeBlock(fixData.fixed_code, blockElement, playButton); return; // Exit this execution, the recursive call will handle the rest } else {