diff --git a/templates/chat.html b/templates/chat.html
index 903c35d..ceee658 100644
--- a/templates/chat.html
+++ b/templates/chat.html
@@ -1558,6 +1558,13 @@ async function executeCodeBlock(code, blockElement, playButton) {
const stderr = job.stderr || '';
const shouldAutoFix = exitCode !== 0 && stderr.trim() !== '';
+ console.log('[DEBUG] Code execution completed:', {
+ exitCode,
+ hasStderr: !!stderr,
+ shouldAutoFix,
+ stderr: stderr.substring(0, 100)
+ });
+
// Track attempts per code block (store in resultsContainer dataset)
if (!resultsContainer.dataset.fixAttempts) {
resultsContainer.dataset.fixAttempts = '0';
@@ -1565,6 +1572,12 @@ async function executeCodeBlock(code, blockElement, playButton) {
const currentAttempts = parseInt(resultsContainer.dataset.fixAttempts);
+ console.log('[DEBUG] Auto-fix decision:', {
+ shouldAutoFix,
+ currentAttempts,
+ willAttemptFix: shouldAutoFix && currentAttempts < 3
+ });
+
if (shouldAutoFix && currentAttempts < 3) {
// Show auto-fix message
const autoFixDiv = document.createElement('div');