Skip to content

Commit a5fbdeb

Browse files
alpslaclaude
andcommitted
fix(report): Add dynamic model lookup for Agent Performance table (BUG #6)
Fixed the Agent Performance metadata section showing "N/A" in the Model column. Problem: - agentPerformance metadata from base-tool-orchestrator.ts doesn't include model info - AI enrichment doesn't track which models were used per agent - Agent Performance table showed "N/A" for all agents Solution: - Added dynamic model lookup in v9-grouped-report-formatter.ts - Extract role from agent name (e.g., "Security Agent" → "security") - Call modelConfigResolver.getCachedConfiguration() to get model config - Use primary_model from configuration - Fallback to "N/A" if lookup fails Changes: - Agent Performance table generation (lines 3721-3741) - Agent Efficiency Ranking calculation (lines 3786-3804) This completes the 4-bug fix series: ✅ BUG #3: Checkstyle severity normalization ✅ BUG #4: Greeting with @username ✅ BUG #5: Dependency-check files scanned count ✅ BUG #6: Agent Performance model column 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent eed246b commit a5fbdeb

1 file changed

Lines changed: 45 additions & 2 deletions

File tree

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

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3717,7 +3717,29 @@ Continue following best practices and consider integrating static analysis into
37173717
const costValue = agent.cost || 0;
37183718
// Check for zero cost (including 0, 0.0, 0.00, etc.) or very small values
37193719
const cost = (costValue === 0 || costValue < 0.0001) ? 'FREE' : '$' + costValue.toFixed(4);
3720-
const model = agent.model || 'N/A';
3720+
3721+
// BUG #6 FIX: Lookup model dynamically if not provided in metadata
3722+
let model = agent.model || 'N/A';
3723+
if (model === 'N/A' && this.modelConfigResolver) {
3724+
// Extract role from agent name (e.g., "Security Agent" → "security")
3725+
const agentName = (agent.name || agent.agent || '').toLowerCase();
3726+
let role = 'code_quality'; // default
3727+
if (agentName.includes('security')) role = 'security';
3728+
else if (agentName.includes('performance')) role = 'performance';
3729+
else if (agentName.includes('architecture')) role = 'architecture';
3730+
else if (agentName.includes('dependencies') || agentName.includes('dependency')) role = 'dependency';
3731+
3732+
try {
3733+
// Synchronously get cached model config (avoid await in forEach)
3734+
const modelConfig = this.modelConfigResolver.getCachedConfiguration?.(role, this.detectedLanguage, this.detectedRepoSize);
3735+
if (modelConfig?.primary_model) {
3736+
model = modelConfig.primary_model;
3737+
}
3738+
} catch (e) {
3739+
// Silently fall back to N/A if lookup fails
3740+
}
3741+
}
3742+
37213743
content += `| ${agent.name || agent.agent} | ${model} | ${agent.filesAnalyzed || agent.files || 'N/A'} | ${issues} | ${time} | ${cost} |\n`;
37223744
});
37233745
}
@@ -3760,9 +3782,30 @@ Continue following best practices and consider integrating static analysis into
37603782
const time = agent.duration || 1;
37613783
const costPerIssue = issues > 0 ? cost / issues : Number.POSITIVE_INFINITY;
37623784
const issuesPerSec = (issues / time) * 1000;
3785+
3786+
// BUG #6 FIX: Lookup model dynamically if not provided in metadata
3787+
let model = agent.model || 'N/A';
3788+
if (model === 'N/A' && this.modelConfigResolver) {
3789+
const agentName = (agent.name || agent.agent || '').toLowerCase();
3790+
let role = 'code_quality';
3791+
if (agentName.includes('security')) role = 'security';
3792+
else if (agentName.includes('performance')) role = 'performance';
3793+
else if (agentName.includes('architecture')) role = 'architecture';
3794+
else if (agentName.includes('dependencies') || agentName.includes('dependency')) role = 'dependency';
3795+
3796+
try {
3797+
const modelConfig = this.modelConfigResolver.getCachedConfiguration?.(role, this.detectedLanguage, this.detectedRepoSize);
3798+
if (modelConfig?.primary_model) {
3799+
model = modelConfig.primary_model;
3800+
}
3801+
} catch (e) {
3802+
// Silently fall back to N/A
3803+
}
3804+
}
3805+
37633806
return {
37643807
name: agent.name || agent.agent,
3765-
model: agent.model || 'N/A',
3808+
model,
37663809
issues,
37673810
cost,
37683811
costPerIssue,

0 commit comments

Comments
 (0)