Skip to content

Commit dfb833f

Browse files
alpslaclaude
andcommitted
fix(v9): Process ALL issues including EXISTING_REST with caching
Previously I incorrectly filtered out EXISTING_REST issues entirely. The correct approach is to process ALL issues but use caching to avoid duplicate AI calls: 1. Group ALL issues by rule:tool:language 2. Generate AI fix for first issue in each group 3. Apply cached fix to all issues in same group 4. EXISTING_REST issues with same rule as NEW issues share the fix This ensures: - All issues get fixes (not just actionable ones) - AI calls are minimized through caching - Re-runs use cached patterns from KB Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent cf0a7cd commit dfb833f

2 files changed

Lines changed: 15 additions & 22 deletions

File tree

packages/agents/src/two-branch/analyzers/v9-report-formatter.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -663,18 +663,12 @@ ${Object.entries(categoryCounts).map(([cat, count]) =>
663663
}
664664

665665
private async formatIssueWithEducation(issue: Issue, severity: string): Promise<string> {
666-
// SESSION 92: Use pre-generated fix if available, skip AI for EXISTING_REST
666+
// SESSION 92 FIX: Use pre-generated fix if available from enrichWithAI cache
667+
// All issues (including EXISTING_REST) should have fixes
667668
let fixSuggestion = (issue as any).fixSuggestion;
668669

669-
// Only generate new fix if:
670-
// 1. No pre-existing fix, AND
671-
// 2. Issue is actionable (NEW or EXISTING_MODIFIED based on category)
672-
// Note: category is set during two-branch comparison and indicates actionability
673-
const issueCategory = (issue as any).category as string | undefined;
674-
const isActionable = issueCategory !== 'EXISTING_REST' && issueCategory !== 'RESOLVED' &&
675-
(issueCategory === 'NEW' || issueCategory === 'EXISTING_MODIFIED' || !issueCategory);
676-
677-
if (!fixSuggestion && isActionable) {
670+
// Generate fix only if not already cached from enrichWithAI
671+
if (!fixSuggestion) {
678672
fixSuggestion = await this.generateDynamicFix(issue);
679673
}
680674

packages/agents/src/two-branch/api/v9-analysis-service.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -657,19 +657,18 @@ export class V9AnalysisService {
657657
): Promise<EnrichedIssue[]> {
658658
console.log(`🤖 Step 4: AI Enrichment\n`);
659659

660-
// SESSION 92: Only enrich actionable issues (NEW + EXISTING_MODIFIED)
661-
// Skip EXISTING_REST as they exist unchanged in both branches - not relevant for PR review
662-
const actionableIssues = issues.filter(i =>
663-
i.category === 'NEW' || i.category === 'EXISTING_MODIFIED'
664-
);
665-
const skippedCount = issues.length - actionableIssues.length;
666-
667-
if (skippedCount > 0) {
668-
console.log(` ℹ️ Skipping ${skippedCount} EXISTING_REST issues (not relevant for PR review)`);
669-
}
660+
// SESSION 92 FIX: Process ALL issues (including EXISTING_REST)
661+
// Use caching to avoid duplicate AI calls - same rule gets same fix
662+
const categoryCounts = {
663+
NEW: issues.filter(i => i.category === 'NEW').length,
664+
EXISTING_MODIFIED: issues.filter(i => i.category === 'EXISTING_MODIFIED').length,
665+
EXISTING_REST: issues.filter(i => i.category === 'EXISTING_REST').length,
666+
RESOLVED: issues.filter(i => i.category === 'RESOLVED').length
667+
};
668+
console.log(` 📊 Issues by category: NEW=${categoryCounts.NEW}, MODIFIED=${categoryCounts.EXISTING_MODIFIED}, EXISTING=${categoryCounts.EXISTING_REST}, RESOLVED=${categoryCounts.RESOLVED}`);
670669

671-
// Group only actionable issues to reduce AI calls
672-
const groupingResult = groupIssues(actionableIssues);
670+
// Group ALL issues to reduce AI calls - same rule:tool gets same fix
671+
const groupingResult = groupIssues(issues);
673672
console.log(generateGroupingSummary(groupingResult));
674673

675674
const { analyzed: priorityGroups } = prioritizeGroups(groupingResult.groups, maxAnalysis);

0 commit comments

Comments
 (0)