Add debug logging for code execution auto-fix retry logic

This commit is contained in:
Russell Ballestrini 2025-11-30 14:31:50 -05:00
parent 54be0761af
commit d79a9c8117

View file

@ -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');