Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/ai/claude-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> = {
'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;
Expand Down
12 changes: 11 additions & 1 deletion src/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }]
);
Expand Down