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
This commit is contained in:
Russell Ballestrini 2025-11-30 14:42:06 -05:00
parent 52cb0e4fdf
commit 09c6f62083

View file

@ -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 {