From d79a9c811743bfb9eecdcd4d2c819032a834d8ed Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Sun, 30 Nov 2025 14:31:50 -0500 Subject: [PATCH] Add debug logging for code execution auto-fix retry logic --- templates/chat.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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');