diff --git a/src/ai/claude-executor.ts b/src/ai/claude-executor.ts index bd194e2d..bcd4e59f 100644 --- a/src/ai/claude-executor.ts +++ b/src/ai/claude-executor.ts @@ -181,6 +181,15 @@ export async function validateAgentOutput( console.log(chalk.green(` Validation passed: Required files/structure present`)); } else { console.log(chalk.red(` Validation failed: Missing required deliverable files`)); + // Log which file is expected for common agents to help with debugging + const expectedFiles: Record = { + 'pre-recon': 'deliverables/code_analysis_deliverable.md', + 'recon': 'deliverables/recon_deliverable.md', + 'report': 'deliverables/comprehensive_security_assessment_report.md', + }; + if (agentName && expectedFiles[agentName]) { + console.log(chalk.yellow(` Expected file: ${sourceDir}/${expectedFiles[agentName]}`)); + } } return validationResult; diff --git a/src/temporal/activities.ts b/src/temporal/activities.ts index 90572b03..c5716378 100644 --- a/src/temporal/activities.ts +++ b/src/temporal/activities.ts @@ -229,8 +229,18 @@ async function runAgentActivity( // Limit output validation retries (unlikely to self-heal) if (attemptNumber >= MAX_OUTPUT_VALIDATION_RETRIES) { + // Build helpful troubleshooting message + const troubleshootingTips = agentName === 'pre-recon' + ? `\n\nTroubleshooting tips: + 1. Check if the repository path is accessible: ${repoPath} + 2. If using ROUTER mode, ensure the model supports tool use and follows instructions well + 3. Check agent logs at: audit-logs/*/agents/${agentName}*.jsonl + 4. Try running with a different model (Claude models recommended) + 5. Ensure the target URL is reachable from the Docker container` + : ''; + throw ApplicationFailure.nonRetryable( - `Agent ${agentName} failed output validation after ${attemptNumber} attempts`, + `Agent ${agentName} failed output validation after ${attemptNumber} attempts. Required deliverable files were not created.${troubleshootingTips}`, 'OutputValidationError', [{ agentName, attemptNumber, elapsed: Date.now() - startTime }] );